Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/GQPE78/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2904,7 +2904,7 @@ MSL_C/MSL_Common/arith.c:
MSL_C/MSL_Common/buffer_io.c:
.text start:0x801E1E30 end:0x801E215C

PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/char_io.c:
MSL_C/MSL_Common/char_io.c:
.text start:0x801E215C end:0x801E25FC

MSL_C/PPC_EABI/critical_regions.gamecube.c:
Expand Down
2 changes: 1 addition & 1 deletion config/GQPE78/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12698,7 +12698,7 @@ __AXDSPTask = .bss:0x8036BBA0; // type:object size:0x50 scope:local
__AXLocalProfile = .bss:0x8036BBF0; // type:object size:0x38 scope:global
__AXStudio = .bss:0x8036BC40; // type:object size:0x36 scope:local data:4byte
...bss.0 = .bss:0x8036BC40; // type:label scope:local
__AXPB = .bss:0x8036BC80; // type:object size:0x3D00 scope:local data:2byte
__AXPB = .bss:0x8036BC80; // type:object size:0x3D00 scope:local align:32 data:2byte
...bss.0 = .bss:0x8036BC80; // type:label scope:local
__AXITD = .bss:0x8036F980; // type:object size:0x1000 scope:local
__AXUpdates = .bss:0x80370980; // type:object size:0x4000 scope:local
Expand Down
69 changes: 41 additions & 28 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@
#"-requireprotos"
]

# Renderware library flags
cflags_renderware = [
*cflags_base,
"-lang=c",
"-fp fmadd",
"-fp_contract off",
"-char signed",
"-str reuse",
"-common off",
"-O4,p",
#"-requireprotos"
]

# REL flags
cflags_rel = [
*cflags_base,
Expand Down Expand Up @@ -307,8 +320,9 @@ def trkLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
def RenderWareLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"src_dir": "libs",
"mw_version": "GC/1.3.2",
"cflags": cflags_base,
"cflags": cflags_renderware,
"progress_category": "RW",
"objects": objects,
}
Expand Down Expand Up @@ -608,7 +622,7 @@ def MatchingFor(*versions):
DolphinLib(
"ar",
[
Object(NonMatching, "dolphin/ar/ar.c"),
Object(Matching, "dolphin/ar/ar.c"),
Object(Matching, "dolphin/ar/arq.c")
]
),
Expand All @@ -620,7 +634,7 @@ def MatchingFor(*versions):
Object(Matching, "dolphin/ax/AXAux.c"),
Object(NonMatching, "dolphin/ax/AXCL.c"),
Object(NonMatching, "dolphin/ax/AXOut.c"),
Object(NonMatching, "dolphin/ax/AXSPB.c"),
Object(Matching, "dolphin/ax/AXSPB.c"),
Object(NonMatching, "dolphin/ax/AXVPB.c"),
Object(Matching, "dolphin/ax/AXComp.c"),
Object(NonMatching, "dolphin/ax/DSPCode.c"),
Expand Down Expand Up @@ -672,10 +686,10 @@ def MatchingFor(*versions):
"dvd",
[
Object(NonMatching, "dolphin/dvd/dvdlow.c"),
Object(NonMatching, "dolphin/dvd/dvdfs.c"),
Object(Matching, "dolphin/dvd/dvdfs.c"),
Object(NonMatching, "dolphin/dvd/dvd.c"),
Object(Matching, "dolphin/dvd/dvdqueue.c"),
Object(NonMatching, "dolphin/dvd/dvderror.c"),
Object(Matching, "dolphin/dvd/dvderror.c"),
Object(Matching, "dolphin/dvd/dvdidutils.c"),
Object(Matching, "dolphin/dvd/dvdFatal.c"),
Object(Matching, "dolphin/dvd/emu_level2/fstload.c"),
Expand All @@ -685,7 +699,7 @@ def MatchingFor(*versions):
"exi",
[
Object(NonMatching, "dolphin/exi/EXIBios.c"),
Object(NonMatching, "dolphin/exi/EXIUart.c")
Object(Matching, "dolphin/exi/EXIUart.c")
]
),
DolphinLib(
Expand All @@ -694,9 +708,9 @@ def MatchingFor(*versions):
Object(NonMatching, "dolphin/gx/GXInit.c"),
Object(NonMatching, "dolphin/gx/GXFifo.c"),
Object(NonMatching, "dolphin/gx/GXAttr.c"),
Object(NonMatching, "dolphin/gx/GXMisc.c"),
Object(Matching, "dolphin/gx/GXMisc.c"),
Object(NonMatching, "dolphin/gx/GXGeometry.c"),
Object(NonMatching, "dolphin/gx/GXFrameBuf.c"),
Object(Matching, "dolphin/gx/GXFrameBuf.c"),
Object(NonMatching, "dolphin/gx/GXLight.c"),
Object(NonMatching, "dolphin/gx/GXTexture.c"),
Object(NonMatching, "dolphin/gx/GXBump.c"),
Expand Down Expand Up @@ -724,7 +738,7 @@ def MatchingFor(*versions):
DolphinLib(
"OdemuExi2",
[
Object(NonMatching, "dolphin/OdemuExi2/DebuggerDriver.c")
Object(Matching, "dolphin/OdemuExi2/DebuggerDriver.c", extra_cflags=["-inline on, deferred"])
]
),
DolphinLib(
Expand All @@ -737,11 +751,11 @@ def MatchingFor(*versions):
"os",
[
Object(NonMatching, "dolphin/os/OS.c"),
Object(NonMatching, "dolphin/os/OSAlarm.c"),
Object(Matching, "dolphin/os/OSAlarm.c"),
Object(Matching, "dolphin/os/OSAlloc.c"),
Object(Matching, "dolphin/os/OSArena.c"),
Object(Matching, "dolphin/os/OSAudioSystem.c"),
Object(NonMatching, "dolphin/os/OSCache.c"),
Object(Matching, "dolphin/os/OSCache.c"),
Object(Matching, "dolphin/os/OSContext.c"),
Object(NonMatching, "dolphin/os/OSError.c"),
Object(NonMatching, "dolphin/os/OSFont.c"),
Expand All @@ -750,11 +764,11 @@ def MatchingFor(*versions):
Object(Matching, "dolphin/os/OSMemory.c"),
Object(Matching, "dolphin/os/OSMutex.c"),
Object(Matching, "dolphin/os/OSReboot.c"),
Object(NonMatching, "dolphin/os/OSReset.c"),
Object(Matching, "dolphin/os/OSReset.c"),
Object(Matching, "dolphin/os/OSResetSW.c"),
Object(NonMatching, "dolphin/os/OSRtc.c"),
Object(NonMatching, "dolphin/os/OSThread.c"),
Object(NonMatching, "dolphin/os/OSTime.c"),
Object(Matching, "dolphin/os/OSRtc.c"),
Object(Matching, "dolphin/os/OSThread.c"),
Object(Matching, "dolphin/os/OSTime.c"),
Object(Matching, "dolphin/os/OSSync.c"),
Object(NonMatching, "dolphin/os/init/__start.c"),
Object(NonMatching, "dolphin/os/init/__ppc_eabi_init.cpp")
Expand All @@ -763,7 +777,7 @@ def MatchingFor(*versions):
DolphinLib(
"pad",
[
Object(NonMatching, "dolphin/pad/Padclamp.c"),
Object(Matching, "dolphin/pad/Padclamp.c"),
Object(NonMatching, "dolphin/pad/Pad.c")
]
),
Expand All @@ -777,7 +791,7 @@ def MatchingFor(*versions):
DolphinLib(
"vi",
[
Object(NonMatching, "dolphin/vi/vi.c"),
Object(Matching, "dolphin/vi/vi.c", extra_cflags=["-DMATCHING"]),
],
),
mslLib(
Expand All @@ -789,9 +803,9 @@ def MatchingFor(*versions):
Object(NonMatching, "Runtime/global_destructor_chain.c"),
Object(NonMatching, "Runtime/New.cp"),
Object(NonMatching, "Runtime/NMWException.cp"),
Object(NonMatching, "Runtime/CPlusLibPPC.cp"),
Object(Matching, "Runtime/CPlusLibPPC.cp"),
Object(NonMatching, "Runtime/ptmf.c"),
#Object(NonMatching, "Runtime/runtime.c"),
Object(NonMatching, "Runtime/runtime.c"),
Object(NonMatching, "Runtime/__init_cpp_exceptions.cpp"),
Object(NonMatching, "Runtime/Gecko_ExceptionPPC.cp"),
Object(NonMatching, "Runtime/GCN_mem_alloc.c"),
Expand All @@ -808,7 +822,7 @@ def MatchingFor(*versions):
Object(NonMatching, "MSL_C/MSL_Common/arith.c"),
Object(NonMatching, "MSL_C/MSL_Common/bsearch.c"),
Object(NonMatching, "MSL_C/MSL_Common/buffer_io.c"),
Object(NonMatching, "MSL_C/PPC_EABI/critical_regions.gamecube.c"),
Object(Matching, "MSL_C/PPC_EABI/critical_regions.gamecube.c"),
Object(NonMatching, "MSL_C/MSL_Common/ctype.c"),
Object(NonMatching, "MSL_C/MSL_Common/direct_io.c"),
Object(Matching, "MSL_C/MSL_Common/errno.c"),
Expand All @@ -828,8 +842,7 @@ def MatchingFor(*versions):
Object(NonMatching, "MSL_C/MSL_Common/strtold.c"),
Object(NonMatching, "MSL_C/MSL_Common/strtoul.c"),
Object(NonMatching, "MSL_C/MSL_Common/float.c"),
# Causes cyclic dependency error
# Object(NonMatching, "MSL_C/MSL_Common/char_io.c"),
Object(NonMatching, "MSL_C/MSL_Common/char_io.c"),
Object(NonMatching, "MSL_C/MSL_Common/wchar_io.c"),
Object(NonMatching, "MSL_C/MSL_Common_Embedded/uart_console_io_gcn.c")
]
Expand Down Expand Up @@ -860,12 +873,12 @@ def MatchingFor(*versions):
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c"),
Object(NonMatching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_exp.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c"),
Object(NonMatching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_log.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_log.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/w_pow.c"),
Object(NonMatching, "MSL_C/PPC_EABI/math_ppc.c"),
]
Expand All @@ -883,20 +896,20 @@ def MatchingFor(*versions):
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/dispatch.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/msghndlr.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/support.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/mutex_TRK.c"),
Object(Matching, "debugger/embedded/MetroTRK/Portable/mutex_TRK.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/notify.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/main_TRK.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/mem_TRK.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Portable/string_TRK.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/flush_cache.c"),
Object(Matching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/flush_cache.c"),
#Object(NonMatching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/__exception.s"),
Object(NonMatching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/targimpl.c"),
#Object(NonMatching, "debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s"),
Object(NonMatching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/mpc_7xx_603e.c"),
Object(Matching, "debugger/embedded/MetroTRK/Processor/ppc/Generic/mpc_7xx_603e.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/dolphin_trk.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/usr_put.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/dolphin_trk_glue.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/targcont.c"),
Object(Matching, "debugger/embedded/MetroTRK/Os/dolphin/targcont.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/target_options.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Os/dolphin/UDP_Stubs.c"),
Object(NonMatching, "debugger/embedded/MetroTRK/Export/mslsupp.c"),
Expand Down
69 changes: 34 additions & 35 deletions include/dolphin/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <dolphin/types.h>

#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif

// Upper words of the masks, since UIMM is only 16 bits
Expand All @@ -23,26 +22,26 @@ extern "C"
#define AT_ADDRESS
#endif
volatile int __OSTVMode AT_ADDRESS(OS_BASE_CACHED | 0xCC);
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h
#define OS_BUS_CLOCK (u32) __OSBusClock
#define OS_CORE_CLOCK __OSCoreClock
#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)

#ifndef _DEBUG
#define OSPhysicalToCached(paddr) ((void *)((u32)(paddr) + OS_BASE_CACHED))
#define OSPhysicalToUncached(paddr) ((void *)((u32)(paddr) + OS_BASE_UNCACHED))
#define OSCachedToPhysical(caddr) ((u32)((u8 *)(caddr)-OS_BASE_CACHED))
#define OSUncachedToPhysical(ucaddr) ((u32)((u8 *)(ucaddr)-OS_BASE_UNCACHED))
#define OSCachedToUncached(caddr) ((void *)((u8 *)(caddr) + (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#define OSUncachedToCached(ucaddr) ((void *)((u8 *)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#define OSPhysicalToCached(paddr) ((void*)((u32)(paddr) + OS_BASE_CACHED))
#define OSPhysicalToUncached(paddr) ((void*)((u32)(paddr) + OS_BASE_UNCACHED))
#define OSCachedToPhysical(caddr) ((u32)((u8*)(caddr)-OS_BASE_CACHED))
#define OSUncachedToPhysical(ucaddr) ((u32)((u8*)(ucaddr)-OS_BASE_UNCACHED))
#define OSCachedToUncached(caddr) ((void*)((u8*)(caddr) + (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#define OSUncachedToCached(ucaddr) ((void*)((u8*)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#else
u32 OSPhysicalToCached(void *paddr);
u32 OSPhysicalToUncached(void *paddr);
u32 OSCachedToPhysical(void *caddr);
u32 OSUncachedToPhysical(void *ucaddr);
u32 OSCachedToUncached(void *caddr);
u32 OSUncachedToCached(void *ucaddr);
u32 OSPhysicalToCached(void* paddr);
u32 OSPhysicalToUncached(void* paddr);
u32 OSCachedToPhysical(void* caddr);
u32 OSUncachedToPhysical(void* ucaddr);
u32 OSCachedToUncached(void* caddr);
u32 OSUncachedToCached(void* ucaddr);
#endif

#define OSTicksToCycles(ticks) (((ticks) * ((OS_CORE_CLOCK * 2) / OS_TIMER_CLOCK)) / 2)
Expand All @@ -60,13 +59,13 @@ u32 OSUncachedToCached(void *ucaddr);
#define OSRoundUp32B(v) ((((u32)v + 31) & ~31))
#define OSRoundDown32B(v) (((u32)(v) & ~31))

void *OSGetArenaHi(void);
void *OSGetArenaLo(void);
void OSSetArenaHi(void *newHi);
void OSSetArenaLo(void *newLo);
void* OSGetArenaHi(void);
void* OSGetArenaLo(void);
void OSSetArenaHi(void* newHi);
void OSSetArenaLo(void* newLo);

void *OSAllocFromArenaLo(u32 size, u32 align);
void *OSAllocFromArenaHi(u32 size, u32 align);
void* OSAllocFromArenaLo(u32 size, u32 align);
void* OSAllocFromArenaHi(u32 size, u32 align);

void OSInit();

Expand Down Expand Up @@ -122,7 +121,7 @@ void OSSetLanguage(u8 language);
u32 OSGetEuRgb60Mode(void);
void OSSetEuRgb60Mode(u32 on);

void OSRegisterVersion(const char *id);
void OSRegisterVersion(const char* id);

BOOL OSDisableInterrupts(void);
BOOL OSEnableInterrupts(void);
Expand All @@ -145,7 +144,7 @@ BOOL OSRestoreInterrupts(BOOL level);
#endif

#ifndef ASSERTMSG
#if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) || defined(__MWERKS__) || \
#if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) || defined(__MWERKS__) || \
defined(__SN__)
#define ASSERTMSG(exp, ...) (void)((exp) || (OSPanic(__FILE__, __LINE__, __VA_ARGS__), 0))
#else
Expand All @@ -154,23 +153,23 @@ BOOL OSRestoreInterrupts(BOOL level);
#endif

#ifndef ASSERTMSG1
#define ASSERTMSG1(exp, msg, param1) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1)), 0))
#define ASSERTMSG1(exp, msg, param1) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1)), 0))
#endif

#ifndef ASSERTMSG2
#define ASSERTMSG2(exp, msg, param1, param2) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2)), 0))
#define ASSERTMSG2(exp, msg, param1, param2) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2)), 0))
#endif

#ifndef ASSERTMSG3
#define ASSERTMSG3(exp, msg, param1, param2, param3) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2), (param3)), 0))
#define ASSERTMSG3(exp, msg, param1, param2, param3) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2), (param3)), 0))
#endif

#ifndef ASSERTMSG4
#define ASSERTMSG4(exp, msg, param1, param2, param3, param4) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2), (param3), (param4)), 0))
#define ASSERTMSG4(exp, msg, param1, param2, param3, param4) \
(void)((exp) || (OSPanic(__FILE__, __LINE__, (msg), (param1), (param2), (param3), (param4)), 0))
#endif

#else // _DEBUG
Expand All @@ -180,7 +179,7 @@ BOOL OSRestoreInterrupts(BOOL level);
#endif

#ifndef ASSERTMSG
#if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) || defined(__MWERKS__) || \
#if defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__) || defined(__MWERKS__) || \
defined(__SN__)
#define ASSERTMSG(exp, ...) ((void)0)
#else
Expand All @@ -203,9 +202,9 @@ BOOL OSRestoreInterrupts(BOOL level);

#endif // _DEBUG

void OSReport(const char *msg, ...);
void OSPanic(const char *file, int line, const char *msg, ...);
void OSFatal(GXColor fg, GXColor bg, const char *msg);
void OSReport(const char* msg, ...);
void OSPanic(const char* file, int line, const char* msg, ...);
void OSFatal(GXColor fg, GXColor bg, const char* msg);

#define OSError(...) OSPanic(__FILE__, __LINE__, __VA_ARGS__)
#ifndef MATCHING
Expand Down
Loading