libretro / libretro/RetroArch

[Feature Request] Timed-Application of Cheats After ROM Load

Open
#17,963 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello!

When a ROM is loaded and RetroArch is configured to apply cheats on load, the cheats might be applied too soon such that the memory layout might have changed in the meanwhile which, in turn, leads to memory corruption due to an implicit time-of-check-to-time-of-use race condition. During testing, it was determined that this issue occurs for complex emulators like FBNeo that have their own specific boot-up such that tampering with the memory before the actual game has loaded does not make much sense - if you will, you can compare this to overriding a memory location on some emulator with loadable media like PlayStation such that applying any "hack" would not even make sense if the disc would not be inside and the game not loaded yet.

Short of implementing conditionals (ie: apply the memory overwrite when some other memory location contains a certain value) which would be an ideal solution, an easier variant could be implemented such that RetroArch would wait a user-provided number of time units before applying the cheats. It would be even nicer if the delay could be applied per cheat instead of applying them all with a delay. For the most part, this is because the memory layout can already be determined and the only major change takes place only during loading.

Right now, the RetroArch option to apply a cheat once the game loads, applies the cheat right when the ROM is loaded, which leads to various errors even though the cheat works fine if it is loaded manually (and even) right after the loading screen.

Thank you!

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

No files, tests, or entry points are named. Start by locating the implementation of RetroArch's apply-cheats-on-load option and compare its timing with manually loaded cheats and complex emulator boot-up; done means a user-configurable delay works reliably, with per-cheat timing if that scope is chosen.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.