Author Topic: [WIP] Custom Game Settings (FF7)  (Read 51487 times)

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #50 on: 2011-04-24 13:08:44 »
65535 (or 0xFFFF) is a slot-empty indicator, so you've most likely mixed the indexes.

Well, the only thing I can think of, is that the inventory is an array, and it works like a stack, ie, they are listed in the order you obtained them. If that's the case, I would have to enumerate the entire inventory, and examine it's contents, rather than looking at individual items.

I didn't mix up the indexes, I'm capable of counting. 0, 1, 2, 3, etc,. :P

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: [WIP] Custom Game Settings (FF7)
« Reply #51 on: 2011-04-24 13:16:11 »
You've read the value from different index, so you've mixed it up ;)

If that function is backed up with a save-map then it's an array. Empty line is a 0xFFFF, it shows up in order you see it in-game. Just calculate counts for first 10 items and see where they are in-game.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #52 on: 2011-04-24 13:25:09 »
You've read the value from different index, so you've mixed it up ;)

If that function is backed up with a save-map then it's an array. Empty line is a 0xFFFF, it shows up in order you see it in-game. Just calculate counts for first 10 items and see where they are in-game.

Hey, not my fault the game uses a weird system. :)

I know potions are the first item I obtained, and the calculation works for index 0.

I'll investigate more thoroughly later, I'm still not fully awake.

What do you know about the Savemap data in the .exe, is it arranged like it is on the Wiki, or is that just how it get's written to a save file. I'm hoping to figure out where the game is drawing it's data from, so I can access it without having to worry about the current game mode. (world\battle\field)

Or is it just a bunch of loose globals that the savemap grabs when it needs to save?

---

Basically, having to have battle\world\field versions of functions, isn't going to be any fun to maintain, I may just re-write how the game works after I figure it out a bit better. (I could probably get the .Net framework loaded, and use generic list, etc,. Just let my DLL act as the data manager for the whole game. Not an easy task, would require rewriting a large chunk of the game, but totally worth the effort, if I can pull it off.)
« Last Edit: 2011-04-24 13:39:47 by Wutai Clan »

NFITC1

  • No life
  • *
  • Posts: 2897
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #53 on: 2011-04-24 14:45:54 »
The save map always exists in memory in the same structure as in the wiki. When you save, the game just takes a whole, contiguous chunk out of the memory and dumps it into a file and calls that the save file. In memory, this starts at 0xDBFD38 and just goes through the entire savemap structure byte-for-byte. No reorganizing or look-ups required.

As for the items, yes they're basically a stack. When you get an item, the game will loop through the entire inventory array looking for the index of the items
Code: [Select]
ItemSlot[x] bAND 1FFh  looking for the index of that item. If it finds it, it just adds one to its quantity
Code: [Select]
ItemSlot[x] = ItemSlot[x] bAND 1FFh + ( ItemSlot[x] bAND FE00h + 200h )  'adds one to the quantity and moves on with life. If it doesn't find the item index it creates a new item in the first unused slot it comes to
Code: [Select]
for ( int x = 0; x < 320; x ++
{
     If (ItemSlot[x] = FFFFh
     {
          ItemSlot[x] = NewItemIndex + 200h;
          break;
     }
}

To find the count of the item you want you'll have to loop through the entire structure looking for the index you're querying. The game won't store an item if you have 99 of them and it won't have multiple entries. You can cheat to give yourself 500 Megalixers if you wanted.

Moral of the story is the item you want to find the count of could be anywhere in the inventory and you might have to look through the entire thing to find it.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #54 on: 2011-04-24 15:27:54 »
The save map always exists in memory in the same structure as in the wiki. When you save, the game just takes a whole, contiguous chunk out of the memory and dumps it into a file and calls that the save file. In memory, this starts at 0xDBFD38 and just goes through the entire savemap structure byte-for-byte. No reorganizing or look-ups required.

Awesome, I'm going to have to check it out, and see how it lines up across modes(ie, will it stay in synch with battle\world mode, or does it synch up during mode changes, etc,.), regardless, this is good info to have, even if I can't use it how I wanted to, I'm sure it will be useful. :)

As for the items, yes they're basically a stack. When you get an item, the game will loop through the entire inventory array looking for the index of the items
Code: [Select]
ItemSlot[x] bAND 1FFh  looking for the index of that item. If it finds it, it just adds one to its quantity
Code: [Select]
ItemSlot[x] = ItemSlot[x] bAND 1FFh + ( ItemSlot[x] bAND FE00h + 200h )  'adds one to the quantity and moves on with life. If it doesn't find the item index it creates a new item in the first unused slot it comes to
Code: [Select]
for ( int x = 0; x < 320; x ++
{
     If (ItemSlot[x] = FFFFh
     {
          ItemSlot[x] = NewItemIndex + 200h;
          break;
     }
}

To find the count of the item you want you'll have to loop through the entire structure looking for the index you're querying. The game won't store an item if you have 99 of them and it won't have multiple entries. You can cheat to give yourself 500 Megalixers if you wanted.

Moral of the story is the item you want to find the count of could be anywhere in the inventory and you might have to look through the entire thing to find it.

Alright, makes sense.

I'll have to play around with it, see if I can't come up with some functions to make it a bit easier to work with. (There are numerous ways to handle this, it's a matter of figuring out what works best, and is easiest to work with from my DLL.)

Thanks for the info, I appreciate it. :)

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: [WIP] Custom Game Settings (FF7)
« Reply #55 on: 2011-04-25 19:24:59 »
Just some extra info:
STITM
CKITM
Functions are already there, so all that is left is to use them ;)

Reading through the Field Script Opcodes is a good idea. Reading through them while checking the disassembly is a great way to expand your knowledge about inner workings of FF7. It'll take a big amount of time, but it's worth it (and you'll admit it only after you've done it ;)).

And to be a technical purist - inventory does not work like a stack! You can clear/replace items in the middle of it, so it's basically a random-access array (or just "an array").

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #56 on: 2011-04-25 21:37:33 »
Just some extra info:
STITM
CKITM
Functions are already there, so all that is left is to use them ;)

Reading through the Field Script Opcodes is a good idea. Reading through them while checking the disassembly is a great way to expand your knowledge about inner workings of FF7. It'll take a big amount of time, but it's worth it (and you'll admit it only after you've done it ;)).

And to be a technical purist - inventory does not work like a stack! You can clear/replace items in the middle of it, so it's basically a random-access array (or just "an array").

Thanks, I'll check it out. :)

Also, I wasn't saying it was a stack, or exactly like a stack, I was saying it seemed to behave similarly to one. :P

(Btw, the functions I'm hooking, are what those call, I can see scripts execute a number of the functions, like, during scripted events, you can see RestoreHPMP being called in my log. But, I may be able to find new functions using those, would certainly be quicker, if I can figure out how it relates, ie, how they look up the real underlying function.)

----

Edit: Well, I think I found the script opcode list in the .exe, but they are pretty much scrambled like everything else, it does narrow down the list of functions to test, but there seems to be quite a few of them(50+).
« Last Edit: 2011-04-26 08:08:28 by Wutai Clan »

NFITC1

  • No life
  • *
  • Posts: 2897
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #57 on: 2011-04-26 02:47:09 »
Edit: Well, I think I found the script opcode list in the .exe, but they are pretty much scrambled like everything else, it does narrow down the list of functions to test, but there seems to be quite a few of them(50+).

Where is that? I haven't done much field script work so I don't know what to look for. I could probably help you interpret some of them.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #58 on: 2011-04-26 07:06:45 »
Where is that? I haven't done much field script work so I don't know what to look for. I could probably help you interpret some of them.

I checked it out better, and it wasn't what I thought..

It starts here [0x009055A0] and goes on for some time, it just list function calls, possibly an export table\lookup table\etc,. ?

What I would like, are the functions that give you EXP\GIL\AP after battle, I'm thinking about adding [Battle Reward Multiplier] options to the .ini, so you can do something like.

[Battle Reward Multiplier]
Enabled = true
GIL = 1 // No change
EXP = 2 // 2x EXP
AP = 5 // 5x AP

I'm also working on a fix for the random battle rate patch, I'm thinking, I can just patch each instruction, it basically checks your inventory, and sets the rate based on whether or not you have certain items(enemy away\lure), their mastery level, etc,. (So any place it sets the value, I can just patch it to the value in the .ini file.)

I'm still trying to find the function that gets triggered when you first "click" an inventory item, I need to intercept that call, figure out what item you selected, and if it's a potion\ether\etc, apply my patches to their restorative values. (After I get that done, I'll probably do a release.)

So if you want to find those battle reward functions, or look for that menu function, or try to find any of the opcode functions(that we don't already have), etc, that would be helpful, this is a huge undertaking, so any help is appreciated. :)

The faster we get stuff decoded, the sooner we can start getting new stuff implemented, and, there aren't very many limits to what can be done, if, I have enough data to understand the systems involved.

NFITC1

  • No life
  • *
  • Posts: 2897
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #59 on: 2011-04-26 12:09:54 »
What I would like, are the functions that give you EXP\GIL\AP after battle, I'm thinking about adding [Battle Reward Multiplier] options to the .ini, so you can do something like.

[Battle Reward Multiplier]
Enabled = true
GIL = 1 // No change
EXP = 2 // 2x EXP
AP = 5 // 5x AP

I'm not certain that will work. When an enemy is defeated, it just adds its rewards to the overall battle rewards totals. After the battle ends it spreads those points between the active members in the battle party. There are no parameters involved. I can tell you what memory addresses those values reside at, but they're not fully populated until the battle is over.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #60 on: 2011-04-26 13:48:18 »
I'm not certain that will work. When an enemy is defeated, it just adds its rewards to the overall battle rewards totals. After the battle ends it spreads those points between the active members in the battle party. There are no parameters involved. I can tell you what memory addresses those values reside at, but they're not fully populated until the battle is over.

Should be fine, it doesn't matter what the game does now, that's the point of this project, to make the game do what I want, when I want. :P

It doesn't matter if there are no parameters, I can patch individual instructions within the .exe..

ie, mov GIL, BattleReward

Can be changed to something like.

mov eax, BattleReward
imul eax, 2
mov GIL, eax

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #61 on: 2011-04-26 15:40:19 »
Sadly I can't help about all this technical stuff, but I have some other ideas, if you need them. Luckily, one day, some of those will be doable.

- making it so the Back Row modifiers are only applied when at least one party member is in the front row (doesn't make much sense that all allies can get access to the back row ; logic tells me that if nothing is in the front row, the back row becomes the front row... ...if logic can be applied to this row system, that is :P)

- expand the magic spell lists... ...I bet this one would be particularly tricky, since you'd have to expand the menus, too

- make weaknesses to status effects display when you use Sense

- remove the less than 30,000 HP requirement for Sense to work (or make this number much higher)

- make the Defend command also halve damage from Magic and Fixed damage, to increase its usefulness

- make it so that you can cast a single magic when you're equipped with the W-Magic materia. I find it annoying when I want to cast only one spell, and the game forces me to cast two (waste of MP). This downside to W-Magic makes no sense

- remove the W-Item glitch, of course :P

- make the Darkness/Blind status effect work on enemies (this one might be easier through AI editing, though)

- make the Defence and Magic Defence work differently. Since currently they work as a % reduction of damage received (512 being a 100% reduction and 256 being a 50% one), a bonus of 1 or 2 points in Def/MDef is negligible. In some RPGs, when you go from 50 points of Defence to 51 or 52, damage is sometimes reduced from 1000 to 500 or even 200. I love that. It would require a complete overhaul of the characters' and monsters' stats, but it would ultimately make the stats more important and thus, the game more interesting

- make the game consider materias as items, so they can be stolen / dropped / morphed from enemies. I'd love to be able to use the Hojo tool (or the yet-to-be-released Proud Clod that will render Hojo useless) to make a materia a battle reward.

...Mmm, maybe I should create another topic that would list all those ideas/requests, instead of posting them in your thread.
« Last Edit: 2011-04-26 15:54:11 by Armorvil »

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: [WIP] Custom Game Settings (FF7)
« Reply #62 on: 2011-04-26 16:08:36 »
That 0x9055A0 (argh... address that's been burned into my memory...) is a base for all Script Op handlers. When a game gets an Opcode, it calculates the offset where a pointer to that function is stored (in a fashion: 0x9055A0 + Opcode << 2), and just calls it.

To find other stuff - get a debugger that helps you find references to a static memory address - it will save you a lot of time. For example, Exp is stored for each character, but if you search for a function that modifies it, you'll see something like 0xDB0000 + x * 0x84 - only Cloud's Exp is referenced, because Barret's can be calculated as an address that is 0x84 bytes higher than Cloud's Exp. If you then search for that specific const, you'll get EVERY SINGLE point in ff7.exe where it's accessed. Leave out all the reading accessors, and you'll end up with a short list of points where it's actually being written to.

Also, most global structures are referenced like that (so with the above method you can check all the subfields for writing). There are usually some unique values connected to each meaningful record, so debugging is really easy - even if the record is passed as a reference, it's structure remains intact (of course), and if the subfield was named szCharacterName, you'll get to know it as 0x234 and a single reference search for that const will get you a list of addresses where it's being accessed. Sometimes it's a mixed mode (so a subfield is referenced by global address and by subaddress somewhere else, but there aren't many cases like that).

Also, it helps how the FF7 was actually built - with absolute minimum optimization.

Vgr

  • Global moderator
  • No life
  • *
  • Posts: 2209
  • Karma: 34
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #63 on: 2011-04-26 16:22:48 »
Do anyone think that the "No Screen Reward Display" is in the exe or something else? This code is used in the flashback.

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #64 on: 2011-04-26 16:36:53 »
Quote from: me
- remove the less than 30,000 HP requirement for Sense to work (or make this number much higher)

Found it !  :D
The HP requirement for Sense is at offset 0x1C9515. Easy to find in a hex-editor and with proper testing. I just searched for 75 30 (= 30000 ; and I know the bytes are reversed in a hex editor).

Proof in picture :)


Vgr

  • Global moderator
  • No life
  • *
  • Posts: 2209
  • Karma: 34
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #65 on: 2011-04-26 16:44:07 »
You rock! At which amount did you set it?

Edit : Given what you gave us, I assume it's 65 535. Higher of course, but not enough for Gjoerulv's mod :( Is it possible to extent it to some other unusued byte or even make it 4 294 967 295 (FF FF FF FF) which is more than any enemy, even in the hard mod.
« Last Edit: 2011-04-26 16:49:24 by Vgr255 »

NFITC1

  • No life
  • *
  • Posts: 2897
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #66 on: 2011-04-26 16:50:25 »
A'ight. Here goes:

Battle Exp: 0x99E2C0
Battle AP: 0x99E2C4
Battle Gil: 0x99E2C8

Seems they get manipulated mainly in 0x430DD0 (which is the huge "end battle and dole out rewards" sub) and initialized in 0x5C6F9C. They get added per enemy too. You can give them an initial value before that point, but you can't manipulate the actual "earned" value until later.

Battle gil gets awarded in 0x6C6B30. You'll need to manipulate that value before that.
AP gets awarded in 0x5CAD70 that takes two arguments: (Character index [0-8], AP to award as unsigned WORD) (passed AP can not exceed 65535 here).
I can't quite nail down where exp gets applied. All I can find is the function that applies Level Up bonuses (0x5C7260 if you're wondering). That takes DWORD CharSaveMapOffset, DWORD Exp Gained, and DWORD Formation index in that order.


- making it so the Back Row modifiers are only applied when at least one party member is in the front row (doesn't make much sense that all allies can get access to the back row ; logic tells me that if nothing is in the front row, the back row becomes the front row... ...if logic can be applied to this row system, that is :P)

Possible? Haven't found this, but worth looking into.

- expand the magic spell lists... ...I bet this one would be particularly tricky, since you'd have to expand the menus, too

I'm not even going to try this. This will take graphical editing, actually, which I'm trying to stay away from.

- make weaknesses to status effects display when you use Sense

Would require a new battle text. I don't see why this couldn't be possible, except it would take a LONG time to list them all for some enemies.

- remove the less than 30,000 HP requirement for Sense to work (or make this number much higher)

Could solve this and the previous point at the same time, probably. Still wouldn't go above 65535 I bet

- make the Defend command also halve damage from Magic and Fixed damage, to increase its usefulness

Defend sets a flag that gets handled during physical-type attacks. You'd have to account for this in other damage types too, but I think the modifier's a function call anyway. Might not be enough room to do this, but it's possible to optimize a few extra bytes out of some of them.

- make it so that you can cast a single magic when you're equipped with the W-Magic materia. I find it annoying when I want to cast only one spell, and the game forces me to cast two (waste of MP). This downside to W-Magic makes no sense

Then don't equip W-Magic. :)

- remove the W-Item glitch, of course :P

I've been wanting to do this for a while, actually. I'd have to see how it's working now before I could tell you how to fix it. I don't know where commands are actually handled though.

- make the Darkness/Blind status effect work on enemies (this one might be easier through AI editing, though)

Does it not work for enemies? I've never tried it.

- make the Defence and Magic Defence work differently. Since currently they work as a % reduction of damage received (512 being a 100% reduction and 256 being a 50% one), a bonus of 1 or 2 points in Def/MDef is negligible. In some RPGs, when you go from 50 points of Defence to 51 or 52, damage is sometimes reduced from 1000 to 500 or even 200. I love that. It would require a complete overhaul of the characters' and monsters' stats, but it would ultimately make the stats more important and thus, the game more interesting

Never have found the attack modifiers so I couldn't tell you if this were possible. Maybe, but I'm not inclined to want it done.

- make the game consider materias as items, so they can be stolen / dropped / morphed from enemies. I'd love to be able to use the Hojo tool (or the yet-to-be-released Proud Clod that will render Hojo useless) to make a materia a battle reward.

Would require too much of a re-write.

Do anyone think that the "No Screen Reward Display" is in the exe or something else? This code is used in the flashback.

It's a battle flag set at the beginning of those battles. There are a few battles with that flag set, but not many.

DLPB

  • No life
  • *
  • Posts: 9572
  • Karma: 320
  • For I realized that God's a young man, too.
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #67 on: 2011-04-26 16:50:44 »
I am afraid the maximum will probably be just 32767.  Unless someone changes code to allow more.  It is signed.

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #68 on: 2011-04-26 16:53:13 »
Thanks :)

I set it at FFFFFF : 16,777,215
The problem though, is that the Sense menu can't display more than 65535. So on the enemy I tested it on, which has 330,000 HP, the Sense menu will say that it has 2325 HP. And when you'll remove those 2325 HP from it, the menu will then display oddities like 65000/2325 HP. As if the enemy had 5 HP bars of 65535 HP each, and a 6th HP gauge of 2325 HP.

EDIT:

Thanks for posting a comment after each of those ideas, NFITC1. Though, with all due respect, your comment about W-Magic was pretty stupid :P
« Last Edit: 2011-04-26 17:14:33 by Armorvil »

Vgr

  • Global moderator
  • No life
  • *
  • Posts: 2209
  • Karma: 34
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #69 on: 2011-04-26 16:55:20 »
Armorvil sense'd an enemy with 60,000 HP (Proud Clod), so it's 65 535.

DLPB, with Menu Reconstruction, should be able to make it work. But hex-editing is a lot of work.

At the beginning of battles huh? Well, I ask this because I want my characters to gain/not gain Exp/AP/Gils in some battles.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #70 on: 2011-04-26 17:02:15 »
@dziugo, alright, I'll check it out, I have IDA\MHS, and between the two, I can usually find anything I need, it just takes time, and diverts me from working on other stuff I need to do. (Like learning these last few hacking techs, and working on my code itself, building a nice friendly API for editing the game. It's taking forever just to fill out the struct that represents character data. I still have to make other structs for other known data too, etc,. Lot's of work.)

@Armorvil, that address you listed for Sense, I can't find it, not sure how that value relates to the disassembled code, I've seen 30,000 called in several places, RestoreHPMP, uses that same amount for fully restoring your characters, etc,. (I'll keep an eye out for it, but, if you can find it in memory, that would be good.)

@Vgr255, not sure what you mean by the no screen reward, like, after battle when it skips rewarding you?
« Last Edit: 2011-04-26 17:09:28 by Wutai Clan »

Armorvil

  • Freak
  • *
  • Posts: 621
  • Karma: 0
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #71 on: 2011-04-26 17:11:43 »
@Armorvil, that address you listed for Sense, I can't find it, not sure how that value relates to the disassembled code, I've seen 30,000 called in several places, RestoreHPMP, uses that same amount for fully restoring your characters, etc,. (I'll keep an eye out for it, but, if you can find it in memory, that would be good.)

Unfortunately, my knowledge in programming is very, very limited (inexistent ? Perhaps). I want to learn but don't know where to start... ...So I can't tell you where to find it in memory. I just opened FF7.exe in my hex editor, searched for the bytes 30 75, replaced each of the found strings by FF FF, and tested the game until Sense worked on an enemy with 60,000 HP. This is how I found the address 0x1C9515.

I might also find other functions that call a specific value, but I have no idea what I could search for next.

EDIT:

Quote
Quote
- make the Darkness/Blind status effect work on enemies (this one might be easier through AI editing, though)

Does it not work for enemies? I've never tried it.

Yeah, it's one of the many FFVII bugs : the Ink item doesn't do a thing. Credit goes to Vgr255 for giving me the info (and I thought I knew everything about FF7). He also informed me about the Elixir bug, which I easily fixed with Wall Market (since the Elixir's formula is physical, a character equipped with the Cover materia would sometimes jump in front of the character you'd want Elixir'd, and drink it :o ).
« Last Edit: 2011-04-26 17:35:32 by Armorvil »

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #72 on: 2011-04-26 17:31:19 »
Unfortunately, my knowledge in programming is very, very limited (inexistent ? Perhaps). I want to learn but don't know where to start... ...So I can't tell you where to find it in memory. I just opened FF7.exe in my hex editor, searched for the bytes 30 75, replaced each of the found strings by FF FF, and tested the game until Sense worked on an enemy with 60,000 HP. This is how I found the address 0x1C9515.

Also, I might also find other functions that call a specific value, but I have no idea what I could search for next.

You don't need to program to find the values in memory, get Cheat Engine\MHS(Memory Hacking Software)..

You can find countless tutorials, both written\video on the internet, try YouTube, look for Cheat Engine tutorials, MHS works roughly the same as CE, but it's a bit more advanced, I prefer it, but that's just my preference.

In any case, searching memory is easy, it's just a process of elimination, say you search for your chars HP, all you have to do, is increase\decrease the HP, then do a sub search for the new value, keep repeating this process until you find the value in memory that controls the chars HP. (It eliminates any non-matching values as you go.)

--

Btw, haven't used CE in some time, but MHS shows pointers in green text, that's what I need, pointers, those exist in the .exe, the other values are usually temp variables\DMA, and won't always be the same. (Pointers are always going to be same for everyone.)

---

Aside from values I already mentioned, I'm interested in the following.

1. Inside the buggy. (I want to remove random battles inside the vehicle, it's annoying to me. Other vehicles would be nice too, airships, etc,. I just want to know when I'm inside a vehicle\walking, that might help me track down a few other things too. Like functions to spawn the vehicles, etc,.)

2. GP for the Gold Saucer. (I may make a cheat(inf\max GP), but I might also remove the GP restriction on that save spot, which also annoys me.)

3. Any unknown battle vars, like, when you hit someone, and you see the little damage floater, getting that value, should allow me to find the damage formulas. (So anything like that, poison values, etc,.)

4. Anything else you think might make a good addition, or be useful in finding related stuff. (Like, how GP will help me find that GP save spot.)

(Remember, everything will be optional, with all cheats disabled by default.)

--

@NFITC1, seems like this where they all get calculated. -> [0x0043153F]

If you right click a variable in IDA, you can select "Jump to xref to operand" which will display a list of places the value get's used, then just look at functions with a "w" next to them, those are writes, "r" are reads.

These values only get written in two places, one sets them to 0, the other has to be the code we are looking for. (Unless it uses temps, and does it elsewhere, but it's probably done there.)

Anyways, thanks for finding those vars, I'll start playing around with patching the values, see if it works. (ie, actually gives the correct values, and hopefully shows up properly in the reward screen. EDIT: A quick test seemed to work exactly as I had hoped, it worked properly with the reward screen, etc,.)

(I also need to go through, and make sure the INI options won't go outside of their range, ie, if a value is 0-255, I'll just make it wrap any values outside the range, to the nearest valid value. ie, using the previous example, 300, would be clamped to 255.. I can probably add comments too, that indicate valid ranges, though, I'm not sure the .ini lib I'm using will allow me to use them, it's not well documented.)
« Last Edit: 2011-04-26 20:15:27 by Wutai Clan »

NFITC1

  • No life
  • *
  • Posts: 2897
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #73 on: 2011-04-26 20:29:44 »
Thanks for posting a comment after each of those ideas, NFITC1. Though, with all due respect, your comment about W-Magic was pretty stupid :P

No it wasn't. YOU'RE stupid. :P
Seriously though, W-Magic materia could be changed to just add W-Magic instead of replace it. That would be best changed in the KERNEL. Biggest problem with that is that it would displace some other command. There's only room for 12 commands, you couldn't have a Master Command, E.Skill, Magic, Summon AND W-Magic. There'd be no where for the W-Magic to go. Same thing with all the Attack replacing commands. If you want to expand that you'd have to expand the command menu (which I'm not going to touch). Although, expanding it to 16 commands could solve some other problems too like W-Item and the "Replace Attack" commands.
Otherwise, how do you suspect it would work? From a series standpoint, W-Magic has always forced the player to perform two magics per turn.

Yeah, it's one of the many FFVII bugs : the Ink item doesn't do a thing. Credit goes to Vgr255 for giving me the info (and I thought I knew everything about FF7). He also informed me about the Elixir bug, which I easily fixed with Wall Market (since the Elixir's formula is physical, a character equipped with the Cover materia would sometimes jump in front of the character you'd want Elixir'd, and drink it :o ).

O_o Really?! I never tried that either. That's awesome!! :D

Barret: Need.....elixir *pulls one out and throws upward for himself*

Cloud: Oh no you Di'int! *steals Elixir*

XD

Wutai Clan

  • Crazy poster
  • *
  • Posts: 115
  • Karma: 0
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #74 on: 2011-04-26 20:42:50 »
I got the battle reward multipliers fully implemented, including the .ini options, thanks for the help NFITC1. :)

(I updated the first page with the new features\options, second post as always.)

--

Btw, can I fix the Elixir bug from my end, or is it better handled elsewhere? (I have no problem patching code to fix issues, so if there are any longstanding bugs that can be fixed via .exe hacking, let me know.)

---

Edit: Test release time..

See: Page 4 for an updated release..

Place both files in your FF7 directory, add the line to Aali's config..(Or use multi-loader)

load_library = GameSettings.dll

Don't forget to configure the .ini file..

Hopefully this works for everyone, let me know if those battle reward calculations seem right to you, I think they seemed kinda large at 2x, but I'm not sure yet.

You will need to install the VC++ runtime 2010 x86, google it, should pop right up. (You can check your installed programs list in the control panel, it will tell you if you need to install this, or if it's already installed.)

Note: This may not work properly with a modified .exe file, so you may want to use an unmodified version for testing.
« Last Edit: 2011-04-26 23:14:29 by Wutai Clan »