mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
oops
This commit is contained in:
parent
55c9596f4c
commit
badc9e8c73
@ -66,22 +66,13 @@ function cheat.startplugin()
|
|||||||
local function load_cheats()
|
local function load_cheats()
|
||||||
local filename = emu.romname()
|
local filename = emu.romname()
|
||||||
local json = require("json")
|
local json = require("json")
|
||||||
local file = emu.file(manager:machine():options().entries.cheatpath:value(), 1)
|
local path = manager:machine():options().entries.cheatpath:value()
|
||||||
local function readAll(file)
|
local file = emu.file(path .. ";" .. path .. "/cheat", 1)
|
||||||
local f = io.open(file, "rb")
|
|
||||||
if not f then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local content = f:read("*all")
|
|
||||||
f:close()
|
|
||||||
return content
|
|
||||||
end
|
|
||||||
|
|
||||||
if emu.softname() ~= "" then
|
if emu.softname() ~= "" then
|
||||||
for name, image in manager:machine().images do
|
for name, image in manager:machine().images do
|
||||||
if image:exists() and image:software_entry() then
|
if image:exists() and image:software_entry() then
|
||||||
filename = filename .. "/" .. image:software_entry()
|
filename = filename .. "/" .. image:software_entry()
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -116,7 +107,7 @@ function cheat.startplugin()
|
|||||||
|
|
||||||
local function draw_line(screen, x1, y1, x2, y2, color)
|
local function draw_line(screen, x1, y1, x2, y2, color)
|
||||||
if not screen then
|
if not screen then
|
||||||
print("draw_text: invalid screen")
|
print("draw_line: invalid screen")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
output[#output + 1] = { type = "line", scr = screen, x1 = x1, x2 = x2, y1 = y1, y2 = y2, color = color }
|
output[#output + 1] = { type = "line", scr = screen, x1 = x1, x2 = x2, y1 = y1, y2 = y2, color = color }
|
||||||
@ -124,7 +115,7 @@ function cheat.startplugin()
|
|||||||
|
|
||||||
local function draw_box(screen, x1, y1, x2, y2, bgcolor, linecolor)
|
local function draw_box(screen, x1, y1, x2, y2, bgcolor, linecolor)
|
||||||
if not screen then
|
if not screen then
|
||||||
print("draw_text: invalid screen")
|
print("draw_box: invalid screen")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
output[#output + 1] = { type = "box", scr = screen, x1 = x1, x2 = x2, y1 = y1, y2 = y2, bgcolor = bgcolor, linecolor = linecolor }
|
output[#output + 1] = { type = "box", scr = screen, x1 = x1, x2 = x2, y1 = y1, y2 = y2, bgcolor = bgcolor, linecolor = linecolor }
|
||||||
@ -414,15 +405,15 @@ function cheat.startplugin()
|
|||||||
emu.register_frame_done(function()
|
emu.register_frame_done(function()
|
||||||
line = 0
|
line = 0
|
||||||
for num, draw in pairs(output) do
|
for num, draw in pairs(output) do
|
||||||
if draw.type = "text" then
|
if draw.type == "text" then
|
||||||
if not draw.color then
|
if not draw.color then
|
||||||
draw.scr:draw_text(draw.x, draw.y, draw.str)
|
draw.scr:draw_text(draw.x, draw.y, draw.str)
|
||||||
else
|
else
|
||||||
draw.scr:draw_text(draw.x, draw.y, draw.str, draw.color)
|
draw.scr:draw_text(draw.x, draw.y, draw.str, draw.color)
|
||||||
end
|
end
|
||||||
elseif draw.type = "line" then
|
elseif draw.type == "line" then
|
||||||
draw.scr:draw_line(draw.x1, draw.x2, draw.y1, draw.y2, draw.color)
|
draw.scr:draw_line(draw.x1, draw.x2, draw.y1, draw.y2, draw.color)
|
||||||
elseif draw.type = "box" then
|
elseif draw.type == "box" then
|
||||||
draw.scr:draw_box(draw.x1, draw.x2, draw.y1, draw.y2, draw.bgcolor, draw.linecolor)
|
draw.scr:draw_box(draw.x1, draw.x2, draw.y1, draw.y2, draw.bgcolor, draw.linecolor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user