Skip to content

Commit

Permalink
Merge pull request #15 from Jakobud/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Jakobud authored Jan 16, 2025
2 parents b340edd + 4687843 commit 29705bd
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 114 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ This plugin is compatibile with:
- **MAME 0.253** or newer
- **Arcade64 0.253** or newer

## :no_entry_sign: VSync Limitations

The plugin will not accurately skip frames when Vsync is enabled.

## :question: How does it work?

Every rom has a different startup procedure and different number of startup frames that need to be skipped. The included file `ssf.txt` defines how many frames should be skipped for each rom.
Expand Down
4 changes: 2 additions & 2 deletions src/frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ local load_frames = function(file)
for line in frames_file:gmatch("[^\r\n]+") do

-- First look for the following pattern: rom,startFrame|resetFrame
local rom, startFrame, resetFrame = line:match("^(%w+),([%d]+)|([%d]+)$")
local rom, startFrame, resetFrame = line:match("^([%w_]+),([%d]+)|([%d]+)$")
if rom ~= nil and startFrame ~= nil and resetFrame ~= nil then
frames[rom] = {
start = tonumber(startFrame),
reset = tonumber(resetFrame)
}
else
-- Second, look for the following pattern: rom,startFrame
rom, startFrame = line:match("^(%w+),([%d]+)$")
rom, startFrame = line:match("^([%w_]+),([%d]+)$")

if rom ~= nil and startFrame ~= nil then
frames[rom] = {
Expand Down
5 changes: 2 additions & 3 deletions src/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ local function load()
else
-- Parse options file
options = json.parse(options_file:read("*a")) or {}
options_file:close()

-- Fix incorrect types and add missing options
for k,v in pairs(defaultoptions) do
if (not options[k] or options[k] == nil or type(options[k]) ~= type(v)) then
if (options[k] == nil or type(options[k]) ~= type(v)) then
options[k] = v
end
end
end

options_file:close()

return options
end

Expand Down
Loading

0 comments on commit 29705bd

Please sign in to comment.