Main > Software Forum

Skip Startup Frames reborn as MAME Plugin

<< < (10/11) > >>

10yard:
Thank you for this amazing plugin!

I made a fork of your github repo to add support further back to MAME 0.227.   This allowed me to include the plugin within my custom built arcade frontend (currently running on MAME 0.241).
The fork is at https://github.com/10yard/skipstartupframes

To get this running on the older versions I had to register your machine notifications using the now deprecated emu.register_start and emu.register_stop.  See below.


--- Code: ---  -- MAME 0.254 and newer compatibility check
  if emu.add_machine_reset_notifier ~= nil and emu.add_machine_stop_notifier ~= nil then
    startNotifier = emu.add_machine_reset_notifier(start)
    stopNotifier = emu.add_machine_stop_notifier(stop)
    menuNotifier = emu.register_menu(menu_callback, menu_populate, _p("plugin-skipstartupframes", "Skip Startup Frames"))

  -- MAME 0.227 and newer compatibility check
  elseif tonumber(emu.app_version()) >= 0.227 then
    emu.register_start(function()
startNotifier = True
        start()
end)
    emu.register_stop(function()
stopNotifier = True
        stop()
end)
    menuNotifier = emu.register_menu(menu_callback, menu_populate, "Skip Startup Frames")

  else
    ---- MAME version not compatible (probably can"t even load LUA plugins anyways)
    print("Skip Startup Frames plugin requires at least MAME 0.227")
    return
  end

--- End code ---


Also,  to accelerate the start,  I made use of frameskip to launch most of my games instantly.  I set to 11 after blacking out the screen and back to 0 after resetting the throttle.


--- Code: ---video.frameskip = 11

--- End code ---

PL1:

--- Quote from: 10yard on May 02, 2025, 06:08:12 am ---I made a fork of your github repo to add support further back to MAME 0.227.   This allowed me to include the plugin within my custom built arcade frontend (currently running on MAME 0.241).
The fork is at https://github.com/10yard/skipstartupframes

To get this running on the older versions I had to register your machine notifications using the now deprecated emu.register_start and emu.register_stop.  See below.


--- Code: ---  -- MAME 0.254 and newer compatibility check
  if emu.add_machine_reset_notifier ~= nil and emu.add_machine_stop_notifier ~= nil then
    startNotifier = emu.add_machine_reset_notifier(start)
    stopNotifier = emu.add_machine_stop_notifier(stop)
    menuNotifier = emu.register_menu(menu_callback, menu_populate, _p("plugin-skipstartupframes", "Skip Startup Frames"))

  -- MAME 0.227 and newer compatibility check
  elseif tonumber(emu.app_version()) >= 0.227 then
    emu.register_start(function()
startNotifier = True
        start()
end)
    emu.register_stop(function()
stopNotifier = True
        stop()
end)
    menuNotifier = emu.register_menu(menu_callback, menu_populate, "Skip Startup Frames")

  else
    ---- MAME version not compatible (probably can"t even load LUA plugins anyways)
    print("Skip Startup Frames plugin requires at least MAME 0.227")
    return
  end

--- End code ---

--- End quote ---
Hey Jon,

Thanks for adding support back to v0.227.   :cheers:

To implement a best practice recommended by Robbbert, you may want to change the 0.227 compatibility check in your code from a number check to a string check like this.

--- Code: ---elseif emu.app_version() >= "0.227" then

--- End code ---

That change will allow it to also work with MAME forks that use hyphenated/alternate numbering systems like NegaMAME (v0.277-1), MAMEUI (v0.277.0), and -- most importantly -- the currently unsupported HBMAME (v0.245.24) which is stuck at v0.245 due to a major restructuring in mainline MAME that took place in v0.246.


--- Quote from: PL1 on January 08, 2025, 09:03:59 pm ---
--- Quote from: Jakobud on January 08, 2025, 10:51:09 am ---I am investigating those settings not saving as well as the version check string/number thing.

--- End quote ---
Your version check starting at line 164 of /src/startplugin.lua . . .

--- Code: ---if emu.add_machine_reset_notifier ~= nil and emu.add_machine_stop_notifier ~= nil then

--- End code ---
. . . is good in MAMEUI v0.273.1 which indicates that your plugin's way of version checking is a not affected by the string/number issue like Aaron's defenderlr plugin was with this number check.

--- Code: ---if tonumber(emu.app_version()) >= 0.254 then

--- End code ---

If you ever want to have different configurations to support different generations of LUA (i.e. one version for 0.254 and newer, another version for 0.227- 0.253 . . .), you could probably use an if/then/else version of Aaron's updated version string check.

--- Code: ---if emu.app_version() >= "0.254" then

--- End code ---

--- End quote ---


Scott

10yard:

--- Quote from: PL1 on May 02, 2025, 05:25:08 pm ---To implement a best practice recommended by Robbbert, you may want to change the 0.227 compatibility check in your code from a number check to a string check like this.

--- Code: ---elseif emu.app_version() >= "0.227" then

--- End code ---

--- End quote ---
Hey Scott.  Thanks.  I've updated the compatibility check in my forked version.

PL1:

--- Quote from: 10yard on May 06, 2025, 03:38:50 am ---Hey Scott.  Thanks.  I've updated the compatibility check in my forked version.

--- End quote ---
Glad to assist.   :cheers:

I have a few questions about changing the frameskip value to 11 then back to 0 to speed up the plugin.

1. Some of the values in ssf.txt need to be exactly accurate so the game starts after the bootup video and before attract mode sound starts playing.
- Can changing frameskip to 11 cause the exact starting frame to be different than leaving frameskip at 0?

2. Some people use a non-zero frameskip value to get full speed emulation for a game/system that would otherwise be too demanding for their computer.
- I assume it is possible to read/use that frameskip value from MAME or the .ini files for each game, right?
- Maybe have the plugin set a variable when starting a game/system that holds the correct frameskip for that game/system.

3. Shouldn't frameskip also be set back to default when the ssf plugin is in debug mode so it is easier to find accurate values for ssf.txt?


Scott
EDIT: Thinking more about question #1.

The frameskip value equals how many frames per group of 12 frames will be skipped.

If frameskip = 11 does cause a problem with starting on the correct frame because MAME is rendering one frame then skipping the next eleven (1 rendered + 11 skipped = 12), the starting frame accuracy could be increased by using smaller frameskip values.

If frameskip = 10 (2 rendered + 10 skipped = 12), you'd get 1 rendered then 5 skipped -- doubles the accuracy with only a slight decrease in speed.

If frameskip = 9 (3 rendered + 9 skipped = 12), you'd get 1 rendered then 3 skipped.

If frameskip = 8 (4 rendered + 8 skipped = 12), you'd get 1 rendered then 2 skipped.

If frameskip = 6 (6 rendered + 6 skipped = 12), you'd get 1 rendered then 1 skipped -- the lowest value that makes sense and accuracy is always either the target frame or target plus 1 frame.

damageinc86:
I don't suppose there is any way to get this plugin into the mame2010 retroarch core is there?  I'd love to be able to FF past the romchecks of all these known game startups you all have figured out.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version