diff options
Diffstat (limited to 'libpsn00b/include')
| -rw-r--r-- | libpsn00b/include/assert.h | 22 | ||||
| -rw-r--r-- | libpsn00b/include/dlfcn.h | 7 |
2 files changed, 21 insertions, 8 deletions
diff --git a/libpsn00b/include/assert.h b/libpsn00b/include/assert.h index 3114b57..e27f2ed 100644 --- a/libpsn00b/include/assert.h +++ b/libpsn00b/include/assert.h @@ -1,6 +1,20 @@ -#ifndef _ASSERT_H -#define _ASSERT_H +/* + * PSn00bSDK assert macro + * (C) 2022 spicyjpeg - MPL licensed + */ -void assert(int e); +#ifndef __ASSERT_H +#define __ASSERT_H -#endif
\ No newline at end of file +void _assert_abort(const char *file, int line, const char *expr); + +#ifdef DEBUG +#define assert(expr) { \ + if (!(expr)) \ + _assert_abort(__FILE__, __LINE__, #expr); \ +} +#else +#define assert(x) +#endif + +#endif diff --git a/libpsn00b/include/dlfcn.h b/libpsn00b/include/dlfcn.h index 6874d06..5848a95 100644 --- a/libpsn00b/include/dlfcn.h +++ b/libpsn00b/include/dlfcn.h @@ -1,19 +1,18 @@ /* * PSn00bSDK dynamic linker - * (C) 2021 spicyjpeg - MPL licensed + * (C) 2021-2022 spicyjpeg - MPL licensed */ #ifndef __DLFCN_H #define __DLFCN_H -#include <sys/types.h> +#include <stdint.h> #include <elf.h> /* Helper macro for setting $t9 before calling a function */ -#define DL_CALL(func, ...) { \ +#define DL_PRE_CALL(func) { \ __asm__ volatile("move $t9, %0;" :: "r"(func) : "$t9"); \ - func(__VA_ARGS__); \ } /* Types */ |
