Standard Trek.exe IDA Database

Standard Trek.exe IDA Database; support/discussion/questions

Moderator: thunderchero

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Standard Trek.exe IDA Database

Post by Tethys » Sat Aug 27, 2011 3:50 pm

thunderchero wrote:
QuasarDonkey wrote:I actually have a few patches in the works for various parts of BotF. I'll start releasing them soon enough.

sounds interesting I can't wait

thunderchero
Seconded. Am I correct in assuming these will be hex fixes? Or do you plan on giving us asm to decode? ;)
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

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

Re: Standard Trek.exe IDA Database

Post by Peter1981 » Sat Aug 27, 2011 5:54 pm

^^ hopefully both QD so those who understand asm can pour over the ideas and concepts while those who don't can type and play :)

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Standard Trek.exe IDA Database

Post by Tethys » Sat Aug 27, 2011 8:09 pm

^ yeah what he said :P I try not to delve to much into asm code, hex code is alooooooooooot easier.
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

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

Re: Standard Trek.exe IDA Database

Post by thunderchero » Sat Aug 27, 2011 9:43 pm

Tethys wrote:^ yeah what he said :P I try not to delve to much into asm code, hex code is alooooooooooot easier.
I know you are afraid you might learn something new lol

thunderchero

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Standard Trek.exe IDA Database

Post by Tethys » Sat Aug 27, 2011 11:16 pm

I dont have time to learn anything new, so I suppose u are right ;)
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

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

Re: Standard Trek.exe IDA Database

Post by QuasarDonkey » Mon Aug 29, 2011 3:03 pm

Sorry guys, I was away for a few days (still am actually).

I had started two patches already, and I've done preliminary research for a few more. One patch I built should allow playing BotF using a folder instead of STBOF.RES. It seems to work for reading the first twenty or so files, but crashes out when reading aibldreq.bin. No idea why yet.

A second patch is to get BotF running in windowed mode. But it's not been entirely successful yet either :?

A third patch I'm doing some research on is replacing trek.exe's complex random number generators with something more predictable for research/diagnostic purposes (I'm thinking AI research).

Most of my patches have failed so far, so I think I'll do some simpler ones first. I'm gonna try make a patch to lower CPU usage.
Tethys wrote:Am I correct in assuming these will be hex fixes? Or do you plan on giving us asm to decode?
Peter1981 wrote:^^ hopefully both QD so those who understand asm can pour over the ideas and concepts while those who don't can type and play :)
I'll provide ASM and hex, and I might use diablo's Universal Patcher too for easy patching.

Hopefully I'll get some of the patches working soon. If anyone has requests/ideas for specific patches (simple ones for now), please mention them. I wanna get some practice in ASM coding.

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2065
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Standard Trek.exe IDA Database

Post by Tethys » Mon Aug 29, 2011 3:41 pm

Well, since you offered :P

Would it be possible to create a zoomable under/overlay for the galactic map? It could be a small step towards creating 'quadrants'. It would show up similar to the way ship ranges show up, but maybe as a white or blue line for quadrant dividers. I dont know if its possible but I think it would be a great cosmetic feature if you are up to the task ;)

Also, if you are up to it, could you find a way to keep empire borders unlocked after signing a non aggression treaty? It would be a nice twist to the game (I remember several episodes where ships crossed into demilitarized space such as the DMZ and RNZ) ;)

Im interested to see BotF maybe use MORE CPU and memory, maybe to speed things up a bit? But ive heard Botf doesnt exactly like 'fast' :lol:
Not for the weak of heart...
Image
GALM <--- GALM/Galaxies Mod

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

Re: Standard Trek.exe IDA Database

Post by thunderchero » Mon Aug 29, 2011 4:28 pm

Not sure how easy this would be....

But I would like for structures when set to upgrade an older structure it replaces the older structure instead of having both of them.

currently the scanner structures and main manned structures do this but no other structure set to upgrade will.

thunderchero

User avatar
xDx
Commander
Commander
Posts: 275
Joined: Sat May 10, 2008 2:00 am
Location: East Coast, USA

Re: Standard Trek.exe IDA Database

Post by xDx » Mon Aug 29, 2011 5:47 pm

I would like to see AI empires able to be set at different diplomatic stances for beginning game. Currently only minors can be adjusted with major empires. It would be a great addition to be able to do this for the mod I am working on but also make the current game/mods more interesting besides just making a team game. Great work with this database :) I dont understand a lot of it but I have been looking at every version you uploaded and hopefully in time we can solve the memory issue with BotF which is I think one of the biggest problems with the game.

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

Re: Standard Trek.exe IDA Database

Post by Flocke » Mon Aug 29, 2011 6:08 pm

QuasarDonkey wrote:A second patch is to get BotF running in windowed mode. But it's not been entirely successful yet either :?
see pseudo windowed mode
mpr97 (CreateDevice or something) also has an option to render in windowed mode, but for some reason it didn't work in my tests either.
Tethys wrote:Would it be possible to create a zoomable under/overlay for the galactic map? It could be a small step towards creating 'quadrants'. It would show up similar to the way ship ranges show up, but maybe as a white or blue line for quadrant dividers. I dont know if its possible but I think it would be a great cosmetic feature if you are up to the task ;)
Since you asked, that would be lots of work and if you want to do it well you need a new engine. *cough*
Maybe multiple zoom levels could be added.
Tethys wrote:Also, if you are up to it, could you find a way to keep empire borders unlocked after signing a non aggression treaty? It would be a nice twist to the game (I remember several episodes where ships crossed into demilitarized space such as the DMZ and RNZ) ;)
Good idea, I often wondered on this, too. AI complaints about flying through their territory anyway.
should be a simple fix but might need some more analysis to find, it's at least in turn processing as well as in shiprange calculation
Tethys wrote:Im interested to see BotF maybe use MORE CPU and memory, maybe to speed things up a bit? But ive heard Botf doesnt exactly like 'fast' :lol:
Unlike java with it's virtual machine, in c++ botf isn't restricted in ressources, but the algorithms are just that slow (and not much multi-threaded). To speed up the game you've to figure what functions are causing the slow downs (like ai ship movement) and reimplement faster alternatives.
I'd not take this as a first task, ai programming can be quite complex.
Lessening CPU usage doesn't seem much useful to me either. BotF already uses sleep calls, only video playback and turn processing doesn't and for current turn processing it can't be changed cause it's not loop based but a bunch of massive functions executed one after another.
thunderchero wrote:Not sure how easy this would be....
But I would like for structures when set to upgrade an older structure it replaces the older structure instead of having both of them.
currently the scanner structures and main manned structures do this but no other structure set to upgrade will.
this should be easy to fix but requires some asm search/debugging
somewhere must be a check for the buildings and it's known how data is stored by savegame analysis
I expect the whole turn processing calculation can be rewritten, but better not all at once
xDx wrote:I would like to see AI empires able to be set at different diplomatic stances for beginning game. Currently only minors can be adjusted with major empires.
I once had some idea on a savegame generator, but it would be much simpler to just do some makeover to the galaxy generation.
This should be a pretty simple thing in terms of programming.
To adjust start attitude a configurion file like an ini could be used.

another nice idea would be to finally fix the minor's upgrade bug, sometimes loosing their factories and research centers
alot of research has been done on minor development but a final fix is still missing
also it would be great to make the minor's evolution relate better to the game settings

shall we reopen a wishlist? :lol:

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

Re: Standard Trek.exe IDA Database

Post by QuasarDonkey » Mon Aug 29, 2011 9:42 pm

Okay, I'm back home now. Seems there's been quite a discussion :)
Flocke wrote:shall we reopen a wishlist?
I'm not sure if that's necessary yet. Anyway I don't want to get inundated with too many requests.
Flocke wrote:Lessening CPU usage doesn't seem much useful to me either. BotF already uses sleep calls, only video playback and turn processing doesn't and for current turn processing it can't be changed cause it's not loop based but a bunch of massive functions executed one after another.
If you're a laptop user, I think you can understand the overheating problems when running at 100% CPU. The sleep calls are what I was gonna look at. Trek.exe consumes 100% CPU even when idle. That's not right. Looking at the MSDN documentation for sleep():
MSDN wrote:If dwMilliseconds is less than the resolution of the system clock, the thread may sleep for less than the specified length of time.
AFAIK system clock resolutions vary somewhere between 10 and 40 ms. In Trek.exe, sleep is called for 0 or 1 ms. I'm gonna play around with the time delays, to see if Trek.exe can use less CPU when doing nothing, without affecting game performance.

Oh, thanks for the link on windowed mode. I wanted to create something easier that just works. It may turn out to be impossible without rewriting MPR :wink:
Tethys wrote:Would it be possible to create a zoomable under/overlay for the galactic map?
Having quadrants wouldn't be impossible, but I don't have the needed information yet.
thunderchero wrote:I would like for structures when set to upgrade an older structure it replaces the older structure instead of having both of them.
You're saying you want energy structures (other than scanners) to be upgradeable like standard manned structures? I can see how that would be useful. I would have thought it'd be in edifice.bst. Have you tried editing different building parameters like GROUP? I'll take a look into the code if it's confirmed that there's nothing in edifice.bst that controls this. Maybe DCER would know more about it.
xDx wrote:I would like to see AI empires able to be set at different diplomatic stances for beginning game.
I'm thinking aiempire.wtf. Ideas anyone?
Tethys wrote:could you find a way to keep empire borders unlocked after signing a non aggression treaty?
Spocks-cuddly-tribble wrote:That's easy via empsInfo or sector.lst. Code locations are known from ferengi trade route code & territorial claims -projects.
Thanks SCT, that takes a load off :o Seems like we're already making progress.

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

Re: Standard Trek.exe IDA Database

Post by QuasarDonkey » Mon Aug 29, 2011 10:07 pm

Update on the lower-CPU patch:

As as test, I changed 2 calls to sleep(0) to sleep(10) with no noticeable decrease in performance. On the opening, diplomacy, and intelligence screens, CPU usage is < 10% when idle versus 100% with the vanilla trek.exe. Moving the mouse makes CPU usage spike. CPU goes to 100% when moving the mouse on the main galactic map, but falls slightly when not moving (well I have a pretty slow computer, so it'd be better on new machines). I'll continue fiddling with the different calls to sleep() to try find optimal values.

This may actually be a bug in BotF, depending on how you look at it. There's no reason why any program should run at 100% CPU when doing nothing. When I get the patch done, BotF will only use as much CPU as it needs, when it needs it. This should allow for cooler CPUs and lower electricity bills :D

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

Re: Standard Trek.exe IDA Database

Post by thunderchero » Mon Aug 29, 2011 11:20 pm

QuasarDonkey wrote:
thunderchero wrote:I would like for structures when set to upgrade an older structure it replaces the older structure instead of having both of them.
You're saying you want energy structures (other than scanners) to be upgradeable like standard manned structures? I can see how that would be useful. I would have thought it'd be in edifice.bst. Have you tried editing different building parameters like GROUP? I'll take a look into the code if it's confirmed that there's nothing in edifice.bst that controls this. Maybe DCER would know more about it.
I have tested many of the used and unused code (up to 29) from DCER edifice.bst list below with no success.

even changing scanner output type seems to break upgrade code so I think it might be linked to output type in trek.exe.

Offset 0x0074 to 0x0074 group

Values:
00 - Main Cardassian food
01 - Main Federation food
02 - Main Ferengi food
03 - Main Klingon food
04 - Main Romulan food
06 - Main Cardassian industry
07 - Main Federation industry
08 - Main Ferengi industry
09 - Main Klingon industry
0A - Main Romulan industry
0C - Main Cardassian energy
0D - Main Federation energy
0E - Main Ferengi energy
0F - Main Klingon energy
10 - Main Romulan energy
12 - Main Cardassian intel
13 - Main Federation intel
14 - Main Ferengi intel
15 - Main Klingon intel
16 - Main Romulan intel
18 - Main Cardassian research
19 - Main Federation research
1A - Main Ferengi research
1B - Main Klingon research
1C - Main Romulan research
1E - Scanners
22 - Other

thunderchero

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

Re: Standard Trek.exe IDA Database

Post by Flocke » Tue Aug 30, 2011 6:17 am

QuasarDonkey wrote:Update on the lower-CPU patch:

As as test, I changed 2 calls to sleep(0) to sleep(10) with no noticeable decrease in performance. On the opening, diplomacy, and intelligence screens, CPU usage is < 10% when idle versus 100% with the vanilla trek.exe. Moving the mouse makes CPU usage spike. CPU goes to 100% when moving the mouse on the main galactic map, but falls slightly when not moving (well I have a pretty slow computer, so it'd be better on new machines). I'll continue fiddling with the different calls to sleep() to try find optimal values.

This may actually be a bug in BotF, depending on how you look at it. There's no reason why any program should run at 100% CPU when doing nothing. When I get the patch done, BotF will only use as much CPU as it needs, when it needs it. This should allow for cooler CPUs and lower electricity bills :D
Ah, you want to lower energy consumtion by it. :)
Well, as you said, the sleep call is very unreliable and can vary - it's variation is also operation system specific. That's especially an issue for 3D rendering cause it can result in noticable hiccups, so it's not a bug in BotF.
Sleep(0) is a special sleep call that immediatly returns when there are no other applications waiting in the operation system's process cycle, and is often used to get the highest fps possible out of windows, while still not blocking other applications.
But if you codecave it to a dll, using 'WaitableTimer' is a better alternative to the sleep call, it has a higher resolution.
I already implemented that approach, refer to KSystem::wait, you know where to find. ;)

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

Re: Standard Trek.exe IDA Database

Post by thunderchero » Tue Aug 30, 2011 11:30 am

here is a suggestion that might be a little easier. :wink:

Gowron has been able to edit some code to allow tech level multipliers for food, industry, and enegry

viewtopic.php?f=9&t=238&p=2834&hilit=Te ... db2b#p2834

I looked at Assembly code only, but when looking at this I saw this sub 461930 This sub has "the Cardassian bonus for manned intel" as well as the 3 above. But has others I do not know what they are for but look very similar.

viewtopic.php?f=9&t=761&p=10388&hilit=t ... b2b#p10388

It would be nice to have tech level multipliers for all 5 main building types.

thunderchero

Post Reply

Return to “Standard Trek.exe IDA Database”

Who is online

Users browsing this forum: No registered users