ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
673 stars 193 forks source link

Support for MD+ command 1Fh (play wave file) #503

Closed ArcadeTV closed 1 year ago

ArcadeTV commented 1 year ago

I'd like to ask if support for command 1Fh (play wave file) is already implemented in Genesis-Plus-GX. I made a test-rom that is not guaranteed to work, because I don't have a MegaSD, but the expected output is a blank screen with MD+ CDDA music playing and a ring sfx coming from the r.wav file.

I've tested this with the "MegaSD" CD-Addon option set.

mdplus_playground.zip MegaSD_DEV_Manual.pdf

Thank you very much for this and your continued support of this great emulator!

ekeeke commented 1 year ago

No, support for commands that access disk space are not supported (see https://github.com/ekeeke/Genesis-Plus-GX/blob/master/core/cart_hw/megasd.c#L849 for the list of unsupported commands).

The reason was mainly that it requires knowing where files are stored, browse directories and read files from user storage, which is usually the goal of the frontend, not the emulation core (which is supposed to be multi platform).

ArcadeTV commented 1 year ago

Ok, I understand. Makes sense from the emulator's point of view. I still have to ask - would it help to make a rule like "has to be in the same folder as the rom file" and ignore any given path?

I'm very interested in this feature since I made a lot of MD+ patches lately and want to take it to the next level by replacing poor sfx in games with better ones played off the fpga.

Thanks for getting back, your input is very much appreciated!

ekeeke commented 1 year ago

I still have to ask - would it help to make a rule like "has to be in the same folder as the rom file" and ignore any given path?

The spec supports both relative (from loaded ROM file folder) and absolute path for these commands because it is designed for use with a sdcard , but yes, in the emulator, I could limit myself to support relative paths (paths that starts by "./" according to the spec) and do not allow access outside of loaded ROM directory (allowing access to any file on a computer is kinda problematic, even if it is only read access).

I'm very interested in this feature since I made a lot of MD+ patches lately and want to take it to the next level by replacing poor sfx in games with better ones played off the fpga.

Ok but keep in mind you would only be able to play either a WAV file or a CDDA track at once, you won't be able to play both simultaneously, the emulator is not designed for that (and MegaSD flashcart probably not either, considering the WAV files must have the same format as CDDA tracks, i.e. 16bit stereo samples @44.1KHz), which makes it a poor sfx replacement if it cuts the game music.

ArcadeTV commented 1 year ago

That's true - if it's not meant to be played simultaniously then it doesn't make sense. Anyways, thank you very much for clearing!

ekeeke commented 1 year ago

Closing this for now as there is indeed not much interest in this command as you can simply do the same using a CUE file with audio tracks pointing to WAV files.

For enhanced sfx, I think a solution would be to use the PCM chip overlay through the enhanced mapper which is described in the Mega SD Dev Manual (and is emulated by Genesis Plus GX).

ArcadeTV commented 1 year ago

Thanks again for your feedback! Yes, I'd love to play with the method described in the manual, but I'm struggeling with a pcm playback routine for the sub cpu, I'm afraid I'm totally lost without some source code to get me started. Anyways, thank you.