Skip to content

Add cheated flag to PagedStateManager and show in blue in TAStudio#4709

Draft
YoshiRulz wants to merge 1 commit intomasterfrom
flag-cheated-greenzone
Draft

Add cheated flag to PagedStateManager and show in blue in TAStudio#4709
YoshiRulz wants to merge 1 commit intomasterfrom
flag-cheated-greenzone

Conversation

@YoshiRulz
Copy link
Copy Markdown
Member

No description provided.

@SuuperW
Copy link
Copy Markdown
Contributor

SuuperW commented Apr 24, 2026

OK well Idk why I didn't think of using an event for this.

This implementation is not correct, though. It can incorrectly indicate cheat state in either direction:

  1. Emulate so that you have some clean states.
  2. Rewind to frame 0.
  3. Poke.
  4. Load a clean state.
  5. Emulate to make more states; they will be marked as cheated.

OR

  1. Make a branch with a cheated state.
  2. Edit an input, so that all states are clean.
  3. Load the branch.
  4. Emulate to make more states; they will be marked as clean.

EDIT: Also it looks like this won't be able to handle situations were an external tool loads a state using the IStatable emulator service, or Lua script loads a state with memorysavestate. (Actually I can test this real quick: using the GBA/SonicAdvance_CamHack.lua script does indeed result in incorrectly marking states as cheated.)

EDIT 2: I noticed your title says they will show as blue. Idk what went wrong, but I am not seeing any blue.
image

@YoshiRulz
Copy link
Copy Markdown
Member Author

The colour config handling must fill in zeroes for a missing value instead of pulling from the defaults. From a clean config it should work.

I'm not sure how to move forward on the correctness issues. A call to IStatable.LoadStateBinary wouldn't go via the frontend at all, right? So maybe this flag actually needs to be part of each core, like IInputPollable.IsLagFrame, in order to be persisted properly.

@SuuperW
Copy link
Copy Markdown
Contributor

SuuperW commented Apr 25, 2026

So maybe this flag actually needs to be part of each core, like IInputPollable.IsLagFrame, in order to be persisted properly.

This was my initial thought, which is why I did not think this feature could realistically be implemented.

But I had an idea that maybe can work: wrap the IStatable service in a new IStatable implementation that is controlled by the frontend and essentially adds a header to the core's states. The header can include a cheated flag and potentially user data too, addressing #3976. I do not know how much refactoring will be needed to ensure the raw, unwrapped core's IStatable is ever accessed by tools/API classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TAStudio must clear state cache after a hex edit / poke / freeze

2 participants