summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-04-26 11:37:48 +0200
committerrobojumper <robojumper@gmail.com>2025-04-26 21:26:55 +0200
commit9bc03e04408c48a07e79294349ddd9b4cfabf23f (patch)
tree1fb403284ed71f8017db2ac40b93da051078f576 /src
parent6c81514f54c6c604098560e4cc1b62d4d28e90f0 (diff)
Configure everything
Diffstat (limited to 'src')
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h6
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h2
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h5
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar.h9
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h6
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wprintf.h2
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wstring.h3
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c9
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c4
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/uart_console_io_gcn.c4
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Inc/MWCPlusLib.h33
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h4
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c8
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp309
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Src/__mem.c83
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c4
-rw-r--r--src/PowerPC_EABI_Support/Runtime/Src/runtime.c2
-rw-r--r--src/nw4r/lyt/lyt_textBox.cpp1
18 files changed, 295 insertions, 199 deletions
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h
index 6e399f53..9514154a 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h
@@ -2,6 +2,7 @@
#define _MSL_COMMON_ANSI_FILES_H
#include "stddef.h"
+#include "wchar.h"
#ifdef __cplusplus
extern "C" {
@@ -13,9 +14,6 @@ extern "C" {
typedef unsigned long __file_handle;
typedef unsigned long fpos_t;
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
#define set_error(file) \
do { \
@@ -126,4 +124,4 @@ void __close_all(void);
};
#endif
-#endif /* _MSL_COMMON_ANSI_FILES_H */ \ No newline at end of file
+#endif /* _MSL_COMMON_ANSI_FILES_H */
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h
index 55110c72..b89fe460 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h
@@ -99,4 +99,4 @@ public:
} // namespace std
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h
index d999b6ea..e4a5fdf2 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h
@@ -1,7 +1,8 @@
#ifndef _MSL_COMMON_MBSTRING_H
#define _MSL_COMMON_MBSTRING_H
-#include "wchar_io.h"
+#include "wchar.h"
+#include "stddef.h"
#ifdef __cplusplus
extern "C" {
@@ -13,4 +14,4 @@ size_t wcstombs(char* dst, const wchar_t* src, size_t n);
}
#endif
-#endif /* _MSL_COMMON_MBSTRING_H */ \ No newline at end of file
+#endif /* _MSL_COMMON_MBSTRING_H */
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar.h
index 961bc74d..4e083ae4 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar.h
@@ -1,15 +1,14 @@
#ifndef MSL_WCHAR_H
#define MSL_WCHAR_H
-#include "common.h"
-#include "limits.h"
-#include "mbstring.h"
-#include "wprintf.h"
-#include "wstring.h"
#ifdef __cplusplus
extern "C" {
#endif
+#ifndef __cplusplus
+typedef unsigned short wchar_t;
+#endif
+
#define WCHAR_MIN SHRT_MIN
#define WCHAR_MAX USHRT_MAX
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h
index 999db811..a2f546c3 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h
@@ -3,10 +3,6 @@
#include "ansi_files.h"
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-
int fwide(FILE* file, int mode);
-#endif /* _MSL_COMMON_WCHAR_IO_H */ \ No newline at end of file
+#endif /* _MSL_COMMON_WCHAR_IO_H */
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wprintf.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wprintf.h
index cd808eb1..f8026464 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wprintf.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wprintf.h
@@ -4,6 +4,8 @@
#include "__va_arg.h"
#include "common.h"
+#include "wchar.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wstring.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wstring.h
index 316f3a59..e8a3699e 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wstring.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wstring.h
@@ -1,6 +1,9 @@
#ifndef MSL_WSTRING_H
#define MSL_WSTRING_H
+
#include "common.h"
+#include "wchar.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c
index 77ddf8ef..04423f91 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c
@@ -15,9 +15,6 @@
#define TARGET_FLOAT_MANT_BITS (TARGET_FLOAT_MANT_DIG - TARGET_FLOAT_IMPLICIT_J_BIT)
#define TARGET_FLOAT_EXP_BITS (TARGET_FLOAT_BITS - TARGET_FLOAT_MANT_BITS - 1)
-#define PTRDIFF __typeof__((char*)0 - (char*)0)
-typedef PTRDIFF ptrdiff_t;
-
enum justification_options { left_justification, right_justification, zero_fill };
enum sign_options { only_minus, sign_always, space_holder };
@@ -1007,7 +1004,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr
if (format.argument_options == long_double_argument) {
long_double_num = va_arg(arg, long double);
} else {
- long_double_num = va_arg(arg, f64);
+ long_double_num = va_arg(arg, double);
}
if (!(buff_ptr = float2str(long_double_num, buff + 512, format))) {
@@ -1022,7 +1019,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr
if (format.argument_options == long_double_argument) {
long_double_num = va_arg(arg, long double);
} else {
- long_double_num = va_arg(arg, f64);
+ long_double_num = va_arg(arg, double);
}
if (!(buff_ptr = double2hex(long_double_num, buff + 512, format))) {
@@ -1262,4 +1259,4 @@ int sprintf(char* s, const char* format, ...) {
va_list args;
va_start(args, format);
return vsnprintf(s, 0xFFFFFFFF, format, args);
-} \ No newline at end of file
+}
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c
index fb139480..ba3a59db 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c
@@ -110,7 +110,7 @@
* to produce the hexadecimal values shown.
*/
-#include "types.h"
+#include "common.h"
#include "errno.h"
#include "math.h"
@@ -404,4 +404,4 @@ double __ieee754_pow(x, y) double x, y;
#endif /* defined(_DOUBLE_IS_32BITS) */
-// EOF e_pow.c \ No newline at end of file
+// EOF e_pow.c
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/uart_console_io_gcn.c b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/uart_console_io_gcn.c
index b727148c..c6a405ea 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/uart_console_io_gcn.c
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/uart_console_io_gcn.c
@@ -1,5 +1,5 @@
#include "uart_console_io_gcn.h"
-#include "dolphin/os.h"
+#include "rvl/os.h"
int InitializeUART(size_t);
int WriteUARTN(unsigned char*, size_t);
@@ -38,4 +38,4 @@ int __write_console(__file_handle handle, unsigned char* buffer, size_t* count,
/* 8036919C-803691A4 363ADC 0008+00 0/0 1/0 0/0 .text __close_console */
int __close_console(__file_handle handle) {
return 0;
-} \ No newline at end of file
+}
diff --git a/src/PowerPC_EABI_Support/Runtime/Inc/MWCPlusLib.h b/src/PowerPC_EABI_Support/Runtime/Inc/MWCPlusLib.h
new file mode 100644
index 00000000..7ec6b8f7
--- /dev/null
+++ b/src/PowerPC_EABI_Support/Runtime/Inc/MWCPlusLib.h
@@ -0,0 +1,33 @@
+#ifndef MWCPLUSLIB_H
+#define MWCPLUSLIB_H
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CTORARG_TYPE int
+#define CTORARG_PARTIAL (0)
+#define CTORARG_COMPLETE (1)
+
+#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
+
+#define DTORARG_TYPE int
+
+#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
+
+typedef void* ConstructorDestructor;
+
+extern void __construct_array(void* ptr, ConstructorDestructor ctor, ConstructorDestructor dtor, size_t size, size_t n);
+extern void __destroy_arr(void* block, ConstructorDestructor* dtor, size_t size, size_t n);
+extern void* __construct_new_array(void* block, ConstructorDestructor ctor, ConstructorDestructor dtor_arg, size_t size, size_t n);
+extern void __destroy_new_array(void* block, ConstructorDestructor dtor);
+extern void __destroy_new_array2();
+extern void __destroy_new_array3();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MWCPLUSLIB_H */
diff --git a/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h b/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h
index a11aea38..7ce2ad4c 100644
--- a/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h
+++ b/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h
@@ -10,8 +10,4 @@ typedef struct __ptmf {
} f_data;
} __ptmf;
-const __ptmf __ptmf_null;
-long __ptmf_test(__ptmf *ptmf);
-void __ptmf_cmpr(register __ptmf *this, register __ptmf *other);
-void __ptmf_scall(...);
#endif /* PTMF_H */
diff --git a/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c b/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c
index 269cbef9..d4e5ac25 100644
--- a/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c
+++ b/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c
@@ -3,7 +3,7 @@
* Description:
*/
-#include "dolphin/os.h"
+#include "RVL/OS.h"
inline static void InitDefaultHeap(void) {
void* arenaLo;
@@ -18,8 +18,8 @@ inline static void InitDefaultHeap(void) {
arenaLo = OSInitAlloc(arenaLo, arenaHi, 1);
OSSetArenaLo(arenaLo);
- arenaLo = OSRoundUpPtr(arenaLo, 0x20);
- arenaHi = OSRoundDownPtr(arenaHi, 0x20);
+ arenaLo = (void*)OSRoundUp32B(arenaLo);
+ arenaHi = (void*)OSRoundDown32B(arenaHi);
OSSetCurrentHeap(OSCreateHeap(arenaLo, arenaHi));
OSSetArenaLo(arenaLo = arenaHi);
@@ -32,4 +32,4 @@ void __sys_free(void* p) {
}
OSFreeToHeap(__OSCurrHeap, p);
-} \ No newline at end of file
+}
diff --git a/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp b/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp
index f665dbbf..3285b3eb 100644
--- a/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp
+++ b/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp
@@ -1,121 +1,218 @@
-//
-// Generated By: dol2asm
-// Translation Unit: NMWException
-//
-
#include "NMWException.h"
-#include "stddef.h"
-#include "dol2asm.h"
+#include "MWCPlusLib.h"
-//
-// Types:
-//
+typedef void (*unexpected_handler)();
+unexpected_handler set_unexpected(unexpected_handler handler);
+void unexpected();
-struct __partial_array_destructor {
- /* 80361E5C */ ~__partial_array_destructor();
-};
+typedef void (*terminate_handler)();
+terminate_handler set_terminate(terminate_handler handler);
+void terminate();
-//
-// Forward References:
-//
-
-#pragma section "extabindex_"
-extern void* const data_8000569C[8];
-extern "C" void __destroy_new_array();
-extern "C" void __destroy_arr();
-extern "C" void __construct_array();
-extern "C" void __dt__26__partial_array_destructorFv();
-extern "C" void __construct_new_array();
-
-//
-// External References:
-//
-
-#pragma section "extab_"
-extern "C" extern void* const _section_symbol_extab[18];
-extern "C" void __dl__FPv();
-extern "C" void __dla__FPv();
-
-//
-// Declarations:
-//
-
-/* 80361C6C-80361CE8 35C5AC 007C+00 2/0 11/11 3/3 .text __destroy_new_array */
-void __destroy_new_array() {
- // NONMATCHING
-}
+#define ARRAY_HEADER_SIZE 16
-/* 80361CE8-80361D60 35C628 0078+00 1/0 58/58 350/350 .text __destroy_arr */
-void __destroy_arr() {
- // NONMATCHING
+extern "C" {
+extern void abort();
}
-/* 80361D60-80361E5C 35C6A0 00FC+00 1/0 98/98 461/461 .text __construct_array */
-void __construct_array() {
- // NONMATCHING
+namespace std {
+static void dthandler() { abort(); }
+
+static terminate_handler thandler = dthandler;
+
+static void duhandler() { terminate(); }
+
+static unexpected_handler uhandler = duhandler;
+
+extern terminate_handler set_terminate(terminate_handler handler) {
+ terminate_handler old = thandler;
+ thandler = handler;
+ return old;
}
-/* 80361E5C-80361F14 35C79C 00B8+00 1/0 1/0 0/0 .text __dt__26__partial_array_destructorFv */
-__partial_array_destructor::~__partial_array_destructor() {
- // NONMATCHING
+extern void terminate() { thandler(); }
+
+extern unexpected_handler set_unexpected(unexpected_handler handler) {
+ unexpected_handler old = uhandler;
+ uhandler = handler;
+ return old;
}
-/* 80361F14-80362018 35C854 0104+00 1/0 28/28 13/13 .text __construct_new_array */
-void __construct_new_array() {
- // NONMATCHING
+extern void unexpected() { uhandler(); }
+} // namespace std
+
+extern char __throw_catch_compare(const char* throwtype, const char* catchtype, long* offset_result) {
+ const char *cptr1, *cptr2;
+
+ *offset_result = 0;
+
+ if ((cptr2 = catchtype) == 0) {
+ return true;
+ }
+
+ cptr1 = throwtype;
+
+ if (*cptr2 == 'P') {
+ cptr2++;
+ if (*cptr2 == 'C')
+ cptr2++;
+ if (*cptr2 == 'V')
+ cptr2++;
+ if (*cptr2 == 'v') {
+ if (*cptr1 == 'P' || *cptr1 == '*') {
+ return true;
+ }
+ }
+ cptr2 = catchtype;
+ }
+
+ switch (*cptr1) {
+ case '*':
+ case '!':
+ if (*cptr1++ != *cptr2++)
+ return false;
+ for (;;) {
+ if (*cptr1 == *cptr2++) {
+ if (*cptr1++ == '!') {
+ long offset;
+
+ for (offset = 0; *cptr1 != '!';) {
+ offset = offset * 10 + *cptr1++ - '0';
+ }
+ *offset_result = offset;
+ return true;
+ }
+ } else {
+ while (*cptr1++ != '!') { }
+ while (*cptr1++ != '!') { }
+ if (*cptr1 == 0)
+ return false;
+
+ cptr2 = catchtype + 1;
+ }
+ }
+ return false;
+ }
+
+ while ((*cptr1 == 'P' || *cptr1 == 'R') && *cptr1 == *cptr2) {
+ cptr1++;
+ cptr2++;
+
+ if (*cptr2 == 'C') {
+ if (*cptr1 == 'C')
+ cptr1++;
+ cptr2++;
+ }
+ if (*cptr1 == 'C')
+ return false;
+
+ if (*cptr2 == 'V') {
+ if (*cptr1 == 'V')
+ cptr1++;
+ cptr2++;
+ }
+ if (*cptr1 == 'V')
+ return false;
+ }
+
+ for (; *cptr1 == *cptr2; cptr1++, cptr2++) {
+ if (*cptr1 == 0)
+ return true;
+ }
+
+ return false;
}
-/* ############################################################################################## */
-/* 80005660-8000566C -00001 000C+00 1/0 0/0 0/0 .extabindex @206 */
-SECTION_EXTABINDEX static void* const lit_206[3] = {
- (void*)__destroy_new_array,
- (void*)0x0000007C,
- (void*)&_section_symbol_extab,
+class __partial_array_destructor {
+private:
+ void* p;
+ size_t size;
+ size_t n;
+ ConstructorDestructor dtor;
+
+public:
+ size_t i;
+
+ __partial_array_destructor(void* array, size_t elementsize, size_t nelements, ConstructorDestructor destructor) {
+ p = array;
+ size = elementsize;
+ n = nelements;
+ dtor = destructor;
+ i = n;
+ }
+
+ ~__partial_array_destructor() {
+ char* ptr;
+
+ if (i < n && dtor) {
+ for (ptr = (char*)p + size * i; i > 0; i--) {
+ ptr -= size;
+ DTORCALL_COMPLETE(dtor, ptr);
+ }
+ }
+ }
};
-/* 8000566C-80005678 -00001 000C+00 0/0 0/0 0/0 .extabindex @211 */
-#pragma push
-#pragma force_active on
-SECTION_EXTABINDEX static void* const lit_211[3] = {
- (void*)__destroy_arr,
- (void*)0x00000078,
- (void*)(((char*)&_section_symbol_extab) + 0x8),
-};
-#pragma pop
-
-/* 80005678-80005684 -00001 000C+00 0/0 0/0 0/0 .extabindex @232 */
-#pragma push
-#pragma force_active on
-SECTION_EXTABINDEX static void* const lit_232[3] = {
- (void*)__construct_array,
- (void*)0x000000FC,
- (void*)(((char*)&_section_symbol_extab) + 0x10),
-};
-#pragma pop
-
-/* 80005684-80005690 -00001 000C+00 0/0 0/0 0/0 .extabindex @240 */
-#pragma push
-#pragma force_active on
-SECTION_EXTABINDEX static void* const lit_240[3] = {
- (void*)__dt__26__partial_array_destructorFv,
- (void*)0x000000B8,
- (void*)(((char*)&_section_symbol_extab) + 0x28),
-};
-#pragma pop
-
-/* 80005690-8000569C -00001 000C+00 0/0 0/0 0/0 .extabindex @263 */
-#pragma push
-#pragma force_active on
-SECTION_EXTABINDEX static void* const lit_263[3] = {
- (void*)__construct_new_array,
- (void*)0x00000104,
- (void*)(((char*)&_section_symbol_extab) + 0x30),
-};
-#pragma pop
-
-/* 8000569C-800056BC -00001 0020+00 1/0 1/1 0/0 .extabindex None */
-SECTION_EXTABINDEX extern void* const data_8000569C[8] = {
- (void*)&lit_206, (void*)&data_8000569C, (void*)__destroy_new_array,
- (void*)0x000003AC, (void*)NULL, (void*)NULL,
- (void*)NULL, (void*)NULL,
-}; \ No newline at end of file
+extern void* __construct_new_array(void* block, ConstructorDestructor ctor, ConstructorDestructor dtor, size_t size, size_t n) {
+ char* ptr;
+
+ if ((ptr = (char*)block) != 0L) {
+ size_t* p = (size_t*)ptr;
+
+ p[0] = size;
+ p[1] = n;
+ ptr += ARRAY_HEADER_SIZE;
+
+ if (ctor) {
+ __partial_array_destructor pad(ptr, size, n, dtor);
+ char* p;
+
+ for (pad.i = 0, p = (char*)ptr; pad.i < n; pad.i++, p += size) {
+ CTORCALL_COMPLETE(ctor, p);
+ }
+ }
+ }
+ return ptr;
+}
+
+extern void __construct_array(void* ptr, ConstructorDestructor ctor, ConstructorDestructor dtor, size_t size, size_t n) {
+ __partial_array_destructor pad(ptr, size, n, dtor);
+ char* p;
+
+ for (pad.i = 0, p = (char*)ptr; pad.i < n; pad.i++, p += size) {
+ CTORCALL_COMPLETE(ctor, p);
+ }
+}
+
+extern void __destroy_arr(void* block, ConstructorDestructor* dtor, size_t size, size_t n) {
+ char* p;
+
+ for (p = (char*)block + size * n; n > 0; n--) {
+ p -= size;
+ DTORCALL_COMPLETE(dtor, p);
+ }
+}
+
+extern void __destroy_new_array(void* block, ConstructorDestructor dtor) {
+ if (block) {
+ if (dtor) {
+ size_t i, objects, objectsize;
+ char* p;
+
+ objectsize = *(size_t*)((char*)block - ARRAY_HEADER_SIZE);
+ objects = ((size_t*)((char*)block - ARRAY_HEADER_SIZE))[1];
+ p = (char*)block + (objectsize * objects);
+
+ for (i = 0; i < objects; i++) {
+ p -= objectsize;
+ DTORCALL_COMPLETE(dtor, p);
+ }
+ }
+
+ ::operator delete[]((char*)block - ARRAY_HEADER_SIZE);
+ }
+}
+
+void __destroy_new_array2(void) {}
+
+void __destroy_new_array3(void) {}
diff --git a/src/PowerPC_EABI_Support/Runtime/Src/__mem.c b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c
index 082bdc1f..4d958060 100644
--- a/src/PowerPC_EABI_Support/Runtime/Src/__mem.c
+++ b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c
@@ -1,54 +1,30 @@
-#include "dol2asm.h"
-#include "dolphin.h"
+#include "stddef.h"
-/* 800035C0-800035E4 0004C0 0024+00 0/0 12/12 0/0 .init TRK_memcpy */
-SECTION_INIT void *TRK_memcpy(void *dst, const void *src, size_t n) {
- const unsigned char *s = (const unsigned char *)src - 1;
- unsigned char *d = (unsigned char *)dst - 1;
-
- n++;
- while (--n != 0) {
- *++d = *++s;
- }
- return dst;
-}
-
-/* 80003590-800035C0 000490 0030+00 0/0 1/1 0/0 .init TRK_memset */
-SECTION_INIT void *TRK_memset(void *dst, int val, size_t n) {
- TRK_fill_mem(dst, val, n);
-
- return dst;
-}
-
-/* 80003540-80003590 000440 0050+00 1/1 63/63 6/6 .init memcpy */
-SECTION_INIT void *memcpy(void *dst, const void *src, size_t n) {
- const unsigned char *s;
- unsigned char *d;
+void* memcpy(void* dst, const void* src, size_t n) {
+ const unsigned char* s;
+ unsigned char* d;
if ((unsigned long)src >= (unsigned long)dst) {
- s = (const unsigned char *)src - 1;
- d = (unsigned char *)dst - 1;
+ s = (const unsigned char*)src - 1;
+ d = (unsigned char*)dst - 1;
n++;
- while (--n != 0) {
+ while (--n != 0)
*++d = *++s;
- }
} else {
- s = (const unsigned char *)src + n;
- d = (unsigned char *)dst + n;
+ s = (const unsigned char*)src + n;
+ d = (unsigned char*)dst + n;
n++;
- while (--n != 0) {
+ while (--n != 0)
*--d = *--s;
- }
}
return dst;
}
-/* 80003488-80003540 000388 00B8+00 1/1 0/0 0/0 .init __fill_mem */
-SECTION_INIT void __fill_mem(void *dst, int val, size_t n) {
+void __fill_mem(void* dst, int val, size_t n) {
unsigned long v = (unsigned char)val;
unsigned long i;
- ((unsigned char *)dst) = ((unsigned char *)dst) - 1;
+ ((unsigned char*)dst) = ((unsigned char*)dst) - 1;
if (n >= 32) {
i = (~(unsigned long)dst) & 3;
@@ -57,28 +33,27 @@ SECTION_INIT void __fill_mem(void *dst, int val, size_t n) {
n -= i;
do {
- *++(((unsigned char *)dst)) = v;
+ *++(((unsigned char*)dst)) = v;
} while (--i);
}
- if (v) {
+ if (v)
v |= v << 24 | v << 16 | v << 8;
- }
- ((unsigned long *)dst) = ((unsigned long *)(((unsigned char *)dst) + 1)) - 1;
+ ((unsigned long*)dst) = ((unsigned long*)(((unsigned char*)dst) + 1)) - 1;
i = n >> 5;
if (i) {
do {
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
- *++((unsigned long *)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
+ *++((unsigned long*)dst) = v;
} while (--i);
}
@@ -86,26 +61,24 @@ SECTION_INIT void __fill_mem(void *dst, int val, size_t n) {
if (i) {
do {
- *++((unsigned long *)dst) = v;
+ *++((unsigned long*)dst) = v;
} while (--i);
}
- ((unsigned char *)dst) = ((unsigned char *)(((unsigned long *)dst) + 1)) - 1;
+ ((unsigned char*)dst) = ((unsigned char*)(((unsigned long*)dst) + 1)) - 1;
n &= 3;
}
- if (n) {
+ if (n)
do {
- *++((unsigned char *)dst) = v;
+ *++((unsigned char*)dst) = v;
} while (--n);
- }
return;
}
-/* 80003458-80003488 000358 0030+00 1/1 55/55 137/137 .init memset */
-SECTION_INIT void *memset(void *dst, int val, size_t n) {
+void* memset(void* dst, int val, size_t n) {
__fill_mem(dst, val, n);
return dst;
diff --git a/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c b/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c
index e5f6449b..fbc9eaaa 100644
--- a/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c
+++ b/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c
@@ -38,7 +38,7 @@ void* __va_arg(_va_list_struct* list, int type) {
} else {
*reg = 8;
addr = list->input_arg_area;
- addr = (char*)(((u32)(addr) + ((size)-1)) & ~((size)-1));
+ addr = (char*)(((unsigned int)(addr) + ((size)-1)) & ~((size)-1));
list->input_arg_area = addr + size;
}
@@ -47,4 +47,4 @@ void* __va_arg(_va_list_struct* list, int type) {
}
return addr;
-} \ No newline at end of file
+}
diff --git a/src/PowerPC_EABI_Support/Runtime/Src/runtime.c b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c
index 6b0aad3f..a3ba7f1e 100644
--- a/src/PowerPC_EABI_Support/Runtime/Src/runtime.c
+++ b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c
@@ -1,4 +1,4 @@
-#include "dolphin.h"
+#include "common.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/nw4r/lyt/lyt_textBox.cpp b/src/nw4r/lyt/lyt_textBox.cpp
index 9be924d7..4eeb8ff9 100644
--- a/src/nw4r/lyt/lyt_textBox.cpp
+++ b/src/nw4r/lyt/lyt_textBox.cpp
@@ -4,6 +4,7 @@
#include "nw4r/lyt/lyt_layout.h"
#include "nw4r/lyt/lyt_material.h"
#include "nw4r/ut.h" // IWYU pragma: export
+#include "wstring.h"
namespace nw4r {
namespace lyt {