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

Android version crashing when loading gzipped images for the first time #484

Closed
veganvelociraptor opened this issue Jan 11, 2023 · 6 comments · Fixed by #485
Closed

Android version crashing when loading gzipped images for the first time #484

veganvelociraptor opened this issue Jan 11, 2023 · 6 comments · Fixed by #485

Comments

@veganvelociraptor
Copy link

veganvelociraptor commented Jan 11, 2023

RetroArch has plenty of general issues with random crashes on my Nvidia Shield when using the UI and what not. I've had some spare time lately so Idecided to try to find what's causing the crashes, and decided to start with the VICE cores, as they have some extraordinary issues which doesn't seem to plague most of the other cores I've tried on the Nvidia Shield.

It took me a while but I finally managed to pinpoint it. I've confirmed this also happens on a freshly installed RetroArch on an Android phone.

Steps to reproduce:

  1. Install the RetroArch apk on the device
  2. Install the VICE cores
  3. Copy over all the necessary system roms, a few .d6z (gzipped d64 files) and some zipped .crt files
  4. Open up any .d6z image, result: app crash (I'm not sure how CTD, Crash To Desktop, translates on a mobile phone or Android TV device)
  5. It will keep crashing until you open up a zipped .crt file instead, which runs just fine
  6. Now you can load the .d6z image that previously crashed RetroArch

Log file no. 1: Opening a .d6z image file on a freshly installed RetroArch

Arg0: x128
Arg1: /storage/emulated/0/RetroArch/roms/Commodore - 64/1942.d6z
Reading configuration file '/storage/emulated/0/RetroArch/system/vice/'.
--------------------------------------------------------------------------------
VICE x128 (C128) 3.5 b69a803, Jan 11 2023 06:14:17
--------------------------------------------------------------------------------
C128MEM: Kernal rev #1.
DriveROM: 2000 ROM image not found. Hardware-level 2000 emulation is not available.
DriveROM: 4000 ROM image not found. Hardware-level 4000 emulation is not available.
DriveROM: CMDHD ROM image not found. Hardware-level CMDHD emulation is not available.
Drive: Finished loading ROM images.
Sound: Available sound devices: retro
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1541-II.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1571_repl310654.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1581.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C64.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C128.bin'.
C128MEM: Kernal rev #1.
C128MEM: Warning: Kernal image may be corrupted. Sum: 7099.
REU: 512KiB unit installed.
AUTOSTART: Autodetecting image type of '/storage/emulated/0/RetroArch/roms/Commodore - 64/1942.d6z'.

App crashes

Log file no. 2: Opening the next .d6z image file in the list

Arg0: x128
Arg1: /storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z
Reading configuration file '/storage/emulated/0/RetroArch/system/vice/'.
--------------------------------------------------------------------------------
VICE x128 (C128) 3.5 b69a803, Jan 11 2023 06:14:17
--------------------------------------------------------------------------------
C128MEM: Kernal rev #1.
DriveROM: 2000 ROM image not found. Hardware-level 2000 emulation is not available.
DriveROM: 4000 ROM image not found. Hardware-level 4000 emulation is not available.
DriveROM: CMDHD ROM image not found. Hardware-level CMDHD emulation is not available.
Drive: Finished loading ROM images.
Sound: Available sound devices: retro
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1541-II.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1571_repl310654.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1581.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C64.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C128.bin'.
C128MEM: Kernal rev #1.
C128MEM: Warning: Kernal image may be corrupted. Sum: 7099.
REU: 512KiB unit installed.
AUTOSTART: Autodetecting image type of '/storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z'.

App crashes

Log file no. 3: Opening a zipped .crt file

Unzip: /storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt
->M3U: /storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.m3u
M3U/VFL parsed, 1 file(s) found
Arg0: x128
Arg1: /storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt
Reading configuration file '/storage/emulated/0/RetroArch/system/vice/'.
--------------------------------------------------------------------------------
VICE x128 (C128) 3.5 b69a803, Jan 11 2023 06:14:17
--------------------------------------------------------------------------------
C128MEM: Kernal rev #1.
DriveROM: 2000 ROM image not found. Hardware-level 2000 emulation is not available.
DriveROM: 4000 ROM image not found. Hardware-level 4000 emulation is not available.
DriveROM: CMDHD ROM image not found. Hardware-level CMDHD emulation is not available.
Drive: Finished loading ROM images.
Sound: Available sound devices: retro
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1541-II.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1571_repl310654.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1581.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C64.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C128.bin'.
C128MEM: Kernal rev #1.
C128MEM: Warning: Kernal image may be corrupted. Sum: 7099.
REU: 512KiB unit installed.
AUTOSTART: Autodetecting image type of '/storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt'.
Filesystem Image Probe: Import GCR: Unknown GCR image version 82.
Filesystem Image: Unknown disk image '/storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt'.
Tape: Cannot open file '/storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt'
CART: attached '/storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt' as ID 19.
AUTOSTART: '/storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP/4th and Inches.crt' recognized as cartridge image.
Main CPU: starting at ($FFFC).
Main CPU: RESET.

Game runs

Log file no. 4: Opening the .d6z image file that previously caused RetroArch to crash

Arg0: x128
Arg1: /storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z
Reading configuration file '/storage/emulated/0/RetroArch/system/vice/'.
--------------------------------------------------------------------------------
VICE x128 (C128) 3.5 b69a803, Jan 11 2023 06:14:17
--------------------------------------------------------------------------------
C128MEM: Kernal rev #1.
DriveROM: 2000 ROM image not found. Hardware-level 2000 emulation is not available.
DriveROM: 4000 ROM image not found. Hardware-level 4000 emulation is not available.
DriveROM: CMDHD ROM image not found. Hardware-level CMDHD emulation is not available.
Drive: Finished loading ROM images.
Sound: Available sound devices: retro
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1541-II.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1571_repl310654.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_1581.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C64.bin'.
Loading system file '/storage/emulated/0/RetroArch/system/vice/JiffyDOS_C128.bin'.
C128MEM: Kernal rev #1.
C128MEM: Warning: Kernal image may be corrupted. Sum: 7099.
REU: 512KiB unit installed.
AUTOSTART: Autodetecting image type of '/storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z'.
AUTOSTART: Attached file '/storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z' as a disk image.
AUTOSTART: mounted image is type: 1541, not changing drive.
AUTOSTART: Resetting drive 8
AUTOSTART: Resetting the machine to autostart '*'
AUTOSTART: '/storage/emulated/0/RetroArch/roms/Commodore - 64/1943 - One Year After.d6z' recognized as disk image.
Main CPU: starting at ($FFFC).
Main CPU: RESET.

Game runs

In the examples above I used the c128 core, which because I wanted to see if it was reproducable regardless if I used the x64sc, x64, xscpu and x128 variants. And it was.

@sonninnos
Copy link
Collaborator

That indeed isn't making much sense since zip and gzip are using a totally different method (first one extracts to temp, second one is read directly), but they do use the same ZLIB library of course..

And I can't reproduce it with desktop either, so the only thing that could ease the pain is a proper stack trace of the crash.

Also I'm in the middle of updating the codebase to 3.7 (and almost finished), so juggling with many hot plates isn't too fun.

@veganvelociraptor
Copy link
Author

Is there any new directory created, or something that changes when a .crt file is opened for the first time? Because now after that, the only way I can get the error to reappear again is to install RetroArch on another Android phone. And this is across all the VICE cores, regardless in which core I opened up the .crt file. I'll try later this week to see if this can be "fixed" by loading something other than a zipped .crt.

Unfortunately I'm not familiar at all with Android development or how to do a stack trace on a phone. I'll see if there's a usable x86/x64 Android which runs in Vbox/VMware with not too much hassle, just to see if I can rule out ARM being the cause of this.

@sonninnos
Copy link
Collaborator

sonninnos commented Jan 12, 2023

As the log says, the extraction happens under saves in TEMP dir, and it stays once it is created, so that it can be mounted as a RAM drive for future use.

But again, that should not matter in any way with gzipped files, since they are not extracted to that temp dir..

And no, nothing happens with crt files alone, only zips and 7zs, and it does not matter what is inside.

@veganvelociraptor
Copy link
Author

Is there any new directory created, or something that changes when a .crt file is opened for the first time?

I checked all directories by looking at the time stamps. Only thing I found that changed, is that a /storage/emulated/0/RetroArch/saves/Commodore - 64/TEMP directory was created which didn't previously exist. If this is the cause, it should be easy to check by doing an mkdir TEMP before running RetroArch the first time. I'll update once I tried that.

@sonninnos
Copy link
Collaborator

sonninnos commented Jan 12, 2023

But hot damn, it does matter. I tried removing the temp dir and d6z no longer starts..

I guess I'll have to fix that in the current version then since it can be reproduced.

@sonninnos
Copy link
Collaborator

Hah, the internal method does actually want to extract it after all, but via the archdep method that I've redirected to use the same common temp dir, because snapshots when using tapes wanted to use the temp for extracting tape data, which I have disabled.

Which means the fix was trivial and coming right up.

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

Successfully merging a pull request may close this issue.

2 participants