Author Topic: A theory about menus I'd like some help with  (Read 14298 times)

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
A theory about menus I'd like some help with
« on: 2010-04-10 15:54:51 »
How difficult would it be to add a menu item to the in-game menu? The text probably isn't hard, but what about linking it to a function.

For now I'm thinking about the PC version.

titeguy3

  • No life
  • *
  • Posts: 1287
  • Karma: 2
  • A jack of all trades
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #1 on: 2010-04-10 16:36:53 »
How difficult would it be to add a menu item to the in-game menu? The text probably isn't hard, but what about linking it to a function.

For now I'm thinking about the PC version.
Well I can tell you that in the English version of ff7.exe, you can find the string array of the menu item names at 0x5192C0 ~ 0x51939B. (You can consistently find it by searching for "30 28 33" -- PHS). Each String is allocated 20 bytes of memory, and there's exactly enough room for the 11 strings, but they're part of a larger array of general strings used in the menu, so it might not be hard to extend the array by 1 element and cram some text into 0x51948C...

As for actually adding it in, AFAIK, there isn't room for another item in the menu context, so one would either have to figure out how to shove the texts closer together or extend the blue menu window further down the screen. I'm not exactly sure, but I think Aali might have some control over things like that with his driver:
Quote from: Aali
I control what gets rendered where

Adding a function would be quite difficult. I don't see it being a possibility within the confines of hex editing as increasing the filesize throws off all sorts of flow control. I think that perhaps somebody in the QGears project might have a better idea than me, but if you can find out where those strings I mentioned earlier are referenced in the exe, that might be a start...

Just out of curiosity, what would you want the new menu item to do?

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #2 on: 2010-04-10 19:06:54 »
How difficult would it be to add a menu item to the in-game menu? The text probably isn't hard, but what about linking it to a function.

For now I'm thinking about the PC version.
Well I can tell you that in the English version of ff7.exe, you can find the string array of the menu item names at 0x5192C0 ~ 0x51939B. (You can consistently find it by searching for "30 28 33" -- PHS). Each String is allocated 20 bytes of memory, and there's exactly enough room for the 11 strings, but they're part of a larger array of general strings used in the menu, so it might not be hard to extend the array by 1 element and cram some text into 0x51948C...

I anticipated that. 20 chars is more than any of them need. I was going to reduce the size of the array to, perhaps, 16 characters per entry. That'd leave me 44 characters at the "end". Again, this is all theory.

As for actually adding it in, AFAIK, there isn't room for another item in the menu context, so one would either have to figure out how to shove the texts closer together or extend the blue menu window further down the screen. I'm not exactly sure, but I think Aali might have some control over things like that with his driver:
Quote from: Aali
I control what gets rendered where

Adding a function would be quite difficult. I don't see it being a possibility within the confines of hex editing as increasing the filesize throws off all sorts of flow control. I think that perhaps somebody in the QGears project might have a better idea than me, but if you can find out where those strings I mentioned earlier are referenced in the exe, that might be a start...

Just out of curiosity, what would you want the new menu item to do?

It's not even a new function. It would be easy to just have it point to the already existing function (which I also have to find). I'm just tired of something not being accessible when I think it should be. I'll leave it to your imagination for the moment. ;)

BPLD

  • And then it dawned on me, that Satan is also an old fuck.
  • Freak
  • *
  • Posts: 899
  • Karma: -42
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #3 on: 2010-04-10 19:51:11 »
....Why don't you just create new points in towns and whatnot?

EDIT: Or make the crystal usable wherever

sithlord48

  • No life
  • *
  • Posts: 1541
  • Karma: 33
  • Dark Lord of the Savegame
    • View Profile
    • Blackchocobo
Re: A theory about menus I'd like some help with
« Reply #4 on: 2010-04-10 22:10:40 »
nfitc1, there are  visibility + lock mask bytes located in the save game file for the menu .  save map its in bank 1/2 offset 0xba4+ 28 (for visibility)  and 0xba4 +30 (for locking mask) , its on my list to allow editing of these , just not a priority right now.

Bosola

  • Fire hazard!
  • No life
  • *
  • Posts: 1770
  • Karma: 15
    • View Profile
    • My YouTube Channel
Re: A theory about menus I'd like some help with
« Reply #5 on: 2010-04-11 01:22:49 »
Pretty sure there's an unused menu item in at least the PSX version that can be accessed by GS. Then again, I've never actually confirmed it.

If so, it would make your life far simpler.

obesebear

  • Administrator
  • *
  • Posts: 3312
  • Karma: 113
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #6 on: 2010-04-11 01:28:52 »
There's the USO code....

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #7 on: 2010-04-11 15:23:59 »
There's the USO code....

Does the USO code exist on the PC ? i remember when i was making a hack to unlock all menu's (materia+phs+save) i found the text but i couldnt find the actual menu (this doesnt mean it doesnt exist it just means i couldnt find it), The only hidden menu i remember seeing was a blank screen where the "Order" menu should be (its just blank, no text since the order is done from the main menu)

EDIT- here is the Order Menu i mentioned above
« Last Edit: 2010-04-11 15:36:10 by kranmer »

Bosola

  • Fire hazard!
  • No life
  • *
  • Posts: 1770
  • Karma: 15
    • View Profile
    • My YouTube Channel
Re: A theory about menus I'd like some help with
« Reply #8 on: 2010-04-11 17:25:48 »
There's the USO code....

That's the one! Yes, there's some sort of unused menu. I don't know what it's supposed to do, though.

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #9 on: 2010-04-12 02:17:59 »
There's the USO code....

That's the one! Yes, there's some sort of unused menu. I don't know what it's supposed to do, though.

I hope it's not what I'm intending to do.... I doubt it though.

obesebear

  • Administrator
  • *
  • Posts: 3312
  • Karma: 113
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #10 on: 2010-04-12 02:25:50 »
USO is a forced PHS system.  You can switch ANYONE in and out of your party.  You can have just Young Cloud, or Sephiroth and Cait Sith.. or 3 Cid's... whatever combination you can think up

titeguy3

  • No life
  • *
  • Posts: 1287
  • Karma: 2
  • A jack of all trades
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #11 on: 2010-04-12 02:55:06 »
USO is a forced PHS system.  You can switch ANYONE in and out of your party.  You can have just Young Cloud, or Sephiroth and Cait Sith.. or 3 Cid's... whatever combination you can think up
Speaking of which, I've always wanted to be able to switch cloud out of the party, and to be able to choose how many characters to have in your party. It'd be fun to solo it up every now and again, or come up with combinations other than Cloud plus 2.

sithlord48

  • No life
  • *
  • Posts: 1541
  • Karma: 33
  • Dark Lord of the Savegame
    • View Profile
    • Blackchocobo
Re: A theory about menus I'd like some help with
« Reply #12 on: 2010-04-12 03:01:03 »
Speaking of which, I've always wanted to be able to switch cloud out of the party, and to be able to choose how many characters to have in your party. It'd be fun to solo it up every now and again, or come up with combinations other than Cloud plus 2.
you can use black chocobo to unlock cloud from the party (check him off in the "allowed in phs" box found under the others tab), but i don't think ne thing i do to the save file will allow for partys of <3 when ever you want.

Nightmarish

  • Freak
  • *
  • Posts: 533
  • Karma: 0
  • owari da
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #13 on: 2010-04-12 10:13:49 »
USO is a forced PHS system.  You can switch ANYONE in and out of your party.  You can have just Young Cloud, or Sephiroth and Cait Sith.. or 3 Cid's... whatever combination you can think up
Speaking of which, I've always wanted to be able to switch cloud out of the party, and to be able to choose how many characters to have in your party. It'd be fun to solo it up every now and again, or come up with combinations other than Cloud plus 2.

Though about that too.
I also would like that the model on the worldmap would be the first person on the party. I want to go around as Vincent T_T

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #14 on: 2010-04-12 15:30:21 »
Does anyone know where the code for the menu items is? When I click on one, where does the executable decide what to do next?

sithlord48

  • No life
  • *
  • Posts: 1541
  • Karma: 33
  • Dark Lord of the Savegame
    • View Profile
    • Blackchocobo
Re: A theory about menus I'd like some help with
« Reply #15 on: 2010-04-12 15:31:52 »
i think i remember seeing that on the wiki or at least some info on it

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #16 on: 2010-04-12 17:19:48 »
im not sure exactly on what your looking for but i do know that the address
0x6C6AF1 mov eax,[00dc12ec]
is the menu instruction and the value there is the menu your on.
(also note that is the memory address, The address in the EXE is 0x2C5EF1)
« Last Edit: 2010-04-12 17:25:25 by kranmer »

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #17 on: 2010-04-12 19:13:28 »
im not sure exactly on what your looking for but i do know that the address
0x6C6AF1 mov eax,[00dc12ec]
is the menu instruction and the value there is the menu your on.
(also note that is the memory address, The address in the EXE is 0x2C5EF1)

Thanks for this. It helped a lot! I got very close to getting it right on my first try. :)

Prince Lex

  • Freak
  • *
  • Posts: 883
  • Karma: 1
  • Opinionfact is Redundancy
    • View Profile
    • Myspace Profile
Re: A theory about menus I'd like some help with
« Reply #18 on: 2010-04-12 21:35:58 »
USO is a forced PHS system.  You can switch ANYONE in and out of your party.  You can have just Young Cloud, or Sephiroth and Cait Sith.. or 3 Cid's... whatever combination you can think up
Speaking of which, I've always wanted to be able to switch cloud out of the party, and to be able to choose how many characters to have in your party. It'd be fun to solo it up every now and again, or come up with combinations other than Cloud plus 2.

Though about that too.
I also would like that the model on the worldmap would be the first person on the party. I want to go around as Vincent T_T

I experimented with this for a while using a german save editor a while back. See here for more details. It also allows you to have just one character, but isn't really the best solution because some models don't have paths in certain places. I.e. "I want to control Vincent instead of Cloud" - he'll only show up on screens that his model was programmed to appear on. It still works in certain places though, every character is just treated like they're Cloud.

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #19 on: 2010-04-12 23:56:49 »
Thanks for this. It helped a lot! I got very close to getting it right on my first try. :)

I am glad it helped, I wasn't sure if that was what you was looking for or not.
Also i am not sure on this but the menu's may have 2 parts of code for each screen,
I was experimenting and found that there is a value for the menu then another value for the controls and name for that menu (for example even if you manage to change the code to the materia page to the magic page the controls for where the cursor would still be set for the materia page and and would make them not work).
But i could be completely wrong so dont take my word for it, I am not really a coder i am just somone with alot of time on his hands.

And on a side note i found 2 entries for the USO code but both seem to be dead ends on the PC version (or maybe i am doing somthing wrong), and they are not in the same place as they are on the PSX (proberly because the PSX doesnt have a quit menu like the PC so the USO code went there)

Zen

  • Insane poster
  • *
  • Posts: 403
  • Karma: -4
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #20 on: 2010-04-13 10:10:08 »
You know, a Load Game function in the menu would surely be useful. But I guess it would have been done by now if someone had the necessary knowledge.




NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #21 on: 2010-04-13 11:55:44 »
You know, a Load Game function in the menu would surely be useful. But I guess it would have been done by now if someone had the necessary knowledge.

This is actually the very thing I'm attempting. I'm getting closer to changing one of the menu functions to the load screen from the beginning of the game, but it's not working out very well. When I point it to the instruction set that will begin the menu process (I believe it's at 0x72225A or something) the game freezes. Well, I see the timer moving, but I don't have control at all. I can point it to a place where it will draw the save menu, but I still don't have a cursor. I'm thinking I'll have to use one of the unused menus in the PC version (apparently there's at least three that don't get called and there's a few duplicate menus too) to make an entire sequence of events to fire. I'm just not sure which ones do do after the 0x72225A. That's the one that should draw the menu, but there's more to it than that.

halkun

  • Global moderator
  • *
  • Posts: 2113
  • Karma: 23
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Re: A theory about menus I'd like some help with
« Reply #22 on: 2010-04-13 13:42:08 »
On the PSX those .MNU files are actually compiled executable overlays that are banked in. It's why they are "embedded" in the exe in the PC version. This code isn't so much "hidden" in so much that you are executing a code stub that's half loaded.

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
Re: A theory about menus I'd like some help with
« Reply #23 on: 2010-04-14 21:14:01 »
hey NFITC1 i was looking a little more at the code trying to find the overlay for load and save and i think i might have found somthing (it may be nothing but looked a little promising)

Load-
00722040 - mov [00dd7704],00000000 - Main Screen that displays 1-10

0x72214A - mov [00dd7704],00000001 -
0x721E9C - mov [00dd7704],00000002 - All 3 are acessed when you click on any saved data 1-10 on main
0x72211E - mov [00dd7704],00000003 -

Save-
0x6FFCDF - mov [00dca028],00000000 - Main Screen that displays 1-10

0x6FFDE1 - mov [00dca028],00000001 -
0x6FFAF7 - mov [00dca028],00000002 - All 3 are acessed when you click on any saved data 1-10 on main
0x6FFDB5 - mov [00dca028],00000003 -

(please note the save/load data screen is the first screen you come to and NOT the actual save slot screen)

NFITC1

  • No life
  • *
  • Posts: 2931
  • Karma: 73
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: A theory about menus I'd like some help with
« Reply #24 on: 2010-04-15 03:22:24 »
hey NFITC1 i was looking a little more at the code trying to find the overlay for load and save and i think i might have found somthing (it may be nothing but looked a little promising)

Load-
00722040 - mov [00dd7704],00000000 - Main Screen that displays 1-10

0x72214A - mov [00dd7704],00000001 -
0x721E9C - mov [00dd7704],00000002 - All 3 are acessed when you click on any saved data 1-10 on main
0x72211E - mov [00dd7704],00000003 -

I noticed things around these places and it seems that code is executed every frame. Like a "monitor input loop" or something. Still, I'll check it out.