Author Topic: Hmm...weapon&armor id/offsets?  (Read 5110 times)

NobodyImportant

  • *
  • Posts: 92
    • View Profile
Hmm...weapon&armor id/offsets?
« on: 2006-05-12 03:05:38 »
Hello, I've been digging through the wiki and jenova source and couldn't find any information on the ID of weapons or armor. When looking through the savemap, I see  "0x1C 1 byte  Equipped weapon". So, when I go to a save with Clouds inital equipment, go to the correct offset and read one byte, both the weapon and armor ID are 0x00. Any ideas?

Sorry if I'm becoming a nuisance. I did look for it. :)

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Hmm...weapon&armor id/offsets?
« Reply #1 on: 2006-05-12 05:40:29 »
Savemap@wiki
 - When reading from FF7 PC saved game, add 0x09 to the offset (there is some PC-only header at the beginning of the file).
 - Decide which character's weapon you want to read, pick the right record-offset (0x54 for Cloud, 0xD8 for Berret, etc.) and add it to your offset
 - Check the character record for an offset you are interested in and... add it to your offset :)

So... If we were trying to read Cloud's weapon, we'd search for it at offset:
0x09 + 0x54 + 0x1C = 0x79

dziugo

NobodyImportant

  • *
  • Posts: 92
    • View Profile
Re: Hmm...weapon&armor id/offsets?
« Reply #2 on: 2006-05-13 02:07:20 »
Right, that's all calculated. However, when I pick the right offset, both the armor and weapon return 0x00. :(

I'm sure it's the right offset because all other data read is correct.

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Hmm...weapon&armor id/offsets?
« Reply #3 on: 2006-05-13 05:45:31 »
Can I see your save-game?

dziugo

NobodyImportant

  • *
  • Posts: 92
    • View Profile
Re: Hmm...weapon&armor id/offsets?
« Reply #4 on: 2006-05-13 20:44:49 »
I've been using save00.ff7, slot one. No need to make my own with this perfectly working example. :) In this save, Cloud has a Buster Sword and Bronze Bangle.

The item ID for Bronze Bangle is 0x00, great. As for the Buster Sword, it's 0x80. :(


ADDITION: I changed the offset to read Barrets weapon & armor, which returns 0x01 for the Gatling Gun and 0x00 for the Bronze Bangle. This is why I'm assuming there's some sort of offset list for the weapons, armor and accessories. Not knowing C++, the Jenova source is very hard to make out, but I've been looking for something like it. By the way, the Gatling Gun item ID is 0xA0. :(
« Last Edit: 2006-05-13 20:56:37 by NobodyImportant »

FeuFeu

  • *
  • Posts: 54
    • View Profile
Re: Hmm...weapon&armor id/offsets?
« Reply #5 on: 2006-05-13 21:22:57 »
I've compared what you get with one of my epsxe savegame at the beginning of the game. I also have 0x00 for the Buster Sword and the Bronze Bangle. Barret's equipped Gatling Gun is 0x20. Considering Buster Sword and Gatling Gun are (respectively) 0x80 and 0xA0 in the inventory listing, you have to substract 0x80 from this value to get the weapon value when equipped.

In Jenova, this is found in charedits.cpp, ie. in the void CCharEquip::OnSelchangeWeapon() function. You'll see some 128 there, because of this "conversion". That's the trick :wink:

By the way, the armor need not be converted. But for the accessory, you have to subtract 0x20 from the inventory ID to get the equipped ID.

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Hmm...weapon&armor id/offsets?
« Reply #6 on: 2006-05-13 21:30:44 »
FeuFeu was faster (that thread-updated notify is soo cool :)), so I'll just post offsets at which a "decoding" process takes place:
Code: [Select]
Weapon:
00706326  |. 8A440A 1C      MOV AL,BYTE PTR DS:[EDX+ECX+1C]
0070632A  |. 05 80000000    ADD EAX,80

Armour:
0070635D  |. 8A440A 1D      MOV AL,BYTE PTR DS:[EDX+ECX+1D]
00706361  |. 05 00010000    ADD EAX,100

Acc:
007063AD  |. 8A440A 1E      MOV AL,BYTE PTR DS:[EDX+ECX+1E]
007063B1  |. 05 20010000    ADD EAX,120

dziugo

NobodyImportant

  • *
  • Posts: 92
    • View Profile
Re: Hmm...weapon&armor id/offsets?
« Reply #7 on: 2006-05-13 21:32:51 »
Man, all the members here are so smart. :|

I never would have thought of that. Good find.

Thanks, you two.

EDIT: Looks like you posted before I replied. Neat board feature.

Thanks again.

FeuFeu

  • *
  • Posts: 54
    • View Profile
Re: Hmm...weapon&armor id/offsets?
« Reply #8 on: 2006-05-13 22:31:51 »
0x100 and 0x120 for armor and accessories ? Is the "compressed" inventory IDs expanded on two bytes when it's loaded from the savemap ?

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: Hmm...weapon&armor id/offsets?
« Reply #9 on: 2006-05-13 23:00:57 »
It's converted "on the fly" whenever it's needed. Then as a DWord it is used in function(s).

dziugo