dolphin icon indicating copy to clipboard operation
dolphin copied to clipboard

CheatSearchWidget: New feature, writing a value to all selected addresses

Open SuperSamus opened this issue 6 months ago • 0 comments

Adds to the cheat manager a feature that allows writing a specific value to all selected addresses.

Useful when you know what the value you need to modify is, but don't know where it's located, and there are many of them. By writing to many addresses at once, you can bisect the address you are looking for.

image

As a bonus, Add to Watch adds all selected addresses, instead of just the right-clicked one.

Note for reviewers

The reason this PR is a draft isn't so much that the feature is incomplete, it's because of... the first commit.

Basically, CheatSearch.cpp, in order to be able to read values generically, overloaded TryReadValueFromEmulatedMemory with all possible types. "This is ugly" I thought, "I'm not going to do the same thing for the writes. It'd be much better if the Read and Write functions were generic in MMU.h in the first place."

So I did that. However, I have little experience with C++, and didn't know that templates may cause reference errors in the linker if not properly managed.

After realizing this, I moved some stuff from MMU.h to MMU.cpp and manually instantiated the functions that were very big (ReadFromHardware and WriteToHardware). That may be controversial... (But hey, 300 lines of code removed, and this is considering the added lines for the new feature!)

SuperSamus avatar May 27 '25 13:05 SuperSamus