Author Topic: Gold Box Companion - tool for GB games  (Read 20410 times)

Offline Ishad Nha

  • Hero Member
  • *****
  • Posts: 945
Re: Gold Box Companion - tool for GB games
« Reply #30 on: September 26, 2015, 10:13:33 AM »
You could add a Jump function, enabling the party to jump from town to town. In at least some of the Gold Box games it is known how to do this. As lists of Geo and Ecl records are known for all Gold Box (known for the two Buck Rogers games?), you can use File Compare to compare two save games when you enter a new town.
Save, enter the new town, save in a new slot, then compare the two files.
« Last Edit: September 26, 2015, 10:19:21 AM by Ishad Nha »

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #31 on: September 26, 2015, 09:08:57 PM »
I've released a new beta version of Gold Box Companion.

- Support for Unlimited Adventures, Buck Rogers: Countdown to Doomsday and Matrix Cubed.
- Automapping for all games.
- Journal entries / passwords can be viewed from a menu.
- Save game editor where you can backup saves, add/replace party characters and edit inventory.

12 games is a big number of titles to support so there are most likely bugs and quirks still left.

Screenshots and more information:
http://personal.inet.fi/koti/jhirvonen/gbc/

Direct download link:
http://personal.inet.fi/koti/jhirvonen/gbc/gbc.zip

Very experimental event placer for all other games than FRUA:
If you right click on the map it will show event numbers. Control + right click allows you to enter / change event on the location.
This could be used for a live map editor where you could immediately walk around the map and test events. Spawning a training hall would be useful in some cases.

Excellent work. I'm currently using this to investigate the lizard man keep in pool of radiance - but I can't get the map to work (the rest of the HUD comes up ok). The area view is disabled normally for this geo. Am I doing something wrong?

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #32 on: September 27, 2015, 02:48:52 AM »
Excellent work. I'm currently using this to investigate the lizard man keep in pool of radiance - but I can't get the map to work (the rest of the HUD comes up ok). The area view is disabled normally for this geo. Am I doing something wrong?

If you press the "search wizard" button on the HUD, the HUD closes and you'll see the start window and the log again. There should be a message if the map or party location wasn't found.
If you mail me a save game I could try it out.
joonas.hirvonen@pp.inet.fi

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #33 on: September 27, 2015, 02:27:38 PM »
Excellent work. I'm currently using this to investigate the lizard man keep in pool of radiance - but I can't get the map to work (the rest of the HUD comes up ok). The area view is disabled normally for this geo. Am I doing something wrong?

If you press the "search wizard" button on the HUD, the HUD closes and you'll see the start window and the log again. There should be a message if the map or party location wasn't found.
If you mail me a save game I could try it out.
joonas.hirvonen@pp.inet.fi
Hey - it seems to be a problem when I'm loading a game in wilderness map mode then entering a dungeon - I can send you a saved game if you want.

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #34 on: September 27, 2015, 09:49:28 PM »
Excellent work. I'm currently using this to investigate the lizard man keep in pool of radiance - but I can't get the map to work (the rest of the HUD comes up ok). The area view is disabled normally for this geo. Am I doing something wrong?

If you press the "search wizard" button on the HUD, the HUD closes and you'll see the start window and the log again. There should be a message if the map or party location wasn't found.
If you mail me a save game I could try it out.
joonas.hirvonen@pp.inet.fi
Hey - it seems to be a problem when I'm loading a game in wilderness map mode then entering a dungeon - I can send you a saved game if you want.

Yes, the map location is searched for only once at the same time when the character search is done. So, when loading a game in wilderness mode, you have to save the game after entered a normal map and then search again.

I couldn't quite figure how the wilderness maps work and they seem to work different in every game.

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #35 on: September 27, 2015, 10:06:38 PM »
Excellent work. I'm currently using this to investigate the lizard man keep in pool of radiance - but I can't get the map to work (the rest of the HUD comes up ok). The area view is disabled normally for this geo. Am I doing something wrong?

If you press the "search wizard" button on the HUD, the HUD closes and you'll see the start window and the log again. There should be a message if the map or party location wasn't found.
If you mail me a save game I could try it out.
joonas.hirvonen@pp.inet.fi
Hey - it seems to be a problem when I'm loading a game in wilderness map mode then entering a dungeon - I can send you a saved game if you want.

Yes, the map location is searched for only once at the same time when the character search is done. So, when loading a game in wilderness mode, you have to save the game after entered a normal map and then search again.

I couldn't quite figure how the wilderness maps work and they seem to work different in every game.

Fair enough. The other thing I noticed was that NPC combat icons weren't showing up on the HUD. I'm not sure if that's a bug or not.

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #36 on: September 28, 2015, 12:48:35 PM »
The other thing I noticed was that NPC combat icons weren't showing up on the HUD. I'm not sure if that's a bug or not.
For PC characters I create the combat icons from pregenerated head/body bitmaps located in the GBC's Games\<game>\ -folder. NPC icons are not shown unless there are bitmap files named after the NPC in that folder. (Hero_1.bmp and Hero_2.bmp, for example). I could of course get the pics from CPICx.DAX-files.

Offline Milos Gulan

  • Hero Member
  • *****
  • Posts: 3151
Re: Gold Box Companion - tool for GB games
« Reply #37 on: October 01, 2015, 05:01:40 PM »
This is looking better and better over time. Well done! What I wouldn't've given to have this available when I played through the games.

I agree with this and thank You very much for this wonderful tool. Site looks amazing and I hope I will have time soon to look trough that and to update to new version of the program.
« Last Edit: October 01, 2015, 05:11:08 PM by Milos Gulan »

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #38 on: October 02, 2015, 06:12:10 PM »
I'm going to write a tool(sort of monitor mode/debugging) for monitoring the execution of ecl code while the games run (inside of dosbox), so I can better analyze how they work. I can do this by adding it to dosbox, but it might work well as an addition to Gold Box Companion - jhirvonen, if you're interested, let me know.

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #39 on: October 03, 2015, 01:29:27 AM »
I'm going to write a tool(sort of monitor mode/debugging) for monitoring the execution of ecl code while the games run (inside of dosbox), so I can better analyze how they work. I can do this by adding it to dosbox, but it might work well as an addition to Gold Box Companion - jhirvonen, if you're interested, let me know.

Sure! I was thinking of adding a feature when you mouse over a map location -> shows the related ECL script but at this point I know very little how ECLs work.

 I guess the info on these files is scattered around here and in Simeon's Curse-code / Gold Box Explorer?


Offline Ishad Nha

  • Hero Member
  • *****
  • Posts: 945
Re: Gold Box Companion - tool for GB games
« Reply #40 on: October 03, 2015, 01:54:17 AM »
Simeon's EclDump program will show how the CAB Ecls work. This gives you a feel for how they work in other Gold Box games. Check his profile for the EclDump link. (Anyone who wants this program: go to his profile, wave cursor over Profile Info, then hold cursor over Show Posts, then click on Attachments.)
My Dark Queen of Krynn and (Offline) Neverwinter Nights Ecl spreadsheets will show the Ecls at the Byte level, hopefully:
DQKECLA.zip, DQKECLB.zip, NWNEclDecryptsA.zip and NWNEclDecryptsB.zip
« Last Edit: October 03, 2015, 02:09:44 AM by Ishad Nha »

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #41 on: October 03, 2015, 06:06:16 AM »
I'm going to write a tool(sort of monitor mode/debugging) for monitoring the execution of ecl code while the games run (inside of dosbox), so I can better analyze how they work. I can do this by adding it to dosbox, but it might work well as an addition to Gold Box Companion - jhirvonen, if you're interested, let me know.

Sure! I was thinking of adding a feature when you mouse over a map location -> shows the related ECL script but at this point I know very little how ECLs work.

 I guess the info on these files is scattered around here and in Simeon's Curse-code / Gold Box Explorer?
Yeah, the ecldump program Ishad mentioned is the primary source - GBE basically contains a copy of that. I have a fair bit of understanding as to how the ECLs work, but they're difficult to analyze statically. Some static analysis I did: http://ua.reonis.com/index.php?topic=2519.0

To do dynamic analysis, we're probably going to have to be able to set breakpoints (and ideally, watchpoints) in the running game executables. I know that dosbox has some debugging features. How does GBC interface with dosbox?

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #42 on: October 03, 2015, 08:37:44 AM »
To do dynamic analysis, we're probably going to have to be able to set breakpoints (and ideally, watchpoints) in the running game executables. I know that dosbox has some debugging features. How does GBC interface with dosbox?

Interfacing is done by grabbing / searching / reading / writing DOSBox's memory.

The functions I have used:

To find the DOSBox window:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633520(v=vs.85).aspx

To open the process:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633522(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx

Read the process:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms680553(v=vs.85).aspx

One thing you could try is to modify a map location's ECL-script in the memory.
"Backup" the existing ECL so it can be restored.
If there's a some kind of "end script", "goto end" or something like that in the ECL commands, you could insert that command into the script to make it halt when wanted.
You could also experiment by replacing commands with another one and so on.

By tweaking the game executables or using a custom version of DOSBox of course would give you more control.

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: Gold Box Companion - tool for GB games
« Reply #43 on: October 04, 2015, 12:07:20 AM »
We have a very Inception like situation here, with virtual machines nested inside each other - the ECL VM inside a dos game being emulated by dosbox which is running in windows (which in my case, is itself running inside a virtual machine)

Interfacing is done by grabbing / searching / reading / writing DOSBox's memory.

The functions I have used:

To find the DOSBox window:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633520(v=vs.85).aspx

To open the process:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633522(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx

Read the process:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms680553(v=vs.85).aspx

Thanks - how do you actually set a breakpoint via the windows api? Maybe I'm missing something, but I couldn't find it among the debugger documentation you linked to.

By tweaking the game executables or using a custom version of DOSBox of course would give you more control.
I'd like to avoid that, if I can somehow.

One thing you could try is to modify a map location's ECL-script in the memory.
"Backup" the existing ECL so it can be restored.
If there's a some kind of "end script", "goto end" or something like that in the ECL commands, you could insert that command into the script to make it halt when wanted.
You could also experiment by replacing commands with another one and so on.
That sounds like a more flexible approach. There's an ECL command 'exit', which is just a single byte of 0. But I presume it resets the program counter and maybe other things.

What I really want is an ECL op that will pause the game, so the debugger can examine the memory contents, restore the original ecl byte code for the next command, and maybe modify whatever the ECL virtual machine is using as an instruction pointer or return stack, so it will point to the next command correctly. The ideal command would be one which doesn't have any arguments, so the rest of the ECL space could be filled with that command byte. I've got some ideas, but I'll have to do some pondering.

Offline jhirvonen

  • Jr. Member
  • **
  • Posts: 92
Re: Gold Box Companion - tool for GB games
« Reply #44 on: October 04, 2015, 10:53:34 AM »
how do you actually set a breakpoint via the windows api? Maybe I'm missing something, but I couldn't find it among the debugger documentation you linked to.

Actually I don't set breakpoints. All is done by just by memory modification. I forgot to mention the WriteProcessMemory-function.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681674(v=vs.85).aspx