-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project
: Makes several corrections; there are still more to come
- JNIEnv is now correctly propagated throughout the entire backend - Fixed improper access to JNIEnv* objects through an incorrect thread - Addresses memory leaks in objects (JNIString, BiosInfo, among others) - Corrects mishandling of BIOS files in both the frontend and backend - Fixes interface crashes - Reduces memory consumption - Improves the logging system (now the parser can check the syntax of the text format before compilation) - Enhances security in the code (libfmt)
- Loading branch information
Showing
38 changed files
with
455 additions
and
261 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <common/except.h> | ||
#include <common/global.h> | ||
|
||
namespace cosmic { | ||
jclass exceptionActivity{}; | ||
CosmicException::CosmicException(const std::string& format) : | ||
std::runtime_error(format) { | ||
user->error("{}", format); | ||
|
||
msg = cosmicEnv->NewStringUTF(format.c_str()); | ||
title = lookupByActivity(); | ||
alertUser(); | ||
} | ||
jstring CosmicException::lookupByActivity() { | ||
const jclass emulation{cosmicEnv->FindClass("emu/cosmic/EmulationActivity$Companion")}; | ||
if (cosmicEnv->IsSameObject(exceptionActivity, emulation)) { | ||
return cosmicEnv->NewStringUTF("Emulation Scene"); | ||
} | ||
return cosmicEnv->NewStringUTF("General Exception"); | ||
} | ||
|
||
void CosmicException::alertUser() { | ||
alert = cosmicEnv->GetMethodID(exceptionActivity, | ||
"displayAlert", "(Ljava/lang/String;Ljava/lang/String;)V"); | ||
|
||
if (alert) { | ||
cosmicEnv->CallStaticVoidMethod(exceptionActivity, alert, title, msg); | ||
} | ||
cosmicEnv->DeleteLocalRef(title); | ||
cosmicEnv->DeleteLocalRef(msg); | ||
} | ||
|
||
void CosmicException::setExceptionClass(jobject super) { | ||
const jclass emuClass{cosmicEnv->FindClass("emu/cosmic/EmulationActivity")}; | ||
if (cosmicEnv->IsInstanceOf(super, emuClass)) { | ||
exceptionActivity = cosmicEnv->FindClass("emu/cosmic/EmulationActivity$Companion"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.