Hello internet.
I got cheats working in mupen64plus today, so I am going to tell you the secrets.
First of all I wanted to see all the secrets available for the games I had in my library.
I ran this bit of bash script to list them:
cd ~/RetroPie/roms/n64
for i in *.v64 *.n64 *.z64; do echo "$i"; mupen64plus --cheats list "$i" | grep -P "^UI-Console:" > "${i:0:-4}.cheat"; done
Now you can peruse your available cheats at your leisure.
ls ~/RetroPie/roms/n64/*.cheat
cat *.cheat
So your retropie probably has a symlinked copy of mupen64plus.
$ which mupen64plus
/usr/local/bin/mupen64plus
$ ls -l $(which mupen64plus)
lrwxrwxrwx 1 root root 51 Feb 8 10:57 /usr/local/bin/mupen64plus -> /opt/retropie/emulators/mupen64plus/bin/mupen64plus
Most of the useful files in use at runtime by runcommand
(the guy that launches mupen64plus), is in the directory it launches from...
/opt/retropie/configs/n64
The cheat file isn't copied or symlinked into this directory by default, so let's do that
ln -s /opt/retropie/emulators/mupen64plus/share/mupen64plus/mupencheat.txt /opt/retropie/configs/n64/mupencheat.txt
I started listing which cheats I wanted on at the bottom of my copy of mupen64plus.sh
$ tail -n 30 /opt/retropie/emulators/mupen64plus/bin/mupen64plus.sh
declare -A cheats_map=(
["golden"]="0,6,16"
#["zelda"]="3,4"
#["mario"]="5,6,7"
)
function set_cheats() {
cheats=""
for key in "${!cheats_map[@]}"; do
if [[ "${ROM,,}" == *"$key"* ]]; then
cheats="--cheats ${cheats_map[$key]}"
break
fi
done
}
set_cheats
echo "Cheats: $cheats"
set -x
SDL_AUDIODRIVER=${SDL_AUDIODRIVER} SDL_VIDEO_RPI_SCALE_MODE=${SDL_VIDEO_RPI_SCALE_MODE} "$rootdir/emulators/mupen64plus/bin/mupen64plus" --noosd $PARAMS ${WINDOW_MODE} --rsp ${RSP_PLUGIN}.so --gfx ${VIDEO_PLUGIN}.so --audio ${AUDIO_PLUGIN}.so --configdir "$configdir/n64" --datadir "$configdir/n64" $cheats "$ROM"
Now the cheats are looked up at the last moment for which game I am using and injects it into the mupen64plus command as needed.
Eventually I might get runcommand to show a list of cheats to enable, but for now I don't have it.
If it still isn't working for you, check out the output log of runcommand found here:
cat /dev/shm/runcommand.log
A lot of the output will be missing until you close the rom.
pi@retropie:/dev/shm$ cat runcommand.log
Parameters:
Executing: /opt/retropie/emulators/mupen64plus/bin/mupen64plus.sh AUTO "/home/pi/RetroPie/roms/n64/007 - GoldenEye (USA).n64"
Cheats: --cheats 0,6,16
+ SDL_AUDIODRIVER=
+ SDL_VIDEO_RPI_SCALE_MODE=1
+ /opt/retropie/emulators/mupen64plus/bin/mupen64plus --noosd --set 'Video-GLideN64[UseNativeResolutionFactor]=1' --windowed --resolution 320x240 --rsp mupen64plus-rsp-hle.so --gfx mupen64plus-video-GLideN64.so --audio mupen64plus-audio-sdl.so --configdir /opt/retropie/configs/n64 --datadir /opt/retropie/configs/n64 --cheats 0,6,16 '/home/pi/RetroPie/roms/n64/007 - GoldenEye (USA).n64'
__ __ __ _ _ ____ _
| \/ |_ _ _ __ ___ _ __ / /_ | || | | _ \| |_ _ ___
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|
| | | | |_| | |_) | __/ | | | (_) |__ _| __/| | |_| \__ \
|_| |_|\__,_| .__/ \___|_| |_|\___/ |_| |_| |_|\__,_|___/
|_| https://mupen64plus.org/
Mupen64Plus Console User-Interface Version 2.5.9
UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.9
UI-Console: Includes support for Dynamic Recompiler.
Core: Using full mem base
Core: Goodname: GoldenEye 007 (U) [!]
Core: Name: GOLDENEYE
Core: MD5: 70C525880240C1E838B8B1BE35666C3B
Core: CRC: DCBC50D1 09FD1AA3
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 12582912 bytes (or 12 Mb or 96 Megabits)
Core: Version: 1447
Core: Manufacturer: Nintendo
Core: Country: USA
UI-Console Status: activated cheat code 0: Enable All Levels & In-Built Cheat Menu
UI-Console Status: activated cheat code 6: Enable All Levels
UI-Console Status: activated cheat code 16: All 64 Characters In Multi Player
UI-Console: using Video plugin: 'GLideN64 rev.49373fd' v2.0.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.9
Input: Using auto-config file at: '/opt/retropie/configs/n64/InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.9
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.9
Core: input plugin did not specify a render callback; there will be no on screen display by the input plugin.
Input: 1 SDL joysticks were found.
Input: Using auto-config file at: '/opt/retropie/configs/n64/InputAutoCfg.ini'
Input: N64 Controller #1: Using auto-config with SDL joystick 0 ('Microsoft X-Box 360 pad')
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Rumble activated on N64 joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.9 initialized.
RSP: RSP Fallback disabled !
Core: Using video capture backend: dummy
Core: Game controller 0 (Standard controller) has a Memory pak plugged in
Core: Game controller 1 (Standard controller) has a Memory pak plugged in
Core: Game controller 2 (Standard controller) has a Memory pak plugged in
Core: Game controller 3 (Standard controller) has a Memory pak plugged in
Core: Using CIC type X102
Core: Setting video mode: 320x240
Audio: Using resampler src
Audio: Initializing SDL audio subsystem...
Input: Rumble activated on N64 joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Dynamic Recompiler
Core: Init new dynarec
Core: ARM CPU Features:, Half, Thumb, FastMult, VFP, ESDP, NEON, VFPv3, TLS, VFPv4, IDIVa, IDIVt
Audio: Initializing SDL audio subsystem...
Core Status: Stopping emulation.
Core: R4300 emulator finished.
Core Status: Rom closed.
Before my fix, I had this line in the logs.
UI-Console Warning: cheat code database file 'mupencheat.txt' not found.
UI-Console Warning: no cheat codes found for ROM image 'GOLDENEYE'