Staredit Newtork
Community
StarCraft
Games
Site
Favourites
I need code.

Creator: isolatedpurity
Time: Sep 13 2007, 10:11 am

Post #1     isolatedpurity Sep 13 2007, 10:11 am

[Avatar]
and she's STILL hawt
 offline contact
I need code in C++ to take a .chk file and break it down into sections, and get the data that SEN needs (map size, tileset, description, forces, force make up (humans, computers)) and prints it out in whatever format I can break it down with in PHP. The furthest I got was seeing that TYPE exists. The more different examples I have = the better. Even if someone gives me the "perfect code", I still wouldn't mind seeing how you did it.

Code is for linux.
This post was edited 1 time, last edit by isolatedpurity: Sep 13 2007, 12:30 pm.
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top

Post #2     Fierce Sep 13 2007, 10:37 am

[Avatar]
 offline contact
You could try and get Yoshi on that, I think LW and someone else helped him with it.
Top

Post #3     isolatedpurity Sep 13 2007, 10:49 am

[Avatar]
and she's STILL hawt
 offline contact
Numerous people can do this...
I'm just not one of them :)
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top

Post #4     Falkoner Sep 13 2007, 1:07 pm

[Avatar]
Taking StarCraft Map Making to the Limit!
 online contact
Yoshi just combined OS Map into the system, ask him how it was done, that's probably the easiest way, since he's pretty much the only one who actually has the code already set up.
Top

Post #5     Doodle77[MM] Sep 13 2007, 1:42 pm

[Avatar]
 offline contact
Why do you want it in c/c++? See pack and unpack
Top

Post #6     spinesheath Sep 13 2007, 2:58 pm

[Avatar]
 offline contact
I don't have exactly the code you need (main issue: windows code), actually splitting the .chk into sections is really simple.
pseudocode:

Code

Copy the whole .chk into an array

while(not at end of file)
{
Read 4 bytes into SectionHeader
Read 4 bytes into SectionLength
if(SectionHeader == known one)
{
Copy SectionLength bytes into a predefined structure, one for each Section. Maybe add some validification
}
Set the pointer to the end of the section you dealt with just now
}




This will skip all the "sections" added for protection (don't worry, there are other means of protection), and you can easily skip a few sections that you don't need, too.
If you copy the section data into structures that have their elements in just the same order as the data in the .chk is, you can really just copy the data over after checking the SectionLength.
This "code" can also easily read multiple terrain sections properly and stuff like that.

Edit: Errmm, fix the CODE tag pls...
Top

Post #7     Mafia.Mayor Sep 13 2007, 4:32 pm

[Avatar]
The Mayor
 offline contact
Using OSMAP the program will make it so any type of protected map can be uploaded. I think that's what would be best for the database.

Also, should save a lot of trouble. Why reinvent the wheel?
My name is Inigo Montoya. You killed my father. Prepare to die.
Top

Post #8     isolatedpurity Sep 13 2007, 5:44 pm

[Avatar]
and she's STILL hawt
 offline contact
1. Osmap runs in vbasic. I do not like vbasic.
2. We do not use windows anyways.

Those php functions might be useful, thanks. I wonder if it would just be easy to parse the chk in php.l

I have it working with (a lot of) clokr_'s help. But I ran into a small problem. Hopefully by tonight I will have a script where you can upload maps and it'll attempt to break your map down.
I still wouldn't mind seeing someone else's linux code though :) .
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top

Post #9     Oo.Twitch.oO Sep 13 2007, 8:10 pm

[Avatar]
Person Of All Kinds
 online contact
Quote from isolatedpurity1. Osmap runs in vbasic. I do not like vbasic.
2. We do not use windows anyways.

Those php functions might be useful, thanks. I wonder if it would just be easy to parse the chk in php.l

I have it working with (a lot of) clokr_'s help. But I ran into a small problem. Hopefully by tonight I will have a script where you can upload maps and it'll attempt to break your map down.
I still wouldn't mind seeing someone else's linux code though :) .

Hey leave VB alone its just as good as anything :) .
Top

Post #10     spinesheath Sep 13 2007, 8:35 pm

[Avatar]
 offline contact
VB is crap. Slow as hell.
Top

Post #11     O)FaRTy1billion[MM] Sep 13 2007, 8:39 pm

[Avatar]
Remember the game! P.s.: Feldspar.
 offline contact
RexyRex may be a good person to ask about this as she has done a lot of it...

4 byte string Name, 4-byte unsigned int Length, then Length bytes. For incrementing the pointer, just do pointer+Length+8.

If you ask nicely, I may set up some simple PHP thingy to parse CHKs and get specified data from them.
This post was edited 1 time, last edit by FaRTy1billion: Sep 13 2007, 8:45 pm.
Badlands 128 Minimap Colors    I like useless tables!
Platform  95 Minimap Colors
Install   85 Minimap Colors    What is this table, you ask?
Ashworld  92 Minimap Colors    I made images that list all the
Jungle   105 Minimap Colors    tiles' minimap colors arranged
Desert   109 Minimap Colors    by tileset groups (i.e. tileset
Ice       94 Minimap Colors    index.)
Twilight  97 Minimap Colors    I could make my own SCPM...
Top

Post #12     RexyRex Sep 13 2007, 9:08 pm

[Avatar]
 offline contact
How about this?
http://75.83.16.184/sc_chk/

Choose a map then click 'session' to dump everything in memory, which is the STR and UNIT section.


Would you like the source? Using it as a guide it'd be fairly easy to follow the CHK specification here or at Maplantis and just finish it.
Top

Post #13     isolatedpurity Sep 13 2007, 9:11 pm

[Avatar]
and she's STILL hawt
 offline contact
You know... I found that website while googling around. I was like "hey... wtf... what's this... IT'S EXACTLY WHAT I'M TRYING TO DO DAMN IT!!!"
You mean, that's you? ;o
What's it written in?
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top

Post #14     RexyRex Sep 13 2007, 9:12 pm

[Avatar]
 offline contact
It's all PHP. I use WinMPQ to extract the CHK.
Top

Post #15     isolatedpurity Sep 13 2007, 9:14 pm

[Avatar]
and she's STILL hawt
 offline contact
Is that actually working off your computer? Like, is that download folder your download folder as of right now? Very sexy. Hell, we don't need SEN, we just need everyone to run that script and just link us all together ;o.

Sure, I'll love to have your source.
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top

Post #16     RexyRex Sep 13 2007, 9:25 pm

[Avatar]
 offline contact
Yeah, it's all live from my computer...

Anyway the script is still fairly incomplete. It doesn't check any of the headers and is still pretty vulnerable to certain protections. LegacyWeapon was starting to help me with that but I haven't worked on the project in ages. Also, the AJAX work was a little thrown together and sloppy. What else... It does log every visitor that at least extracts a map.

Yeah I should probably be telling you this in a PM with the source huh. TTYL :D
Top

Post #17     Falkoner Sep 13 2007, 9:52 pm

[Avatar]
Taking StarCraft Map Making to the Limit!
 online contact
OS Map 2 isn't VB, so you could use that once all the kinks are worked out.
Top

Post #18     RexyRex Sep 13 2007, 10:02 pm

[Avatar]
 offline contact
The headers you should be looking into are 'OWNR', 'ERA ', 'DIM ', 'STR ', 'SPRP', 'FORC', and maybe 'COLR'
Top

Post #19     (U)LegacyWeapon Sep 13 2007, 10:46 pm

[Avatar]
Programmer
 offline contact
Quote from FalkonerOS Map 2 isn't VB, so you could use that once all the kinks are worked out.
It's not?
(user posted image)
Top

Post #20     isolatedpurity Sep 13 2007, 11:40 pm

[Avatar]
and she's STILL hawt
 offline contact
So that's how you get all your minerals Falk... you reply to everything without even knowing what you are saying? ;o
Things to know: The squeaky wheel gets the grease
Forums are DONE. Well, done as in I'm leaving the area to do other things.
LET ME KNOW IF YOU HAVE ANY PROBLEMS. After awhile, I'll generally leave the area alone and not do any work on it until I revisit.
Currently working on: DLDB tools for the DLDB managers. Probably the DLDB in general as well.
Next in line: Message center, Mod night, Wiki
Top
Users in this topic: Guest


[08:34 pm]
lil-Inferno -- no u
[08:27 pm]
Mafia.Dark_Marine]:] -- Screw that, Its a Mike and Ike
[08:27 pm]
[Echo]:] -- Anyone ever experienced sleep paralysis? or a dream where you fall and you wake up before you die?
[08:26 pm]
[Darkling]:] -- DM, I'm going to turn you into a 3 course meal, and a carpet.
[08:26 pm]
[Darkling]:] -- O_O
[08:25 pm]
[Echo]:] -- Your color is a green Now & Later candy
[08:25 pm]
[Echo]:] -- my mix of what?
You must log in to shout.

©2003-2008 Staredit Network.
Starcraft & Starcraft II are trademarks of Blizzard Entertainment.
Site Index   |   Terms of Service   |   Privacy Policy   |   Contributions