libretro / mame2003-plus-libretro

Updated 2018 version of MAME (0.78) for libretro. with added game support plus many fixes and improvements
Other
192 stars 110 forks source link

Irem Samples Support #1091

Closed KMFDManic closed 3 years ago

KMFDManic commented 3 years ago

@arcadez2003 @mahoneyt944

One of the coolest things you can do with some of the Irem Games is use "Yamaha Drum Samples", to have an effect of real percussion, in games such as Kid Niki (especially, with the latest crash fix implemented:), Spelunker 1, 2, Horizon, (possibly Kung Fu Master?). FBA/FBNEO Cores have the support added. Here is a test video, showing what I refer to. Yeah, I have a better video setup than in previous videos:) You can run 4 games with these FM drum samples! I can fill in more details, if unfamiliar. But, I feel we can get these added into Plus/Xtreme!

https://www.youtube.com/watch?v=YJPo8rFW2cI

mahoneyt944 commented 3 years ago

Would this be a replacement sample for a existing sample or a new optional ost sample? Haven't looked at the drivers yet.

arcadez2003 commented 3 years ago

The samples are netlist based so therefore not compatible here, but im sure they added em as bonafida samples for the FBNEO core although whether their code would be portable across to this one is another matter.

Original MAME https://github.com/arcadez2003/mame/commit/00150aec1cf3e6b4d00a3fd7b0211baaedc6881b#diff-14337f317993da93b507b9aa6fa60e263220e5217b6d44820feea224acf20347

FBNEO https://github.com/finalburnneo/FBNeo/commit/60c61e55690aa82a3870f15ffa70dfc77f7f2145#diff-b8100b123e32c8cc223920a25b3f0abb61b5a4ff2f6f1b4df03968168356430d

arcadez2003 commented 3 years ago

@mahoneyt944 @KMFDManic This my attempt to port across the sample code from FBN it's rough and untested right enough maybe ya's can take a peek sometime with a view to fixing any errors on my side, as i had nothing to compare it to there are a couple of things im unsure about firstly how many channels to use and whether i've set the sample start defines correctly..........

struct Samplesinterface tr606_samples_interface = { 7, // correct ??

static WRITE_HANDLER( irem_samples_w ) { if (data == 0xff) { //bprintf(0, _T("M62 Analog drumkit init.\n")); return; }

/ ripped from FBN if (data > 0) { if (data & 0x01) // bass drum BurnSamplePlay(2); if (data & 0x02) // snare drum BurnSamplePlay(1); if (data & 0x04) // open hat BurnSamplePlay(3); if (data & 0x08) // closed hat BurnSamplePlay(0); } /

/* not sure if these values are correct */
if (data > 0) {
    if (data & 0x01) // bass drum
        sample_start(2, 2, 0); // correct ??
    if (data & 0x02) // snare drum
        sample_start(1, 1, 0); // correct ??
    if (data & 0x04) // open hat
        sample_start(3, 3, 0); // correct ??
    if (data & 0x08) // closed hat
        sample_start(0, 0, 0); // correct ??
}

Code MHY.zip

mahoneyt944 commented 3 years ago

I added this to it's own branch for testing.

mahoneyt944 commented 3 years ago

Hat.wav was missing from your sample list not sure if that effected how you set your triggers or not.

Samples tr606drumkit.zip

Branch https://github.com/libretro/mame2003-plus-libretro/compare/Irem

arcadez2003 commented 3 years ago

@mahoneyt944 Thanks bigman you've more experience of the ole sample code than me i only spent 10 mins on this more or less, i counted seven samples but "forgot to add one whoops" hence i made it seven channels i dunno if that's correct.?? but looking at other drivers that seems to be how they set it.

As for the sample_start since we cant just have (2) as per FBN and after looking at how this is setup in MAME78 there are many variables so i just played it save with (2, 2, 0) but ya know im only guessing here as i cant state that i fully understand the samples setup hence i was hoping you'd sort this amatuerish attempt sometime down the road :)

mahoneyt944 commented 3 years ago

I added a test in with on screen logging. it turns out that "data" is always reading 0 in this function. probably the first issue to figure out. headed out for the time being though

ghost commented 3 years ago

@mahoneyt944 @arcadez2003 I looked at the code i think the sample code should be going here. https://github.com/libretro/mame2003-plus-libretro/blob/9d0705ded5ac0297c5427c95b8ad4d879b60d9ca/src/sndhrdw/irem.c#L18-L21 Im working ten hours shifts at the moment but will have a look at the weekend when im off. We only have 2 channels and the sample interface only needs the sample names and the rom name for the samples if this isint the same as any rom the rom managers will complain but it will still work. Seems like it should drop in just make sure the samples arent looping and playing through channel 0 or 1 or both for this core.

KMFDManic commented 3 years ago

@mahoneyt944 @arcadez2003 Thanks a hell of a lot for checking this out. I found these really cool to play around with. @dinkc64 originally added the support into FBA like 6 years back, based off MAME code. Love Yamaha and FM style sound effects, which also show up in Sharp X68000, as well as in PC-98. You don't need to watch this whole video. But, listen to the "real sounding drums", which really make a huge impact in the overall gameplay:)

https://www.youtube.com/watch?v=YhRgsEObN6s&t=106s

Again, thanks:) Looking forward to testing the commits out, and feel these will make for a most welcome sound enhancement! Will be hard to ever go back to the original sound:) The other games sound fantastic, too, including Horizon (bit like Moon Patrol) and Spelunker!

ghost commented 3 years ago

ok guys added it real quick followed the code dont think the hi hat is right but is what we have.

@mahoneyt944 fixed it up best as i could on a quick whim grab the files from my wip branch they dont include arcades updates @KMFDManic can let you know what other games need the samples added

dinkc64 commented 3 years ago

KMFDManic that's not true, I added samples to fb[alpha at the time] several years ago based on my own reverse engineering.

ghost commented 3 years ago

Yea is based on arcadez port of it code ls above arcade linked it

KMFDManic commented 3 years ago

@dinkc64 I in no way, shape, or form, meant to downplay your role in inplementing these samples. I was referring to your description about the information you utilized to pull it off, from your 6 year old video:)

https://youtu.be/-gdFjS5J_dY

Never, ever, for a moment, think you are anything less than amazing when you code in or reverse engineer this stuff. You are always one that i shout out to in release notes, along with arcadez2003, grant2258, mahoneyt944, markwkidd:) I apologize if you misinterpreted the meaning behind my initial message, due to how I worded things:)

I am especially thankful for the sheer amount of patience you put into those SGM Coleco Games! Those are my childhood:)

arcadez2003 commented 3 years ago

@KMFDManic there's not need to apologize slight oversights happen :)

But yeah @dinkc64 tends to quite often add his own sample code created from scratch to FBN rather than attempt to port other dev's work across from MAME, a prime example would be Red Clash as FBN is the only emulator to have sound for this game via samples created for that purpose.

Regards.

dinkc64 commented 3 years ago

KMFDManic, it's no problem, I worded it wrong on the video, if it weren't for the mame driver in the first place, we'd probably be way behind on the M62 emulation (or it probably wouldn't exist). The sample part was my harebrained idea though :)

mahoneyt944 commented 3 years ago

@grant2258 nice work. I noticed you added Hat.wav to the bottom of the list where as in fbneo they have it at the top. That may be why the triggers had to be reordered unless you did this intentionally? I updated the irem branch here with a medley of fbneo, arcadez, yours, and my work. I ordered the samples the way fbneo did and that seems to get the right trigger order for the samples. Though some are missing. Of our 7 samples, we only have triggers for 4 of them? why? something to do with the routes?

mahoneyt944 commented 3 years ago

Maybe high and low bits?

mahoneyt944 commented 3 years ago

@arcadez @grant2258 ok fixed one issue. The sample pack was corrupted. I hand made a new one, now things are getting closer. I'm also going to update my old post above with the right samples. tr606drumkit.zip

ghost commented 3 years ago

I think its probably best to keep the samples named the same as fbneo/alpha code we got it from. its not really a big issue is eaier for users that have the fbneo samples that way. Ill grab the samples and have a listen i also need to remove the if else and replace with if. I put in to see if we where missing any since dinks already done the testing its good to go

mahoneyt944 commented 3 years ago

updated irem branch naming to match fbneo. Heres the proper sample pack. As it turns out, I think my original download got corrupted... seems fine now

tr606drumkit.zip

mahoneyt944 commented 3 years ago

ok its fixed working great! merging

mahoneyt944 commented 3 years ago

Kidniki, spelunkr, spelnkrj, spelunk2, yanchamr, and horizon all tested to be working. How's the level sound? Is it too loud?

ghost commented 3 years ago

The samples in my core are treated differently with volume levels. Its best to hear from others how they find it sits with there ears. These are normal samples for the question you asked before not ost ones. As for the other sounds not being used that was what kidnikki used for samples. I played this game as a kid the drums do make a big difference!

mahoneyt944 commented 3 years ago

Yeah they all seem to be playing properly now. I tweaked the volume down a hair after comparing to other cores and YouTube. Seems good to me. Nice work fellas.

KMFDManic commented 3 years ago

@dinkc64 @grant2258 @mahoneyt944 @arcadez2003 Thanks so much all of you. This truly is one of the coolest additions, to date:) Crank up the sound system, and enjoy the Real Drums! I will do some more test videos. I will get this stuff added to Xtreme, too, including the Kid Niki "crash" fix, which I will likely need.

mahoneyt944 commented 3 years ago

I believe we can promote these now from imperfect sound. Via the samples the sound seems proper enough

KMFDManic commented 3 years ago

@mahoneyt944 Had a nice test of them last night, and sounded great:) Spelunker 2 is actually a pretty interesting game...kind of reminds me of a better "Super Pitfall" Super Pitfall is the type of game that a kid got for Xmas or a gift, that they did not want! And, it is probably impossible to beat, unless you had Nintendo Power or called the Tip Line. Spelunker games, on the other hand, you can generally know what you gotta do, so the journey is a bit more fun:)

ghost commented 3 years ago

I think the bass drum needs a volume boost thats about it.