Staredit Network

Staredit Network -> Modding Assistance -> DatLoader
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-14 at 19:33:12
I am currently working on a program called DatLoader, DatLoader is a program for loading .dat files (currently only have offsets units.dat) into the starcraft memory so as to make modding possible without requiring starcraft to be restarted with the correct mod. It is currently in the PRE-ALPHA stages, so I have not finished the program to a workable extent yet.

Planned and very possible:
Loading of .dat files into SC memory.
Support for .dat files other than units.dat .


Planned and possible:
Load the .dat from the map that is currently being played. (Found offset, and some sloppy compiling by Blizzard. tongue.gif)
Command line switch to keep going, checking every 4 seconds or so if you have loaded a different map.
Load at runtime, it checks your InstallPath for Starcraft (otherwise defaults) and runs it, then will automatically open map when you open it (need an offset that says if your in a game or not). I dont need to reload your default because starcraft does that for me.


Possible:
Support for loading iscript.bin (need to figure out how its loaded into memory).


Not planned/possible:
Loading of custom GRP's. (The only way I can think of to do this is to change the places where starcraft looks for the graphics, and hope the map is on priority right below INSTALL.exe).


DatLoader progress: [progress]25[/progress] debug debug debug debug debug!!! because of the horrible things it does! lalalalalalala!

Along with DatLoader comes DatMaker, which does the exact opposite, it takes the memory and makes .dat files. This is for research into hyperunits.
[progress]35[/progress] Coming along nicely, Theres an error somewhere in my values.
Report, edit, etc...Posted by Darktossgen(MM) on 2006-02-14 at 19:49:56
*mouth drops* So this would be kinda like EUD's, you design a Units.dat,weapons.dat,or whatever, insert it into the map, and then DatLoader takes care of the rest? Interesting... I like it >: D
Report, edit, etc...Posted by DiscipleOfAdun on 2006-02-14 at 20:04:53
Iscript.bin? Do you know how hard that is going to be? I'll tell you what. I'll look into how sc loads files like that. I know where the routine is(thanks to updating memgraft), but I don't know what it takes/returns. If I find out, I'll tell you. Other than that, you'll probably not find a way to add files of different size.

EDIT - don't take that(above) too hard. I'm not going to change it, because it is right, files of different size aren't easy to put into memory. But, don't stop just because I'm being a bit realistic....I'm sure there is a way to do this properly. Besides, forcing SC to load it is a lot better than doing it yourself, no?
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-14 at 20:27:21
Well, the problem with forcing starcraft to load a particular Iscript.bin is that it will probably want to load it from patch_rt>BrooDat>StarDat>INSTALL rather than the map.

Just a note, the structure I am basing my dat loader off of was actually found in IceCC, it turns out he wrote things to load dat files and TBL files as well as Iscripts.

One last thing, do you know the location of the current map in the memory?
Report, edit, etc...Posted by DiscipleOfAdun on 2006-02-15 at 10:27:48
Nope. It shouldn't be too hard to find though. I'd look, but I'm sure you'd rather have offsets for the .dat files. Besides, I'm trying to find time to work on Firegraft anyway(which I'm not finding too much), so I'll try, but no guarantee
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-15 at 19:52:48
Okay. I found the offset for the current map file. It even has plenty of buffering space, so I dont have to worry about runnning into another value. meanwhile, I have also been debuging the 0.1 alpha (Units.dat only, fixed .dat location, no extra things to do on command line).
Report, edit, etc...Posted by Staredit.Net Essence on 2006-02-15 at 22:59:16
They already have one of these. It loads Mod files. It is a mod for starcraft shareware that adds a lot of stuff to it. Here ill post a link.

ADDITION:
http://ultimatepatch.cjb.net-Official Site
Dont get it there you will get spammed up the ass. Im looking for this special Site. This patch works for BW 1.13f but you just need to get addon from official site.

Report, edit, etc...Posted by Doodle77(MM) on 2006-02-16 at 17:18:34
This is completely different. Its not a mod. It works without doing anything to your starcraft install. It works with brood war, and it loads .dat files.
Report, edit, etc...Posted by Staredit.Net Essence on 2006-02-16 at 23:57:18
Yeah, That loads .dat files into starcraft. It is part mod because it edits *Sharewares files to make it so that it loads Zerg and can play other maps. This thing has auto switch(changes your mod in game to the players you join), Name it so that you can check that everybody has it and some other cool features.
Report, edit, etc...Posted by Darktossgen(MM) on 2006-02-17 at 08:19:56
What are those words anyways? I want to compare that to DatLoader when it's ready smile.gif
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-17 at 18:56:31
I have been working on datloader, and I am having a little problem.
When you first load a map, the offset 0x00515E8C becomes the path to the current map.
For example after loading Arctic Station I have:
CODE
C:\Program Files\Starcraft\maps\BroodWar\(4)Arctic Station.scx

But when I load a map with a shorter name, for example Trench Wars, I get
CODE
C:\Program Files\Starcraft\maps\BroodWar\(3)Trench wars.scxcx

Do you know of an offset to the length of the map name, or something else that would help me.
Report, edit, etc...Posted by Staredit.Net Essence on 2006-02-17 at 20:49:40
This is good since its newer. I just hope it works.

The program EZLoader is exactly like this.
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-18 at 17:11:00
One method I could use to fix my problem would be to blank the offset after DatLoader is loaded, but that makes it so you cannot 'Restart Mission'.
I can load custom TBL files, which allows you to change GRP's and stuff, but starcraft loads the GRP's and WAV's like patch_rt->Broodat->stardat->INSTALL }:
Report, edit, etc...Posted by Darktossgen(MM) on 2006-02-18 at 17:13:19
Do it, who uses Restart Mission anyways?
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-20 at 11:38:45
Wow. I suck at C++
I get alot of this error and I dont know how to fix it.
CODE

52 C:\Documents and Settings\*****\Desktop\AutoDatLoader\datload.cpp base operand of `->' has non-pointer type `DatFmt'

I have no other errors.
Report, edit, etc...Posted by DiscipleOfAdun on 2006-02-20 at 11:44:10
I think I know what is wrong, but I'd need to see the declaration and implementation of DatFmt to tell you what is wrong.
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-20 at 11:47:28
CODE

typedef struct DatFmtEnt {
 size_t   size;   /* size of each var */
 unsigned num;    /* number of this var */
 unsigned offset; /* where varno 0 starts; some variables don't
       apply for all entries and thus start from a no
       > 0, but usually this is 0  i.e. 114*/
 char     *name;  /* name of this var */
 unsigned memoffset; //Memory offset for where these values are loaded.
};
/* this structure holds the info about a particular Dat
  file. There are some defined below */
typedef struct DatFmt {
 size_t numvars;            /* number of vars in this format */
 DatFmtEnt entries[64]; // array of pointers to the var formats,
                        // 64 should be enough entries.
 char     *filename; // filename (i.e. arr\units.dat)
};

I will be releasing it completely open source because i am lazy as hell and didnt write a way to externally update it.

One random little question, how do you use curdirectcondjmp?
Report, edit, etc...Posted by DiscipleOfAdun on 2006-02-20 at 11:55:25
Try using '.', not '->'. That should fix it, because I'm guessing that you do not dynamically allocate it, so it isn't a pointer to the structure.

curdirectcondjmp is like the trgarccondjmp. It's similar it's arguments, but I can't really explain it too much. I did an entire day of testing using it(on both the missile installation trap and the nuke), and am still unsure on how it works. But, it ends up checking the direction of the spirte, and then jumping if it is facing that direction. How to divide the circle is the same as finding the angle in trgarccondjmp. If you compare against the missle trap, you should be able to figure it out(if you get trgarccondjmp).
Report, edit, etc...Posted by Doodle77(MM) on 2006-02-22 at 22:13:17
Hmm, I was only using -> because thats what I saw in one of the random utilites that were included along with the IceCC source. (thats where the format stucture came from)
What is the order of the arguments for curdirectcondjmp? direction-?-label?

ADDITION:
I am having a major problem thatis inhibiting the development of DatLoader -- My keyboard is sort of broken so that when I press e it acts as if though I pressed w and e. samewith s and d and x and c. unfortunately my laptop has no PS/2 ports and I have no USB keyboards so I am stuck using the On-Screen Keyboard.

ADDITION:
I took a two hour crash course in taking apart my Dell Inspiron 1200 and now my keyboard works fine again. W00t! back to DatLoader. Might be delayed a bit b/c i just started playing N.
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-03 at 19:19:52
Wow. The problem I had that was requiring Restart Mission to not work was a nonexistent problem. I just wasnt seeing that it [the map name] was null terminated. I feel dumb.
Report, edit, etc...Posted by zcz_team on 2006-03-03 at 20:43:50
ooo sounds interesting cant wait
Report, edit, etc...Posted by ShadowFlare on 2006-03-07 at 14:49:48
Hmm, some of the things you mentioned sound like they are things I could help with. smile.gif If you use MSN Messenger, add me to your list so we can discuss it. My e-mail I use with it is blakflare at hotmail dot com. If you don't use that IM client, then let me know what you do use.

BTW, just for anyone who would like to know, my site has been moved to http://shadowflare.samods.org/
The old address at http://shadowflare.gameproc.com/ was removed very soon after I finished moving my site. closedeyes.gif
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-10 at 16:49:09
Well, I now have a MSN account, p1z5p4mm3 same as my AIM
I'm having a bit of trouble using sfmpqapi.
Report, edit, etc...Posted by ShadowFlare on 2006-03-11 at 02:02:42
QUOTE(Doodle77(MM) @ Mar 10 2006, 02:48 PM)
Well, I now have a MSN account, p1z5p4mm3 same as my AIM
I'm having a bit of trouble using sfmpqapi.
[right][snapback]442817[/snapback][/right]

Well, I wasn't referring to SFmpqapi, but I could help with that, too. What I was referring to was certain types of in-place memory modifications and also ways of handling certain things with function calls. There are some things I know how to do that may fit in very well with what you want to do.
Report, edit, etc...Posted by Doodle77(MM) on 2006-03-12 at 13:15:00
I'm almost finished with the alpha for the companion program to DatLoader, which takes the memory and makes dat files (for investigation into hyper units). This is good news because this program uses many of the same files and methods, so the only impediment to the completion of DatLoader currently is that I have close to no idea how to use SFmpqapi.

Wheeee... Units.dat: dec. 24-28 = STUFF!

Time to look at DatEdit source i guess..

Then again, since DatEdit does no reading, i am pretty much screwed.

I think I have an incorrect value somewere in my data, can someone find it.
CODE

typedef struct DatFmt {
 size_t numvars;            /* number of vars in this format */
 DatFmtEnt entries[64]; // array of pointers to the var formats,
                        // 64 should be enough entries.
 char     *filename; // filename (i.e. arr\units.dat)
};
typedef struct DatFmtEnt {
 size_t   size;   /* total size size of the vars, they are all together in the memory
                          and file, so theres no reason to separate them.. */
 char     *name;  /* name of this var */
 unsigned int *memoffset; //Memory offset for where these values are loaded.
};


CODE

#include "datfmt.h"
static DatFmt dat_units = {
 54,
 {
   { 228, "Graphic", (unsigned int*)0x6c5910},
   { 456, "Subunit1", (unsigned int*)0x6c3f98},
   { 456, "Subunit2", (unsigned int*)0x6c3c08},
   { 192, "InfestationPointer", (unsigned int*)0x6c4de8},
   { 912, "ConstructionAnim", (unsigned int*)0x6c45e0},
   { 228, "SubunitTurning", (unsigned int*)0x6c45e0},
   { 228, "ShieldEnable", (unsigned int*)7090496},
   { 456, "ShieldAmount", (unsigned int*)7098712},
   { 912, "HitPoints", (unsigned int*)7090960},
   { 228, "AnimLevel", (unsigned int*)7108688},
   { 228, "MovementType", (unsigned int*)7107992},
   { 228, "StareditOrder/Sublabel", (unsigned int*)7092560},
   { 228, "ActionCompAIIdle", (unsigned int*)7101384},
   { 228, "ActionHumanAIIdle", (unsigned int*)7092328},
   { 228, "IdleAfterAction", (unsigned int*)7105936},
   { 228, "ActionGroundAttack", (unsigned int*)7095544},
   { 228, "ActionAirAttack", (unsigned int*)7092096},
   { 228, "WeaponGround", (unsigned int*)7100920},
   { 228, "MaxHitGround", (unsigned int*)7102048},
   { 228, "WeaponAir", (unsigned int*)7098480},
   { 228, "MaxHitAir", (unsigned int*)7090728},
   { 228, "OrderFlags", (unsigned int*)7090048},
   { 912, "SpecialAbilityFlags", (unsigned int*)7108920},
   { 228, "TargetAcquireRange", (unsigned int*)7103648},
   { 228, "SightRange", (unsigned int*)7108456},
   { 228, "ArmorUpgradeGroup", (unsigned int*)7108224},
   { 228, "Size", (unsigned int*)7099168},
   { 228, "ArmorAmount", (unsigned int*)7101152},
   { 228, "RightClickAction", (unsigned int*)7094624},
   { 212, "ReadySound", (unsigned int*)7090280},
   { 496, "WhatSoundStart", (unsigned int*)7096920},
   { 496, "WhatSoundEnd", (unsigned int*)7093712},
   { 212, "PissSoundStart", (unsigned int*)7091880},
   { 212, "PissSoundEnd", (unsigned int*)7101616},
   { 212, "YesSoundStart", (unsigned int*)7101832},
   { 212, "YesSoundEnd", (unsigned int*)7099856},
   { 912, "PlacementDimesions", (unsigned int*)7102280},
   { 384, "AddonPlacement", (unsigned int*)7100304},
   { 1824, "BufferDimensions", (unsigned int*)7104632},
   { 496, "Portrait", (unsigned int*)7097376},
   { 496, "MineralCost", (unsigned int*)7094856},
   { 496, "VespeneCost", (unsigned int*)7103880},
   { 496, "BuildTime", (unsigned int*)7098024},
   { 496, "ResrictionFlags", (unsigned int*)7099400},
   { 228, "StareditGroupFlags", (unsigned int*)7104792},
   { 228, "FoodGiven", (unsigned int*)7096688},
   { 228, "FoodProduced", (unsigned int*)7089816},
   { 228, "FoodCost", (unsigned int*)7093024},
   { 228, "TransportOrBunkerSpace", (unsigned int*)7095312},
   { 496, "BuildScore", (unsigned int*)7105024},
   { 496, "DestroyScore", (unsigned int*)7105480},
   { 496, "MapStringRefrencer", (unsigned int*)7104336},
   { 496, "StareditAvailabilityFlags", (unsigned int*)7103192},
 },
 "arr\\units.dat"
};

Woo for sloppy coding!
Next Page (1)