mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Report crash in a dialog
This commit is contained in:
@ -64,6 +64,7 @@ namespace skyline {
|
||||
closeKeyboardId{environ->GetMethodID(instanceClass, "closeKeyboard", "(Lemu/skyline/applet/swkbd/SoftwareKeyboardDialog;)V")},
|
||||
showValidationResultId{environ->GetMethodID(instanceClass, "showValidationResult", "(Lemu/skyline/applet/swkbd/SoftwareKeyboardDialog;ILjava/lang/String;)I")},
|
||||
getIntegerValueId{environ->GetMethodID(environ->FindClass("java/lang/Integer"), "intValue", "()I")},
|
||||
reportCrashId{environ->GetMethodID(instanceClass, "reportCrash", "()V")},
|
||||
showPipelineLoadingScreenId{environ->GetMethodID(instanceClass, "showPipelineLoadingScreen", "(I)V")},
|
||||
updatePipelineLoadingProgressId{environ->GetMethodID(instanceClass, "updatePipelineLoadingProgress", "(I)V")},
|
||||
hidePipelineLoadingScreenId{environ->GetMethodID(instanceClass, "hidePipelineLoadingScreen", "()V")},
|
||||
@ -165,6 +166,10 @@ namespace skyline {
|
||||
return result;
|
||||
}
|
||||
|
||||
void JvmManager::reportCrash() {
|
||||
env->CallVoidMethod(instance, reportCrashId);
|
||||
}
|
||||
|
||||
void JvmManager::ShowPipelineLoadingScreen(u32 totalPipelineCount) {
|
||||
env->CallVoidMethod(instance, showPipelineLoadingScreenId, static_cast<jint>(totalPipelineCount));
|
||||
}
|
||||
|
@ -184,6 +184,11 @@ namespace skyline {
|
||||
*/
|
||||
KeyboardCloseResult ShowValidationResult(KeyboardHandle dialog, KeyboardTextCheckResult checkResult, std::u16string message);
|
||||
|
||||
/**
|
||||
* @brief A call to EmulationActivity.reportCrash in Kotlin
|
||||
*/
|
||||
void reportCrash();
|
||||
|
||||
/**
|
||||
* @brief A call to EmulationActivity.showPipelineLoadingScreen in Kotlin
|
||||
*/
|
||||
@ -220,6 +225,7 @@ namespace skyline {
|
||||
jmethodID closeKeyboardId;
|
||||
jmethodID showValidationResultId;
|
||||
jmethodID getIntegerValueId;
|
||||
jmethodID reportCrashId;
|
||||
|
||||
jmethodID showPipelineLoadingScreenId;
|
||||
jmethodID updatePipelineLoadingProgressId;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <nce.h>
|
||||
#include <os.h>
|
||||
#include <jvm.h>
|
||||
#include <common/trace.h>
|
||||
#include <kernel/results.h>
|
||||
#include "KProcess.h"
|
||||
@ -28,6 +29,7 @@ namespace skyline::kernel::type {
|
||||
void KProcess::Kill(bool join, bool all, bool disableCreation) {
|
||||
Logger::Warn("Killing {}{}KProcess{}", join ? "and joining " : "", all ? "all threads in " : "HOS-1 in ", disableCreation ? " with new thread creation disabled" : "");
|
||||
Logger::EmulationContext.Flush();
|
||||
state.jvm->reportCrash();
|
||||
|
||||
bool expected{false};
|
||||
if (!join && !alreadyKilled.compare_exchange_strong(expected, true))
|
||||
|
@ -17,6 +17,7 @@ import android.content.pm.ActivityInfo
|
||||
import android.content.res.AssetManager
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.PointF
|
||||
import android.graphics.drawable.Icon
|
||||
import android.hardware.display.DisplayManager
|
||||
@ -29,6 +30,7 @@ import android.util.TypedValue
|
||||
import android.view.*
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.view.isGone
|
||||
@ -759,6 +761,21 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
return ((major shl 22) or (minor shl 12) or (patch)).toInt()
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun reportCrash() {
|
||||
if (BuildConfig.BUILD_TYPE != "release")
|
||||
return
|
||||
runOnUiThread {
|
||||
MaterialAlertDialogBuilder(this)
|
||||
.setTitle(getString(R.string.game_crash))
|
||||
.setMessage(getString(R.string.game_crash_message))
|
||||
.setPositiveButton(getString(android.R.string.ok)) { _, _ ->
|
||||
shouldFinish = true
|
||||
returnFromEmulation()
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
||||
private val insetsOrMarginHandler = View.OnApplyWindowInsetsListener { view, insets ->
|
||||
insets.displayCutout?.let {
|
||||
val defaultHorizontalMargin = view.resources.getDimensionPixelSize(R.dimen.onScreenItemHorizontalMargin)
|
||||
|
@ -296,4 +296,6 @@
|
||||
<string name="no">No</string>
|
||||
<string name="save_file_imported_ok">The save file was imported successfully</string>
|
||||
<string name="save_file_invalid_zip_structure">Invalid Zip directory structure: the first subfolder name must be the Title ID of the game.</string>
|
||||
<string name="game_crash">The game has crashed</string>
|
||||
<string name="game_crash_message">A fatal error occurred. Check the log for details.</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user