From hacking one item to hacking a sequential list with loop code

TomSwitch

Well-Known Member
OP
Member
Joined
Jan 10, 2019
Messages
2,252
Trophies
1
Age
42
XP
6,937
Country
United States
Often inventory items are coded as a list. First step is to find slot one of the list.
Next look for the link in the pointer chain that is incremented.

Here is an example.
This code hack the quantity of item in slot one.
After finding this code with pointer searcher look around the pointer chain to see if there is a list somewhere.
[Inventory slot1 Qty 144]
580F0000 05E9A528
580F1000 00000030
580F1000 000001F0
580F1000 000000B8
580F1000 00000020 <= list found here, next slot is +0x8
580F1000 00000030
780F0000 00000020
640F0000 00000000 00000090

[Inventory all slots Qty 144]
580F0000 05E9A528
580F1000 00000030
580F1000 000001F0
580F1000 000000B8
30000000 00000014 <= loop for 20 times, this is size of your inventory list
9893F000 <= R3 = R15
58031000 00000020 <= Continue with R3
58031000 00000030
78030000 00000020
64030000 00000000 00000090
780F0000 00000008 <= R15 = R15+0x8
31000000

If the list is at the very end of the pointer chain. This code will also work but it can be simplified. There is no need to introduce R3.
30000000 00000014 <= loop for 20 times, this is size of your inventory list
640F0000 00000000 00000090 <= can use R15 as it is the last in the chain
780F0000 00000008 <= R15 = R15+0x8
31000000
 
Last edited by TomSwitch,
  • Like
Reactions: crazy_p

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
35,126
Trophies
2
Website
trastindustries.com
XP
24,663
Country
United Kingdom
I would note the two classic styles of inventory here as you can often do both with slide codes as they would classically be known.

1) Item location
2) Item Identifier

1) For the stereotypical fantasy RPG is then byte 1 of the table is amount of starting daggers you have, byte 2 is first town small sword, byte 3 is large sword, byte 4 is first dungeon upgrade, 5 second town...

2) Is each item has an ID number associated with it and your inventory is then a list of IDs and items.


Should be easy enough to see how fiddling with ID numbers and seeing what is in locations can get you the end game, crazy speedrun bonus or even things cut from the game as opposed to the classic "buy one, check for changed values, buy one, checked for changed values... cheat search method, which might not even be possible with this if the thing is the result of a massive hours long sidequest you only get one for. Indeed I would probably place money on almost any inventory cheat that covers the fun end game stuff being made in this way.
There are some things that allow you to guess which is more likely to be in the game -- limited inventory selection, save size (having to have a list of each item in the table for 1) does limit weapon variation as you have to do the whole table), and if going with the topic name of sequential list then ability to manually reorder items is potentially notable in this. It is possible to have both in play in a single game -- usually if there is a separate panel for key items then probably going to be that regardless of what the other is.
How this interplays with equipped items is also possibly of interest as you could force your mage to have a nice super sword in some cases if you wanted to roll that way, though maybe a different topic for that one.

Modern stuff might use more custom from the ground up -- if you have 50 possible effects that means 50 slots, far easier to say +5 fire damage +2 dark damage in some kind of XML or whatever setup you process at game time than have to have your 10000 weapon and armours make saves megabytes in size before you even went anywhere.
 
  • Like
Reactions: crazy_p

Group statistics

Members:
76
Threads:
33
Messages:
107