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 saving credits in certain games  (Read 4336 times)

0 Members and 1 Guest are viewing this topic.

Max_FS

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 35
  • Last login:November 09, 2023, 03:45:06 pm
  • I want to build my own arcade controls!
MAME saving credits in certain games
« on: October 29, 2020, 01:51:18 pm »
There are some games in mame saving credits even after leaving the game and the emulator, for example tapper and timber. That's not a big problem at all, but maybe some of us (like me) prefer to start a game without credits. It seems there was some discussion about it (also in this forum and many years ago) but I did not find a solution to the problem except some clue that the information was stored in the NVRAM files in mame/nvram folder.

If anybody is interested in a workaround that works for me you may read further.

Step 1:
Get a hex editor with command line functionality, I use Hexciting.
Find out, where the credit information is stored. I did it for timber and tapper.

Step 2:
Create a batch-file. For use with Hexciting and the games timber and tapper it would look like this:

Quote
@ECHO OFF

IF %1==timber (
hexciting -a -r 0x11 0x12 C:\emu\mame\nvram\timber\nvram 00
)

IF %1==tapper (
hexciting -a -r 0x11 0x12 C:\emu\mame\nvram\tapper\nvram 00
)

mame64.exe %1


Explanation of the command line:
a: performs an AND-Operation
r: the range of bits where the credit information is stored (I found the information at 0x11 but still I had to write 0x11 0x12)
C:\...: path of the certain NVRAM-file
00: setting the credits to 0

Step 3:
Tell your frontend to start that batch-file instead of mame.

For me this works surprisingly good. Maybe it is of use for someone else.
And if someone knows of other games saving credits, I am interested to hear about.

Max_FS

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 35
  • Last login:November 09, 2023, 03:45:06 pm
  • I want to build my own arcade controls!
Re: MAME saving credits in certain games
« Reply #1 on: February 12, 2021, 11:16:47 am »
In some games one has to modify more than one line.
For Zookeeper (zookeep) it would be as follows:

hexciting -a -r 0x247 0x248 C:\emu\mame\nvram\zookeep\nvram 00
hexciting -a -r 0x249 0x24A C:\emu\mame\nvram\zookeep\nvram 00
hexciting -a -r 0x24B 0x24C C:\emu\mame\nvram\zookeep\nvram 00
hexciting -a -r 0x251 0x252 C:\emu\mame\nvram\zookeep\nvram 00

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: MAME saving credits in certain games
« Reply #2 on: February 12, 2021, 06:59:59 pm »
According to Hexciting's built-in help, the range start is inclusive, but the range end is exclusive. So if you want to change one byte, you specify that one as the start, which is included, and the next one as the end, which is excluded. You're not writing both bytes with your data.

Since your data byte is decimal (unless you prefix it with 0x), there's no need to use double 0. It doesn't hurt, but it might make someone think that's hex when they try to modify your command for their own use.

With Zookeeper, did you find a need to change all those bytes? They do seem to change, but they're not always the same as the number of coins, especially when you start throwing dollars in. In my testing, 0x0247 was sufficient.

If you wanted one command for Zookeeper with your data, since you're ANDing, you could use
hexciting -a -r 0x247 0x252 nvram 0 255 0 255 0 255 255 255 255 255 0

Max_FS

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 35
  • Last login:November 09, 2023, 03:45:06 pm
  • I want to build my own arcade controls!
Re: MAME saving credits in certain games
« Reply #3 on: February 13, 2021, 03:23:17 am »
Good point. In my testing, it always changed all four bytes according to the number of credits. I tried resetting single bytes but it did not work. However, it seems I forgot 0x0247 when doing that so my conclusion was I have to reset four bytes. But in the end you are right, it is sufficient to reset 0x0247.

And many thanks for the explanations. I am not very familiar with hex editing at all and I found the solution by playing around with it but did not really understand what was happening :D

Max_FS

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 35
  • Last login:November 09, 2023, 03:45:06 pm
  • I want to build my own arcade controls!
Re: MAME saving credits in certain games
« Reply #4 on: January 06, 2022, 02:45:12 pm »
Here are some new additions:

Domino Man:

IF %1==domino (
hexciting -a -r 0x11 0x12 C:\emu\mame\nvram\domino\nvram 00
)

Defender:

IF %1==defender (
hexciting -a -r 0x7E 0x7F C:\emu\mame\nvram\defender\nvram 240
)

Stargate:

IF %1==stargate (
hexciting -a -r 0x101 0x102 C:\emu\mame\nvram\stargate\nvram 240
)

abispac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1497
  • Last login:March 27, 2024, 01:01:09 pm
Re: MAME saving credits in certain games
« Reply #5 on: January 06, 2022, 09:19:24 pm »
An ezyer work around would be, find wich games save the credits, exit game with 0 credits on it,exit mame, go to the nvram folder,find the nvram file for that game, set properties to read only and thats it, the game wont be able to save the credits after you exit the game.

Max_FS

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 35
  • Last login:November 09, 2023, 03:45:06 pm
  • I want to build my own arcade controls!
Re: MAME saving credits in certain games
« Reply #6 on: January 07, 2022, 01:13:34 am »
You are right, that seems to be much easier :-D
I was not sure if there are other things that have to be saved in NVRAM, so I tried it the way as I described above.

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4412
  • Last login:Yesterday at 10:40:50 pm
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: MAME saving credits in certain games
« Reply #7 on: January 07, 2022, 11:46:24 am »
some games use NVram to store hiscores also.

if you don't care about the hiscores, then you can put a Read only Attribute of the nvram file.

or delete it everytime you execute the game or exit.
« Last Edit: January 07, 2022, 11:47:56 am by Thenasty »
Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0