#pragma once #include #include void screen_deinit(void); bool screen_init(void); void screen_clear(void); int screen_puts(const char *msg); __attribute__((format(printf, 1, 2))) int screen_printf(const char *fmt, ...); #define printf screen_printf #define errx(code, fmt, ...) { \ screen_init(); \ printf("ERROR @ %s:%lu "fmt"\n", __func__, (uint32_t)__LINE__, ##__VA_ARGS__); \ while (true) { sceKernelDelayThread((SceUInt)~0); } \ } #define warnx(fmt, ...) { printf("WARN @ %s:%lu "fmt"\n", __func__, (uint32_t)__LINE__, ##__VA_ARGS__); } #define err(code, fmt, ...) { errx(code, fmt": %s", ##__VA_ARGS__, strerror(errno)); } #define warn(fmt, ...) { warnx(code, fmt": %s", ##__VA_ARGS__, strerror(errno)); } #define assert(x) { if (!(x)) { errx("assertion failed for %s", #x); } }