How to configure X68k system in MAME?

Long story short: got tired of px68k not supporting MIDI and saw that X68k emulation in MAME is getting damn good. So as of right now I’ve finally managed to boot into the games, the lack of up-to-date documentation about the process having been my biggest gripe. Where I’m stuck is I have no idea where the settings are saved, if they save at all, and how to go about properly setting things up to begin with.

Basically

  • Games boot displaying both the game itself and the LEDs of the emulated machine. I can sort this out by going into the MAME menu and fiddling with the video options. These don’t seem to save, at all.
  • I have no idea whether the video option 4:3 or ‘Pixel Aspect 3/2’ corresponds to actual pixel-perfect output. The latter should be correct, but the former looks more correct. Also don’t understand the ‘Non-integer scale’ option, as it doesn’t seem to affect anything.
  • I’d like to hook up my MIDI synths like MUNT and SC VA. I can set up MIDI out as an expansion card through the MAME menu, and this setting I’ve managed to save (!) somehow, but that doesn’t get me very far. Wish I knew if and where these things get stored as text.

If anybody’s got a working setup, please inform me of things like important core options, relevant folders and files etc.

Also, I understand only the original 68000 BIOS has good support in MAME. How do I go about playing more demanding games like Mahou Daisakusen? Is overclocking viable?

Thank you in advance!

Yeah midi on pk68k would be great… but at least games are playing well (with fm), I just gave Mahou Daisakusen a shot and it works well… I cannot help with the mame config, I did delve into the whole mame SL yet, hopefully somebody can help with that! pls if you solve it update this post!

yo dawg, i heard u liked midi in ur x68k games, so…

performance (both video and audio) is choppy in the footage due to the overhead of obs recording, combined with low latency retroarch settings and munt doing midi synth, all being too much for my current crappy laptop to handle. when not recording it runs perfectly and sounds spot on

still gotta clean up the code bit but was able to getting working after having to learn a little bit about how the midi format works and banging my head against the px68k-libretro codebase for a while, expect a pull request in the coming days

relevant performance/throttle settings used when recording the above footage:

retroarch.cfg:

video_driver = "gl"
video_hard_sync = "true"
video_hard_sync_frames = "0"
vrr_runloop_enable = "true"

PX68K.opt:

px68k_adjust_frame_rates = "disabled"
px68k_audio_desync_hack = "enabled"
px68k_cpuspeed = "16Mhz"
px68k_no_wait_mode = "enabled"
px68k_push_video_before_audio = "enabled"
7 Likes

Great stuff man! can’t wait to try!

Edit. Also I’m still on an older version of the core because the latest from the online updater still doesn’t work for me (it crashes on loading game…), does anybody have any news?

1 Like

Holy crap, that is awesome! Looking forward to that PR!

Also I’m still on an older version of the core because the latest from the online updater still doesn’t work for me (it crashes on loading game…), does anybody have any news?

Same boat, I hope @e-tank has taken this into account since I assume they’re using the latest version.

EDIT Ooooor they’re on Linux…

1 Like

Ya, i’m on linux and was unaware of this issue since it works fine here. i did some digging and found a bunch of ppl have reported on the issue and from what i can see the problem lies in the c68k cpu core not being compatible/having probs with ASLR, which is now the default for building on windows (i’ll post the links at the end of this post relating to this issue if anyone wants to take a stab at it)

since i don’t have access to a windows build env it’s not something i could easily try and fix myself, plus i’d rather not EVER have to touch that c68k cpu core, not even with a 10 foot programming pole made up of old rolled up copies of K&R C. so instead i just haphazardly popped in the musashi 68k cpu core (pulled from neocd_libretro, an AMAZINGLY well written emulator btw, unlike px68k, unfortunately…) and made it the default instead. it seems to work just fine for me, i could use help so anyone who can compile on windows pls try this out and see if it helps:

resources for anyone wanting to try to fix up c68k in px68-libretro:

https://github.com/libretro/px68k-libretro/issues/151

https://github.com/libretro/px68k-libretro/issues/150

https://github.com/libretro/px68k-libretro/issues/147

https://github.com/libretro/picodrive/issues/184

https://github.com/libretro/picodrive/commit/a704c216bacc5bd0ac3894fe72f8cf66839b6191

btw, how did yabause come away unscathed from this problem?! from what i can see it uses the same exact cpu core. weird.

2 Likes

Just built and tried out your code, and it works just fine! Now I’m eager to see where you take this! :grin:

2 Likes

Yep, built the musashi branch and it doesn’t crash with my minimal RetroArch Windows build. Even the older buildbot version of the core crashes with my RA builds.

Nice work!

1 Like

Are we going to have it also from the online updater eventually?

we did it gamers. thank u both @DukeSkinny and @Awakened for ur work, i’ll go ahead and pull request this branch rn so ppl can start using it asap

5 Likes

The pull request was merged, so it should be on there soon.

@e-tank BTW, would it be hard to improve the FM synth emulation in px68k? It’s not bad, but I’ve noticed some instruments are a little harsh in Akumajou Dracula. I wonder if something like Nuked-OPM could be added (possibly as a core option, since it would likely be slower because it’s cycle accurate): https://github.com/nukeykt/Nuked-OPM

2 Likes

What minimal RA build is, you have your own custom build without all features, like a lite version or something?

Yay! Great news! please let us know when we can unlock the old core and update!

You could do that right now. It’s all set. Only thing missing now is the MIDI support.

1 Like

Just did and finished akumajou dracula to test it out! XD I guess when Midi will be available I’ll do it again! :partying_face: :partying_face: :partying_face:

5 Likes

Yeah, you can disable lots of features when compiling to make the .exe smaller and require way less .dll files. I have a Github Actions script that I can trigger to compile my minimal builds whenever: https://github.com/Awakened0/RetroArch-Minimal-Builds

I finished it with the updated core too. I was playing the “Akumajou Dracula (1993)(Konami)(Disk 1 of 2)[a]” variant from the TOSEC set, where first stage enemies do 2 damage and later ones do 4. Pretty brutal. The non-[a] variant might have a trainer patched into it, since everything does 1 damage. I think the [a] one is the actual original, since it matches the damage output in Castlevania Chronicles “Original” Mode."

3 Likes

I never played the game but i do know that [a] stands for “alternative version”.

[!] should be the verified good rom.

1 Like

my wip branch with initial midi support is here for those wanting to test: https://github.com/energy-t/px68k-libretro/tree/midi

I have no idea how to setup github actions to easily prep releases to ppl so maybe i’ll figure how to do that next…

relevant options i’ve been using with munt when testing, may or may not apply to u so adjust as necessary:

retroarch.cfg:

video_driver = "gl"
video_vsync = "true"
video_hard_sync = "true"
video_hard_sync_frames = "0"
vrr_runloop_enable = "true"
audio_sync = "false"
midi_driver = "alsa"
midi_output = "Standard"

PX68K.opt:

px68k_adjust_frame_rates = "disabled"
px68k_audio_desync_hack = "enabled"
px68k_cpuspeed = "16Mhz"
px68k_no_wait_mode = "enabled"
px68k_push_video_before_audio = "enabled"
px68k_midi = "enabled"
px68k_midi_type = "LA"

No idea. I’d guess it would depend on how similar the interface code to use it is compared to what’s currently in there rn, which i’m not at all familiar with…

Yep, the tosec [a] variant is the actual version of the game. Last i checked mame also had the easy mode / wrong one in its verified software list as the official version. gotta imagine the ppl curating these lists have never played a castlevania game before b/c how could anyone who has think that the version floating around that results in only a single bar of health being removed per hit for the entire game, including all six subsequent loops, was the official version? Those wacky tosec and mame software list maintainers… /s

gg!

now, just 6 more loops left go! gotta make sure all them loops work right w/musashi and midi support so time to get crackin for us here /s (*just kidding, in case it wasn’t clear already with the /s)

***I want to add/stress that this is all very early work towards getting working midi support in this core. while i was able to get SOMETHING working from what little glue code i put in - that being castlevania works reasonably well using munt now - it’s far from perfect. i’ve seen some issues already and i’m sure there’s loads more i haven’t yet. i don’t want to give ppl false hope here. In the mean time, it would be a good idea to revisit the initial purpose of this thread, that is for ppl to try and get midi working with MAME’s x68k emulator. I’m willing to bet its midi support is in a lot better shape than px68k, and having something to compare to and crib notes from can help a lot going forward.

3 Likes

I wouldn’t worry about it then unless you really feel like messing with it. I’m just happy to have the crashing fixed.

Though apparently Etoile Princess still crashes at the title screen regardless of using the musashi or c68k cores. You still have to use an old build for that game: https://github.com/libretro/px68k-libretro/issues/135#issuecomment-1215629357

Probably if a current archiving group like No-Intro or Redump did x68000 this would be fixed.

Maybe someone will take MAME’s x68k emulation and create a more accuracy focused x68k libretro core someday. I don’t want to bother with the full MAME core just for x68k, personally.

You’re welcome to use my actions recipe as a starting point: https://github.com/hunterk/libretro_builds/blob/master/.github/workflows/win64_px68k.yml

It’s a cross-compile from linux, but all you should need to do is swap out your repo address (and, if needed, add a branch checkout step).

1 Like