libretro / mame2003-plus-libretro

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

[3DS] sailormn - Opening RetroArch Menu Crashes System #986

Closed ChainSwordCS closed 3 years ago

ChainSwordCS commented 3 years ago

20210308_142254 Game: Pretty Soldier Sailor Moon (Ver. 95/03/22B, Europe) / sailormn.zip

On New 3DS, in-game when I try to open the RetroArch menu, it crashes the system. The crash screen is attached. I don't have any game-specific options, and I even tried deleting the existing MAME 2003 Plus config to no avail.

This does happen to me with some RetroArch emulators when trying to launch games that are not supported or not correctly formatted, but this game runs fine (albeit 35-40 fps).

I think the version number might be 71a461c, I downloaded this CIA from the BuildBot about 12 hours ago.

mahoneyt944 commented 3 years ago

This may not be an issue with the core specifically, but a memory limitation of the 3ds causing an overflow. Is it only the rom you listed or all roms doing this?

ChainSwordCS commented 3 years ago

It's only this rom as far as i know.

mahoneyt944 commented 3 years ago

Ok. I just tested this rom on Android and there are no issues with accessing the menu. I do notice this rom is noticably larger than most rom.zip files too which also points to memory issues on the 3ds.

There is another version of sailormn we support but it's just as large and will probably have the same issues. The same machine code sailormn uses is used by agallet.zip but it's half the size of sailormn. You might be able to test that rom and see if the menu problem exists or not.

I suspect sailormn is just using up too much memory and crashing Retroarch.

ChainSwordCS commented 3 years ago

I'll get around to testing both of those.

ChainSwordCS commented 3 years ago

I actually tried sailormn in MAME 2003 on 3DS and did not experience this issue.

agallet works fine, no issue opening the menu.

Huh, the other one this emulator supports, sailormo, is part of an older romset and was I think renamed to sailormno.

Anyway, sailormo suffers the same issue as sailormn.

mahoneyt944 commented 3 years ago

If it's working in mame2003 and not in mame2003-plus I'll need the commit versions you are using of each.

Load each emulator then open Retroarch. The bottom of the screen will display the emulator name followed by the commit number

ChainSwordCS commented 3 years ago

I'm still running MAME 2003-Plus 71a461c

And I'm running MAME 2003 (0.78) (67c10fa)

They're both very recent builds, from the past few days.

mahoneyt944 commented 3 years ago

It looks like a good many commits were done by @markwkidd and @arcadez2003 for sailormn's driver files, "cave". I'll have to sort through them to see if I see anything odd.

My suspicion is that it could be something like an imbedded comment issue or memory line that changed which is shared with another game. It seems to be specific to 3ds since I don't experience any issues with this on Android. So it could also be something with compiling, though the makefiles are very similar.... Maybe a syntax thing the 3ds doesn't like.

mahoneyt944 commented 3 years ago

@ChainSwordCS just for information purposes what retroarch version are you using for each emulator? Are you using the same 3DS to run both emulators? Same memory card, same rom file etc? Any other differences to be aware about?

arcadez2003 commented 3 years ago

@mahoneyt944 none of the commits by me actually directly or indirectly affect Pretty Soldier Sailor Moon nothing codewise that game uses have been touched more or less, i had a quick look at the cave.c driver in MAME2003 vs ours and although your right in the sense there are many commits over and above what the same driver has in the original core........

https://github.com/libretro/mame2003-plus-libretro/commits/4134f4c9ce8ae84a690b49fe09730c53ce093522/src/drivers/cave.c

The same could be said with regards to this core also so the problem might lie outside the driver rather than inside it as on first glance there dont seem to be any changes in our driver which could be causing this issue, but ya never know so i'll have a more in depth look using winrar later.

arcadez2003 commented 3 years ago

@mahoneyt944 i'd like to add a test driver basically cave.c from MAME2003 as we know that driver does not have the same issue, that way we can rule out this being a wider core issue, then one with only my commits added to it and that way if Sailormoon then works as it should on the 3DS then we can narrow it down to jut four possible commits as being the likely culprit.

But since we'd be leaving out @markwkidd's debugging/logging and some silly / / changes im not sure if it would then compile in this core.?? i thought it worth asking ya first less i cause some needless breakage :)

mahoneyt944 commented 3 years ago

I believe a lot of of drivers still have // in them so it's probably ok. And debug stuff can probably pass a build too.

ChainSwordCS commented 3 years ago

20210311_112355 Yes same 3DS system, same microSD card, same shared ROM files between cores. Both of them are RetroArch 1.9.0.

And out of curiosity, here's how it looks with Luma's exception handler disabled...

ChainSwordCS commented 3 years ago

And here's the crash dump file, it's not really very human readable though.

crash_dump_00000001.dmp.txt

arcadez2003 commented 3 years ago

And here's the crash dump file, it's not really very human readable though.

crash_dump_00000001.dmp.txt

I've added a new test driver try updating to latest build and see if your problems are solved.

https://github.com/libretro/mame2003-plus-libretro/commit/e1ac1b7aa45fc57b3be03be96093424a90b20c24

ChainSwordCS commented 3 years ago

I did try e1ac1b7, which happens to have been built by the BuildBot. Apologies I don't have a build environment set up.

And I still get the error, I'll attach the image in a minute...

20210311_155705

arcadez2003 commented 3 years ago

@ChainSwordCS Ok if you could try it one last time using the same driver as MAME2003 then we can rule out or not an issue with our cave.c.......

06258ad

If it still crashes then we have to assume the problem is caused by a change elsewhere in source rather than in the driver

Regards

ChainSwordCS commented 3 years ago

I'm actually running 024c377 which is the latest one, but there are no differences in cave.c

I still have the same crash as before, unfortunately.

arcadez2003 commented 3 years ago

Ok thanks for testing this means we can rule out the game crashing due to a problem in our cave.c driver unfortunately though this means it's a change somewhere else in the source which is behind this and tracking it down might be akin to finding the ole needle in the haystack.

mahoneyt944 commented 3 years ago

Maybe debug level log the crash?

arcadez2003 commented 3 years ago

Maybe debug level log the crash?

Aye well now i've established it wasn't me that actually broke the game i kind of feel whomever did should sort it :P

mahoneyt944 commented 3 years ago

Without knowing when it actually broke, it's a guessing game. We'd have to do the same thing for every file sailormn uses.

arcadez2003 commented 3 years ago

Some of the cave.c games use an eeprom via a nvram file to store game data that might be an area worth a look

Im sorry if you think im being an ass here, honesty is as they say always the best policy even if it makes me look like a muppet in the process, im not from programming background i never turned on a pc till 2006 :)

The simple fact is i never bothered with trying to learn how to debug MAME or FBN code as i always seemed to luck out with my guesswork, plus i could never get a debug version of the xbox arcade cores to actually compile in the first place they always errored out if i tried to.

Sure it would have likely saved me some hastle in the long run and i wish i had put in the time as i'd love to run a debug on Ghox to see why it's not booting in MAME78, so since i dont want you to think im being a prick here it's best to just tell ya i dunno how to debug the game in this core.

mahoneyt944 commented 3 years ago

I looked through eeprom and z80 stuff I can't seem to find anything.

@ChainSwordCS I would suggest enabling debug level log, and log to file in Retroarch then run sailormn and crash it. Then post the log here.

Retroarch-> settings-> logging verbosity-> enable

Set the logging level core and frontend to debug. Then enable log to file.

Try it out then copy the log here. Remember to disable the logging after you're done or else you'll get big slowdowns.

ChainSwordCS commented 3 years ago

Yeah I can do that in a few hours, I'm happy to help 🙂

ChainSwordCS commented 3 years ago

Luma 3DS Arm11 Crash Dump (less useful): crash_dump_00000002.dmp.txt

RetroArch Debug Log: retroarch2021_03_1412_40_06.log

I wanted to let the game run a bit, but it was 1 frame per second so I crashed it around 380~ frames.

mahoneyt944 commented 3 years ago

I can't see anything in the log. I've tested this on android and rpi3 retropie with no issues. So it seems it's a 3DS only issue or something with your setup. I guess if we could test against another 3ds to confirm would be useful.

ChainSwordCS commented 3 years ago

I could test on another console sometime (previous tests are on New 3DS, "Old" 3DS could be different too).

And I could test the .3dsx version (different homebrew program file format, was using .cia)

mahoneyt944 commented 3 years ago

I could test on another console sometime (previous tests are on New 3DS, "Old" 3DS could be different too).

And I could test the .3dsx version (different homebrew program file format, was using .cia)

That would be useful

ChainSwordCS commented 3 years ago

Alright I'll finally get around to testing more.

ChainSwordCS commented 3 years ago

I actually couldn't get the .3dsx version of RetroArch running on my New 3DS XL for some reason, probably conflicting configuration files or something. Actually when I tried to run the .3dsx version on Old 2DS, I ran into issues as well. I've heard RetroArch 3DS is a bit touchy...

Will try to test the .cia version of RetroArch on Old 2DS in a bit.

ChainSwordCS commented 3 years ago

It seems that sailormn is actually not able to run on Old 2DS (and by extension probably Old 3DS). I get an error "unable to allocate memory for region 140" during the boot process, so yes it's likely a memory related issue even on New 3DS.

If you don't know, New 3DS is capable of higher CPU clock speed and more RAM compared to 'Old' 3DS.

And in MAME 2003, RetroArch closed with some error I didn't see... probably also memory related.

image

mahoneyt944 commented 3 years ago

Not much can be done about memory if that's the case.

arcadez2003 commented 3 years ago

Someone would need to create a virtual memory program like what we have on the xbox where as the memory is loaded seperately in smaller blocks rather than one big chunk.

There are device specific RA cores kicking around where the dev's have added similar VMM routines for example i noticed an FBA core which has one so that some of the bigger NeoGeo and CPS3 games would be able to boot but i cant mind the platform it was aimed at.??

it might have been the WII right enough but anyway just shooting the breeze here as i dont have the skill sets to create a VMM program for this core from scratch.

mahoneyt944 commented 3 years ago

Closing this as this appears to be a memory limitation of the 3ds and not an actual bug within the core. I'd suggest opening a new issue if you wish to request a virtual memory manager as mentioned above. Thank you.