aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-03-20 10:56:23 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-03-20 10:56:23 +0100
commit4bbfe640a8c357137524e797a8d2bd0a94d3abfa (patch)
treecd1b0ac173ffb2e27d8116637434f413e18542f4
parent8c68b4b8a5bf7757b8e4d6bc2f68f10584b0deb1 (diff)
downloadpsn00bsdk-4bbfe640a8c357137524e797a8d2bd0a94d3abfa.tar.gz
Remove stdint.h, fix n00bdemo crashing
-rw-r--r--examples/demos/n00bdemo/logo.c4
-rw-r--r--examples/demos/n00bdemo/main.c5
-rw-r--r--examples/io/pads/spi.c1
-rw-r--r--examples/io/pads/spi.h1
-rw-r--r--libpsn00b/include/stdint.h16
-rw-r--r--libpsn00b/include/stdlib.h2
-rw-r--r--libpsn00b/libc/start.c23
7 files changed, 20 insertions, 32 deletions
diff --git a/examples/demos/n00bdemo/logo.c b/examples/demos/n00bdemo/logo.c
index 40160e7..784c9e1 100644
--- a/examples/demos/n00bdemo/logo.c
+++ b/examples/demos/n00bdemo/logo.c
@@ -51,9 +51,11 @@ typedef struct {
int size;
} NODE;
+extern NODE _end[];
+
void DumpHeap() {
- NODE *n = (NODE*)GetBSSend();
+ NODE *n = _end;
printf( "--\n" );
diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c
index cb64c42..439bccc 100644
--- a/examples/demos/n00bdemo/main.c
+++ b/examples/demos/n00bdemo/main.c
@@ -232,12 +232,11 @@ void unpackModels() {
}
void init() {
+ // Init display
+ initDisplay();
#ifdef SYSTEM_573_SUPPORT
system573Setup();
#endif
-
- // Init display
- initDisplay();
FntLoad( 960, 0 );
diff --git a/examples/io/pads/spi.c b/examples/io/pads/spi.c
index 43b5bc3..133782c 100644
--- a/examples/io/pads/spi.c
+++ b/examples/io/pads/spi.c
@@ -27,6 +27,7 @@
*/
#include <stdint.h>
+#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <psxetc.h>
diff --git a/examples/io/pads/spi.h b/examples/io/pads/spi.h
index 7d4d75b..8c17df3 100644
--- a/examples/io/pads/spi.h
+++ b/examples/io/pads/spi.h
@@ -7,6 +7,7 @@
#define __SPI_H
#include <stdint.h>
+#include <stddef.h>
#include <psxpad.h>
// Maximum request/response length (34 bytes for pads, 140 for memory cards).
diff --git a/libpsn00b/include/stdint.h b/libpsn00b/include/stdint.h
deleted file mode 100644
index 83acb00..0000000
--- a/libpsn00b/include/stdint.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _STDINT_H
-#define _STDINT_H
-
-typedef unsigned int size_t;
-
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-#endif // _STDINT_H \ No newline at end of file
diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h
index b187a6f..4c4fcd3 100644
--- a/libpsn00b/include/stdlib.h
+++ b/libpsn00b/include/stdlib.h
@@ -44,7 +44,7 @@ double strtod(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);
// Memory allocation functions
-unsigned int *GetBSSend();
+void _mem_init(int ram_size, int stack_max_size);
void InitHeap(unsigned int *addr, int size);
int SetHeapSize(int size);
void *malloc(int size);
diff --git a/libpsn00b/libc/start.c b/libpsn00b/libc/start.c
index f190794..fd6fe33 100644
--- a/libpsn00b/libc/start.c
+++ b/libpsn00b/libc/start.c
@@ -6,19 +6,20 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
+#include <stddef.h>
-#define KERNEL_ARG_STRING ((const char *) 0x80000180)
-#define KERNEL_RETURN_VALUE ((volatile int *) 0x8000dffc)
+#define KERNEL_ARG_STRING ((const char *) 0x80000180)
+#define KERNEL_RETURN_VALUE ((volatile int *) 0x8000dffc)
/* Argument parsing */
-int32_t __argc;
-const char **__argv;
+int __argc;
+const char **__argv;
#define ARGC_MAX 16
-static const char *_argv_buffer[ARGC_MAX];
-static char _arg_string_buffer[132];
+static const char *_argv_buffer[ARGC_MAX];
+static char _arg_string_buffer[132];
static void _parse_kernel_args() {
// Copy the argument string from kernel memory into a private buffer (which
@@ -61,10 +62,10 @@ extern uint8_t _end[];
// useful though to change the stack size and/or reinitialize the heap on
// systems that have more than 2 MB of RAM (e.g. emulators, devkits, PS1-based
// arcade boards).
-void _mem_init(size_t ram_size, size_t stack_max_size) {
- void *exe_end = _end + 4;
- size_t exe_size = (size_t) exe_end - (size_t) __text_start;
- size_t ram_used = (0x10000 + exe_size + stack_max_size) & 0xfffffffc;
+void _mem_init(int ram_size, int stack_max_size) {
+ void *exe_end = _end + 4;
+ int exe_size = (int) exe_end - (int) __text_start;
+ int ram_used = (0x10000 + exe_size + stack_max_size) & 0xfffffffc;
InitHeap(exe_end, ram_size - ram_used);
}
@@ -74,7 +75,7 @@ void _mem_init(size_t ram_size, size_t stack_max_size) {
extern void (*__CTOR_LIST__[])(void);
extern void (*__DTOR_LIST__[])(void);
-extern int32_t main(int32_t argc, const char* argv[]);
+extern int main(int argc, const char* argv[]);
// Even though _start() usually takes no arguments, this implementation allows
// parent executables to pass args directly to child executables without having