Update C headers to be C++

This commit is contained in:
Jaby 2024-04-07 10:46:35 -05:00
parent f2ea2f04f0
commit f5270df019
58 changed files with 153 additions and 225 deletions

View File

@ -5,8 +5,7 @@
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <PSX/Timer/frame_timer.hpp> #include <PSX/Timer/frame_timer.hpp>
#include <FontWriter/fonts.hpp> #include <FontWriter/fonts.hpp>
#include <stdio.h> #include <string.hpp>
#include <string.h>
namespace BIOSInfo { namespace BIOSInfo {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -1,7 +1,6 @@
#include "../../../include/shared.hpp" #include "../../../include/shared.hpp"
#include "include/controller_state.hpp" #include "include/controller_state.hpp"
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace ControllerTest { namespace ControllerTest {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -1,7 +1,6 @@
#include "../../../include/shared.hpp" #include "../../../include/shared.hpp"
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace FontCycler { namespace FontCycler {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -3,7 +3,6 @@
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <PSX/GPU/make_gpu_primitives.hpp> #include <PSX/GPU/make_gpu_primitives.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace GPUTest { namespace GPUTest {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -3,7 +3,6 @@
#include "include/GTE_Sprite.hpp" #include "include/GTE_Sprite.hpp"
#include "include/gte_test_assets.hpp" #include "include/gte_test_assets.hpp"
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace GTETest { namespace GTETest {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -4,7 +4,6 @@
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <PSX/Timer/frame_timer.hpp> #include <PSX/Timer/frame_timer.hpp>
#include <stdio.h>
namespace ScreenCenter { namespace ScreenCenter {
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -6,7 +6,7 @@
#include <FontWriter/fonts.hpp> #include <FontWriter/fonts.hpp>
#include <FontWriter/font_writer.hpp> #include <FontWriter/font_writer.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h> #include <stdio.hpp>
using namespace JabyEngine; using namespace JabyEngine;

View File

@ -3,7 +3,7 @@
#include <PSX/File/Processor/cd_file_processor.hpp> #include <PSX/File/Processor/cd_file_processor.hpp>
#include <PSX/AutoLBA/auto_lba.hpp> #include <PSX/AutoLBA/auto_lba.hpp>
#include <PSX/AutoLBA/auto_lba_declaration.hpp> #include <PSX/AutoLBA/auto_lba_declaration.hpp>
#include <stdio.h> #include <stdio.hpp>
extern "C" uint32_t __bios_info_start; extern "C" uint32_t __bios_info_start;
extern "C" uint32_t __controller_tests_start; extern "C" uint32_t __controller_tests_start;

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../../stddef.h" #include "../../stddef.hpp"
namespace JabyEngine { namespace JabyEngine {
template<typename T> template<typename T>

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
#include "types.hpp" #include "types.hpp"
namespace JabyEngine { namespace JabyEngine {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../../stdint.h" #include "../../stdint.hpp"
namespace JabyEngine { namespace JabyEngine {
static constexpr int8_t operator""_i8(unsigned long long int value) { static constexpr int8_t operator""_i8(unsigned long long int value) {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../../stddef.h" #include "../../stddef.hpp"
#include "array_range.hpp" #include "array_range.hpp"
#include "types.hpp" #include "types.hpp"

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "types.hpp" #include "types.hpp"
#include <stddef.h> #include <stddef.hpp>
namespace JabyEngine { namespace JabyEngine {
template<typename T> template<typename T>

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../../stdint.h" #include "../../stdint.hpp"
namespace JabyEngine { namespace JabyEngine {
uint16_t unaligned_lhu(const uint8_t* adr) { uint16_t unaligned_lhu(const uint8_t* adr) {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "../Auxiliary/bits.hpp" #include "../Auxiliary/bits.hpp"
#include "../GPU/gpu_types.hpp" #include "../GPU/gpu_types.hpp"
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
namespace JabyEngine { namespace JabyEngine {
#pragma pack(push, 1) #pragma pack(push, 1)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "../Auxiliary/bits.hpp" #include "../Auxiliary/bits.hpp"
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
namespace JabyEngine { namespace JabyEngine {
namespace GPU { namespace GPU {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
namespace JabyEngine { namespace JabyEngine {
namespace Periphery { namespace Periphery {

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "ioport.hpp" #include "ioport.hpp"
#include "../../GPU/gpu_types.hpp" #include "../../GPU/gpu_types.hpp"
#include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace GPU_IO { namespace GPU_IO {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
/* /*
R0 zr Constant Zero R0 zr Constant Zero

View File

@ -1,7 +1,7 @@
#ifndef __JABYENGINE_FRAME_TIME_HELPER_HPP__ #ifndef __JABYENGINE_FRAME_TIME_HELPER_HPP__
#define __JABYENGINE_FRAME_TIME_HELPER_HPP__ #define __JABYENGINE_FRAME_TIME_HELPER_HPP__
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <limits.h> #include <limits.hpp>
namespace JabyEngine { namespace JabyEngine {
static constexpr double ms_per_frame = 1000.0/static_cast<double>(GPU::Display::frames_per_sec); static constexpr double ms_per_frame = 1000.0/static_cast<double>(GPU::Display::frames_per_sec);

View File

@ -1,7 +1,7 @@
#ifndef __JABYENGINE_FRAME_TIMER_HPP__ #ifndef __JABYENGINE_FRAME_TIMER_HPP__
#define __JABYENGINE_FRAME_TIMER_HPP__ #define __JABYENGINE_FRAME_TIMER_HPP__
#include "frame_time_helper.hpp" #include "frame_time_helper.hpp"
#include <stdint.h> #include <stdint.hpp>
namespace JabyEngine { namespace JabyEngine {
class MasterTime { class MasterTime {

View File

@ -1,6 +1,6 @@
#ifndef __JABYENGINE_HIGH_RES_TIMER_HPP__ #ifndef __JABYENGINE_HIGH_RES_TIMER_HPP__
#define __JABYENGINE_HIGH_RES_TIMER_HPP__ #define __JABYENGINE_HIGH_RES_TIMER_HPP__
#include "../jabyengine_defines.h" #include "../jabyengine_defines.hpp"
#include <PSX/System/IOPorts/interrupt_io.hpp> #include <PSX/System/IOPorts/interrupt_io.hpp>
#include <PSX/System/IOPorts/timer_io.hpp> #include <PSX/System/IOPorts/timer_io.hpp>

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "jabyengine_defines.h" #include "jabyengine_defines.hpp"
namespace JabyEngine { namespace JabyEngine {
typedef void (*MainRoutine)(); typedef void (*MainRoutine)();

View File

@ -1,6 +1,5 @@
#ifndef __JABYENGINE_DEFINES__H__ #pragma once
#define __JABYENGINE_DEFINES__H__ #include "../stddef.hpp"
#include "../stddef.h"
#define __used __attribute__((used)) #define __used __attribute__((used))
#define __no_align __attribute__((packed)) #define __no_align __attribute__((packed))
@ -23,4 +22,3 @@
#define START_C_FUNCTIONS #define START_C_FUNCTIONS
#define END_C_FUNCTIONS #define END_C_FUNCTIONS
#endif #endif
#endif //!__JABYENGINE_DEFINES__H__

View File

@ -1,36 +0,0 @@
#ifndef __LIMITS__H
#define __LIMITS__H
#define CHAR_BIT 8
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 0xff
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767
#define USHRT_MAX 0xffff
#define INT_MIN (-2147483647 - 1)
#define INT_MAX 2147483647
#define UINT_MAX 0xffffffff
#define LONG_MIN INT_MIN
#define LONG_MAX INT_MAX
#define ULONG_MAX UINT_MAX
#define I8_MIN SCHAR_MIN
#define I8_MAX SCHAR_MAX
#define UI8_MAX UCHAR_MAX
#define I16_MIN SHRT_MIN
#define I16_MAX SHRT_MAX
#define UI16_MAX USHRT_MAX
#define I32_MIN INT_MIN
#define I32_MAX INT_MAX
#define UI32_MAX UINT_MAX
#endif //!__LIMITS__H

33
include/limits.hpp Normal file
View File

@ -0,0 +1,33 @@
#pragma once
static constexpr auto CHAR_BIT = 8;
static constexpr auto SCHAR_MIN = -128;
static constexpr auto SCHAR_MAX = 127;
static constexpr auto UCHAR_MAX = 0xff;
static constexpr auto CHAR_MIN = SCHAR_MIN;
static constexpr auto CHAR_MAX = SCHAR_MAX;
static constexpr auto SHRT_MIN = -32768;
static constexpr auto SHRT_MAX = 32767;
static constexpr auto USHRT_MAX = 0xffff;
static constexpr auto INT_MIN = -2147483647 - 1;
static constexpr auto INT_MAX = 2147483647;
static constexpr auto UINT_MAX = 0xffffffff;
static constexpr auto LONG_MIN = INT_MIN;
static constexpr auto LONG_MAX = INT_MAX;
static constexpr auto ULONG_MAX = UINT_MAX;
static constexpr auto I8_MIN = SCHAR_MIN;
static constexpr auto I8_MAX = SCHAR_MAX;
static constexpr auto UI8_MAX = UCHAR_MAX;
static constexpr auto I16_MIN = SHRT_MIN;
static constexpr auto I16_MAX = SHRT_MAX;
static constexpr auto UI16_MAX = USHRT_MAX;
static constexpr auto I32_MIN = INT_MIN;
static constexpr auto I32_MAX = INT_MAX;
static constexpr auto UI32_MAX = UINT_MAX;

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "stdint.h" #include "stdint.hpp"
namespace math { namespace math {
template<typename T> template<typename T>
@ -74,8 +74,5 @@ static constexpr gte_float operator""_gf(long double value) {
return gte_float::from_double(value); return gte_float::from_double(value);
} }
using sin_t = int32_t; gte_float sin(deg_t value);
using cos_t = int32_t; gte_float cos(deg_t value);
sin_t sin(deg_t value);
cos_t cos(deg_t value);

View File

@ -1,10 +0,0 @@
#ifndef __STDARG__H
#define __STDARG__H
typedef __builtin_va_list va_list;
#define va_start __builtin_va_start
#define va_end __builtin_va_end
#define next_arg __builtin_next_arg
#define va_arg __builtin_va_arg
#endif // !__STDARG__H

7
include/stdarg.hpp Normal file
View File

@ -0,0 +1,7 @@
#pragma once
using va_list = __builtin_va_list;
#define va_start __builtin_va_start
#define va_end __builtin_va_end
#define next_arg __builtin_next_arg
#define va_arg __builtin_va_arg

View File

@ -1,7 +0,0 @@
#ifndef __STDDEF__H
#define __STDDEF__H
#include "stdint.h"
typedef uintmax_t size_t;
#endif //!__STDDEF__H

4
include/stddef.hpp Normal file
View File

@ -0,0 +1,4 @@
#pragma once
#include "stdint.hpp"
using size_t = uintmax_t;

View File

@ -1,37 +0,0 @@
#ifndef __STDINT__H
#define __STDINT__H
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef signed char int_least8_t;
typedef unsigned char uint_least8_t;
typedef short int_least16_t;
typedef unsigned short uint_least16_t;
typedef int int_least32_t;
typedef unsigned int uint_least32_t;
typedef signed char int_fast8_t;
typedef unsigned char uint_fast8_t;
typedef int int_fast16_t;
typedef unsigned int uint_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
typedef signed int intmax_t;
typedef unsigned int uintmax_t;
typedef signed long intptr_t;
typedef unsigned long uintptr_t;
#endif //!__STDINT__H

34
include/stdint.hpp Normal file
View File

@ -0,0 +1,34 @@
#pragma once
using int8_t = signed char;
using uint8_t = unsigned char;
using int16_t = short;
using uint16_t = unsigned short;
using int32_t = int;
using uint32_t = unsigned int;
using int_least8_t = signed char;
using uint_least8_t = unsigned char;
using int_least16_t = short;
using uint_least16_t = unsigned short;
using int_least32_t = int;
using uint_least32_t = unsigned int;
using int_fast8_t = signed char;
using uint_fast8_t = unsigned char;
using int_fast16_t = int;
using uint_fast16_t = unsigned int;
using int_fast32_t = int;
using uint_fast32_t = unsigned int;
using intmax_t = signed int;
using uintmax_t = unsigned int;
using intptr_t = signed long;
using uintptr_t = unsigned long;

View File

@ -1,8 +0,0 @@
#ifndef __STDIO__H
#define __STDIO__H
#include "PSX/jabyengine_defines.h"
START_C_FUNCTIONS
int printf(const char* txt, ...) asm("_ZN10JabyEngine7SysCall6printfEPKcz");
END_C_FUNCTIONS
#endif //!__STDIO__H

4
include/stdio.hpp Normal file
View File

@ -0,0 +1,4 @@
#pragma once
#include "PSX/jabyengine_defines.hpp"
int printf(const char* txt, ...) asm("_ZN10JabyEngine7SysCall6printfEPKcz");

View File

@ -1,10 +0,0 @@
#ifndef __STRING__H
#define __STRING__H
#include "PSX/jabyengine_defines.h"
START_C_FUNCTIONS
int strncmp(const char* s1, const char* s2, size_t n);
size_t strlen(const char* str);
END_C_FUNCTIONS
#endif // !__STRING__H

5
include/string.hpp Normal file
View File

@ -0,0 +1,5 @@
#pragma once
#include "PSX/jabyengine_defines.hpp"
int strncmp(const char* s1, const char* s2, size_t n);
size_t strlen(const char* str);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "../GPU/gpu_internal.hpp" #include "../GPU/gpu_internal.hpp"
#include <stdio.h> #include <stdio.hpp>
namespace JabyEngine { namespace JabyEngine {
static void render_num(uint8_t value, uint16_t x, uint16_t y) { static void render_num(uint8_t value, uint16_t x, uint16_t y) {

View File

@ -2,7 +2,7 @@
#include <PSX/AutoLBA/auto_lba.hpp> #include <PSX/AutoLBA/auto_lba.hpp>
#include <PSX/Auxiliary/math_helper.hpp> #include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/System/IOPorts/cd_io.hpp> #include <PSX/System/IOPorts/cd_io.hpp>
#include <stddef.h> #include <stddef.hpp>
namespace JabyEngine { namespace JabyEngine {
namespace CD { namespace CD {

View File

@ -2,7 +2,7 @@
#include <PSX/System/IOPorts/interrupt_io.hpp> #include <PSX/System/IOPorts/interrupt_io.hpp>
#include <PSX/System/IOPorts/periphery_io.hpp> #include <PSX/System/IOPorts/periphery_io.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h> #include <stdio.hpp>
extern "C" void busy_loop(int count); extern "C" void busy_loop(int count);

View File

@ -1,39 +1,8 @@
# inline_n.h # inline_n.h
This header is directly lifted from psx-redux and not my creation. I will try to give it my personal touch but the original implementation will be always from [pcsx-redux](https://github.com/grumpycoders/pcsx-redux) and the **grumpycoders**. This header is directly lifted from psx-redux and not my creation. I will try to give it my personal touch but the original implementation will be always from [pcsx-redux](https://github.com/grumpycoders/pcsx-redux) and the **grumpycoders**.
```c++ # GTEMAC.H
MATRIX *HiRotMatrix(VECTOR *r, MATRIX *m) { Great for reference! It is under `psyq\include\GTEMAC.H`
short s[3],c[3]; # LIBGTE.H
MATRIX tm[3]; Not so helpful but can be found under `psyq\include\LIBGTE.H`
s[0] = hisin(r->vx); s[1] = hisin(r->vy); s[2] = hisin(r->vz);
c[0] = hicos(r->vx); c[1] = hicos(r->vy); c[2] = hicos(r->vz);
// mX
m->m[0][0] = ONE; m->m[0][1] = 0; m->m[0][2] = 0;
m->m[1][0] = 0; m->m[1][1] = c[0]; m->m[1][2] = -s[0];
m->m[2][0] = 0; m->m[2][1] = s[0]; m->m[2][2] = c[0];
// mY
tm[0].m[0][0] = c[1]; tm[0].m[0][1] = 0; tm[0].m[0][2] = s[1];
tm[0].m[1][0] = 0; tm[0].m[1][1] = ONE; tm[0].m[1][2] = 0;
tm[0].m[2][0] = -s[1]; tm[0].m[2][1] = 0; tm[0].m[2][2] = c[1];
// mZ
tm[1].m[0][0] = c[2]; tm[1].m[0][1] = -s[2]; tm[1].m[0][2] = 0;
tm[1].m[1][0] = s[2]; tm[1].m[1][1] = c[2]; tm[1].m[1][2] = 0;
tm[1].m[2][0] = 0; tm[1].m[2][1] = 0; tm[1].m[2][2] = ONE;
PushMatrix();
MulMatrix0( m, &tm[0], &tm[2] );
MulMatrix0( &tm[2], &tm[1], m );
PopMatrix();
return m;
}
```

View File

@ -1,7 +1,6 @@
#include <PSX/System/IOPorts/dma_io.hpp> #include <PSX/System/IOPorts/dma_io.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <PSX/System/IOPorts/interrupt_io.hpp> #include <PSX/System/IOPorts/interrupt_io.hpp>
#include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace boot { namespace boot {

View File

@ -4,7 +4,7 @@
#include <PSX/File/Processor/file_processor.hpp> #include <PSX/File/Processor/file_processor.hpp>
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <stdio.h> #include <stdio.hpp>
#ifdef JABYENGINE_PAL #ifdef JABYENGINE_PAL
#include "splash_image_pal_boot.hpp" #include "splash_image_pal_boot.hpp"

View File

@ -1,6 +1,5 @@
#include "../../internal-include/periphery_internal.hpp" #include "../../internal-include/periphery_internal.hpp"
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace boot { namespace boot {

View File

@ -1,6 +1,5 @@
#include <PSX/System/IOPorts/spu_io.hpp> #include <PSX/System/IOPorts/spu_io.hpp>
#include <stdio.h> #include <limits.hpp>
#include <limits.h>
namespace JabyEngine { namespace JabyEngine {
namespace boot { namespace boot {

View File

@ -1,6 +1,6 @@
#include "../../internal-include/BootLoader/boot_loader.hpp" #include "../../internal-include/BootLoader/boot_loader.hpp"
#include "../../internal-include/GPU/gpu_internal.hpp" #include "../../internal-include/GPU/gpu_internal.hpp"
#include <stdio.h> #include <stdio.hpp>
#include <PSX/GTE/gte.hpp> #include <PSX/GTE/gte.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>

View File

@ -1,6 +1,6 @@
#include <PSX/Auxiliary/math_helper.hpp> #include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <string.h> #include <string.hpp>
namespace JabyEngine { namespace JabyEngine {
namespace boot { namespace boot {

View File

@ -1,6 +1,6 @@
#include "../../../internal-include/CD/cd_internal.hpp" #include "../../../internal-include/CD/cd_internal.hpp"
#include <PSX/File/Processor/cd_file_processor.hpp> #include <PSX/File/Processor/cd_file_processor.hpp>
#include <stdio.h> #include <stdio.hpp>
namespace JabyEngine { namespace JabyEngine {
static constexpr auto DisabledCircularBufferSize = 512; static constexpr auto DisabledCircularBufferSize = 512;

View File

@ -1,8 +1,8 @@
#include "../../../internal-include/GPU/gpu_internal.hpp" #include "../../../internal-include/GPU/gpu_internal.hpp"
#include "simplehelper.hpp" #include "simplehelper.hpp"
#include <PSX/GPU/gpu_types.hpp> #include <PSX/GPU/gpu_types.hpp>
#include <limits.h> #include <limits.hpp>
#include <stdio.h> #include <stdio.hpp>
namespace JabyEngine { namespace JabyEngine {
namespace FileProcessor { namespace FileProcessor {

View File

@ -19,12 +19,12 @@ static int32_t hisin(int32_t value) {
return c >= 0 ? result : -result; return c >= 0 ? result : -result;
} }
sin_t sin(deg_t value) { gte_float sin(deg_t value) {
return hisin(value.raw); return gte_float{.raw = hisin(value.raw)};
} }
cos_t cos(deg_t value) { gte_float cos(deg_t value) {
return hisin(value.raw + (deg_t::full_circle/4)); return gte_float{.raw = hisin(value.raw + (deg_t::full_circle/4))};
} }
namespace JabyEngine { namespace JabyEngine {

View File

@ -1,6 +1,5 @@
#include "../../internal-include/periphery_internal.hpp" #include "../../internal-include/periphery_internal.hpp"
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
namespace Periphery { namespace Periphery {

View File

@ -1,27 +1,25 @@
#include <string.h> #include <string.hpp>
START_C_FUNCTIONS int strncmp(const char* s1, const char* s2, size_t n) {
int strncmp(const char* s1, const char* s2, size_t n) { if(n == 0) {
if(n == 0) {
return 0;
}
do {
if(*s1 != *s2++) {
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
}
if(*s1++ == 0) {
break;
}
} while(--n != 0);
return 0; return 0;
} }
size_t strlen(const char *str) { do {
const char* end = str; if(*s1 != *s2++) {
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
}
for(; *end; ++end); if(*s1++ == 0) {
return(end - str); break;
} }
END_C_FUNCTIONS } while(--n != 0);
return 0;
}
size_t strlen(const char *str) {
const char* end = str;
for(; *end; ++end);
return(end - str);
}

View File

@ -1,6 +1,5 @@
#include <PSX/Auxiliary/math_helper.hpp> #include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <string.h>
namespace JabyEngine { namespace JabyEngine {
namespace BIOS { namespace BIOS {

View File

@ -1,5 +1,5 @@
#include <PSX/GPU/gpu_primitives.hpp> #include <PSX/GPU/gpu_primitives.hpp>
#include <stdio.h> #include <stdio.hpp>
extern "C" uint32_t __bss_start; extern "C" uint32_t __bss_start;
extern "C" uint32_t __bss_end; extern "C" uint32_t __bss_end;

View File

@ -32,7 +32,7 @@ const UNIX_LINEFEED: &'static str = "\n";
const WINDOWS_LINEFEED: &'static str = "\r\n"; const WINDOWS_LINEFEED: &'static str = "\r\n";
const C_DECLARATIONS: FileDeclarations = FileDeclarations{include: "", var_type: "char"}; const C_DECLARATIONS: FileDeclarations = FileDeclarations{include: "", var_type: "char"};
const CPP_DECLARATIONS: FileDeclarations = FileDeclarations{include: "#include <stdint.h>", var_type: "uint8_t"}; const CPP_DECLARATIONS: FileDeclarations = FileDeclarations{include: "#include <stdint.hpp>", var_type: "uint8_t"};
fn output_bytes(input: Input, output: &mut Output, line_feed: &str) -> Result<usize, std::io::Error> { fn output_bytes(input: Input, output: &mut Output, line_feed: &str) -> Result<usize, std::io::Error> {
let mut byte_line_count = 0; let mut byte_line_count = 0;

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Type/types.hpp" #include "Type/types.hpp"
#include <stdarg.h> #include <stdarg.hpp>
namespace JabyEngine { namespace JabyEngine {
class FontWriter { class FontWriter {

View File

@ -2,7 +2,7 @@
#include <FontWriter/fonts.hpp> #include <FontWriter/fonts.hpp>
#include <PSX/File/Processor/file_processor.hpp> #include <PSX/File/Processor/file_processor.hpp>
#include <PSX/Auxiliary/lz4_decompressor.hpp> #include <PSX/Auxiliary/lz4_decompressor.hpp>
#include <stdio.h> #include <stdio.hpp>
namespace JabyEngine { namespace JabyEngine {
static size_t decompress_font(uint32_t* work_area) { static size_t decompress_font(uint32_t* work_area) {

View File

@ -2,7 +2,6 @@
#include <PSX/GPU/gpu.hpp> #include <PSX/GPU/gpu.hpp>
#include <PSX/GPU/make_gpu_primitives.hpp> #include <PSX/GPU/make_gpu_primitives.hpp>
#include <FontWriter/font_writer.hpp> #include <FontWriter/font_writer.hpp>
#include <stdio.h>
namespace JabyEngine { namespace JabyEngine {
static constexpr auto ITOABufferSize = 32; static constexpr auto ITOABufferSize = 32;