libretro / mame2003-plus-libretro

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

Marble Madness II MAME2003 #1332

Closed arcadez2003 closed 2 years ago

arcadez2003 commented 2 years ago

So without rabbiting on i have it on good authority that it uses the same hardware as Batman it's a dead ringer more or less and all we need to do to get the game to work here is follow the blueprint from FBN which is the following.......

in our ole batman.c......

1) copy the mem map or maps already present in the driver and simply update them to the values used by MM2 2) copy the gfx decodes already present in the driver and then same as the above add in the values for MM2 3) add the inputs and the new romset for MM2 4) ignore vad alpha ram code as mm2 doesn't use it. 5) rewrite some parts of the video drawing 6) make sure the JSA sound commands are correctly hooked up

In theory after the above and since we're hanging off the rest of the batman code for gfx and sound etc etc we should have a new working and highly saught after game playable in this ole core, but of course this sounds far too simple and knowing how things can go with ole code in this ole core maybe it's wishful thinking.??

We'll find out i guess either way :)

So who's up for helping.??

mahoneyt944 commented 2 years ago

Surely

mahoneyt944 commented 2 years ago

Since we are decoding the graphics isolated for this game I assume we don't need to invert them like Batman does?

ROM_START( marblmd2 )
    ROM_REGION( 0x80000, REGION_CPU1, 0 ) // 68000 Code 
    ROM_LOAD16_BYTE( "rom0l.18c",  0x00001, 0x20000, CRC(a4db40d9) SHA1(ae8313c9bb513143472347a7705bec33783bad7e) )
    ROM_LOAD16_BYTE( "rom0h.20c",  0x00000, 0x20000, CRC(d1a17d67) SHA1(7ac434858fa94e4bb4bb7d0603f699667494aa0d) )
    ROM_LOAD16_BYTE( "rom1l.18e",  0x40001, 0x20000, CRC(b6fb08b5) SHA1(0ce9c1a5d70133ffc879cfe548646c04de371e13) )
    ROM_LOAD16_BYTE( "rom1h.20e",  0x40000, 0x20000, CRC(b2a361a8) SHA1(b7c58404642a494532597cceb946463e3a6f56b3) )

    ROM_REGION( 0x10000, REGION_CPU2, 0 ) // 6502 code 
    ROM_LOAD( "aud0.12c",  0x00000, 0x10000, CRC(89a8d90a) SHA1(cd73483d0bcfe2c8134d005c4417975f9a2cb658) )

    ROM_REGION( 0x100000, REGION_GFX1, 0 )
    ROM_LOAD( "pf0l.3p",  0x00000, 0x20000, CRC(a4fe377a) SHA1(a8a1a8027da778e5ad406a65814eec999b0f81af) )
    ROM_LOAD( "pf1l.3m",  0x20000, 0x20000, CRC(5dc7aaa8) SHA1(4fb815e9bcf6bcdf1b7976a3dea2b6d1dd6a8f6b) )
    ROM_LOAD( "pf2l.3k",  0x40000, 0x20000, CRC(0c7c5f74) SHA1(26f1d36f70f4e8354537d0d67764a1c9be35e8f7) )
    ROM_LOAD( "pf3l.3j",  0x60000, 0x20000, CRC(0a780429) SHA1(a9d7d564507c31dafc448726b04293d6a582cff5) )
    ROM_LOAD( "pf0h.1p",  0x80000, 0x20000, CRC(a6297a83) SHA1(ffe9ea41d1ba7bb3d0260f3fcf0e970112098d46) )
    ROM_LOAD( "pf1h.1m",  0xa0000, 0x20000, CRC(5b40f1bb) SHA1(cf0de8679ab0dd9460324ce72b4bfac029591506) )
    ROM_LOAD( "pf2h.1k",  0xc0000, 0x20000, CRC(18323df9) SHA1(9c4add4733bcfe7202b53d86f1bca4b9d207e22a) )
    ROM_LOAD( "pf3h.1j",  0xe0000, 0x20000, CRC(05d86ef8) SHA1(47eefd7112a3a3be16f0b4496cf034c8f7a69b1b) )

    ROM_REGION( 0x80000, REGION_GFX2, 0 )
    ROM_LOAD( "mo0l.7p",  0x00000, 0x20000, CRC(950d95a3) SHA1(3f38da7b6eeaa87cc84b98c9d535468b0c060f6d) )
    ROM_LOAD( "mo1l.10p", 0x20000, 0x20000, CRC(b62b6ebf) SHA1(3781cd81780c10cd245871bb8f7b6260f7bb53b7) )
    ROM_LOAD( "mo0h.12p", 0x40000, 0x20000, CRC(e47d92b0) SHA1(7953e8342450c02408e4d90f132144d55de2f491) )
    ROM_LOAD( "mo1h.14p", 0x60000, 0x20000, CRC(317a03fb) SHA1(23a7cfe7c5601c858e8b346de31441788c7a8e97) )

    // loading based on batman, there are 2 unpopulated positions on the PCB
    ROM_REGION( 0x80000, REGION_SOUND1, 0 )
    ROM_LOAD( "sound.19e",  0x00000, 0x20000, CRC(e916bef7) SHA1(e07ddc8a3e1656d7307b767e692cf4a575ca47a3) )
    ROM_LOAD( "sound.12e",  0x60000, 0x20000, CRC(bab2f8e5) SHA1(bbe2d693d40e5eeba315fe7b6380a2030b66f23e) )
ROM_END
mahoneyt944 commented 2 years ago

Maybe?

static struct GfxLayout pflayout =
{
    8,8,
    RGN_FRAC(1,2),
    8,
    { 0,1,2,3,4,5,6,7 },
    { 0,RGN_FRAC(1,2) + 0, 8,RGN_FRAC(1,2) + 8,  16,RGN_FRAC(1,2) + 16,24,RGN_FRAC(1,2) + 24 },
    { 0 * 32, 1 * 32, 2 * 32, 3 * 32, 4 * 32, 5 * 32, 6 * 32, 7 * 32 },
    8 * 32
};

static struct GfxLayout molayout =
{
    8,8,
    RGN_FRAC(1,2),
    4,
    { 0, 1, 2, 3 },
    { RGN_FRAC(1,2) + 0, RGN_FRAC(1,2) + 4, 0, 4, RGN_FRAC(1,2) + 8, RGN_FRAC(1,2) + 12, 8, 12  },
    { 0 * 16, 1 * 16, 2 * 16, 3 * 16, 4 * 16, 5 * 16, 6 * 16, 7 * 16 },
    16 * 8
};

static struct GfxDecodeInfo gfxdecode_mm2[] =
{
    { REGION_GFX1, 0, &pflayout,  0x0, 1 }, 
    { REGION_GFX2, 0, &molayout,  0x0, 0x10 },
    { -1 }
};
MistyDreams commented 2 years ago

its certainly bootable needs some work didnt spend much time on will look more at the weekend. Screenshot from 2022-05-26 07-30-59

mahoneyt944 commented 2 years ago

@MistyDreams did you invert the gfx or use the new decoding? Share the files you updated in a wip PR

arcadez2003 commented 2 years ago

Been looking over the code in a little more depth trying to pindown the diffs between the games im using the batman and mm2 drivers in both MAME and FBN as a guide, i've started to rework the mem maps almost done the reads and a few lines on the writes this is what i have so far but a long way to go yet.......

This is what i've done atm

static MEMORY_READ16_START( mm2_main_readmem ) { 0x000000, 0x07ffff, MRA16_ROM }, { 0x600000, 0x600001, input_port_0_word_r }, { 0x600002, 0x600003, input_port_1_word_r }, { 0x600010, 0x600011, input_port_2_word_r }, { 0x600012, 0x600013, input_port_3_word_r }, { 0x600020, 0x600020, input_port_4_word_r }, { 0x100000, 0x10ffff, MRA16_RAM }, { 0x120000, 0x120fff, atarigen_eeprom_r }, // { 0x260010, 0x260011, special_port2_r }, // mm2 doesn't use this from what i can tell { 0x600030, 0x600031, atarigen_sound_r }, { 0x7c0000, 0x7c03ff, MRA16_RAM }, // palette { 0x3effc0, 0x3effff, atarivc_r }, { 0x3f0000, 0x3fffff, MRA16_RAM }, MEMORY_END

static MEMORY_WRITE16_START( mm2_main_writemem ) { 0x000000, 0x07ffff, MWA16_ROM }, { 0x100000, 0x10ffff, MWA16_RAM }, { 0x120000, 0x120fff, atarigen_eeprom_w, &atarigen_eeprom, &atarigen_eeprom_size }, { 0x600040, 0x600041, atarigen_sound_w }, { 0x600050, 0x600051, latch_w }, { 0x600060, 0x600061, atarigen_eeprom_enable_w }, { 0x2a0000, 0x2a0001, watchdog_reset16_w }, { 0x7c0000, 0x7c03ff, atarigen_666_paletteram_w, &paletteram16 }, { 0x3effc0, 0x3effff, atarivc_w, &atarivc_data }, { 0x3f0000, 0x3f1fff, atarigen_playfield2_latched_msb_w, &atarigen_playfield2 }, { 0x3f2000, 0x3f3fff, atarigen_playfield_latched_lsb_w, &atarigen_playfield }, { 0x3f4000, 0x3f5fff, atarigen_playfield_dual_upper_w, &atarigen_playfield_upper }, { 0x3f6000, 0x3f7fff, atarimo_0_spriteram_w, &atarimo_0_spriteram }, { 0x3f8000, 0x3f8fef, atarigen_alpha_w, &atarigen_alpha }, { 0x3f8f00, 0x3f8f7f, MWA16_RAM, &atarivc_eof_data }, { 0x3f8f80, 0x3f8fff, atarimo_0_slipram_w, &atarimo_0_slipram }, { 0x3f9000, 0x3fffff, MWA16_RAM }, MEMORY_END

arcadez2003 commented 2 years ago

We'll need to rewrite some parts of the video drawing i'll add that to the to do list, also this had me stumped....

map(0x600030, 0x600031).r(m_jsa, FUNC(atari_jsa_iii_device::main_response_r));
map(0x600040, 0x600041).w(m_jsa, FUNC(atari_jsa_iii_device::main_command_w));

A quick check on the git and it's more or less the same as a game in another Atari driver Off The Wall so i've used the setup from that driver in our core with the address lines for mm2 it should be correct.......

{ 0x600030, 0x600031, atarigen_sound_r },
{ 0x600040, 0x600041, atarigen_sound_w },

Some more work on this might be needed but we have all the parts we need spread across the Atari code it's figuring out how to put them all together leaving out what we dont need and rejigging or adding in what we do is where the fun is :)

arcadez2003 commented 2 years ago

@MistyDreams did you invert the gfx or use the new decoding? Share the files you updated in a wip PR

Yeah if we share and collaborate here we'll have this done in no time im gonna carry on with the memory mapping for the moment i may need some help with this we'll see.

MistyDreams commented 2 years ago

Ill give you what i have if you like its not complete and will mess batman up. The dipswitches and joystick direction input will need added as well. wip.zip

arcadez2003 commented 2 years ago

Yeah no worries there are two ways to do this right enough support the code in the batman.c driver + vidhrdw or simply make a copy of those two files and morph them into new ones for mm2 whatever you guys think is easier.

mahoneyt944 commented 2 years ago

I would just add it into the batman drivers

MistyDreams commented 2 years ago

I think the dips and inputs do need added to be honest demo mode drops out quick to the title screen. I didnt have time to work on this, so its a rough around the edges just more curious if it would work lol.

arcadez2003 commented 2 years ago

i've added the inputs to the mem map not hooked up as yet though i'll do it later as it looks like you've nailed the mem map gonna check it quickly then start on the dips/inputs

arcadez2003 commented 2 years ago

Ok some work i did tonight...

Hooked up the inputs and got the sound working Tweaked the CPU2 address values to improve the sound Split the video code into seperate versions for both games Added the correct game title Batman is fixed although i've only played part of level one but it should be good again

Here is the latest more wip.zip

mahoneyt944 commented 2 years ago

@arcadez2003 I took your last posted files and set the machine init to marblmd2, then isolated the driver init. Then I tired plugging 256 into the decode and it's showing more of the image. Seems like a gfxdecode issue. marblmd2-220526-213101

MistyDreams commented 2 years ago

yea i has the sound working will need tweaked if you move the input ports

mahoneyt944 commented 2 years ago

@MistyDreams seems like we just have a gfx issue now. Inputs are working and the sound seems ok. I was playing around with gfx1 and if you use 256 instead of 0 you'll see more details (such as the goals, the select level screen, and the mesh like design in attract mode). I'm wondering because of how batman used 3 gfx regions and we are only using 2 if we need to alter the color table or palette length? Any thoughts on this?

MistyDreams commented 2 years ago

could be differences in the mame and atari drivers or my new video code ported is wrong or just the decode who knows at this point intterupts and jsa init needs looked at as well.

does the debugger work in this core?

mahoneyt944 commented 2 years ago

I believe so, but you have to set the flag in the makefile. I've never used it personally

mahoneyt944 commented 2 years ago

I created a branch mm2 with our combined work. https://github.com/libretro/mame2003-plus-libretro/compare/Mm2

mahoneyt944 commented 2 years ago

Seems like the video code is pretty close, but the decode, palette length, or color table is off

marblmd2-220527-010639

arcadez2003 commented 2 years ago

Single playfield and different pallette by looks im checking other Atari drivers to find games with a similar hookup as we might luck out and find a very similar or exact drawing routine as used by mm2

mahoneyt944 commented 2 years ago

Indy Jones and roadrunner maybe?

arcadez2003 commented 2 years ago

Im asking dink and iq_132 for some advice around which games to look at badlands maybe.?? any game using a single playfield will be worth a look right enough still not found where the pallette code is i assume it's somewhere in the generic Atari video.??

mahoneyt944 commented 2 years ago

Also should we null the eeprom? No idea if that batman one is compatible.

arcadez2003 commented 2 years ago

It cant hurt to disable it for now if we're unsure

MistyDreams commented 2 years ago

I highly doubt the decode is at fault here it more likely the video code.

arcadez2003 commented 2 years ago

I got some great help from a couple of top guys here is how it's looking now.....

https://imgur.com/FMRE0wy

https://imgur.com/X91OPw9

mahoneyt944 commented 2 years ago

You got it then?? What's the fix up?

MistyDreams commented 2 years ago

is mistakes in the memory map as well ive tidied it up. Will look at interrupts and the video code another day

arcadez2003 commented 2 years ago

Alright incase i should die here are the latest changes :)

dink iq_132 and myself have fixed the pallette colours and the broken sprite and tile layers i've further improved the sound by tweaking the rom boot values in REGION_SOUND1

The game is more or less playable now a couple of small niggles remain the screen sizeing is wrong and there is a small bug when the marble scrolls across the title screen i expect to have those sorted tonight all being well.

Feel free to test this out as you might spot some more niggles i've missed

even more wip.zip

mahoneyt944 commented 2 years ago

Nice work, I've added the gfx fixes to mm2 branch. I notice the ball glitch on the title screen only happens on the initial load. If you press the joystick while in attract mode it cycles through the screens so you can replay the title screen quickly. Looks fine after the first run.

arcadez2003 commented 2 years ago

Yip i noticed that as well also if you do an ingame reset it doesn't do it either i might have a fix for this later in the meantime tthis might fix the screen sizeing haven't tried it as yet as it's dinner time now ::)

MDRV_SCREEN_SIZE(456, 262)
mahoneyt944 commented 2 years ago

It's noon here ha, lunch. I'll test it out

mahoneyt944 commented 2 years ago

Pushed the initial wip branch #1339.

mahoneyt944 commented 2 years ago

Also noted, this dip option takes you to the test menu and the text is garbled. marblmd2-220527-132431 marblmd2-220527-132444

mahoneyt944 commented 2 years ago

Also player 3 "insert coin" is not displaying, don't know if player 3 even works. Dip options don't seem to help.

MistyDreams commented 2 years ago

that should be what service mode gives you. @arcadez2003 nice work on the video didnt realize it was the wrong palette we where using.

MistyDreams commented 2 years ago

it doesnt like the interrupts are done right

arcadez2003 commented 2 years ago

Also player 3 "insert coin" is not displaying, don't know if player 3 even works. Dip options don't seem to help.

JSA_III_PORT doesn't support 3rd player coins check sndhrdw/ atarijsa.h we could try to add in a third coin.

arcadez2003 commented 2 years ago

Hmm i tried to add in another version with 3rd player coins but no dice it's maybe not as simple as that

define JSA_III_PORT_3_PLAYER \

PORT_START                                              \
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )             \
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )             \
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )             \
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE )           \
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )    /* self test */\
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )    /* output buffer full */\
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )    /* input buffer full */\
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )    /* self test */
arcadez2003 commented 2 years ago

that should be what service mode gives you. @arcadez2003 nice work on the video didnt realize it was the wrong palette we where using.

Oh i did minimal work on it TBH it's dink and iq_132 the FBN boys more or less who helped me fix it up

mahoneyt944 commented 2 years ago

Glad it's working, I danced around the 256 palette a bunch....I knew it had something to do with it, but just couldn't figure it out. Lol

arcadez2003 commented 2 years ago

Glad it's working, I danced around the 256 palette a bunch....I knew it had something to do with it, but just couldn't figure it out. Lol

Aye same here i kinda knew what had to be done but was unsure how to go about it, i was staring at the code for several hours last night then thought i have to admit to myself this was above me, so when the FBN boys offered to help us out well i didn't need to be asked twice :)

Not that i didn't think you boys might suss it but well better to get this done while the goin is good in lighting quick time by taking the offer to help when it was mentioned as well they might be too busy to help at some other time plus it means i can get back to Lego Starwars on my Switch sooner that i thought ;)

So inputs then they might need some work to fix player3 or we leave it be and just tell folk we only support a 2player version LOL

mahoneyt944 commented 2 years ago

Lol except that pesky green ball on the title screen blowing our cover 😂

mahoneyt944 commented 2 years ago

Left side of the screen looks correct now, but the right side looks like we are missing a strip of pixels maybe? Based on the outline box on the title screen

arcadez2003 commented 2 years ago

Ok dink has kindly sent me another fix to sort that gfx issue on the title screen and some advice as to get the best screen sizeing isn't he a smashing fella, i'll commit there changes later now all that remains IMO is to sort player 3

MistyDreams commented 2 years ago

thought you finished the gfx already!

arcadez2003 commented 2 years ago

Well there was the small matter of that bug on the title screen and the screen position being off a bit, minor stuff yes but it still counts and gfx work and it's better to have everything as perfect as it can be, right just the missing player 3 to sort which im trying to now.

MistyDreams commented 2 years ago

the ball seems t0 be leaving a trail now during the demo dont recall its doing that yesterday. I did fix the dip switch so service worked. I also done a little video update to test. Seems there is a miss alignment you can see it when your is the service mode.

This will fix your service mode dip not working https://github.com/MistyDreams/mame2003-plus-libretro/blob/4c883a5e66f185d1a64c23ecc92dd3dcf0958bf1/src/drivers/batman.c#L84-L97