Skip to content

Commit

Permalink
Add SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Jun 1, 2024
1 parent 3440fe3 commit 4919e2f
Show file tree
Hide file tree
Showing 773 changed files with 270,624 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:22.04

RUN apt-get update
RUN apt-get -y install bash make

RUN echo "## Exporting ps3dev environment" >> /root/.bashrc
RUN echo "export PSNOOB=/usr/local/psnoob" >> /root/.bashrc
RUN echo "export PATH=\$PATH:\$PSNOOB/bin" >> /root/.bashrc
RUN echo "export PSN00BSDK_LIBS=$PSNOOB/lib/libpsn00b" >> /root/.bashrc

COPY . /usr/local/psnoob
Binary file added bin/dumpsxiso
Binary file not shown.
Binary file added bin/elf2cpe
Binary file not shown.
Binary file added bin/elf2x
Binary file not shown.
Binary file added bin/lzpack
Binary file not shown.
Binary file added bin/mipsel-none-elf-addr2line
Binary file not shown.
Binary file added bin/mipsel-none-elf-ar
Binary file not shown.
Binary file added bin/mipsel-none-elf-as
Binary file not shown.
Binary file added bin/mipsel-none-elf-c++
Binary file not shown.
Binary file added bin/mipsel-none-elf-c++filt
Binary file not shown.
Binary file added bin/mipsel-none-elf-cpp
Binary file not shown.
Binary file added bin/mipsel-none-elf-elfedit
Binary file not shown.
Binary file added bin/mipsel-none-elf-g++
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcc
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcc-12.3.0
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcc-ar
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcc-nm
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcc-ranlib
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcov
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcov-dump
Binary file not shown.
Binary file added bin/mipsel-none-elf-gcov-tool
Binary file not shown.
Binary file added bin/mipsel-none-elf-ld
Binary file not shown.
Binary file added bin/mipsel-none-elf-ld.bfd
Binary file not shown.
Binary file added bin/mipsel-none-elf-lto-dump
Binary file not shown.
Binary file added bin/mipsel-none-elf-nm
Binary file not shown.
Binary file added bin/mipsel-none-elf-objcopy
Binary file not shown.
Binary file added bin/mipsel-none-elf-objdump
Binary file not shown.
Binary file added bin/mipsel-none-elf-ranlib
Binary file not shown.
Binary file added bin/mipsel-none-elf-readelf
Binary file not shown.
Binary file added bin/mipsel-none-elf-size
Binary file not shown.
Binary file added bin/mipsel-none-elf-strings
Binary file not shown.
Binary file added bin/mipsel-none-elf-strip
Binary file not shown.
Binary file added bin/mkpsxiso
Binary file not shown.
Binary file added bin/ninja
Binary file not shown.
Binary file added bin/smxlink
Binary file not shown.
60 changes: 60 additions & 0 deletions include/libpsn00b/assert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* PSn00bSDK assert macro and internal logging
* (C) 2022-2023 spicyjpeg - MPL licensed
*
* The _sdk_*() macros are used internally by PSn00bSDK to output messages when
* building in debug mode.
*/

#pragma once

#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)
#define _sdk_log(fmt, ...)
#define _sdk_assert(expr, fmt, ...)
#define _sdk_validate_args_void(expr)
#define _sdk_validate_args(expr, ret)

#else

#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_OPT__(,) __VA_ARGS__)
#else
#define _sdk_log(fmt, ...) \
printf(fmt __VA_OPT__(,) __VA_ARGS__)
#endif

#define _sdk_assert(expr, ret, fmt, ...) \
if (!(expr)) { \
_sdk_log(fmt, __VA_ARGS__); \
return ret; \
}
#define _sdk_validate_args_void(expr) \
if (!(expr)) { \
_sdk_log("invalid args to %s() (%s)\n", __func__, #expr); \
return; \
}
#define _sdk_validate_args(expr, ret) \
if (!(expr)) { \
_sdk_log("invalid args to %s() (%s)\n", __func__, #expr); \
return ret; \
}

#endif
8 changes: 8 additions & 0 deletions include/libpsn00b/cassert
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* PSn00bSDK assert macro and internal logging
* (C) 2022-2023 spicyjpeg - MPL licensed
*/

#pragma once

#include <assert.h>
22 changes: 22 additions & 0 deletions include/libpsn00b/cctype
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 PSXSDK authors, Lameguy64, spicyjpeg - MPL licensed
*/

#pragma once

namespace std {
extern "C" {

int isprint(int ch);
int isgraph(int ch);
int isspace(int ch);
int isblank(int ch);
int isalpha(int ch);
int isdigit(int ch);

int tolower(int ch);
int toupper(int ch);

}
}
34 changes: 34 additions & 0 deletions include/libpsn00b/cstdint
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 Lameguy64, spicyjpeg - MPL licensed
*
* This is a replacement for the <cstdint> header included with GCC, which seems
* to be broken (at least in GCC 12.2.0) as it requires some macros to be set.
*/

#pragma once

#include <stdint.h>

namespace std {

#define _DEF_TYPE(bits, prefix) \
using ::prefix##bits##_t; \
using ::prefix##_fast##bits##_t; \
using ::prefix##_least##bits##_t;

_DEF_TYPE( 8, int)
_DEF_TYPE( 8, uint)
_DEF_TYPE(16, int)
_DEF_TYPE(16, uint)
_DEF_TYPE(32, int)
_DEF_TYPE(32, uint)

#undef _DEF_TYPE

using ::intmax_t;
using ::uintmax_t;
using ::intptr_t;
using ::uintptr_t;

}
32 changes: 32 additions & 0 deletions include/libpsn00b/cstdio
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 Lameguy64, spicyjpeg - MPL licensed
*/

#pragma once

#include <cstdarg>

namespace std {
extern "C" {

/* String I/O API (provided by BIOS) */

int printf(const char *fmt, ...);
char *gets(char *str);
void puts(const char *str);
int getchar(void);
void putchar(int ch);

/* String formatting API (built-in) */

int vsnprintf(char *string, unsigned int size, const char *fmt, va_list ap);
int vsprintf(char *string, const char *fmt, va_list ap);
int sprintf(char *string, const char *fmt, ...);
int snprintf(char *string, unsigned int size, const char *fmt, ...);

int vsscanf(const char *str, const char *format, va_list ap);
int sscanf(const char *str, const char *fmt, ...);

}
}
59 changes: 59 additions & 0 deletions include/libpsn00b/cstdlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 PSXSDK authors, Lameguy64, spicyjpeg - MPL licensed
*/

#pragma once

#include <cstddef>

namespace std {

/* Definitions */

static constexpr int RAND_MAX = 0x7fff;

/* Structure definitions */

struct HeapUsage {
size_t total; // Total size of heap + stack
size_t heap; // Amount of memory currently reserved for heap
size_t stack; // Amount of memory currently reserved for stack
size_t alloc; // Amount of memory currently allocated
size_t alloc_max; // Maximum amount of memory ever allocated
};

/* API */

extern "C" {

extern int __argc;
extern const char **__argv;

void abort(void);

int rand(void);
void srand(int seed);

int abs(int j);
long labs(long i);

long strtol(const char *str, char **str_end, int base);
long long strtoll(const char *str, char **str_end, int base);
//float strtof(const char *str, char **str_end);
//double strtod(const char *str, char **str_end);
//long double strtold(const char *str, char **str_end);

void InitHeap(void *addr, size_t size);
void *sbrk(ptrdiff_t incr);

void TrackHeapUsage(ptrdiff_t alloc_incr);
void GetHeapUsage(HeapUsage *usage);

void *malloc(size_t size);
void *calloc(size_t num, size_t size);
void *realloc(void *ptr, size_t size);
void free(void *ptr);

}
}
38 changes: 38 additions & 0 deletions include/libpsn00b/cstring
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 PSXSDK authors, Lameguy64, spicyjpeg - MPL licensed
*/

#pragma once

#include <cstddef>

namespace std {
extern "C" {

void *memset(void *dest, int ch, size_t count);
void *memcpy(void *dest, const void *src, size_t count);
void *memccpy(void *dest, const void *src, int ch, size_t count);
void *memmove(void *dest, const void *src, size_t count);
int memcmp(const void *lhs, const void *rhs, size_t count);
void *memchr(const void *ptr, int ch, size_t count);

char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t count);
int strcmp(const char *lhs, const char *rhs);
int strncmp(const char *lhs, const char *rhs, size_t count);
char *strchr(const char *str, int ch);
char *strrchr(const char *str, int ch);
char *strpbrk(const char *str, const char *breakset);
char *strstr(const char *str, const char *substr);

size_t strlen(const char *str);
char *strcat(char *dest, const char *src);
char *strncat(char *dest, const char *src, size_t count);
char *strdup(const char *str);
char *strndup(const char *str, size_t count);

char *strtok(char *str, const char *delim);

}
}
24 changes: 24 additions & 0 deletions include/libpsn00b/ctype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* PSn00bSDK standard library
* (C) 2019-2023 PSXSDK authors, Lameguy64, spicyjpeg - MPL licensed
*/

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

int isprint(int ch);
int isgraph(int ch);
int isspace(int ch);
int isblank(int ch);
int isalpha(int ch);
int isdigit(int ch);

int tolower(int ch);
int toupper(int ch);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 4919e2f

Please sign in to comment.