Uninlined PrivateSingleton and MemorySetupper

This commit is contained in:
Charlotte Delenk 2021-10-20 07:58:59 +02:00
parent 8506bbdfc8
commit 06b748f792
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
4 changed files with 19 additions and 42 deletions

View file

@ -12,50 +12,15 @@ using namespace hel::common;
namespace app {
extern "C" {
System::SDKInitializer *
__ct__Q33app6System14SDKInitializerFv(System::SDKInitializer *self);
gfx::GXFifoMemoryManager *
__ct__Q23gfx19GXFifoMemoryManagerFUlUl(gfx::GXFifoMemoryManager *self,
unsigned long, unsigned long);
System::GXInitializer *
__ct__Q33app6System13GXInitializerFRQ23gfx19GXFifoMemoryManager(
System::GXInitializer *self, gfx::GXFifoMemoryManager *);
gfx::VISetting *__ct__Q23gfx9VISettingFv(gfx::VISetting *self);
gfx::XFBManager *
__ct__Q23gfx10XFBManagerFRCQ23gfx9VISetting(gfx::XFBManager *self,
const gfx::VISetting *);
gfx::RenderSetting *__ct__Q23gfx13RenderSettingFv(gfx::RenderSetting *self);
freeze::FreezeManager *
__ct__Q26freeze13FreezeManagerFPUcPUc(freeze::FreezeManager *self,
unsigned char *, unsigned char *);
hid::LibInitializer *__ct__Q23hid14LibInitializerFv(hid::LibInitializer *self);
snd::SoundManager *__ct__Q23snd12SoundManagerFv(snd::SoundManager *self);
System *__ct__Q23app6SystemFv(System *self) {
PrivateSingleton<System>::isExist_ = true;
__ct__Q33app6System14SDKInitializerFv(&self->sdkInit_);
mem::Memory::SetupIfNotSetup();
__ct__Q23gfx19GXFifoMemoryManagerFUlUl(&self->gxFifoMemoryManager_, 0x100000,
0);
__ct__Q33app6System13GXInitializerFRQ23gfx19GXFifoMemoryManager(
&self->gxInitializer_, &self->gxFifoMemoryManager_);
__ct__Q23gfx9VISettingFv(&self->viSetting_);
__ct__Q23gfx10XFBManagerFRCQ23gfx9VISetting(&self->xfbManager_,
&self->viSetting_);
__ct__Q23gfx13RenderSettingFv(&self->renderSetting_);
__ct__Q26freeze13FreezeManagerFPUcPUc(&self->freezeManager_,
self->xfbManager_.target1(),
self->xfbManager_.target2());
__ct__Q23hid14LibInitializerFv(&self->libInitializer_);
__ct__Q23snd12SoundManagerFv(&self->soundManager_);
self->viSetting_.set(0xe);
System::System()
: PrivateSingleton<System>(), sdkInit_(), memorySetupper_(),
gxFifoMemoryManager_(0x100000, 0), gxInitializer_(gxFifoMemoryManager_),
viSetting_(), xfbManager_(viSetting_), renderSetting_(),
freezeManager_(xfbManager_.target1(), xfbManager_.target2()),
libInitializer_(), soundManager_() {
viSetting_.set(0xe);
nw4r::g3d::G3dInit(true);
nw4r::g3d::tmem::SetTMemLayout(nw4r::g3d::tmem::TMEM_LAYOUT_1);
return self;
}
}
gfx::RenderSetting &System::renderSetting() { return renderSetting_; }
@ -87,6 +52,10 @@ System::SDKInitializer::SDKInitializer() {
AXInit();
}
inline System::MemorySetupper::MemorySetupper() {
mem::Memory::SetupIfNotSetup();
}
System::GXInitializer::GXInitializer(gfx::GXFifoMemoryManager &fifoMM) {
GXInit(fifoMM.data(), fifoMM.size());
GXSetDither(0);

View file

@ -16,11 +16,16 @@ struct System : hel::common::PrivateSingleton<System> {
SDKInitializer();
};
struct MemorySetupper {
MemorySetupper();
};
struct GXInitializer {
GXInitializer(gfx::GXFifoMemoryManager &);
};
SDKInitializer sdkInit_;
MemorySetupper memorySetupper_;
gfx::GXFifoMemoryManager gxFifoMemoryManager_;
GXInitializer gxInitializer_;
gfx::VISetting viSetting_;

View file

@ -6,6 +6,7 @@ namespace hel {
namespace common {
template <class T> struct PrivateSingleton : NonCopyable {
static bool isExist_;
inline PrivateSingleton() { isExist_ = true; }
~PrivateSingleton();
};
} // namespace common

View file

@ -66,6 +66,8 @@ static CFLAGS: Lazy<HashMap<&'static str, &'static [&'static str]>> = Lazy::new(
"-O3",
"-opt",
"space,nopeep",
"-ipa",
"file",
"-inline",
"auto",
"-gccinc",