rafaelvcaetano / melonDS-android

Android port of melonDS
GNU General Public License v3.0
797 stars 48 forks source link

New super mario bros #617

Closed Theoscar707 closed 2 years ago

Theoscar707 commented 3 years ago

Problem:
Insert a small description of the problem.

Stack trace:

g6.c: Could not create temporary SRAM file at content://com.root.clean.boost.explorer.filemanager.externalstorage.documents/tree/download%3ANew%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).zip/document/download%3ANew%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).zip
    at me.magnum.melonds.ui.emulator.EmulatorViewModel.I(Unknown Source:117)
    at me.magnum.melonds.ui.emulator.d1.I(Unknown Source:75)
    at me.magnum.melonds.ui.emulator.d1.i(Unknown Source:0)
    at me.magnum.melonds.ui.emulator.c1.a(Unknown Source:8)
    at c4.a.v(Unknown Source:10)
    at o3.t.b(Unknown Source:14)
    at c4.f$a.c(Unknown Source:27)
    at c4.p$b.c(Unknown Source:26)
    at c4.p$c.c(Unknown Source:4)
    at z3.m$a.c(Unknown Source:6)
    at z3.j$a.run(Unknown Source:21)
    at o3.s$a.run(Unknown Source:9)
    at e4.k.run(Unknown Source:13)
    at e4.k.call(Unknown Source:0)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:919)

Configuration:

RomCrashContext(emulatorConfiguration=EmulatorConfiguration(useCustomBios=false, showBootScreen=false, dsBios7Uri=null, dsBios9Uri=null, dsFirmwareUri=null, dsiBios7Uri=null, dsiBios9Uri=null, dsiFirmwareUri=null, dsiNandUri=null, internalDirectory=/data/user/0/me.magnum.melonds/files, fastForwardSpeedMultiplier=-1.0, useJit=false, consoleType=DS, soundEnabled=true, micSource=BLOW, firmwareConfiguration=FirmwareConfiguration(nickname=Player, message=Hello!, language=1, favouriteColour=0, birthdayMonth=1, birthdayDay=1, randomizeMacAddress=false, internalMacAddress=00:09:BF:AA:6D:10), rendererConfiguration=RendererConfiguration(videoFiltering=LINEAR, threadedRendering=true)), romSearchDirUri=content://com.root.clean.boost.explorer.filemanager.externalstorage.documents/tree/download%3ANew%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).zip, romUri=content://com.root.clean.boost.explorer.filemanager.externalstorage.documents/tree/download%3ANew%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).zip/document/download%3ANew%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).zip%000479%20-%20New%20Super%20Mario%20Bros.%20(Europe)%20(En%2CFr%2CDe%2CEs%2CIt).nds, sramUri=null)
coderkei commented 3 years ago

Are you loading the ROM from a file manager and not via the app?

It looks like MelonDS is loading the ROM from the File Manager's temporary folder and its not able to create a save file there.

Looking at the stack trace it looks like you are opening the ROM as a ZIP file. I would advise extracting the ROM to the NDS file and loading that file inside the app.

You can use Zarchiver or RAR for Android to extract the zip.

rafaelvcaetano commented 3 years ago

The problem is that some devices allow the file explorer to open ZIP files and use it as a directory, when it is in fact a file. As such, save files cannot be created inside of them and the ROM fails to load. A workaround is to select the directory that contains the ZIP archive or to extract the files.

I've been trying to find a device that allows this so that I can further analyse this behaviour and prevent such directories from being selected, but I have none in my possession.

coderkei commented 3 years ago

The problem is that some devices allow the file explorer to open ZIP files and use it as a directory, when it is in fact a file. As such, save files cannot be created inside of them and the ROM fails to load. A workaround is to select the directory that contains the ZIP archive or to extract the files.

I've been trying to find a device that allows this so that I can further analyse this behaviour and prevent such directories from being selected, but I have none in my possession.

It looks like they are using FileMaster to load the ROM from the zip.

To be fair its pretty typical behaviour for most file managers to cache the contents of the zip to a read-only folder, or the folder has R/W permissions but is immediately deleted as soon as the file is loaded. Depends on the file manager.

One solution you could try is giving the option (or by default considering most users will probably load ROMs from zip files) storing the save files in a directory created by MelonDS. Some other DS emulators do it this way, having a central folder that stores all save states and save files etc).

Their device (Samsung Galaxy J8) officially supports Android 9 so I would doubt this is anything to do with Android 11 if that is any possibility. I know that has broken a lot of apps.

rafaelvcaetano commented 2 years ago

This should be fixed in the Beta 1.7.0 release. If it doesn't allow you to select the folder with the ROMs, try extracting them.