Android: handle errors in debug.cpp (#42)
This commit is contained in:
parent
299c0d211c
commit
d974b14e2c
@ -20,10 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
package com.multicraft.game.helpers
|
package com.multicraft.game.helpers
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.*
|
||||||
import android.app.ActivityManager
|
|
||||||
import android.app.AlarmManager
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.app.PendingIntent.FLAG_CANCEL_CURRENT
|
import android.app.PendingIntent.FLAG_CANCEL_CURRENT
|
||||||
import android.app.PendingIntent.FLAG_IMMUTABLE
|
import android.app.PendingIntent.FLAG_IMMUTABLE
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -15,7 +15,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.1'
|
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||||
classpath 'de.undercouch:gradle-download-task:4.1.2'
|
classpath 'de.undercouch:gradle-download-task:4.1.2'
|
||||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
|
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@ -61,7 +61,7 @@ void sanity_check_fn(const char *assertion, const char *file,
|
|||||||
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
||||||
" (" + std::string(function) + ")";
|
" (" + std::string(function) + ")";
|
||||||
|
|
||||||
throw std::runtime_error(capture);
|
porting::finishGame(capture);
|
||||||
#else
|
#else
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
@ -84,7 +84,7 @@ void fatal_error_fn(const char *msg, const char *file,
|
|||||||
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
||||||
" (" + std::string(function) + ")";
|
" (" + std::string(function) + ")";
|
||||||
|
|
||||||
throw std::runtime_error(capture);
|
porting::finishGame(capture);
|
||||||
#else
|
#else
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
|
@ -356,6 +356,7 @@ void finishGame(const std::string &exc)
|
|||||||
|
|
||||||
jstring jexc = jnienv->NewStringUTF(exc.c_str());
|
jstring jexc = jnienv->NewStringUTF(exc.c_str());
|
||||||
jnienv->CallVoidMethod(app_global->activity->clazz, finishMe, jexc);
|
jnienv->CallVoidMethod(app_global->activity->clazz, finishMe, jexc);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring getJniString(const std::string &message)
|
jstring getJniString(const std::string &message)
|
||||||
|
@ -94,7 +94,7 @@ float getDisplayDensity();
|
|||||||
/**
|
/**
|
||||||
* call Android function to finish
|
* call Android function to finish
|
||||||
*/
|
*/
|
||||||
void finishGame(const std::string &exc);
|
NORETURN void finishGame(const std::string &exc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* call Android function to handle not-critical error
|
* call Android function to handle not-critical error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user