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

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #25 on: 2011-04-18 23:47:15 »
MSN would be better right? Mine is [email protected]

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #26 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.)

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #27 on: 2011-04-19 00:13:41 »
No. BTW, where is GameSettings.ini ??

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #28 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.
« Last Edit: 2011-04-19 00:30:09 by Wutai Clan »

Kranmer

  • *
  • Posts: 766
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #29 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.
« Last Edit: 2011-04-19 08:08:41 by kranmer »

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #30 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.)
« Last Edit: 2011-04-19 12:54:00 by Wutai Clan »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #31 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.

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #32 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.
« Last Edit: 2011-04-19 16:13:55 by Wutai Clan »

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #33 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 ! =)

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #34 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.)

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #35 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.
« Last Edit: 2011-04-20 16:43:54 by Wutai Clan »

Kranmer

  • *
  • Posts: 766
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #36 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)

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #37 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,.
« Last Edit: 2011-04-20 18:59:48 by Wutai Clan »

Kranmer

  • *
  • Posts: 766
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #38 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.
« Last Edit: 2011-04-20 21:44:58 by kranmer »

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #39 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.

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #40 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. 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.
« Last Edit: 2011-04-21 18:58:59 by Armorvil »

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #41 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. 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.

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #42 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

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #43 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.

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #44 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.
« Last Edit: 2011-04-22 17:05:18 by Wutai Clan »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [WIP] Custom Game Settings (FF7)
« Reply #45 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.

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #46 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. ???
« Last Edit: 2011-04-24 01:25:30 by Wutai Clan »

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: [WIP] Custom Game Settings (FF7)
« Reply #47 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

Wutai Clan

  • *
  • Posts: 115
    • View Profile
Re: [WIP] Custom Game Settings (FF7)
« Reply #48 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]
« Last Edit: 2011-04-24 12:47:22 by Wutai Clan »

dziugo

  • *
  • Posts: 1470
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: [WIP] Custom Game Settings (FF7)
« Reply #49 on: 2011-04-24 13:01:22 »
65535 (or 0xFFFF) is a slot-empty indicator, so you've most likely mixed the indexes.