libretro / mame2003-plus-libretro

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

Backport request: Fantasy Zone II - The Tears of Opa-Opa (fantzn2x) #1239

Closed vaguerant closed 2 years ago

vaguerant commented 2 years ago

The original Fantasy Zone was released for Sega System 16 and is emulated in MAME 2003 Plus. The sequel, Fantasy Zone II, was originally a Sega Master System exclusive, but in 2008 Sega contracted M2 to port the game to System 16 hardware.

The new Fantasy Zone II runs on a slightly modified System 16 board, with more RAM than the original boards. It was added to MAME in mid-2012, well beyond MAME 2003/0.78, but I'm hoping the changes needed are small enough that the 2003 version of the driver could have System 16C/Fantasy Zone II support added without the need to backport too much.

Here's the commit which added Fantasy Zone II to MAME. mamedev/mame@bac858b0a3f73860847e7430ba97b9c8657ddccb MAME was still using the old non-commercial license at this point, so even if it isn't directly usable, it should be fine to reference its code.

arcadez2003 commented 2 years ago

@arcadez2003 is assume you came up with that fix for wrestle fest ?

Nope i was at the fitba Scotland mince as usual, i have no code to share im hanging off torymon video and was messing about with the sprite offsets and spritelist end until i asked someone about it and they told me it's likely a sprite wrapping issue.

Not had time to look into it further i may not bother TBH.

MistyDreams commented 2 years ago

@arcadez2003 i mean in the past I see a fix was put in for that game specifically. Im not too interested in taking this on either if you remove the hacks youll need to update the drivers. I tale it we have all sysem16 on some form ie bootlegs now ?

mahoneyt944 commented 2 years ago

This really feels like a parameter issue when drawing. The top, bottom, and right sides all allow sprites to roll off screen as they should. The left side just has a small strip where sprites can not be drawn. Seems like we need to extend this parameter on the left side of the screen to allow drawing here. Maybe we can adjust this in the video code with an offset or something? @dinkc64, I'm guessing arcadez inquired about this issue with you already, if not I'm sorry to have bothered you 🙃, but I'm curious about your opinion. One of the assumptions was sprite wrapping, but if this were the case wouldn't we see sprites warping onto other sprites or something? This issue is very consistent, as if the sprites hit a wall where the video code thinks its no longer required to draw.

mahoneyt944 commented 2 years ago

One of the odd things is that the service menu script test allows all sides to work correctly with the sprite fantzn2x-220602-014704

arcadez2003 commented 2 years ago

@arcadez2003 i mean in the past I see a fix was put in for that game specifically. Im not too interested in taking this on either if you remove the hacks youll need to update the drivers. I tale it we have all sysem16 on some form ie bootlegs now ?

It wasn't just Wrestle War quite a few Sega games benefited from it, i cant mind all of them off the top of my head but removing this update will make no difference as my MAME72 test core doesn't have it and still Fantasy Zone II has that sprite bug.

mahoneyt944 commented 2 years ago

What I don't understand is why 3 sides of the screen are working but the left side has a cutoff. There has to be a shift or offset or something to account for this. We just can't draw there, while in game anyways.

MistyDreams commented 2 years ago

try setting sys16_18_mode = 1

mahoneyt944 commented 2 years ago

Sure, 1sec.

mahoneyt944 commented 2 years ago

That's the default anyhow for system18, so should be active already. https://github.com/libretro/mame2003-plus-libretro/blob/755e64ed8c7f1fdc5d69e65084a3355c51107937/src/vidhrdw/system16_vidhrdw.c#L1016

MistyDreams commented 2 years ago

have you tried setting it with system16 video ?

mahoneyt944 commented 2 years ago

I have not. It's not an external variable either so you'd have to extend it out or make a new video start with the change.

What about a blanking issue? The sprite does disappear like it reached the end of the active screen.

MistyDreams commented 2 years ago

not at home cant test this here. It would be probably be better getting the video hardware source cleaned down and fix drivers after its cleaned then trace from there. Also im pretty sure is the bootleg video code might want to check against mame if there is a difference between the bootleg and real hardware instead of guessing that will be a fair bit of graft for one game

arcadez2003 commented 2 years ago

That's the default anyhow for system18, so should be active already.

https://github.com/libretro/mame2003-plus-libretro/blob/755e64ed8c7f1fdc5d69e65084a3355c51107937/src/vidhrdw/system16_vidhrdw.c#L1016

If you do this sys16_sprxoffset = -0x48; the cut off point or deadzone moves to the centre of the screen i still think there could be a variable which will be correct for all of the playfield it's finding it though

MistyDreams commented 2 years ago

well we default too sys16_spritesystem = sys16_sprite_shinobi; if its not set there are a few there if you guys feel like testing

arcadez2003 commented 2 years ago

Video update system 16 sys16_sprxoffset = -0xb8; by default, this is obviously not correct for this game hence the sprites are cut off on the far left panel, this is my two cents but i could be wrong :)

MistyDreams commented 2 years ago

I hope your right might luck it out and the bootleg will work. Im not willing spend any more time fixing one game if it was a bigger picture maybe.

arcadez2003 commented 2 years ago

Well im thinking with the correct sprite offset the game will be fine it's finding it though eh, as things stand we need to alter this slightly sys16_sprxoffset = -0xb8 to shift the sprite layer slightly to the left.

MistyDreams commented 2 years ago

can easily add key presses to increase/decrese the value

arcadez2003 commented 2 years ago

I did put -15 to shift the sprites across to the left more just to see if we'd still get that cutoff and it still happens well im outta ideas and dont fancy trying to rewrite some sprite code most likely to fit in with this game as it's not worth it really.

@mahoneyt944 just add an imperfect gfx flag to this one and let's be done with it imo

P.S humour me here these is a fix for Wrestle War it's sprite list end related i think as a last roll of the dice try turning it off to see if it's sorts the problem //sys16_wwfix = 1;

EDIT Nope that didnt sort it oh well

mahoneyt944 commented 2 years ago

can easily add key presses to increase/decrese the value

Yeah might be worth a try, should be able to add key presses to the video update and use the usrintf_showmessage to display the value

MistyDreams commented 2 years ago

sorted on my branch one line fix

mahoneyt944 commented 2 years ago

@MistyDreams nice work 👍.

mahoneyt944 commented 2 years ago

@MistyDreams testing all these games doesn't sound fun, maybe we should hook this up separately. Created a PR #1359 to do just that, unless you feel confident that all these games will work with that change.

mahoneyt944 commented 2 years ago

Also after some clean up in the driver, I wonder if we should be using this for wrestwar too. Hwchamp and fantzn2x share this. Maybe wrestwar as well?

sys16_tile_bank0 = sys16_extraram[0]&0xf;
sys16_tile_bank1 = sys16_extraram[1]&0xf
MistyDreams commented 2 years ago

pretty sure this is good for the sprites all round however i havent looked beyond this game. and the could be varies hacks to fix it hidden round the code

mahoneyt944 commented 2 years ago

Yeah that's my concern, probably best to just separate it for now so we don't have test everything. But I'm also trying to clean up the driver a little too.

I'm going to try that fix with some other games to see if it helps or not.

arcadez2003 commented 2 years ago

@MistyDreams lovely work bigman i was a little downhearted last night but was planning to look at the sprite code today but it now seems i wont have to :) far be it for me to interfere but for the record all i did here was paste in the new sprites for fantzn2x hook it via system16.h and then like so in the driver......

static void fantzn2x_update_proc( void ){ set_fg_page( sys16_textram[0x740] ); set_bg_page( sys16_textram[0x741] ); sys16_fg_scrolly = sys16_textram[0x748]; sys16_bg_scrolly = sys16_textram[0x749]; sys16_fg_scrollx = sys16_textram[0x74c]; sys16_bg_scrollx = sys16_textram[0x74d];

sys16_tile_bank1 = sys16_extraram[1]&0xf;
sys16_tile_bank0 = sys16_extraram[0]&0xf;

}

static MACHINE_INIT( fantzn2x ){ sys16_spritesystem = sys16_sprite_fantzn2x; sys16_bg_priority_mode=2; sys16_bg_priority_value=0x0a00; sys16_update_proc = fantzn2x_update_proc; sys16_wwfix = 1; //* }

static DRIVER_INIT( fantzn2x ){ machine_init_sys16_onetime(); sys16_bg1_trans=1; sys16_MaxShadowColors=16; sys18_splittab_bg_y=&sys16_textram[0x0f40]; sys18_splittab_fg_y=&sys16_textram[0x0f00]; sys16_rowscroll_scroll=0x8000; }

Seems the simpilest way TBH although as @mahoneyt944 said some other games might just benefit from using the new sprite code.

mahoneyt944 commented 2 years ago

@vaguerant this game is working now if you want to try it out. Closing this issue.

I'm going to start a new one for wrestwar though

arcadez2003 commented 2 years ago

Nice job on this guys someone posted on retropie that it playes great for them as it was too slow in FBN and later MAME i love posts like that it just goes to show our faster core and in this case faster Sega code ended up being a real boon for that user.

And that's one of the reasons i like working on this core, they did mention however that the high scores dont save i suppose if none of the other Sega 16 games save either then it's just the lack of save support in the driver but if they all do.?? then we might have missed something.?? one to check on a rainy day.

MistyDreams commented 2 years ago

retropie name makes me want to eat something! haha

mahoneyt944 commented 2 years ago

I read somewhere that a lot of games use nvram that's not hooked up, but you could scout newer hiscore files for entries

arcadez2003 commented 2 years ago

According to the user Alien Syndrome and the original Fantasy Zone save the highscores so maybe we missed something.??

MistyDreams commented 2 years ago

think the workram will be the eprom to be honest

mahoneyt944 commented 2 years ago

Good reference, fantzone is in the hiscore.dat along with many of the other games. So we'd need to add and entry for this to work. https://github.com/libretro/mame2003-plus-libretro/blob/7ff51a1524b01da721f7768b67ecc3a8e69b55a8/metadata/hiscore.dat#L11523-L11526

Edit, it doesn't look like fantzn2x or fantzn2 was ever added to hiscore.dat, referencing the current one in mame. So unless someone wants to make an entry for it.....probably a no go. That said, I'd imagine it might be similar to another system16 game, but that's a shot in the dark without looking for the address.

MistyDreams commented 2 years ago

you need a nvhandler for workram have different sizes now