diff options
author | Priuli <52487@rommac-52487-1.station> | 2021-04-01 15:33:39 +0200 |
---|---|---|
committer | Priuli <52487@rommac-52487-1.station> | 2021-04-01 15:33:39 +0200 |
commit | bcfd7c64b070a6d65eaa6c1d81a544e8a1050776 (patch) | |
tree | e71179cb9a6573254e8b3a6c59207461c696d3b3 | |
parent | 1bc0dcbf464b822f63c4ee447d51612e1d6af083 (diff) |
plugins/cheat: fix XML cheat loading when emulation is launched with an image option specified (e.g. mame nes -cart smb) or by loading directly one part of the software (e.g. mame a600 amigaocs_flop:lslarry2:flop1)
-rw-r--r-- | plugins/cheat/init.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua index d6a0c25015c..1d020ee9cae 100644 --- a/plugins/cheat/init.lua +++ b/plugins/cheat/init.lua @@ -95,18 +95,15 @@ function cheat.startplugin() local filename = emu.romname() local newcheats = {} local file = emu.file(manager.machine.options.entries.cheatpath:value():gsub("([^;]+)", "%1;%1/cheat") , 1) - if emu.softname() ~= "" then - if emu.softname():find(":") then - filename = emu.softname():gsub(":", "/") - else - for name, image in pairs(manager.machine.images) do - if image.exists and image.software_list_name ~= "" then - filename = image.software_list_name .. "/" .. emu.softname() - end - end + + for name, image in pairs(manager.machine.images) do + if image.exists and image.software_list_name ~= "" then + filename = image.software_list_name .. "/" .. image.filename end end + cheatname = filename + print(cheatname) local function add(addcheats) if not next(newcheats) then newcheats = addcheats |