Author Topic: (PSX) FF7 - Adding options to the beginning menu?  (Read 6853 times)

Lazy Bastard

  • *
  • Posts: 290
  • I may be lazy, but I can...zzzZZZzzzZZZzzz...
    • View Profile
    • GameHacking.org
In some of Akari's QGears testing (for example, this - http://forums.qhimm.com/index.php?topic=13252.0), I've seen modified versions of what I believe is BGINMENU.MNU (SAVEMENU.MNU for some reason contains the Buster Sword TIM, but the menu itself is BGINMENU.MNU, if I'm not mistaken). However, digging around in BGINMENU.MNU hasn't yielded any appreciable results.

Anyone have a clue as to how this was done?

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #1 on: 2013-03-30 15:11:21 »
In some of Akari's QGears testing (for example, this - http://forums.qhimm.com/index.php?topic=13252.0), I've seen modified versions of what I believe is BGINMENU.MNU (SAVEMENU.MNU for some reason contains the Buster Sword TIM, but the menu itself is BGINMENU.MNU, if I'm not mistaken). However, digging around in BGINMENU.MNU hasn't yielded any appreciable results.

Anyone have a clue as to how this was done?
Yes someone can...


Oh wait you want to know how ... LOL (evil grin)
Actually that is a script in the Q-gears engine. What q-gears does is extract the game data and converts it into meta data and data. The actual script though is in LUA and runs in q-gears. Look at this message and this message in the q-gears forum.

Unfortunately t's all in the LUA scripting.

However you do pose a good question halkun (or if pixel is around) might be able to help with that as I never messed with the code. In any case you If I remember correctly the start menu is actual software (IE program code) that starts the script engine to do stuff. So I believe it's MIPS3 code (heh).  I believe it might be also in the wiki ... somewhere I know it was discussed circa 2005/6 somewhere.

This wiki entry may be of use.

Cyb
« Last Edit: 2013-03-30 15:15:27 by Cyberman »

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #2 on: 2013-03-30 17:46:39 »
the MNU files are actually pre-compiled banks of PSX code, (Which is why they are missing/rolled into the executable of the PC version of FF7).
The upsiade to this is if you know the entry vector, you can code your own MNU file I guess, but you would need to know the kernel callbacks yada/yada/yada

Lazy Bastard

  • *
  • Posts: 290
  • I may be lazy, but I can...zzzZZZzzzZZZzzz...
    • View Profile
    • GameHacking.org
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #3 on: 2013-03-31 02:13:59 »
Cyberman: Ah; that explains a lot (and makes me feel less annoyed that I was unable to make heads or tails of the format, heh). I've read that wiki page (also, where did those images go?).

halkun: I may do just that. Time to get knee-deep in r3000 ASM again  :)

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #4 on: 2013-03-31 02:27:02 »
Cyberman: Ah; that explains a lot (and makes me feel less annoyed that I was unable to make heads or tails of the format, heh). I've read that wiki page (also, where did those images go?).

halkun: I may do just that. Time to get knee-deep in r3000 ASM again  :)
Hmmm a few small suggestions
1:  You should be able to write the code using C/C++ (not asm) the main reason is all those functions were likely written as C functions and they used the linker to make them "load" into specific locations.  Which of course doesn't immediately help you, but it's likely too be C code they have.
2:  You probably want to take halkun's advice and look for 'system' calls in the code. I suggest taking one of the 'menus' and reversing it. The best bet might be 'new game' if possible. You can then take the code and look at how it behaves.
3:  Don't drive yourself insane have us do it for you.... with suggestions ;)

Cyb

Lazy Bastard

  • *
  • Posts: 290
  • I may be lazy, but I can...zzzZZZzzzZZZzzz...
    • View Profile
    • GameHacking.org
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #5 on: 2013-03-31 03:56:41 »
Cyberman:

1 - As in, dynamic linking, or it's actually compiled at runtime?

2 - That's some of what I had in mind, along with setting breakpoints on a few addresses I've already identified as "interesting", and finding the encoded text for "NEW GAME" and "Continue" (capitalization inconsistency copied from the game).

3 - Done :)

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #6 on: 2013-03-31 04:31:44 »
The system uses what's called "overlays" which are precursors to dynamic libraries.

A Static Library is compiled into the executable and becomes part of the code.

A Dynamic Library can be loaded anywhere in memory and has a vector table of functions within it. The program loads the library during run-time, looks up the function in the header it needs to run and then jumps to it and runs it.

An Overlay is a pre-compiled chunk of code that MUST be loaded in a particular memory location by some kind of memory manager, there is no lookup table and the calling function assumes that the overly will be there. This is the same idea as "bank switching" that was done in the old rom days. When another overlay is needed, the old overlay is overwritten. I can assume that all the MNU files are loaded into the exact location over each other and executed with a single function call. You can even probably find that call by reversing the MENU command in the field script.
« Last Edit: 2013-03-31 04:34:44 by halkun »

Lazy Bastard

  • *
  • Posts: 290
  • I may be lazy, but I can...zzzZZZzzzZZZzzz...
    • View Profile
    • GameHacking.org
Re: (PSX) FF7 - Adding options to the beginning menu?
« Reply #7 on: 2013-03-31 06:33:58 »
Ah, very interesting.

A mentally lazier way to begin that (I do have this moniker for a reason :) ) would be to open BGINMENU.MNU in a hex editor, copy a chunk of unique data from it (preferably near the beginning of the file), run the game in pSX (or another emulator with the ability to dump RAM), make a RAM dump while in the beginning menu, open the RAM dump in a hex editor, and paste the BGINMENU.MNU data you copied earlier into a Search feature. It should be pretty easy to identify where in RAM the file is loaded (that's how I lazily found world map models, as well as several other things); now you have a value to search for when looking for the pointer.

I'll play around with this when I've finished a few other things I'm working on for my mod.

Thanks for the info.
« Last Edit: 2013-03-31 06:35:41 by Lazy Bastard »