mirror of
https://github.com/zeldaret/tp
synced 2026-08-21 22:41:04 -04:00
MSL_C cleanup (#238)
* clean up MSL_C files according to prime decomp * remove asm
This commit is contained in:
@@ -4,25 +4,15 @@
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/FILE_POS.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void fseek();
|
||||
static void _fseek();
|
||||
void ftell();
|
||||
#include "MSL_C/MSL_Common/Src/buffer_io.h"
|
||||
#include "errno.h"
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __flush_buffer();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
extern u8 errno[4 + 4 /* padding */];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
@@ -32,7 +22,7 @@ extern u8 errno[4 + 4 /* padding */];
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void fseek() {
|
||||
asm int fseek(FILE* file, long offset, int mode) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/FILE_POS/fseek.s"
|
||||
}
|
||||
@@ -42,7 +32,7 @@ asm void fseek() {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
static asm void _fseek() {
|
||||
asm int _fseek(FILE* file, fpos_t offset, int mode) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/FILE_POS/_fseek.s"
|
||||
}
|
||||
@@ -52,7 +42,7 @@ static asm void _fseek() {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void ftell() {
|
||||
asm long ftell(FILE* file) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/FILE_POS/ftell.s"
|
||||
}
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/abort_exit
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/abort_exit.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/MSL_Common/Src/signal.h"
|
||||
#include "MSL_C/MSL_Common/Src/stddef.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void exit();
|
||||
void abort();
|
||||
extern u8 data_804519A0[8];
|
||||
extern unsigned char data_804519A0[8];
|
||||
|
||||
//
|
||||
// External References:
|
||||
@@ -24,12 +13,7 @@ void __destroy_global_chain();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
void __kill_critical_regions();
|
||||
void raise(int);
|
||||
SECTION_DTORS10 extern void (*__destroy_global_chain_reference[])(void);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
extern void (*__destroy_global_chain_reference[])(void);
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8044D440-8044D540 07A160 0100+00 2/2 0/0 0/0 .bss __atexit_funcs */
|
||||
@@ -37,14 +21,13 @@ static void (*__atexit_funcs[64])(void);
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804519A0-804519A8 000EA0 0008+00 0/0 1/1 0/0 .sbss None */
|
||||
extern u8 data_804519A0[8];
|
||||
u8 data_804519A0[8];
|
||||
extern unsigned char data_804519A0[8];
|
||||
unsigned char data_804519A0[8];
|
||||
|
||||
/* 8045199C-804519A0 000E9C 0004+00 2/2 0/0 0/0 .sbss __console_exit */
|
||||
static void (*__console_exit)(void);
|
||||
|
||||
/* 80451998-8045199C 000E98 0004+00 1/1 1/1 0/0 .sbss __stdio_exit */
|
||||
extern void (*__stdio_exit)(void);
|
||||
void (*__stdio_exit)(void);
|
||||
|
||||
/* 80451994-80451998 000E94 0004+00 2/2 0/0 0/0 .sbss __atexit_curr_func */
|
||||
@@ -53,43 +36,6 @@ static int __atexit_curr_func;
|
||||
/* 80451990-80451994 000E90 0004+00 2/2 0/0 0/0 .sbss __aborting */
|
||||
static int __aborting;
|
||||
|
||||
/* 803629CC-80362ABC 35D30C 00F0+00 0/0 2/2 0/0 .text exit */
|
||||
void exit(int status) {
|
||||
int i;
|
||||
void (**dtor)(void);
|
||||
|
||||
if (!__aborting) {
|
||||
__begin_critical_region(0);
|
||||
__end_critical_region(0);
|
||||
__destroy_global_chain();
|
||||
|
||||
dtor = __destroy_global_chain_reference;
|
||||
while (*dtor != NULL) {
|
||||
(*dtor)();
|
||||
dtor++;
|
||||
}
|
||||
|
||||
if (__stdio_exit != NULL) {
|
||||
__stdio_exit();
|
||||
__stdio_exit = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
__begin_critical_region(0);
|
||||
while (__atexit_curr_func > 0)
|
||||
__atexit_funcs[--__atexit_curr_func]();
|
||||
|
||||
__end_critical_region(0);
|
||||
__kill_critical_regions();
|
||||
|
||||
if (__console_exit != NULL) {
|
||||
__console_exit();
|
||||
__console_exit = NULL;
|
||||
}
|
||||
|
||||
_ExitProcess();
|
||||
}
|
||||
|
||||
/* 80362ABC-80362B58 35D3FC 009C+00 0/0 9/9 0/0 .text abort */
|
||||
void abort(void) {
|
||||
raise(1);
|
||||
@@ -97,15 +43,52 @@ void abort(void) {
|
||||
__begin_critical_region(0);
|
||||
|
||||
while (__atexit_curr_func > 0)
|
||||
__atexit_funcs[--__atexit_curr_func]();
|
||||
|
||||
__atexit_funcs[--__atexit_curr_func]();
|
||||
|
||||
__end_critical_region(0);
|
||||
__kill_critical_regions();
|
||||
|
||||
if (__console_exit != NULL) {
|
||||
__console_exit();
|
||||
__console_exit = NULL;
|
||||
}
|
||||
__console_exit();
|
||||
__console_exit = NULL;
|
||||
}
|
||||
|
||||
_ExitProcess();
|
||||
_ExitProcess();
|
||||
}
|
||||
|
||||
/* 803629CC-80362ABC 35D30C 00F0+00 0/0 2/2 0/0 .text exit */
|
||||
void exit(int status) {
|
||||
int i;
|
||||
void (**dtor)(void);
|
||||
|
||||
if (!__aborting) {
|
||||
__begin_critical_region(0);
|
||||
__end_critical_region(0);
|
||||
__destroy_global_chain();
|
||||
|
||||
dtor = __destroy_global_chain_reference;
|
||||
while (*dtor != NULL) {
|
||||
(*dtor)();
|
||||
dtor++;
|
||||
}
|
||||
|
||||
if (__stdio_exit != NULL) {
|
||||
__stdio_exit();
|
||||
__stdio_exit = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
__begin_critical_region(0);
|
||||
while (__atexit_curr_func > 0)
|
||||
__atexit_funcs[--__atexit_curr_func]();
|
||||
|
||||
__end_critical_region(0);
|
||||
__kill_critical_regions();
|
||||
|
||||
if (__console_exit != NULL) {
|
||||
__console_exit();
|
||||
__console_exit = NULL;
|
||||
}
|
||||
|
||||
_ExitProcess();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/alloc
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/alloc.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/MSL_Common/Src/string.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void free();
|
||||
void __pool_free();
|
||||
static void deallocate_from_fixed_pools();
|
||||
static void deallocate_from_var_pools();
|
||||
|
||||
@@ -20,11 +8,10 @@ static void deallocate_from_var_pools();
|
||||
// External References:
|
||||
//
|
||||
|
||||
SECTION_INIT void memset();
|
||||
void __sys_free();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
extern u8 data_804519A0[8];
|
||||
extern unsigned char data_804519A0[8];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
@@ -32,13 +19,13 @@ extern u8 data_804519A0[8];
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8044D540-8044D578 07A260 0038+00 1/1 0/0 0/0 .bss protopool$192 */
|
||||
static u8 protopool[56];
|
||||
static unsigned char protopool[56];
|
||||
|
||||
/* 80362B58-80362BC8 35D498 0070+00 0/0 2/2 0/0 .text free */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void free() {
|
||||
asm void free(FILE* file) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/alloc/free.s"
|
||||
}
|
||||
@@ -56,11 +43,10 @@ asm void __pool_free() {
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803A2220-803A2238 02E880 0018+00 1/1 0/0 0/0 .rodata fix_pool_sizes */
|
||||
SECTION_RODATA static u8 const fix_pool_sizes[24] = {
|
||||
static unsigned char const fix_pool_sizes[24] = {
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x14,
|
||||
0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x44,
|
||||
};
|
||||
COMPILER_STRIP_GATE(0x803A2220, &fix_pool_sizes);
|
||||
|
||||
/* 80362C20-80362D78 35D560 0158+00 1/1 0/0 0/0 .text deallocate_from_fixed_pools */
|
||||
#pragma push
|
||||
|
||||
@@ -1,142 +1,152 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/ansi_files
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/ansi_files.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/MSL_Common/Src/alloc.h"
|
||||
#include "MSL_C/MSL_Common/Src/file_io.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
unsigned int __flush_all();
|
||||
void __close_all();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void free(FILE*);
|
||||
void __end_critical_region(int);
|
||||
void __begin_critical_region(int);
|
||||
int fflush(FILE*);
|
||||
void fclose(FILE*);
|
||||
int __close_console(unsigned int);
|
||||
int __write_console(int, int, int*, int);
|
||||
int __read_console(unsigned int, unsigned int, unsigned int*);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8044D778-8044D878 07A498 0100+00 1/0 0/0 0/0 .bss stdin_buff */
|
||||
static u8 stdin_buff[0x100];
|
||||
static unsigned char stdin_buff[0x100];
|
||||
|
||||
/* 8044D678-8044D778 07A398 0100+00 1/0 0/0 0/0 .bss stdout_buff */
|
||||
static u8 stdout_buff[0x100];
|
||||
static unsigned char stdout_buff[0x100];
|
||||
|
||||
/* 8044D578-8044D678 07A298 0100+00 1/0 0/0 0/0 .bss stderr_buff */
|
||||
static u8 stderr_buff[0x100];
|
||||
static unsigned char stderr_buff[0x100];
|
||||
|
||||
/* 803D29B0-803D2AF0 -00001 0140+00 3/2 15/15 0/0 .data __files */
|
||||
SECTION_DATA extern files __files = {
|
||||
{0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdin_buff,
|
||||
0x00000100,
|
||||
stdin_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.stdout},
|
||||
{1,
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdout_buff,
|
||||
0x00000100,
|
||||
stdout_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.stderr},
|
||||
{2,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stderr_buff,
|
||||
0x00000100,
|
||||
stderr_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.empty},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0},
|
||||
{0, 0}, 0, NULL, 0x00000000, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
extern files __files = {
|
||||
{
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdin_buff,
|
||||
0x00000100,
|
||||
stdin_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.stdout,
|
||||
},
|
||||
{
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdout_buff,
|
||||
0x00000100,
|
||||
stdout_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.stderr,
|
||||
},
|
||||
{
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stderr_buff,
|
||||
0x00000100,
|
||||
stderr_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
NULL,
|
||||
&__files.empty,
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0},
|
||||
{0, 0}, 0, NULL, 0x00000000, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
},
|
||||
};
|
||||
|
||||
/* 8036307C-80363124 35D9BC 00A8+00 0/0 1/1 0/0 .text __close_all */
|
||||
void __close_all(void) {
|
||||
FILE* file = &__files.stdin;
|
||||
FILE* last_file;
|
||||
|
||||
__begin_critical_region(2);
|
||||
|
||||
while (file != NULL) {
|
||||
if (file->file_mode.file_kind != __closed_file) {
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
last_file = file;
|
||||
file = file->next_file;
|
||||
|
||||
if (last_file->is_dynamically_allocated) {
|
||||
free(last_file);
|
||||
} else {
|
||||
last_file->file_mode.file_kind = __unavailable_file;
|
||||
if (file != NULL && file->is_dynamically_allocated) {
|
||||
last_file->next_file = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__end_critical_region(2);
|
||||
}
|
||||
|
||||
/* 8036300C-8036307C 35D94C 0070+00 0/0 2/2 0/0 .text __flush_all */
|
||||
unsigned int __flush_all(void) {
|
||||
unsigned int ret = 0;
|
||||
@@ -151,31 +161,3 @@ unsigned int __flush_all(void) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8036307C-80363124 35D9BC 00A8+00 0/0 1/1 0/0 .text __close_all */
|
||||
void __close_all(void) {
|
||||
FILE* file = &__files.stdin;
|
||||
FILE* last_file;
|
||||
|
||||
__begin_critical_region(2);
|
||||
|
||||
while (file != NULL) {
|
||||
if (file->file_mode.file_kind != CLOSED_FILE) {
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
last_file = file;
|
||||
file = file->next_file;
|
||||
|
||||
if (last_file->flag) {
|
||||
free(last_file);
|
||||
} else {
|
||||
last_file->file_mode.file_kind = UNAVAILABLE_FILE;
|
||||
if (file != NULL && file->flag) {
|
||||
last_file->next_file = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__end_critical_region(2);
|
||||
}
|
||||
|
||||
@@ -1,43 +1,20 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/arith
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/arith.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void div();
|
||||
void abs();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
#include "MSL_C/math.h"
|
||||
|
||||
/* 80365078-803650D0 35F9B8 0058+00 0/0 1/1 0/0 .text div */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void div() {
|
||||
asm div_t div(int numerator, int denominator) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/arith/div.s"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 803650D0-803650E0 35FA10 0010+00 0/0 66/66 225/225 .text abs */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void abs() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/arith/abs.s"
|
||||
int abs(int n) {
|
||||
if (n < 0)
|
||||
return (-n);
|
||||
else
|
||||
return (n);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/buffer_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/buffer_io.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
void __convert_from_newlines(unsigned char* buf, size_t* n) {}
|
||||
|
||||
void __flush_buffer();
|
||||
void __prep_buffer();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 803650E0-803651A4 35FA20 00C4+00 0/0 5/5 0/0 .text __flush_buffer */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __flush_buffer() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/buffer_io/__flush_buffer.s"
|
||||
}
|
||||
#pragma pop
|
||||
void __convert_to_newlines(unsigned char* buf, size_t* n) {}
|
||||
|
||||
/* 803651A4-803651D8 35FAE4 0034+00 0/0 2/2 0/0 .text __prep_buffer */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __prep_buffer() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/buffer_io/__prep_buffer.s"
|
||||
void __prep_buffer(FILE* file) {
|
||||
file->buffer_ptr = file->buffer;
|
||||
file->buffer_length = file->buffer_size;
|
||||
file->buffer_length -= file->position & file->buffer_alignment;
|
||||
file->buffer_position = file->position;
|
||||
}
|
||||
|
||||
/* 803650E0-803651A4 35FA20 00C4+00 0/0 5/5 0/0 .text __flush_buffer */
|
||||
int __flush_buffer(FILE* file, size_t* bytes_flushed) {
|
||||
size_t buffer_len;
|
||||
int ioresult;
|
||||
|
||||
buffer_len = file->buffer_ptr - file->buffer;
|
||||
|
||||
if (buffer_len) {
|
||||
file->buffer_length = buffer_len;
|
||||
|
||||
if (!file->file_mode.binary_io)
|
||||
__convert_from_newlines(file->buffer, (size_t*)&file->buffer_length);
|
||||
|
||||
ioresult = (*file->write_fn)(file->handle, file->buffer, (size_t*)&file->buffer_length,
|
||||
file->idle_fn);
|
||||
|
||||
if (bytes_flushed)
|
||||
*bytes_flushed = file->buffer_length;
|
||||
|
||||
if (ioresult)
|
||||
return (ioresult);
|
||||
|
||||
file->position += file->buffer_length;
|
||||
}
|
||||
|
||||
__prep_buffer(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -1,39 +1,17 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/char_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/char_io.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/MSL_Common/Src/FILE_POS.h"
|
||||
#include "MSL_C/MSL_Common/Src/buffer_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/misc_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/wchar_io.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __put_char();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __flush_buffer();
|
||||
void __prep_buffer();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
void fseek();
|
||||
void __stdio_atexit();
|
||||
void fwide();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 803651D8-803652AC 35FB18 00D4+00 0/0 1/1 0/0 .text fputs */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int fputs(const char*, FILE*) {
|
||||
asm int fputs(const char* str, FILE* stream) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/char_io/fputs.s"
|
||||
}
|
||||
@@ -43,7 +21,7 @@ asm int fputs(const char*, FILE*) {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __put_char() {
|
||||
asm int __put_char(int c, FILE* stream) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/char_io/__put_char.s"
|
||||
}
|
||||
|
||||
@@ -1,57 +1,43 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/ctype
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern unsigned char __upper_map[256];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
#define ctrl __control_char
|
||||
#define motn __motion_char
|
||||
#define spac __space_char
|
||||
#define punc __punctuation
|
||||
#define digi __digit
|
||||
#define hexd __hex_digit
|
||||
#define lowc __lower_case
|
||||
#define uppc __upper_case
|
||||
#define dhex (hexd | digi)
|
||||
#define uhex (hexd | uppc)
|
||||
#define lhex (hexd | lowc)
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803D2C18-803D2D18 02FD38 0100+00 0/0 3/3 0/0 .data __ctype_map */
|
||||
SECTION_DATA extern unsigned char __ctype_map[256] = {
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x08, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x08, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x08, 0x08, 0x08, 0x08, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
unsigned char __ctype_map[256] = {
|
||||
// clang-format off
|
||||
ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, motn, motn, motn, motn, motn, ctrl, ctrl,
|
||||
ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl,
|
||||
spac, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc,
|
||||
dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, punc, punc, punc, punc, punc, punc,
|
||||
punc, uhex, uhex, uhex, uhex, uhex, uhex, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc,
|
||||
uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, punc, punc, punc, punc, punc,
|
||||
punc, lhex, lhex, lhex, lhex, lhex, lhex, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc,
|
||||
lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, punc, punc, punc, punc, ctrl,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* 803D2D18-803D2E18 02FE38 0100+00 1/1 3/3 0/0 .data __lower_map */
|
||||
SECTION_DATA extern unsigned char __lower_map[256] = {
|
||||
unsigned char __lower_map[256] = {
|
||||
// clang-format off
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
@@ -60,6 +46,7 @@ SECTION_DATA extern unsigned char __lower_map[256] = {
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* 80365470-80365494 35FDB0 0024+00 0/0 4/4 0/0 .text tolower */
|
||||
@@ -75,15 +62,15 @@ int tolower(int __c) {
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803D2E18-803D2F18 02FF38 0100+00 0/0 1/1 0/0 .data __upper_map */
|
||||
SECTION_DATA extern unsigned char __upper_map[256] = {
|
||||
unsigned char __upper_map[256] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
|
||||
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
@@ -92,4 +79,5 @@ SECTION_DATA extern unsigned char __upper_map[256] = {
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -1,53 +1,129 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/direct_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/direct_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/FILE_POS.h"
|
||||
#include "MSL_C/MSL_Common/Src/ansi_files.h"
|
||||
#include "MSL_C/MSL_Common/Src/buffer_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/mem.h"
|
||||
#include "MSL_C/MSL_Common/Src/misc_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/string.h"
|
||||
#include "MSL_C/MSL_Common/Src/wchar_io.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __fwrite();
|
||||
void fwrite();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
SECTION_INIT void memcpy();
|
||||
void __flush_buffer();
|
||||
void __prep_buffer();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
void fseek();
|
||||
void __memrchr();
|
||||
void __stdio_atexit();
|
||||
void fwide();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 80365494-803657A0 35FDD4 030C+00 1/1 0/0 0/0 .text __fwrite */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __fwrite() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/direct_io/__fwrite.s"
|
||||
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream) {
|
||||
size_t retval;
|
||||
|
||||
__begin_critical_region(2);
|
||||
retval = __fwrite(buffer, size, count, stream);
|
||||
__end_critical_region(2);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 803657A0-8036581C 3600E0 007C+00 0/0 1/1 0/0 .text fwrite */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void fwrite() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/direct_io/fwrite.s"
|
||||
size_t __fwrite(const void* buffer, size_t size, size_t count, FILE* stream) {
|
||||
unsigned char* write_ptr;
|
||||
size_t num_bytes, bytes_to_go, bytes_written;
|
||||
int ioresult, always_buffer;
|
||||
|
||||
#ifndef __NO_WIDE_CHAR
|
||||
if (fwide(stream, 0) == 0)
|
||||
fwide(stream, -1);
|
||||
#endif
|
||||
|
||||
bytes_to_go = size * count;
|
||||
|
||||
if (!bytes_to_go || stream->file_state.error || stream->file_mode.file_kind == __closed_file)
|
||||
return 0;
|
||||
|
||||
if (stream->file_mode.file_kind == __console_file)
|
||||
__stdio_atexit();
|
||||
|
||||
always_buffer = !stream->file_mode.binary_io || stream->file_mode.buffer_mode == _IOFBF ||
|
||||
stream->file_mode.buffer_mode == _IOLBF;
|
||||
|
||||
if (stream->file_state.io_state == __neutral) {
|
||||
if (stream->file_mode.io_mode & __write) {
|
||||
if (stream->file_mode.io_mode & __append) {
|
||||
if (fseek(stream, 0, SEEK_END))
|
||||
return 0;
|
||||
}
|
||||
stream->file_state.io_state = __writing;
|
||||
|
||||
__prep_buffer(stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (stream->file_state.io_state != __writing) {
|
||||
set_error(stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
write_ptr = (unsigned char*)buffer;
|
||||
bytes_written = 0;
|
||||
|
||||
if (bytes_to_go && (stream->buffer_ptr != stream->buffer || always_buffer)) {
|
||||
stream->buffer_length = stream->buffer_size - (stream->buffer_ptr - stream->buffer);
|
||||
|
||||
do {
|
||||
unsigned char* newline = NULL;
|
||||
|
||||
num_bytes = stream->buffer_length;
|
||||
|
||||
if (num_bytes > bytes_to_go)
|
||||
num_bytes = bytes_to_go;
|
||||
if (stream->file_mode.buffer_mode == _IOLBF && num_bytes)
|
||||
if ((newline = (unsigned char*)__memrchr(write_ptr, '\n', num_bytes)) != NULL)
|
||||
num_bytes = newline + 1 - write_ptr;
|
||||
|
||||
if (num_bytes) {
|
||||
memcpy(stream->buffer_ptr, write_ptr, num_bytes);
|
||||
|
||||
write_ptr += num_bytes;
|
||||
bytes_written += num_bytes;
|
||||
bytes_to_go -= num_bytes;
|
||||
|
||||
stream->buffer_ptr += num_bytes;
|
||||
stream->buffer_length -= num_bytes;
|
||||
}
|
||||
if (!stream->buffer_length || newline != NULL ||
|
||||
(stream->file_mode.buffer_mode == _IONBF)) {
|
||||
ioresult = __flush_buffer(stream, NULL);
|
||||
|
||||
if (ioresult) {
|
||||
set_error(stream);
|
||||
bytes_to_go = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (bytes_to_go && always_buffer);
|
||||
}
|
||||
|
||||
if (bytes_to_go && !always_buffer) {
|
||||
unsigned char* save_buffer = stream->buffer;
|
||||
size_t save_size = stream->buffer_size;
|
||||
|
||||
stream->buffer = write_ptr;
|
||||
stream->buffer_size = bytes_to_go;
|
||||
stream->buffer_ptr = write_ptr + bytes_to_go;
|
||||
|
||||
if (__flush_buffer(stream, &num_bytes) != __no_io_error)
|
||||
set_error(stream);
|
||||
|
||||
bytes_written += num_bytes;
|
||||
|
||||
stream->buffer = save_buffer;
|
||||
stream->buffer_size = save_size;
|
||||
|
||||
__prep_buffer(stream);
|
||||
|
||||
stream->buffer_length = 0;
|
||||
}
|
||||
|
||||
if (stream->file_mode.buffer_mode != _IOFBF)
|
||||
stream->buffer_length = 0;
|
||||
|
||||
return ((bytes_written + size - 1) / size);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/errno
|
||||
//
|
||||
|
||||
#include "errno.h"
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804519A8-804519B0 000EA8 0004+04 0/0 6/6 0/0 .sbss errno */
|
||||
int errno;
|
||||
|
||||
@@ -1,35 +1,12 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/extras
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/extras.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void strnicmp();
|
||||
void stricmp();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __msl_strnicmp();
|
||||
extern u8 __lower_map[256];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
#include "MSL_C/MSL_Common/Src/file_io.h"
|
||||
|
||||
/* 8036CA74-8036CA94 3673B4 0020+00 0/0 1/1 0/0 .text strnicmp */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void strnicmp() {
|
||||
asm int strnicmp(const char* str1, const char* str2, int n) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/extras/strnicmp.s"
|
||||
}
|
||||
@@ -39,7 +16,7 @@ asm void strnicmp() {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void stricmp() {
|
||||
asm int stricmp(const char* str1, const char* str2) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/extras/stricmp.s"
|
||||
}
|
||||
|
||||
@@ -1,60 +1,83 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/file_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/file_io.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __msl_strnicmp();
|
||||
void fflush();
|
||||
void fclose();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void free();
|
||||
void __flush_all();
|
||||
void __flush_buffer();
|
||||
void ftell();
|
||||
extern u8 __lower_map[256];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
#include "MSL_C/MSL_Common/Src/FILE_POS.h"
|
||||
#include "MSL_C/MSL_Common/Src/alloc.h"
|
||||
#include "MSL_C/MSL_Common/Src/buffer_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
|
||||
/* 8036581C-803658C0 36015C 00A4+00 0/0 1/1 0/0 .text __msl_strnicmp */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __msl_strnicmp() {
|
||||
asm int __msl_strnicmp(const char* str1, const char* str2, size_t n) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/file_io/__msl_strnicmp.s"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 803658C0-803659F8 360200 0138+00 0/0 4/4 0/0 .text fflush */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void fflush() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/file_io/fflush.s"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 803659F8-80365BB4 360338 01BC+00 0/0 1/1 0/0 .text fclose */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void fclose() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/file_io/fclose.s"
|
||||
int fclose(FILE* file) {
|
||||
int flush_result, close_result;
|
||||
|
||||
if (file == NULL)
|
||||
return (-1);
|
||||
if (file->file_mode.file_kind == __closed_file)
|
||||
return (0);
|
||||
|
||||
flush_result = fflush(file);
|
||||
|
||||
close_result = (*file->close_fn)(file->handle);
|
||||
|
||||
file->file_mode.file_kind = __closed_file;
|
||||
file->handle = NULL;
|
||||
|
||||
if (file->file_state.free_buffer)
|
||||
free((FILE*)file->buffer);
|
||||
return ((flush_result || close_result) ? -1 : 0);
|
||||
}
|
||||
|
||||
/* 803658C0-803659F8 360200 0138+00 0/0 4/4 0/0 .text fflush */
|
||||
int fflush(FILE* file) {
|
||||
int pos;
|
||||
|
||||
if (file == NULL) {
|
||||
return __flush_all();
|
||||
}
|
||||
|
||||
if (file->file_state.error != 0 || file->file_mode.file_kind == __closed_file) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->file_mode.io_mode == 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file->file_state.io_state >= 3) {
|
||||
file->file_state.io_state = 2;
|
||||
}
|
||||
|
||||
if (file->file_state.io_state == 2) {
|
||||
file->buffer_length = 0;
|
||||
}
|
||||
|
||||
if (file->file_state.io_state != 1) {
|
||||
file->file_state.io_state = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file->file_mode.file_kind != __disk_file) {
|
||||
pos = 0;
|
||||
} else {
|
||||
pos = ftell(file);
|
||||
}
|
||||
|
||||
if (__flush_buffer(file, 0) != 0) {
|
||||
file->file_state.error = 1;
|
||||
file->buffer_length = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
file->file_state.io_state = 0;
|
||||
file->position = pos;
|
||||
file->buffer_length = 0;
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -1,43 +1,17 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/float
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/float.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern u32 __float_nan;
|
||||
extern u32 __float_huge;
|
||||
extern u32 __float_max;
|
||||
extern u32 __float_epsilon;
|
||||
extern f32 data_80450AF0;
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80450AE0-80450AE4 000560 0004+00 0/0 204/204 1060/1060 .sdata __float_nan */
|
||||
SECTION_SDATA extern u32 __float_nan = 0x7FFFFFFF;
|
||||
extern unsigned long __float_nan = 0x7FFFFFFF;
|
||||
|
||||
/* 80450AE4-80450AE8 000564 0004+00 0/0 1/1 0/0 .sdata __float_huge */
|
||||
SECTION_SDATA extern u32 __float_huge = 0x7F800000;
|
||||
extern unsigned long __float_huge = 0x7F800000;
|
||||
|
||||
/* 80450AE8-80450AEC 000568 0004+00 0/0 18/18 14/14 .sdata __float_max */
|
||||
SECTION_SDATA extern u32 __float_max = 0x7F7FFFFF;
|
||||
extern unsigned long __float_max = 0x7F7FFFFF;
|
||||
|
||||
/* 80450AEC-80450AF0 00056C 0004+00 0/0 28/28 0/0 .sdata __float_epsilon */
|
||||
SECTION_SDATA extern u32 __float_epsilon = 0x34000000;
|
||||
extern unsigned long __float_epsilon = 0x34000000;
|
||||
|
||||
/* 80450AF0-80450AF4 000570 0004+00 0/0 1/1 0/0 .sdata None */
|
||||
SECTION_SDATA extern f32 data_80450AF0;
|
||||
SECTION_SDATA f32 data_80450AF0 = -0.0f;
|
||||
extern float data_80450AF0;
|
||||
float data_80450AF0 = -0.0f;
|
||||
|
||||
@@ -1,41 +1,16 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/mbstring
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/mbstring.h"
|
||||
#include "MSL_C/MSL_Common/Src/string.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void wcstombs();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void strncpy();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80456668-80456670 004C68 0004+04 1/1 0/0 0/0 .sdata2 @74 */
|
||||
SECTION_SDATA2 static u32 lit_74[1 + 1 /* padding */] = {
|
||||
0x0000C0E0,
|
||||
/* padding */
|
||||
0x00000000,
|
||||
};
|
||||
SECTION_SDATA2 static unsigned long lit_74 = 0x0000C0E0;
|
||||
|
||||
/* 80365F74-8036608C 3608B4 0118+00 0/0 1/1 0/0 .text wcstombs */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void wcstombs() {
|
||||
asm size_t wcstombs(char* dst, const wchar_t* src, size_t n) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/mbstring/wcstombs.s"
|
||||
}
|
||||
|
||||
@@ -1,101 +1,25 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/mem
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/mem.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
unsigned char* __memrchr(unsigned char*, unsigned char, size_t);
|
||||
void* memchr(unsigned char*, int, size_t);
|
||||
void* memmove(void* dst, const void* src, size_t len);
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __copy_longs_rev_unaligned(void* dst, const void* src, size_t len);
|
||||
void __copy_longs_unaligned(void* dst, const void* src, size_t len);
|
||||
void __copy_longs_rev_aligned(void* dst, const void* src, size_t len);
|
||||
void __copy_longs_aligned(void* dst, const void* src, size_t len);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8036608C-803660D8 3609CC 004C+00 0/0 19/19 5/5 .text memcmp */
|
||||
int memcmp(const void* __s1, const void* __s2, size_t __n) {
|
||||
const unsigned char* val1 = ((const unsigned char*)__s1 - 1);
|
||||
const unsigned char* val2 = ((const unsigned char*)__s2 - 1);
|
||||
|
||||
size_t size = __n + 1;
|
||||
while (--size > 0) {
|
||||
if (*++val1 != *++val2) {
|
||||
return val1[0] < val2[0] ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 803660D8-80366104 360A18 002C+00 0/0 1/1 0/0 .text __memrchr */
|
||||
unsigned char* __memrchr(unsigned char* s, unsigned char c, size_t n) {
|
||||
int n_count;
|
||||
size_t char_check;
|
||||
|
||||
char_check = (unsigned char)c;
|
||||
s = &s[n];
|
||||
n_count = n + 1;
|
||||
while (--n_count) {
|
||||
if (*--s == char_check) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 80366104-80366130 360A44 002C+00 0/0 1/1 0/0 .text memchr */
|
||||
void* memchr(unsigned char* s, int c, size_t n) {
|
||||
int n_count;
|
||||
size_t char_check;
|
||||
|
||||
char_check = (unsigned char)c;
|
||||
s = &s[-1];
|
||||
n_count = n + 1;
|
||||
while (--n_count) {
|
||||
if (*++s == char_check) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#include "MSL_C/MSL_Common/Src/mem_funcs.h"
|
||||
|
||||
/* 80366130-803661FC 360A70 00CC+00 0/0 2/2 0/0 .text memmove */
|
||||
void* memmove(void* dst, const void* src, size_t len) {
|
||||
void* memmove(void* dst, const void* src, size_t n) {
|
||||
unsigned char* csrc;
|
||||
unsigned char* cdst;
|
||||
|
||||
int reverse = (unsigned int)src < (unsigned int)dst;
|
||||
|
||||
if (len >= 32) {
|
||||
if (n >= 32) {
|
||||
if (((unsigned int)dst ^ (unsigned int)src) & 3) {
|
||||
if (!reverse) {
|
||||
__copy_longs_unaligned(dst, src, len);
|
||||
__copy_longs_unaligned(dst, src, n);
|
||||
} else {
|
||||
__copy_longs_rev_unaligned(dst, src, len);
|
||||
__copy_longs_rev_unaligned(dst, src, n);
|
||||
}
|
||||
} else {
|
||||
if (!reverse) {
|
||||
__copy_longs_aligned(dst, src, len);
|
||||
__copy_longs_aligned(dst, src, n);
|
||||
} else {
|
||||
__copy_longs_rev_aligned(dst, src, len);
|
||||
__copy_longs_rev_aligned(dst, src, n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,17 +28,17 @@ void* memmove(void* dst, const void* src, size_t len) {
|
||||
if (!reverse) {
|
||||
csrc = ((unsigned char*)src) - 1;
|
||||
cdst = ((unsigned char*)dst) - 1;
|
||||
len++;
|
||||
n++;
|
||||
|
||||
while (--len > 0) {
|
||||
while (--n > 0) {
|
||||
*++cdst = *++csrc;
|
||||
}
|
||||
} else {
|
||||
csrc = (unsigned char*)src + len;
|
||||
cdst = (unsigned char*)dst + len;
|
||||
len++;
|
||||
csrc = (unsigned char*)src + n;
|
||||
cdst = (unsigned char*)dst + n;
|
||||
n++;
|
||||
|
||||
while (--len > 0) {
|
||||
while (--n > 0) {
|
||||
*--cdst = *--csrc;
|
||||
}
|
||||
}
|
||||
@@ -122,3 +46,41 @@ void* memmove(void* dst, const void* src, size_t len) {
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 80366104-80366130 360A44 002C+00 0/0 1/1 0/0 .text memchr */
|
||||
void* memchr(const void* ptr, int ch, size_t count) {
|
||||
const unsigned char* p;
|
||||
|
||||
unsigned long v = (ch & 0xff);
|
||||
|
||||
for (p = (unsigned char*)ptr - 1, count++; --count;)
|
||||
if ((*++p & 0xff) == v)
|
||||
return (void*)p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 803660D8-80366104 360A18 002C+00 0/0 1/1 0/0 .text __memrchr */
|
||||
void* __memrchr(const void* ptr, int ch, size_t count) {
|
||||
const unsigned char* p;
|
||||
|
||||
unsigned long v = (ch & 0xff);
|
||||
|
||||
for (p = (unsigned char*)ptr + count, count++; --count;)
|
||||
if (*--p == v)
|
||||
return (void*)p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 8036608C-803660D8 3609CC 004C+00 0/0 19/19 5/5 .text memcmp */
|
||||
int memcmp(const void* lhs, const void* rhs, size_t count) {
|
||||
const unsigned char* p1;
|
||||
const unsigned char* p2;
|
||||
|
||||
for (p1 = (const unsigned char*)lhs - 1, p2 = (const unsigned char*)rhs - 1, count++; --count;)
|
||||
if (*++p1 != *++p2)
|
||||
return ((*p1 < *p2) ? -1 : +1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,65 +1,221 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/mem_funcs
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/mem_funcs.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __copy_longs_rev_unaligned();
|
||||
void __copy_longs_unaligned();
|
||||
void __copy_longs_rev_aligned();
|
||||
void __copy_longs_aligned();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 803661FC-803662A8 360B3C 00AC+00 0/0 1/1 0/0 .text __copy_longs_rev_unaligned */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __copy_longs_rev_unaligned() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/mem_funcs/__copy_longs_rev_unaligned.s"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 803662A8-80366368 360BE8 00C0+00 0/0 1/1 0/0 .text __copy_longs_unaligned */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __copy_longs_unaligned() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/mem_funcs/__copy_longs_unaligned.s"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 80366368-80366410 360CA8 00A8+00 0/0 1/1 0/0 .text __copy_longs_rev_aligned */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __copy_longs_rev_aligned() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/mem_funcs/__copy_longs_rev_aligned.s"
|
||||
}
|
||||
#pragma pop
|
||||
#define cps ((unsigned char*)src)
|
||||
#define cpd ((unsigned char*)dst)
|
||||
#define lps ((unsigned long*)src)
|
||||
#define lpd ((unsigned long*)dst)
|
||||
#define deref_auto_inc(p) *++(p)
|
||||
|
||||
/* 80366410-803664CC 360D50 00BC+00 0/0 1/1 0/0 .text __copy_longs_aligned */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __copy_longs_aligned() {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/mem_funcs/__copy_longs_aligned.s"
|
||||
void __copy_longs_aligned(void* dst, const void* src, size_t n) {
|
||||
unsigned long i;
|
||||
|
||||
i = (-(unsigned long)dst) & 3;
|
||||
|
||||
cps = ((unsigned char*)src) - 1;
|
||||
cpd = ((unsigned char*)dst) - 1;
|
||||
|
||||
if (i) {
|
||||
n -= i;
|
||||
|
||||
do
|
||||
deref_auto_inc(cpd) = deref_auto_inc(cps);
|
||||
while (--i);
|
||||
}
|
||||
|
||||
lps = ((unsigned long*)(cps + 1)) - 1;
|
||||
lpd = ((unsigned long*)(cpd + 1)) - 1;
|
||||
|
||||
i = n >> 5;
|
||||
|
||||
if (i)
|
||||
do {
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
} while (--i);
|
||||
|
||||
i = (n & 31) >> 2;
|
||||
|
||||
if (i)
|
||||
do
|
||||
deref_auto_inc(lpd) = deref_auto_inc(lps);
|
||||
while (--i);
|
||||
|
||||
cps = ((unsigned char*)(lps + 1)) - 1;
|
||||
cpd = ((unsigned char*)(lpd + 1)) - 1;
|
||||
|
||||
n &= 3;
|
||||
|
||||
if (n)
|
||||
do
|
||||
deref_auto_inc(cpd) = deref_auto_inc(cps);
|
||||
while (--n);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 80366368-80366410 360CA8 00A8+00 0/0 1/1 0/0 .text __copy_longs_rev_aligned */
|
||||
void __copy_longs_rev_aligned(void* dst, const void* src, size_t n) {
|
||||
unsigned long i;
|
||||
|
||||
cps = ((unsigned char*)src) + n;
|
||||
cpd = ((unsigned char*)dst) + n;
|
||||
|
||||
i = ((unsigned long)cpd) & 3;
|
||||
|
||||
if (i) {
|
||||
n -= i;
|
||||
|
||||
do
|
||||
*--cpd = *--cps;
|
||||
while (--i);
|
||||
}
|
||||
|
||||
i = n >> 5;
|
||||
|
||||
if (i)
|
||||
do {
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
*--lpd = *--lps;
|
||||
} while (--i);
|
||||
|
||||
i = (n & 31) >> 2;
|
||||
|
||||
if (i)
|
||||
do
|
||||
*--lpd = *--lps;
|
||||
while (--i);
|
||||
|
||||
n &= 3;
|
||||
|
||||
if (n)
|
||||
do
|
||||
*--cpd = *--cps;
|
||||
while (--n);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 803662A8-80366368 360BE8 00C0+00 0/0 1/1 0/0 .text __copy_longs_unaligned */
|
||||
void __copy_longs_unaligned(void* dst, const void* src, size_t n) {
|
||||
unsigned long i, v1, v2;
|
||||
unsigned int src_offset, left_shift, right_shift;
|
||||
|
||||
i = (-(unsigned long)dst) & 3;
|
||||
|
||||
cps = ((unsigned char*)src) - 1;
|
||||
cpd = ((unsigned char*)dst) - 1;
|
||||
|
||||
if (i) {
|
||||
n -= i;
|
||||
|
||||
do
|
||||
deref_auto_inc(cpd) = deref_auto_inc(cps);
|
||||
while (--i);
|
||||
}
|
||||
|
||||
src_offset = ((unsigned int)(cps + 1)) & 3;
|
||||
|
||||
left_shift = src_offset << 3;
|
||||
right_shift = 32 - left_shift;
|
||||
|
||||
cps -= src_offset;
|
||||
|
||||
lps = ((unsigned long*)(cps + 1)) - 1;
|
||||
lpd = ((unsigned long*)(cpd + 1)) - 1;
|
||||
|
||||
i = n >> 3;
|
||||
|
||||
v1 = deref_auto_inc(lps);
|
||||
|
||||
do {
|
||||
v2 = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = (v1 << left_shift) | (v2 >> right_shift);
|
||||
v1 = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = (v2 << left_shift) | (v1 >> right_shift);
|
||||
} while (--i);
|
||||
|
||||
if (n & 4) {
|
||||
v2 = deref_auto_inc(lps);
|
||||
deref_auto_inc(lpd) = (v1 << left_shift) | (v2 >> right_shift);
|
||||
}
|
||||
|
||||
cps = ((unsigned char*)(lps + 1)) - 1;
|
||||
cpd = ((unsigned char*)(lpd + 1)) - 1;
|
||||
|
||||
n &= 3;
|
||||
|
||||
if (n) {
|
||||
cps -= 4 - src_offset;
|
||||
do
|
||||
deref_auto_inc(cpd) = deref_auto_inc(cps);
|
||||
while (--n);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 803661FC-803662A8 360B3C 00AC+00 0/0 1/1 0/0 .text __copy_longs_rev_unaligned */
|
||||
void __copy_longs_rev_unaligned(void* dst, const void* src, size_t n) {
|
||||
unsigned long i, v1, v2;
|
||||
unsigned int src_offset, left_shift, right_shift;
|
||||
|
||||
cps = ((unsigned char*)src) + n;
|
||||
cpd = ((unsigned char*)dst) + n;
|
||||
|
||||
i = ((unsigned long)cpd) & 3;
|
||||
|
||||
if (i) {
|
||||
n -= i;
|
||||
|
||||
do
|
||||
*--cpd = *--cps;
|
||||
while (--i);
|
||||
}
|
||||
|
||||
src_offset = ((unsigned int)cps) & 3;
|
||||
|
||||
left_shift = src_offset << 3;
|
||||
right_shift = 32 - left_shift;
|
||||
|
||||
cps += 4 - src_offset;
|
||||
|
||||
i = n >> 3;
|
||||
|
||||
v1 = *--lps;
|
||||
|
||||
do {
|
||||
v2 = *--lps;
|
||||
*--lpd = (v2 << left_shift) | (v1 >> right_shift);
|
||||
v1 = *--lps;
|
||||
*--lpd = (v1 << left_shift) | (v2 >> right_shift);
|
||||
} while (--i);
|
||||
|
||||
if (n & 4) {
|
||||
v2 = *--lps;
|
||||
*--lpd = (v2 << left_shift) | (v1 >> right_shift);
|
||||
}
|
||||
|
||||
n &= 3;
|
||||
|
||||
if (n) {
|
||||
cps += src_offset;
|
||||
do
|
||||
*--cpd = *--cps;
|
||||
while (--n);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
@@ -1,30 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/misc_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/misc_io.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __stdio_atexit();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __close_all(void);
|
||||
extern void (*__stdio_exit)(void);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
#include "MSL_C/MSL_Common/Src/abort_exit.h"
|
||||
#include "MSL_C/MSL_Common/Src/ansi_files.h"
|
||||
|
||||
/* 803664CC-803664DC 360E0C 0010+00 0/0 2/2 0/0 .text __stdio_atexit */
|
||||
void __stdio_atexit() {
|
||||
void __stdio_atexit(void) {
|
||||
__stdio_exit = __close_all;
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/printf.h"
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
#include "MSL_C/MSL_Common/Src/mem.h"
|
||||
#include "MSL_C/MSL_Common/Src/string.h"
|
||||
#include "MSL_C/MSL_Common/Src/wchar_io.h"
|
||||
#include "Runtime.PPCEABI.H/__va_arg.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void fprintf();
|
||||
void __StringWrite();
|
||||
void __FileWrite();
|
||||
void __pformatter();
|
||||
@@ -28,7 +30,6 @@ extern char const* const MSL_Common_Src_printf__stringBase0;
|
||||
// External References:
|
||||
//
|
||||
|
||||
SECTION_INIT void memcpy();
|
||||
void __div2u();
|
||||
void __mod2u();
|
||||
void __num2dec();
|
||||
@@ -36,13 +37,6 @@ void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
void fwrite();
|
||||
void wcstombs();
|
||||
void memchr();
|
||||
void strchr();
|
||||
void strcpy();
|
||||
void strlen();
|
||||
void fwide();
|
||||
extern void* __files[80];
|
||||
extern u8 __ctype_map[256];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
@@ -52,7 +46,7 @@ extern u8 __ctype_map[256];
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm size_t sprintf(const char*, const char*, ...) {
|
||||
asm int sprintf(const char* str, const char* format, ...) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/sprintf.s"
|
||||
}
|
||||
@@ -62,7 +56,7 @@ asm size_t sprintf(const char*, const char*, ...) {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm size_t snprintf(const char*, size_t, const char*, ...) {
|
||||
asm int snprintf(const char* str, size_t n, const char* format, ...) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/snprintf.s"
|
||||
}
|
||||
@@ -72,7 +66,7 @@ asm size_t snprintf(const char*, size_t, const char*, ...) {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm size_t vsnprintf(char* buffer, size_t buffer_size, const char* format, va_list args) {
|
||||
asm int vsnprintf(char* str, size_t n, const char* format, va_list arg) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/vsnprintf.s"
|
||||
}
|
||||
@@ -82,7 +76,7 @@ asm size_t vsnprintf(char* buffer, size_t buffer_size, const char* format, va_li
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm size_t vprintf(const char*, va_list) {
|
||||
asm int vprintf(const char* format, va_list arg) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/vprintf.s"
|
||||
}
|
||||
@@ -92,7 +86,7 @@ asm size_t vprintf(const char*, va_list) {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void fprintf() {
|
||||
asm int fprintf(FILE* stream, const char* format, ...) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/fprintf.s"
|
||||
}
|
||||
@@ -102,7 +96,7 @@ asm void fprintf() {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm size_t printf(const char*, ...) {
|
||||
asm int printf(const char* format, ...) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/printf/printf.s"
|
||||
}
|
||||
@@ -136,7 +130,7 @@ SECTION_DEAD static char const* const stringBase_803A2318 = "";
|
||||
#pragma pop
|
||||
|
||||
/* 80450AD8-80450AE0 000558 0002+06 1/1 0/0 0/0 .sdata @wstringBase0 */
|
||||
SECTION_SDATA static u8 data_80450AD8[2 + 6 /* padding */] = {
|
||||
SECTION_SDATA static unsigned char data_80450AD8[2 + 6 /* padding */] = {
|
||||
0x00,
|
||||
0x00,
|
||||
/* padding */
|
||||
@@ -176,7 +170,7 @@ SECTION_DEAD static char const* const pad_803A233D = "\0\0";
|
||||
#pragma pop
|
||||
|
||||
/* 80456670-80456678 004C70 0008+00 1/1 0/0 0/0 .sdata2 @1089 */
|
||||
SECTION_SDATA2 static u8 lit_1089[8] = {
|
||||
SECTION_SDATA2 static unsigned char lit_1089[8] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,31 +1,10 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/scanf
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/scanf.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __StringRead();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8036878C-8036881C 3630CC 0090+00 0/0 2/2 0/0 .text __StringRead */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __StringRead() {
|
||||
asm int __StringRead(char* str, int ch, int behavior) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/scanf/__StringRead.s"
|
||||
}
|
||||
|
||||
@@ -1,39 +1,18 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/signal
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/signal.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/MSL_Common/Src/abort_exit.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void raise();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void exit();
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8044D878-8044D890 07A598 0018+00 1/1 0/0 0/0 .bss signal_funcs */
|
||||
static u8 signal_funcs[24];
|
||||
static unsigned char signal_funcs[24];
|
||||
|
||||
/* 8036881C-803688DC 36315C 00C0+00 0/0 1/1 0/0 .text raise */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void raise() {
|
||||
asm int raise(int sig) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/signal/raise.s"
|
||||
}
|
||||
|
||||
+131
-142
@@ -1,77 +1,123 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/string
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/string.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#define K1 0x80808080
|
||||
#define K2 0xFEFEFEFF
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
/* 80368BE4-80368C00 363524 001C+00 0/0 28/28 8/8 .text strlen */
|
||||
size_t strlen(const char* str) {
|
||||
size_t len = -1;
|
||||
unsigned char* p = (unsigned char*)str - 1;
|
||||
|
||||
/* 803688DC-80368924 36321C 0048+00 0/0 1/1 0/0 .text strrchr */
|
||||
char* strrchr(const char* str, int chr) {
|
||||
const u8* p = (u8*)str - 1;
|
||||
const u8* q = NULL;
|
||||
u32 c = (chr & 0xFF);
|
||||
do {
|
||||
len++;
|
||||
} while (*++p);
|
||||
|
||||
u32 ch;
|
||||
while (ch = *++p) {
|
||||
if (ch == c) {
|
||||
q = p;
|
||||
}
|
||||
}
|
||||
|
||||
if (q != NULL) {
|
||||
return (char*)q;
|
||||
}
|
||||
|
||||
return c ? NULL : (char*)p;
|
||||
return len;
|
||||
}
|
||||
|
||||
/* 80368924-80368954 363264 0030+00 0/0 3/3 0/0 .text strchr */
|
||||
char* strchr(const char* str, int chr) {
|
||||
const u8* p = (u8*)str - 1;
|
||||
u32 c = (chr & 0xFF);
|
||||
/* 80368B2C-80368BE4 36346C 00B8+00 0/0 131/131 13/13 .text strcpy */
|
||||
char* strcpy(char* dst, const char* src) {
|
||||
register unsigned char *destb, *fromb;
|
||||
register unsigned long w, t, align;
|
||||
|
||||
u32 ch;
|
||||
while (ch = *++p) {
|
||||
if (ch == c) {
|
||||
return (char*)p;
|
||||
}
|
||||
fromb = (unsigned char*)src;
|
||||
destb = (unsigned char*)dst;
|
||||
|
||||
if ((align = ((int)fromb & 3)) != ((int)destb & 3)) {
|
||||
goto bytecopy;
|
||||
}
|
||||
|
||||
return c ? NULL : (char*)p;
|
||||
if (align) {
|
||||
if ((*destb = *fromb) == 0) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
for (align = 3 - align; align; align--) {
|
||||
if ((*(++destb) = *(++fromb)) == 0) {
|
||||
return dst;
|
||||
}
|
||||
}
|
||||
++destb;
|
||||
++fromb;
|
||||
}
|
||||
|
||||
w = *((int*)(fromb));
|
||||
|
||||
t = w + K2;
|
||||
|
||||
t &= K1;
|
||||
if (t) {
|
||||
goto bytecopy;
|
||||
}
|
||||
--((int*)(destb));
|
||||
|
||||
do {
|
||||
*(++((int*)(destb))) = w;
|
||||
w = *(++((int*)(fromb)));
|
||||
|
||||
t = w + K2;
|
||||
t &= K1;
|
||||
if (t) {
|
||||
goto adjust;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
adjust:
|
||||
++((int*)(destb));
|
||||
|
||||
bytecopy:
|
||||
if ((*destb = *fromb) == 0) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
do {
|
||||
if ((*(++destb) = *(++fromb)) == 0) {
|
||||
return dst;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 80368954-80368994 363294 0040+00 0/0 6/6 0/0 .text strncmp */
|
||||
int strncmp(const char* strA, const char* strB, u32 n) {
|
||||
const u8* p1 = (u8*)strA - 1;
|
||||
const u8* p2 = (u8*)strB - 1;
|
||||
u32 c1, c2;
|
||||
/* 80368AE8-80368B2C 363428 0044+00 0/0 9/9 1/1 .text strncpy */
|
||||
char* strncpy(char* dst, const char* src, size_t n) {
|
||||
const unsigned char* p = (const unsigned char*)src - 1;
|
||||
unsigned char* q = (unsigned char*)dst - 1;
|
||||
|
||||
n++;
|
||||
while (--n) {
|
||||
if ((c1 = *++p1) != (c2 = *++p2)) {
|
||||
return c1 - c2;
|
||||
} else if (c1 == 0) {
|
||||
if (!(*++q = *++p)) {
|
||||
while (--n) {
|
||||
*++q = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 80368ABC-80368AE8 3633FC 002C+00 0/0 20/20 8/8 .text strcat */
|
||||
char* strcat(char* dst, const char* src) {
|
||||
const unsigned char* p = (unsigned char*)src - 1;
|
||||
unsigned char* q = (unsigned char*)dst - 1;
|
||||
|
||||
while (*++q) {
|
||||
}
|
||||
|
||||
q--;
|
||||
|
||||
while (*++q = *++p) {
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 80368994-80368ABC 3632D4 0128+00 0/0 155/155 279/279 .text strcmp */
|
||||
int strcmp(const char* strA, const char* strB) {
|
||||
register u8* left = (u8*)strA;
|
||||
register u8* right = (u8*)strB;
|
||||
u32 align, l1, r1, x;
|
||||
int strcmp(const char* str1, const char* str2) {
|
||||
register unsigned char* left = (unsigned char*)str1;
|
||||
register unsigned char* right = (unsigned char*)str2;
|
||||
unsigned long align, l1, r1, x;
|
||||
|
||||
l1 = *left;
|
||||
r1 = *right;
|
||||
@@ -146,112 +192,55 @@ bytecopy:
|
||||
} while (1);
|
||||
}
|
||||
|
||||
/* 80368ABC-80368AE8 3633FC 002C+00 0/0 20/20 8/8 .text strcat */
|
||||
char* strcat(char* dst, const char* src) {
|
||||
const u8* p = (u8*)src - 1;
|
||||
u8* q = (u8*)dst - 1;
|
||||
|
||||
while (*++q) {
|
||||
}
|
||||
|
||||
q--;
|
||||
|
||||
while (*++q = *++p) {
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/* 80368AE8-80368B2C 363428 0044+00 0/0 9/9 1/1 .text strncpy */
|
||||
char* strncpy(char* dst, const char* src, size_t n) {
|
||||
const u8* p = (const u8*)src - 1;
|
||||
u8* q = (u8*)dst - 1;
|
||||
/* 80368954-80368994 363294 0040+00 0/0 6/6 0/0 .text strncmp */
|
||||
int strncmp(const char* str1, const char* str2, size_t n) {
|
||||
const unsigned char* p1 = (unsigned char*)str1 - 1;
|
||||
const unsigned char* p2 = (unsigned char*)str2 - 1;
|
||||
unsigned long c1, c2;
|
||||
|
||||
n++;
|
||||
while (--n) {
|
||||
if (!(*++q = *++p)) {
|
||||
while (--n) {
|
||||
*++q = 0;
|
||||
}
|
||||
if ((c1 = *++p1) != (c2 = *++p2)) {
|
||||
return c1 - c2;
|
||||
} else if (c1 == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 80368B2C-80368BE4 36346C 00B8+00 0/0 131/131 13/13 .text strcpy */
|
||||
char* strcpy(char* dst, const char* src) {
|
||||
register u8 *destb, *fromb;
|
||||
register u32 w, t, align;
|
||||
/* 80368924-80368954 363264 0030+00 0/0 3/3 0/0 .text strchr */
|
||||
char* strchr(const char* str, int c) {
|
||||
const unsigned char* p = (unsigned char*)str - 1;
|
||||
unsigned long chr = (c & 0xFF);
|
||||
|
||||
fromb = (u8*)src;
|
||||
destb = (u8*)dst;
|
||||
|
||||
if ((align = ((int)fromb & 3)) != ((int)destb & 3)) {
|
||||
goto bytecopy;
|
||||
unsigned long ch;
|
||||
while (ch = *++p) {
|
||||
if (ch == chr) {
|
||||
return (char*)p;
|
||||
}
|
||||
}
|
||||
|
||||
if (align) {
|
||||
if ((*destb = *fromb) == 0) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
for (align = 3 - align; align; align--) {
|
||||
if ((*(++destb) = *(++fromb)) == 0) {
|
||||
return dst;
|
||||
}
|
||||
}
|
||||
++destb;
|
||||
++fromb;
|
||||
}
|
||||
|
||||
w = *((int*)(fromb));
|
||||
|
||||
t = w + K2;
|
||||
|
||||
t &= K1;
|
||||
if (t) {
|
||||
goto bytecopy;
|
||||
}
|
||||
--((int*)(destb));
|
||||
|
||||
do {
|
||||
*(++((int*)(destb))) = w;
|
||||
w = *(++((int*)(fromb)));
|
||||
|
||||
t = w + K2;
|
||||
t &= K1;
|
||||
if (t) {
|
||||
goto adjust;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
adjust:
|
||||
++((int*)(destb));
|
||||
|
||||
bytecopy:
|
||||
if ((*destb = *fromb) == 0) {
|
||||
return dst;
|
||||
}
|
||||
|
||||
do {
|
||||
if ((*(++destb) = *(++fromb)) == 0) {
|
||||
return dst;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return dst;
|
||||
return chr ? NULL : (char*)p;
|
||||
}
|
||||
|
||||
/* 80368BE4-80368C00 363524 001C+00 0/0 28/28 8/8 .text strlen */
|
||||
u32 strlen(const char* str) {
|
||||
size_t len = -1;
|
||||
u8* p = (u8*)str - 1;
|
||||
/* 803688DC-80368924 36321C 0048+00 0/0 1/1 0/0 .text strrchr */
|
||||
char* strrchr(const char* str, int c) {
|
||||
const unsigned char* p = (unsigned char*)str - 1;
|
||||
const unsigned char* q = NULL;
|
||||
unsigned long chr = (c & 0xFF);
|
||||
|
||||
do {
|
||||
len++;
|
||||
} while (*++p);
|
||||
unsigned long ch;
|
||||
while (ch = *++p) {
|
||||
if (ch == chr) {
|
||||
q = p;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
if (q != NULL) {
|
||||
return (char*)q;
|
||||
}
|
||||
|
||||
return chr ? NULL : (char*)p;
|
||||
}
|
||||
|
||||
@@ -4,35 +4,16 @@
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/strtoul.h"
|
||||
#include "MSL_C/MSL_Common/Src/ctype.h"
|
||||
#include "MSL_C/MSL_Common/Src/scanf.h"
|
||||
#include "errno.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void strtol();
|
||||
void strtoul();
|
||||
void __strtoul();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
void __StringRead();
|
||||
extern u8 __ctype_map[256];
|
||||
extern u8 __upper_map[256];
|
||||
extern u8 errno[4 + 4 /* padding */];
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 80368C00-80368CF0 363540 00F0+00 0/0 3/3 0/0 .text strtol */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void strtol() {
|
||||
asm long strtol(const char* str, char** endptr, int base) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/strtoul/strtol.s"
|
||||
}
|
||||
@@ -42,7 +23,7 @@ asm void strtol() {
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void strtoul() {
|
||||
asm unsigned long strtoul(const char* str, char** endptr, int base) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/strtoul/strtoul.s"
|
||||
}
|
||||
@@ -69,14 +50,14 @@ SECTION_DATA static void* lit_431[17 + 1 /* padding */] = {
|
||||
(void*)(((char*)__strtoul) + 0x310),
|
||||
(void*)(((char*)__strtoul) + 0x1FC),
|
||||
/* padding */
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
|
||||
/* 80368D9C-80369114 3636DC 0378+00 3/2 0/0 0/0 .text __strtoul */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void __strtoul() {
|
||||
asm unsigned long __strtoul(const char* str, char** endptr, int base) {
|
||||
nofralloc
|
||||
#include "asm/MSL_C/MSL_Common/Src/strtoul/__strtoul.s"
|
||||
}
|
||||
|
||||
@@ -1,30 +1,8 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: MSL_Common/Src/wchar_io
|
||||
//
|
||||
|
||||
#include "MSL_C/MSL_Common/Src/wchar_io.h"
|
||||
#include "MSL_C/MSL_Common/Src/ansi_files.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
int fwide(FILE* file, int mode);
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 80369114-8036919C 363A54 0088+00 0/0 5/5 0/0 .text fwide */
|
||||
int fwide(FILE* file, int mode) {
|
||||
if (file == NULL || file->file_mode.file_kind == CLOSED_FILE) {
|
||||
if (file == NULL || file->file_mode.file_kind == __closed_file) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ LIBMSL_C_PPCEABI_BARE_H_A_CFLAGS := \
|
||||
-lang=c \
|
||||
-fp_contract on \
|
||||
-use_lmw_stmw on \
|
||||
-inline deferred,auto \
|
||||
|
||||
LIBMSL_C_PPCEABI_BARE_H_A_LDFLAGS := \
|
||||
-nodefaults \
|
||||
|
||||
@@ -22,7 +22,7 @@ static const double
|
||||
|
||||
double ldexp(double x, int n)
|
||||
{
|
||||
s32 k, hx, lx; /*- cc 020130 -*/
|
||||
long k, hx, lx; /*- cc 020130 -*/
|
||||
if (!isfinite(x) || x == 0.0)
|
||||
return x;
|
||||
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: PPC_EABI/Src/critical_regions.gamecube
|
||||
//
|
||||
|
||||
#include "MSL_C/PPC_EABI/Src/critical_regions.gamecube.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
void __end_critical_region();
|
||||
void __begin_critical_region();
|
||||
void __kill_critical_regions();
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 80365464-80365468 35FDA4 0004+00 0/0 12/12 0/0 .text __end_critical_region */
|
||||
void __end_critical_region() {
|
||||
/* 8036546C-80365470 35FDAC 0004+00 0/0 2/2 0/0 .text __kill_critical_regions */
|
||||
void __kill_critical_regions() {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
@@ -33,7 +14,7 @@ void __begin_critical_region() {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
/* 8036546C-80365470 35FDAC 0004+00 0/0 2/2 0/0 .text __kill_critical_regions */
|
||||
void __kill_critical_regions() {
|
||||
/* 80365464-80365468 35FDA4 0004+00 0/0 12/12 0/0 .text __end_critical_region */
|
||||
void __end_critical_region() {
|
||||
/* empty function */
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@
|
||||
//
|
||||
|
||||
#include "MSL_C/PPC_EABI/Src/math_ppc.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "fdlibm.h"
|
||||
|
||||
//
|
||||
@@ -21,14 +19,9 @@ float acosf(float);
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8036C9C4-8036C9E8 367304 0024+00 0/0 2/2 0/0 .text tanf */
|
||||
float tanf(float x) {
|
||||
return tan(x);
|
||||
}
|
||||
|
||||
/* 8036C9E8-8036CA0C 367328 0024+00 0/0 4/4 0/0 .text sinf */
|
||||
float sinf(float x) {
|
||||
return sin(x);
|
||||
/* 8036CA30-8036CA54 367370 0024+00 0/0 1/1 0/0 .text acosf */
|
||||
float acosf(float x) {
|
||||
return acos(x);
|
||||
}
|
||||
|
||||
/* 8036CA0C-8036CA30 36734C 0024+00 0/0 4/4 0/0 .text cosf */
|
||||
@@ -36,7 +29,12 @@ float cosf(float x) {
|
||||
return cos(x);
|
||||
}
|
||||
|
||||
/* 8036CA30-8036CA54 367370 0024+00 0/0 1/1 0/0 .text acosf */
|
||||
float acosf(float x) {
|
||||
return acos(x);
|
||||
/* 8036C9E8-8036CA0C 367328 0024+00 0/0 4/4 0/0 .text sinf */
|
||||
float sinf(float x) {
|
||||
return sin(x);
|
||||
}
|
||||
|
||||
/* 8036C9C4-8036C9E8 367304 0024+00 0/0 2/2 0/0 .text tanf */
|
||||
float tanf(float x) {
|
||||
return tan(x);
|
||||
}
|
||||
|
||||
@@ -1,39 +1,14 @@
|
||||
//
|
||||
// Generated By: dol2asm
|
||||
// Translation Unit: PPC_EABI/Src/uart_console_io_gcn
|
||||
//
|
||||
|
||||
#include "MSL_C/PPC_EABI/Src/uart_console_io_gcn.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
int __close_console();
|
||||
int __write_console(s32 arg0, s32 arg1, s32* arg2, s32 arg3);
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
s32 OSGetConsoleType(void);
|
||||
s32 InitializeUART(u32);
|
||||
s32 WriteUARTN(s32, s32);
|
||||
s32 __TRK_write_console(s32, s32, s32*, s32);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8036919C-803691A4 363ADC 0008+00 0/0 1/0 0/0 .text __close_console */
|
||||
int __close_console() {
|
||||
return 0;
|
||||
}
|
||||
int InitializeUART(size_t);
|
||||
int WriteUARTN(unsigned char*, size_t);
|
||||
int __TRK_write_console(__file_handle handle, unsigned char* buffer, size_t* count,
|
||||
__idle_proc idle_fn);
|
||||
|
||||
/* 803691A4-80369274 363AE4 00D0+00 0/0 1/0 0/0 .text __write_console */
|
||||
int __write_console(s32 param_0, s32 param_1, s32* param_2, s32 param_3) {
|
||||
int __write_console(__file_handle handle, unsigned char* buffer, size_t* count,
|
||||
__idle_proc idle_fn) {
|
||||
static int initialized;
|
||||
|
||||
if ((OSGetConsoleType() & 0x20000000) == 0) {
|
||||
@@ -50,12 +25,17 @@ int __write_console(s32 param_0, s32 param_1, s32* param_2, s32 param_3) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (WriteUARTN(param_1, *param_2) != 0) {
|
||||
*param_2 = 0;
|
||||
if (WriteUARTN(buffer, *count) != 0) {
|
||||
*count = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
__TRK_write_console(param_0, param_1, param_2, param_3);
|
||||
__TRK_write_console(handle, buffer, count, idle_fn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 8036919C-803691A4 363ADC 0008+00 0/0 1/0 0/0 .text __close_console */
|
||||
int __close_console(__file_handle handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user