Files
amethyst/source/amethyst.cpp
2025-11-19 22:20:27 +01:00

35 lines
758 B
C++
Executable File

#include <amethyst.hpp>
#include <exception>
#include <iostream>
#ifdef AMY_3DS
#include <3ds.h>
void NpiD7CxxExceptionHandler() {
gfxInitDefault();
consoleInit(GFX_TOP, nullptr);
std::cout << "[C++ Error Handler]" << std::endl;
try {
std::rethrow_exception(std::current_exception());
} catch (const std::exception& e) {
std::cout << "\n\n" << e.what() << std::endl;
}
aptSetHomeAllowed(false);
aptSetSleepAllowed(false);
while (aptMainLoop()) {
hidScanInput();
if (hidKeysDown() & KEY_START) {
break;
}
}
std::abort();
}
#endif
namespace amy {
void registerCxxExceptionHandler() {
#ifdef AMY_3DS
std::set_terminate(NpiD7CxxExceptionHandler);
#endif
}
} // namespace amy