1
0
Fork 0
mirror of https://gitlab.com/niansa/llama_any.git synced 2025-03-06 20:48:27 +01:00
llama_any/Runtime.cpp
2023-04-03 22:06:29 +02:00

47 lines
1.1 KiB
C++

#include "Runtime.hpp"
#ifdef PLATFORM_3DS
#include <string>
#include <exception>
#include <cerrno>
#include <3ds.h>
void Runtime::customTerminate() noexcept {
// Get error message
std::string message;
try {
std::rethrow_exception(std::current_exception());
} catch (const std::exception& e) {
message = e.what();
} catch (...) {
message = "Unknown";
}
// Display error
errorConf conf = {
.type = ERROR_TEXT_WORD_WRAP,
.errorCode = errno,
.upperScreenFlag = ERROR_NORMAL,
.useLanguage = CFG_LANGUAGE_EN,
.Text = {L'I', L'N', L'V', L'A', L'L', L'I', L'D', L'\0'},
.homeButton = true,
.softwareReset = false,
.appJump = false,
.returnCode = ERROR_UNKNOWN,
.eulaVersion = 0
};
errorText(&conf, ("An exception was thrown but never handled:\n\n"+message).c_str());
errorDisp(&conf);
// Exit
aptExit();
socExit();
gfxExit();
exit(-errno);
}
#elif PLATFORM_DS
void Runtime::kbCallback(int key) {
if (key > 0) printf("%c", key);
}
#endif