3.1415% decompiled

This commit is contained in:
SwareJonge 2023-04-01 21:20:20 +02:00
parent 6fc1ac300b
commit 59de9b8bf7
10 changed files with 119 additions and 2 deletions

View File

@ -331,8 +331,9 @@ CFLAGS = [
]
JSYSTEM_SPEED = CFLAGS + [ "-O4,p" ]
JSYSTEM_RELEASE = CFLAGS + [ "-opt level=4, nopeep, schedule"]
JSYSTEM_RELEASE = CFLAGS + [ "-opt level=4, schedule"]
# confusion
MSL_C = CFLAGS + ["-common off", "-use_lmw_stmw off", "-opt level=0, schedule"]
BASE_GAME_CFLAGS = CFLAGS + [ "-O4,s" ]
KANESHIGE = BASE_GAME_CFLAGS + [ "-inline off" ]
@ -345,6 +346,7 @@ LOCAL_CFLAGS = [
MWCC_INCLUDES
]
DOL_CFLAGS = ' '.join(BASE_GAME_CFLAGS + LOCAL_CFLAGS)
MSL_C_CFLAGS = ' '.join(MSL_C + LOCAL_CFLAGS)
JSYSTEM_SPEED_CFLAGS = ' '.join(JSYSTEM_SPEED + LOCAL_CFLAGS)
JSYSTEM_RELEASE_CFLAGS = ' '.join(JSYSTEM_RELEASE + LOCAL_CFLAGS)
KANESHIGE_CFLAGS = ' '.join(BASE_GAME_CFLAGS + LOCAL_CFLAGS)

View File

@ -237,6 +237,10 @@ dolphin/__ppc_eabi_init.cpp:
.init: [0x80003400, 0x80003458]
.text: [0x800f31b8, 0x800f324c]
PowerPC_EABI_Support/MSL_C/MSL_Common/signal.c:
.text: [0x8010d4f4, 0x8010d5dc]
.bss: [0x803c65f0, 0x803c6608]
Bando/EngineSound.cpp:
.text: [0x80118cac, 0x80118d1c]
.data: [0x80393760, 0x803937b8]

View File

@ -227,6 +227,10 @@ dolphin/__ppc_eabi_init.cpp:
.init: [0x80003400, 0x80003458]
.text: [0x800ec7e8, 0x800ec87c]
PowerPC_EABI_Support/MSL_C/MSL_Common/signal.c:
.text: [0x80106b24, 0x80106c0c]
.bss: [0x80386130, 0x80386148]
Bando/EngineSound.cpp:
.text: [0x8011226c, 0x801122dc]
.data: [0x80353590, 0x803535e8]

View File

@ -1832,6 +1832,8 @@ global:
0x8035058c: GXPal528IntDf
0x803505c8: GXEurgb60Hz480IntDf
0x80386130: signal_funcs
# float.c
0x803d3844: __float_epsilon

View File

@ -564,6 +564,8 @@ class CSource(Source):
if path.startswith("src/dolphin/"):
self.cc = c.SDK_CC # TODO: build flags for SDK
elif path.startswith("src/PowerPC_EABI_Support/MSL_C/"):
self.cflags = c.MSL_C_CFLAGS
elif path.startswith("src/Kaneshige/"):
self.cflags = c.KANESHIGE_CFLAGS
if c.VERSION == "Release":

View File

@ -0,0 +1,15 @@
#ifndef ABORT_EXIT_H
#define ABORT_EXIT_H
#ifdef __cplusplus
extern "C"
{
#endif // ifdef __cplusplus
void exit(int);
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif

View File

@ -0,0 +1,14 @@
#ifndef ANSI_PARAMS_H
#define ANSI_PARAMS_H
#define _MSL_CANT_THROW __attribute__((nothrow))
#define _MSL_THROW throw()
#ifndef _MSL_LOCALDATA
#define _MSL_LOCALDATA(_a) _a
#endif
#define __std(ref) ref
#endif // ANSI_PARAMS_H

View File

@ -0,0 +1,18 @@
#ifndef CRITICAL_REGIONS_GAMECUBE_H
#define CRITICAL_REGIONS_GAMECUBE_H
#ifdef __cplusplus
extern "C"
{
#endif // ifdef __cplusplus
void __init_critical_regions();
void __kill_critical_regions();
void __begin_critical_region(int);
void __end_critical_region(int);
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif // CRITICAL_REGIONS_GAMECUBE_H

View File

@ -0,0 +1,17 @@
#ifndef SIGNAL_H
#define SIGNAL_H
#ifdef __cplusplus
extern "C"
{
#endif // ifdef __cplusplus
typedef void (*__signal_func_ptr)(int);
int raise(int);
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif // SIGNAL_H

View File

@ -0,0 +1,39 @@
#include "PowerPC_EABI_Support/MSL_C/signal.h"
#include "PowerPC_EABI_Support/MSL_C/ansi_params.h"
#include "PowerPC_EABI_Support/MSL_C/critical_regions.gamecube.h"
#include "PowerPC_EABI_Support/MSL_C/abort_exit.h"
__signal_func_ptr signal_funcs[6];
int raise(int sig)
{
__signal_func_ptr signal_func;
if (sig < 1 || sig > 6)
{
return -1;
}
__begin_critical_region(4);
signal_func = signal_funcs[sig - 1];
if (signal_func != ((__std(__signal_func_ptr))1))
{
signal_funcs[sig - 1] = ((__std(__signal_func_ptr))0);
}
__end_critical_region(4);
if (signal_func == ((__std(__signal_func_ptr))1) || (signal_func == ((__std(__signal_func_ptr))0) && sig == 1))
{
return 0;
}
if (signal_func == ((__std(__signal_func_ptr))0))
{
exit(0);
}
(*signal_func)(sig);
return 0;
}