Skip to content

MAME/MESS VGM mod

Current version: 0.256 (released on 2023-06-28)

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

MAME/MESS VGM mod

Post by RandomName »

The fix allowed MAME/MESS VGM mod to compile completely with both GCC and Clang. But when enabling vgmwrite, the GCC build exits with

Code: Select all

*** buffer overflow detected ***: mame terminated
Aborted (core dumped)
Luckily, the Clang build works with vgmwrite enabled. I was able to record a VGM from adlib tracker 2 DOS version 2.3.56 using the following MAME command line.

Code: Select all

mame ct486 -ramsize 16M -isa1 svga_et4k -isa2 sblaster_16 -hard1 dos622.chd -flop1 floppy.ima
  • User avatar
  • LuNiney Offline
  • Posts: 24
  • Joined: 2018-06-08, 5:33:59

Post by LuNiney »

I'd like to report an issue in the dumping of DMG-CPU VGMs - There is a high chance that the Programmable Waveform can be altered mid-song.
The alteration of the wave causes one note to sound completely different, but then it fixes itself in the next note.
However, it gets even worse after optimizing with ValleyBell's vgm_cmp.exe. The alteration becomes permanent.
Examples:
VGMissue.zip
(112.81 KiB) Downloaded 687 times
Example 1 is the raw VGM dump (can be trimmed too)
Example 2 is the VGM after being compressed with vgm_cmp.exe

And to add, (this isn't a report, but rather a suggestion...)
Since the beginning, MAME/MESS was already one of the most inaccurate multi-emulators to go to...
And in my honest opinion, it is one of the least user friendly emulators as well.

I'd heavily consider investing in figuring out how to implement VGM dumping in TASVideos' BizHawk, which is an emulator focusing on accuracy.
Or at least, RetroArch with its Libretro cores.
If any of that is possible, of course... but I'd still look into the issue I pointed out.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

1. You shouldn't use vgm_cmp for gameboy VGMs. The latest version of vgm_cmp disables optimization completely for gameboy due to some problems in the process. And 'raw' VGMs without optimization may sound better if the emulation in vgmplay itself is improved (though see the following points)
2. Gameboy is a bit special since some registers are changed by the sound chip and modified by the CPU at the same time, though I believe logging problems caused by this have been fixed at this point.
3. Both bizhawk and retroarch are just frontends, the emulators are separate projects and the interface is quite rigid anyway, there is no way to easily add VGM logging except in the stand alone emulators.
4. Have you tried the latest versions of MAME and NEZPlug?
5. Have you tried the latest version of VGMPlay?
6. Try the chatbox if you don't get a response in the forums, instead of just reposting the issue in every subforum.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

1. Actually the fixed vgm_cmp is hidden in one of the later posts in the VGM tool topic, so he isn't really to blame.

2./4./5. Logging and replaying problems with GameBoy VGMs should be fixed in MAME 0.200 (GB sound emulation got fixed in 0.179) and VGMPlay 0.40.8.

3. I don't consider modding BizHawk/RetroArch indeed because they just include multiple emulator cores and I would have to separately modify each of them. (E.g. if there is an emulation core for Sega Master System and another one for MegaDrive, I need to add PSG logging separately to each of them.)
For this reason, I modded VBjin instead of Mednafen, for example.
MAME has the advantage of being the first emulator I modded. And everything is structured in a way that makes modding easier than it is with those multi-core emulators.

I agree that MAME is often a bit lacking when it comes to accuracy though. Especially things that depend on cycle timing seem off.
  • User avatar
  • LuNiney Offline
  • Posts: 24
  • Joined: 2018-06-08, 5:33:59

Post by LuNiney »

ValleyBell wrote:1. Actually the fixed vgm_cmp is hidden in one of the later posts in the VGM tool topic, so he isn't really to blame.

2./4./5. Logging and replaying problems with GameBoy VGMs should be fixed in MAME 0.200 (GB sound emulation got fixed in 0.179) and VGMPlay 0.40.8.

3. I don't consider modding BizHawk/RetroArch indeed because they just include multiple emulator cores and I would have to separately modify each of them. (E.g. if there is an emulation core for Sega Master System and another one for MegaDrive, I need to add PSG logging separately to each of them.)
For this reason, I modded VBjin instead of Mednafen, for example.
MAME has the advantage of being the first emulator I modded. And everything is structured in a way that makes modding easier than it is with those multi-core emulators.

I agree that MAME is often a bit lacking when it comes to accuracy though. Especially things that depend on cycle timing seem off.
Thanks for the reply!
However, I updated VGMPlay AND used MAME 0.200 to log, but I'm still getting sound issues.
If you want to investigate what might be causing it the VGM with the issue is in this thread:
http://vgmrips.net/forum/viewtopic.php? ... 66&p=10160
  • roughana Offline
  • Posts: 6
  • Joined: 2019-11-10, 22:54:35

Tutorial for MAME rip?

Post by roughana »

Hi all, I've just started looking around and haven't found any instructions on how to rip from MAME yet. I think the tutorial section would be a great place to find one.
I'm new to MAME too so something really intro level would be appreciated.
If something exists already, please point me there.
Thanks!
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

To start logging with MAME, it's easy as this:

- Run MAME with the "-vgmwrite" parameter or with "vgmwrite 1" in mame.ini
- Play a game
- a vgm file is written in the MAME executable's directory.

If you want to make a VGM pack, ask us in the chatbox and we can help you (when we have time).
  • roughana Offline
  • Posts: 6
  • Joined: 2019-11-10, 22:54:35

Post by roughana »

ok, thanks for the pointer.

The -vgmwrite parameter takes an argument and there's no indication what this should be. I assumed a filename.
I started my game and then killed MAME process to end it (and used UI - ESCape as an alternative) and there was no file written in the mame directory that I started from. Does it write somewhere else?

So I'm still in need of further assistance.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

It's a number, actually. 0 = no logging, 1 = enable logging
It's a bit more obvious if you run MAME with "-createconfig" and look at the "mame.ini" it writes.
Editing mame.ini also has the advantage of being able to enable logging permanently when doing multiple logs. Just make sure to rename the files before restarting MAME, because it will overwrite them.
  • roughana Offline
  • Posts: 6
  • Joined: 2019-11-10, 22:54:35

Post by roughana »

Thanks. I did try to followup with my success but my reply didn't stick for some reason. Yes, the command line parameter is numeric and the file gets logged in the current directory.
I've continued on to rip and split the tracks to create my first pack.

Post by slickmandela »

Are there any builds of the MAME use to log VGMs for Mac? I'm thinking something akin to the builds at https://sdlmame.lngn.net/
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

I'm afraid you're on your own when it comes to Linux and Mac MAME builds with VGM logging support.
I don't have a Mac, so I can not do any Mac builds.

Post by slickmandela »

Rats, I was hoping to take a crack at this. There are so many sets not yet submitted- nobody's fault of course, since there are literally thousands of arcade machines.

Post by Mao (RN22) »

k054539 doesn't play while im logging violent storm
To-Do list:
?

Current Status: I could only upload 5 VGM packs per VB's stream.
Tempo: 105.95%
Pitch: +1.00

Better Call Mao!

Image

Please, check my WIP list for more updates.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

With a few years of delay, here it is finally: MAME VGM mod 0.222, see OP.

Compared to MAME 0.200 it is a lot more stable. Not everything is working perfectly though:
  • The inability to log NES DPCM data from MAME 0.200 remains though.
  • C140 ripping is semi-broken, as the way banking works has changed.
  • C219 lacks the sample data, as it uses the main CPU's RAM for sample data and that is not captured currently.
Happy ripping!
Post Reply