Closed eriXD closed 4 years ago
This is because strtok is non-reentrant. I'll fix the S9xCreateCheatGroup function to not use it.
I believe I've fixed this upstream. ae1477d420461e8a602e62c36842bef5aa1780ab should fix it.
This bug for multi-line cheats Action Replay detected on
snes9x2002-2018.06.24_c98e1c3
snes9x2005-2018.11.02_f4a5a7a
Please, fix it for other snes9x-20Xx_libretro
don't work cheats with +
from Online Updater > Update Cheats
Those cores are old and unrelated to this up-to-date core, so different people would fix those. You can make issues on the other cores' respective issue trackers, if you like, though.
Since the original issue is fixed, I'm going to close this issue now.
When using Multiline cheats (I tried it with a sequence of Action Replay codes using + as delimiter) only the first one gets activated.
In libretro.cpp's function
retro_cheat_set
(line 779) thecode
variable gets tokenized and the parts are supposedly (and indirectly) given over to cheats2.cpp'sS9xCreateCheatgroup
. The problem is that this function also creates tokens of the code string it is given, which (I guess due to the way strtok is implemented) somehow destroys the remains of the originalcode
variable in libretro.cpp setting it immediately toNull
.An ugly workaround is to remove
S9xCreateCheatGroup
's for-loop (line 403 in cheat2.cpp) and change the rest of the function so that the correct string is given toS9xTextToCheat
. Obviously this will not create a "cheat group" but merely several cheat groups consisting of only one cheat each. Unfortunately I'm no expert on this matter - I tried giving theS9xCreateCheatGroup
function the entire multiline cheat string, which should then be split, put into a cheat group and be activated, but somehow it didn't work... I may have done it incorrectly...