Random half-done src and headers.

I guess I wasn't quite done. 🤷
This commit is contained in:
SodiumChlorideLogic 2021-12-15 13:49:16 -05:00
parent 957ebf6420
commit 6c7fec1704
23 changed files with 855 additions and 561 deletions

View File

@ -1,30 +1,27 @@
#ifndef _ARAM_H
#define _ARAM_H
// TODO: move to DVD ripper
namespace JKRDvdRipper {
typedef int EAllocDirection;
}
#include "JSystem/JKR/JKRDvdRipper.h"
#include "types.h"
typedef int JKRExpandSwitch;
namespace ARAM {
struct Mgr {
Mgr();
struct ARAM {
struct Mgr {
Mgr();
void aramToMainRam(const char*, unsigned char*, unsigned long,
unsigned long, JKRExpandSwitch, unsigned long,
struct JKRHeap*, JKRDvdRipper::EAllocDirection, int,
unsigned long*);
void dump();
void dvdToAram(const char*, bool);
void init();
void search(const char*);
};
struct Node {
~Node();
};
void* aramToMainRam(const char*, uchar*, ulong, ulong, JKRExpandSwitch,
ulong, JKRHeap*, JKRDvdRipper::EAllocDirection, int,
ulong*);
void dump();
void dvdToAram(const char*, bool);
void init();
void search(const char*);
};
struct Node {
~Node();
};
} // namespace ARAM
extern ARAM::Mgr* gAramMgr;
#endif

View File

@ -1,6 +1,7 @@
#ifndef _DOLPHIN_CTYPE_H
#define _DOLPHIN_CTYPE_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
@ -16,6 +17,13 @@ enum ctype {
CTYPE_UPPER = 0x80
};
extern enum ctype __ctype_map[256];
inline BOOL isdigit(int c)
{
return (__ctype_map[c & 0xFF] & CTYPE_XDIGIT) != 0;
}
#ifdef __cplusplus
};
#endif // ifdef __cplusplus

View File

@ -1,13 +1,15 @@
#ifndef _DVDTHREADCOMMAND_H
#define _DVDTHREADCOMMAND_H
#include "types.h"
#include "JSystem/JSU/JSUPtrLink.h"
#include "types.h"
struct JKRArchive;
struct JKRHeap;
struct DvdThreadCommand {
DvdThreadCommand();
u32 _00; // _00
u32 m_loadType; // _04
char* m_arcPath; // _08

View File

@ -4,23 +4,32 @@
#include "types.h"
struct IDelegate {
virtual void invoke() = 0;
};
template <typename A> struct IDelegate1 : public IDelegate {
virtual void invoke(A);
template <typename A> struct IDelegate1 {
virtual void invoke(A) = 0;
};
template <typename A, typename B> struct IDelegate2 : public IDelegate {
virtual void invoke(A, B);
template <typename A, typename B> struct IDelegate2 {
virtual void invoke(A, B) = 0;
};
template <typename A, typename B, typename C>
struct IDelegate3 : public IDelegate {
virtual void invoke(A, B, C);
template <typename A, typename B, typename C> struct IDelegate3 {
virtual void invoke(A, B, C) = 0;
};
template <typename T> struct Delegate : public IDelegate1<T> {
virtual void invoke(T);
template <typename T> struct Delegate : public IDelegate {
inline Delegate(T* obj, void (T::*func)())
{
m_object = obj;
m_function = func;
}
virtual void invoke() { (m_object->*m_function)(); }
// VTBL _00
T* m_object; // _04
void (T::*m_function)(); // _08
};
template <typename T, typename A> struct Delegate1 : public IDelegate1<A> {
@ -33,10 +42,8 @@ template <typename T, typename A> struct Delegate1 : public IDelegate1<A> {
virtual void invoke(A a) { (m_object->*m_function)(a); }
// VTBL _00
T* m_object; // _04
// u32 _08; // _08
// u32 _0C; // _0C
void (T::*m_function)(A); // _10
T* m_object; // _04
void (T::*m_function)(A); // _08
};
template <typename T, typename A, typename B>
@ -50,10 +57,8 @@ struct Delegate2 : public IDelegate2<A, B> {
virtual void invoke(A a, B b) { (m_object->*m_function)(a, b); }
// VTBL _00
T* m_object; // _04
// u32 _08; // _08
// u32 _0C; // _0C
void (T::*m_function)(A, B); // _10
T* m_object; // _04
void (T::*m_function)(A, B); // _08
};
template <typename T, typename A, typename B, typename C>
@ -67,10 +72,8 @@ struct Delegate3 : public IDelegate3<A, B, C> {
virtual void invoke(A a, B b, C c) { (m_object->*m_function)(a, b, c); }
// VTBL _00
T* m_object; // _04
// u32 _08; // _08
// u32 _0C; // _0C
void (T::*m_function)(A, B, C); // _10
T* m_object; // _04
void (T::*m_function)(A, B, C); // _08
};
#endif

View File

@ -7,6 +7,7 @@ struct J3DJos32Tree;
struct Vec;
struct J3DShape {
enum Flags { IsHidden = 0x1, Invalid = 0xFFFFFFFF };
virtual void draw() const; // _00
virtual void drawFast() const; // _04
virtual void simpleDraw() const; // _08
@ -24,7 +25,7 @@ struct J3DShape {
s32* _04; // _04
s16 m_id; // _08
u16 _0A; // _0A
u32 m_flags; // _0C
Flags m_flags; // _0C
f32 _10; // _10
f32 _14; // _14
f32 _18; // _18

11
include/P2JME/P2JME.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef _P2JME_P2JME_H
#define _P2JME_P2JME_H
#include "types.h"
namespace P2JME {
void convertU64ToMessageID(ulonglong, ulong*, ulong*);
void convertCharToMessageID(char*, ulong*, ulong*);
} // namespace P2JME
#endif

View File

@ -1,41 +1,110 @@
#ifndef _RESOURCE_H
#define _RESOURCE_H
struct Resource {
struct Mgr2D {
void init(struct JKRHeap*);
};
#include "CNode.h"
#include "DvdThreadCommand.h"
#include "IDelegate.h"
#include "JSystem/JKR/JKRDisposer.h"
struct Node {
~Node();
};
struct Graphics;
struct MgrCommand {
MgrCommand(char*);
~MgrCommand();
namespace ARAM {
struct Node;
} // namespace ARAM
void aramLoadCallBackFunc();
void becomeCurrentHeap();
void dvdLoadCallBackFunc();
void getResource();
void memoryCallBackFunc();
void releaseCurrentHeap();
void setModeInvalid();
void userCallBackInvoke();
};
namespace Resource {
struct MgrCommand;
struct Mgr {
Mgr(struct JKRHeap*, unsigned long);
struct Node : public CNode, JKRDisposer {
~Node();
void createNewNode(const char*);
void delFinishCommand();
void destroy(Resource::MgrCommand*);
void destroyAll();
void drawDump(struct Graphics&, int, int);
void loadResource(Resource::MgrCommand*, const char*, bool);
void searchCommand(Resource::MgrCommand*);
void sync(Resource::MgrCommand*, bool);
};
// Unused/inlined:
Node(char const*);
void dump();
void drawDump(Graphics&, int&, int&);
void becomeCurrentHeap();
static void destroy(Node*);
// CNode _00 - _18
// JKRDisposer _18 - _30
JKRHeap* _30; // _30
u8 m_groupIDMaybe; // _34
void* m_resource; // _38
MgrCommand* m_mgrCommand; // _3C
};
struct MgrCommand : public CNode, JKRDisposer {
MgrCommand(char*);
~MgrCommand();
void aramLoadCallBackFunc();
void becomeCurrentHeap();
void dvdLoadCallBackFunc();
void* getResource();
void memoryCallBackFunc();
void releaseCurrentHeap();
void setModeInvalid();
void userCallBackInvoke();
// Unused/inlined:
bool isFinish();
void setModeMemory(Node*);
void setModeAram(Node*, ARAM::Node*);
void setModeDvd(Node*);
bool destroy();
// CNode _00 - _18
// JKRDisposer _18 - _30
s32 _30; // _30
u8 _34; // _34
Node* _38; // _38
DvdThreadCommand _3C; // _3C
Node* _A8; // _A8
JKRHeap* _AC; // _AC
IDelegate1<MgrCommand*>* _B0; // _B0
Delegate<MgrCommand> _B4; // _B4
Delegate<MgrCommand> _C8; // _C8
Delegate<MgrCommand> _DC; // _DC
};
struct Mgr {
Mgr(JKRHeap*, ulong);
~Mgr();
virtual void drawDump(Graphics&, int, int); // _00
void createNewNode(const char*);
void delFinishCommand();
bool destroy(MgrCommand*);
void destroyAll();
void loadResource(MgrCommand*, const char*, bool);
void searchCommand(MgrCommand*);
void sync(MgrCommand*, bool);
// Unused/inlined:
void search(const char*);
void dump();
void syncAll(bool);
void watchHeap();
// VTBL _00
JKRHeap* _04; // _04
ulong _08; // _08
u32 _0C; // _0C
CNode _10; // _10
CNode _28; // _28
union {
u8 bytesView[4];
u32 dwordView;
} _40; // _40
};
struct Mgr2D : Mgr {
Mgr2D(JKRHeap*);
static void init(JKRHeap*);
};
} // namespace Resource
extern Resource::Mgr2D* gResMgr2D;
#endif

View File

@ -3,12 +3,16 @@
#include "Dolphin/gx.h"
#include "JSystem/JKR/JKRDisposer.h"
#include "JSystem/JUtility.h"
#include "Resource.h"
#include "Screen/Enums.h"
#include "types.h"
#include "CNode.h"
struct Controller;
struct Graphics;
struct JKRArchive;
struct JKRSolidHeap;
namespace og {
namespace Screen {
@ -21,6 +25,10 @@ struct MgrCommand;
} // namespace Resource
namespace Screen {
struct IObjBase;
struct ObjBase;
struct ObjMgrBase;
struct Mgr;
struct SceneArg {
virtual SceneType getSceneType(); // _00
@ -52,13 +60,26 @@ struct EndSceneArg : public SceneArg {
};
struct SceneBase {
#pragma enumalwaysint on
enum StateID {
Unknown0 = 0,
Unknown1,
Unknown2,
Unknown3,
Unknown4,
Invalid = 0xFFFFFFFF
};
#pragma enumalwaysint reset
SceneBase();
virtual SceneType getSceneType() = 0; // _00
virtual uint getOwnerID() = 0; // _04
virtual ulonglong getMemberID() = 0; // _08
virtual bool isUseBackupSceneInfo(); // _0C
virtual bool isDrawInDemo() const; // _10
virtual char* getResName() = 0; // _14
virtual void doCreateObj() = 0; // _18
virtual char* getResName() = 0; // _14
virtual void doCreateObj(JKRArchive*) = 0; // _18
virtual void doUserCallBackFunc(Resource::MgrCommand*); // _1C
virtual void setPort(Graphics&); // _20
virtual void doUpdateActive(); // _24
@ -70,6 +91,44 @@ struct SceneBase {
virtual bool setDefaultDispMember(); // _3C
virtual void doSetBackupScene(SetSceneArg&); // _40
virtual int doGetFinishState(); // _44
void confirmEndScene(EndSceneArg*);
void confirmSetScene(SetSceneArg&);
void confirmStartScene(StartSceneArg*);
void create();
void createObj(JKRArchive*);
void destroy();
void draw(Graphics&);
bool end(EndSceneArg*);
void endScene(EndSceneArg*);
int getFinishState();
Controller* getGamePad() const;
void registObj(ObjBase*, JKRArchive*);
IObjBase* searchObj(char*);
void setBackupScene();
void setColorBG(uchar, uchar, uchar, uchar);
void setScene(SetSceneArg&);
void setDispMember(og::Screen::DispMemberBase*);
bool start(StartSceneArg*);
void startScene(StartSceneArg*);
void update();
bool updateActive();
void userCallBackFunc(Resource::MgrCommand*);
// Unused/inlined:
u32 getBackupSceneType();
void setBGMode(int);
// VTBL _00
char m_name[256]; // _004
Controller* m_controller; // _104
Mgr* m_screenMgr; // _108
Delegate1<SceneBase, Resource::MgrCommand*> _10C; // _10C
StateID m_stateID; // _120
float m_someTime; // _124
Resource::MgrCommand m_command; // _128
ObjMgrBase* m_objMgr; // _218
u8* m_dispMemberBuffer; // _21C
};
struct IObjBase : public CNode, JKRDisposer {
@ -115,6 +174,62 @@ struct ObjBase : public IObjBase {
int _30; // _30
SceneBase* m_owner; // _34
};
struct MgrBase : public JKRDisposer {
virtual ~MgrBase(); // _00
virtual void setScene(SetSceneArg&) = 0; // _04
virtual bool startScene(StartSceneArg*) = 0; // _08
virtual void endScene(EndSceneArg*) = 0; // _0C
};
struct Mgr : public MgrBase {
Mgr();
virtual ~Mgr(); // _00
virtual void setScene(SetSceneArg&); // _04
virtual bool startScene(StartSceneArg*); // _08
virtual void endScene(EndSceneArg*); // _0C
virtual void reset(); // _10
virtual void setColorBG(JUtility::TColor&); // _14
virtual void setBGMode(int); // _18
virtual void doGetSceneBase(long); // _1C
virtual void drawBG(Graphics&); // _20
virtual void drawWipe(Graphics&); // _24
u8 _18; // _18
u8 _19; // _19
u8 _1A; // _1A
u8 _1B; // _1B
SceneBase* m_backupScene; // _1C
Controller* m_controller; // _20
u8 _24[8]; // _24
CNode _2C; // _2C
CNode _44; // _44
JKRSolidHeap* _5C; // _5C
CNode _60; // _60
CNode m_sceneInfoListNode; // _78
u8 _90; // _90
u8 _91; // _91
u8 _92; // _92
u32 _94; // _94
u32 _98; // _98
JUtility::TColor m_bgColor; // _9C
JUtility::TColor _A0; // _A0
int m_bgMode; // _A4
};
struct ObjMgrBase : public CNode {
ObjMgrBase();
bool confirmSetScene(SetSceneArg&);
bool confirmStartScene(StartSceneArg*);
bool confirmEndScene(EndSceneArg*);
void draw(Graphics&);
void registObj(IObjBase*, SceneBase*);
IObjBase* search(SceneBase*, char*);
bool start(StartSceneArg*);
bool update();
bool end(EndSceneArg*);
};
} // namespace Screen
#endif

View File

@ -57,48 +57,6 @@ struct DispMemberZukanItem;
namespace Screen {
struct SceneBase;
struct MgrBase : public JKRDisposer {
virtual ~MgrBase(); // _00
virtual void setScene(SetSceneArg&) = 0; // _04
virtual bool startScene(StartSceneArg*) = 0; // _08
virtual void endScene(EndSceneArg*) = 0; // _0C
};
struct Mgr : public MgrBase {
Mgr();
virtual ~Mgr(); // _00
virtual void setScene(SetSceneArg&); // _04
virtual bool startScene(StartSceneArg*); // _08
virtual void endScene(EndSceneArg*); // _0C
virtual void reset(); // _10
virtual void setColorBG(JUtility::TColor&); // _14
virtual void setBGMode(int); // _18
virtual void doGetSceneBase(long); // _1C
virtual void drawBG(Graphics&); // _20
virtual void drawWipe(Graphics&); // _24
u8 _18; // _18
u8 _19; // _19
u8 _1A; // _1A
u8 _1B; // _1B
SceneBase* m_backupScene; // _1C
Controller* controller; // _20
u8 _24[8]; // _24
CNode _2C; // _2C
CNode _44; // _44
JKRSolidHeap* _5C; // _5C
CNode _60; // _60
CNode m_sceneInfoListNode; // _78
u8 _90; // _90
u8 _91; // _91
u8 _92; // _92
u32 _94; // _94
u32 _98; // _98
JUtility::TColor m_bgColor; // _9C
JUtility::TColor _A0; // _A0
int m_bgMode; // _A4
};
struct Game2DMgr : public JKRDisposer {
enum GameOverTitle {};

View File

@ -11,7 +11,7 @@ struct JUTFader;
struct ISection : public JKRDisposer {
virtual ~ISection(); // _00
virtual void run() = 0; // _04
virtual void update() = 0; // _08
virtual bool update() = 0; // _08
virtual void draw(Graphics&) = 0; // _0C
virtual void init() = 0; // _10
};
@ -23,7 +23,7 @@ struct Section : public ISection {
virtual ~Section(); // _00
virtual void run(); // _04
virtual void update(); // _08
virtual bool update(); // _08
virtual void draw(Graphics&); // _0C
virtual void init(); // _10
virtual void drawInit(Graphics&); // _14
@ -44,6 +44,12 @@ struct Section : public ISection {
void endRender();
void exit();
// Unused/inlined:
void loading();
void fadeIn();
void main();
void fadeOut();
u32 _18; // _18
JKRHeap* _1C; // _1C
JKRHeap* _20; // _20

View File

@ -5,6 +5,7 @@
#include "SysShape/MtxObject.h"
struct J3DModel;
struct J3DModelData;
struct Matrixf;
namespace Sys {
struct Sphere;
@ -14,7 +15,7 @@ namespace SysShape {
struct Joint;
struct Model : MtxObject {
Model(struct J3DModelData*, unsigned long, unsigned long);
Model(J3DModelData*, ulong, ulong);
virtual Matrixf* getMatrix(); // _00
virtual bool isModel(); // _04
@ -38,11 +39,16 @@ struct Model : MtxObject {
void initJoints();
void initJointsRec(int, SysShape::Joint*);
void isMtxImmediate();
void setCurrentViewNo(unsigned long);
void setCurrentViewNo(ulong);
void setViewCalcModeImm();
void setViewCalcModeInd();
void viewCalc();
// Unused/inlined:
void entry(Sys::Sphere&);
void update();
bool needViewCalc();
// VTBL _00
u8 _04; // _04
u8 _05; // _05

View File

@ -62,7 +62,7 @@ struct System {
void deleteThreads();
struct JFWDisplay* setCurrentDisplay(struct JFWDisplay*);
u32 clearCurrentDisplay(struct JFWDisplay*);
void beginFrame();
bool beginFrame();
void endFrame();
void beginRender();
void endRender();

39
include/THP/THPRead.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef _THP_THPREAD_H
#define _THP_THPREAD_H
#include "Dolphin/os.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
typedef struct THPReadBuffer {
u32 _00;
} THPReadBuffer;
BOOL CreateReadThread(int);
void ReadThreadStart();
void ReadThreadCancel();
void Reader(void*);
OSMessage PopReadedBuffer();
BOOL PushReadedBuffer(OSMessage*);
OSMessage PopFreeReadBuffer();
BOOL PushFreeReadBuffer(OSMessage*);
OSMessage PopReadedBuffer2();
BOOL PushReadedBuffer2(OSMessage*);
extern BOOL ReadThreadCreated;
extern OSMessageQueue FreeReadBufferQueue;
extern OSMessageQueue ReadedBufferQueue;
extern OSMessageQueue ReadedBufferQueue2;
extern THPReadBuffer* FreeReadBufferMessage[10];
extern THPReadBuffer* ReadedBufferMessage[10];
extern THPReadBuffer* ReadedBufferMessage2[10];
extern OSThread ReadThread;
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,32 @@
#ifndef _THP_THPVIDEODECODE_H
#define _THP_THPVIDEODECODE_H
#include "Dolphin/os.h"
#include "THP/THPRead.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
BOOL CreateVideoDecodeThread(int, void*);
void VideoDecodeThreadStart();
void VideoDecodeThreadCancel();
void VideoDecoder(void*);
void VideoDecoderForOnMemory(void*);
void VideoDecode(THPReadBuffer*);
OSMessage PopFreeTextureSet();
BOOL PushFreeTextureSet(OSMessage*);
OSMessage PopDecodedTextureSet();
BOOL PushDecodedTextureSet(OSMessage*);
extern BOOL VideoDecodeThreadCreated;
extern OSMessageQueue FreeTextureSetQueue;
extern OSMessageQueue DecodedTextureSetQueue;
extern OSThread VideoDecodeThread;
#ifdef __cplusplus
};
#endif
#endif

View File

@ -1,4 +1,5 @@
#include "Dolphin/ctype.h"
#include "types.h"
enum ctype __ctype_map[256] = { CTYPE_CNTRL,
CTYPE_CNTRL,
@ -346,9 +347,10 @@ int tolower(int __c)
* Address: ........
* Size: 000018
*/
void isxdigit(void)
BOOL isxdigit(unsigned char c)
{
// UNUSED FUNCTION
return (__ctype_map[c] & CTYPE_XDIGIT) != 0;
}
/*
@ -416,10 +418,10 @@ void isgraph(void)
* Address: ........
* Size: 000018
*/
void isdigit(void)
{
// UNUSED FUNCTION
}
// BOOL isdigit(int c)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--

View File

@ -1,12 +1,25 @@
#include "THP/THPRead.h"
#include "THP/THPVideoDecode.h"
#include "Dolphin/os.h"
#include "types.h"
/*
* --INFO--
* Address: 8044F58C
* Size: 0000A0
*/
void CreateReadThread(void)
BOOL CreateReadThread(int priority)
{
BOOL created = OSCreateThread(&ReadThread, Reader, nullptr,
&VideoDecodeThread, 0x1000, priority, 1);
if (created) {
OSInitMessageQueue(&FreeReadBufferQueue, &FreeReadBufferMessage, 10);
OSInitMessageQueue(&ReadedBufferQueue, &ReadedBufferMessage, 10);
OSInitMessageQueue(&ReadedBufferQueue2, &ReadedBufferMessage2, 10);
ReadThreadCreated = TRUE;
}
return created != FALSE;
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -61,8 +74,11 @@ void CreateReadThread(void)
* Address: 8044F62C
* Size: 000034
*/
void ReadThreadStart(void)
void ReadThreadStart()
{
if (ReadThreadCreated != FALSE) {
OSResumeThread(&ReadThread);
}
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -88,8 +104,12 @@ void ReadThreadStart(void)
* Address: 8044F660
* Size: 00003C
*/
void ReadThreadCancel(void)
void ReadThreadCancel()
{
if (ReadThreadCreated != FALSE) {
OSCancelThread(&ReadThread);
ReadThreadCreated = FALSE;
}
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -200,8 +220,11 @@ void Reader(void*)
* Address: 8044F788
* Size: 000034
*/
void PopReadedBuffer(void)
OSMessage PopReadedBuffer()
{
OSMessage msg;
OSReceiveMessage(&ReadedBufferQueue, msg, MSG_QUEUE_SHOULD_BLOCK);
return msg;
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -225,8 +248,9 @@ void PopReadedBuffer(void)
* Address: 8044F7BC
* Size: 000030
*/
void PushReadedBuffer(void)
BOOL PushReadedBuffer(OSMessage* msg)
{
return OSSendMessage(&ReadedBufferQueue, msg, MSG_QUEUE_SHOULD_BLOCK);
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -249,8 +273,11 @@ void PushReadedBuffer(void)
* Address: 8044F7EC
* Size: 000034
*/
void PopFreeReadBuffer(void)
OSMessage PopFreeReadBuffer()
{
OSMessage msg;
OSReceiveMessage(&FreeReadBufferQueue, msg, MSG_QUEUE_SHOULD_BLOCK);
return msg;
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -274,7 +301,7 @@ void PopFreeReadBuffer(void)
* Address: 8044F820
* Size: 000030
*/
void PushFreeReadBuffer(void)
BOOL PushFreeReadBuffer(OSMessage*)
{
/*
.loc_0x0:
@ -298,7 +325,7 @@ void PushFreeReadBuffer(void)
* Address: 8044F850
* Size: 000034
*/
void PopReadedBuffer2(void)
OSMessage PopReadedBuffer2()
{
/*
.loc_0x0:
@ -323,7 +350,7 @@ void PopReadedBuffer2(void)
* Address: 8044F884
* Size: 000030
*/
void PushReadedBuffer2(void)
BOOL PushReadedBuffer2(OSMessage*)
{
/*
.loc_0x0:

View File

@ -1,11 +1,12 @@
#include "THP/THPVideoDecode.h"
#include "types.h"
/*
* --INFO--
* Address: 8044F8B4
* Size: 0000D8
*/
void CreateVideoDecodeThread(void)
BOOL CreateVideoDecodeThread(int priority, void* taskMaybe)
{
/*
.loc_0x0:
@ -318,7 +319,7 @@ void VideoDecoderForOnMemory(void*)
* Address: 8044FBF8
* Size: 000120
*/
void VideoDecode(THPReadBuffer*)
void VideoDecode(THPReadBuffer* buffer)
{
/*
.loc_0x0:
@ -418,7 +419,7 @@ void VideoDecode(THPReadBuffer*)
* Address: 8044FD18
* Size: 000034
*/
void PopFreeTextureSet(void)
OSMessage PopFreeTextureSet()
{
/*
.loc_0x0:
@ -443,7 +444,7 @@ void PopFreeTextureSet(void)
* Address: 8044FD4C
* Size: 000030
*/
void PushFreeTextureSet(void)
BOOL PushFreeTextureSet(OSMessage* msg)
{
/*
.loc_0x0:
@ -467,7 +468,7 @@ void PushFreeTextureSet(void)
* Address: 8044FD7C
* Size: 000044
*/
void PopDecodedTextureSet(void)
OSMessage PopDecodedTextureSet()
{
/*
.loc_0x0:
@ -500,7 +501,7 @@ void PopDecodedTextureSet(void)
* Address: 8044FDC0
* Size: 000030
*/
void PushDecodedTextureSet(void)
BOOL PushDecodedTextureSet(OSMessage* msg)
{
/*
.loc_0x0:

View File

@ -1,3 +1,5 @@
#include "Dolphin/ctype.h"
#include "P2JME/P2JME.h"
#include "types.h"
/*
@ -11,8 +13,10 @@ namespace P2JME {
* Address: 8043D32C
* Size: 000048
*/
void convertU64ToMessageID(unsigned long long, unsigned long*, unsigned long*)
void convertU64ToMessageID(ulonglong inID, ulong* messageID, ulong* variantID)
{
ulonglong temp = inID << 8;
convertCharToMessageID((char*)(temp), messageID, variantID);
/*
stwu r1, -0x10(r1)
mflr r0
@ -40,8 +44,28 @@ void convertU64ToMessageID(unsigned long long, unsigned long*, unsigned long*)
* Address: 8043D374
* Size: 000128
*/
void convertCharToMessageID(char*, unsigned long*, unsigned long*)
void convertCharToMessageID(char* str, ulong* messageID, ulong* variantID)
{
*variantID = 0;
*messageID = 0;
if (isdigit(str[0])) {
*messageID = *messageID * 10 + str[0] - '0';
}
if (isdigit(str[1])) {
*messageID = *messageID * 10 + str[1] - '0';
}
if (isdigit(str[2])) {
*messageID = *messageID * 10 + str[2] - '0';
}
if (isdigit(str[3])) {
*messageID = *messageID * 10 + str[3] - '0';
}
if (isdigit(str[5])) {
*variantID = *variantID * 10 + str[5] - '0';
}
if (isdigit(str[6])) {
*variantID = *variantID * 10 + str[6] - '0';
}
/*
li r0, 0
lis r6, __ctype_map@ha

View File

@ -1,3 +1,9 @@
#include "ARAM.h"
#include "JSystem/JKR/JKRDvdRipper.h"
#include "JSystem/JKR/JKRExpandSwitch.h"
#include "JSystem/JKR/JKRHeap.h"
#include "JSystem/JUT/JUTException.h"
#include "Resource.h"
#include "types.h"
/*
@ -92,6 +98,10 @@ Resource::Node::Node(char const*)
*/
Resource::Node::~Node(void)
{
P2ASSERTLINE(99, m_mgrCommand != nullptr);
P2ASSERTLINE(101, m_mgrCommand->_38 == this);
m_mgrCommand->setModeInvalid();
del();
/*
stwu r1, -0x10(r1)
mflr r0
@ -185,16 +195,22 @@ void Resource::Node::drawDump(Graphics&, int&, int&)
void Resource::Node::becomeCurrentHeap(void)
{
// UNUSED FUNCTION
_30->becomeCurrentHeap();
_30->changeGroupID(m_groupIDMaybe);
}
/*
* @matchedSize
* --INFO--
* Address: ........
* Size: 000030
*/
void Resource::Node::destroy(Resource::Node*)
void Resource::Node::destroy(Resource::Node* node)
{
// UNUSED FUNCTION
if (node != nullptr) {
((JKRExpHeap*)node->_30)->freeGroup(node->m_groupIDMaybe);
}
}
/*
@ -202,99 +218,29 @@ void Resource::Node::destroy(Resource::Node*)
* Address: 804331B4
* Size: 000138
*/
Resource::MgrCommand::MgrCommand(char*)
Resource::MgrCommand::MgrCommand(char* name)
: CNode(name)
, JKRDisposer()
, _3C()
, _AC(nullptr)
, _B0(nullptr)
, _B4(this, &MgrCommand::memoryCallBackFunc)
, _C8(this, &MgrCommand::dvdLoadCallBackFunc)
, _DC(this, &MgrCommand::aramLoadCallBackFunc)
{
/*
stwu r1, -0x40(r1)
mflr r0
lis r5, __vt__5CNode@ha
stw r0, 0x44(r1)
addi r0, r5, __vt__5CNode@l
stw r31, 0x3c(r1)
stw r30, 0x38(r1)
mr r30, r3
lis r3, lbl_804EC3D8@ha
stw r0, 0(r30)
li r0, 0
addi r31, r3, lbl_804EC3D8@l
addi r3, r30, 0x18
stw r0, 0x10(r30)
stw r0, 0xc(r30)
stw r0, 8(r30)
stw r0, 4(r30)
stw r4, 0x14(r30)
bl __ct__11JKRDisposerFv
lis r4, __vt__Q28Resource10MgrCommand@ha
addi r3, r30, 0x3c
addi r4, r4, __vt__Q28Resource10MgrCommand@l
stw r4, 0(r30)
addi r0, r4, 0x10
stw r0, 0x18(r30)
bl __ct__16DvdThreadCommandFv
li r0, 0
lis r3, __vt__9IDelegate@ha
stw r0, 0xac(r30)
lis r4, "__vt__33Delegate<Q28Resource10MgrCommand>"@ha
addi r10, r3, __vt__9IDelegate@l
mr r3, r30
stw r0, 0xb0(r30)
addi r9, r4, "__vt__33Delegate<Q28Resource10MgrCommand>"@l
lwz r4, 0(r31)
lwz r0, 4(r31)
lwz r11, 8(r31)
stw r4, 0x20(r1)
stw r10, 0xb4(r30)
stw r9, 0xb4(r30)
stw r30, 0xb8(r30)
stw r4, 0xbc(r30)
stw r0, 0xc0(r30)
stw r11, 0xc4(r30)
lwz r8, 0xc(r31)
lwz r7, 0x10(r31)
lwz r6, 0x14(r31)
stw r0, 0x24(r1)
stw r10, 0xc8(r30)
stw r9, 0xc8(r30)
stw r30, 0xcc(r30)
stw r8, 0xd0(r30)
stw r7, 0xd4(r30)
stw r6, 0xd8(r30)
lwz r5, 0x18(r31)
lwz r4, 0x1c(r31)
lwz r0, 0x20(r31)
stw r11, 0x28(r1)
stw r10, 0xdc(r30)
stw r9, 0xdc(r30)
stw r30, 0xe0(r30)
stw r5, 0xe4(r30)
stw r4, 0xe8(r30)
stw r8, 0x14(r1)
stw r7, 0x18(r1)
stw r6, 0x1c(r1)
stw r5, 8(r1)
stw r4, 0xc(r1)
stw r0, 0x10(r1)
stw r0, 0xec(r30)
bl setModeInvalid__Q28Resource10MgrCommandFv
lwz r0, 0x44(r1)
mr r3, r30
lwz r31, 0x3c(r1)
lwz r30, 0x38(r1)
mtlr r0
addi r1, r1, 0x40
blr
*/
setModeInvalid();
}
/*
* Generated?
* --INFO--
* Address: ........
* Size: 000064
*/
void __dt__Q38Resource10MgrCommand26 @class$2436resourceMgr_cppFv(void)
{
// UNUSED FUNCTION
}
// void __dt__Q38Resource10MgrCommand26 @class$2436resourceMgr_cppFv(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
@ -360,44 +306,16 @@ lbl_80433388:
}
/*
* becomeCurrentHeap__Q28Resource10MgrCommandFv
* --INFO--
* Address: 804333A4
* Size: 000070
*/
void Resource::MgrCommand::becomeCurrentHeap(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
lwz r0, 0x30(r3)
cmpwi r0, -1
bne lbl_804333E0
lis r3, lbl_8049A640@ha
lis r5, lbl_8049A650@ha
addi r3, r3, lbl_8049A640@l
li r4, 0xbb
addi r5, r5, lbl_8049A650@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
lbl_804333E0:
lwz r0, sCurrentHeap__7JKRHeap@sda21(r13)
stw r0, 0xac(r31)
lwz r31, 0x38(r31)
lwz r3, 0x30(r31)
bl becomeCurrentHeap__7JKRHeapFv
lwz r3, 0x30(r31)
lbz r4, 0x34(r31)
bl changeGroupID__7JKRHeapFUc
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
P2ASSERTLINE(187, _30 != -1);
_AC = JKRHeap::sCurrentHeap;
_38->becomeCurrentHeap();
}
/*
@ -407,46 +325,10 @@ lbl_804333E0:
*/
void Resource::MgrCommand::releaseCurrentHeap(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
lwz r0, 0x30(r3)
cmpwi r0, -1
bne lbl_80433450
lis r3, lbl_8049A640@ha
lis r5, lbl_8049A650@ha
addi r3, r3, lbl_8049A640@l
li r4, 0xc7
addi r5, r5, lbl_8049A650@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
lbl_80433450:
lwz r0, 0xac(r31)
cmplwi r0, 0
bne lbl_80433478
lis r3, lbl_8049A640@ha
lis r5, lbl_8049A650@ha
addi r3, r3, lbl_8049A640@l
li r4, 0xc9
addi r5, r5, lbl_8049A650@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
lbl_80433478:
lwz r3, 0xac(r31)
bl becomeCurrentHeap__7JKRHeapFv
li r0, 0
stw r0, 0xac(r31)
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
P2ASSERTLINE(199, _30 != -1);
P2ASSERTLINE(201, _AC != nullptr);
_AC->becomeCurrentHeap();
_AC = nullptr;
}
/*
@ -454,7 +336,7 @@ lbl_80433478:
* Address: ........
* Size: 0000E8
*/
void Resource::MgrCommand::isFinish(void)
bool Resource::MgrCommand::isFinish(void)
{
// UNUSED FUNCTION
}
@ -464,8 +346,9 @@ void Resource::MgrCommand::isFinish(void)
* Address: 8043349C
* Size: 00000C
*/
void Resource::MgrCommand::getResource(void)
void* Resource::MgrCommand::getResource(void)
{
return _38->m_resource;
/*
lwz r3, 0x38(r3)
lwz r3, 0x38(r3)
@ -510,15 +393,10 @@ void Resource::MgrCommand::setModeDvd(Resource::Node*)
*/
void Resource::MgrCommand::setModeInvalid(void)
{
/*
li r4, -1
li r0, 0
stw r4, 0x30(r3)
stw r0, 0x38(r3)
stb r0, 0x34(r3)
stw r0, 0xb0(r3)
blr
*/
_30 = -1;
_38 = nullptr;
_34 = 0;
_B0 = nullptr;
}
/*
@ -526,28 +404,10 @@ void Resource::MgrCommand::setModeInvalid(void)
* Address: 804334C4
* Size: 000048
*/
void Resource::MgrCommand::memoryCallBackFunc(void)
void Resource::MgrCommand::memoryCallBackFunc()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r4, 0x38(r3)
lwz r3, 0x30(r4)
lbz r4, 0x34(r4)
bl changeGroupID__7JKRHeapFUc
lis r3, lbl_8049A640@ha
lis r5, lbl_8049A65C@ha
addi r3, r3, lbl_8049A640@l
li r4, 0x157
addi r5, r5, lbl_8049A65C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
_38->_30->changeGroupID(_38->m_groupIDMaybe);
JUT_PANICLINE(343, "有りえない状態でございます \n");
}
/*
@ -557,48 +417,14 @@ void Resource::MgrCommand::memoryCallBackFunc(void)
*/
void Resource::MgrCommand::aramLoadCallBackFunc(void)
{
/*
stwu r1, -0x20(r1)
mflr r0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r3
lwz r4, 0x38(r3)
lwz r3, 0x30(r4)
lbz r4, 0x34(r4)
bl changeGroupID__7JKRHeapFUc
li r0, 1
li r3, -1
stw r0, 8(r1)
li r0, 0
li r5, 0
li r6, 0
stw r3, 0xc(r1)
li r7, 0
li r8, 1
li r9, 0
stw r0, 0x10(r1)
lwz r4, 0xa8(r31)
lwz r10, 0x38(r31)
lwz r3, gAramMgr@sda21(r13)
lwz r4, 0x14(r4)
lwz r10, 0x30(r10)
bl
aramToMainRam__Q24ARAM3MgrFPCcPUcUlUl15JKRExpandSwitchUlP7JKRHeapQ212JKRDvdRipper15EAllocDirectioniPUl
cmplwi r3, 0
beq lbl_8043358C
lwz r4, 0x38(r31)
stw r3, 0x38(r4)
mr r3, r31
bl userCallBackInvoke__Q28Resource10MgrCommandFv
lbl_8043358C:
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
mtlr r0
addi r1, r1, 0x20
blr
*/
_38->_30->changeGroupID(_38->m_groupIDMaybe);
void* resource = gAramMgr->aramToMainRam(
_A8->m_name, nullptr, 0, 0, Switch_1, 0, _38->_30,
JKRDvdRipper::AllocDirection_1, -1, nullptr);
if (resource != nullptr) {
_38->m_resource = resource;
userCallBackInvoke();
}
}
/*
@ -673,39 +499,13 @@ lbl_80433640:
*/
void Resource::MgrCommand::userCallBackInvoke(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
stw r30, 8(r1)
mr r30, r3
lwz r0, 0xb0(r3)
cmplwi r0, 0
beq lbl_804336B8
lwz r3, 0x38(r30)
lwz r31, sCurrentHeap__7JKRHeap@sda21(r13)
lwz r3, 0x30(r3)
bl becomeCurrentHeap__7JKRHeapFv
lwz r3, 0xb0(r30)
mr r4, r30
lwz r12, 0(r3)
lwz r12, 8(r12)
mtctr r12
bctrl
li r0, 0
mr r3, r31
stw r0, 0xb0(r30)
bl becomeCurrentHeap__7JKRHeapFv
lbl_804336B8:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
if (_B0 != nullptr) {
JKRHeap* existingCurrentHeap = JKRHeap::sCurrentHeap;
_38->_30->becomeCurrentHeap();
_B0->invoke(this);
_B0 = nullptr;
existingCurrentHeap->becomeCurrentHeap();
}
}
/*
@ -713,18 +513,55 @@ lbl_804336B8:
* Address: ........
* Size: 000070
*/
void Resource::MgrCommand::destroy(void)
bool Resource::MgrCommand::destroy()
{
// UNUSED FUNCTION
bool result = false;
if (_30 != -1) {
if (_38 != nullptr) {
Node::destroy(_38);
_30 = -1;
result = true;
_38 = nullptr;
_34 = 0;
_B0 = nullptr;
}
}
return result;
}
/*
* __ct__Q28Resource3MgrFP7JKRHeapUl
* --INFO--
* Address: 804336D0
* Size: 00010C
*/
Resource::Mgr::Mgr(JKRHeap*, unsigned long)
Resource::Mgr::Mgr(JKRHeap* heap, ulong size)
: _04(nullptr)
, _08(0)
, _0C(0)
, _10()
, _28()
{
_40.bytesView[0] = 0;
_40.bytesView[1] = 0;
_40.bytesView[2] = 0;
_40.bytesView[3] = 0;
JKRHeap* existingCurrentHeap = JKRHeap::sCurrentHeap;
if (heap == nullptr) {
heap = JKRHeap::sCurrentHeap;
}
_04 = JKRExpHeap::create(size, heap, true);
P2ASSERTLINE(487, _04 != nullptr);
_08 = size;
_0C = _08;
_40.bytesView[0] = 0;
_40.bytesView[1] = 0;
_40.bytesView[2] = 0;
_40.bytesView[3] = 0;
_40.dwordView &= -2;
existingCurrentHeap->becomeCurrentHeap();
/*
stwu r1, -0x20(r1)
mflr r0
@ -1091,46 +928,14 @@ lbl_80433B08:
}
/*
* destroy__Q28Resource3MgrFPQ28Resource10MgrCommand
* --INFO--
* Address: 80433B1C
* Size: 000070
*/
void Resource::Mgr::destroy(Resource::MgrCommand*)
bool Resource::Mgr::destroy(Resource::MgrCommand* command)
{
/*
stwu r1, -0x10(r1)
mflr r0
li r3, 0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
lwz r0, 0x30(r4)
cmpwi r0, -1
beq lbl_80433B78
lwz r4, 0x38(r31)
cmplwi r4, 0
beq lbl_80433B78
beq lbl_80433B5C
lwz r3, 0x30(r4)
lbz r4, 0x34(r4)
bl freeGroup__10JKRExpHeapFUc
lbl_80433B5C:
li r3, -1
li r0, 0
stw r3, 0x30(r31)
li r3, 1
stw r0, 0x38(r31)
stb r0, 0x34(r31)
stw r0, 0xb0(r31)
lbl_80433B78:
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
return command->destroy();
}
/*
@ -1140,6 +945,13 @@ lbl_80433B78:
*/
void Resource::Mgr::destroyAll(void)
{
Node* parent;
Node* child = (Node*)_10._10;
while (parent = child, parent != nullptr) {
child = (Node*)parent->_04;
Node::destroy(parent);
}
_04->freeAll();
/*
stwu r1, -0x10(r1)
mflr r0
@ -1511,50 +1323,51 @@ void Resource::Mgr::watchHeap(void)
}
/*
* Generated?
* --INFO--
* Address: 80433F30
* Size: 000030
*/
void Delegate<Resource::MgrCommand>::invoke()
{
/*
stwu r1, -0x10(r1)
mflr r0
mr r4, r3
stw r0, 0x14(r1)
addi r12, r4, 8
lwz r3, 4(r3)
bl __ptmf_scall
nop
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// void Delegate<Resource::MgrCommand>::invoke()
// {
// /*
// stwu r1, -0x10(r1)
// mflr r0
// mr r4, r3
// stw r0, 0x14(r1)
// addi r12, r4, 8
// lwz r3, 4(r3)
// bl __ptmf_scall
// nop
// lwz r0, 0x14(r1)
// mtlr r0
// addi r1, r1, 0x10
// blr
// */
// }
/*
* --INFO--
* Address: 80433F60
* Size: 000008
*/
@24 @Resource::Node::~Node(void)
{
/*
addi r3, r3, -24
b __dt__Q28Resource4NodeFv
*/
}
// /*
// * --INFO--
// * Address: 80433F60
// * Size: 000008
// */
// @24 @Resource::Node::~Node(void)
// {
// /*
// addi r3, r3, -24
// b __dt__Q28Resource4NodeFv
// */
// }
/*
* --INFO--
* Address: 80433F68
* Size: 000008
*/
@24 @Resource::MgrCommand::~MgrCommand(void)
{
/*
addi r3, r3, -24
b __dt__Q28Resource10MgrCommandFv
*/
}
// /*
// * --INFO--
// * Address: 80433F68
// * Size: 000008
// */
// @24 @Resource::MgrCommand::~MgrCommand(void)
// {
// /*
// addi r3, r3, -24
// b __dt__Q28Resource10MgrCommandFv
// */
// }

View File

@ -1,3 +1,5 @@
#include "JSystem/JUT/JUTException.h"
#include "Resource.h"
#include "types.h"
/*
@ -27,14 +29,20 @@
.skip 0x8
*/
Resource::Mgr2D* gResMgr2D;
/*
* --INFO--
* Address: ........
* Size: 0000A0
*/
Resource::Mgr2D::Mgr2D(JKRHeap*)
Resource::Mgr2D::Mgr2D(JKRHeap* heap)
: Mgr(heap, 0xD4800)
{
// UNUSED FUNCTION
P2ASSERTLINE(34, heap != nullptr);
// oldGlobalMgr = mgr;
P2ASSERTLINE(36, gResMgr2D == nullptr);
}
/*
@ -52,8 +60,14 @@ Resource::Mgr::~Mgr(void)
* Address: 80433F70
* Size: 0000B0
*/
void Resource::Mgr2D::init(JKRHeap*)
void Resource::Mgr2D::init(JKRHeap* heap)
{
// Mgr2D* oldGlobalMgr = gResMgr2D;
// oldGlobalMgr = new Mgr2D(heap);
// Mgr2D* newMgr = new Mgr2D(heap);
// gResMgr2D = newMgr;
// gResMgr2D = oldGlobalMgr;
gResMgr2D = new Mgr2D(heap);
/*
stwu r1, -0x10(r1)
mflr r0

View File

@ -1,4 +1,10 @@
#include "Dolphin/stl.h"
#include "IDelegate.h"
#include "JSystem/JUT/JUTException.h"
#include "JSystem/JUtility.h"
#include "og/newScreen/ogUtil.h"
#include "Screen/Bases.h"
#include "System.h"
#include "types.h"
/*
@ -84,7 +90,19 @@ namespace Screen {
* Size: 000134
*/
SceneBase::SceneBase(void)
: m_controller(nullptr)
, m_screenMgr(nullptr)
, _10C(this, &SceneBase::userCallBackFunc)
, m_stateID(Unknown0)
, m_command("no name")
, m_objMgr(nullptr)
{
m_objMgr = new ObjMgrBase();
m_dispMemberBuffer = new u8[0x400];
P2ASSERTLINE(113, m_dispMemberBuffer != nullptr);
DispMemberDummy dummy;
memcpy(m_dispMemberBuffer, dummy, sizeof(dummy));
sprintf(m_name, "???");
/*
stwu r1, -0x30(r1)
mflr r0
@ -164,8 +182,9 @@ lbl_8045186C:
* Address: 804518C4
* Size: 000030
*/
void SceneBase::searchObj(char*)
IObjBase* SceneBase::searchObj(char* name)
{
return m_objMgr->search(this, name);
/*
stwu r1, -0x10(r1)
mflr r0
@ -189,6 +208,9 @@ void SceneBase::searchObj(char*)
*/
void SceneBase::destroy(void)
{
if (m_command._30 != -1) {
gResMgr2D->destroy(&m_command);
}
/*
stwu r1, -0x10(r1)
mflr r0
@ -216,6 +238,17 @@ lbl_8045191C:
*/
void SceneBase::create(void)
{
if (m_command._30 == -1) {
m_someTime = sys->getTime();
m_command._B0 = &_10C;
if (getResName()[0] == '\0') {
gResMgr2D->loadResource(&m_command, "", true);
} else {
og::newScreen::makeLanguageResName(m_name, getResName());
gResMgr2D->loadResource(&m_command, m_name, true);
}
m_stateID = Unknown1;
}
/*
stwu r1, -0x10(r1)
mflr r0
@ -280,6 +313,38 @@ lbl_804519D4:
*/
void SceneBase::update(void)
{
switch (m_stateID) {
case Unknown0:
break;
case Unknown1:
if (gResMgr2D->sync(&m_command, false) != '\0') {
if (getResName()[0] != '\0') {
void* res = m_command.getResource();
P2ASSERTLINE(194, res != nullptr);
m_command.becomeCurrentHeap();
JKRArchive* archive = JKRArchive::mount(res, nullptr, 1);
P2ASSERTLINE(197, archive != nullptr);
createObj(archive);
m_command.releaseCurrentHeap();
}
m_stateID = Unknown2;
sys->getTime();
}
break;
case Unknown2:
break;
case Unknown3:
if (updateActive()) {
m_stateID = Unknown4;
}
break;
case Unknown4:
break;
default:
case Invalid:
JUTException::panic_f(__FILE__, 226, "P2Assert");
break;
}
/*
stwu r1, -0x10(r1)
mflr r0
@ -392,8 +457,10 @@ lbl_80451B2C:
* Address: 80451B44
* Size: 000040
*/
void SceneBase::updateActive(void)
bool SceneBase::updateActive(void)
{
doUpdateActive();
m_objMgr->update();
/*
stwu r1, -0x10(r1)
mflr r0
@ -426,8 +493,21 @@ void SceneBase::doUpdateActive(void) { }
* Address: 80451B88
* Size: 000090
*/
void SceneBase::draw(Graphics&)
void SceneBase::draw(Graphics& gfx)
{
switch (m_stateID) {
case Unknown0:
case Unknown1:
case Unknown2:
return;
case Unknown3:
case Unknown4:
setPort(gfx);
m_objMgr->draw(gfx);
return;
default:
JUT_PANICLINE(285, "P2Assert");
}
/*
stwu r1, -0x10(r1)
mflr r0
@ -479,8 +559,13 @@ lbl_80451C00:
* Address: 80451C18
* Size: 000050
*/
void SceneBase::start(Screen::StartSceneArg*)
bool SceneBase::start(Screen::StartSceneArg* arg)
{
if (m_stateID == Unknown0 || m_stateID == Unknown1) {
return false;
}
m_stateID = Unknown3;
return doStart(arg);
/*
stwu r1, -0x10(r1)
mflr r0
@ -514,8 +599,10 @@ lbl_80451C58:
* Address: 80451C68
* Size: 000028
*/
void SceneBase::doStart(Screen::StartSceneArg*)
bool SceneBase::doStart(Screen::StartSceneArg* arg)
{
m_objMgr->start(arg);
return true;
/*
stwu r1, -0x10(r1)
mflr r0
@ -535,8 +622,18 @@ void SceneBase::doStart(Screen::StartSceneArg*)
* Address: 80451C90
* Size: 000068
*/
void SceneBase::end(Screen::EndSceneArg*)
bool SceneBase::end(Screen::EndSceneArg* arg)
{
switch (m_stateID) {
case Unknown0:
case Unknown2:
m_stateID = Unknown4;
return true;
case Unknown1:
return false;
default:
return doEnd(arg);
}
/*
stwu r1, -0x10(r1)
mflr r0
@ -580,8 +677,9 @@ lbl_80451CE4:
* Address: 80451CF8
* Size: 000024
*/
void SceneBase::doEnd(Screen::EndSceneArg*)
bool SceneBase::doEnd(Screen::EndSceneArg* arg)
{
m_objMgr->end(arg);
/*
stwu r1, -0x10(r1)
mflr r0
@ -600,8 +698,9 @@ void SceneBase::doEnd(Screen::EndSceneArg*)
* Address: 80451D1C
* Size: 00002C
*/
void SceneBase::userCallBackFunc(Resource::MgrCommand*)
void SceneBase::userCallBackFunc(Resource::MgrCommand* command)
{
doUserCallBackFunc(command);
/*
stwu r1, -0x10(r1)
mflr r0
@ -622,8 +721,9 @@ void SceneBase::userCallBackFunc(Resource::MgrCommand*)
* Address: 80451D48
* Size: 00002C
*/
void SceneBase::createObj(JKRArchive*)
void SceneBase::createObj(JKRArchive* archive)
{
doCreateObj(archive);
/*
stwu r1, -0x10(r1)
mflr r0
@ -644,8 +744,10 @@ void SceneBase::createObj(JKRArchive*)
* Address: 80451D74
* Size: 00005C
*/
void SceneBase::registObj(Screen::ObjBase*, JKRArchive*)
void SceneBase::registObj(Screen::ObjBase* obj, JKRArchive* archive)
{
m_objMgr->registObj(obj, this);
obj->create(*archive);
/*
stwu r1, -0x10(r1)
mflr r0
@ -805,8 +907,9 @@ lbl_80451F14:
* Address: 80451F30
* Size: 000030
*/
void SceneBase::setScene(Screen::SetSceneArg&)
void SceneBase::setScene(Screen::SetSceneArg& arg)
{
m_screenMgr->setScene(arg);
/*
stwu r1, -0x10(r1)
mflr r0
@ -828,8 +931,9 @@ void SceneBase::setScene(Screen::SetSceneArg&)
* Address: 80451F60
* Size: 000030
*/
void SceneBase::startScene(Screen::StartSceneArg*)
void SceneBase::startScene(Screen::StartSceneArg* arg)
{
m_screenMgr->startScene(arg);
/*
stwu r1, -0x10(r1)
mflr r0
@ -851,8 +955,9 @@ void SceneBase::startScene(Screen::StartSceneArg*)
* Address: 80451F90
* Size: 000030
*/
void SceneBase::endScene(Screen::EndSceneArg*)
void SceneBase::endScene(Screen::EndSceneArg* arg)
{
m_screenMgr->endScene(arg);
/*
stwu r1, -0x10(r1)
mflr r0
@ -953,7 +1058,7 @@ lbl_804520A0:
* Address: ........
* Size: 000020
*/
void SceneBase::getBackupSceneType(void)
u32 SceneBase::getBackupSceneType()
{
// UNUSED FUNCTION
}
@ -1056,8 +1161,9 @@ lbl_804521D8:
* Address: 804521F0
* Size: 000040
*/
void SceneBase::getFinishState(void)
int SceneBase::getFinishState()
{
return (m_stateID == 4) ? doGetFinishState() : -2;
/*
stwu r1, -0x10(r1)
mflr r0
@ -1087,8 +1193,10 @@ lbl_80452220:
* Address: 80452230
* Size: 000054
*/
void SceneBase::getGamePad() const
Controller* SceneBase::getGamePad() const
{
P2ASSERTLINE(280, m_screenMgr->m_controller != nullptr);
return m_screenMgr->m_controller;
/*
stwu r1, -0x10(r1)
mflr r0
@ -1121,9 +1229,10 @@ lbl_8045226C:
* Address: 80452284
* Size: 000044
*/
void SceneBase::setColorBG(unsigned char, unsigned char, unsigned char,
unsigned char)
void SceneBase::setColorBG(uchar r, uchar g, uchar b, uchar a)
{
JUtility::TColor color(r, g, b, a);
m_screenMgr->setColorBG(color);
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -1173,26 +1282,27 @@ void Mgr::setBGMode(int) { }
} // namespace Screen
/*
* Generated
* --INFO--
* Address: 804522D0
* Size: 000030
*/
void Delegate1<Screen::SceneBase, Resource::MgrCommand*>::invoke(
Resource::MgrCommand*)
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r5, r3
stw r0, 0x14(r1)
addi r12, r5, 0x8
lwz r3, 0x4(r3)
bl -0x3907C4
nop
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
// void Delegate1<Screen::SceneBase, Resource::MgrCommand*>::invoke(
// Resource::MgrCommand*)
// {
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
mr r5, r3
stw r0, 0x14(r1)
addi r12, r5, 0x8
lwz r3, 0x4(r3)
bl -0x3907C4
nop
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
// }

View File

@ -1,4 +1,7 @@
#include "Section.h"
#include "JSystem/JKR/JKRHeap.h"
#include "JSystem/JUT/JUTException.h"
#include "System.h"
#include "types.h"
/*
@ -416,6 +419,9 @@ void Section::fadeOut()
*/
void Section::run()
{
// P2ASSERTLINE(543, m_display != nullptr);
// m_display->waitBlanking(1);
// doLoadingStart();
/*
stwu r1, -0x40(r1)
mflr r0
@ -773,28 +779,10 @@ lbl_80423F4C:
*/
void Section::exit()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
lwz r12, 0(r3)
lwz r12, 0x24(r12)
mtctr r12
bctrl
lwz r3, 0x20(r31)
bl becomeCurrentHeap__7JKRHeapFv
lwz r3, sys@sda21(r13)
bl initGenNode__6SystemFv
lwz r3, sys@sda21(r13)
bl refreshGenNode__6SystemFv
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
doExit();
_20->becomeCurrentHeap();
sys->initGenNode();
sys->refreshGenNode();
}
/*
@ -802,8 +790,9 @@ void Section::exit()
* Address: 80423FCC
* Size: 000024
*/
void Section::beginFrame()
bool Section::beginFrame()
{
return sys->beginFrame();
/*
stwu r1, -0x10(r1)
mflr r0
@ -824,6 +813,7 @@ void Section::beginFrame()
*/
void Section::endFrame()
{
sys->endFrame();
/*
stwu r1, -0x10(r1)
mflr r0
@ -844,6 +834,7 @@ void Section::endFrame()
*/
void Section::beginRender()
{
sys->beginRender();
/*
stwu r1, -0x10(r1)
mflr r0
@ -864,6 +855,10 @@ void Section::beginRender()
*/
void Section::endRender()
{
// if (_18 != nullptr) {
// _18->_04();
// }
// sys->endRender();
/*
stwu r1, -0x10(r1)
mflr r0
@ -891,8 +886,13 @@ lbl_80424060:
* Address: 80424078
* Size: 00007C
*/
void Section::update()
bool Section::update()
{
if (sys->isDvdErrorOccured() == false) {
return doUpdate();
}
sys->m_cardMgr->update();
return false;
/*
stwu r1, -0x10(r1)
mflr r0
@ -937,8 +937,11 @@ lbl_804240D8:
* Address: 804240F4
* Size: 00005C
*/
void Section::draw(Graphics&)
void Section::draw(Graphics& gfx)
{
if (sys->isDvdErrorOccured() == false) {
doDraw(gfx);
}
/*
stwu r1, -0x10(r1)
mflr r0

View File

@ -1,5 +1,14 @@
#include "Camera.h"
#include "Graphics.h"
#include "JSystem/J3D/J3DJoint.h"
#include "JSystem/J3D/J3DMaterial.h"
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DShape.h"
#include "SysShape/Model.h"
#include "SysShape/Joint.h"
#include "System.h"
#include "types.h"
#include "Viewport.h"
/*
Generated from dpostproc
@ -673,8 +682,22 @@ void Model::entry(Sys::Sphere&)
* Address: 8043E8A4
* Size: 000098
*/
void Model::isVisible(Sys::Sphere&)
bool Model::isVisible(Sys::Sphere& sphere)
{
int i = 0;
while (true) {
if (sys->m_gfx->m_viewportCount <= i) {
m_isVisible = false;
return false;
}
Viewport* viewport = sys->m_gfx->getViewport(i);
if (viewport->viewable() && viewport->m_camera->isVisible(sphere)) {
break;
}
i++;
}
m_isVisible = true;
return true;
/*
stwu r1, -0x20(r1)
mflr r0
@ -730,8 +753,23 @@ lbl_8043E928:
* Address: 8043E93C
* Size: 000080
*/
void Model::jointVisible(bool, int)
void Model::jointVisible(bool newVisibility, int jointIndex)
{
if (newVisibility != false) {
for (J3DMaterial* material = m_j3dModel->m_modelData->m_jointTree
->m_joints[(ushort)jointIndex]
->m_material;
material != nullptr; material = material->_04) {
material->m_shape->m_flags &= ~J3DShape::IsHidden;
}
return;
}
for (J3DMaterial* material
= m_j3dModel->m_modelData->m_jointTree->m_joints[(ushort)jointIndex]
->m_material;
material != nullptr; material = material->_04) {
material->m_shape->m_flags |= J3DShape::IsHidden;
}
/*
clrlwi. r0, r4, 0x18
beq lbl_8043E980
@ -785,6 +823,13 @@ lbl_8043E9B0:
*/
void Model::hide(void)
{
for (ushort i = 0; i < m_jointCount; i++) {
for (J3DMaterial* material
= m_j3dModel->m_modelData->m_jointTree->m_joints[i]->m_material;
material != nullptr; material = material->_04) {
material->m_shape->m_flags |= J3DShape::IsHidden;
}
}
/*
li r5, 0
b lbl_8043EA00
@ -826,6 +871,13 @@ lbl_8043EA00:
*/
void Model::show(void)
{
for (ushort i = 0; i < m_jointCount; i++) {
for (J3DMaterial* material
= m_j3dModel->m_modelData->m_jointTree->m_joints[i]->m_material;
material != nullptr; material = material->_04) {
material->m_shape->m_flags &= ~J3DShape::IsHidden;
}
}
/*
li r5, 0
b lbl_8043EA58
@ -1397,7 +1449,7 @@ lbl_8043F02C:
* Address: ........
* Size: 000050
*/
void Model::update(void)
void Model::update()
{
// UNUSED FUNCTION
}
@ -1435,7 +1487,7 @@ void Model::setViewCalcModeInd(void)
* Address: ........
* Size: 000040
*/
void Model::needViewCalc(void)
bool Model::needViewCalc()
{
// UNUSED FUNCTION
}
@ -1536,15 +1588,16 @@ void Model::isMtxImmediate(void)
* Address: 8043F120
* Size: 000008
*/
u32 Model::isModel(void) { return 0x1; }
bool Model::isModel() { return true; }
/*
* --INFO--
* Address: 8043F128
* Size: 000008
*/
void Model::isVisible(void)
bool Model::isVisible(void)
{
return m_isVisible;
/*
lbz r3, 6(r3)
blr