MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

BPzeBanshee
MAME Fan
Reged: 07/22/12
Posts: 19
Send PM


Sample hacking seibuspi.c, need help
#309601 - 05/31/13 07:24 AM


Raiden Legacy came out recently with so-called "HD Music" - basically hacking their emulator (which I'm 100% certain is in itself using MAME code) to play samples instead of emulating the music.
Being sick of MAME's emulation of the music myself, and after doing some modernisation work with ThunderMAME to port it over to newer versions I decided to do a bit of sample hacking myself - but with plain MAME which does most things right unlike Raiden Legacy.

I've started with Raiden Fighters JET, and have successfully gotten samples to play and then trap the command sent to play the emulated music (so that it's not playing under the samples and making it sound odd). I'm not sure if actually having the samples up is allowed here but I've uploaded my modified code here: http://www.mediafire.com/download/6e6fwqy96mi90wa/Seibuhax_V3.zip

The final hurdles I'm at however, is as follows:

1) hooking up the sample system (with the correct reference to JET's samples) so that only Raiden Fighters JET and its variants load and use the samples. I seem to have messed up my attempt at making a MACHINE_CONFIG_DERIVED that adds it because every game that isn't rfjets (the sxx2g variant that I was working with because it had a sound test), is that even the right approach? What am I doing wrong with this code?

2) the ROM Transfer tune as called in the ROM Transfer process (rather than the one available in rfjets's sound test) is proving to be a real pain. Any trapping of suspect commands sent through to the Z80 results in some kind of error, same with sending anything that isn't what it's expecting. If I set the sound off in MACHINE_CONFIG_START then I get no sfx in-game (I only want to sample replace the music for the time being). I'm wondering if maybe there's a way to just mute the sound driver itself dynamically when I know it's at the ROM Transfer process?

3) This happened in the source recently: http://git.redump.net/mame/commit/?id=6d0f90261cf96726742ac3d73f3f3e1e50e148f9
which post MAME 0.148u5 among other things removes the sound_fifo_w command I was placing my sample/trapping commands in. Apart from being a code shuffle it doesn't seem to do anything beneficial, but I'm worried this might make my method of intercepting sound requests incompatible with future MAME versions. Any ideas for how I can get around this?

Any help with this will be much appreciated. I've hit a bit of an impasse with this and not sure where to find anyone who knows enough about MAME drivers to help me out (although trap15 and the guys at #messdev have been helpful in getting me this far, credit where it's due).

Edited by BPzeBanshee (05/31/13 07:28 AM)



BPzeBanshee
MAME Fan
Reged: 07/22/12
Posts: 19
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: BPzeBanshee]
#309605 - 05/31/13 02:34 PM


Okay, I'm an idiot. Got 1) sorted. I had two lines taken from a MACHINE_CONFIG_DERIVED that didn't need to be there and was messing things up for rfjet. One I removed those rfjet and all its variants ran fine. Then I added an (if use_sample > 0) check in video/seibuspi.c for the sample volume control commands (I had it initialised as 0 and set to 3 whenever rfjet launched) and that fixed all the rest of the games from crashing.

Still need help with the ROM Transfer tune though, completely and utterly stumped with that one. At least with 3), using just the old driver before the FIFO functions got hooked up externally it compiles and runs the same anyway.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9716
Loc: ECV-197 The Orville
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: BPzeBanshee]
#309759 - 06/03/13 04:54 PM


If you're replacing everything with external samples, why are you running the Z80 in the first place?

Also note that the YMF271 music emulation has been improved for the next version.



BPzeBanshee
MAME Fan
Reged: 07/22/12
Posts: 19
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: R. Belmont]
#309795 - 06/04/13 12:28 PM


Thing is, I'm not replacing *everything*, only the background music. If I had a way to get every sfx off the PCB for each game I'd do it, but that's a near-impossible undertaking for me. I'm also using one of the fifo commands to intercept the data variables for which music track to play - which got removed in the midst of haps' recent improvements.

While all work is good work I still don't think the music and sfx is quite there yet (but it's getting better: I almost thought I was running samples at RF1's credits in a recent SVN build, and RF2 always did have the least signs of audio emulation issues after the tempo fix). It's especially noticeable in rfjets where even more sfx are missing compared to its SPI parent.



hap
Reged: 12/01/08
Posts: 296
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: BPzeBanshee]
#309805 - 06/04/13 02:46 PM


> Thing is, I'm not replacing *everything*, only the background music. If I had a way
> to get every sfx off the PCB for each game I'd do it, but that's a near-impossible
> undertaking for me. I'm also using one of the fifo commands to intercept the data
> variables for which music track to play - which got removed in the midst of haps'
> recent improvements.
>


To intercept the fifo variables, make your own WRITE8 function, so:

AM_DEVWRITE8("soundfifo1", fifo7200_device, data_byte_w, 0x000000ff)
change to something like:
AM_WRITE8(myfifo_w, 0x000000ff)

WRITE8_MEMBER(seibuspi_state::myfifo_w)
{
do your stuff...

m_soundfifo1->data_byte_w(space, 0, data);
}




> While all work is good work I still don't think the music and sfx is quite there yet
> (but it's getting better: I almost thought I was running samples at RF1's credits in
> a recent SVN build, and RF2 always did have the least signs of audio emulation issues
> after the tempo fix). It's especially noticeable in rfjets where even more sfx are
> missing compared to its SPI parent.


You worded it a bit strangely. Is rfjets better or worse now?



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4462
Loc: Melbourne, Australia
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: hap]
#309828 - 06/05/13 04:49 AM


> You worded it a bit strangely. Is rfjets better or worse now?

they're all better, but rfjets has more remaining issues than rfjets



BPzeBanshee
MAME Fan
Reged: 07/22/12
Posts: 19
Send PM


Re: Sample hacking seibuspi.c, need help new [Re: hap]
#309840 - 06/05/13 01:41 PM


Thanks for the example hap! With that it should be a breeze to update it all now, makes a lot more sense than it did last time I looked at it.

Regarding rfjets, I noticed it before and after most of your changes (I've yet to update tonight): the pitch and tempo are considerably worse in rfjets (the single board version, IIRC sxx2g variant with sound/eeprom tests) than they are in the parent version.

I'm not sure how to word this, but if you listen to how the tunes in rfjet sound and then again in rfjets the difference is quite noticeable. Not sure what's up with that.


Pages: 1

MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 44 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 3556