plugins: handle the case where the ui prepends the list name to the list entry name (nw)

This commit is contained in:
cracyc 2018-05-02 09:37:34 -05:00
parent f5191c8605
commit fec83c922b
4 changed files with 20 additions and 9 deletions

View File

@ -92,9 +92,13 @@ function cheat.startplugin()
local newcheats = {}
local file = emu.file(manager:machine():options().entries.cheatpath:value():gsub("([^;]+)", "%1;%1/cheat") , 1)
if emu.softname() ~= "" then
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()
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
end
end

View File

@ -730,9 +730,13 @@ function cheatfind.startplugin()
menu_type = 1
local setname = emu.romname()
if emu.softname() ~= "" then
for name, image in pairs(manager:machine().images) do
if image:exists() and image:software_list_name() ~= "" then
setname = image:software_list_name() .. "/" .. emu.softname()
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
setname = image:software_list_name() .. "/" .. emu.softname()
end
end
end
end

View File

@ -94,7 +94,8 @@ function hiscore.startplugin()
file = io.open( hiscore_plugin_path .. "/hiscore.dat", "r" );
end
if emu.softname() ~= "" then
rm_match = '^' .. emu.romname() .. ',' .. emu.softname() .. ':';
local soft = emu.softname():match("([^:]*)$")
rm_match = '^' .. emu.romname() .. ',' .. soft .. ':';
else
rm_match = '^' .. emu.romname() .. ':';
end
@ -148,7 +149,8 @@ function hiscore.startplugin()
local function get_file_name ()
local r;
if emu.softname() ~= "" then
r = hiscore_path .. '/' .. emu.romname() .. "_" .. emu.softname() .. ".hi";
local soft = emu.softname():match("([^:]*)$")
r = hiscore_path .. '/' .. emu.romname() .. "_" .. soft .. ".hi";
else
r = hiscore_path .. '/' .. emu.romname() .. ".hi";
end

View File

@ -31,7 +31,8 @@ function portname.startplugin()
local function get_filename(nosoft)
local filename
if emu.softname() ~= "" and not nosoft then
filename = emu.romname() .. "_" .. emu.softname() .. ".json"
local soft = emu.softname():match("([^:]*)$")
filename = emu.romname() .. "_" .. soft .. ".json"
else
filename = emu.romname() .. ".json"
end