Decompiled Application::run and Application::Application

This commit is contained in:
Charlotte Delenk 2021-10-21 10:59:57 +02:00
parent 862273029d
commit 3641f2f542
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
12 changed files with 109 additions and 4 deletions

View file

@ -11,6 +11,7 @@
80006620,80006684,,,,,,,,,,,,,,,,,,,,,,,,,sdk/rvl/os/__ppc_eabi_init.o
,,,,,,80174ad8,80174af8,,,,,,,,,,,,,80556b70,80556b71,,,,,donut/Main.o
,,,,,,,,,,,,,,,,,,,,8055d120,8055d12c,,,,,donut/app/AppImpl.o
,,,,,,80176268,80176464,,,,,,,,,,,,,8055d130,8055d134,,,,,donut/app/Application.o
,,,,,,801776bc,8017793c,,,,,,,80452cf7,80452d18,,,,,8055d13c,8055d141,,,,,donut/app/EntryPoint.o
,,,,,,8017bbdc,8017bd88,,,,,,,,,,,,,,,,,,,donut/app/System.o
,,,,,,,,,,,,,,,,,,,,8055d1b0,8055d1b4,,,,,donut/g3d/Root.o

1 .init start .init end extab start extab end extabindex start extabindex end .text start .text end .ctors start .ctors end .dtors start .dtors end .rodata start .rodata end .data start .data end .bss start .bss end .sdata start .sdata end .sbss start .sbss end .sdata2 start .sdata2 end .sbss2 start .sbss2 end File
11 80006620 80006684 sdk/rvl/os/__ppc_eabi_init.o
12 80174ad8 80174af8 80556b70 80556b71 donut/Main.o
13 8055d120 8055d12c donut/app/AppImpl.o
14 80176268 80176464 8055d130 8055d134 donut/app/Application.o
15 801776bc 8017793c 80452cf7 80452d18 8055d13c 8055d141 donut/app/EntryPoint.o
16 8017bbdc 8017bd88 donut/app/System.o
17 8055d1b0 8055d1b4 donut/g3d/Root.o

View file

@ -21,6 +21,7 @@ Address,SymbolName
80022ba0,OSLockMutex
80022c80,OSUnlockMutex
80023820,OSResetSystem
800244a0,CheckPointerIsValid__Q33hel6common13ScopedPtrUtilFPCv
80028530,__init_user
800285a0,exit
8002c840,VIInit
@ -38,9 +39,11 @@ Address,SymbolName
800dd3e0,__ct__Q33hel6common34PointerWrapper<Q23mem10IAllocator>Fv
800f16b0,G3dInit__Q24nw4r3g3dFb
801007e0,startAddress__Q23mem8MemBlockCFv
80174de0,__ct__Q23app7AppImplFRQ23app6System
801754f4,run__Q23app7AppImplFbbb
80175004,__dt__Q33hel6common43ExplicitSingleton<Q26freeze13FreezeManager>Fv
80175004,__dt__Q33hel6common38ExplicitSingleton<Q23app11Application>Fv
80175b68,__dt__Q33hel6common11NonCopyableFv
80176268,Run__Q23app11ApplicationFRQ23app6Systembbb
8018a900,__ct__Q26freeze13FreezeManagerFPUcPUc
80196404,__dt__Q23gfx13RenderSettingFv
80196468,rmode__Q23gfx13RenderSettingCFv

1 Address SymbolName
21 80022ba0 OSLockMutex
22 80022c80 OSUnlockMutex
23 80023820 OSResetSystem
24 800244a0 CheckPointerIsValid__Q33hel6common13ScopedPtrUtilFPCv
25 80028530 __init_user
26 800285a0 exit
27 8002c840 VIInit
39 800dd3e0 __ct__Q33hel6common34PointerWrapper<Q23mem10IAllocator>Fv
40 800f16b0 G3dInit__Q24nw4r3g3dFb
41 801007e0 startAddress__Q23mem8MemBlockCFv
42 80174de0 __ct__Q23app7AppImplFRQ23app6System
43 801754f4 run__Q23app7AppImplFbbb
44 80175004 __dt__Q33hel6common43ExplicitSingleton<Q26freeze13FreezeManager>Fv
45 80175004 __dt__Q33hel6common38ExplicitSingleton<Q23app11Application>Fv
46 80175b68 __dt__Q33hel6common11NonCopyableFv
80176268 Run__Q23app11ApplicationFRQ23app6Systembbb
47 8018a900 __ct__Q26freeze13FreezeManagerFPUcPUc
48 80196404 __dt__Q23gfx13RenderSettingFv
49 80196468 rmode__Q23gfx13RenderSettingCFv

25
donut/app/Application.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <app/Application.hpp>
using namespace hel::common;
namespace app {
void Application::Run(System &system, bool debug, bool hbm_reset,
bool wiisystem_reset) {
Application app(system, debug, hbm_reset, wiisystem_reset);
}
Application::Application(System &system, bool debug, bool hbm_reset,
bool wiisystem_reset)
: impl_(new AppImpl(system)) {
object_ = this;
impl_->run(debug, hbm_reset, wiisystem_reset);
}
Application::~Application() { object_ = 0; }
} // namespace app
namespace hel {
namespace common {
app::Application *ExplicitSingleton<app::Application>::object_;
} // namespace common
} // namespace hel

View file

@ -54,7 +54,7 @@ void *operator new[](u32 size, IAllocator &alloc) {
return t_operatorNew(size, alloc);
}
USED void *operator new(u32 size) { return t_operatorNew(size); }
void *operator new(u32 size) { return t_operatorNew(size); }
void *operator new[](u32 size) { return t_operatorNew(size); }

17
include/app/AppImpl.hpp Normal file
View file

@ -0,0 +1,17 @@
#pragma once
#include <app/System.hpp>
#include <gfx/IDrawer.hpp>
#include <hel/common/ProtectedSingleton.hpp>
namespace app {
struct AppImpl : gfx::IDrawer, hel::common::ProtectedSingleton<AppImpl> {
int unk[15090];
AppImpl(System &system);
virtual ~AppImpl();
virtual void drawerExecDraw();
void run(bool debug, bool hbm_reset, bool wiisystem_reset);
};
} // namespace app

View file

@ -1,9 +1,17 @@
#pragma once
#include <app/AppImpl.hpp>
#include <app/System.hpp>
#include <hel/common/ExplicitSingleton.hpp>
#include <hel/common/ScopedPtr.hpp>
namespace app {
struct Application {
struct Application : hel::common::ExplicitSingleton<Application> {
hel::common::ScopedPtr<AppImpl> impl_;
Application(System &system, bool debug, bool hbm_reset, bool wiisystem_reset);
~Application();
static void Run(System &, bool, bool, bool);
};
} // namespace app

View file

@ -2,8 +2,10 @@
#define AT(pos) : pos
#define SECTION(sect) __declspec(section sect)
#define USED __attribute__((used))
#define NOINLINE __attribute__((never_inline))
#else
#define AT(pos)
#define SECTION(sect)
#define USED
#define NOINLINE
#endif

8
include/gfx/IDrawer.hpp Normal file
View file

@ -0,0 +1,8 @@
#pragma once
namespace gfx {
struct IDrawer {
virtual ~IDrawer() {}
virtual void drawerExecDraw() = 0;
};
} // namespace gfx

View file

@ -0,0 +1,12 @@
#pragma once
#include <hel/common/NonCopyable.hpp>
namespace hel {
namespace common {
template <class T> struct ProtectedSingleton : NonCopyable {
static T *ptr_;
virtual ~ProtectedSingleton();
};
} // namespace common
} // namespace hel

View file

@ -0,0 +1,26 @@
#pragma once
#include <defines.h>
#include <hel/common/NonCopyable.hpp>
namespace hel {
namespace common {
struct ScopedPtrUtil {
static void CheckPointerIsValid(const void *);
};
template <class T> struct ScopedPtr : NonCopyable {
T *ptr_;
inline ScopedPtr(T *ptr) : ptr_(ptr) {}
~ScopedPtr() {
T *tmp = ptr_;
ptr_ = 0;
delete tmp;
}
NOINLINE T *operator->() const {
ScopedPtrUtil::CheckPointerIsValid(ptr_);
return ptr_;
}
};
} // namespace common
} // namespace hel

View file

@ -1,7 +1,9 @@
#pragma once
#include <hel/common/ExplicitSingleton.hpp>
namespace snd {
struct SoundManager {
struct SoundManager : hel::common::ExplicitSingleton<SoundManager> {
int unknown[188];
SoundManager();
~SoundManager();

View file

@ -22,6 +22,7 @@ const SOURCES: &[(&str, &str)] = &[
("sdk/rvl/os/__ppc_eabi_init.c", "sdk"),
("donut/Main.cpp", "donut"),
("donut/app/AppImpl.cpp", "donut"),
("donut/app/Application.cpp", "donut"),
("donut/app/EntryPoint.cpp", "donut"),
("donut/app/System.cpp", "donut"),
("donut/g3d/Root.cpp", "donut"),