diff options
Diffstat (limited to 'clients/vita/screen.h')
-rw-r--r-- | clients/vita/screen.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clients/vita/screen.h b/clients/vita/screen.h new file mode 100644 index 0000000..e1ec9d4 --- /dev/null +++ b/clients/vita/screen.h @@ -0,0 +1,24 @@ +#pragma once + +#include <stdbool.h> +#include <errno.h> + +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); } } |