[nostalgia/core/gba] Add test for malloc and unify panic systems

This commit is contained in:
2020-02-11 21:17:10 -06:00
parent ea14ccac3a
commit fffc66f18b
6 changed files with 141 additions and 67 deletions
+9 -3
View File
@@ -7,15 +7,21 @@
*/
#include "../core.hpp"
#include "panic.hpp"
#include "../gfx.hpp"
namespace nostalgia::core {
namespace ox {
void panic(const char *msg) {
using namespace nostalgia::core;
void panic(const char*, int, const char *msg, ox::Error err) {
oxIgnoreError(initGfx(nullptr));
oxIgnoreError(initConsole(nullptr));
ox::BString<23> serr = "Error code: ";
serr += err;
puts(nullptr, 32 + 0, 1, "SADNESS...");
puts(nullptr, 32 + 0, 4, "UNEXPECTED STATE:");
puts(nullptr, 32 + 2, 6, msg);
puts(nullptr, 32 + 2, 7, serr.c_str());
puts(nullptr, 32 + 0, 10, "PLEASE RESTART THE SYSTEM");
// TODO: properly end program execution, this wastes power
while (1);