aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2022-12-18 01:06:20 +0100
committerspicyjpeg <thatspicyjpeg@gmail.com>2022-12-18 01:06:20 +0100
commit70833192a803061008d2221b27e9baada6042c90 (patch)
tree13af0c4eec84a29549e729c88b14905905c0da7b /libpsn00b/include
parentfc021dc6d6f06f8eff7edc72929faddd1e1f0d1b (diff)
downloadpsn00bsdk-70833192a803061008d2221b27e9baada6042c90.tar.gz
Fix dynamic linker symbol resolver and assert macro
Diffstat (limited to 'libpsn00b/include')
-rw-r--r--libpsn00b/include/assert.h13
-rw-r--r--libpsn00b/include/dlfcn.h7
-rw-r--r--libpsn00b/include/stdio.h17
3 files changed, 13 insertions, 24 deletions
diff --git a/libpsn00b/include/assert.h b/libpsn00b/include/assert.h
index 12212af..1b2bda2 100644
--- a/libpsn00b/include/assert.h
+++ b/libpsn00b/include/assert.h
@@ -11,8 +11,16 @@
#include <stdio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void _assert_abort(const char *file, int line, const char *expr);
+#ifdef __cplusplus
+}
+#endif
+
#ifdef NDEBUG
#define assert(expr)
@@ -20,9 +28,8 @@ void _assert_abort(const char *file, int line, const char *expr);
#else
-#define assert(expr) { \
- if (!(expr)) _assert_abort(__FILE__, __LINE__, #expr); \
-}
+#define assert(expr) \
+ ((expr) ? ((void) 0) : _assert_abort(__FILE__, __LINE__, #expr))
#ifdef SDK_LIBRARY_NAME
#define _sdk_log(fmt, ...) printf(SDK_LIBRARY_NAME ": " fmt, ##__VA_ARGS__)
diff --git a/libpsn00b/include/dlfcn.h b/libpsn00b/include/dlfcn.h
index f6a5baf..6192430 100644
--- a/libpsn00b/include/dlfcn.h
+++ b/libpsn00b/include/dlfcn.h
@@ -37,15 +37,14 @@ typedef enum _DL_ResolveMode {
// Members of this struct should not be accessed directly in most cases, but
// they are intentionally exposed for easier expandability.
typedef struct _DLL {
- void *ptr;
- void *malloc_ptr;
+ void *ptr, *malloc_ptr;
size_t size;
const uint32_t *hash;
uint32_t *got;
Elf32_Sym *symtab;
const char *strtab;
- uint16_t symbol_count;
- uint16_t got_length;
+ uint16_t symbol_count, first_got_symbol;
+ uint16_t got_local_count, got_extern_count;
} DLL;
/* Public API */
diff --git a/libpsn00b/include/stdio.h b/libpsn00b/include/stdio.h
index 97a2f5a..8aaf4c7 100644
--- a/libpsn00b/include/stdio.h
+++ b/libpsn00b/include/stdio.h
@@ -3,18 +3,6 @@
#include <stdarg.h>
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef true
-#define true 1
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
// BIOS seek modes
#ifndef SEEK_SET
#define SEEK_SET 0
@@ -26,11 +14,6 @@
#define SEEK_END 2 /* warning: reportedly buggy */
#endif
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif