/* Added by FredyGames: the devkitPro libsysbase is not available in our toolchain, so the newlib system calls the C library links against are stubbed (the game does no file or console I/O). */ #include #include #include void *fake_heap_end = 0; static char heap_area[8192] __attribute__((aligned(4))); static size_t heap_used; void *_sbrk(ptrdiff_t incr) { if (heap_used + (size_t)incr > sizeof heap_area) { errno = ENOMEM; return (void *)-1; } void *p = heap_area + heap_used; heap_used += (size_t)incr; return p; } int _close(int fd) { (void)fd; errno = EBADF; return -1; } int _fstat(int fd, struct stat *st) { (void)fd; st->st_mode = S_IFCHR; return 0; } int _isatty(int fd) { (void)fd; return 1; } int _lseek(int fd, int off, int whence) { (void)fd; (void)off; (void)whence; return 0; } int _read(int fd, char *buf, int len) { (void)fd; (void)buf; (void)len; return 0; } int _write(int fd, char *buf, int len) { (void)fd; (void)buf; return len; } int _getpid(void) { return 1; } int _kill(int pid, int sig) { (void)pid; (void)sig; errno = EINVAL; return -1; } void _exit(int code) { (void)code; for (;;) {} }