Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] add music to Batsugun #1700

Open
Cibomatto2002 opened this issue Mar 4, 2024 · 17 comments
Open

[feature request] add music to Batsugun #1700

Cibomatto2002 opened this issue Mar 4, 2024 · 17 comments

Comments

@Cibomatto2002
Copy link

could be maybe in the future see this game get it's music it was fixed in 0.141u1: Alex Jackson fixed missing music and some sound effects in Batsugun. Changed (set 2) to parent 'Batsugun' and (set 1) to clone 'Batsugun (older set)'. Renamed (batsugun) to (batsuguna) and (batsuguna) to (batsugun).

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Mar 4, 2024

Well in order to have the full sound and music for the official versions of Batsugun, Knuckle Bash, Fixeight and V-Five
we'd require to have the V25 CPU as that's what they all use to decode the sound encryption and we dont have it
unfortunately nor would it be easy to add it.

@arcadez2003
Copy link
Collaborator

@Cibomatto2002 i dunno if you like Dogyuun.?? The reason i mention it is like Batsugun it requires the V25 CPU
to decrypt the protected sound commands, however a version turned up last year a location test set which they used unprotected sound with a Z80 CPU to drive it

We support that game here now so atleast one version of Dogyunn now has full sound and music using MAME2003+
if a similar set was to turn up for Batsugun then we'll look at adding it also

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Mar 4, 2024

Hmm i always thought there might be another way.....

https://en.wikipedia.org/wiki/NEC_V25

Basically a souped up version of the NEC V20 and according to the above it's still compatable with the Intel I8088 which we
do support, maybe i should try my theory that the sound hookup for Batsugun might play with our I8088 there is some
work in this but if ya dont try ya'll never know :)

When dink added Q-Bert to FBN back in the day not having a v20 he used the I8088 and the game was fine
i remembered that and wondered if the same could be done for the Toaplan2 games maybe it's time to find out :)

@arcadez2003
Copy link
Collaborator

For my reference....

V25 logging mem maps inputs etc etc from before the cpu was added...
arcadez2003/mame@7280578
arcadez2003/mame@5eb822f
arcadez2003/mame@0cc5c03
arcadez2003/mame@9fd5d7f

The addition of the V25 and working sound for Batsugun
arcadez2003/mame@6d8cb11

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Mar 5, 2024

@grant2258 @mahoneyt944 here is Batsugun with the v25 code using the I86 instead it'll either work or blow up
in a 1000 ways can one of ya's try it sometime to finally answer the question if an I86 can double as a V25 also :)
Batsugun I86.zip

Edit forgot to say im using grants shared ram code to handle the writes between the 16 and 8 bit cpu's
i've added the batsugun share code also as it's slightly different for reference, but since Dogyunn Ghox and
Teki Paki had issues around this i thought it better to use code that we know to work already for here.

@mahoneyt944
Copy link
Collaborator

Crashes on startup. Might be able to pin it down closer with logging or sanitizer, but I don't have it setup.

@grant2258
Copy link
Contributor

grant2258 commented Mar 5, 2024

I really doubt a sanitizer would help much in this case but feel free to check if you feel its beneficial, arcadez rightly state it can blow up in many ways. I have a big workload this week will check the mem maps and such at the weekend. You could probably compile a later mame with the cpu changes and see if it works before jumping down a big rabbit hole. Thats the first thing ill be trying at the weekend before jumping down a rabbit hole. I really cant even remember these sound changes must have been a good while back :)

@arcadez2003
Copy link
Collaborator

Thanks for letting me rope you in to this madness LOL might be a shared ram issue.?? for Ghox Teki Paki and when i
added that Dogyunn set we needed to use grants share code for the writes between the 8 bit sound cpu and 16bit main

However other games in the driver have different setups maybe we need to use the actual batsugun share code.??
in that case we need to change up some stuff in the mem maps and switch on the alt batsugun_share type......

static MEMORY_READ16_START( batsugun_readmem )
{ 0x000000, 0x07ffff, MRA16_ROM },
{ 0x100000, 0x10ffff, MRA16_RAM },
{ 0x200010, 0x200011, input_port_1_word_r }, /* Player 1 controls /
{ 0x200014, 0x200015, input_port_2_word_r }, /
Player 2 controls /
{ 0x200018, 0x200019, input_port_3_word_r }, /
Coin/System inputs */
{ 0x210000, 0x21bbff, MRA16_RAM },
{ 0x210000, 0x21ffff, batsugun_share_r },
// { 0x210000, 0x21ffff, shared_ram_r },

/***** The following in 0x30000x are for video controller 1 ******/
{ 0x300004, 0x300007, toaplan2_0_videoram16_r },/* tile layers */
{ 0x30000c, 0x30000d, toaplan2_inputport_0_word_r },	/* VBlank */
{ 0x400000, 0x400fff, paletteram16_word_r },
/***** The following in 0x50000x are for video controller 2 ******/
{ 0x500004, 0x500007, toaplan2_1_videoram16_r },/* tile layers 2 */
{ 0x700000, 0x700001, video_count_r },

MEMORY_END

static MEMORY_WRITE16_START( batsugun_writemem )
{ 0x000000, 0x07ffff, MWA16_ROM },
{ 0x100000, 0x10ffff, MWA16_RAM },
{ 0x20001c, 0x20001d, toaplan2_v25_batsugun_coin_word_w }, /* Coin count/lock + v25 reset/hold control lines? */
{ 0x210000, 0x21bbff, MWA16_RAM },
{ 0x210000, 0x21ffff, batsugun_share_w },
// { 0x210000, 0x21ffff, shared_ram_w },

/***** The following in 0x30000x are for video controller 1 ******/
{ 0x300000, 0x300001, toaplan2_0_voffs_w },		/* VideoRAM selector/offset */
{ 0x300004, 0x300007, toaplan2_0_videoram16_w },/* Tile/Sprite VideoRAM */
{ 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w },
{ 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w },
{ 0x400000, 0x400fff, paletteram16_xBBBBBGGGGGRRRRR_word_w, &paletteram16 },
/***** The following in 0x50000x are for video controller 2 ******/
{ 0x500000, 0x500001, toaplan2_1_voffs_w },		/* VideoRAM selector/offset */
{ 0x500004, 0x500007, toaplan2_1_videoram16_w },/* Tile/Sprite VideoRAM */
{ 0x500008, 0x500009, toaplan2_1_scroll_reg_select_w },
{ 0x50000c, 0x50000d, toaplan2_1_scroll_reg_data_w },

MEMORY_END

static MEMORY_READ_START( V25_rambased_readmem )
{ 0x00001, 0x00001, YM2151_status_port_0_r },
{ 0x00004, 0x00004, OKIM6295_status_0_r },
// { 0x80000, 0x87fff, shared_ram8_r },
{ 0x80000, 0x87fff, MRA_RAM },
// AM_RANGE(0x80000, 0x87fff) AM_RAM AM_MIRROR(0x78000) AM_BASE_MEMBER(toaplan2_state, batsugun_share)
MEMORY_END

static MEMORY_WRITE_START( V25_rambased_writemem )
{ 0x00000, 0x00000, YM2151_register_port_0_w },
{ 0x00001, 0x00001, YM2151_data_port_0_w },
{ 0x00004, 0x00004, OKIM6295_data_0_w },
// { 0x80000, 0x87fff, shared_ram8_w },
{ 0x80000, 0x87fff, MWA_RAM, &batsugun_share },
// AM_RANGE(0x80000, 0x87fff) AM_RAM AM_MIRROR(0x78000) AM_BASE_MEMBER(batsugun_share)
MEMORY_END

There is a mirror here which i've not done yet but as grant said he might find time to test this on his MAME95 core
the batsugun share and mirror will defo work using that then we'll know either way if this is boom or bust :)

@Cibomatto2002
Copy link
Author

@Cibomatto2002 i dunno if you like Dogyuun.?? The reason i mention it is like Batsugun it requires the V25 CPU to decrypt the protected sound commands, however a version turned up last year a location test set which they used unprotected sound with a Z80 CPU to drive it

We support that game here now so atleast one version of Dogyunn now has full sound and music using MAME2003+ if a similar set was to turn up for Batsugun then we'll look at adding it also

Yes I like Dogyunn and games like it. thanks everyone for looking into this. :)

@grant2258
Copy link
Contributor

@arcadez2003 tried with your mem map updates above. It runs but as soon as cpu1 is is resumed it crashes. Will test this somewhere its working and see if cpu the drop in method will work.

[libretro DEBUG] [MAME 2003+] toaplan2_v25_coin_word_w 0030
[libretro DEBUG] [MAME 2003+] timer_adjust 64979900 to expire @ 0.000052783
[libretro DEBUG] [MAME 2003+] activecpu_abort_timeslice (CPU=0, cycles_left=174)
[libretro DEBUG] [MAME 2003+]          864 ran, 1671806 total, time = 0.000054033
[libretro DEBUG] [MAME 2003+]          (new target)
[libretro DEBUG] [MAME 2003+]   cpu 1: 864 cycles (suspended)
[libretro DEBUG] [MAME 2003+]          864 skipped, 1671805 total, time = 0.000053970
[libretro DEBUG] [MAME 2003+] timer_adjust_global_time: delta=0.000054033 head->expire=-0.000001250
[libretro DEBUG] [MAME 2003+] Timer 64979900 fired (expire=-0.000001250)
[libretro DEBUG] [MAME 2003+] cpunum_resume (CPU=1, r=2)
[libretro DEBUG] [MAME 2003+] ------------------
[libretro DEBUG] [MAME 2003+] cpu_timeslice: target = 0.000009580
[libretro DEBUG] [MAME 2003+] --> updated CPU1 suspend from 2 to 0
[libretro DEBUG] [MAME 2003+]   cpu 0: 153 cycles
[libretro DEBUG] [MAME 2003+]          154 ran, 1671960 total, time = 0.000009625
[libretro DEBUG] [MAME 2003+]   cpu 1: 154 cycles
```

@grant2258
Copy link
Contributor

grant2258 commented Mar 6, 2024

Fixed up the shares havent really looked at the new code vs old but this should sort the shares. It a black screen but the cpu1 is running through the cycles but the cpu is suspended. master...grant2258:mame2003-plus-libretro:rabbit_hole. I will need to double check the shares between the 16bit and 8 bit but will test on a later mame to see if it even works should be enough for others to to dig in though.

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Mar 7, 2024

@grant2258 Im sorry but I86 is the wrong CPU i should have used the I88 fucking doh.!!!!!! try this......

MDRV_CPU_ADD(I88, 32000000/2) /* NEC V25 type Toaplan marked CPU ??? */

@mahoneyt944
Copy link
Collaborator

Lol, man nice catch. That surely could be the issue if this franken sound is going to work ha

@grant2258
Copy link
Contributor

grant2258 commented Mar 7, 2024

@arcadez2003 no issues there I was going to try it on current mame first before debugging on our end. You caught it in time easy mistake to be honest. The I88 cpu isint enabled in this core either for some reason. So I think a test where its working is the best course of action in this case

@grant2258
Copy link
Contributor

grant2258 commented Mar 8, 2024

@arcadez2003 I was messing with current mame last night and completely removing the audio cpu the game still boots. Adding a V20 that is closer than an I88 doesnt work the looks like the v25 ports from that update are needed for this to work. Regarding this removing the cpu doesnt allow the game to boot, that could be a symptom of how the old code is working though.

edit: @arcadez2003 i86 wasnt such a big deal in the long run borntofi should be using a i88 and a v20 and I86 works fine in this this core. Its just the port sare needed in the v25 to get the sound to work. The cpu could be backported for the for your xbox core but this core would be a lot of extra work due to the differences. If i was motivated to do any cpu for here core it would probably be the I8751 to get some sega games and probably many more working.

@arcadez2003
Copy link
Collaborator

arcadez2003 commented Mar 8, 2024

Yeah i was looking at the v25 input ports last night i was wondering if we could have used the simulation of those
that were in the driver beforehand, that's if the game booted up and we could confirm the sound would work using a
different CPU, anyway it was always gonna be 80/20 as to if this would have worked or not

It was worth a wee try though we'll call this a day then eh.?? these can be played with the full audio using FBN
as for this core i usually keep an eye on the toaplan2 driver if any new dumps turn up which would enable us to
have full sound and music in Batugun for example i'd try and it.

@grant2258
Copy link
Contributor

Not sure why its not booting wth no cpu but the V20 doesnt work as a replacement on current mame. It would be nice to do these things but it would require a new cpu core being realistic. It never been a competition(for this port anyway) on low end more the best we can do with what we are working with.

I dont know how well these games will play on lower end anyway. I mean most games work fine on the pi5 so low end should be fine for most going forward by todays low end standard. I think eventually these other arcade ports like this core will only be useful for people running wii/u and old android/arm architecture. Which is where it targeted anyway. FBNeo I don't know much about now really used it much apart from the days when it ran faster than mame on my 486 haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants