disassembler help/energy screen project

Energy Screen with 15+ Building Buttons + patchtool; support/discussion/questions

Moderator: thunderchero

User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

@Thunderchero and SCT

I know this project has fallen by the wayside a little of late; however I've been having some thoughts about it and have got a few questions

in IDA Pro's flowchart of sub_4F8AA0 it seems to me that the section from 004F8F60 deals with loading and drawing the energy screen? - is this correct?

TC you mention the data in trek.exe at 0x193f6c - 0x1940bb but you havn't mention where this is read from could any one point me in the direction of this subroutine?

What I am looking for is the various subroutine start addresses that deal with this project my attempts have not been very fruitful.

thanks in advance guys. P'81
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Peter1981 wrote:TC you mention the data in trek.exe at 0x193f6c - 0x1940bb but you havn't mention where this is read from could any one point me in the direction of this subroutine?
I found this by chance it is part of unk_5960F4

when I noticed it matched the data in energy wdf files I started playing with it lol

unk_5960F4 is listed in sub_4F8690, 004F9025

here is a quote from SCT
Spocks-cuddly-tribble wrote:As you said, sub_4F8AA0 controls almost the whole F2-GUI:

sub_53E600 -> load wdf-file from stbof.res (most via name)
sub_4F8690 -> read dynamic system data for wdf (if not loaded yet) -> important
sub_43AB80 -> load wdf emp. letters (fonts) for popups? (sub_513D99)
sub_43AF30 -> load some .fnt-file data
sub_4FAFC0 -> some solcur.wdf control

But without analysis of most of the dynamic variables, this knowledge means almost nothing. :(

-> dynamic address of strcInfo ? (and/or similar power lists)
-> 591790: MemUIPool (functionality?)
-> 595DA8: F2-GUI relevant data! (functionality?)
-> ObjectFileMemory(s): 5A007C: / 5A0080: & 5A0084: (functionality?)
-> two lists (special and defense) - taken from where? & determined by what? (edifice.bst?)
-> 7 structure per row limit - determined by what ? (aside of wdf)

Once this is done, the main work won't even have begun...
thunderchero
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

I've just reread the project topic, but it's quite hard to follow at some points if you are short on time:

0x193EF4 - 0x1940bb // asm-5960F4 -> trek.exe area for senergy.wdf - length 1C8h (26h*C =control of 38 objects?)

thunderchero wrote:each set of 12 bytes has a matching entry in hsenergy.wdf file, let start with first 12 bytes.

0E 00 00 00 this is the type of object (text) for images it would be (0D 00 00 00).

60 09 00 00 this is the matching code that is in hsenergy.wdf file. All codes are in highlighted area above.

00 02 00 00 I think this is the command used in trek.exe I have switch this with other entrys and that code changed the postion or type depending on what was changed.


in trek.exe at 0x193f6c - 0x1940bb

this section of code holds 28 entries that matches *senergy.wdf only for the energy structures. 14 images and 14 text entries

here is example of one entry for each type.

image;

0D 00 00 00 6A 09 00 00 90 01 00 00

Explanation of each part of image code.

0D 00 00 00 code for image

6A 09 00 00 code to get postion from *senergy.wdf for placement

90 01 00 00 This code is for if next structure to use and increases by 4 for every entry.

text;

0E 00 00 00 79 09 00 00 C0 01 00 00

Explanation of each part of text code.

0E 00 00 00 code for text

79 09 00 00 code to get postion from *senergy.wdf for placement

90 01 00 00 This code is for if next structure to use and increases by 4 for every entry.


Spocks-cuddly-tribble wrote:What happens if objects/codes in hsenergy.wdf (e.g. text for "Special" and "Defense") will be replaced...
...my attempt trying this resulted in crash at game start up. same thing I get adding any bytes to hsenergy.wdf file. with same crash log. I think it is crashing due to trek.exe is looking for text and I have set to image...

had an idea when writing this post but did not work,

I have setup a "hsenergy.wdf" with code for 28 images as above. But no text, I used the text code for new images "79 09 00 00" A diferent code for each image using all 14 text codes. In trek.exe I have edited code for the 14 entries of text to match new "hsenergy.wdf".

I have not found anything in hsenergy.wdf file that says the file size but if size is increased game crashes not sure if this is due to incorrect data in file (not matching in trek.exe) or the size of file. NOTE: some races file size is differant. So I am thinking wrong format of new data or not matching trek.exe entries.
According to the above issues, you haven't figured yet how to manipulate code key (trek.exe / senergy.wdf) in order to e.g. replace a text object with a picture (i.e a working button) - if so, then extending the trek.exe data field wouldn't work anyway?

Since I hope that I misinterpreted this, here is how to extend trek.exe area for senergy.wdf:

- number of 12 byte entries / controlled objects (i.e. * 12 = length of data field)
- asm address of data field

Code: Select all

004F8701     BA 26000000     MOV EDX, 26
004F8706     B8 F4605900     MOV EAX, 005960F4

004F9020     BB 26000000     MOV EBX, 26
004F9025     BA F4605900     MOV EDX, 005960F4
Following option allows for 6 more 12 byte entries i.e. 44 in total: (just to keep things simple for testing purpose, at least 55 entries are no problem, if it works)

1. Use shared bonus ranges (i.e. all empires use cardassian data / unmodded this doesn't matter if card range bug was fixed: Map Range)

at 0x7B603 change 01 C3 -> 90 90
at 0x7B79B change 01 C1 -> 90 90

2. Change asm-address of senergy data field to asm_00590B04 i.e. 0x18E904 (ex. fed-rom bonus ranges = 44*12bytes max.)

3. Increase number of entries to read from data field (size)

4. Copy & paste extended new data field at 0x18E904
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

thanks sct & tc back to the coal face :D
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Spocks-cuddly-tribble wrote:0x193EF4 - 0x1940bb // asm-5960F4 -> trek.exe area for senergy.wdf - length 1C8h (26h*C =control of 38 objects?)
yes in order found in trek.exe

60 09 Energy Managment text
61 09 Special text
62 09 Defence text
63 09 Orbital Batteries text
66 09 Energy text
9C 09 *s_ssdrl.tga/*s_ssdrlo.tga
9D 09 *s_sdrr.tga/*s_sdrro.tga
64 09 *s_sld30.tga/*s_sld31.tga
65 09 *s_sld30.tga/*s_sld31.tga
A0 09 orbital battery image
6A 09 row 1 1 image
6B 09 row 1 2 image
6C 09 row 1 3 image
6D 09 row 1 4 image
6E 09 row 1 5 image
6F 09 row 1 6 image
70 09 row 1 7 image
7E 09 row 2 1 image
7F 09 row 2 2 image
80 09 row 2 3 image
81 09 row 2 4 image
82 09 row 2 5 image
83 09 row 2 6 image
84 09 row 2 7 image
74 09 row 1 6 text
75 09 row 1 5 text
76 09 row 1 4 text
77 09 row 1 2 text
78 09 row 1 3 text
79 09 row 1 1 text
7A 09 row 1 7 text
88 09 row 2 1 text
89 09 row 2 2 text
8A 09 row 2 3 text
8B 09 row 2 4 text
8C 09 row 2 5 text
8D 09 row 2 6 text
8E 09 row 2 7 text

thunderchero
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

thanks sct and tc for the quick replys.

To sumerise what i think can be achieved within the limitations of the trek.exe and time:-

Increase the number of 'Power-Up' buttons on both rows (I'm thnking from 7 to 10.) This should surfice for testing and proof of concept.

so as sct points out: reduce the ship range to use just cardassian values; to free space for larger data set. and alter the asm addresses.

Why does this part of the table get jumbled up?
TC wrote:
74 09 row 1 6 text
75 09 row 1 5 text
76 09 row 1 4 text
77 09 row 1 2 text
78 09 row 1 3 text
79 09 row 1 1 text
7A 09 row 1 7 text
is this the order their found in senergy?

-- I am correct in assuming that the new buttons (in this instance 6 picture buttons and 6 energy texts) will need to be added to all 5 *senery.wdf files. TC could you explain the .wdf layout to me a bit more please and what you did.

thanks on advance.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

so many question still need answering;

TC when you added the slider, in an earlier attempt on this project, did you add that object to the hsenergy.wdf file or did you just change another entry? -- has adding an object be cracked if so could some one point that piece of infomation out to be or explain how it is done. the infomation on .wdf manipulation seems incomplete to me.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Peter1981 wrote:Increase the number of 'Power-Up' buttons on both rows (I'm thnking from 7 to 10.) This should surfice for testing and proof of concept.
I am currently attempting 4 rows 7 in first and 3rd row and 1 in 2nd and 4th row. I should have results late tonight or early tomorrow.
Peter1981 wrote:Why does this part of the table get jumbled up?
TC wrote:
74 09 row 1 6 text
75 09 row 1 5 text
76 09 row 1 4 text
77 09 row 1 2 text
78 09 row 1 3 text
79 09 row 1 1 text
7A 09 row 1 7 text
is this the order their found in senergy?
yes but I have moved other items in wdf file (just to make it easier to change things) with out any problems. On my current attempt I plan on putting them in order.
Peter1981 wrote:-- I am correct in assuming that the new buttons (in this instance 6 picture buttons and 6 energy texts) will need to be added to all 5 *senery.wdf files. TC could you explain the .wdf layout to me a bit more please and what you did.

thanks on advance.
Explaining wdf files is not easy :wink:

first; yes each wdf file for each race will need to be edited. but only 1 is required for testing as long as only that race is loaded (I think) :D
Peter1981 wrote:TC when you added the slider, in an earlier attempt on this project, did you add that object to the hsenergy.wdf file or did you just change another entry? -- has adding an object be cracked if so could some one point that piece of infomation out to be or explain how it is done. the infomation on .wdf manipulation seems incomplete to me.
I think I tried both ways (it has been over 2 years) both resulted in crash when race loaded.

the best way to explain the wdf file for the *senergy.wdf files. every wdf file is a little different.

first part of file

0x00 to 0x495 this part is for orbital and energy scroll bars and buttons. In this part objects can be moved to new location but that is all.

0x496 to 0x1109 This is image area each image data is 41 bytes.
I have moved images in file without any problems
example; The 11th image is the A0 09 "orbital battery image" I have moved it to the first image to allow me to edit the 7 images for energy easier.

break down of 41 bytes

0D 00 00 00 this is for images
6A 09 00 00 this is code for that image
50 00 00 00 this placement of top right pixel from right of *senbkg.tga
5A 00 00 00 this placement of top right pixel from top of *senbkg.tga
1E 00 00 00 this is the width of image in pixels
1E 00 00 00 this is height of image in pixels
6E 6F 6E 65 20 20 20 20 20 20 20 20 20 FF FF FF FF is just how they all end I am not sure what or if this is for any thing.

0x1110 to 0x3029 This is text area each text data is 101 bytes.
I have moved text in file without any problems. Just like image example and for the same reason I moved other text to end of file so all energy objects were together.

break down of 101 bytes;

0E 00 00 00 this is for text
60 09 00 00 this is code for that text
47 00 00 00 this placement of top right pixel from right of *senbkg.tga
23 00 00 00 this placement of top right pixel from top of *senbkg.tga
AA 00 00 00 this is the width of area in pixels
16 00 00 00 this is height of area in pixels
last 77 bytes repeats area used and is for what size font used.

I know I did not explain this the best but I hope this helps.

thunderchero
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Well my current attempt failed. :evil:

I suspect I am missing 1 or more checks for total objects.
004F8701 BA 26000000 MOV EDX, 26
004F8706 B8 F4605900 MOV EAX, 005960F4

004F9020 BB 26000000 MOV EBX, 26
004F9025 BA F4605900 MOV EDX, 005960F4
I did both of these but afraid there are more. Or code to only allow 7 objects per energy type/line.

EDIT I also tried a brute force replacing all 26 00 00 00 with 2A 00 00 00 with no luck same crash log

here are the files I used in my attempt. In zip file there is 3 folders

energy_project.zip

My attempt started with a fresh install of main multi-installer

vanilla (unedited)
38 objects (with these file added game will load all races) these files already has the new code SCT suggested above to move asm-address of senergy data field.
42 objects (with these files added game will crash at galaxy generation)

I only edited fed files for this test.
with 42 object files and load feds I get this crash log

Version Under Test: 72
File: guifile.c, Line: 468,
Initialize State: 31
Player Empire: 1 Starting Seed: 1308877319
Galaxy shape: 2 Galaxy Size: 1

with 42 object files and load any other race I get this type of crash log.

Version Under Test: 72
File: wdfread.c, Line: 193, Cannot retrieve Object typeId = 13, instanceId = 2417 not found in Csenergy.wdf

Initialize State: 31
Player Empire: 0 Starting Seed: 1308877621
Galaxy shape: 2 Galaxy Size: 1

Note: lexicon.dic edited so defense and energy text would not be seen. But is same file in 38 objects and 42 objects folders.

Note; edifice.bst and racetech.tec was edited to allow adding of more building if test worked. But is same files in 38 objects and 42 objects folders.

I feel wdf and asm-address of senergy data field are set correctly.

with 38 files you would get image below if you built re-education and the pink areas would be where new objects would be when 42 works (positive thinking) the other 6 objects could be added after it is working.



thunderchero
Last edited by thunderchero on Fri Jun 24, 2011 12:00 am, edited 2 times in total.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2403
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Post by Tethys »

I stumbled accross my wdf file breakdown (for wat its worth) a few nights ago ill see if i can pull it back up tomorrow and post it
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

it is up tethys but only scratches the surface but was some use :)
thnks tc for your files am looking at this tonight :)

EDIT:
I'm looking at sub53e600 this is where the wdf null stuff seems to be.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

@tc the second crash .log report
Version Under Test: 72
File: wdfread.c, Line: 193, Cannot retrieve Object typeId = 13, instanceId = 2417 not found in Csenergy.wdf

Initialize State: 31
Player Empire: 0 Starting Seed: 1308877621
Galaxy shape: 2 Galaxy Size: 1
is due to there not being 42 images/text/buttons - I renamed hsenergy.wdf to the other races pre-fix and this will solve this; however game still crashes with
Version Under Test: 72
File: guifile.c, Line: 468,
Initialize State: 31
Player Empire: 1 Starting Seed: 1308877319
Galaxy shape: 2 Galaxy Size: 1
this and i'm struggling to isolate this problem tonight ;) -- anyone got any thoughts?
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Peter1981 wrote:@tc the second crash .log report is due to there not being 42 images/text/buttons - I renamed hsenergy.wdf to the other races pre-fix and this will solve this; however game still crashes with
I expected this but as I stated before game will not load with any other race without other 4 wdf and locations for images will be slightly different
Peter1981 wrote: Version Under Test: 72
File: guifile.c, Line: 468,
Initialize State: 31
Player Empire: 1 Starting Seed: 1308877319
Galaxy shape: 2 Galaxy Size: 1

this and i'm struggling to isolate this problem tonight ;) -- anyone got any thoughts?
I have not tested any further, But some ideas that come to mind is what SCT worried about before.
Spocks-cuddly-tribble wrote:But without analysis of most of the dynamic variables, this knowledge means almost nothing. :(

-> dynamic address of strcInfo ? (and/or similar power lists)
-> 591790: MemUIPool (functionality?)
-> 595DA8: F2-GUI relevant data! (functionality?)
-> ObjectFileMemory(s): 5A007C: / 5A0080: & 5A0084: (functionality?)
-> two lists (special and defense) - taken from where? & determined by what? (edifice.bst?)
-> 7 structure per row limit - determined by what ? (aside of wdf)

Once this is done, the main work won't even have begun....
any or all of the above

I wish I could be more helpful my skills are limited here.

what worries me is it crashes on galaxy generation. If it was only related to the energy screen would it not crash when entering build energy screen?

thunderchero
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

what worries me is it crashes on galaxy generation. If it was only related to the energy screen would it not crash when entering build energy screen?
yes agree not sure why it crashes on galaxy generation as this has nothing to do with energy screen gui, however there maybe some test upon startup which runs through and checks the some/all the various gui some of this data must be read and stored for use by trek.exe.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

I looked in ida pro and found this in sub_547490

Code: Select all

mov     esi, offset aGuifile_c ; "guifile.c"
mov     ecx, 1D4h
only reason I am posting D4 01 = 468

Version Under Test: 72
File: guifile.c, Line: 468,
Initialize State: 31
Player Empire: 1 Starting Seed: 1308877319
Galaxy shape: 2 Galaxy Size: 1

I know it is a shot in the dark but what I thought vanilla had 14 energy objects (28 total objects 14 images 14 text) now we are using 32 total 16 each. and 1C ( 28 ) is listed a lot. but I have no idea what to edit.

thunderchero
Post Reply

Return to “Energy Screen with 15+ Building Buttons + patchtool”