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

[iOS5 - iOS9] BIG BUG in 80% games / application random crashes when using dynarec x32 #503

Closed
dagazik opened this issue Feb 21, 2021 · 8 comments

Comments

@dagazik
Copy link

dagazik commented Feb 21, 2021

The device that I use is the first generation iPad (not officially supported by the community), but in the process of debugging another problem, I found a commit with which the dynarec behavior changed. Further investigation showed that this error affects in one way or another 80% of games on armv7 and ios 5-9(maybe even 10).

Description

Bug is in application crashes when using dynarec x32:

  • or always crashes at specific points (NOT DEPENDS on the game session).
  • or random crashes at specific points (DEPENDS on the game session)
  • or random crashes anywhere (DEPENDS on the game session)

When I say "DEPENDS on the game session" I mean that: sometimes I can play for several hours without interruption, and sometimes the game crashes after 5-10 minutes.

This looks like a lack of RAM, but the analysis of the task manager, as well as the AppleСrashReport, suggests that there is a problem in something else.

Steps to reproduce

Here are some bug games:

  1. Crash Bandicoot 2 / Sometimes crashes during the game
  2. Castlevania Symphony of the Night / Always crashes after victory first boss
  3. Disney's Action Game Featuring Hercules / Always crashes at level three
  4. Diablo / Sometimes crashes after saving to a memory card
  5. FF7 / Sometimes crashes when entering and exiting combat
  6. Hogs of War / Always crashes when loading a workout
  7. Tomb Raider 2 / Sometimes crashes at the second level
    ...and many other games.

There are games that work flawlessly, but there aren't many.

When did the behavior start?

This is how the core ReARMed behaved before and after the commit d148d26:

iOS 5.1.1

BEFORE - It did not work and always crashed at boot,
AFTER - It works, but random crashed application (and retention in RAM, but I fixed it here).

iOS 9.3.5

BEFORE - Works fine.
AFTER - Works, but random crashed application. (you can read about it here and here)

Extract of test results from the libretro.com forum on iPad_mini 2012 with ios 9.3.5: (thanks to AfonsoH)

RESULT_Commit_d148d26_on_iOS_9 3 5_min

Since after the commit, the behavior on iOS 5 and iOS 9 as a whole became the same, I think that the error has common roots (adjusted for the fact that for some reason this happens much more often on the first generation iPad).

How to fix it?

Need to fix the code in one of these files(based on the working code from the commit 1fedf1e, but don't break ios5 support): assem_arm.c, new_dynarec.c

I can't do it on my own because I'm not a C developer but my guess is that the problem is working with clearing the cache, addressing RAM or buffer overflow.

Your device/OS/platform/architecture

My device: iPad1Gen 2010, SoC A4, 256Mb RAM, IOS5.1.1 + RetroArch 1.9.0(built with support ios5 from Weedy_Weed_Smoker) + ReARMed different years of make.

AfonsoH device: iPad_mini 2012, SoC A5, 512Mb RAM, IOS9.3.5 + RetroArch 1.9.0(built from libretro repository) + ReARMed different years of make.

Logs

Log file from RetroArch is created empty :(

Screenshots

This is a snapshot of the state of the iPad processes at the time of the crash.
As you can see from the screenshot the RAM is sufficient.

RAM RetroArc_ps1

@dagazik
Copy link
Author

dagazik commented Feb 22, 2021

This is what a CrashReport looks like when Diablo crashes(same error with other games): CrashReporter_diablo.zip
I do not see any additional information in it that could help in solution(except that it is not a forced close due to out of RAM).

@LexouDuck
Copy link

I saw this thread, and I just wanted to pop in to say that I can confirm the same crashing behavior occurs for me on iOS 10 (i.e. depending on the game, the crashes are either deterministic, or random)

using RetroArch 1.9.0 on iOS 10.3.3, with a 32-bit iPhone 5 (GSM model A1429), which is the last 32-bit iphone model before apple permanently switched over to producing 64-bit phones.

I am confident this is the same issue, since everything works flawlessly when I disable the "Dynamic Recompilation" setting from within the RetroArch "Core Options" menu. When I say "flawlessly", I mean haven't seen a crash in several hours of gameplay since I disabled the setting, while testing several games (it's slightly laggy with some audio stutters, but largely playable - and I imagine fixing dynarec and re-enabling it would help make it run a bit smoother, and fix both of these minor issues).

I also took a look at CrashReporter - doesn't give much info beyond the fact that's it's a SIGSEGV segfault signal that causes the crash, so it can be anything in the low-level code there...

Also, I had read some other threads mentioning how apparently dynarec will work fine on jailbroken devices - from my personal experience, this is not the case (my device was jailbroken via h3lix - it's a semi-untethered jailbreak, so maybe that's a factor ?)

@dagazik
Copy link
Author

dagazik commented Feb 26, 2021

To check the effect of the jailbreak type on stability of work with dynarec, you can try running a version where there has not been a problem of random crashes yet: pcsx_rearmed-2016-09-19_r22_1fedf1e-no_sign.zip (note: this version are not signed with a developer certificate, but on a device with full Jailbreak and AppSync it work)

Please report your experience!

dagazik referenced this issue in notaz/pcsx_rearmed Feb 27, 2021
@LexouDuck
Copy link

It seems that this PCSX-reARMed core build you linked is the same (md5sum is identical) as the one you linked in that other thread (which we can see in your screenshot there).
On my end, both the "normal" and "interpreter" cores simply do not open, with a "failed to open libretro core" error message in the UI.
Like you say, it probably is because I do not have appsync installed (attempting to install it previously had locked my device in a boot-loop, forcing me reinstall everything - so i now avoid it) - but another possibility is: you mention it's supposed to work for iOS 9.3.5, but maybe there's some incompatbility with iOS 10 ?

@dagazik
Copy link
Author

dagazik commented Feb 27, 2021

This is similar to the symptoms of a missing signature. I can't sign the core because I don't have an Apple developer certificate. Write something in this thread on the libretro forum - I have ideas on how to help you (don't want to litter this thread offtopic).

@afhenriques
Copy link

In my tests, using iOS 9.3.5 on an iPad mini 1 (JB) I experience crashes when trying to load a saved state – sometimes right on the first attempt, others on the second subsequential attempt. Never got passed 2. This happens with release c2d67cd.
Release 1fedf1e works fine, can load save states without any ssue.

@dagazik
Copy link
Author

dagazik commented Mar 16, 2022

Some time ago I compiled and tested the latest version: dynarec works without crashes. Thanks Notaz for fix. 🙂

Compiled version with fixes(#495) for iOS5: pcsx_rearmed-2022-02-17_r22_7e3ce9a_NO_SAUCE-no_sign.zip
Compiled version for iOS9 here(original code): pcsx_rearmed-2022-02-17_r22_7e3ce9a-no_sign.zip

This version are not signed with a developer certificate, but on a device with Jailbreak and AppSync should work.

@dagazik dagazik closed this as completed Mar 16, 2022
@SoFasttt
Copy link

SoFasttt commented Nov 3, 2023

Hi, I'm not sure how to contact the OP @dagazik but I've encountered the same problem and need a compiled r23 version (which seems to fix the bug) for my iOS 8 iPad Mini 1 (8.4.1 32-bit to be exact).

I've tried both versions above (iOS 5 and iOS9, sadly none worked). Could anyone please help? I have no idea how to compile a dylib for iOS.

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

No branches or pull requests

4 participants