libretro / libretro/RetroArch

[Cheats] Address Increase Each Iteration's behavior is weird

Open
#19,193 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

While this isn't a bug as it seems to be working as "intended" or as described by the description, the intended behavior seems weird. The Address Increase Each Iteration for cheats seems to behave by acting upon a multiple of the memory search size. I get the potential intent if you had a bunch of sequential 16-bit or 32-bit fields and wanted to iterate over 60 of them then saying 1 for address size and 60 iterations would allow that to work.

However, this functionality makes a certain case impossible. For example, this PSX Breath of Fire III cheat for max stats for the faeries in the faerie village:

50003c09 0000
301f2705 0005
50003c09 0000
801f2706 0505
50003c09 0000
301f2708 0005

What those codes are really doing is the faeries have 4 different stats each with a max value of 5. So with RetroArch you could convert that to a single 32-bit code with a hex value of 05050505, do 60 iterations for 60 faeries, and do an address increase of 9 to hop between each faerie's struct.

However, given how the Address Increase Each Iteration currently behaves, it would be impossible to have this be one code because if you are using a 32-bit cheat, you can't make the address increase cleanly 9 bytes. It would have to be a multiple of 4 bytes. In order to kind of protect users from themselves, you restrict some very meaningful functionality.

There are many cheats which could easily run into the same issue, such as if you were converting codes for max stats for different party members in an RPG, and hopping across different structs for each different party member didn't happen to align with the amount of bytes you needed to hop. For these cases, I think people would expect "Address Increase Each Iteration" to just be the value you put in, not multiplied by the memory search size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the cheat implementation for “Address Increase Each Iteration” and its handling of memory search size. Compare the current multiplied increment with the requested raw address increase, including the 32-bit PSX example using an increment of 9. Done means the intended semantics are defined and covered for unaligned increments without breaking existing cheat behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.