Author Topic: Need help yet again - Sorting of items and materia  (Read 4446 times)

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
I do not understand the technical aspect of how the game arranges materia and items in FF7.  From what I can gather the matera and items have an ID and a table which tells it how to order.  Let's start with the materia.

In order to reduce the number of textures the game uses and to place the materia onto the correct texture (colour wise) I had to also alter the texture ID of the 5 materias.  These 5 ID's (1 byte each) are found at:

0091ABF0-0091ABF4

The problem is the game also uses these to arrange materia by colour.  So now when I choose arrange, the Summon materia is first on the list and others are not in the correct order as the original.

A way to change this via assembly would be helpful or I will have to be sloppy and alter the textures in adobe photoshop.  I have noticed 2 areas that seem to be most involved with reordering:

006CBCF3 and 0070e5da

It could also be that I am missing the point here and that the ID's I changed are just associating colour with materia and elsewhere there is code or table telling it how to go into the colour order.

===========

For items, it shouldn't be much of a problem to alter the tables so that "By name" works with my re-translated names and not the originals.  I can probably find this on my own but we will see.


Any help appreciated.

« Last Edit: 2011-09-15 18:26:05 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Need help yet again - Sorting of items and materia
« Reply #1 on: 2011-09-17 13:34:32 »
Dziugo has fixed it.  He is a God.  How the f*ck you can be this good is beyond me.

As for the problem - the table you've changed was not actually a graphic lookup table, but more like a rank lookup table. If you want to keep the actual graphics for each materia you have to somehow rollback the changes. The code:
Code: [Select]
CPU Disasm
Address   Hex dump                 Command                                                                         Comments
0070E5DA  /.  55                   PUSH EBP
0070E5DB  |.  8BEC                 MOV EBP,ESP
0070E5DD  |.  83EC 10              SUB ESP,10
0070E5E0  |.  31D2                 XOR EDX,EDX
0070E5E2  |.  66:8B55 08           MOV DX,WORD PTR SS:[ARG.1]
0070E5E6  |.  8B5D 10              MOV EBX,DWORD PTR SS:[ARG.3]
0070E5E9  |.  8B1B                 MOV EBX,DWORD PTR DS:[EBX]
0070E5EB  |.  8B0C93               MOV ECX,DWORD PTR DS:[EDX*4+EBX]
0070E5EE  |.  83F9 FF              CMP ECX,-1
0070E5F1  |.  75 0D                JNE SHORT 0070E600
0070E5F3  |.  C645 F4 80           MOV BYTE PTR SS:[LOCAL.3],80
0070E5F7  |.  C745 FC 00000000     MOV DWORD PTR SS:[LOCAL.1],0
0070E5FE  |.  EB 4F                JMP SHORT 0070E64F
0070E600  |>  51                   PUSH ECX                                                                        ; /Arg1
0070E601  |.  E8 EDD6FBFF          CALL 006CBCF3                                                                   ; \ff7.006CBCF3
0070E606  |.  59                   POP ECX
0070E607  |.  8A80 12E67000        MOV AL,BYTE PTR DS:[EAX+70E612]
0070E60D  |.  8845 F4              MOV BYTE PTR SS:[LOCAL.3],AL
0070E610  \.  EB 0A                JMP SHORT 0070E61C
0070E612      00                   DB 00
0070E613      01                   DB 01
0070E614      02                   DB 02
0070E615      03                   DB 03
0070E616      04                   DB 04
0070E617  /.  05 06070809          ADD EAX,9080706
0070E61C  |>  8B4D 08              MOV ECX,DWORD PTR SS:[ARG.1]
0070E61F  |.  81E1 FFFF0000        AND ECX,0000FFFF
0070E625  |.  8B55 10              MOV EDX,DWORD PTR SS:[ARG.3]
0070E628  |.  8B02                 MOV EAX,DWORD PTR DS:[EDX]
0070E62A  |.  8B0C88               MOV ECX,DWORD PTR DS:[ECX*4+EAX]
0070E62D  |.  C1E9 08              SHR ECX,8
0070E630  |.  8B55 08              MOV EDX,DWORD PTR SS:[ARG.1]
0070E633  |.  81E2 FFFF0000        AND EDX,0000FFFF
0070E639  |.  8B45 10              MOV EAX,DWORD PTR SS:[ARG.3]
0070E63C  |.  8B00                 MOV EAX,DWORD PTR DS:[EAX]
0070E63E  |.  8B1490               MOV EDX,DWORD PTR DS:[EDX*4+EAX]
0070E641  |.  81E2 FF000000        AND EDX,000000FF
0070E647  |.  C1E2 18              SHL EDX,18
0070E64A  |.  03CA                 ADD ECX,EDX
0070E64C  |.  894D FC              MOV DWORD PTR SS:[LOCAL.1],ECX
0070E64F  |>  31D2                 XOR EDX,EDX
0070E651  |.  66:8B55 0C           MOV DX,WORD PTR SS:[ARG.2]
0070E655  |.  8B5D 10              MOV EBX,DWORD PTR SS:[ARG.3]
0070E658  |.  8B1B                 MOV EBX,DWORD PTR DS:[EBX]
0070E65A  |.  8B0C93               MOV ECX,DWORD PTR DS:[EDX*4+EBX]
0070E65D  |.  83F9 FF              CMP ECX,-1
0070E660  |.  75 0D                JNE SHORT 0070E66F
0070E662  |.  C645 F0 80           MOV BYTE PTR SS:[LOCAL.4],80
0070E666  |.  C745 F8 00000000     MOV DWORD PTR SS:[LOCAL.2],0
0070E66D  |.  EB 4F                JMP SHORT 0070E6BE
0070E66F  |>  51                   PUSH ECX                                                                        ; /Arg1
0070E670  |.  E8 7ED6FBFF          CALL 006CBCF3                                                                   ; \ff7.006CBCF3
0070E675  |.  59                   POP ECX
0070E676  |.  8A80 12E67000        MOV AL,BYTE PTR DS:[EAX+70E612]
0070E67C  |.  90                   NOP
0070E67D  |.  90                   NOP
0070E67E  |.  90                   NOP
0070E67F  |.  90                   NOP
0070E680  |.  90                   NOP
0070E681  |.  90                   NOP
0070E682  |.  90                   NOP
0070E683  |.  90                   NOP
0070E684  |.  90                   NOP
0070E685  |.  90                   NOP
0070E686  |.  90                   NOP
0070E687  |.  90                   NOP
0070E688  |.  8845 F0              MOV BYTE PTR SS:[LOCAL.4],AL

Or in binary starting at 70E5DA:
Code: [Select]
55 8B EC 83 EC 10 31 D2 66 8B 55 08 8B 5D 10 8B
1B 8B 0C 93 83 F9 FF 75 0D C6 45 F4 80 C7 45 FC
00 00 00 00 EB 4F 51 E8 ED D6 FB FF 59 8A 80 12
E6 70 00 88 45 F4 EB 0A 00 01 02 03 04 05 06 07
08 09 8B 4D 08 81 E1 FF FF 00 00 8B 55 10 8B 02
8B 0C 88 C1 E9 08 8B 55 08 81 E2 FF FF 00 00 8B
45 10 8B 00 8B 14 90 81 E2 FF 00 00 00 C1 E2 18
03 CA 89 4D FC 31 D2 66 8B 55 0C 8B 5D 10 8B 1B
8B 0C 93 83 F9 FF 75 0D C6 45 F0 80 C7 45 F8 00
00 00 00 EB 4F 51 E8 7E D6 FB FF 59 8A 80 12 E6
70 00 90 90 90 90 90 90 90 90 90 90 90 90 88 45
F0

Rollback rank table is located at 0070E612 and right now it does nothing - just change the numbers there. Should be something like this:
Code: [Select]
00 01 0A 09 04 05 08 07 08 09So incoming 02 becomes 0A (as it was before).

Cheers!
dziugo
« Last Edit: 2011-09-17 15:58:17 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Need help yet again - Sorting of items and materia
« Reply #2 on: 2011-09-19 18:48:21 »
Just documenting some findings here:

Ordering table for items starts at 00921548 memory.

 Items with id  0069-007fh are unused.
Item 00FF is Sephiroth's sword Masamune and is hidden from item menu because it has been assigned 0099h.  0099h appears to tell the menu not to display item.

There are a total of 296 used items, 1 hidden (masamune) and 23 unused.  Total therefore of maximum number 320

You can get Masamune back in the item list by changing 2 bytes in the order table,

memory address 00921746, change bytes 9900 to 4001.

that will place it right at bottom of the item list.
 
« Last Edit: 2011-09-19 18:56:00 by DLPB »

cloudiar

  • *
  • Posts: 205
    • View Profile
Re: Need help yet again - Sorting of items and materia
« Reply #3 on: 2011-11-19 05:34:09 »
I reading your menssages...your a MONSTER!!! Always thanks for your contribution in forum :)
I much interesed in this! You think with try change values of support can activate materia "booster"? I can try ...in this moment contruction of mod and want modify all possible! I surprise in never of forum talking of this materia >.>

Sorry for bad english T.T    (I'm spanish)

Ah other small question...You it's very longer time in this forum...I wanted Meteor but never website run to download T.T (in qhimm and all), in case you have this program can send? I need for comence edition for activate walk in misterious cave, in towards the Ancient Capital, but firt need this tool for activate walk, and later create funtion up for walk and enter in cave (and possible add booster xD)

Sorry for molesties,  you not obligated to answer :) and I maintain my thanks for your time

In case can help send my MP and I send email ^^

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Need help yet again - Sorting of items and materia
« Reply #4 on: 2011-11-19 16:27:25 »
I am afraid at the moment I am swamped in 2 projects and a project elsewhere, but if I get time I will have a look.  Perhaps someone else here can have a look too  :mrgreen: