Migrate to inline=deferred,noauto

This commit is contained in:
Luke Street 2022-07-28 09:19:26 -04:00
parent 93eb46aedd
commit 863cf71312
10 changed files with 150 additions and 150 deletions

View File

@ -104,7 +104,7 @@ LDFLAGS := $(MAPGEN) -fp fmadd -nodefaults -w off
endif
CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -O4,p -maxerrors 1 -use_lmw_stmw on -enum int -inline auto -MMD $(INCLUDES)
CFLAGS_MUSYX = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -O4,p -maxerrors 1 -enum int -inline auto -MMD $(INCLUDES)
CFLAGS = $(CFLAGS_1.2) -gccinc
CFLAGS = $(CFLAGS_1.2) -gccinc -inline deferred,noauto
ifeq ($(VERBOSE),0)
# this set of ASFLAGS generates no warnings.
@ -113,13 +113,23 @@ endif
$(BUILD_DIR)/src/os/__start.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/os/__start.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/MetroTRK/mslsupp.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/MetroTRK/mslsupp.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/PPCArch.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/PPCArch.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/os/OSAudioSystem.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/os/OSReset.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/os/OSReset.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/Dolphin/dsp/dsp.o: MWCC_VERSION := 1.2.5
$(BUILD_DIR)/src/Dolphin/dsp/dsp.o: CFLAGS := $(CFLAGS_1.2)
$(BUILD_DIR)/src/musyx/seq_api.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/synth_dbtab.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/snd_service.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/snd_init.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/dsp_import.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/hw_memory.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/reverb_fx.o: CFLAGS := $(CFLAGS_MUSYX)
#-------------------------------------------------------------------------------
# Recipes

View File

@ -529,7 +529,6 @@ lbl_805ADE04:
lbl_803D5E98:
# ROM: 0x3D2E98
.asciz "CMDL_GameCube"
.byte 0x3F, 0x3F
.asciz "(??)"
.asciz "??(??)"
.balign 4

View File

@ -3,6 +3,7 @@
class CParticleGen;
class IWeaponRenderer {
public:
virtual ~IWeaponRenderer() {}
virtual void AddParticleGen(const CParticleGen& gen) = 0;
@ -18,6 +19,4 @@ public:
void AddParticleGen(const CParticleGen& gen);
};
static CDefaultRenderer sDefaultRenderer = CDefaultRenderer();;
#endif //__IWEAPONRENDERER_HPP__

View File

@ -2,16 +2,10 @@
#include "Kyoto/Basics/COsContext.hpp"
IAllocator::~IAllocator() {
}
IAllocator::SMetrics::SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6,
u32 unk7, u32 unk8, u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize,
u32 smallAllocRemainingSize, u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize,
u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, u32 unk12,
u32 mediumAllocTotalAllocated, u32 fakeStatics)
IAllocator::SMetrics::SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6, u32 unk7, u32 unk8,
u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize,
u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11,
u32 unk12, u32 mediumAllocTotalAllocated, u32 fakeStatics)
: x0_heapSize(heapSize)
, x4_(unk1)
, x8_(unk2)
@ -34,3 +28,5 @@ IAllocator::SMetrics::SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 u
, x4c_(unk12)
, x50_mediumTotalAllocated(mediumAllocTotalAllocated)
, x54_fakeStatics(fakeStatics) {}
IAllocator::~IAllocator() {}

View File

@ -2,13 +2,6 @@
#include "Dolphin/os.h"
bool CStopwatch::CSWData::Initialize() {
x0_timerFreq = OS_TIMER_CLOCK;
x8_timerFreqO1M = x0_timerFreq / 1000000ll;
x10_timerPeriod = 1.f / static_cast<f32>(x0_timerFreq);
return true;
}
void CStopwatch::CSWData::Wait(f32 v) const {
OSTime duration = OSSecondsToTicks(v);
OSTime end = OSGetTime() + duration;
@ -19,3 +12,10 @@ void CStopwatch::CSWData::Wait(f32 v) const {
diff = current - end;
} while (diff < 0);
}
bool CStopwatch::CSWData::Initialize() {
x0_timerFreq = OS_TIMER_CLOCK;
x8_timerFreqO1M = x0_timerFreq / 1000000ll;
x10_timerPeriod = 1.f / static_cast<f32>(x0_timerFreq);
return true;
}

View File

@ -4,37 +4,97 @@
#include "Kyoto/Alloc/CMemory.hpp"
static u8 c;
static u16 s;
static u32 l;
static u64 ll;
static f32 f;
CInputStream::CInputStream(size_t len)
: x4_blockOffset(0)
, x8_blockLen(0)
, xc_len(len)
, x10_ptr(new u8[len])
, x14_owned(true)
, x18_readPosition(0)
, x1c_bitWord(0)
, x20_bitOffset(0) {}
f32 CInputStream::ReadFloat() {
Get(&f, sizeof(f32));
return f;
CInputStream::CInputStream(const void* ptr, size_t len, bool owned)
: x4_blockOffset(0)
, x8_blockLen(len)
, xc_len(len)
, x10_ptr(const_cast< u8* >(reinterpret_cast< const u8* >(ptr)))
, x14_owned(owned)
, x18_readPosition(0)
, x1c_bitWord(0)
, x20_bitOffset(0) {}
CInputStream::~CInputStream() {
if (x14_owned) {
delete x10_ptr;
}
}
u64 CInputStream::ReadLongLong() {
Get(&ll, sizeof(u64));
return ll;
bool CInputStream::InternalReadNext() {
x8_blockLen = Read(x10_ptr, xc_len);
x4_blockOffset = 0;
return x8_blockLen != 0;
}
u32 CInputStream::ReadLong() {
Get(&l, sizeof(u32));
return l;
bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); }
void CInputStream::Get(void* dest, unsigned long len) {
u32 remain = len;
u32 readCount = 0;
x20_bitOffset = 0;
while (remain != 0) {
u32 blockLen = x8_blockLen - x4_blockOffset;
blockLen = remain < blockLen ? remain : blockLen;
if (blockLen != 0) {
memcpy(reinterpret_cast< u8* >(dest) + readCount, x10_ptr + x4_blockOffset, blockLen);
remain -= blockLen;
readCount += blockLen;
x4_blockOffset += blockLen;
} else if (remain > 256) {
u32 readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain);
remain -= readLen;
readCount += readLen;
} else {
GrabAnotherBlock();
}
}
x18_readPosition += readCount;
}
u16 CInputStream::ReadShort() {
Get(&s, sizeof(u16));
return s;
}
u32 CInputStream::ReadBytes(void* dest, unsigned long len) {
if (len == 0) {
return 0;
}
bool CInputStream::ReadBool() { return static_cast< bool >(ReadChar()); }
if (x4_blockOffset == x8_blockLen) {
GrabAnotherBlock();
}
u8 CInputStream::ReadChar() {
Get(&c, sizeof(u8));
return c;
u32 curLen = len;
u32 curReadLen = 0;
while (curReadLen < len) {
u32 remain = x8_blockLen - x4_blockOffset;
if (remain == 0) {
if (InternalReadNext()) {
continue;
} else {
return curReadLen;
}
}
u32 sz = curLen < remain ? curLen : remain;
memcpy(reinterpret_cast< u8* >(dest) + curReadLen, x10_ptr + x4_blockOffset, sz);
curReadLen += sz;
curLen -= sz;
x4_blockOffset += sz;
}
x18_readPosition += curReadLen;
return curReadLen;
}
static inline u32 BitsToBytes(u32 bits) { return (bits / 8) + ((bits % 8) ? 1 : 0); }
@ -84,95 +144,34 @@ u32 CInputStream::ReadBits(u32 bitCount) {
return ret;
}
u32 CInputStream::ReadBytes(void* dest, unsigned long len) {
if (len == 0) {
return 0;
}
if (x4_blockOffset == x8_blockLen) {
GrabAnotherBlock();
}
u32 curLen = len;
u32 curReadLen = 0;
while (curReadLen < len) {
u32 remain = x8_blockLen - x4_blockOffset;
if (remain == 0) {
if (InternalReadNext()) {
continue;
} else {
return curReadLen;
}
}
u32 sz = curLen < remain ? curLen : remain;
memcpy(reinterpret_cast< u8* >(dest) + curReadLen, x10_ptr + x4_blockOffset, sz);
curReadLen += sz;
curLen -= sz;
x4_blockOffset += sz;
}
x18_readPosition += curReadLen;
return curReadLen;
u8 CInputStream::ReadChar() {
static u8 c;
Get(&c, sizeof(u8));
return c;
}
void CInputStream::Get(void* dest, unsigned long len) {
u32 remain = len;
u32 readCount = 0;
x20_bitOffset = 0;
bool CInputStream::ReadBool() { return static_cast< bool >(ReadChar()); }
while (remain != 0) {
u32 blockLen = x8_blockLen - x4_blockOffset;
blockLen = remain < blockLen ? remain : blockLen;
if (blockLen != 0) {
memcpy(reinterpret_cast< u8* >(dest) + readCount, x10_ptr + x4_blockOffset, blockLen);
remain -= blockLen;
readCount += blockLen;
x4_blockOffset += blockLen;
} else if (remain > 256) {
u32 readLen = Read(reinterpret_cast< u8* >(dest) + readCount, remain);
remain -= readLen;
readCount += readLen;
} else {
GrabAnotherBlock();
}
}
x18_readPosition += readCount;
u16 CInputStream::ReadShort() {
static u16 s;
Get(&s, sizeof(u16));
return s;
}
bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); }
bool CInputStream::InternalReadNext() {
x8_blockLen = Read(x10_ptr, xc_len);
x4_blockOffset = 0;
return x8_blockLen != 0;
u32 CInputStream::ReadLong() {
static u32 l;
Get(&l, sizeof(u32));
return l;
}
CInputStream::~CInputStream() {
if (x14_owned) {
delete x10_ptr;
}
u64 CInputStream::ReadLongLong() {
static u64 ll;
Get(&ll, sizeof(u64));
return ll;
}
CInputStream::CInputStream(const void* ptr, size_t len, bool owned)
: x4_blockOffset(0)
, x8_blockLen(len)
, xc_len(len)
, x10_ptr(const_cast< u8* >(reinterpret_cast< const u8* >(ptr)))
, x14_owned(owned)
, x18_readPosition(0)
, x1c_bitWord(0)
, x20_bitOffset(0) {}
CInputStream::CInputStream(size_t len)
: x4_blockOffset(0)
, x8_blockLen(0)
, xc_len(len)
, x10_ptr(new u8[len])
, x14_owned(true)
, x18_readPosition(0)
, x1c_bitWord(0)
, x20_bitOffset(0) {}
f32 CInputStream::ReadFloat() {
static f32 f;
Get(&f, sizeof(f32));
return f;
}

View File

@ -1,11 +1,8 @@
#include "Kyoto/Streams/CMemoryInStream.hpp"
u32 CMemoryInStream::Read(void* dest, u32 len) {
return 0;
}
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len)
: CInputStream(ptr, len, false) {}
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership)
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership)
: CInputStream(ptr, len, ownership == kOS_Owned) {}
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len) : CInputStream(ptr, len, false) {}
u32 CMemoryInStream::Read(void* dest, u32 len) { return 0; }

View File

@ -6,20 +6,7 @@
#include "Kyoto/CFactoryMgr.hpp"
static FourCC mCurrentLanguage = 'ENGL';
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { return new CStringTable(in); }
template <>
CFactoryFnReturn::CFactoryFnReturn(CStringTable* ptr) : obj(TToken< CStringTable >::GetIObjObjectFor(ptr).release()) {}
static const wchar_t skInvalidString[] = L"Invalid";
const wchar_t* CStringTable::GetString(s32 idx) const {
if (idx < 0 || idx >= x0_stringCount) {
return skInvalidString;
}
s32 offset = *(reinterpret_cast< const s32* >(x4_data.get()) + idx);
return reinterpret_cast< const wchar_t* >(x4_data.get() + offset);
}
CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL) {
in.ReadLong();
@ -46,3 +33,16 @@ CStringTable::CStringTable(CInputStream& in) : x0_stringCount(0), x4_data(NULL)
x4_data = new u8[dataLen];
in.ReadBytes(x4_data.get(), dataLen);
}
const wchar_t* CStringTable::GetString(s32 idx) const {
if (idx < 0 || idx >= x0_stringCount) {
return skInvalidString;
}
s32 offset = *(reinterpret_cast< const s32* >(x4_data.get()) + idx);
return reinterpret_cast< const wchar_t* >(x4_data.get() + offset);
}
template <>
CFactoryFnReturn::CFactoryFnReturn(CStringTable* ptr) : obj(TToken< CStringTable >::GetIObjObjectFor(ptr).release()) {}
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { return new CStringTable(in); }

View File

@ -97,7 +97,7 @@ void CMain::RefreshGameState() {
x128_gameGlobalObjects->GameState() = nullptr;
gpGameState = nullptr;
{
CMemoryInStream stream(backupBuf.data(), backupBuf.size(), CMemoryInStream::Owned);
CMemoryInStream stream(backupBuf.data(), backupBuf.size(), CMemoryInStream::kOS_Owned);
x128_gameGlobalObjects->GameState() = new CGameState(stream, saveIdx);
}
gpGameState = x128_gameGlobalObjects->GameState().get();

View File

@ -3,7 +3,7 @@
#include "Kyoto/Particles/CParticleGen.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
//CDefaultRenderer sDefaultRenderer = CDefaultRenderer();
static CDefaultRenderer sDefaultRenderer = CDefaultRenderer();
IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer;