hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.03k stars 2.15k forks source link

Option to remove tickbox from cheatnote cheats in cheatlist #15442

Open oldmario opened 2 years ago

oldmario commented 2 years ago

What should happen

this github has a cheat.db that's updated every so often and includes PPSSPP specific cheats like 60fps/fixes/ultra-widescreen ect... https://github.com/Saramagrean/CWCheat-Database-Plus-

this is an example of what they look like in the list, the hex they use, and the sort of notes they give

_C0 ↑[#Cheat Refresh Rate Must Set Lower On PPSSPP]
_L 0x00000000 0x00000000
_C0 ↑↑[#How To Use: Change Display Layout Editor Setting To "Streching" Then Enable Widescreen Hack Code, And Start Game]
_L 0x00000000 0x00000000
_C0 __________[>>>Partner UPC Modifier Codes<<<]__________
_L 0x00000000 0x00000000

would it be possible to get some sort of option to remove the toggle box on these cheats and center the text so it's easier to distinguish between the cheat and the cheatnote

Who would this benefit

people who use the cheat section and the notes that are added onto the cheats

Platform (if relevant)

No response

Games this would be useful in

games with cheatnotes

Other emulators or software with a similar feature

No response

Checklist

iota97 commented 2 years ago

Things are a little trickier than this.

Importing a cheat.db will just append new lines so this approach won't work if you have the cheat already (it will add the header or description at the end of the file, likely to the wrong cheat).

The idea is good and useful tho' :)

LunaMoo commented 2 years ago

Why do those cheats have "_L 0x00000000 0x00000000" line? Is that a requirement of some PSP/PSV cheat engine to display them at cheat list? Can't they display without that line?

Pretty sure even with that line they also have checkboxes and are detected as normal cheats on real hardware. Technically having 0x0 at the address and value is not creating an empty cheat, they're still patching things and I can imagine someone could store a variable at 0x00000000 and have a separate cheat with exactly same line to zero that variable which would then be wrongly interpreted as comment stopping it from working.

I would propose to simply display "#" & "//" lines as we're detecting those as comments already anyway and if someone wants comments without checkboxes they'd just include those. Then again maybe not both as I don't see how it would make things clearer if a person(again like me) would create a customizable cheat and have a lot of comments that describe exactly how to customize it which requires editing the file via text editor anyway and don't want it all to be displayed through UI.

Maybe display # comments, still just ignoring // ones or just create completely new command for comments that can display differently as that would as a matter of fact be a feature which doesn't exist on real hardware plugins anyway(can be wrong as there's a lot of cheating plugins for PSP and I saw like 2 at most).

oldmario commented 2 years ago

Why do those cheats have "_L 0x00000000 0x00000000" line? Is that a requirement of some PSP/PSV cheat engine to display them at cheat list? Can't they display without that line?

i assume it's the safest value to use without it being used by anything else on its own and with a value it gets detected to show up too

Maybe display # comments, still just ignoring // ones or just create completely new command for comments that can display differently as that would as a matter of fact be a feature which doesn't exist on real hardware plugins anyway(can be wrong as there's a lot of cheating plugins for PSP and I saw like 2 at most).

i had a look on my real psp as i had some games that contain cheatnotes and there's a 30 character limit for the cheat text so i guess that's why these cheatnotes exist to add extra text to the cheat but i'd say 90% of them that exist are only for the emulator

iota97 commented 2 years ago

I made some attempt, (but more focused on UI rather than format).

There are 2 types of cheat note AFAICT: header and description. I used _H header name and _D description text (description right after the last cheat line AKA _L)

I leave the code here, just for the UI part if someone ever want to it (the format logic is messy).

Screenshot_2022-03-20_08-00-57

The real problem as I mentioned before is how to handle importing cheat db and merge the already present cheat in the right way.

We could probably have a map header_name -> cheat_list for the header and add the description to the cheat info?

To be fair the import code is a bit messy and I'm scared of breaking something (3 nested cycle, a goto and a guard that call break at the end? I can't really get all the logic behind it.)

We should probably refactor that first (and probably have it in Core rather than UI).

unknownbrackets commented 2 years ago

Yeah, I agree it'd be better in this case to add description just as another field on lastCheatInfo_, so when it flushes all the data is in one place.

I think I rewrote the cheat parsing in Core/CwCheat some time ago, and basically didn't want to mess with that import code either for some of the same reasons as you mention... but also because I don't really use it myself, so I wouldn't know if I broke it really.

That said, it seems to me like "importing" should be unnecessary. The current parsing can filter by game ID, so if you pointed it at a large cheat DB with many games' cheats in it, it would already parse out the game's specific cheats anyway. That's how it worked on the PSP iirc, I don't think it had separate files per game. Though, there are definitely benefits to separate files...

Seems like 0x00000000 is being abused, not a fan of that, though. But not sure how many would update their cheats across various parts of the internet if we invented a new format either?

-[Unknown]