Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: MAME scripty things!  (Read 8865 times)

0 Members and 1 Guest are viewing this topic.

Stiletto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:September 27, 2022, 11:41:36 pm
  • MAME me.
MAME scripty things!
« on: October 24, 2021, 04:28:25 pm »
Third-Party MAME Lua Plugins/Scripts - A List

All entries make use of MAME's Lua functionality via the plugin system:
https://docs.mamedev.org/techspecs/luaengine.html
https://docs.mamedev.org/techspecs/luareference.html

MarI/O MAME - SMW SMB:
Script - https://gist.github.com/cracyc/02cbcac7b869329e7d8b280ef6c77fa5
Video - hxxps://www.youtube.com/watch?v=aGKFs5wJ0CI

SFII RYUNATOR:
Script - https://github.com/Jazpy/RYUNATOR

Robotron-AI - Robotron 2084, Automated Gameplay in MAME
Script - https://github.com/grunt2084/robotron-ai
Video - hxxps://www.youtube.com/watch?v=hPItPwnsjig
Video - hxxps://www.youtube.com/watch?v=7dapV20G3iw

Hitbox Viewer for Warriors of Fate:
http://www.mamecheat.co.uk/forums/viewtopic.php?f=4&t=12830

Street Fighter II hitbox viewer, etc.:
Comes with MAME Cheats: http://www.mamecheat.co.uk/
https://gist.github.com/cracyc/01b6d1c93b3b9937eb500dff157fc832
https://gist.github.com/cracyc/145ae60b9e6ac1d1bd7ce26c60f250c6

Autotron (not published) - a neural network that can competently play Robotron: 2084:
http://www.jeraddunn.com/

Headkaze ShowCP plugin (CPWizard):
http://forum.arcadecontrols.com/index.php?topic=151810.0

Headkaze simple Savestate plugin:
http://headsoft.com.au/download/mame/savestate_plugin.zip
http://forum.arcadecontrols.com/index.php/topic,151810.msg1623419.html#msg1623419

Headkaze auto load save state plugin:
http://forum.arcadecontrols.com/index.php/topic,155063.msg1626548.html#msg1626548

Nibbler bot:
https://github.com/FrankRizzo890/NibblerBot
https://reddit.com/r/MAME/comments/ab4tj6/going_for_the_mame_bot_world_record_on_nibbler/
hxxps://www.youtube.com/watch?v=60gVbJTOUOo

Track & Field bot:
https://github.com/FrankRizzo890/TrackFieldBot
https://reddit.com/r/MAME/comments/bwlh12/my_2nd_bot_plays_track_field_see_it_here/
hxxps://www.youtube.com/watch?v=fs-aIPMlcUo

Space Zap bot:
https://github.com/FrankRizzo890/SpaceZapBot
https://reddit.com/r/MAME/comments/byb0bk/my_3rd_bot_plays_space_zap_see_it_here/
hxxps://www.youtube.com/watch?v=90yBznscFkk

Hyper Sports bot:
https://github.com/FrankRizzo890/HyperSportsBot
https://reddit.com/r/MAME/comments/c7orvd/my_4th_bot_is_posted_it_plays_hyper_sports/
hxxps://www.youtube.com/watch?v=JWOLBkUp6dA

MAME system shutdown plugin for Windows:
https://github.com/michaelshmitty/mame-shutdown
https://reddit.com/r/MAME/comments/7bwhef/simple_mame_plugin_for_shutting_down_your_windows/

Arcademus - MAME plugin that helps to play arcade music on demand:
https://github.com/stengun/arcademus

DKShooter - Donkey Kong Shooter - A Galaga themed plugin/hack for MAME:
https://github.com/10yard/dkshooter
hxxps://www.youtube.com/watch?v=Rk5n4frRmI0

DKCoach - DK Coach - A MAME plugin to assist with Donkey Kong gameplay:
https://github.com/10yard/dkcoach
hxxps://www.youtube.com/watch?v=ax-xDwVr7No

DKLavaPanic - A MAME plugin version of DK Lava Panic:
https://github.com/10yard/dklavapanic
hxxps://www.youtube.com/watch?v=KB_6jqc82Ek

DKWho - A MAME plugin version of DK Who and the Daleks:
https://github.com/10yard/dkwho
hxxps://www.youtube.com/watch?v=BAFvoF_iqCY

DKChorus - A MAME plugin which replaces the DK samples and music with acapella sounds:
https://github.com/10yard/dkchorus
hxxps://www.youtube.com/watch?v=nYCNioYWcO4

DKAFE - Donkey Kong Arcade Front End (uses MAME plugin to interface with MAME):
https://github.com/10yard/dkafe
hxxps://www.youtube.com/watch?v=IOaJTd_O6yY

BletchMAME - MAME Frontend (uses MAME plugin to interface with MAME):
https://www.bletchmame.org/

Defender directional movement plugin:
https://github.com/BPaden/defenderlr
https://reddit.com/r/MAME/comments/njc019/defender_directional_movement_plugin/
https://drive.google.com/file/d/1kRYwEwyKy_wDicLL9JTlnwOuOlicM5tB/view?usp=sharing

Defender 8-way control plugin:
http://forum.arcadecontrols.com/index.php?topic=163525.0

Game Input Lag Tester (uses Lua to interface with MAME):
http://forum.arcadecontrols.com/index.php/topic,160722.0.html
http://www.gameinputlagtester.com
hxxps://www.youtube.com/watch?v=Whhz5Y4bd9Q

Killer Instinct Attack Info:
https://github.com/CSword123/MAME-LUA-scripts

MAMEToolkit - A Python toolkit used to train reinforcement learning algorithms against arcade games:
(note: requires modified MAME: https://github.com/M-J-Murray/mame )
(uses MAME plugin to to interface with MAME)
https://reposhub.com/python/deep-learning/M-J-Murray-MAMEToolkit.html

BinTracker - "A Chiptune Audio Workstation for the 21st Century" (uses MAME plugin to to interface with MAME):
https://bintracker.org/
https://bintracker.org/documentation/hacking.html

4am's plugin to autocrack dumps with Passport (not published):
https://twitter.com/a2_4am/status/1379593106836877318

Tim Lindner's Timberbot:
https://gist.github.com/tlindner/0199ee5ee64ab6fb1e3340856bfdece9
hxxps://www.youtube.com/watch?v=1DO3xOZhf2s

Tim Lindner's CoCo Arkanoid cheat:
https://gist.github.com/tlindner/6e042b295f47a64e4c76eb3eb0d0757a
hxxps://www.youtube.com/watch?v=7g8ZbzxxYpI

MAME Music Scripts - some music display scripts:
https://github.com/jedpossum/Mame-Music-Scripts

**disabled embeds, replace hxxps with https when you open in another browser tab

Contributions wanted :)

- Stiletto
« Last Edit: October 24, 2021, 07:59:37 pm by Stiletto »

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #1 on: October 24, 2021, 06:10:28 pm »
Hey,  this will be a useful reference.  I did the DK plugins but am soon to be looking at other scripting projects for MAME.

There are some bad links above with hxxps instead of https.  Please update.
Thanks.
« Last Edit: October 24, 2021, 06:14:31 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


Stiletto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 50
  • Last login:September 27, 2022, 11:41:36 pm
  • MAME me.
Re: MAME scripty things!
« Reply #2 on: October 24, 2021, 07:56:43 pm »
Hey,  this will be a useful reference.  I did the DK plugins but am soon to be looking at other scripting projects for MAME.

Thanks!

There are some bad links above with hxxps instead of https.  Please update.

I will not, because Arcade-Controls forum software wants to automatically embed the YouTube players. Unless there is a way around that?
I don't think a forum post with close to a dozen YouTube windows within it is very nice looking, especially when the meat is in the links! It's also not very friendly to ancient computers. As I said in the footer, copy the URL to another tab and fix the hxxps -> https protocol.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #3 on: November 24, 2021, 11:59:05 am »
Defender directional movement plugin:
https://github.com/BPaden/defenderlr
https://reddit.com/r/MAME/comments/njc019/defender_directional_movement_plugin/
https://drive.google.com/file/d/1kRYwEwyKy_wDicLL9JTlnwOuOlicM5tB/view?usp=sharing
Does anybody have this plugin installed and MAME configured in a way that doesn't cause MAME problems/errors/crashes outside of Defender?   :dizzy:

It does work for Defender in MAME 0.231 and 0.238 if I use the steps below, but "plugins    1" in mame.ini + this plugin enabled can cause problems with games other than Defender (unless the workaround mentioned below works) and AFAIK it will cause problems with MAME's built-in UI.   :banghead:

1. Download MAME and do a fresh install.  I put it in "C:\MAME_defender\".

2. Copy/paste the defender ROM into the roms folder.

3. Download the .zip file for the plugin and copy/paste the defenderlr folder with init.lua and plugin.json files into the plugins folder.

4. Generate a fresh mame.ini ("mame -cc" command) then verify that it contains "plugins    1" and the paths are good for inis and plugins.

5. Make a defender.ini containing "plugin    defenderlr" in either the ini folder or the same folder as the MAME executable.

6. Launch MAME.

7. Enable the defenderlr plugin in the MAME user interface "plugins" menu.

8. Exit MAME.

9. Create a .bat file or shortcut link for "mame defender".  Use that file/link to launch Defender.

If you run the MAME 0.231 executable without the ROMname, MAME's built-in FE throws an annoying error that you can work around it by closing the error window and choosing "Select New Machine".

If you run the MAME 0.238 executable without the ROMname, MAME doesn't get past a black screen and hourglass icon before . . . eventually . . . timing out and crashing.   :angry:

Possible labor-intensive workaround:
- For other games, it looks like you can use a .ini file containing "plugins    0" (plugins disabled) and launch the game from a .bat file or a shortcut link without a problem. (tested using Asteroids)


Scott

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #4 on: November 24, 2021, 06:56:09 pm »
Defender directional movement plugin:
https://github.com/BPaden/defenderlr
https://reddit.com/r/MAME/comments/njc019/defender_directional_movement_plugin/
https://drive.google.com/file/d/1kRYwEwyKy_wDicLL9JTlnwOuOlicM5tB/view?usp=sharing
Does anybody have this plugin installed and MAME configured in a way that doesn't cause MAME problems/errors/crashes outside of Defender?   :dizzy:

It does work for Defender in MAME 0.231 and 0.238 if I use the steps below, but "plugins    1" in mame.ini + this plugin enabled can cause problems with games other than Defender (unless the workaround mentioned below works) and AFAIK it will cause problems with MAME's built-in UI.   :banghead:

1. Download MAME and do a fresh install.  I put it in "C:\MAME_defender\".

2. Copy/paste the defender ROM into the roms folder.

3. Download the .zip file for the plugin and copy/paste the defenderlr folder with init.lua and plugin.json files into the plugins folder.

4. Generate a fresh mame.ini ("mame -cc" command) then verify that it contains "plugins    1" and the paths are good for inis and plugins.

5. Make a defender.ini containing "plugin    defenderlr" in either the ini folder or the same folder as the MAME executable.

6. Launch MAME.

7. Enable the defenderlr plugin in the MAME user interface "plugins" menu.

8. Exit MAME.

9. Create a .bat file or shortcut link for "mame defender".  Use that file/link to launch Defender.

If you run the MAME 0.231 executable without the ROMname, MAME's built-in FE throws an annoying error that you can work around it by closing the error window and choosing "Select New Machine".

If you run the MAME 0.238 executable without the ROMname, MAME doesn't get past a black screen and hourglass icon before . . . eventually . . . timing out and crashing.   :angry:

Possible labor-intensive workaround:
- For other games, it looks like you can use a .ini file containing "plugins    0" (plugins disabled) and launch the game from a .bat file or a shortcut link without a problem. (tested using Asteroids)


Scott

I tested OK in mame 0238 when using the plugin files downloaded from github at https://github.com/AaronBPaden/defenderlr.git
Defender plays really well! 
I'm simply launching mame with
Code: [Select]
mame defender -plugin defenderlr
I get problems when using the files downloaded from the Google Drive.  These files appear to be out of date. The author has since made some enhancements on github to verify that you are running the defender rom during initialisation.

Scott - Can you replace with github files and repeat your tests.

« Last Edit: November 24, 2021, 06:58:24 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #5 on: November 24, 2021, 09:43:25 pm »
I get problems when using the files downloaded from the Google Drive.  These files appear to be out of date. The author has since made some enhancements on github to verify that you are running the defender rom during initialisation.

Scott - Can you replace with github files and repeat your tests.
Nice catch, Jon.   :cheers:

Init.lua on the Google Drive is exports.version = '1' and the one on Github is exports.version = '2'.
(Plugin.json from both locations has the same SHA-1 so they are confirmed identical.)

The "Code" button on the https://github.com/AaronBPaden/defenderlr page doesn't seem to work with either of my browsers.   :banghead:

Good news:
By clicking on the filename then on the "Raw" button on the right side just above the first line of code, the file opens in the browser and you can save it.

  https://raw.githubusercontent.com/AaronBPaden/defenderlr/master/init.lua
  SHA-1: 67248D36DE5D72156C2563423D711738320926DD

  https://raw.githubusercontent.com/AaronBPaden/defenderlr/master/plugin.json
  SHA-1: DB56FA79742545F012C08464B17ABBDA65F21110

Mixed news:
Tried the files saved from those links with the command line you posted for Defender.
- As expected, the command line you posted launches the game and plugin.  No custom .ini file needed for this approach.
- If you launch from the MAME built-in FE you'll need the defender.ini file with "plugin    defenderlr".

There are definite improvements in v2 like being able to run the MAME built-in FE by just launching the executable.

There are also definite stability issues, usually when switching between games.
- If you don't change games, it appears to be very stable.   ;D
- When you try to switch to a different game, sometimes it works but sometimes it locks up -- around 50-50 odds.   :dunno
- The instability could also be caused by my e-mail client or browser pages auto-refreshing and bogging things down.
-- I've never seen that cause problems in MAME before, but this old system is getting a bit squirrely.   :embarassed:
- Tomorrow I'll try adding a few more games to see if there's any instability when switching between them or if it's only triggered when Defender and this plugin are involved.


Scott
« Last Edit: November 24, 2021, 09:53:26 pm by PL1 »

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #6 on: November 25, 2021, 08:23:21 am »
Mixed news:
Tried the files saved from those links with the command line you posted for Defender.
- As expected, the command line you posted launches the game and plugin.  No custom .ini file needed for this approach.
- If you launch from the MAME built-in FE you'll need the defender.ini file with "plugin    defenderlr".

There are definite improvements in v2 like being able to run the MAME built-in FE by just launching the executable.

There are also definite stability issues, usually when switching between games.
- If you don't change games, it appears to be very stable.   ;D
- When you try to switch to a different game, sometimes it works but sometimes it locks up -- around 50-50 odds.   :dunno
- The instability could also be caused by my e-mail client or browser pages auto-refreshing and bogging things down.
-- I've never seen that cause problems in MAME before, but this old system is getting a bit squirrely.   :embarassed:
- Tomorrow I'll try adding a few more games to see if there's any instability when switching between them or if it's only triggered when Defender and this plugin are involved.


Scott

I was able to replicate your reported stability issues when switching between games in the mame frontend.
I found this to be due to the input capture routine (input:seq_pressed) still being active after user presses escape key (to exit the game).
I fixed the issue by clearing out input variables and unregistering the frame callback on exit and when starting up a game that is not defender.

Updated plugin files are in the zip.
If you are able to test again Scott and confirm all good.  I will submit my changes to the author so hopefully he can update his git repo.

Jon
« Last Edit: November 25, 2021, 06:24:16 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #7 on: November 25, 2021, 11:43:49 am »
I fixed the issue by clearing out input variables and unregistering the frame callback on exit and when starting up a game that is not defender.

Updated plugin files are in the zip.
If you are able to test again Scott and confirm all good.  I will submit my changes to the author so hopefully he can update his git repo.
:applaud:   :notworthy:   :applaud:   :notworthy:   :applaud:

Confirmed.  Your updated files look rock solid.   :cheers:

I know the "defender.ini" file is really simple, but it wouldn't hurt to include it on the Github.

The other thing that he should have is a Readme.md file to explain the plugin and how to use it for those who are . . . less technically inclined . . . and don't know how the MAME plugin system works.   ;)

Maybe something like this?

The opening is mostly borrowed from his Reddit post here.

One unknown item is whether or not the plugin works with versions of MAME before v0.231.   :dunno
- One Redditor tried it with v0.167, but that version was way too old for some of the features in the script.

Quote
The defenderlr plugin

This plugin is adapted from the original by oomek here and works with MAME [v0.231?] or newer.

It should work with whatever you have configured to act as a joystick with no configuration.

I know someone asks about defender every few months, and I've been meaning to get this working for me for a long time, but I've just now gotten around to it. This makes the game way more playable, though I still prefer Defender II for the 2600. The enemies in the arcade original are pretty devious and dodge your laser gun like alien ninja.

A note about the implementation. I tried to avoid writing to memory by detecting the facing of the player and triggering the reverse button, but it didn't work. While I was able to successfully detect the facing, triggering the reverse button didn't reliably work and I couldn't figure out why. So I fell back to the behavior in the original plugin of writing to memory. There doesn't seem to be any side-effects from casual observation.

Anyway the fact that you can do this with no modifications to mame is pretty cool.

Configuring MAME

Can you launch Defender in MAME?  "mame.exe defender"
- If not, you need to find the correct version of the "defender.zip" ROM file for your version of MAME and put it the "\mame\roms" folder.  (ROM not provided here.)

If you don't already have one, create a mame.ini file using the "mame -cc" (create config) command.
- Open it in Notepad and verify that it contains "plugins    1". (enabled)
Code: [Select]
#
# SCRIPTING OPTIONS
#
autoboot_command         
autoboot_delay            0
autoboot_script           
console                   0
plugins                   1

- Next, check the paths for inis and plugins so you know where to put those files so MAME can find them.
For example, "inipath    .;ini;ini/presets" indicates that MAME will look for ini files in three folders "\mame\", "\mame\ini\", and "\mame\ini\presets\".
Code: [Select]
#
# CORE SEARCH PATH OPTIONS
#
homepath                  .
rompath                   roms
hashpath                  hash
samplepath                samples
artpath                   artwork
ctrlrpath                 ctrlr
inipath                   .;ini;ini/presets
fontpath                  .
cheatpath                 cheat
crosshairpath             crosshair
pluginspath               plugins

Make a "\mame\plugins\defenderlr\" folder.
- Put the init.lua and plugin.json plugin files in that folder.

Make a text file named "defender.ini" in either the ini folder or the same folder as the MAME executable.
-  It should contain the text "plugin    defenderlr".

Enable the defenderlr plugin via the MAME user interface "plugins" menu.
  or
Edit the "plugin.ini" file and change "defenderlr        0" (disabled) to "defenderlr        1". (enabled)
Code: [Select]
#
# PLUGINS OPTIONS
#
autofire                  0
cheat                     0
cheatfind                 0
commonui                  0
console                   0
data                      1
defenderlr                1

Now you're ready to play Defender and blast those pesky aliens.  :)


Scott
« Last Edit: November 25, 2021, 11:46:53 am by PL1 »

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #8 on: November 25, 2021, 12:23:04 pm »
:applaud:   :notworthy:   :applaud:   :notworthy:   :applaud:

Confirmed.  Your updated files look rock solid.   :cheers:

Fantastic!  Thanks for testing.

I know the "defender.ini" file is really simple, but it wouldn't hurt to include it on the Github.

The other thing that he should have is a Readme.md file to explain the plugin and how to use it for those who are . . . less technically inclined . . . and don't know how the MAME plugin system works.   ;)

Maybe something like this?

The opening is mostly borrowed from his Reddit post here.

Yes,  the readme and ini files will be a great help to most.  Thanks for pulling them together.

One unknown item is whether or not the plugin works with versions of MAME before v0.231.   :dunno
- One Redditor tried it with v0.167, but that version was way too old for some of the features in the script.

Compatibility should be possible back to v0.196 but a tweak will be required for that.  I discovered this myself when building the LUA interface for my DK frontend.
We must account for a change to MAME's LUA data structures when initialising the machine.

Instead of:

Code: [Select]
input = manager.machine.input
ioport = manager.machine.ioport
memory = manager.machine.devices[':maincpu'].spaces['program']

We need to run a version check and also check the userdata structure (since this changed ~v0.227 too!).  Also nice to output a warning if it's not going to work (pre v0.196).  Something like this should work.

Code: [Select]
if tonumber(emu.app_version()) >= 0.196 then
if type(manager.machine) == "userdata" then
mac = manager.machine
else
mac =  manager:machine()
end
input = mac.input
ioport = mac.ioport
memory = mac.devices[':maincpu'].spaces['program']
else
print("ERROR: This plugin requires MAME version 0.196 or greater.")
end

I have a test system set up already for 0.196, 0.227 and 0.238 so will verify against them all.  If that's good then i'll post the updated plugin here and sync with the author on github.

Jon
« Last Edit: November 25, 2021, 12:28:27 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #9 on: November 25, 2021, 06:23:14 pm »
The updated defenderlr plugin is attached and is bundled with the readme file as prepared by PL1.
This is a stability fix to ensure the plugin does not lockup on exit or when switching games in the MAME frontend.

I can verify that the plugin will work with MAME v0.227 and greater.  To go back to v0.196 would require some work as some of the key LUA functionality was not available in the earlier versions (i.e. type_seq).  I don't want to start hacking up the code further so have let it be at that.

I'm pleased to have stumbled across this Defender plugin.   It's a much nicer way to control the ship.
Thanks to Scott for his thorough (as usual) breakdown of the issue.

Edit - I have messaged Aaron (the author of defenderlr) with the hope that he will merge my changes and the readme from PL1. 

Jon
« Last Edit: November 25, 2021, 06:46:31 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #10 on: November 27, 2021, 06:55:25 am »
Good news. Aaron has accepted our changes to the defenderlr plug-in and his repository is updated.  Version is now 3.

https://github.com/AaronBPaden/defenderlr

Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #11 on: November 29, 2021, 04:38:18 am »
Good news. Aaron has accepted our changes to the defenderlr plug-in and his repository is updated.  Version is now 3.

https://github.com/AaronBPaden/defenderlr
Finally got a chance to update and test.  Everything works great!   :applaud:

I tried to adapt it for Stargate by copying the plugin files to a "stargatelr" folder and changing "defender" to "stargate" in the .json and .lua files -- and it half-way worked!   :lol    :w00t
- Left and right on the joystick trigger thrust, but they do not reverse direction.

I figure that this is either due to a change in the default button/keystroke for reverse (Z for Defender vs. Shift for Stargate) or a change in the memory location "FACING_ADDRESS = 0xA0BB". (line 28 of the .lua)

What do you think, Jon?


Scott

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #12 on: November 29, 2021, 06:00:51 am »
Finally got a chance to update and test.  Everything works great!   :applaud:

Yay!  thanks for confirming Scott.

I tried to adapt it for Stargate by copying the plugin files to a "stargatelr" folder and changing "defender" to "stargate" in the .json and .lua files -- and it half-way worked!   :lol    :w00t
- Left and right on the joystick trigger thrust, but they do not reverse direction.

I figure that this is either due to a change in the default button/keystroke for reverse (Z for Defender vs. Shift for Stargate) or a change in the memory location "FACING_ADDRESS = 0xA0BB". (line 28 of the .lua)

What do you think, Jon?

It's the facing address.  If you set that to "FACING_ADDRESS = 0x9C92" then it should work for you.  If that's all good then I could merge the stargate into defenderlr so we are only maintaining one plugin.
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #13 on: November 29, 2021, 06:37:28 am »
It's the facing address.  If you set that to "FACING_ADDRESS = 0x9C92" then it should work for you.  If that's all good then I could merge the stargate into defenderlr so we are only maintaining one plugin.
With that address change, everything appears to work fine in my copied/edited version of the plugin.   :cheers:


Scott

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #14 on: November 29, 2021, 09:02:07 am »
With that address change, everything appears to work fine in my copied/edited version of the plugin.   :cheers:

Great  stuff  :cheers:

I have merged the stargate change into defenderlr and tested ok.   Plugin version is now 4.0.  I have sent a request to Aaron to update his original git repo.

I made a fork so you can easily grab the files for the v4 release in a zip at: https://github.com/10yard/defenderlr/releases

Jon
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #15 on: November 29, 2021, 09:15:41 am »
Noticed your latest pull request on Aaron's Github.

You may also want to make these changes to Readme.md.

Change 1:
Quote
Can you launch Defender in MAME? "mame.exe defender" - If not, you need to find the correct version of the "defender.zip" ROM file for your version of MAME and put it the "\mame\roms" folder. (ROM not provided here.)
to
Quote
Can you launch Defender and Stargate in MAME? "mame.exe defender" and "mame.exe stargate" - If not, you need to find the correct version of the "defender.zip" and "stargate.zip" ROM files for your version of MAME and put them the "\mame\roms" folder. (ROMs not provided here.)

Change 2:
Quote
Make a text file named "defender.ini" in either the ini folder or the same folder as the MAME executable. - It should contain the text "plugin defenderlr".
to
Quote
Make text files named "defender.ini" and "stargate.ini" in either the ini folder or the same folder as the MAME executable. - They should contain the text "plugin defenderlr".

Change 3:
Quote
Now you're ready to play Defender and blast those pesky aliens.
to
Quote
Now you're ready to play Defender or Stargate and blast those pesky aliens.

I have merged the stargate change into defenderlr and tested ok.   Plugin version is now 4.0.  I have sent a request to Aaron to update his original git repo.

I made a fork so you can easily grab the files for the v4 release in a zip at: https://github.com/10yard/defenderlr/releases
I'll try them now.   ;D


Scott
EDIT: Merged version works great.   ;D
« Last Edit: November 29, 2021, 09:28:55 am by PL1 »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #16 on: December 02, 2021, 11:51:58 pm »
Cleaned up the Readme.md file using Wordpad.
- Made the changes mentioned above.
- Added link to Oomek's original plugin thread to "the original by oomek here ".
- Reworded a few lines for better flow.
- Added step numbers to the Configuring MAME section so it's easier to keep track of where you are in the process.
- Put all commands and settings in single quotes (') so they show up in a grey box on Github.
- Put all folders and filenames and folders in double quotes. (")
- Added spaces in the .ini file quote sections so they look more like actual .ini files.
-- The right column entries line up in Wordpad, but not in Notepad.   :banghead:
-- The alignment may need to be tweaked using Github's file editor.   :dunno


Scott

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #17 on: December 03, 2021, 04:50:34 am »
Thank you muchly Scott  :cheers:

Outside of github I tend to use https://stackedit.io/ for editing/reviewing markdown.
I made a tweak to your latest readme to emphasise code blocks using ``` tags.  Can you review it using above link?  You will need to click on "Start Writing" and then paste the text into the left pane.  If that's all good with you then I will send Aaron another pull request.
 
Jon
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #18 on: December 03, 2021, 08:06:42 am »
Outside of github I tend to use https://stackedit.io/ for editing/reviewing markdown.
That one doesn't play well with my browser, but this one does.   ;D
https://markdown-editor.github.io/

I made a tweak to your latest readme to emphasise code blocks using ``` tags.
Just figured out what I was doing wrong.   :lol

I used the single-quote ' (un-shifted " key) next to the ENTER key instead of the backtick ` (un-shifted ~ key) next to the ESC key.   :embarassed:

I understand why you would use a ``` (fenced code block) tag for multi-line .ini file content, but why use it instead of a ` (code) tag for the inline commands and settings?
- You used single backtick code tags lots of times for inline code in your DKAFE Readme.md file.

If that's all good with you then I will send Aaron another pull request.
Line 18: Add double quotes around mame.ini. (all other filenames have them)
  Change
Quote
2. If you don't already have one, create a mame.ini file using the ```mame -cc``` (create config) command.
  to
Quote
2. If you don't already have one, create a "mame.ini" file using the ```mame -cc``` (create config) command.
----------------------
Add a blank line between lines 15 and 16 so current line 16 renders as a paragraph like current line 20 does.
----------------------
Line 15:
- Change the single-quotes to backticks -- your choice single (code tag, shown) or triple. (fenced code block tag)
- Delete the second question mark (you're stating the correct commands to launch the games) or put the second half of the line in one set of parentheses or put the command after the game name.
  Change
Quote
1. Can you launch Defender and Stargate in MAME? 'mame.exe defender' and 'mame.exe stargate'?
  to
Quote
1. Can you launch Defender and Stargate in MAME? `mame.exe defender` and `mame.exe stargate`
  or
Quote
1. Can you launch Defender and Stargate in MAME? (`mame.exe defender` and `mame.exe stargate`)
  or
Quote
1. Can you launch Defender (`mame.exe defender`) and Stargate  (`mame.exe stargate`) in MAME?

The only remaining odd rendering is on lines 20, 35, 60, and 66 where the multiple spaces like "defenderlr    0" are auto-formatted to a single space like "defenderlr 0" -- not sure if it's possible to change this.   :dunno


Scott
« Last Edit: December 03, 2021, 08:46:48 am by PL1 »

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #19 on: December 04, 2021, 04:28:16 am »
Quote from: PL1
Just figured out what I was doing wrong.   :lol

I used the single-quote ' (un-shifted " key) next to the ENTER key instead of the backtick ` (un-shifted ~ key) next to the ESC key.   :embarassed:

I understand why you would use a ``` (fenced code block) tag for multi-line .ini file content, but why use it instead of a ` (code) tag for the inline commands and settings?
- You used single backtick code tags lots of times for inline code in your DKAFE Readme.md file.

Yes,  it's the back tick for quotes.  That was just a brain fart from me.  I'd forgotten that you can use a single one for inline comments. :lol   

Quote from: PL1
Line 18: Add double quotes around mame.ini. (all other filenames have them)
  Change
Quote
2. If you don't already have one, create a mame.ini file using the ```mame -cc``` (create config) command.
  to
Quote
2. If you don't already have one, create a "mame.ini" file using the ```mame -cc``` (create config) command.
----------------------
Add a blank line between lines 15 and 16 so current line 16 renders as a paragraph like current line 20 does.
----------------------
Line 15:
- Change the single-quotes to backticks -- your choice single (code tag, shown) or triple. (fenced code block tag)
- Delete the second question mark (you're stating the correct commands to launch the games) or put the second half of the line in one set of parentheses or put the command after the game name.
  Change
Quote
1. Can you launch Defender and Stargate in MAME? 'mame.exe defender' and 'mame.exe stargate'?
  to
Quote
1. Can you launch Defender and Stargate in MAME? `mame.exe defender` and `mame.exe stargate`
  or
Quote
1. Can you launch Defender and Stargate in MAME? (`mame.exe defender` and `mame.exe stargate`)
  or
Quote
1. Can you launch Defender (`mame.exe defender`) and Stargate  (`mame.exe stargate`) in MAME?

The only remaining odd rendering is on lines 20, 35, 60, and 66 where the multiple spaces like "defenderlr    0" are auto-formatted to a single space like "defenderlr 0" -- not sure if it's possible to change this.   :dunno

Unfortunately, multiple/tab spaces for inline code are not supported.  Otherwise,  all was updated. 

Thanks for being so thorough! 

I've sent another pull request to Aaron.


Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #20 on: December 04, 2021, 06:19:49 am »
Thanks for being so thorough! 
Thanks for all your help with Github.   :cheers:

Seems like there are always typos that slip through -- just noticed that there's no step 3.   :embarassed:   :lol
- Line 55 should be step 3, not step 4.
- Line 59 should be step 4, not step 5.
- Line 63 should be step 5, not step 6.

Everything else looks rock solid.   ;D


Scott

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #21 on: February 23, 2022, 01:34:28 am »
Typos fixed in the defenderlr plugin readme.  Thanks, Jon and Aaron.   :cheers:

Please consider updating the description of the plugin, Stiletto.

Current description:
Defender directional movement plugin:
https://github.com/BPaden/defenderlr
https://reddit.com/r/MAME/comments/njc019/defender_directional_movement_plugin/
https://drive.google.com/file/d/1kRYwEwyKy_wDicLL9JTlnwOuOlicM5tB/view?usp=sharing

Suggested updates:
- Mention support for Stargate.
- The useful info from the Reddit thread is now included in the readme file on Github so the Reddit link is not needed.
- The Google Drive link is to an outdated version.
Quote
Defender and Stargate directional movement plugin:
https://github.com/BPaden/defenderlr


Scott

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9393
  • Last login:Today at 02:54:41 am
  • Designated spam hunter
Re: MAME scripty things!
« Reply #22 on: August 23, 2023, 02:19:38 pm »
MAME recently updated the LUA script system.

Tried to get Aaron's updated defenderlr script working in v0.254 using the steps in the readme, but no luck.

I also tried it using a fresh install of v0.257.

Any idea what I'm doing wrong or how to get the script working?


Scott
EDIT: Here's the output from running "mame defender -verbose > verbose.txt" from command line.
Code: [Select]
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of raster.ini
Parsing raster.ini
Attempting load of source\williams.ini
Attempting load of defender.ini
Parsing defender.ini
Loading translation file language\English\strings.mo
Reading translation file: 1 strings, original table at word offset 7, translated table at word offset 9
Loaded 0 translated string from file
Starting plugin data...
Starting plugin defenderlr...
Attempting load of mame.ini
Parsing mame.ini
Attempting load of mame.ini
Parsing mame.ini
Attempting load of horizont.ini
Attempting load of raster.ini
Parsing raster.ini
Attempting load of source\williams.ini
Attempting load of defender.ini
Parsing defender.ini
Video: Monitor 65537 = "\\.\DISPLAY1" (primary)
Direct3D: Using Direct3D 9
Physical width 1360, height 768
Direct3D: Initialize
Direct3D: Configuring adapter #0 = NVIDIA GeForce GT 630
Direct3D: YUV format = RGB
Direct3D: Max texture size = 16384x16384
Direct3D: Device created at 1360x768
Direct3D: Initialize HLSL
Direct3D: First store options
Direct3D: HLSL initialized
DirectSound: Primary buffer: 48000 Hz, 16 bits, 2 channels
Input: Adding keyboard #1: HID Keyboard Device (device id: \\?\HID#VID_21F8&PID_208A&MI_00&Col02#8&2b022778&0&0001#{884b96c3-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding keyboard #2: HID Keyboard Device (device id: \\?\HID#VID_21F8&PID_208A&MI_02#8&1eee75fb&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding mouse #1: HID-compliant mouse (device id: \\?\HID#VID_21F8&PID_208A&MI_01&Col01#8&72ae9b6&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
Input: Adding lightgun #1: HID-compliant mouse (device id: \\?\HID#VID_21F8&PID_208A&MI_01&Col01#8&72ae9b6&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd})
unzip: opened archive file roms\defender.zip
unzip: found roms\defender.zip ECD at 980
unzip: roms\defender.zip has no ZIP64 ECD locator
unzip: read roms\defender.zip central directory
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
unzip: found roms\defender.zip in cache
unzip: opened archive file roms\defender.zip
unzip: closing archive file roms\defender.zip and sending to cache
Optional device ':pia_3' not found
Optional memory bank ':mainbank' not found
Optional memory region ':nvram' not found
Optional memory region ':screen' not found
Starting Defender (Red label) ':'
  (missing dependencies; rescheduling)
Starting Motorola MC6809E ':maincpu'
Starting Motorola MC6808 ':soundcpu'
Starting NVRAM ':nvram'
Starting Timer ':scan_timer'
Starting Timer ':240_timer'
Starting Watchdog Timer ':watchdog'
Starting Video Screen ':screen'
Starting palette ':palette'
Starting Speaker ':speaker'
  (missing dependencies; rescheduling)
Starting MC1408 DAC ':dac'
Starting Input Merger (any high) ':mainirq'
Starting Input Merger (any high) ':soundirq'
Starting 6821 PIA ':pia_0'
Starting 6821 PIA ':pia_1'
Starting 6821 PIA ':pia_2'
Starting Address Map Bank ':bankc000'
Starting Defender (Red label) ':'
  (missing dependencies; rescheduling)
Starting Speaker ':speaker'
Starting Defender (Red label) ':'
Attempting to parse: default.cfg
Attempting to parse: defender.cfg
Average speed: 100.00% (11 seconds)
Sound: buffer overflows=2 underflows=0

EDIT2: The script works when you launch MAME using "mame defender -plugin defenderlr", but it doesn't work when launched from MAME's built-in FE or if you change games.   :dizzy:

EDIT3: Confirmed that 10yard's version 4 of the script is working in MAME v0.262 when launched from command line or MAME's built-in FE, and also when you change between Defender and Stargate.  Not sure why Aaron's version wasn't working with MAME v0.254 or 0.257.   :dunno
« Last Edit: March 26, 2024, 07:56:32 am by PL1 »

Begbie80

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:Yesterday at 11:22:31 pm
Re: MAME scripty things!
« Reply #23 on: March 25, 2024, 11:10:09 pm »
I also had no more luck with an install of mame 263 other than the workaround suggested (running from the command line). Hope there is a work around or update as this makes one of the most brutally difficult arcade games a little more  accessible

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 137
  • Last login:Today at 03:48:47 am
  • L BREAK into program
    • DKAFE Frontend
Re: MAME scripty things!
« Reply #24 on: March 26, 2024, 05:47:31 am »
I also had no more luck with an install of mame 263 other than the workaround suggested (running from the command line). Hope there is a work around or update as this makes one of the most brutally difficult arcade games a little more  accessible

I've tested my fork version of the defenderlr plugin (from 2021) and all seems to be working with MAME 0.263 including when switching between roms. 
There are deprecation warnings (for start/end callbacks) but this should not effect use and retains compatibility back to MAME 0.227

Download link:
https://github.com/10yard/defenderlr/releases/download/v4/defenderlr_v4.zip
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


Begbie80

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:Yesterday at 11:22:31 pm
Re: MAME scripty things!
« Reply #25 on: March 26, 2024, 11:23:29 pm »
Thanks! It is working for me now! Looks like my init.lua wasn't the same (thought I had the latest from the github but I guess I didn't).

I also had no more luck with an install of mame 263 other than the workaround suggested (running from the command line). Hope there is a work around or update as this makes one of the most brutally difficult arcade games a little more  accessible

I've tested my fork version of the defenderlr plugin (from 2021) and all seems to be working with MAME 0.263 including when switching between roms. 
There are deprecation warnings (for start/end callbacks) but this should not effect use and retains compatibility back to MAME 0.227

Download link:
https://github.com/10yard/defenderlr/releases/download/v4/defenderlr_v4.zip