Staredit Network

Staredit Network -> Modding Assistance -> DatLoader
Report, edit, etc...Posted by BroodKiller on 2006-03-13 at 07:01:36
QUOTE
Time to look at DatEdit source i guess..
Then again, since DatEdit does no reading, i am pretty much screwed.

Yeah, DatEd cannot read MPQs as of now, and this is because I'm getting errors when trying to use the SFileReadFile function. I'm pretty sure my code is correct - the whole function is like 10 lines long, so it'd be hard to make a mistake in it. Examining made me know that the Acess Violation errors I'm getting are caused by the unsigned long BytesRead pointer and the void Output pointer. The thing is that these are created right before the SFileReadFile is called, so I don't have a clue what is wrong....

ShadowFlare, can you provide me with some help on this?
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-13 at 17:33:46
Wow, i had it say it had 54 vars when it has 52.

C++ doesnt warn you when you look at illegal indexes.
k now its giving me units with size 19,592.
Report, edit, etc...Posted by DaMiNaToR on 2006-03-13 at 17:45:17
I wish I knew how to program... disgust.gif
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-14 at 16:20:12
Once you learn Javascript, its not that hard to program in any language, they all work in almost the same way.
Report, edit, etc...Posted by ShadowFlare on 2006-03-15 at 14:26:09
QUOTE(BroodKiller @ Mar 13 2006, 05:01 AM)
Yeah, DatEd cannot read MPQs as of now, and this is because I'm getting errors when trying to use the SFileReadFile function. I'm pretty sure my code is correct - the whole function is like 10 lines long, so it'd be hard to make a mistake in it. Examining made me know that the Acess Violation errors I'm getting are caused by the unsigned long BytesRead pointer and the void Output pointer. The thing is that these are created right before the SFileReadFile is called, so I don't have a clue what is wrong....

ShadowFlare, can you provide me with some help on this?
[right][snapback]444632[/snapback][/right]

Are you using storm.dll or sfmpq? If sfmpq and you used the version that is a separate download on my site, then try the dll that comes with WinMPQ and see if that helps.

Doodle77(MM): Read this, it might help: http://shadowflare.samods.org/inside_mopaq/
The section on Storm.dll is the part that you probably would want to look at. BTW, anything there will also apply to SFmpq.
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-15 at 17:04:21
I've looked at that quite a bit, before I was even using the Storm interface library before I found sfmpqapi. One problem I cant fix -
CODE

167 C:\Documents and Settings\Marcel\Desktop\DatLoader\SFmpqapi.h `__forceinline' does not name a type


I dont even know what that is.
Just a note, im using Dev-C++, which is based on Mingw.
Report, edit, etc...Posted by BroodKiller on 2006-03-16 at 02:30:12
QUOTE(ShadowFlare @ Mar 15 2006, 09:25 PM)
Are you using storm.dll or sfmpq?  If sfmpq and you used the version that is a separate download on my site, then try the dll that comes with WinMPQ and see if that helps.

I have used both SFMPQ and Stormlib, as well as Lelik's MPQAPI (or is it the same as Stormlib...:?) and I got the same error with all of them. I'll try with the WinMPQ's storm version, then...
Report, edit, etc...Posted by ShadowFlare on 2006-03-23 at 20:38:59
QUOTE(Doodle77(MM) @ Mar 15 2006, 03:03 PM)
I've looked at that quite a bit, before I was even using the Storm interface library before I found sfmpqapi. One problem I cant fix -
CODE

167 C:\Documents and Settings\Marcel\Desktop\DatLoader\SFmpqapi.h `__forceinline' does not name a type


I dont even know what that is.
Just a note, im using Dev-C++, which is based on Mingw.
[right][snapback]446193[/snapback][/right]

Use the included SFmpqapi_nolib.cpp and .h (or whatever it was called) instead of that one. The main .h and .lib files are only intended to work in Microsoft Visual C++.

ADDITION:
Heh, I've made a program that can do some things like DatLoader does, but in a different way. At the moment, I won't say the details of how it works, but it allows you to have several different files Starcraft uses to be able to get loaded from the scm/scx files. The files that can be replaced by adding them to the scm/scx file are any ones that are loaded after the map is loaded. You will just have to experiment to find which ones those are.

The program is in the form of an MPQDraft plugin. To use it, first make a map which has modified Starcraft files in it, then load MPQDraft, select Starcraft, and then add the plugin to the list of plugins.

http://shadowflare.samods.org/dwnload.html#SCMLoader

I've also made some test maps. You can try them out and see some things this can do.

http://shadowflare.samods.org/files/(8)The%20Hunters.scm
http://shadowflare.samods.org/files/(4)Space%20Battle.scx
http://shadowflare.samods.org/files/(1)Space%20Battle.scx

All three of those have the same modified files, they are just different maps.

ADDITION:
I've also uploaded a version that logs information about calls to Storm.dll from Starcraft, like parameters passed and return values. This might help some with finding memory locations for some files.

http://shadowflare.samods.org/files/SCMLoa...%20enabled).zip
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-24 at 15:32:24
much more errors now.. lots along the lines of
CODE

 multiple definition of `SFMPQAPIMODULE::~SFMPQAPIMODULE()'

I think i should go with the lib instead, I can link it in.

You beat me to the punch, no reason for me to keep working on this then.

I found the problem in my data, I have original starcraft values, so I have no Broodwar Unit Flag.
Report, edit, etc...Posted by Darktossgen(MM) on 2006-03-24 at 16:14:51
Wow! I'm still suprised. How exactly will DatMaker research HyperUnit's though? O.o
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-24 at 17:16:16
Because you can think of it this way:
When Starcraft looks up the graphic of the marine (unit 0) it looks at offset 0x6c5910 for the value.
When Starcraft looks up the graphic of Vespene Gas Tank 2 (unit 228) it looks at 0x6C59F4 (0x6c5910 + 228)
When Starcraft looks up the graphic of unit #1360 (a hyperunit) it looks at offset 0x6C5E60 ( 0x6c5910 + 1360) for the value. That value is more or less nonsense*.
Now, if you look at this line in my program -
CODE

ReadProcessMemory(process, dat_units.entries[i].memoffset + (offseter * dat_units.entries[i].size), trans, dat_units.entries[i].size, bytesread)


It multiplies the total size of the entries for that entry by the units.dat number that you want, and so to get unit #1360 you would put in 5 and iit would give you a dat that contained the stats for unit numbers 1140 - 1368.

Can someone give me a complete list of the sizes and names of a proper units.dat file, i'm going through a major 'wtf' stage now.

[sub][sub]*Actually, that is the max hits for the marine : P[/sub][/sub]
Report, edit, etc...Posted by BroodKiller on 2006-03-25 at 13:37:52
Here:
http://www.smempire.org/specs/units_dat.php

Mind you, that this is NOT a 100% correct specification, but it's the best one available. You can dig the full and correct spec out of DatEdit's source code: Check in EntryData.cpp for property names (the "Sender" parameter) and write down the numbers they add to the entry-specific offset. Then open the FileData.cpp and look for the LoadFormat routine. Look at its 'units.dat'-related part and check the 2 large arrays: offsize indicates the length of a particular property (which you will easily identify as it is the value's index number in the array) while off is the hex offset where it begins (interpreted in the same way as the above).

Although it is a bit clumsy way, it'll give you a correct result (as far as DatEdit's specs are correct, but noone has yet complained about anything from this side).
Report, edit, etc...Posted by ShadowFlare on 2006-03-27 at 20:40:08
Hmm, can DatLoader apply changes to .dat files while you are playing and have the changes take effect? If so, and if there was a way I could detect things in the map's triggers by having an MPQDraft plugin look at certain memory locations, then it may be possible to make it so the plugin loads a new .dat file (or just a section of one) for certain trigger conditions, so that a trigger could actually make major changes to a unit type while the map is running. smile.gif

Maybe something like being able to detect which switches are enabled. Maybe in a separate script included in the scm/scx it could specify which switches to monitor and what to load when the state changes.

ADDITION:
QUOTE(Doodle77(MM) @ Mar 15 2006, 03:03 PM)
I've looked at that quite a bit, before I was even using the Storm interface library before I found sfmpqapi. One problem I cant fix -
CODE

167 C:\Documents and Settings\Marcel\Desktop\DatLoader\SFmpqapi.h `__forceinline' does not name a type


I dont even know what that is.
Just a note, im using Dev-C++, which is based on Mingw.
[right][snapback]446193[/snapback][/right]

Hmm, unless you need to compare the dll version to what your program was compiled with, try removing the line that causes that error. I just used that as a way to force the function to get stored in the .lib file instead of trying to get the function from sfmpq.dll.
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-28 at 17:42:01
QUOTE(ShadowFlare @ Mar 27 2006, 08:39 PM)
Hmm, can DatLoader apply changes to .dat files while you are playing and have the changes take effect? If so, and if there was a way I could detect things in the map's triggers by having an MPQDraft plugin look at certain memory locations, then it may be possible to make it so the plugin loads a new .dat file (or just a section of one) for certain trigger conditions, so that a trigger could actually make major changes to a unit type while the map is running. smile.gif

Maybe something like being able to detect which switches are enabled. Maybe in a separate script included in the scm/scx it could specify which switches to monitor and what to load when the state changes.

Best method for this would be to monitor death counts for Vespene Gas Tank Type 2 on p1 or something (that way I dont have to mess with bit manipulation, and i can just use one death count monitoring for values from 4294960000 to 4294967296). I already have this offset so it wouldnt be so hard to implement this. Really, the first thing I need is to get DatLoader to actually work wink.gif

ADDITION:

Well, it can edit the dat files but the changes are not applied to currently-existing units. Still, this could allow you to make a hero `gain' levels. I might add some general memory editing functions too, to do something like bringing back EUD's.

How can I get the current position of the pointer in the dat file in the archive?
Report, edit, etc...Posted by ShadowFlare on 2006-03-30 at 13:51:52
QUOTE(Doodle77(MM) @ Mar 28 2006, 03:41 PM)
Well, it can edit the dat files but the changes are not applied to currently-existing units. Still, this could allow you to make a hero `gain' levels. I might add some general memory editing functions too, to do something like bringing back EUD's.

How can I get the current position of the pointer in the dat file in the archive?
[right][snapback]455028[/snapback][/right]

Do you mean for when you read it yourself or when Starcraft reads it?
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-30 at 16:47:27
When I read it.
Report, edit, etc...Posted by ShadowFlare on 2006-03-31 at 02:21:32
QUOTE(Doodle77(MM) @ Mar 28 2006, 03:41 PM)
Well, it can edit the dat files but the changes are not applied to currently-existing units. Still, this could allow you to make a hero `gain' levels. I might add some general memory editing functions too, to do something like bringing back EUD's.

How can I get the current position of the pointer in the dat file in the archive?
[right][snapback]455028[/snapback][/right]

SFileSetFilePointer returns the changed position after it is done, so you can get the current position like this:

currentposition = SFileSetFilePointer(hFile, 0, 0, FILE_CURRENT);
Report, edit, etc...Posted by Darkomni on 2006-04-01 at 12:06:35
lol! ide love to test this program whenever possible, you can find shizloads of modding stuff here!
Report, edit, etc...Posted by Doodle77(MM) on 2006-04-01 at 14:40:49
Okay, I've finished 0.1 alpha for DatLoader. Get it.[attachmentid=18097][attachmentid=18099]
Report, edit, etc...Posted by TheEvilBeaVer on 2006-04-01 at 14:51:04
QUOTE
Sorry, an error occurred. If you are unsure on how to use a feature, or don't know why you got this error message, try looking through the help files for more information.

The error returned was:

Sorry, some required files are missing, if you intended to view a topic, it's possible that it's been moved or deleted. Please go back and try again.
Report, edit, etc...Posted by Darktossgen(MM) on 2006-04-01 at 15:13:39
LMFAO, April.exe.b2k. It's an April Fools Joke! xD
Report, edit, etc...Posted by Doodle77(MM) on 2006-04-01 at 15:14:46
no, thats my APRIL build of the program.
Report, edit, etc...Posted by Voyager7456(MM) on 2006-04-01 at 15:15:58
Yeah... it works over here... Great job Doodle. biggrin.gif
Report, edit, etc...Posted by Darktossgen(MM) on 2006-04-01 at 15:16:28
I renamed it to EXE and it did nothing.
Report, edit, etc...Posted by Doodle77(MM) on 2006-04-01 at 15:17:53
geez, dont you have a halfway decent unzipping program. Its a BZ2.
Next Page (2)