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 »

the crash log gives
Version Under Test: 72
File: ..\..\source\game\tech\techhash.c, Line: 164, Cannot get the structure by id

Initialize State: 15
Player Empire: 1 Starting Seed: 0
Galaxy shape: 0 Galaxy Size: 0
this is before the game even playes the opening movie.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

Thats strange never had that happen.

also I think we posted at same time I replied on last page.

your error could be due to changing first 10 objects I have no reference location for those.

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

Post by thunderchero »

Ok everyone we have found many things to do with this project.

And we have focused on only one option (adding 14 extra images and text)

we do have couple other option we could explore.

1. remove text from wdf for the 14 energy structures and replace with images. We know how to edit wdf better and this might open some code data area to duplicate image code (text code seems to have more data)

2. With new wdf info we might be able to add a scroll bar to energy screen and use only 6 60 x50 images and be able to scroll though them. This would require in-depth research into *solar.wdf and trek.exe code.

I found more reference locations tonight but went non-responsive CTD at galaxy generation. I almost expect this any more :evil:

here is list of the references I have to date.

0xf1289 90 01 00 00 defense image set reference
0xf1314 AC 01 00 00 defense text set reference
0xf13b4 AC 01 00 00 defense text set reference
0xf1577 AC 01 00 00 defense text set reference
0xf13e1 C8 01 00 00 special image set reference
0xf146c E4 01 00 00 special text set reference
0xf150c E4 01 00 00 special text set reference
0xf1547 E4 01 00 00 special text set reference

0xf125f (special) 07 -> 0E (14)

0xf127d (defense) 07 -> 0E (14)

note new found references below I have been unable to test.

sub_4F10F0

0xf0553 C8 01 00 00 special image set reference
0xf0568 C8 01 00 00 special image set reference
0xf0570 E4 01 00 00 special text set reference
0xf057c 90 01 00 00 defense image set reference
0xf0591 90 01 00 00 defense image set reference
0xf0599 AC 01 00 00 defense text set reference

0xf0563 (special) 07 -> 0E (14)

0xf058c (defense) 07 -> 0E (14)

below were found in area of both sub's above but look to be related.

0xf660F 90 01 00 00 defense image set reference
0xf661D 90 01 00 00 defense image set reference
0xf664C C8 01 00 00 special image set reference
0xf665a C8 01 00 00 special image set reference
0xf0EF6 AC 01 00 00 defense text set reference
0xf0f14 E4 01 00 00 special text set reference

As SCT pointed out a few pages back I think I might start a new topic of only confirmed info and lock post and add new data as it is found and confirmed and discussion would continue on this post.

let us know your thoughts

thunderchero
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3197
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Post by Flocke »

All your effort looks quite impressive.
Option 2 is too complicated when you loop through your systems to check if certain special buildings are powered, so I'd choose nr. 1.

However, I'd probably rather reimplement that (sub)screen, you know. 8)
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

I might start a new topic of only confirmed info and lock post and add new data as it is found and confirmed and discussion would continue on this post.
good idea, this topic is very much a sketch pad of ideas and not easy for new people to join the conversation.

to me option one seem the best way forward; would we need to work out how to stop trek.exe trying to place text, or if no text info in .wdf file does that suffice and not ctd the trek.exe?

EDIT: mysteriously and miraculosly trek.exe now doesn't ctd on start??? WITH MY CHANGES AS POSTED NOW CTD AT GALAXY GENERATON.

EDIT2: have tried to make text into images but not really sure if i'm heading in the right direction or not :evil: lots of ctd :x
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Post by thunderchero »

peter,

1. I am not even sure if sub_4F10F0 is being used. or if this is a galaxy generation check?

2 as for option 1 editing wdf only would need to start the same set up with codes matching first set in trek.exe unk. but yes I too would expect a lot of CTD. I have tried nothing on this type of attempt. first thing would be set up wdf I would use my last set I uploaded and remove the 14 text for the energy structure texts. change value for total text. fed wdf would be easy but other races would need slightly different editing. and remove last 14 0E entries in trek.exe in unk area but who knows how game would react after setting total unk size to proper value 26 (38 objects).

3. I am starting to think stack variable size is our problem now.

thunderchero
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7851
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 did a quick look and edit of fed only wdf and trek.exe and non-responsive CTD at F2/build screen selection (expected)

but these are used by images

loc_4F1E3E
loc_4F1E66
loc_4F1FDC

these are used by text

loc_4F1EFF
loc_4F1F1C
loc_4F2057
loc_4F2074
loc_4F2120
loc_4F2150

so maybe if top data added to unused/text area. using the same unk trek reference ? and nop rest This is all greek to me lol

this might work

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

Post by thunderchero »

Just an update I did attempt 28 images only.

non-responsive CTD at F2/build screen selection on every attempt. never got a crashlog lol

basically nop all text code that I know of and tried to leave the jump to next operation then nop that one ect. So we still are missing something somewhere.

although I thought about it as I was over half way and I should have just attempted to remove text from unedited files. just to see if text can be removed.

thunderchero
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Post by Spocks-cuddly-tribble »

Well, after solving the load/check wdf-file bug, now you have run into serious trek.exe problems.
thunderchero wrote:

Code: Select all

00 02 00 00     Energy Managment text 
04 02 00 00     Special text 
08 02 00 00     Defence text 
0C 02 00 00     Orbital Batteries text 
10 02 00 00     Energy text 
14 02 00 00     *s_sdrl.tga button 
18 02 00 00     *s_sdrr.tga button 
7C 01 00 00     *s_sld30.tga slide 
78 01 00 00     *s_sld31.tga slide 
20 02 00 00     orbital battery image
any of these values would cause a conflict
That's not the main problem. The wholestuff is also stored at ds:[595DA8], which has a major importance for the whole GUI and is created & accessed by shared trek.exe standard code i.e. any change of its sub-structure is definitely not realistic, since resulting in unreasonable snowball effects. The same goes for changing all static base offsets in trek.exe and in many wdf-files.

thunderchero wrote:we do have couple other option we could explore.

1. remove text from wdf for the 14 energy structures and replace with images. We know how to edit wdf better and this might open some code data area to duplicate image code (text code seems to have more data)
This appears to me the only relastic option yet (if possible).

Code: Select all

base memory addresses & number of objects (maybe only some of them & some just guessed)

0x190 / 400 defense pics
0x1AC / 428 defense text
0x1C8 / 456 special pics
0x1E4 / 484 special text


sub_4F1A60

004F1E57                 mov     ebx, [ecx+18Ch] // special objects
004F1E5D                 cmp     ebx, 7  // objects limit

004F1E75                 mov     edx, [ecx+188h] // defense objects
004F1E7B                 cmp     edx, 7  // objects limit
004F1E86                 mov     esi, [ecx+eax*4+190h] // defense pics
004F1E99                 mov     ebx, [ecx+240h] // total objects ?
004F1EA4                 mov     [ecx+240h], ebx  // total objects ?
004F1F0B                 mov     edx, [ecx+188h] // defense objects
004F1F11                 mov     ebx, [ecx+edx*4+1ACh] // defense text
004F1FA1                 mov     eax, [ecx+188h] // defense objects
004F1FB1                 mov     eax, [ecx+eax*4+1ACh] // defense text

004F1FBD                 mov     esi, [ecx+188h] // defense objects
004F1FC3                 mov     edi, [ecx+240h] // total objects ?
004F1FCB                 mov     [ecx+188h], esi  // defense objects
004F1FD1                 mov     [ecx+240h], edi // total objects ?

004F1FDE                 mov     esi, [ecx+eax*4+1C8h] // special pics
004F1FF1                 mov     edi, [ecx+240h]  // total objects ?
004F1FFC                 mov     [ecx+240h], edi  // total objects ?
004F2069                 mov     ebx, [ecx+ebx*4+1E4h] // special text
004F2063                 mov     ebx, [ecx+18Ch]  // special objects
004F2069                 mov     ebx, [ecx+ebx*4+1E4h] // special text
004F20F9                 mov     eax, [ecx+18Ch] // special objects
004F2109                 mov     eax, [ecx+eax*4+1E4h] // special text


sub_4F10F0

004F1151                 mov     ebx, [ebp+1C8h] // special pics
004F115E                 add     eax, 4    // entry size
004F1161                 cmp     edx, 7  // objects limit
004F1166                 cmp     esi, [eax+1C8h] // special pics
004F116E                 mov     edi, [eax+1E4h] // special text

004F117A                 mov     ebx, [ebp+190h] // defense pics
004F1187                 add     eax, 4   // entry size
004F118A                 cmp     edx, 7  // objects limit
004F118F                 cmp     esi, [eax+190h] // defense pics
004F1197                 mov     edi, [eax+1ACh] // defense text
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: disassembler help/energy screen project

Post by QuasarDonkey »

Spocks-cuddly-tribble wrote:any change of its sub-structure is definitely not realistic
Oh really?

LOL. Unfortunately it crashes out whenever you switch out of the solar system screen :x

Background: I've built a tool that applies about 30 patches to Trek.exe to expand the energy screen. I also rewrote the fed wdf to allow for 20 energy objects. As you can see in the above pic, I have it partially working. Once I figure out what the crash problem is, we'll be in business.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: disassembler help/energy screen project

Post by thunderchero »

Very nice, :D

so what was the key to this?

SWEET.......

thunderchero
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: disassembler help/energy screen project

Post by QuasarDonkey »

Well we're not quite there yet :oops:

I'm a little tired now, but I'll post the full details / patch tool later.

Basically I modified the hsenergy.wdf file manually, which was tricky enough to get right (I wasted hours debugging because I forgot to increase the total number of objects in the WDF). I also relocated the wdf object descriptors for senergy.wdf items in Trek.exe, you know, those triples of numbers containing the object type, id, and offset. I relocated them so I'd have room to add entries corresponding to the new entries hsenergy.wdf. The last parameter of the triple is the offset within the Solar System screen structure (an in-memory data structure that holds pointers to the widgets and other variables). Those offsets need to be modified to point within a valid location in that structure. So I had to enlarge that structure by allocating more memory for it, and fiddle around with lots of references in Trek.exe to put all the energy pics and text boxes at the end of that structure. (SCT has listed most/all of those code references a few posts above); I changed the "cmp X, 7" to "cmp X, 10", etc.

The key to it, is that it's so complicated to do manually, I wrote a program to do all the patching. That way, no mistakes. The program can actually add any number of energy objects to Trek.exe. If I get all working, I'll make that program generate the WDF's too.

To test, I modded a savegame using UE to add extra buildings to Sol, which you can see in the above pic. The buttons work, you can activate/deactivate each object. But when you try to switch screen, or move to the next solar system, it crashes out.

I only got it working a short while ago, so I'm gonna look into the crash tomorrow.
User avatar
Peter1981
Rear-Admiral
Rear-Admiral
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Re: disassembler help/energy screen project

Post by Peter1981 »

My oh my! QuasarDonkey! I'm amazed this is truly brillaint break throught (possibly deserves this year's modding award!) I look forward to seeing the details :)

congratulations! QD well done and thank-you.

P.S. a tutorial on the changes you made to make this work would be of intrest to me and may lead to other modding discoveries ;)
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: disassembler help/energy screen project

Post by QuasarDonkey »

Thank you! But just to reiterate, there still is a problem with crashing on leaving the solar system screen. Hopefully I'll get it fixed soon. Either way, I'll just post my patch tool soon which contains all the changes.
Peter1981 wrote:P.S. a tutorial on the changes you made to make this work would be of interest to me and may lead to other modding discoveries ;)
Yeah I've made a few discoveries in the process which may allow for modding of other screens too (to what end, I do not know).
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7851
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: disassembler help/energy screen project

Post by thunderchero »

QuasarDonkey wrote:Yeah I've made a few discoveries in the process which may allow for modding of other screens too (to what end, I do not know).
first one that comes to mind would be the redeployment screen to allow more than 9 in a fleet. :wink:

thunderchero
Post Reply

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