Qhimm.com Forums

Miscellaneous Forums => Gameplay => Topic started by: Wutai Clan on 2011-04-14 08:26:03

Title: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-14 08:26:03
This project is an attempt to add easy to configure settings, that will allow for easy modifications to how the game works. (That are normally not easy, or require external tools like trainers\hacking of the .exe, etc,.)

For example, I'm trying to add settings that will allow you to easily change how much HP get's restored by various healing items.

The project uses a dll file called "GameSettings.dll", and will read values from an .ini file. (It will require Aali's Custom Graphic Driver to run.)

Code: [Select]
Example GameSettings.ini

#HP Restoring Items
Potions = 100

#MP Restoring Items
Ether = 100 (I don't know the real value right off hand.)

# Lot's of other settings will be added as I work on the project, but for now, I'm working on HP\MP restoring items.

An example, MP regeneration, is something I always thought might be interesting.

MP_Regen = Enabled
MP_RegenRate = 6 [ie, Every six seconds]
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-14 08:33:01
Functions Found\Hooked

IncreaseHP = 0x006CBA6A [DWORD formationIndex, WORD amount]
DecreaseHP = 0x006CB9D2 [DWORD formationIndex, DWORD amount]
IncreaseMP = 0x006CBBBF [DWORD formationIndex, WORD amount]
DecreaseMP = 0x006CBB27 [DWORD formationIndex, DWORD amount]
RestoreHPMP = 0x0061F793 [] // Full Heal Party

AddItems = 0x006CBFFA [DWORD item:amount]
RemoveItems = 0x006CBE5F [DWORD item:amount]

IncreaseGil = 0x006CBCB9 [DWORD amount]
DecreaseGil = 0x006CBC7C [DWORD amount]
GetCurrentGil = 0x006CBCE9 []

GetCharacterData = 0x006CB98E [DWORD formationIndex]
DebugOutput = 0x00664E30 [char* string]

IsMenuOpen = 0x0063BC9D []
CurrentMenu = 0x006C6AEE [DWORD menu] // Not sure exactly what this is doing yet, but I can get the currently opened menu by intercepting it's argument. (Materia\Spell\Equipment\etc,.)

Custom Functions: Created\Patched

SetRandomBattleRate [BYTE rate] [Options: Enabled\Disabled | Rate]

Found WIP\Untested

ShowMessage = 0x00631586 [WORD unk1, WORD unk2] -Tested\Hooked\Still needs work. (Shows empty window, no matter what parameters I feed it, it definitely depends on a file for it's entries, whether on disk, or in memory.)

SaveGame = 00720F6E [DWORD unk1:slot? filename?] - Completely untested
LoadGame = 007210BC [DWORD unk1:slot? filename?] - Completely untested

GetCharacterBySlot [Derive from GetCharacterData?]

GetItemCount = 0x006CBF57 [DWORD index] - Needs adjusted to return counts. (Going to have to create a wrapper function, that converts the data to other formats, ItemID, and Counts, I already have the formulas to do so.)

GetRandomBattleRate = 0x00767C55 []

Misc Addresses

Battle Timer Variable = 0x009AE17C // Times how long each battle took.

Turn Timer Variable = 0x009AE180 // Measures how long each battle participants turn took. (Enemies, and allies.. This only accounts for the time the animations, etc, take to play out, it doesn't count time spent in the menu's, etc,.)

Battle IsTargeting Variable = 0x009A8B08 // This is equal to 0, if you aren't targeting something, 1 if you are. ie, if you select a command, and a target icon appears, this will be equal to 1.

Battle Escape Variable = 0x009AAD06 // This is the counter that determines when you escape, the longer you try, the larger this number gets, after it hits a certain value, you escape. (This value will slowly decrease after you stop trying to escape.)

Pressed Key Variable = 0x009A85D4 // Works with keys the game actually uses, doesn't seem to register other keys. (This also responds to gamepad input.)

Menu Open Variable = 0x00CFFB8C // Equals 1 while the menu is open. (Triangle menu.)

Ideas

E. Skill materia: Expand the list of learn-able skills.

Improve battle targeting: Make items\spells target relevant party members. (ie, phoenix down, will target a KO'd member.)

New Hotkeys [To trigger various functions. Example: Custom Option Menu->RenamePartyMember.]

Note: These are just notes to myself, so I don't forget anything, but they are also here so you can offer feedback on the ideas, etc,.

Progress Notes\Issues

Hooked the game's internal debug messages. (Tells me all kinds of stuff, like when the engine is loading different modules(WorldMap\Menu\Battle), etc,.)

Setup a debugging console, so I can watch log entries as they occur. (Much nicer than using the .log file, though it still exist, it's a shared function.))

GameLoop hooked. (This hook isn't working in battle mode, but works pretty much everywhere else, I need to find a function that get's called no matter what mode the game is in.)

BattleLoop hooked.

MP Regen: Implemented. (Doesn't work in battle, the hook doesn't run, and the values are stored different.)

Infinite Item Usage: Implemented. (Doesn't work in battle, the hook doesn't run, and it probably stores the values differently.)

Custom Random Battle Rates: Implemented.

Battle Reward Multipliers: Implemented.

Sense Materia Fix: Implemented.

Better 3rd Person Camera Patch: Implemented.

INI File: Implemented.

Here are the current .ini options. (All of them are fully implemented.)

Code: [Select]
[Debug Console]
Enabled = false

[Infinite Item Use]
Enabled = true

[MP Regeneration Settings]
Enabled = true
Rate = 6

[Random Battle Settings]
Enabled = true
Rate = 4

[Battle Reward Multipliers]
Enabled = true;
EXP = 1
GIL = 1
AP = 1
Title: Re: [WIP] Custom Game Settings
Post by: Dark_Ansem on 2011-04-14 09:54:51
I like the idea of MP regen as well, maybe attached to items and of variable intensity. think the BIN expander could do you some help?
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-14 10:05:55
Yeah, there are lot's of possibilities, for now it's probably best to stick to the basics, but, the more functions I hook, the more control I'll gain over how the game works.

Mp regen will probably be global at first, just restoring 1mp every x seconds that pass to all the party members. But I like your idea too, so maybe, depends on how far I get with hacking the .exe..
Title: Re: [WIP] Custom Game Settings
Post by: Vgr on 2011-04-14 12:00:32
I think that Potion restore must be 64 to be 100 because this is in hexa. Well, looking forward for the first release.
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-14 12:42:46
Well, that function definitely get's called, but only after the healing occurs, so it's not the right function. (It does have the proper item. Probably related to item removal..)

I was able to make my custom edit to potion values using it, but, it works like this.

Heal function called
Item used function called
Set global value (For tracking item use, ie, storing 512)

So it didn't work on the first run..

However, on the second run, since I had successfully set my tracking variable the first run, it did work.

So I'm close, if I can just find the right item used function. (I still need to write a parser to read the .ini file too, then I should be able to release with a few values exposed.)
Title: Re: [WIP] Custom Game Settings
Post by: nfitc1 on 2011-04-14 21:52:52
Right now, I need to find the "Item Used" function, if it even exist, I'm guessing there is a function that get's called when an item is used, I need to get the values from it that represent what item was used.

...

A function that returns character data, HP, MP, STR, etc,. (ie, I can feed it an NPC, and get data about that NPC.)

A function that increases\decreases item counts. (Inventory, etc,.)

A function to get the NPC occupying a slot. (ie, Slot1 = Cloud)

.... More to come.

I know where most of those are, but of course I've put my laptop away and I don't have time to fish it back out. Maybe tonight I'll update. I know exactly where the menu-based item handler is and how it works. I can find the item increase/decrease function too, but I haven't looked for the "NPC to battle slotX" function is.

EDIT:
Item Menu Usage handler begins at 0x715105. It's a long function too, running through 0x717599. It's really each item's function all squished together.

return character data is at 0x6CB98E. Give it a byte (formation index) and get the pointer to that position's stats. That will only return an active character (in the party), but that's probably all you'd need anyway. The game mostly ignores the characters NOT in the party.

Decrease Item count function is 0x6CBE5F. Pass it the item index ORd with ( quantity to remove << 9 ) like an item inventory data. XXXXXXXY:YYYYYYYY where XXXXXXX is the item quantity and YYYYYYYYY is the item index.
Increase Item is different because decrease is unsigned. It's at 0x6CBFFA and can either increase an existing item's quantity or put it in the first blank space it comes to. Input format is identical to Decrease Item.

Get Character occupying a slot is not a function. Each sub that wants to know that info manually derives what that is if necessary. It's always 0xDBA498 + 440h * Slot.


As for that healing function you've been messing with, that's almost exclusively used out of battle. It's more for item menu usage and magic menu use (which starts at 0x710DFA and ends at 0x71441B). Only a few others use it. Handle_Cats_Bell (0x6CC4A8), some full_heal function (0x61F6B0) that restores HP, MP and FurySadness flag I don't know what calls it (inn maybe?), a heal HP/MP function (0x61F793) that increments some counter (not sure what), and a similar one to that (0x61F977) that increases the same counter by 5.
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-15 00:58:03
@NFITC1, awesome, I appreciate it, it will greatly help this project. :)

(Aali helped me a bit with the .ini file end of things, so I will start working on that tonight, just crawled out of bed. We should be able to get a working demo up in no time.)

--

Edit:

@NFITC1, I need to get a global function hooked, ie, a function that always get's called by the game(every frame). I need this for things like mp regen. (I also need a way to tell if I'm in game, in menu, or still on the start menu, in order to control when my custom code should run.)

So if you know anything on this front, that would be great, I can probably find the global function, there are generally lot's of things being called by the game every frame. But I definitely need to know if I'm still on the start menu, running party based code for regen, with no party, is bad.
Title: Re: [WIP] Custom Game Settings
Post by: nfitc1 on 2011-04-15 01:34:25
Just edited my above post. Check it out.
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-15 02:00:46
Just edited my above post. Check it out.

Excellent, thanks for that. :)

On the subject of the generic healing function, yeah, I mainly need it for making dynamic changes to values(potion = 250), I thought that it worked on spells, because when I was testing, Healing Wind triggered it, but that makes sense with what you've told me.

Will character stats returned by 0x6CB98E include the character name(is this an array, or are the values separate variables?), I want to use that for debugging, rather than returning Slot1\Slot2, just return the name of the character. (Though it will probably get used for more as the project matures.)

Anyways, thanks for all this, most helpful. :)

----

That item use function you listed 0x00715105, any idea what the input arg is?

Here is a sample of the log I get when hooking it.

Code: [Select]
ItemUse: Executing
ItemUse: 72
ItemUse: Executing
ItemUse: 73
ItemUse: Executing
ItemUse: 74
ItemUse: Executing
ItemUse: 75
ItemUse: Executing
ItemUse: 76
ItemUse: Executing
ItemUse: 77
ItemUse: Executing
ItemUse: 78
ItemUse: Executing
ItemUse: 79
ItemUse: Executing
ItemUse: 80
ItemUse: Executing
ItemUse: 81
ItemUse: Executing
ItemUse: 82
ItemUse: Executing
ItemUse: 83

This went on for quite some time, all the way up to around 400+, I don't think I can use that one for my purpose, it seems to be called constantly, and keeps incrementing some counter. (Though this may work for my global function hook, depends on where it gets called in the game loop.)

Is there another function that only get's called once when you use an item, and has an input arg that equates to the item? That's what I really need, so I can track item usage. (It needs to be called before GenericHeal too, so RemoveItems won't work, unless I damage the HP to make up the difference, but that's really hacky.)

The function will probably be in the same range as the decrease\increase item functions. (Or around that area.)
Title: Re: [WIP] Custom Game Settings
Post by: nfitc1 on 2011-04-15 05:18:44
Will character stats returned by 0x6CB98E include the character name(is this an array, or are the values separate variables?), I want to use that for debugging, rather than returning Slot1\Slot2, just return the name of the character. (Though it will probably get used for more as the project matures.)

A Pointer to the 1088 byte array will be returned. If you know what the values are then you can access almost anything about them. I don't know if Name is in that array or not. I think name is always pulled out of the SaveMap.

That item use function you listed 0x00715105, any idea what the input arg is?

Here is a sample of the log I get when hooking it.

[ code ]

This went on for quite some time, all the way up to around 400+, I don't think I can use that one for my purpose, it seems to be called constantly, and keeps incrementing some counter. (Though this may work for my global function hook, depends on where it gets called in the game loop.)

Is there another function that only get's called once when you use an item, and has an input arg that equates to the item? That's what I really need, so I can track item usage. (It needs to be called before GenericHeal too, so RemoveItems won't work, unless I damage the HP to make up the difference, but that's really hacky.)

The function will probably be in the same range as the decrease\increase item functions. (Or around that area.)

I think the argument is the item itself. I could be wrong on that. It only has one argument. I can assure you that this is the only place where menu item usage is handled. It might be the entire menu handler for all I know. Item usage is just a part of that function. There's a lot more going on inside it, but I have it labeled as item usage because that's the point of interest I have in it.
Title: Re: [WIP] Custom Game Settings
Post by: Wutai Clan on 2011-04-15 05:39:32
A Pointer to the 1088 byte array will be returned. If you know what the values are then you can access almost anything about them. I don't know if Name is in that array or not. I think name is always pulled out of the SaveMap.

Saved for future reference.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 14:52:16
Here is a log showing the DebugOutput I recently hooked..

Code: [Select]
Game: Started
GameSettings: Loaded
Hooked: GameLoop
Hooked: Item_Menu
Hooked: DebugOutput
Hooked: GetCharacterData
Hooked: IncreaseHP
Hooked: IncreaseMP
Hooked: RestoreHPMP
Hooked: AddItems
Hooked: RemoveItems

DebugOutput: LOCK UNLOCK TEST

DebugOutput: MATRIX INITIALIZE

DebugOutput: INITIALIZE DD/D3D END

DebugOutput: initializing sound...

DebugOutput: creating dsound primary buffer

DebugOutput: reading audio file

DebugOutput: loading static sounds

DebugOutput: sound initialized

DebugOutput: set music volume: 127

DebugOutput: set music volume: 127

DebugOutput: Entering MAIN

DebugOutput: Exiting MAIN

DebugOutput: START OF CREDITS!!!

DebugOutput: set music volume trans: 127->0, step=60

DebugOutput: END OF CREDITS!!!

DebugOutput: Entering MAIN

DebugOutput: set music volume: 127

DebugOutput: Exiting MAIN

DebugOutput: START OF MENU SYSTEM!!!

DebugOutput: SET VOLUME 5: 127

DebugOutput: END OF MENU SYSTEM!!!

DebugOutput: Entering MAIN

DebugOutput: Exiting MAIN

DebugOutput: -=-=[START OF WORLD MAP!!!]=-=-

DebugOutput: stop_sound

DebugOutput: cross play music: 0

DebugOutput: set music volume trans: 127->0, step=4

DebugOutput: set music volume: 127

DebugOutput: stop_sound

DebugOutput: -=-=[END OF WORLD MAP!!!]=-=-

DebugOutput: Entering MAIN

DebugOutput: Exiting MAIN

DebugOutput: Field Start

DebugOutput: Entering MAIN

DebugOutput: Exiting MAIN

DebugOutput: START OF MENU SYSTEM!!!

DebugOutput: SET VOLUME 5: 127

DebugOutput: WM_CLOSE

DebugOutput: END OF MENU SYSTEM!!!

DebugOutput: Field Quit

DebugOutput: UNINITIALIZE DD

Unhooked: GameLoop
Unhooked: Item_Menu
Unhooked: DebugOutput
Unhooked: GetCharacterData
Unhooked: IncreaseHP
Unhooked: IncreaseMP
Unhooked: RestoreHPMP
Unhooked: AddItems
Unhooked: RemoveItems
GameSettings: Unloaded
Game: Exit
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 21:23:08
How is it supposed to load? I put it either in the LOADR folder with the Multi.dll or directly in the FF7 directory and configure, but no one works. I'm running W7 64 bits (or was it? I have (x86) after one of my Program Files, so what is it?)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Kranmer on 2011-04-18 21:33:55
How is it supposed to load? I put it either in the LOADR folder with the Multi.dll or directly in the FF7 directory and configure, but no one works. I'm running W7 64 bits (or was it? I have (x86) after one of my Program Files, so what is it?)

if you have x86 after one of your program files folders then you are on 64bit (x86 means 32bit so all the files in the program files folder that uses the x86 are 32bit programs)

EDIT- i also just get
ERROR: Failed to load library GameSettings.dll
when running this DLL on Windows XP SP3 32bit
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 21:35:48
Ok... O.o

I put all my programs into the Program Files (x86) and the other one serves the only purposes of the pre-installed programs, some transfered programs and being there.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 22:55:17
Not sure why it wouldn't load on Win7, that's what I'm running(x64) and it works fine. (XP should be fine too. ?)

For the install, you just put it in your FF7 directory.

C:\Program Files (x86)\Square Soft, Inc\Final Fantasy VII\GameSettings.dll

Open up "ff7_opengl.cfg" <-- Aali's Custom Driver Config

Add this line at the bottom..

load_library = GameSettings.dll

Save the config after you edit it.. Then run the game in windowed mode to test it out..

Let me know if this solves your issue.

----

Do you have the lastest patch installed(v1.02)? Do you have any .exe modifications from other mods? Latest Visual C++ runtimes installled? (VC++ 2010 runtimes.)

Here are links to the runtimes, try installing them all in order(2005, 2008, 2010) to be sure you have everything.

VC++ Runtimes 2010
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84

VC++ Runtimes 2008
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en

VC++ Runtimes 2005
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 23:08:10
1.02 exe modified by some YAMP patches. Put the GameSettings.dll into a subfolder called "LOADR" and a dll Multi.dll load every dll in that folder. I tested it in the FF7 directory (directly) and it still doesn't work.

Other DLLs that run with it : Speedhack, AnyCD crack.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 23:12:26
1.02 exe modified by some YAMP patches. Put the GameSettings.dll into a subfolder called "LOADR" and a dll Multi.dll load every dll in that folder. I tested it in the FF7 directory (directly) and it still doesn't work.

Other DLLs that run with it : Speedhack, AnyCD crack.

Did you try installing it like I said? I don't know what the other .dll files do, but mine assumes it's being loaded with the game, so that may be an issue.

Also, make sure you have the VC++ runtimes installed, it's not optional, they are required for VC++ applications to run. (See my last post for links.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 23:16:41
Yeah, I already have these (and I reinstalled to make sure). The other DLLs load properly, so I really don't know what is the issue...
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 23:23:47
What's it do? Does it crash, do you get any kind of errors, etc,. ?

The only thing I can think of, is my hooking lib might not be getting compiled into the .dll.. (This would be the same as having a missing .dll, etc,.)

That or a YAMP patch is conflicting. ?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 23:26:16
It just not starting...
...
...
...
CRAP!
I just realized that I used my AVgr's executable (which has modified limits/shops) when testing. Maybe that?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 23:32:01
It just not starting...
...
...
...
CRAP!
I just realized that I used my AVgr's executable (which has modified limits/shops) when testing. Maybe that?

Just not starting? That's odd, for Win7. (Do you have error reporting disabled or something.)

That .exe could be an issue, if you have an original backup somewhere, just test it out. (The other .dll files might cause issues too.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 23:33:50
Yeah, I tried with original executable, but I have some mods :

- Menu Reconstruction
- Yamp patches
- etc...

Will try with th original 1.02 exe

Edit : Nope >:(
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-18 23:45:30
Yeah, I tried with original executable, but I have some mods :

- Menu Reconstruction
- Yamp patches
- etc...

Will try with th original 1.02 exe

Edit : Nope >:(

Hmm, must be an issue with the hooking library(?) I'm using, I'll see what I can do before I get a real release up. (This was just a test release anyways, to find, and fix issues like this one.)

Can any C++ programmers verify this, I'm using a .lib\.h library, does that need shipped with the .dll in order to function correctly, or should it be getting compiled into the .dll.. ?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-18 23:47:15
MSN would be better right? Mine is [email protected]
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-19 00:12:52
I don't really like using messengers.

I don't think there the is much that can be done anyways. (Will probably require another release, and code updates to fix the issue.)

Btw, is there a GameSettings.log file in your FF7 directory? (If so paste it's contents here, that might help me figure out where it's going wrong.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-19 00:13:41
No. BTW, where is GameSettings.ini ??
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-19 00:19:43
No. BTW, where is GameSettings.ini ??

It's only been a few days, it takes time to hack, program, etc,.

It doesn't exist yet, to answer your question.

Anyways, I may PM you in the next couple days, with some debug versions to test out. (I'll try a couple things, there are a number of possible culprits, the hooking library, the console logging window, could even be an issue with some of my hooks themselves.)

----

Edit: One last question, are you using load_library to load that multi loader thing you were talking about? If so, try just replacing that, I don't think Aali's driver supports multiple load_library calls..

load_library = somelib.dll
load_library = GameSettings.dll

Won't work.. (Unless he fixed this.)

load_library = GameSettings.dll <- Just one..

If it still doesn't work, then the problem is more than likely on my end.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Kranmer on 2011-04-19 06:59:32
I have tested this by loading this directly from Aali's Driver (with the load library function) and the multi DLL and i have tried injecting the DLL myself and all 3 ways have failed, in Aali's driver i just get the error
ERROR: Failed to load library GameSettings.dll

Also i have VC++ 2005,2008,2010 redist's installed already

Edit: One last question, are you using load_library to load that multi loader thing you were talking about? If so, try just replacing that, I don't think Aali's driver supports multiple load_library calls..
I posted the Multi loader for DLL's because Aali's driver doesn't support loading more then 1 DLL but by using the DLL in the post below you can load as many DLL's as you want (well i havent tested how many you can load but i have loaded over 4 successfully)
http://forums.qhimm.com/index.php?topic=11564.msg161144#msg161144


EDIT1:-
OK i found the problem, i installed "Visual Studio Express 2010" (its the free version of visual studio) and then your DLL ran fine, so then i deleted every single folder installed by Visual Studio 1 by 1 until the DLL stopped working again, then i narrowed it down further by deleting 1 file at a time and i figured out exactly which files are the needed to run this
msvcp100d.dll
msvcr100d.dll
if the above 2 DLL's are in the system32 folder or the games folder your DLL works fine (providing you have VC++ redist 2010 as well). Hope that helps.

EDIT2:-
Just tried this with the multi DLL and it works fine with it.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-19 10:10:49
Thanks Kranmer. :D

That helped me solve the issue, the problem is, I released a .dll compiled in debug mode, which apparently dynamically links to the runtime files, so the next version will be compiled in release mode, which should solve that issue. :)

I'll try to get a newer release up soon.

---

It may be a bit, I want to try to clean up the release a bit, make a readme, get the .ini implemented, and a few options done, that way it will start resembling the final product I have in mind. (I also have to do a few things to comply with the license on the hooking lib I'm using, I may just write my own, and avoid the issue altogether.)

I still have a number of issues I need to work around to get the restorative items hacked, so despite these being a feature planned for early release, they are getting pushed back while I decode stuff further. (Can these be edited with Wall Market, or any other tool, I don't really know what's currently possible\impossible via the current tools. Any info on what can't be done, that you would like to do, may help with the feature set of this tool.)

(I also need to find the battle mode functions that match the field\world functions I've been finding, a lot of stuff only works in field\world mode right now.)

Anyways, I'll try to get that release up soon, but keep in mind, there is a lot that needs to be done first. The early alpha release was just to work out the kinks in the actual release process, and it seems we have. (Thanks for testing it out, etc, all I wanted to know, was if it would work outside my system.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-04-19 14:56:59
I still have a number of issues I need to work around to get the restorative items hacked, so despite these being a feature planned for early release, they are getting pushed back while I decode stuff further. (Can these be edited with Wall Market, or any other tool, I don't really know what's currently possible\impossible via the current tools. Any info on what can't be done, that you would like to do, may help with the feature set of this tool.)

What exactly are you needing? WM might be able to do it.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-19 16:04:45
What exactly are you needing? WM might be able to do it.

I just wanted to know if Wall Market can already do what I'm trying to do, change the amount of hp\mp items(potions\ether) can restore. I also wanted to know what sorts of things aren't possible that you guys would like to be able to do easily. (ie, things that normally require hacking, and require YAMP\.exe hacks, etc,.)

Here is that post I PM'd you about.. (Though, after re-reading it, I think I found the function I needed.)
http://forums.qhimm.com/index.php?topic=9661.0

Also, I see talks about the USO code, any info on that, where I might find refs in the .exe would be nice, I may be able to make it work again.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-19 17:36:41
Quote
I just wanted to know if Wall Market can already do what I'm trying to do, change the amount of hp\mp items(potions\ether) can restore. I also wanted to know what sorts of things aren't possible that you guys would like to be able to do easily. (ie, things that normally require hacking, and require YAMP\.exe hacks, etc,.)

Wall Market can edit all items & magics (as well as the commands, materias, initial data and equipment), but their in-battle effects only. Sadly, as far as I know, no one found how to edit their field / triangle menu data, yet. If you could find out how to do this, that would make a lot of people happy, myself included :)

As for requests, I sure do have a few. Modifying the out of battle item and magic effects would indeed be great, as would be altering the different algorithms the game uses to calculate damage and stuff. I'd also like the PHS to be always available - not only at save points. Mmm... ...I'm sure I'd have more but they're not coming to mind at the moment.

Great project ! =)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-19 18:19:18
Wall Market can edit all items & magics (as well as the commands, materias, initial data and equipment), but their in-battle effects only. Sadly, as far as I know, no one found how to edit their field / triangle menu data, yet. If you could find out how to do this, that would make a lot of people happy, myself included :)

As for requests, I sure do have a few. Modifying the out of battle item and magic effects would indeed be great, as would be altering the different algorithms the game uses to calculate damage and stuff. I'd also like the PHS to be always available - not only at save points. Mmm... ...I'm sure I'd have more but they're not coming to mind at the moment.

Great project ! =)

Alright, sounds good, that's the kind of stuff I'm working on right now. :)

I should be able to pull off most of your request, we'll see, but it all sounds doable. (Damage calculations etc, are probably going to be hard to find. But the rest shouldn't be too bad.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-20 09:39:43
Kinda sick, so my brain isn't working too well right now. :(

Anyways, if someone working on a trainer for ff7 can donate some known memory addresses it would speed up the process of finding the related .exe functions. (I need v1.02 addresses, anything you have will be good. Though I really need battle codes, codes for random battles, save anywhere, PHS always enabled, etc,.)

I can find these myself, however, it can take varied amounts of time to find them, some take minutes, some can take hours, some even longer, it depends on what you are trying to find.

--

Edit: Found a few things today, nothing really useful, it's looking bad for a number of things, going to be a lot harder than I had hoped. (Still possible though.)

Here is what I've found today.. (That might actually be useful. ?)

ItemAddStatus [DWORD status], this controls what status type get's added when you use an item (item menu) on a character. (Or, what happens when you use an item on a character. ie, I can make a potion act like an Ether, etc,.)

MagicMenuCast [DWORD effect], this controls what magic effect is cast from the magic menu. (I can probably make Cure, cast Esuna, etc,. Not sure how this will be useful.)

Both seem to get their target from elsewhere, not really sure where yet. (Probably the menu cursor, but I won't know for sure till I decode more stuff.)

Everything else I found was useless, I'm going to have create a ton of custom functions to make up for the way they coded the game, which means it's going to take a lot of extra time debugging, and figuring out the games data structures, so I can directly manipulate the data.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Kranmer on 2011-04-20 17:32:51
Anyways, if someone working on a trainer for ff7 can donate some known memory addresses it would speed up the process of finding the related .exe functions. (I need v1.02 addresses, anything you have will be good. Though I really need battle codes, codes for random battles, save anywhere, PHS always enabled, etc,.)

Well i am not currently working on my trainer due to being busy on other projects but i did make a trainer which can be gotten here (its for version 1.02 of FF7 as well)
http://forums.qhimm.com/index.php?topic=9890.0
Take a look at the options on that trainer and tell me if there are any of the address's you want and i will give you the address (also i do have some options i haven't added to the trainer like "Load Anywhere In Field" etc so even if its not on the trainer i may have the address)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-20 18:39:16
Well i am not currently working on my trainer due to being busy on other projects but i did make a trainer which can be gotten here (its for version 1.02 of FF7 as well)
http://forums.qhimm.com/index.php?topic=9890.0
Take a look at the options on that trainer and tell me if there are any of the address's you want and i will give you the address (also i do have some options i haven't added to the trainer like "Load Anywhere In Field" etc so even if its not on the trainer i may have the address)

Awesome, I appreciate it. :)

Full menu (save+phs+materia)
No Random Battles
Constant Random Battles
Hours played timer always 0
Teleport (Any location, I just want to see how the game handles moving the characters.)
Character Switching stuff(Slot1=Barrett + Vincent to Sephiroth). (I may be able to do something cool with this.)
Game Menu Anytime(Should help me decode the menu's a bit more.)

Those should be good, and give me a bit to decode, but feel free to provide any\all the other data.

I'm trying to decode the .exe, so the more data I have, the more I can see how it all fits together, etc,.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Kranmer on 2011-04-20 21:41:07
OK Wutai Clan here you go
Code: [Select]
Full In-Game menu
00DC08F8 = FF FF

No Random Battles
00DBCAD9 = 0

Constant Random Battles
00DBCAD9 = FF

Inf/Max Gil
00DC08B4 = FF B4 34 7F

Set Game Played Time To 0
00DC08B8 = 00 00
----------------------------------------------------
TELEPORT/INSTANT BATTLE/RENAME/PHS/SHOP/IN-GAME MENU/MINI-GAME anywhere
00CC0D89 =
00 = Normal Field
01 = Fade to black (use this for teleport plus the next 2 bytes)
02 = Battle swirl (use this for instant battle plus the next 2 bytes)
03 = UNKNOWN
04 = Makes screen flash but somtimes plays movies
05 = Plays Ending Movie and Credits
06 = Rename Screen
07 = PHS
08 = Weapon Shop
09 = In-Game Menu (use this to get out of shop or phs or rename screen)
0A = UNKNOWN
0B = UNKNOWN
0C = MiniGame


You can find a list of teleport locations and values inside the zip which can be downloaded here
http://forums.qhimm.com/index.php?topic=10556.msg147396#msg147396
----------------------------------------------------
Character slot 1
00DC0230 =
00 = Cloud
01 = Barrett
02 = Tifa
03 = Aeris
04 = Red XIII
05 = Yuffie
06 = Cait Sith
07 = Vincent
08 = Cid
09 = Young Cloud (only while activated or if used before Kalm Flashback)
0A = Sephiroth (only while activated or if used before Kalm Flashback)
FF = Blank

Character slot 2
00DC0231 = SAME AS ABOVE

Character slot 3
00DC0232 = SAME AS ABOVE
----------------------------------------------------
Activate character instead of the following character (use this to replace different characters with sephiroth or young cloud)
Cloud
00DBFD8C =

Barrett
00DBFE10 =

Tifa
00DBFE94 =

Aries
00DBFF18 =

Red XIII
00DBFF9C =

Yuffie
00DC0020 =

Cait Sith
00DC00A4 =

Vincent
00DC0128 =

Cid
00DC01AC =

09 = Young Cloud
0A = Sepiroth
----------------------------------------------------
Sephiroth Instead of Vincent Code
Sephiroth In Slot3
00DC0232 = 0A

Activate Sephiroth Instead of Vincent
00DC0128 = 0A

Sephiroth's Name
00DC0136 = 01 41 33 45 50 48 49 52 4F 54 48 FF
----------------------------------------------------
That covers the things i think you where after, if you need anything else let me know (even if i don't have it i may be able to help).
Also a small request if i may, when this is complete would you be able to send me the Source to have a look at ? i don't really know much C++ but your project does interest me (also feel free to say no, i know how precious source code is to lots of programmers) Or if you could make it open source that would be even better.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-20 23:09:38
OK Wutai Clan here you go
Code: [Select]
Full In-Game menu
00DC08F8 = FF FF

No Random Battles
00DBCAD9 = 0

Constant Random Battles
00DBCAD9 = FF

Inf/Max Gil
00DC08B4 = FF B4 34 7F

Set Game Played Time To 0
00DC08B8 = 00 00
----------------------------------------------------
TELEPORT/INSTANT BATTLE/RENAME/PHS/SHOP/IN-GAME MENU/MINI-GAME anywhere
00CC0D89 =
00 = Normal Field
01 = Fade to black (use this for teleport plus the next 2 bytes)
02 = Battle swirl (use this for instant battle plus the next 2 bytes)
03 = UNKNOWN
04 = Makes screen flash but somtimes plays movies
05 = Plays Ending Movie and Credits
06 = Rename Screen
07 = PHS
08 = Weapon Shop
09 = In-Game Menu (use this to get out of shop or phs or rename screen)
0A = UNKNOWN
0B = UNKNOWN
0C = MiniGame


You can find a list of teleport locations and values inside the zip which can be downloaded here
http://forums.qhimm.com/index.php?topic=10556.msg147396#msg147396
----------------------------------------------------
Character slot 1
00DC0230 =
00 = Cloud
01 = Barrett
02 = Tifa
03 = Aeris
04 = Red XIII
05 = Yuffie
06 = Cait Sith
07 = Vincent
08 = Cid
09 = Young Cloud (only while activated or if used before Kalm Flashback)
0A = Sephiroth (only while activated or if used before Kalm Flashback)
FF = Blank

Character slot 2
00DC0231 = SAME AS ABOVE

Character slot 3
00DC0232 = SAME AS ABOVE
----------------------------------------------------
Activate character instead of the following character (use this to replace different characters with sephiroth or young cloud)
Cloud
00DBFD8C =

Barrett
00DBFE10 =

Tifa
00DBFE94 =

Aries
00DBFF18 =

Red XIII
00DBFF9C =

Yuffie
00DC0020 =

Cait Sith
00DC00A4 =

Vincent
00DC0128 =

Cid
00DC01AC =

09 = Young Cloud
0A = Sepiroth
----------------------------------------------------
Sephiroth Instead of Vincent Code
Sephiroth In Slot3
00DC0232 = 0A

Activate Sephiroth Instead of Vincent
00DC0128 = 0A

Sephiroth's Name
00DC0136 = 01 41 33 45 50 48 49 52 4F 54 48 FF
----------------------------------------------------
That covers the things i think you where after, if you need anything else let me know (even if i don't have it i may be able to help).
Also a small request if i may, when this is complete would you be able to send me the Source to have a look at ? i don't really know much C++ but your project does interest me (also feel free to say no, i know how precious source code is to lots of programmers) Or if you could make it open source that would be even better.

Thanks a lot, I appreciate it. :)

On the topic of the source code, yeah, I'm going to open source it, I know how hard it is to find info on doing this stuff, it's taken me forever to learn, due to how stingy ppl are with this info.

I can even explain the basics, it's simple really.

There are lot's of ways to decode the .exe, however, in cases like this one, the easiest, is simply using a tool like MHS v6.1 to find pointers(like the ones you are supplying), then you can use MHS to see what functions access the value. (ie, right click value, select find what writes to this address), then you will just have to play the game a bit, and do things that change the value, and MHS will keep a list of all the functions that wrote to the value.

Then, it's just a matter of using something like IDA Pro to comment the ASM, just write down little notes as you decode things, eventually, it starts becoming clear, you can start seeing how things go together, etc,. (Lot's of trial and error, lot's of re-commenting, as you realize your initial assumptions were wrong, etc,.)

Beyond that, I'm still learning myself, decoding data structures, etc, are going to be a learning experience. :)

Now, there is a lot to learn to be able to actually do this, but you seem to know your way around ASM, and can obviously handle hacking memory, so, you should have no problems figuring it out. If you do have a question, feel free to ask, I'm not stingy at all.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-21 12:04:08
Another request, while I think about it : allowing three party members to participate in the Battle Square ^^

EDIT:

And actually, if you need more ideas, you can look at the edited part of reply #43, in this thread (http://forums.qhimm.com/index.php?topic=11667.msg162804#msg162804). Granted, these ideas come from FFVI (and I bet most of them would be doable through AI editing), but I wonder, for example, what could be done to the status effects themselves.
Oh yeah, and expanding the list of items / weapons / armors / accessories. I would love this.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-21 20:40:35
Another request, while I think about it : allowing three party members to participate in the Battle Square ^^

EDIT:

And actually, if you need more ideas, you can look at the edited part of reply #43, in this thread (http://forums.qhimm.com/index.php?topic=11667.msg162804#msg162804). Granted, these ideas come from FFVI (and I bet most of them would be doable through AI editing), but I wonder, for example, what could be done to the status effects themselves.
Oh yeah, and expanding the list of items / weapons / armors / accessories. I would love this.

Well, I spent most of the last couple days working on a new hooking technique, it's actually, more like a dynamic patch, than a hook. Anyways, now that I've learned how to do that, I should be able to accomplish a lot of cool stuff.

I'll do what I can to make the request happen, but I can't promise anything, I mainly wanted an idea of what parts of the code I should focus on decoding.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-21 20:57:34
I see. Oh, and I also know that many people, myself included, would love to increase the damage from the Poison status (something like 25% MaxHP would be cool, so it finally becomes a threat). I'm done this time, promise  :P
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-21 21:07:46
I see. Oh, and I also know that many people, myself included, would love to increase the damage from the Poison status (something like 25% MaxHP would be cool, so it finally becomes a threat). I'm done this time, promise  :P

It's cool, I don't mind the request, it helps me figure out what to work on, I just wanted to make sure you guys know, the best I can do, is try.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-22 16:59:21
Hey, in case you haven't noticed, I update the second post, on the first page with stuff of interest, I just added a few battle variables I decoded. (So even if I'm not making new post, you can always check that post for possible new additions\updates.)

Working on decoding the battle system a bit, and I added a new feature for setting custom random battle rates. (It still needs work, interferes with Chocobo Lure, seems that Enemy Away\Enemy Lure\Chocobo Lure, and random battles are handled by the same function. So I'll need to re-write my hook to account for that once, I figure out which part of the code I patched handles it.)

Also, I need to write a new function into the games memory space, so it can access the games variables as if it were original game code. So, if you know how to dynamically allocate a function into a code cave within the game, let me know, I need to be able to do this for some advanced stuff. (I might be able to Google it, but, it might be hard to find, since I don't know the proper terminology.)

Basically, I want to inject a function, then hook it, so I can use it to access the games data, just like the game does.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-04-22 21:53:39
Wall Market can edit all items & magics (as well as the commands, materias, initial data and equipment), but their in-battle effects only. Sadly, as far as I know, no one found how to edit their field / triangle menu data, yet. If you could find out how to do this, that would make a lot of people happy, myself included :)

Oh, I know how to do it. I've known for a while. It's just it'd be nearly impossible to do it safely other that what Wutai Clan's trying to do. I pointed out the function that handles the Items. That's all there is to it.

Wutai Clan:
I thought I already gave you the DamageHP/MP functions. I guess I didn't. I didn't have DamageMP listed although I was almost sure I had found it before.

DamageHP is 0x6CB9D2. Takes FormationSlot and Amount to damage as parameters. Both are DWords. This is called by some field scripts like running into the spikes in Cave of the Gi.
DamageMP is 0x6CBB27 and takes same parameters. I think this is used when performing magic from the menu.

GetItemCount is 0x6CBF57. Takes Item Index as a parameter and returns the item's listing as it is in the inventory ((Count << 9) + Item Index). Not much of a stretch from there to get the count.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-23 09:41:33
@NFITC1, Thanks, I'll have to get them tested, and update the list, etc,. :)

@Kranmer, the post on the first page with all the update info, contains a few entries marked as variables, you can use those for trainer options, they are proper values for memory editing, pointers in memory editing, are really the addresses of the variables in the .exe..(Also, all my values are obtained with a retail v1.02 .exe, so if you have any .exe patches(YAMP), it could interfere with the values, this project will pretty much require an unmodified .exe to work 100% as intended.(It could be unstable otherwise, since I might end up patching code, that is somewhere else in your game, causing crashes, bugs, etc,.))

Well, thanks to both of you for the help, feel free to contribute with anything you don't see on my list, I'm just decoding at random, to get a clearer picture of what does what, and implementing new stuff as it becomes possible.

----

Edit: Can you explain what this formula means?

Code: [Select]
((Count << 9) + Item Index)

----

Edit: I've tried various ways to make a working formula that always gives me the correct results, I can't seem to figure it out. ???
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-04-24 08:50:43
Edit: Can you explain what this formula means?

Code: [Select]
((Count << 9) + Item Index)
<< is the SHL you've been asking about somewhere on the board. So... Having an item record, to get the actual count, you do a SHR (by 9 bits) and that means dividing by 512.

So a 0x0601 (1537 in decimal and 0000011000000001 in binary) means (/ is an integer-division, % is the modulus)
 - 1537 / 512 = 3 - actual count
 - 1537 % 512 = 1 - item id (might be a potion, don't remember)

A quicker way - you get the higher byte (in our example - 0x06) and divide it be 2, discarding the remainder. 6 / 2= 3.

dziugo
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-24 12:28:26
<< is the SHL you've been asking about somewhere on the board. So... Having an item record, to get the actual count, you do a SHR (by 9 bits) and that means dividing by 512.

So a 0x0601 (1537 in decimal and 0000011000000001 in binary) means (/ is an integer-division, % is the modulus)
 - 1537 / 512 = 3 - actual count
 - 1537 % 512 = 1 - item id (might be a potion, don't remember)

A quicker way - you get the higher byte (in our example - 0x06) and divide it be 2, discarding the remainder. 6 / 2= 3.

dziugo

Thanks for taking time to help out. :)

Anyways, that formula isn't working either, here are a few examples taken by checking my current inventory.

Code: [Select]
Item = Potion x99
Slot = 0 [0 Based]
Value = 50,688 [Decimal]
Result = 50,688 / 512 = 99 [Correct]

Item = Ether x8
Slot = 1 [0 Based]
Value = 25,089 [Decimal]
Result = 25,089 / 512 = 49 [Wrong]

Item = Phoenix Down x46
Slot = 2 [0 Based]
Value = 65,535 [Decimal]
Result = 65,535 / 512 = 127 [Wrong]
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-04-24 13:01:22
65535 (or 0xFFFF) is a slot-empty indicator, so you've most likely mixed the indexes.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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. :)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-04-25 19:24:59
Just some extra info:
STITM (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/58_STITM)
CKITM (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/5A_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").
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-25 21:37:33
Just some extra info:
STITM (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/58_STITM)
CKITM (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/5A_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+).
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil 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 :)

(http://img838.imageshack.us/img838/6348/sensep.th.jpg)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil 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
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil 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 ).
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 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
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan 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.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 21:42:09
So what we saying now, that we can limit the sense to 65535?  I will look into this later and see what I can see.  Which won't be much . ha.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 21:52:24
For Sense, I would need both the current HP and max HP, and I can probably get it implemented. (Pointers to the values.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 21:55:41
I am looking now at the code.  In memory it is at :
5ca10f

It doesnt look too complicated to change.  Someone should be able to no probs.  Ill see what ive learned :)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 22:04:50
I am looking now at the code.  In memory it is at :
5ca10f

It doesnt look too complicated to change.  Someone should be able to no probs.  Ill see what ive learned :)

Alright, I'll see what I can do, looks simple to change, so long as that's the only value that's causing issues. (All I have to do is replace that call with a jmp, patch the value, and return the execution to the next command.)

Code: [Select]
__asm
{
    cmp dword ptr ds:[0x009AB10C][ecx], FFFFh
    jmp [0x005CA119]
}
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 22:08:50
it does seem to do a compare though to

9ab2ac  What is it doing there?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 22:13:05
it does seem to do a compare though to

9ab2ac  What is it doing there?

That's probably the current HP value, it compares it to the max value allowed(7530h), and if it passes, it works, if not it fails, see above(my last post) for an example of how to patch it.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 22:28:25
Yes that gets it to 65535 I take it? Seemed to work for me, And if I read you right:

5ca107 becomes je 005CA119

and 5ca10f becomes cmp [ecx+009AB10C],0000ffff

Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-26 22:31:24
F*ck! Kranmer could you send me the needed DLLs?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-26 22:35:09
@NFITC1:

Yeah, I'm nitpicking with W-Magic, I admit. It's true that it works this way in all FFs that made the command available. Still, I'd love to select the first magic spell, its target, then press Square or something to bypass the need to enter a second command.

@ Wutai clan :

I'll test your test release right away :)
...if I can make multi.dll work, that is. I followed the instructions : Multi.dll and the LOADR folder are both in the Final Fantasy VII directory, and I added the load_library = Multi.dll line inside the FF7opengl.cfg. And it doesn't work either when I only put FF7anyCD.dll inside the LOADR folder. It works fine without Multi.dll though, so I'll try your dll without it for now.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 22:36:19
yeah your code works fine like that, question is can we possibly extend this to work for creatures up to HP's of  FF FF FF  ?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 22:44:11
Yes that gets it to 65535 I take it? Seemed to work for me, And if I read you right:

5ca107 becomes je 005CA119

and 5ca10f becomes cmp [ecx+009AB10C],0000ffff

Well, I don't know what method you are using, but for me, this is how it works.

0x005CA10F - get's replaced with an unconditional jmp to a code cave.

After the jump, it just executes this code, and returns to the original destination.

cmp dword ptr ds:[0x009AB10C][ecx], FFFFh
jmp [0x005CA119]

So basically, it's the same as just overwriting the original..

cmp     dword_9AB10C[ecx], 7530h

With this..

cmp     dword_9AB10C[ecx], FFFFh

---

@Vgr255, I take it it's not working for you again? I compiled in release mode this time, if you have the proper VC++ 2010 x86 runtimes installed, it should be working. ???
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 22:59:00
but what of increasing the limit to FF FF FF, is this possible?  How would it be done?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 23:05:21
but what of increasing the limit to FF FF FF, is this possible?  How would it be done?

Just put a larger value in than FFFFh, though, it won't look right in the menu's. (Edit: I misunderstood your question, I was distracted by the release not working for Vgr255..)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-26 23:10:21
Quote
but what of increasing the limit to FF FF FF, is this possible? How would it be done?

I don't know if you read my previous messages, but this is what I did by directly editing the executable, and it works great. The only problem is, you'll never know how much HP the enemy really has... ...It will divide its HP in chunks of 65535. So, if the enemy has 131100 HP and you sense it, it will display "30/30 HP" then after you damage it for 30 points of damage, you'll read "65535/30 HP" and after you deplete these 65535, it will show "65535 / 30 HP" one last time.

@ Wutai clan : I installed the C++ thingy, used a clean FF7.exe, and made FF7opengl.cfg directly read GameSettings.dll, but it still doesn't work :(
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-26 23:17:02
Yeah, I saw your post after typing my message. And the new version doesn't work either :(
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 23:23:28
Yeah, I saw your post after typing my message. And the new version doesn't work either :(

WTF...

Everything needed should either be a part of the runtime, or compiled into the .dll itself, this is why I HATE C++, it's junk.. C# never has issues like this, I really wish C# could do this kind of stuff natively. (It can with C++ dlls, but, then it's the same thing..)

Try installing the x64 version if you have an x64 system, then reboot..

msvcp100.dll
msvcr100.dll

Search your system for these files, and copy(don't move) them in your FF7 directory, if the above didn't work.

Did you install those with admin privs? That could be the problem too, you have to have admin privs to install stuff to the system directory where the runtimes install. (ie, Run as admin(win7) when installing the VC++ runtimes.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-04-26 23:26:15
My Windows XP is 32 bits, so it should do... Anyways, it's getting late in my part of the world (1:30 AM), so I'll call it a day. Maybe it will work tomorrow, nighty night everyone ^^

EDIT:

Sorry, I'll have to try this fix tomorrow.

EDIT2:

Yes, I run my system as an administrator. Can I go to bed, now ? lol
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 23:35:22
Sure, sleep well.. ?

Try this if you are having issues. It might work..?
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c32f406a-f8fc-4164-b6eb-5328b8578f03

--

Edit: I'm going to try updating to the latest VC++ release, and rebuilding the project, hopefully they fixed this, because it's stupid. (So, you'll probably need that since it's the latest runtime.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 23:44:27
I don't know if you read my previous messages,

I did, and as you said, that simply won't work right.  It has to be done properly.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-26 23:54:17
I did, and as you said, that simply won't work right.  It has to be done properly.

That is done properly, the game just doesn't support it. There are various possible causes.

1. The variable may only be able to hold 65,535.
2. The message code just doesn't support it. (Variables too small, text limitations, etc,.)
3. Some unknown issue.
4. All of the above.

I might be able to fix it, but it's going to take time, and more investigation.

--

@Kranmer, let me know if you can run this new version, that will help narrow down the issue, I compiled in release mode, and switched the project to use the /MT switch, which compiles the runtime files directly into my DLL, so it should be working..

The only thing I can think of, is I compiled the hooking lib using different settings, so it's causing issues, I'm going to try recompiling that, updating my system, and updating Visual Studio.. (Then rebuilding the project.)

It will probably be tomorrow before I get another release up, but your answer will greatly aid in troubleshooting the issue.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-26 23:58:36
yup, sadly thats how it looks. at least it is now extended.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-27 00:41:42
Okay, last attempt for the day.

Test Release
http://www.mediafire.com/?2mr51shembkmfbd

VC++ Runtime 2010
http://www.microsoft.com/downloads/en/details.aspx?familyid=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84&displaylang=en

VC++ Runtime 2010 SP1
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c32f406a-f8fc-4164-b6eb-5328b8578f03

---

Edit: Did you guys setup the .ini file? The debug console is disabled by default, as are all the other features, so if you didn't configure it, it won't appear to do anything. (Was a .log file generated, that should occur regardless.)

I've also posed the issue on a support site, so hopefully between them, Kranmer, and your responses, I can figure WTH is going on here.  :x
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-27 01:39:59
Even with VC++ installed, both DLLs in both FF7 and LOADR folder, it doesn't work...
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-27 01:44:23
Even with VC++ installed, both DLLs in both FF7 and LOADR folder, it doesn't work...

Can you describe, "doesn't work"..

Will the game launch? Or does nothing happen at all.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-04-27 01:45:50
Game launch. I think I must try with an original ff7.exe ... well now I'm busy (lazy, yeah, but busy too)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-27 01:50:53
Here, this package contains three debug versions, try them all, and let me know which if any works. (Run in windowed mode for the test.)

http://www.mediafire.com/?d3apd6xwex9yc7g

Basically, I've disabled several features in each version, to try to narrow down where it's going wrong.

Here are the test descriptions.

DLL Load Test:

This test does nothing but show a messagebox, every other feature is disabled, if this doesn't work, it's a runtime\compile issue.

Console Only Test:

This test will just load the debug console, this will tell me if that's somehow causing issues. (Though it was disabled by default.)

No Logging Test:

This test will load everything, but disables all logging features, to determine whether the logging method is an issue.

---

I forgot to include the .ini file, just put this in a .txt file, and name it GameSettings.ini, if you don't still have a copy..

Code: [Select]
[Debug Console]
Enabled = true

[Infinite Item Use]
Enabled = true

[MP Regeneration Settings]
Enabled = true
Rate = 6

[Random Battle Settings]
Enabled = true
Rate = 2

[Battle Reward Multipliers]
Enabled = true
EXP = 2
GIL = 2
AP = 2
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Dark_Ansem on 2011-04-27 07:02:02
will try this later. good work.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-04-27 10:34:36
In other news, I think I know how to fix this sense issue...

edit.  Not so easy.  Probably going to take a lot of messing.  I know what is wrong but to fix takes a bit more work :) I will send what I have learned in PM.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: TTK_86 on 2011-04-27 15:52:06
Works fine with me!  It seems that EXP and AP multiplier is a bit off, it sets too high values in game.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-27 16:02:13
Works fine with me!  It seems that EXP and AP multiplier is a bit off, it sets too high values in game.

Which version did you try, the one from the last page, or the debug builds from this page, it's kind of important, I need to solve the issue of it not working for some people.

About the battle rewards, yeah, I thought they seemed kinda high, the code must loop, and apply the multiplier multiple times, or the code I used doesn't work as intended, I'll try to get some debug output on original values vs. modified values for Exp\Gil\AP, to figure out what's wrong.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-28 04:45:46
So, no one intends to try the test builds?

Then let me lay it out plainly, this only effects some users, and whether it gets fixed or not, depends on whether or not you are cooperative and help me find the cause, it's your choice, it runs great for me. I'm trying to help you out.

Here are some possible causes. (In order of highest likelihood.)

1. You are missing some required file.

This could be my fault, it could be yours, or it could be Microsofts. (Hard to tell, until we figure out what if any required DLL's are missing.)

http://www.dependencywalker.com/

To find out if you are missing something required, download that tool, and click "File", choose "Open", and select my DLL, it will tell you if you have everything required to run my DLL installed.

This link will help you use the tool. (It's really easy.)
http://www.techerator.com/2010/05/resolve-missing-dll-errors-with-dependency-walker/

If you are missing a required file, report it, so I can track down the required library, and link the installer for others to use.

2. It's possible that something about one of libs, or my code is causing the issue, I have supplied a debug package above which will tell us where the issue might be, but, that requires you to run it, and report your results. (I left instructions above, on what needs to be done, and I need the results for all three DLL files.)

3. Some stray setting in VC++, is causing it to compile in such a way, that's incompatible with certain systems for some unknown reason. (I won't know until I rule out the other possibilities, and changing settings for no good reason, is more likely to break the project for everyone, than it is to fix it for you.)

4. If you got this far, and still can't run my project. It tells me numerous things, you have all the required files, my code isn't at fault, and the VC++ IDE isn't the issue. It's voodoo magic, or God himself smiting you, because it should be working, pure witchery, no doubt about it. ;)

But seriously, it should be one of the first three options, the test I've provided, will take no more than 10 minutes to complete.

It's up to you, these are the possible causes, I've given you the tools to help solve the issue, but I can't make you do anything.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: TTK_86 on 2011-04-28 07:28:07
It was the one from page 4, and i have unmodified ff7.exe

I'll try those test builds later today.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-28 07:53:03
It was the one from page 4, and i have unmodified ff7.exe

I'll try those test builds later today.

If the one on page 4 worked for you, then you don't have to worry about this, this is only for people that can't run the regular build. (On page 4.)

Thanks though. :)

-------

Finally got around to testing GetCharacterData, and trying to decode it's return value.

Slot 0 = 0x00DBA498
Slot 1 = 0x00DBA8D8
Slot 2 = 0x00DBAD18

These were already known values(to me anyways.), I need to figure out where to go next, and I should be able to start getting the stats, etc,.

---

Edit: I don't know, I've tried various things to get the data out of those, I've cast the data to arrays in every way I could think of, it never seems to be correct.

I used inline ASM, and accessed the values like that, and it does return data, but, it doesn't seem to relate to the info found on the wiki. (ie, I checked the indexes, using exact byte counts listed to store the values, and it was all wrong.)

NFITC1, can you shed some light on this, that is the stats, etc, correct? It should be the same as the character map on the wiki, right?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-04-29 15:55:02
One tip - character records are 132bytes (0x84) long in the savemap - check if it's actually a savemap you're looking at (IIRC, savemap address for FF7 Save begins with 0x00DBxxxx, but don't remember the exact number). Savemap is the best place to modify data.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-29 16:37:47
One tip - character records are 132bytes (0x84) long in the savemap - check if it's actually a savemap you're looking at (IIRC, savemap address for FF7 Save begins with 0x00DBxxxx, but don't remember the exact number). Savemap is the best place to modify data.

Thanks. :)

I'm thinking the data isn't an array, but a bunch of loose globals, and those are the starting indexes for the character records. So, I should be able to check the next byte after each one, and get the character ID. (I think that was the first byte of character record(ID), I'll have to double check the wiki, to see what order the data is in.)

I'll check it out here in a bit, I gotta get woke up.

----

Well, the data I'm getting seems to be character data, so I was right about it being loose globals, however, the wiki has it listed in a very different order. (Which doesn't mean the wiki is wrong, it just means it gets sorted different in the save.)

Here is the order I'm finding it in..

ID (Maybe, it was a 0 with Cloud, I'll have to test it out..)
Strength
Vitality
Magic
Spirit
Dexterity
Luck
Attack
Defense
Magic Attack
Magic Defense
Current HP
Max HP
Current MP
Max MP
Unknown = 0 // Don't think they are sources used..
Unknown = 0 // SAA
Etc.. (There are several unknowns, then it get's kind of weird, perhaps equipment\materia data, etc,.)

I'll have to keep checking the values, to get the rest. (I know these are correct, I've already tried modifying them, and the stats change.)

--

I know this, this game has too many representations of the same data, I think I'm going to map them all to the same globals once I decode the game enough to do so. (Relics from the PSX version no doubt.)

What I can do, is create a C++ module, that has variable representations of all the games data, then anytime the game accesses a value, point it at my new module(and the appropriate value), that way all the data get's handled uniformly, and only by one variable. (And will always stay in synch, and be easier to work with.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-04-29 20:06:56
I hope I'm able to clear some of this up because I think I know what you're talking about.

There are two sets of character data.

One is part of the save map which is always kept in memory at 0xDBFD38 and is identical in form to the savemap on the wiki.

The second is what I call Active Party Data. This is what battles use to do their manipulation of and stuff. That starts at 0xDBA498 and has three entries of 1088 bytes. My notes has it following this structure:

Char ID
Level
Attack (Str + Str Bonus)
Defense (see above)
Magic (see above)
MDef (see above)
Speed (see above)
Luck (see above)
word: Temp_Attack (Attack + weapon strength; can be halved in the battle arena)
word: Temp_Def (Like above)
word: MagicAtk ( just Magic stat )
word: MagicDef (just Spirit stat without MDef fix )
word: HP
word: MHP
word: MP
word: MMP
word: Limit (looks like limitbar value)
word: Unknown
word: Counter Attack Command
word: Counter Attack Chance
...
+0x3C: OR'd with 0x418 when recalculating stats; unknown effect
...
+0x44: Statuses that can be inflicted by attacking
...
+0x4C: Battle Command Menu. Structure of six bytes and sixteen entries
..
+0x108: Enabled Magics: eight bytes * 56 magics (magic index, MP cost, ?, ?, ?, ?, ?, ?)
+0x2C8: Might be enabled Summons: eight bytes * 16 summons.
+0x348: Some other command-related thing: eight bytes * 24 entries
+0x408: I believe this is the first 11 bytes of equipped weapon data the character is using. This will prevent the necessity of continually checking the weapon part of the KERNEL for everything. Follows weapon data from wiki. Only cares about status attack (0x40D) and accuracy (0x410)
+0x418: Status Defenses?
+0x41C: byte list of four statuses to increase ( four bytes )
+0x420: amount to increase those stats by (four bytes)
+0x424 - 0x440: unused?

That's what I have. There's lots of blanks there that I don't know. Rarely does the game point at these address individually. Most of the time it gets the head of the map, increases it by formationID * 440h, then adds the amount it wants to look for. The map's offset is loaded LOTS of times and I don't have the time to look through them all.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-04-29 23:04:09
I hope I'm able to clear some of this up because I think I know what you're talking about.

There are two sets of character data.

One is part of the save map which is always kept in memory at 0xDBFD38 and is identical in form to the savemap on the wiki.

The second is what I call Active Party Data. This is what battles use to do their manipulation of and stuff. That starts at 0xDBA498 and has three entries of 1088 bytes. My notes has it following this structure:

Char ID
Level
Attack (Str + Str Bonus)
Defense (see above)
Magic (see above)
MDef (see above)
Speed (see above)
Luck (see above)
word: Temp_Attack (Attack + weapon strength; can be halved in the battle arena)
word: Temp_Def (Like above)
word: MagicAtk ( just Magic stat )
word: MagicDef (just Spirit stat without MDef fix )
word: HP
word: MHP
word: MP
word: MMP
word: Limit (looks like limitbar value)
word: Unknown
word: Counter Attack Command
word: Counter Attack Chance
...
+0x3C: OR'd with 0x418 when recalculating stats; unknown effect
...
+0x44: Statuses that can be inflicted by attacking
...
+0x4C: Battle Command Menu. Structure of six bytes and sixteen entries
..
+0x108: Enabled Magics: eight bytes * 56 magics (magic index, MP cost, ?, ?, ?, ?, ?, ?)
+0x2C8: Might be enabled Summons: eight bytes * 16 summons.
+0x348: Some other command-related thing: eight bytes * 24 entries
+0x408: I believe this is the first 11 bytes of equipped weapon data the character is using. This will prevent the necessity of continually checking the weapon part of the KERNEL for everything. Follows weapon data from wiki. Only cares about status attack (0x40D) and accuracy (0x410)
+0x418: Status Defenses?
+0x41C: byte list of four statuses to increase ( four bytes )
+0x420: amount to increase those stats by (four bytes)
+0x424 - 0x440: unused?

That's what I have. There's lots of blanks there that I don't know. Rarely does the game point at these address individually. Most of the time it gets the head of the map, increases it by formationID * 440h, then adds the amount it wants to look for. The map's offset is loaded LOTS of times and I don't have the time to look through them all.

That's probably what I'm looking at then. :)

As far as I can tell, the game has at least three different sets of values for managing the same data.

Savemap
World\Field
Battle

These values(Active Party Data) get loaded with the battle module, but, they pass their data into local variables, ie, if you change them in world mode, it works fine(changes in stats menu), but not in battle mode. (I was trying to make mp regen work in battle mode, since I finally found the main battle loop, and quickly found changing them had no effect.)

It works kinda like this.

1. Active Party: P1 Current MP -> Stored to local.
2. Local MP manipulated.
3. Local returned to Active Party Data MP
4. Loop

You can see the Active Party MP change during battle, but changing it yourself, seems to have no effect, since the locals(take control) and overwrite it anyways.

---

Edit: Okay, I got the random battle rate patch fixed up, it no longer breaks Chocobo Lure. I should be able to get the "Sense" materia fix implemented too. (I have a new method for patching data, that can target single lines of ASM.)

----

Edit: Alright, got those patches done, now I'm working on a camera patch, it basically gives you a real nice 3rd person view in world mode. :) The game looks much better from this perspective, you can see more details, the LOD doesn't look as bad, etc,.

Edit: Man, that camera patch was a pain, it took a lot of patching to make it work, but I think it's worth it. The only issue, is that it breaks the overhead view, the camera system is way too complicated to do it properly at this time. (After I decode it a bit more, I should be able to fix it.)

I couldn't get a screenshot, it just came out black, but, it's like a whole new game, driving the vehicles, like the buggy feels much better too. It will take a bit of testing to make sure it doesn't cause any issues, like not being able to see something you could with the original view, but it should be fine. (It will be optional anyways, so you can always turn it on\off as needed.)

Edit: Here, I had to take it in windowed mode.
http://i51.tinypic.com/kcl3yu.png
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-01 20:24:46
Did any of the Q-Gears folks write their info down?

They decoded a lot of the same stuff I'm working on to figure out the opcodes for that project, which means they knew were the functions were located in the disassembled code.

I can find this stuff again, but it's going to take forever, and it's already been done, and should be well documented, so are there any post that I've overlooked, or sources of info? (I'll keep searching the forums, but the more time I waste on stuff like this, and doing work that's already been done, the less new features I can get coded. I've decoded maybe 30 functions, out of hundreds, probably close to thousands.)

Btw, did anyone see my last post, I hacked the world view camera, there is a screenshot. I thought it was pretty cool, no one else?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: obesebear on 2011-05-01 20:43:22
I think Kranmer recently did something similar to the world map camera.  But if my memory serves me correctly he was only able to adjust the level of zoom.  Is that what you can do, or can you actually move yours around?

Also, this seems obvious, but check the QGears forum for information.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-01 20:47:48
I think Kranmer recently did something similar to the world map camera.  But if my memory serves me correctly he was only able to adjust the level of zoom.  Is that what you can do, or can you actually move yours around?

Also, this seems obvious, but check the QGears forum for information.

I can adjust it however I want, zoom\angle\etc. /snip

---

Edit: Decoding is going to be slow now that I've got most the easy stuff located. I've got a few tricks up my sleeve thanks to MHS, but, I expect the next few days to yield little in the way of results, going to be spending most of my time decoding, trying to find some of the more elusive stuff.

I've been trying to nail down a general flow for a number of systems. For example, I found\decoded part of the damage formulas.

From what I can see so far, it works something like this.. (Rough draft formula. This was a monster attacking me, btw,.)

Base Attack = 12 // Monster base damage?
Attack Multiplier(?) = 25 // Weapon? Stat? (Not sure where this value came from.)
Damage = 300

// Not sure how it calculated this part, but the value 240 is correct.
Damage / Defense Factor = 240 // Final Damage

I found the rest(or a lot of it.), but I haven't decoded it at all yet. (The above can be modified by several factors\functions, so it may be a real pain to fully decode. There were about ten functions called, and no telling how many branching functions could be called based on different factors, etc,. Special materia factors, equipment bonuses, etc,. ?)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Aali on 2011-05-02 10:22:42
Akaris work and most (if not all) of Q-Gears is based on the PSX version.

The call table for field script opcodes is at 0x9055A0.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 10:40:31
Akaris work and most (if not all) of Q-Gears is based on the PSX version.

The call table for field script opcodes is at 0x9055A0.

I found that, but honestly, don't know what to do with it?

Any tips?

(My guess, is that it's a structure, based on how it looked, but that's about all I know about it so far. Too tired to think about it, I'm going to bed, I'll mess with it some more after I get some sleep.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-05-02 12:17:11
That's probably what I'm looking at then. :)

As far as I can tell, the game has at least three different sets of values for managing the same data.

Savemap
World\Field
Battle

Where's that located? I've been looking for that for a while now.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 19:12:13
Where's that located? I've been looking for that for a while now.

Starts here. [0x00DBA498] - (Returned by GetCharacterData[0])

That's just an index(structure), the next byte is ID, followed by Level, etc, but it doesn't follow the savemap exactly.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-05-02 20:02:46
Starts here. [0x00DBA498] - (Returned by GetCharacterData[0])

That's just an index(structure), the next byte is ID, followed by Level, etc, but it doesn't follow the savemap exactly.

...That was the battle structure I was just telling you about. What, then, do you have as the Battle stat location?
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 20:23:07
...That was the battle structure I was just telling you about. What, then, do you have as the Battle stat location?

The values you said were the active party, seems to do just that(world\field), the other characters don't seem to be calculated except for in the savemap. For battle, it passes the active party data into local variables. (Within the battle loop functions)

Though, I haven't fully decoded it, there could be more going on, or I could be misreading what's happening.

I just figured out how to find the opcodes, you basically, take an opcode.

MPu\IncreaseMP = 0x45
Opcode Structure = 0x009055A0

(0x45 x 4) + 0x009055A0 = 0x009056B4 [MPu\IncreaseMP]

That's the position in the OPCODE structure, the function is actually located here. [0x0061F801]

Btw, that function isn't directly usable, it uses local variables, and calls IncreaseMP[0x006CBBBF]..
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-05-02 20:52:59
I just figured out how to find the opcodes, you basically, take an opcode.

MPu\IncreaseMP = 0x45
Opcode Structure = 0x009055A0

(0x45 x 4) + 0x009055A0 = 0x009056B4 [MPu\IncreaseMP]

(...)

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.
2 pages back. You're saying that you don't want to discover things on your own if it's already decoded, and asking for people to step in and share, and then you just do it on your own anyway? Why bother asking...
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 21:31:56
2 pages back. You're saying that you don't want to discover things on your own if it's already decoded, and asking for people to step in and share, and then you just do it on your own anyway? Why bother asking...

When did I say that?

I asked for help in my very first post, and I accepted help, and integrated values NFITC1 told me about. But I also said I would decode what I have to.

I will discover things on my own if I have to, but I'd rather not do work, that's already been done.

As for why I would go ahead and do it on my own, that's because I'm working on a project, I want to accomplish my goals, not sit around and wait for answers that might come.

Your answer was wrong, maybe shift left 2 equals 4, but why tell me answers in a format the game doesn't use? The game explicitly says eax * 4, not << 2... That's why I didn't use your info, it didn't match up with anything I was seeing. (And since we're bringing up 2 pages ago, you KNEW I had trouble understanding bit shifts, so why intentionally change a simple multiplication formula to use a bit shift?)

So try being less fancy, and being more correct, and someone might trust\use your data.

---

How hard is this.

Formula:
OPCODEBASE + (OPCODE * 4) = OPCODE LOCATION

Example:
0x009055A0 + (0x45 * 4) = 0x009056B4

Using fancy formulas doesn't make you look smarter, and it only serves to confuse people.

I understood the bit shift with AddItems, because the game uses that formula, I could see it, and knew what you were talking about. (ie, It didn't require me to go out and learn binary to decode your answer. Decoding the game is enough work, I don't need\want to decode your answers as well, so I ignore anything you say that doesn't match up with the actual code.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-05-02 22:09:29
Ok, so from the top:
When did I say that?
Here (http://forums.qhimm.com/index.php?topic=11703.msg163548#msg163548).

I asked for help in my very first post, and I accepted help, and integrated values NFITC1 told me about. But I also said I would decode what I have to.

I will discover things on my own if I have to, but I'd rather not do work, that's already been done.

As for why I would go ahead and do it on my own, that's because I'm working on a project, I want to accomplish my goals, not sit around and wait for answers that might come.
Nothing wrong with doing things on your own. That's for sure.

Your answer was wrong (...)
No it wasn't.

(...) maybe shift right 2 equals 4
... shift left, but yes, it does equal *4. Of course it does.

(...) but why tell me answers in a format the game doesn't use?
FF7 (for PC) was written in C++, and "<<" is a C/C++ operator explicitly convertable to SAL/SHL, also...

The game explicitly says eax * 4, not << 2...
No it doesn't. That's what your debugger/disassembler shows to you. The machine code actually says 0x9055A0 + EAX SHL 2. That's how the CPU will compute it.

That's why I didn't use your info, it didn't match up with anything I was seeing. (And since we're bringing up 2 pages ago, you KNEW I had trouble understanding bit shifts, so intentionally change a simple multiplication formula to use a bit shift?)
YES. That's exactly what I did - I intentionally used a bit shift operator. But if I didn't - you'd still get an answer with an array of function pointers.

So try being less fancy, and being more correct, and someone might trust your data.
I stand correct. And << is actually pretty important operator.

I'm not your enemy, just wanted to make sure that you understood the shifting thing. In the source code, it looked something like this:
Code: [Select]
...
fieldOpcodesPointer[scriptOpcode](args)
...
Still, no *4 in here - that's because compiler is smart enough to know that a function pointer in a 32bit app is 32bit long, so the whole array has a 4-byte alignment. Multiplications are actually pretty slow - in oppose to bit-shifts. That's also a reason why you'd see some unreferenced 1-byte field between other, larger structs  - the alignment is important and the game speeds up when the addresses are 4-byte divisable and the CPU can do just "address + eax << 2".

//---

I understood the bit shift with AddItems, because the game uses that formula, I could see it, and knew what you were talking about. (ie, It didn't require me to go out and learn binary to decode your answer. Decoding the game is enough work, I don't need\want to decode your answers as well, so I ignore anything you say that doesn't match up with the actual code.)
That's why I hate .NET/Java. It spoils people.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 22:14:46
That's what your debugger showed you.

It looks like this in my debugger..

Call Near DWORD PTR [EAX*4+9055A0]

Your debugger sucks, it's a structure, this is how structures are used in ASM.

--

I'm not spoiled, bit shifts are ASM math optimizations, even most C++ users never use them directly, it has nothing to do with C#.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-05-02 22:23:10
That's what your debugger showed you.

It looks like this in my debugger..

Call Near DWORD PTR [EAX*4+9055A0]

Your debugger sucks, it's a structure, this is how structures are used in ASM.
You don't pay attention - I was talking about machine code - debugger is just nice and shows it as *4 (mine does too). And it's not a structure. At it's best you could call it an array.

//---

PS: It's not an array, it's a structure, learn the difference. It's C code, not C++, the port was done in C++, not this, it's the original C code. (Only the graphics, etc, are using C++, ie port specific code.)
Didn't pay attention one more time - I actually said "FF7 (for PC)". Doesn't matter anyway, bit-shifts are not C++ - specific.

And as for the scruct thing - prove it. Write a C listing (a simple one) that would compile into such code - then we'll talk.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 22:27:33
You don't pay attention - I was talking about machine code - debugger is just nice and shows it as *4 (mine does too). And it's not a structure. At it's best you could call it an array.

It's a structure.

At any rate, IDA and the debugger show it as eax*4, so why change the formula?

Seriously, just write the formulas to match what I'm looking at, or, I'm going to assume you are wrong. It's pretty simple. We're not machines, we're people, use people code, alright.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-05-02 22:31:51
Right. Sorry for that.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-02 22:35:13
Right. Sorry for that.

I highly doubt it.

And, as far as I know the CPU just executes the code, the compiler makes all the optimizations, not the CPU. So it doesn't look like that, ever, except in your little delusional mind. If it looked like that anywhere, it would show up in IDA\Debugger, it doesn't.

IDA doesn't do that elsewhere, there are plenty of places where the code uses bit shifting, but you're right, just for this one function, it decided to change the code to be easier to read.  ::)  -- (And how do you think IDA get's the code, it executes it, and reads what happened on the stack\registers, that's what it saw occur, so that's how the machine code really looks.)

I don't appreciate being confronted over bullsh*t, especially when it was your own mistake that caused the issue to begin with. Had you explained yourself clearly, in a straightforward manner, I would have used your info, you didn't, so I didn't, end of f*cking story.

---

Even if it does that at some low level, I've mentioned that bit shifting isn't something I understand well. What I asked for was accurate info, not math lessons. I'll figure that out on my own time, as it becomes necessary. So your excuse for doing so, ie, helping me out, is BS.

Regardless, everyone else managed to give me info that lined up with the debugger\disassembler, you didn't. That's why I used their info, and not yours.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: dziugo on 2011-05-03 07:27:30
You seem to have removed some content, so no quotes for those parts.
I highly doubt it.
Oh, but I do! I'm sorry for thinking that you can actually be smarter than a debugger. The "fancy operator" I used is being taught in one of the firsts classes of C (in case of bit logic and/or operator precedence, whichever comes first). From now on, I'll be sure to double-check if the provided data is in way you'd understand.

And about .NET (C# in your case) not having anything to do with spoiling people (can't quote you now) - it does. Microsoft had made a very successful attempt to provide people with a programming language where everything* can be done with a few lines of code. It spoils people in a way that they EXPECT that everything they need is out there, somewhere (in a C# and VB.NET version).

*everything - everything that they've thought you'd need

And, as far as I know the CPU just executes the code, the compiler makes all the optimizations, not the CPU. So it doesn't look like that, ever, except in your little delusional mind.
Right about the first sentence. Let's see what we've established: CPU doesn't do optimization, just executes the code.

If it looked like that anywhere, it would show up in IDA\Debugger, it doesn't.

IDA doesn't do that elsewhere, there are plenty of places where the code uses bit shifting, but you're right, just for this one function, it decided to change the code to be easier to read.  ::)
Second one (after removing the sarcasm): IDA will not make any attempt at providing user with more-friendly data.

Now let's produce some code with that famous opcode part. To the right you'd see a disassembled line, and to the left - actual machine code.
Code: [Select]
FF140D A0559000        CALL DWORD PTR DS:[ECX+9055A0]
FF144D A0559000        CALL DWORD PTR DS:[ECX*2+9055A0]
FF148D A0559000        CALL DWORD PTR DS:[ECX*4+9055A0]
FF14CD A0559000        CALL DWORD PTR DS:[ECX*8+9055A0]
The only byte that changes is the 3rd one (0x0D -> 0x4D -> 0x8D -> 0xCD). In binary:
Quote
00001101
01001101
10001101
11001101
You'd expect it to be 1, 2, 4 & 8, but that's actually 0, 1, 2 (SHL 2 equals *4 ) and 3 (SHL 3 equals *8 ), so it actually does a bit-shift. So, "just for this one function, it decided to change the code to be easier to read"? No way! (disclaimer: not saying that's bad).

(And how do you think IDA get's the code, it executes it, and reads what happened on the stack\registers, that's what it saw occur, so that's how the machine code really looks.)
LoL ;) No, Mister Ignorant :) It interprets it, at it's best, parse maybe, but sure as hell does not execute it. That would be a big security hole if it just "oh, lets run it and see what it does, yay!". Machine code is the hex codes you see next to each disassembled line ;)

I don't appreciate being confronted over bullsh*t, especially when it was your own mistake that caused the issue to begin with. Had you explained yourself clearly, in a straightforward manner, I would have used your info, you didn't, so I didn't, end of f*cking story.

---

Even if it does that at some low level, I've mentioned that bit shifting isn't something I understand well. What I asked for was accurate info, not math lessons. I'll figure that out on my own time, as it becomes necessary. So your excuse for doing so, ie, helping me out, is BS.

Regardless, everyone else managed to give me info that lined up with the debugger\disassembler, you didn't. That's why I used their info, and not yours.
In short:
The only mistake I did was assuming that you actually did understand the "thing" (no, it wasn't me who started explaning it to you) - I was giving you info in a manner I thought that you'd surely understand now. I stand corrected.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-03 10:26:48
I'll be sure to double-check if the provided data is in way you'd understand.

Why not just post it in binary next time, that'll be helpful.

0001011010101000101001000010001001011001010001001010100101010010

There ya go, good luck decoding.. Don't be an ass, just post the sh*t in plain English, unless it actually requires you to use some formula, like AddItems did, etc,. That way, someone can look, and go, oh, that's what he's talking about, I see it.

(Btw, I've learned how to use the shift operator since then, these are past tense answers, as in, why I ignored the post days ago.)

And about .NET (C# in your case) not having anything to do with spoiling people (can't quote you now) - it does.

You can't learn C++ without the internet, a book, or schooling, it's such a nonsensical language, that you will be constantly referencing something.

With C#, the intellisense alone is generally enough to figure it out(if not, you can easily look at the source via reflection\metadata\etc.), I rarely need to reference anything with it. In C++, you have to use a reference just to do simple data conversions. (Do I really need to Google for three hours to figure out something C# does with ease, is that what makes a "good" language. If you say so. Without the internet, you couldn't do sh*t in C\C++, you'd get stuck with some obscure error, and struggle for months trying to figure it out. Argue if you want, but you know it's true.)

There is a reason C# is taking over as the industry standard, it's because it's better. C# rules for the same reason remote controls do, because it's easier than walking across the room, and changing channels manually. Get it?

Still not clear, here is how I see C++..

http://en.wikipedia.org/wiki/Rube_Goldberg_machine

No, Mister Ignorant :) It interprets it, at it's best, parse maybe, but sure as hell does not execute it. That would be a big security hole if it just "oh, lets run it and see what it does, yay!". Machine code is the hex codes you see next to each disassembled line ;)

Yes, in a world without virtualization, that might be true, however, that's not our world. (You can easily execute any code safely if you know what you are doing.)

No, hex isn't machine code, binary is, hex is for human benefit, like ASM, and C++, etc,.

http://en.wikipedia.org/wiki/Binary_numeral_system
http://en.wikipedia.org/wiki/Hexadecimal

In short:
The only mistake I did was assuming that you actually did understand the "thing" (no, it wasn't me who started explaning it to you) - I was giving you info in a manner I thought that you'd surely understand now. I stand corrected.

The mistake you made, was coming into my topic, and acting like an a*shole, who cares if I ignored your post, and figured it out myself? F*ck off. Seriously.

Btw, you just volunteered yourself to finish this project. Good luck. :)

@All, direct all inquiries to dziugo, he is the COMPUTER MASTER, and will have this project done in no time. I'm sure he'll have no trouble doing anything I've done, since he's so much smarter than me. (Sure, I know, he's had the last six years to do so, and hasn't, but, he was just biding his time, the sleeper has awakened, you'll see.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-05-03 18:41:43
Quote
Don't be an ass, just post the sh*t in plain English,

Can I second this.  No offence but there seem to be a lot of people around who like to look smart by being complicated.  So many times it happens that I ask for a simple explanation and get a ton of jumble back. It is very irritating.  When I ask how I can make a section of code simpler, I do not expect a 100 page essay.  Just give me the 1 line of code.

 8)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-03 21:45:22
Agreed. :)

---

Furthermore.

Some of you, are a*sholes.

For example, I release an "Alpha" in less than a week after the project was born, which is very quick, and then, I get this ->  >:( Because, said alpha wasn't a perfect working release.

You do realize, that was extremely quick for what I did, and not many people could do the same. More importantly, software companies, have many test PC's, with different hardware, software, and operating systems installed. They have bug testers, quality assurance, etc,.

Despite all those measures, even paid software has bugs. (After months\years in development.)

Now, you, are giving me angry faces, because a one week old alpha release, which hasn't had the benefit of being tested on various machines, or going through rigorous bug testing, and quality assurance testing, isn't working properly? Does anyone see the problem here?

I try to come up with a solution, and post several debug builds, but, no, you're done, and not helping me anymore, I wasted your time apparently, because an alpha wasn't f*cking immaculate. Piss off. You couldn't do any better, and expecting it from me, for FREE no less, I should kill you.

So, that really pissed me off.

Here read this..

http://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha

Now, I got this jerkoff showing up, why did you figure that out on your own, I told you how to do it?

Because, no you didn't, isn't it clear, your information made no sense, so I figured it out myself. (I mean, why would someone figure something out themselves, if you had told them in a clear manner, it's not even possible. If you told me, and I understood it, then I couldn't possibly figure it out myself, because you already told me,. Nevermind, you're too stupid to get it.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: sl1982 on 2011-05-03 22:06:57
A word of advice Wutai, ignore those which piss you off on the internet. There will always be people that expect something for nothing, and even more still that will criticize you work yet will not or cannot do work of their own, and even more still that will keep asking you when the next release is. My point being, if you are not able to shrug these things off then you will blow a gasket (which you look very close to doing already.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-05-03 22:14:13
Yup... I've also learned that you just have to ignore it.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Armorvil on 2011-05-03 22:30:31
I don't know if some parts of your latest reply were directed at me specifically Wutai Clan, but let me tell you why I "left".

1) because I noticed that other people started playtesting your mod, too. I thought you were in good hands -- guess you weren't.

2) I really don't have the technical knowledge to help you.

3) I have a mod of my own that's taking almost all of my free time, and I noticed that with the way your program works, the two wouldn't be compatible.

So yeah. Sorry for "leaving" like that, but I'm focusing on my mod right now. The most important thing when working on tools/mods, is to make them for your own pleasure first. Also, another reason why I didn't create a topic about my mod, is because I'm aware the attitude of other people could bring me down (sometimes to the point of wanting to drop it all). And I don't want that.

When I finally make a thread about my mod, I won't care much if it's being shot down or if people don't care about it, since at least it will be fully playable. I'm really making my mod for my own needs/pleasure first, and I suggest you do the same (if the two are comparable).
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-04 00:26:42
See below..
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-06 12:08:20
Well, I've decided to keep working on the project.

I can't promise it will work for everyone, and since no one would run the debug builds, I can't do much about that. I'll make a new thread when it's ready for release. (Could be days\weeks\months, hard to say.)
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Arikadoo on 2011-05-07 18:04:38
I have tried testing it but whenever I run them game this error pops up "You have an error in your config file, some options may  not have been parsed. (no such option 'load_library'), im using the latest Aali's Custom graphics driver.

Would you mind telling me how could I do this with Cheat Engine, I already have EXP and Ap adresses, but I don't know how to make my Cheat Engine to double the EXP or AP.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-05-07 18:06:24
Post your ff7_opengl.cfg
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Arikadoo on 2011-05-07 20:46:47
Never mind... I downloaded the latest Aali's graphic driver and now works, Ap x 5 is working nice, Haven't tried Exp and Gil multipliers yet. Thanks
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Vgr on 2011-05-07 21:17:20
Well, I tried it and...

A message pops up at the startup saying "DLL Test Loaded" and a blank command box appears. But nothing else.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-11 02:52:27
Quote
Here, this package contains three debug versions, try them all, and let me know which if any works. (Run in windowed mode for the test.)

http://www.mediafire.com/?d3apd6xwex9yc7g

Basically, I've disabled several features in each version, to try to narrow down where it's going wrong.

Here are the test descriptions.

DLL Load Test:

This test does nothing but show a messagebox, every other feature is disabled, if this doesn't work, it's a runtime\compile issue.

Console Only Test:

This test will just load the debug console, this will tell me if that's somehow causing issues. (Though it was disabled by default.)

No Logging Test:

This test will load everything, but disables all logging features, to determine whether the logging method is an issue.

----------

Here is a partial list of items for the wiki.

Code: [Select]
Slot: 0
ItemID: Potion [0] // 0 = Potion
Count: 99

Slot: 1
ItemID: Hi-Potion [1] // 1 = Hi-Potion
Count: 63

Slot: 2
ItemID: X-Potion [2]
Count: 2

Slot: 3
ItemID: Ether [3]
Count: 20

Slot: 4
ItemID: Turbo Ether [4]
Count: 6

Slot: 5
ItemID: Elixir [5]
Count: 9

Slot: 6
ItemID: Megalixir [6]
Count: 3

Slot: 7
ItemID: Phoenix Down [7]
Count: 50

Slot: 8
ItemID: Antidote [8]
Count: 15

Slot: 9
ItemID: Soft [9]
Count: 97

Slot: 10
ItemID: Maiden's Kiss [10]
Count: 91

Slot: 11
ItemID: Cornucopia [11]
Count: 98

Slot: 12
ItemID: Echo Screen [12]
Count: 1

Slot: 13
ItemID: Hyper [13]
Count: 92

Slot: 14
ItemID: Tranquilizer [14]
Count: 92

Slot: 15
ItemID: Remedy [15]
Count: 32

Slot: 16
ItemID: Smoke Bomb [16]
Count: 1

Slot: 17
ItemID: Grenade [20]
Count: 12

Slot: 18
ItemID: Spider Web [25]
Count: 1

Slot: 19
ItemID: Fire Fang [30]
Count: 1

Slot: 20
ItemID: Deadly Waste [38]
Count: 2

Slot: 21
ItemID: M-Tentacles [39]
Count: 1

Slot: 22
ItemID: Vampire Fang [41]
Count: 6

Slot: 23
ItemID: Ghost Hand [42]
Count: 2

Slot: 24
ItemID: Vagyrisk Claw [43]
Count: 1

Slot: 25
ItemID: Eye Drops [52]
Count: 13

Slot: 26
ItemID: Molotov [53]
Count: 5

Slot: 27
ItemID: S-mine [54]
Count: 1

Slot: 28
ItemID: Graviball [56]
Count: 1

Slot: 29
ItemID: T/S Bomb [57]
Count: 1

Slot: 30
ItemID: Dragon Fang [60]
Count: 1

Slot: 31
ItemID: Mimett Greens [64]
Count: 5

Slot: 32
ItemID: Curiel Greens [65]
Count: 5

Slot: 33
ItemID: Pahsana Greens [66]
Count: 4

Slot: 34
ItemID: Tantal Greens [67]
Count: 4

Slot: 35
ItemID: Krakka Greens [68]
Count: 1

Slot: 36
ItemID: Gysahl Greens [69]
Count: 1

Slot: 37
ItemID: Tent [70]
Count: 15

Slot: 38
ItemID: Power Source [71]
Count: 4

Slot: 39
ItemID: Guard Source [72]
Count: 3

Slot: 40
ItemID: Magic Source [73]
Count: 2

Slot: 41
ItemID: Mind Source [74]
Count: 3

Slot: 42
ItemID: Speed Source [75]
Count: 2

Slot: 43
ItemID: Luck Source [76]
Count: 1

Slot: 44
ItemID: Lasan Nut [81]
Count: 4

Slot: 45
ItemID: Saraha Nut [82]
Count: 3

Slot: 46
ItemID: Luchile Nut [83]
Count: 2

Slot: 47
ItemID: Battery [85]
Count: 3

Slot: 48
ItemID: Cosmo Memory [91]
Count: 1

Slot: 49
ItemID: 1/35 Soldier [95]
Count: 2

Slot: 50
ItemID: Buster Sword [128]
Count: 1

Slot: 51
ItemID: Mythril Saber [129]
Count: 2

Slot: 52
ItemID: Hardedge [130]
Count: 2

Slot: 53
ItemID: Butterfly Edge [131]
Count: 2

Slot: 54
ItemID: Enhance Sword [132]
Count: 1

Slot: 55
ItemID: Organics [133]
Count: 1

Slot: 56
ItemID: Force Stealer [135]
Count: 1

Slot: 57
ItemID: Rune Blade [136]
Count: 1

Slot: 58
ItemID: Nail Bat [138]
Count: 1

Slot: 59
ItemID: Leather Glove [144]
Count: 1

Slot: 60
ItemID: Metal Knuckle [145]
Count: 2

Slot: 61
ItemID: Mythril Claw [146]
Count: 2

Slot: 62
ItemID: Grand Glove [147]
Count: 1

Slot: 63
ItemID: Tiger Fang [148]
Count: 1

Slot: 64
ItemID: Dragon Claw [150]
Count: 1

Slot: 65
ItemID: Motor Drive [152]
Count: 1

Slot: 66
ItemID: Kaiser Knuckle [154]
Count: 1

Slot: 67
ItemID: Work Glove [155]
Count: 1

Slot: 68
ItemID: Powersoul [156]
Count: 1

Slot: 69
ItemID: Gatling Gun [160]
Count: 1

Slot: 70
ItemID: Cannon Ball [161]
Count: 2

Slot: 71
ItemID: Atomic Scissors [162]
Count: 2

Slot: 72
ItemID: Heavy Vulcan [163]
Count: 2

Slot: 73
ItemID: Microlaser [164]
Count: 1

Slot: 74
ItemID: W Machine Gun [166]
Count: 1

Slot: 75
ItemID: Drill Arm [168]
Count: 1

Slot: 76
ItemID: Rocket Punch [169]
Count: 1

Slot: 77
ItemID: Enemy Launcher [171]
Count: 1

Slot: 78
ItemID: Mythril Clip [172]
Count: 2

Slot: 79
ItemID: Diamond Pin [176]
Count: 1

Slot: 80
ItemID: Adaman Clip [177]
Count: 1

Slot: 81
ItemID: Seraph Comb [180]
Count: 1

Slot: 82
ItemID: Guard Stick [186]
Count: 1

Slot: 83
ItemID: Mythril Rod [190]
Count: 1

Slot: 84
ItemID: Full Metal Staff [191]
Count: 3

Slot: 85
ItemID: Striking Staff [192]
Count: 2

Slot: 86
ItemID: Wizard Staff [193]
Count: 1

Slot: 87
ItemID: Wizer Staff [196]
Count: 1

Slot: 88
ItemID: Fairy Tale [197]
Count: 1

Slot: 89
ItemID: Princess Guard [198]
Count: 2

Slot: 90
ItemID: Trident [200]
Count: 1

Slot: 91
ItemID: Javelin [203]
Count: 1

Slot: 92
ItemID: 4-point Shuriken [207]
Count: 1

Slot: 93
ItemID: Boomerang [215]
Count: 1

Slot: 94
ItemID: Hawkeye [216]
Count: 2

Slot: 95
ItemID: Wind Slash [219]
Count: 1

Slot: 96
ItemID: Yellow M-phone [221]
Count: 1

Slot: 97
ItemID: White M-phone [229]
Count: 1

Slot: 98
ItemID: Black M-phone [234]
Count: 1

Slot: 99
ItemID: Trumpet Shell [235]
Count: 1

Slot: 100
ItemID: Quicksilver [237]
Count: 1

Slot: 101
ItemID: Shotgun [242]
Count: 1

Slot: 102
ItemID: Lariat [243]
Count: 2

Slot: 103
ItemID: Silver Rifle [245]
Count: 1

Slot: 104
ItemID: Sniper CR [250]
Count: 1

Slot: 105
ItemID: Bronze Bangle [251]
Count: 3

Slot: 106
ItemID: UNKNOWN:ID->256 [256]
Count: 4

Slot: 107
ItemID: UNKNOWN:ID->257 [257]
Count: 5

Slot: 108
ItemID: UNKNOWN:ID->258 [258]
Count: 3

Slot: 109
ItemID: UNKNOWN:ID->259 [259]
Count: 9

Slot: 110
ItemID: UNKNOWN:ID->260 [260]
Count: 2

Slot: 111
ItemID: UNKNOWN:ID->261 [261]
Count: 6

Slot: 112
ItemID: UNKNOWN:ID->263 [263]
Count: 1

Slot: 113
ItemID: UNKNOWN:ID->265 [265]
Count: 1

Slot: 114
ItemID: UNKNOWN:ID->266 [266]
Count: 1

Slot: 115
ItemID: UNKNOWN:ID->267 [267]
Count: 1

Slot: 116
ItemID: UNKNOWN:ID->268 [268]
Count: 1

Slot: 117
ItemID: UNKNOWN:ID->270 [270]
Count: 1

Slot: 118
ItemID: UNKNOWN:ID->277 [277]
Count: 5

Slot: 119
ItemID: UNKNOWN:ID->278 [278]
Count: 1

Slot: 120
ItemID: UNKNOWN:ID->279 [279]
Count: 1

Slot: 121
ItemID: UNKNOWN:ID->281 [281]
Count: 1

Slot: 122
ItemID: UNKNOWN:ID->288 [288]
Count: 3

Slot: 123
ItemID: UNKNOWN:ID->289 [289]
Count: 5

Slot: 124
ItemID: UNKNOWN:ID->290 [290]
Count: 1

Slot: 125
ItemID: UNKNOWN:ID->291 [291]
Count: 6

Slot: 126
ItemID: UNKNOWN:ID->295 [295]
Count: 1

Slot: 127
ItemID: UNKNOWN:ID->298 [298]
Count: 6

Slot: 128
ItemID: UNKNOWN:ID->299 [299]
Count: 1

Slot: 129
ItemID: UNKNOWN:ID->300 [300]
Count: 1

Slot: 130
ItemID: UNKNOWN:ID->301 [301]
Count: 1

Slot: 131
ItemID: UNKNOWN:ID->302 [302]
Count: 1

Slot: 132
ItemID: UNKNOWN:ID->303 [303]
Count: 1

Slot: 133
ItemID: UNKNOWN:ID->306 [306]
Count: 4

Slot: 134
ItemID: UNKNOWN:ID->307 [307]
Count: 2

Slot: 135
ItemID: UNKNOWN:ID->312 [312]
Count: 1

Slot: 136
ItemID: UNKNOWN:ID->316 [316]
Count: 1

Slot: 137
ItemID: UNKNOWN:ID->317 [317]
Count: 2

Slot: 138
ItemID: UNKNOWN:ID->319 [319]
Count: 1

Slot: 139
ItemID: Empty Slot [511]
Count: 127

---

Well, I got some text rendering set up, I ended up just using Aali's function for printing to the screen. He shared the offset for the function a few days back, but I wasn't sure what module that offset was relative to, but I finally found it. (Thanks Aali.)

So that's good, I can print text, and draw primitive shapes now. :)

Still a ways off from having an in-game console, etc,.

I've also been working on some ideas, I think I'm going to add event triggers to a number of functions, that way I can have things fire when certain things occur. (Damage taken, shop buy\sell, staying at an inn..)

You could, for example, add a random chance for gil to be stolen while staying at an inn, or, have a special item give shop discounts, etc,.

If I can add LUA scripts, I could try to expose these handlers so you can add your own functions by writing some custom scripts, etc,.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-05-15 10:13:36
I think I'm done.

This lack of support, and cooperation, is annoying. :x

It's your business if you don't want to help, but honestly, if you can't spend 10 minutes scanning memory, and reporting an address or two, then you honestly don't deserve this project. (It's easy, there are thousands of tutorials, no excuse will work for me here, anyone can do this. You type a number, hit search, and wait for the results.)

It's not like you had to dedicate your life to this, you could have, every now and again, helped out. With 3,000+ views on this thread, had all of them contributed even a LITTLE, a lot more would be done, and I wouldn't be so annoyed.

Despite what you may think, this is not a one man job, don't believe me, try it yourself, the original game code was probably over 200,000+ lines of code(give or take.), and decoding, is WAY slower than coding. It took a whole team years to code the engine, so what do you expect when you leave one person to try to do a harder job by themselves, and then give them fucking attitude over stupid shit, etc,.

Plus, Aali's driver is interfering, and he still isn't answering PM's. Seriously, it's near impossible to track his changes, I've found no easy way to do it. (And I'm pretty good at this stuff now.) That leaves the hard way, which is very, very, very time consuming. (ie, at runtime, and making notes manually about what's happening, which is very hard since you lose all the context, ie, you can't see an OpenGL call, as an OpenGL call in memory with a debugger, it's just ASM like everything else. Trust me, I've got the best tools available, and it's still not easy..)

I'll still hack the game for my own purposes, and in my own time, but as for this project, well you killed it. Feel free to try yourselves, all the info is here, figure it out, and don't expect a lot of support, apparently, you're on your own.

PS: I don't want to hear any BS, ie, it's YOUR project, why should we help. No, it's a project I was doing for THIS community. But, apparently this community, consist of about two helpful people, and a bunch of lazy grubby motherfuckers who just want shit handed to them on a silver platter. (3,000+ views, and two helpful people, I think the numbers speak for themselves.)

Btw, good luck finding another hacker willing to do this.

Aali's is your best bet, and I don't see em' volunteering to help, much less do the job in it's entirety. dziugo, he's trying to decompile the game, which, honestly isn't much help, you still have to do all the decoding, it's still scrambled C++, instead of scrambled ASM, so, don't expect him to do anything soon.

Peace
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: sl1982 on 2011-05-18 22:17:54
Sorry to see this project die, from a technical standpoint it seemed pretty interesting. Unfortunately I do not have much time or motivation to whip out ff7 and mess around with it. As for everyone else yes most of them just want a finished tool to use.

Anyways best of luck.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: DLPB_ on 2011-05-19 15:36:58
You should not care about people :)  Do it for those of us who do care and want to see something and are not just grabbers.

Remember though that 3000 views does not equal 3000 people, and of those not many will have the skills required to help you.  I have had tons of people who wanted to help translate and don't know Japanese and others who want to construct menu and can't.

It might seem simple to you but most people can't do it.

Dan
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: nfitc1 on 2011-05-19 16:07:11
I'd have helped, but for one reason or another on each of the computers I have access to, FFVII absolutely refuses to run. My own decoding has slowed to a crawl too since I can't get IDA to even execute whatever code I give it.

I'm sorry to have seen this project die. I suppose I can only hope you (or someone else) will revisit this.
Title: Re: [WIP] Custom Game Settings (FF7)
Post by: Wutai Clan on 2011-08-17 12:06:18
There still seems to be a misunderstanding here about what the real issue is. (Which is partially my fault, because I have lot's of issue with the situation.)

The main issue is simple:

I asked for testers to help solve an issue, specifically, those who reported the issue, needed to get their asses back here and run the test to help solve it. Point blank. (This was a project halting issue.)

Now, I'm over here expecting to put YEARS of my free time into this, make NO money, deal with hundreds of ppl, doing technical support, etc,. Just tons of work\effort on my part.

So, when I had to ask more than twice(and I did) for the ppl who reported the issue to help me out by running some simple test, there is a major issue.

Personal grievances aside, the project simply halted due to technical issues, I can't reproduce the issue, several users did, which means, if several thousand ppl use this, large quantities of them will get the issue.

(There is also the issue with Aali's driver, he needs to release his source, or expose all his methods via a plugin API.)

The rest is just annoyance with this "job" altogether, I don't know, if you don't get it, you probably haven't done it long enough yet(or at all).. It's not worth discussing any further, you either know, don't, someday will, or never will. :)