Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWC improvements/fixes #8818

Merged
merged 4 commits into from
Jun 21, 2016
Merged

CWC improvements/fixes #8818

merged 4 commits into from
Jun 21, 2016

Conversation

LunaMoo
Copy link
Collaborator

@LunaMoo LunaMoo commented Jun 19, 2016

This solves #8658 althrough I would be lazy to do it just because of the argument mentioned there about someone being lazy to restart emulation when it's required by cheat, my own argument for adding it is for cases where broken cheats crash PPSSPP on boot which might suck on non windows platforms currently.

It additionally fixes a small problem where first line was removed from newly created files, it could remove first cheat if someone opened automatically created file and added cheats without _S/_G lines that we usually add as PSP legacy, but not actually use them.

Also invalidates JIT for reading values via 0xE/0xD multi-line skip codes, in some cases where code is moved around/loaded in modules those codes can't read original values otherwise. I don't think that's particulary common issue since people rarely ever used those cheats that way on psp, I do it all the time since they're great to stop long scripts from being written constantly as well as for safety checks.

Saying so I can't really find any more issues with CWC, people will continue to have problems with PSP cheats where address differs and we can't do much about it, so I guess #7375 could also be closed.

Edit: sorry for pushing it like few times in a row;p I'm quite literally on drugs(well eye drops count as drugs I guess;p) and my vision is quite blurry. Should be fine now.

Fixes #8448, fixes #8658, fixes #8023. Fixes #7375 (remaining jit invalidations.)

@LunaMoo LunaMoo force-pushed the minorCWC branch 3 times, most recently from 19c347e to 17a3a92 Compare June 20, 2016 00:23
@@ -40,10 +41,69 @@ static bool enableAll = false;
static std::vector<std::string> cheatList;
static CWCheatEngine *cheatEngine2;
static std::deque<bool> bEnableCheat;
std::string gamePath_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a class member of CwCheatScreen probably, or otherwise it should be static.

For non-class members, static means that other cpp files can't see it (e.g. if two files had std::string gamePath_ in them without static, they would conflict, or be the same variable.)

-[Unknown]

@LunaMoo LunaMoo force-pushed the minorCWC branch 3 times, most recently from 5a9af62 to 53f3205 Compare June 20, 2016 02:13
@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 20, 2016

Cool, since with this cheat file creation is handled better passing info from UI - #8448 was also fixed.

The only thing it still generates nameless ini file anyway since we generate them on boot as well, I'll just disable it for homebrew. Those files are created when opening cheat menu anyway.

Invalidate JIT for 0xE/0xD checks
And big thanks to [Unknown] for help:3
@LunaMoo LunaMoo force-pushed the minorCWC branch 2 times, most recently from a9fdd70 to f853176 Compare June 20, 2016 18:31
Limit homebrew ini file generation to UI.
@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 20, 2016

I think everything is done here now, or at least I hope so, to sum it up - this now fixes:
#8023 - Expand (save states files naming) to cheat files
#8448 - Trying to import cheats from cheat.db while playing a homebrew game causes the emulator to crash
#8658 - Request: Add "Cheat" option to games before launching it

Potentially
#7375 - Cheat engine issues and "locking interval"
could also be closed since it's far too generic, we already have the feature it requested for a while, from my experience used cheats for a long time without issues until noticing 0xE/0xD code types also need invalidate JIT which this PR deals with.

Cheat related issues which people report are commonly caused by either:

  • memory differences between ppsspp vs psp,
  • not cwcheats or at least not following it's original syntax, CWC is easily the most popular and best documented one, unfortunately not the only format in existence.

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 20, 2016

Blah, I thought we generate ID's using filename for homebrew, but we do use filename, just for some reason homebrew like to display a legit ID, except all of them use same one? :C
Tried "Cave Story" and "Chuckie Egg" both UCJS10041, and actually not using that for anything else but to show on gameScreen? Any ideas?

@hrydgard
Copy link
Owner

I don't know of any reliable way to generate IDs for homebrew, unfortunately. Hashing the executable might come close but the filenames won't exactly be legible.

If you want to do something about it before merge, that's fine - I'm happy to merge this as is, too, looks good.

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 20, 2016

I'll try to set homebrew through filename as well, just need to test how it works.

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 20, 2016

filenames
Seems to work fine now, also checks for extensions assuming commercial games can only be iso/cso/pbp to avoid use of that incorrect ID some homebrew had.

std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini.
std::vector<std::string> CWCheatEngine::GetCodesList(std::string file) { //Reads the entire cheat list from the appropriate .ini.
if (file.empty()) {
file = activeCheatFile;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I suppose this isn't doing anything since activeCheatFile is being set otherwise.

-[Unknown]

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Jun 21, 2016

Yeah, looks okay to me. I think we have similar logic for homebrew savestates.

By the way, edited with "fixes ####" so that it auto-closes.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 21, 2016

Oh yeah, I ended setting it up during cheat file creation and never used that one;c. Thanks for edit as well, I don't know most of git power.

@unknownbrackets unknownbrackets merged commit 2bd0567 into hrydgard:master Jun 21, 2016
@LunaMoo LunaMoo deleted the minorCWC branch June 21, 2016 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants