added egg/core headers seen in SS

This commit is contained in:
Elijah Thomas
2023-08-17 20:25:20 -04:00
parent 93f003b87b
commit 4b6a5d2e01
50 changed files with 1539 additions and 217 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ public:
/* 0x68 */ mHeapAllocator_c heap_allocator;
/* 0x84 */ ObjInfo* obj_info;
/* 0x88 */ void* sound_info_tail;
/* 0x8c */ SoundInfo* sound_info_next;
/* 0x8c */ void* sound_info_next;
/* 0x90 */ int count;
/* 0x94 */ void* obj_sound;
/* 0x9C */ mVec3_c* obj_pos;
@@ -45,7 +45,7 @@ public:
/* 0xE8 */ u32 field_0xe8;
/* 0xEC */ u8 roomid;
/* 0xED */ u8 actor_subtype;
/* 0xF0 */ u32 field_0xF0;
/* 0xF0 */ u32 JStudio_actor;
/* 0xF4 */ char someStr[4];
/* 0xF8 */ char field_0xf8[0xfc - 0xf8];
protected:
+9 -12
View File
@@ -1,26 +1,23 @@
#pragma once
#include <types.h>
#include <rvl/MEM.h>
#include <egg/core/eggHeap.h>
// Ghidra: Allocator
// size: 0x1C
// .text: [0x804952d0, 0x804953f0]
// .data: [0x8056e8d0, 0x8056e8e8] # Allocator vtable
// sdata2: [0x8057f2f0, 0x8057f2f8] # MEMAllocator func table
// /* 80495310 */ MEMInitAllocatorFor_Heap(MEMAllocator* alloc, s32 align, void* heap);
// /* 804952f0 */ MEM_AllocFor_Heap(MEMAllocator* alloc, void* block);
// /* 804952d0 */ MEM_AllocFor_Heap(MEMAllocator* alloc, u32 size, s32 align);
namespace EGG {
class Heap;
class Allocator : public MEMAllocator {
public:
Allocator(Heap* heap, s32 align);
// vtable at 0x10
/* 0x08 */ virtual ~Allocator();
/* 0x0C */ virtual void* alloc(u32 size);
/* 0x10 */ virtual void free(void* block);
/* 80495330 */ Allocator(Heap* heap, s32 align);
public:
/* vt 0x08 | 80495380 */ virtual ~Allocator();
/* vt 0x0C | 804953c0 */ virtual void* alloc(u32 size);
/* vt 0x10 | 804953e0 */ virtual void free(void* block);
inline MEMAllocator* getHandle() { return static_cast<MEMAllocator*>(this); }
private:
/* 0x14 */ Heap* mHeap;
/* 0x18 */ s32 align;
};
+60
View File
@@ -0,0 +1,60 @@
#pragma once
#include <types.h>
#include <rvl/ARC.h>
#include <rvl/NAND.h>
#include <egg/core/eggDisposer.h>
typedef void (*FileCallbackFunc)(void*, void*, const ARCDirEntry*, const char*);
namespace EGG
{
// Functions that need a proper home:
/* 80493510 */ void readNANDFile(NANDFileInfo* info, void* buf, u32 len, s32 offs);
class Archive : public Disposer {
public:
struct FileInfo {
u32 mArcStartOffset;
u32 mArcLength;
};
enum MountType { // enum name is correct, values arent official
NOT_LOADED, LOADED_CAN_FAST_READ, NAND_File,
};
/* 0x10 */ MountType mMountType;
/* 0x14 */ u32 mRefCount;
/* 0x18 */ ARCHandle mHandle;
/* 0x34 */ s32 mDvdEntryNum; // gets put into first param of DVDFastOpen
/* 0x38 */ s32 mNandFile; // pointer to NANDFileInfo (was allocated)
/* 0x3C */ nw4r::ut::Node mLink;
public:
/* 804935f0 */ virtual ~Archive();
public:
/* 80493580 */ Archive();
/* 80493660 */ void initHandle(void* data, MountType mountType);
/* 804936d0 */ static Archive* findArchive(void* data);
/* 80493760 */ static Archive* findArchive(NANDFileInfo* file);
/* 804937f0 */ static void appendList(Archive*); // prob private
/* 80493850 */ static void removeList(Archive*);
/* 80493860 */ static Archive* mount(void* data, Heap* heap, s32 align);
/* 80493950 */ static Archive* mountFST(void* data, Heap* heap, s32 align);
/* 80493a40 */ static Archive* mountNandFile(NANDFileInfo* , Heap* heap, s32 align);
/* 80493ac0 */ static Archive* loadFST(const char* fileName, Heap* heap, s32 align);
/* 80493b80 */ void unmount();
/* 80493c20 */ u32 getFile(const char* name, FileInfo* out);
/* 80493cf0 */ long convertPathToEntryID(const char* path);
/* 80493d00 */ void* getFileFast(long entryId, FileInfo* fileinfo);
/* 80493dc0 */ void* getFileFast(long entryId, Heap* heap, s32 align);
/* 80493f30 */ s32 countFile();
/* 804940c0 */ void searchInside(FileCallbackFunc, void*);
/* 80494140 */ static void* loadFromNAND(NANDFileInfo* fileInfo, Heap* heap, s32 align);
public:
/* 80576728 */ static bool sIsArchiveListInitialized;
/* 80673ac8 */ static nw4r::ut::List sArchiveList;
};
/* 80493f10 */ void countFileCallbackFunc(void*, void*, const ARCDirEntry*, const char*);
/* 80493f70 */ void searchInsideWithPath(
Archive* arc, ARCHandle* handle, FileCallbackFunc, void*, char* outPath, u32
);
} // namespace EGG
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG {
class AssertHeap : public Heap {
public:
// vtable at 0x0 | 8056ea00
/* vt 0x08 | 804963e0 */ virtual ~AssertHeap();
/* vt 0x0C | 80496820 */ virtual eHeapKind getHeapKind() const;
/* vt 0x14 | 804966b0 */ virtual void* alloc(u32 size, s32 align);
/* vt 0x18 | 80496710 */ virtual void free(void* block);
/* vt 0x1C | 80496620 */ virtual void destroy();
/* vt 0x20 | 80496760 */ virtual u32 resizeForMBlock(void* block, u32 size);
/* vt 0x24 | 80496770 */ virtual u32 getTotalFreeSize();
/* vt 0x28 | 80496780 */ virtual u32 getAllocatableSize(s32 align);
/* vt 0x2C | 80496790 */ virtual u32 adjust();
public:
/* 804963a0 */ AssertHeap(MEMiHeapHead* heapHead);
/* 80496460 */ static AssertHeap* create(void* block, u32 size, u16 attr);
/* 80496530 */ static AssertHeap* create(u32 size, Heap* heap);
/* 80496810 */ static u32 getSize(); // returns 0x7C
};
} // namespace EGG
+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include <types.h>
#include <egg/core/eggDisplay.h>
namespace EGG
{
class AsyncDisplay : public Display {
public:
// vtable at 0x04 | 8056eb60
/* vt 0x08 | 80497f20 */ virtual void beginFrame();
/* vt 0x10 | 804980e0 */ virtual void endRender();
/* vt 0x14 | 804980c0 */ virtual void endFrame();
/* vt 0x18 | 804982d0 */ virtual u32 getTickPerFrame();
/* vt 0x1C | 80498100 */ virtual void preVRetrace();
public:
/* 0x2C */ char field_0x2C[0x60-0x2C];
/* 0x60 */ OSThreadQueue mThreadQueue;
/* 0x68 */ OSMessageQueue mMesgQueue;
/* 0x88 */ OSMessage mMesg;
/* 0x8C */ char field_0x8C[0x98-0x8C];
/* 0x98 */ s32 field_0x98;
/* 0x9C */ f32 field_0x9C;
/* 0xA0 */ f32 field_0xA0;
/* 0xA4 */ s32 field_0xA4;
/* 0xA8 */ s32 field_0xA8;
/* 0xAC */ s32 field_0xAC;
/* 0xB0 */ u32 field_0xB0;
/* 0xB4 */ s32 field_0xB4;
/* 0xB8 */ u32 field_0xB8;
/* 0xBC */ u32 field_0xBC;
public:
/* 80497e40 */ AsyncDisplay(u8 maxRetrace);
/* 80497ec0 */ void calcS();
/* 80498260 */ void clearEFB();
/* 804982f0 */ void clearEFB(u16, u16, u16, u16, u16, u16, nw4r::ut::Color);
};
} // namespace EGG
#ifdef __cplusplus
extern "C" {
#endif
/* 80576790 */ static EGG::AsyncDisplay* spSelector;
#ifdef __cplusplus
}
#endif
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include <types.h>
#include <nw4r/ut/Color.h>
#include <egg/core/eggFader.h>
#include <egg/prim/eggBitFlag.h>
namespace EGG
{
class ColorFader : public Fader {
public:
// vtable at 0x00 | 8056eae8
/* vt 0x08 | 80497a10 */ virtual void setStatus(EStatus);
/* vt 0x0C | 00000000 */ virtual EStatus getStatus() const;
/* vt 0x10 | 80497a50 */ virtual bool fadeIn();
/* vt 0x14 | 80497a80 */ virtual bool fadeOut();
/* vt 0x18 | 80497ab0 */ virtual bool calc();
/* vt 0x1C | 80497ba0 */ virtual bool draw();
/* vt 0x1C | 80131b70 */ virtual ~ColorFader();
public:
/* 0x04 */ EStatus mStatus;
/* 0x08 */ TBitFlag<u8> mFlags;
/* 0x0A */ u16 mFrame;
/* 0x0C */ u16 mFadeTimer;
/* 0x0E */ u16 field_0x0E;
/* 0x10 */ nw4r::ut::Color mColor;
/* 0x14 */ f32 mStartX;
/* 0x18 */ f32 mStartY;
/* 0x1C */ f32 mEndX;
/* 0x20 */ f32 mEndY;
public:
/* 80497930 */ ColorFader(
f32 startX, f32 startY, f32 lengthX, f32 lengthY,
nw4r::ut::Color color,EStatus status);
/* 804979e0 */ void setFrame(u16 frame);
/* 804979f0 */ void setColor(nw4r::ut::Color);
};
} // namespace EGG
+170
View File
@@ -0,0 +1,170 @@
#pragma once
#include <types.h>
#include <egg/math/eggMatrix.h>
#include <egg/math/eggVector.h>
#include <egg/prim/eggBitFlag.h>
#include <egg/prim/eggBuffer.h>
#include <rvl/PAD.h>
namespace EGG
{
class ControllerRumbleMgr;
// To Be Filled out
enum eCoreDevType {
};
class CoreStatus {
public:
/* 0x00 */ u8 field_0x00[0xF0];
public:
/* 80498f90 */ void init();
/* 80498fa0 */ u32 getFSStickButton() const;
};
class CoreController {
public:
// vtable 0x000 | 8056ec50
/* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32);
/* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32);
/* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32);
/* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32);
/* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask);
/* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask);
/* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask);
/* vt 0x24 | 800599e0 */ virtual bool isReleased();
/* vt 0x28 | 80059840 */ virtual bool isAllPressed();
/* vt 0x2C | 80059a80 */ virtual bool isNotPressed();
/* vt 0x30 | 80499660 */ virtual void beginFrame(void* padStatus); // Really needs to be PADStatus
/* vt 0x34 | 80499a60 */ virtual void endFrame();
public:
/* 0x004 */ s32 mChannelID;
/* 0x008 */ u32 mButtonHeld; // these fields may need a slight amount of work
/* 0x00C */ u32 mButtonTriggered;
/* 0x010 */ u32 mButtonReleased;
/* 0x014 */ u32 field_0x14;
/* 0x018 */ CoreStatus coreStatus[16];
/* 0xf18 */ int mKPADResult;
/* 0xf1c */ TBitFlag<u8> mFlag;
/* 0xf20 */ Vector3f mAccel;
/* 0xf2c */ Vector2f mDpdPos;
/* 0xf34 */ u32 field_0xf28;
/* 0xf38 */ u32 mMotorPattern;
/* 0xf3c */ bool mEnableMotor;
/* 0xf40 */ s32 mMotorFrameDuration;
/* 0xf44 */ u8 mMotorPatternLength;
/* 0xf45 */ u8 mMotorPatternPos;
/* 0xf48 */ ControllerRumbleMgr* mRumbleMgr;
/* 0xf4c */ Matrix34f mPostureMatrix;
/* 0xf7c */ Matrix34f mPostureMatrixPrev;
/* 0xfac */ TBitFlag<u8> mAccelFlags;
/* 0xfb0 */ s32 mMaxAccelFrameTime;
/* 0xfb4 */ s32 mAccelFrameTimeX;
/* 0xfb8 */ s32 mAccelFrameTimeY;
/* 0xfbc */ s32 mAccelFrameTimeZ;
/* 0xfc0 */ f32 mMaxAccelDiff;
/* 0xfc4 */ Vector3f mPrevAccel;
public:
/* 80499050 */ CoreController();
/* 804990b0 */ void sceneReset();
/* 80499170 */ Vector2f getDpdRawPos();
/* 80499190 */ s32 getDpdDistance();
/* 804991a0 */ void startMotor();
/* 804991b0 */ void stopMotor();
/* 804991c0 */ void createRumberMgr(u8);
/* 80499220 */ void startPatternRumble(const char*, int, bool);
/* 80499240 */ void stopRumbleMgr();
/* 80499260 */ CoreStatus* getCoreStatus(s32 idx);
/* 8056ebf8 */ void calc_posture_matrix(Matrix34f& mat, bool);
/* 80499ac0 */ f32 getFreeStickX();
/* 80499ae0 */ f32 getFreeStickY();
};
class NullController : public CoreController {
public:
// idk this has NO effect on anything
u8 unk[0x80674c00-0x80674b10];
};
class ControllerRumbleUnit {
public:
// 0x00 vtable | 8056ebb4
/* vt 0x08 | 8049a8e0 */ virtual ~ControllerRumbleUnit();
public:
/* 0x04 */ char* mPattern;
/* 0x08 */ char* mPatternPos;
/* 0x0C */ s32 mTimer; // guess
/* 0x10 */ f32 mRampUp; // guess
/* 0x14 */ f32 mIntesity; // guess
/* 0x18 */ TBitFlag<u8> mFlag;
/* 0x1C */ nw4r::ut::Node mNode;
/* 0x24 */ u32 field_0x24; // could just be part of the node (List)
public:
/* 8049a3b0 */ void init();
/* 8049a3e0 */ void startPattern(const char* patter, int);
/* 8049a440 */ f32 calc();
};
class ControllerRumbleMgr {
public:
// 0x00 vtable | 8056eba8
/* vt 0x08 | 8049a8a0 */ virtual ~ControllerRumbleMgr();
public:
/* 0x04 */ nw4r::ut::List mActiveUnitList;
/* 0x10 */ nw4r::ut::List mInactiveUnitList;
/* 0x1C */ CoreController* mController;
public:
/* 8049a530 */ ControllerRumbleMgr();
/* 8049a590 */ void createUnit(u8 numUnits, CoreController* controller);
/* 8049a620 */ void stop();
/* 8049a690 */ void calc();
/* 8049a7a0 */ void startPattern(const char* pattern, int, bool);
/* 8049a7f0 */ ControllerRumbleUnit* getUnitFromList(bool bGrabActive);
};
class CoreControllerMgr {
public:
struct T__Disposer {
Disposer mDisposer;
/* vt 0x08 | 80499b00 */ virtual ~T__Disposer();
/* 805767ac */ static T__Disposer* sStaticDisposer;
};
// Disposer Vtable: 8056ec40
/* 0x0000 */ T__Disposer mDisposer; // for the static T__Disposer
public:
// 0x0010 vtable | 8056ebf8
/* vt 0x08 | 8049a130 */ void beginFrame();
/* vt 0x0C | 8049a1e0 */ void endFrame();
public:
/* 0x0014 */ TBuffer<CoreController*> mControllers;
/* 0x0020 */ u8 field_0x20[0x10a4 - 0x0020];
/* 0x10A4 */ TBuffer<eCoreDevType> mDevTypes;
/* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0];
public:
/* 80499b80 */ static void createInstance();
/* 80499bd0 */ static void deleteInstance();
/* 80499cd0 */ void connectCallback(s32, s32);
/* 80499d10 */ CoreControllerMgr();
public:
/* 805767a8 */ static CoreControllerMgr* sInstance;
/* 805767b0 */ static CoreController* (*sCoreControllerFactory)();
/* 805767b4 */ static void (*sConnectCallback)(s32, s32);
/* 805767b8 */ static bool sUnk;
// /* 805767bc */ static sAllocator; // defined in cpp file
// Other Stuff thats autogen (buffers/sinit/etc)
// /* 8049a950 */ void TBuffer<eCoreDevType>::allocate(int, int);
// /* 8049a9a0 */ void TBuffer<eCoreDevType>::allocate(int, Heap*, int);
// /* 8049aa20 */ void TBuffer<eCoreDevType>::onAllocate(Heap*);
// /* 8049aa30 */ void TBuffer<CoreController*>::allocate(int, int);
// /* 8049aa80 */ void TBuffer<CoreController*>::allocate(int, Heap*, int);
// /* 8049ab00 */ void TBuffer<CoreController*>::onAllocate(Heap*);
// /* 8049ab10 */ void sinit(); // NULL CONTROLLER
};
} // namespace EGG
+76
View File
@@ -0,0 +1,76 @@
#pragma once
#include <types.h>
#include <rvl/CX/cx.h>
// NOTE: I put StreamDecomp stuff here. im unsure of the correct place
namespace EGG
{
class StreamDecomp {
public:
/* vt 0x08 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 */ virtual u32 getHeaderSize();
/* vt 0x14 */ virtual u32 getUncompressedSize(const void* src);
public:
/* 0x04 */ void* dest;
/* 0x08 */ u32 maxCompressedSize;
};
class StreamDecompLZ : public StreamDecomp {
public:
/* vt 0x08 | 80494c80 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C | 80494cb0 */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 | 804952c0 */ virtual u32 getHeaderSize();
/* vt 0x14 | 804952b0 */ virtual u32 getUncompressedSize(const void* src);
public:
/* 0x0C */ CXUncompContextLZ context;
};
class StreamDecompRL : public StreamDecomp {
public:
/* vt 0x08 | 80494ce0 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C | 80494d10 */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 | 804952a0 */ virtual u32 getHeaderSize();
/* vt 0x14 | 80495290 */ virtual u32 getUncompressedSize(const void* src);
public:
/* 0x0C */ CXUncompContextRL context;
};
class StreamDecompLH : public StreamDecomp {
public:
/* vt 0x08 | 80494d40 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C | 80494d70 */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 | 80495280 */ virtual u32 getHeaderSize();
/* vt 0x14 | 80495270 */ virtual u32 getUncompressedSize(const void* src);
public:
/* 0x0C */ CXUncompContextLH context;
};
class StreamDecompLRC : public StreamDecomp {
public:
/* vt 0x08 | 80494da0 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C | 80494dd0 */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 | 80495260 */ virtual u32 getHeaderSize();
/* vt 0x14 | 80495250 */ virtual u32 getUncompressedSize(const void* src);
public:
/* 0x0C */ CXUncompContextLRC context;
};
class StreamDecompSZS : public StreamDecomp {
public:
/* vt 0x08 | 804951d0 */ virtual bool init(void* dest, u32 maxCompressedSize);
/* vt 0x0C | 80495200 */ virtual bool decomp(const void* src, u32 len);
/* vt 0x10 | 80495240 */ virtual u32 getHeaderSize();
/* vt 0x14 | 80495230 */ virtual u32 getUncompressedSize(const void* src);
private:
// NON-OFFICIAL
struct SZSCompContext {
u8 _[0x18];
/* 80494e00 */ static u32 getUncompressedSize(const void* src);
/* 80494e30 */ void init(u32 maxCompSize);
/* 80494e60 */ static int readSzsHeader(/* unk params*/);
/* 80494f60 */ void* decomp(const void* src, u32 len);
};
public:
/* 0x0C */ SZSCompContext context;
};
} // namespace EGG
+50
View File
@@ -0,0 +1,50 @@
#pragma once
#include <types.h>
#include <rvl/VI.h>
#include <nw4r/ut/Color.h>
#include <egg/prim/eggBitFlag.h>
#include <egg/core/eggSystem.h> // for BaseSystem config
#include <egg/core/eggVideo.h>
/* 80497530 */ // void PreRetraceCallback(void);
namespace EGG
{
class Display {
public:
enum EFlagBits { mFlag_SetClear, mFlag_WaitForRetrace };
/* 0x00*/ TBitFlag<u8> mFlag;
public:
// vtable at 0x04 | 8056eac8
/* vt 0x08 | 80497600 */ virtual void beginFrame();
/* vt 0x0C | 804976c0 */ virtual void beginRender();
/* vt 0x10 | 804976d0 */ virtual void endRender();
/* vt 0x14 | 804976e0 */ virtual void endFrame();
/* vt 0x18 | 804975f0 */ virtual u32 getTickPerFrame();
/* vt 0x1C | 804976f0 */ virtual void preVRetrace();
public:
/* 0x08 */ u8 mMaxRetraces;
enum EScreenStateBits { mScreenStateFlag_SetBlack };
/* 0x09 */ TBitFlag<u8> mScreenStateFlag;
/* 0x0C */ u32 mRetraceCount;
/* 0x10 */ u32 mFrameCount;
/* 0x14 */ nw4r::ut::Color mClearColor;
/* 0x18 */ u32 mClearZ;
/* 0x1C */ s32 mBeginTick;
/* 0x20 */ s32 mLastTick; // new
/* 0x24 */ s32 mDeltaTick;
/* 0x28 */ f32 mFrequency;
public:
/* 80497570 */ Display(u8 maxRetrace);
/* 804977d0 */ void copyEFBtoXFB();
/* 80497870 */ void calcFrequency();
/* inline */ void setBlack(bool b) {}
public:
/* 80497900 */ static u32 sTickPeriod;
};
} // namespace EGG
+24 -23
View File
@@ -2,32 +2,33 @@
// This file was adapted from https://github.com/riidefi/mkw/blob/master/source/egg/core/eggDisposer.hpp
#include <nw4r/ut/utList.h>
#include <nw4r/ut/List.h>
#include <types.h>
namespace EGG {
class Heap;
// Ghidra: EggBase
// size: 0x8
// .text: [0x80496830, 0x80496910]
class Disposer : private NonCopyable {
friend class Heap;
protected:
virtual ~Disposer();
Disposer();
public:
enum eLifetime {
LIFETIME_UNMANAGED,
LIFETIME_HEAP_GC
};
inline eLifetime getLifetime() const {
return mContainHeap != nullptr ? LIFETIME_HEAP_GC : LIFETIME_UNMANAGED;
}
private:
Heap* mContainHeap;
nw4r::ut::Node mList;
class Heap;
class Disposer : private NonCopyable {
friend class Heap;
protected:
/* vt 0x08 | 80496890 */ virtual ~Disposer();
/* 80496830 */ Disposer();
public:
enum eLifetime {
LIFETIME_UNMANAGED,
LIFETIME_HEAP_GC
};
inline eLifetime getLifetime() const {
return mContainHeap != nullptr ? LIFETIME_HEAP_GC : LIFETIME_UNMANAGED;
}
private:
/* 0x04 */ Heap* mContainHeap;
/* 0x08 */ nw4r::ut::Node mList;
};
// TODO: Add singleton define for the T__Disposer stuff.
// see https://github.com/open-ead/sead/blob/master/include/heap/seadDisposer.h
// for reference
};
+47
View File
@@ -0,0 +1,47 @@
#pragma once
#include <types.h>
#include <rvl/OS.h>
#include <rvl/DVD.h>
#include <nw4r/ut/List.h>
#include <egg/core/eggFile.h>
namespace EGG
{
class DvdFile : public File {
public:
struct FileInfo : public DVDFileInfo {
DvdFile* dvdFile;
};
public:
/* 0x08 */ OSMutex mMutex;
/* 0x20 */ OSMutex mMutexUnused;
/* 0x38 */ u32 field_0x38;
/* 0x3c */ FileInfo mFileInfo;
/* 0x7c */ OSMessageQueue mMsgQueueUnsued;
/* 0x9c */ OSMessage mMsgUnused;
/* 0xa0 */ OSMessageQueue mMsgQueue;
/* 0xc0 */ OSMessage mMsg;
/* 0xc4 */ OSThread* mThread;
/* 0xc8 */ nw4r::ut::Node mNode;
public:
/* vt 0x08 | 804942f0 */ virtual ~DvdFile();
/* vt 0x0C | 80494450 */ virtual bool open(const char* path);
/* vt 0x10 | 804944b0 */ virtual void close();
/* vt 0x14 | 80494510 */ virtual s32 readData(void* buffer, s32 length, s32 offset);
/* vt 0x18 | 804945e0 */ virtual s32 writeData(void* buffer, s32 length, s32 offset);
/* vt 0x1C | 80494670 */ virtual u32 getFileSize();
/* vt 0x20 | 804943d0 */ virtual bool open(s32 entryNum);
/* vt 0x24 | 804944a0 */ virtual bool open(const char* path, void*);
public:
/* 804942a0 */ DvdFile();
/* 80494360 */ void initiate();
/* 804945f0 */ s32 sync();
/* 80494650 */ static void doneProcess(s32 result, DVDFileInfo* fileInfo);
public:
/* 80576730 */ static bool sIsInitialized;
/* 80673ad8 */ static nw4r::ut::List sDvdList;
};
} // namespace EGG
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
#include <egg/core/eggDvdFile.h>
#include <egg/core/eggDecomp.h>
namespace EGG
{
class DvdRipper {
public:
enum EAllocDirection {
ALLOC_CIR_PAD,
ALLOC_DIR_TOP,
ALLOC_DIR_BOTTOM
};
public:
/* 80494680 */ static u8* loadToMainRAM( s32 entryNum,
u8* dst, Heap* heap, EAllocDirection allocDir,
u32 offset, u32* amountRead, u32* fileSize
);
/* 80494730 */ static u8* loadToMainRAM( const char* path,
u8* dst, Heap* heap, EAllocDirection allocDir,
u32 offset, u32* amountRead, u32* fileSize
);
/* 804947e0 */ static u8* loadToMainRAM( DvdFile* file,
u8* dst, Heap* heap, EAllocDirection allocDir,
u32 offset, u32* amountRead, u32* fileSize
);
/* 804949b0 */ static void* loadToMainRAMDecomp( DvdFile* file,
StreamDecomp* decompressor, u8* dst, Heap* heap,
EAllocDirection allocDir, u32 offset, s32 size,
u32 maxChunkSize, u32* amountRead, u32* fileSize
);
public:
/* 80574ed0 */ static bool sErrorRetry;
/* */ // static sCallback;
};
} // namespace EGG
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG
{
class ExpHeap : public Heap {
public:
// vtable at 0x0 | 8056e980
/* vt 0x08 | 80495af0 */ virtual ~ExpHeap();
/* vt 0x0C | 80495f90 */ virtual eHeapKind getHeapKind() const;
/* vt 0x14 | 80495d90 */ virtual void* alloc(u32 size, s32 align);
/* vt 0x18 | 80495e50 */ virtual void free(void* block);
/* vt 0x1C | 80495d00 */ virtual void destroy();
/* vt 0x20 | 80495ec0 */ virtual u32 resizeForMBlock(void* block, u32 size);
/* vt 0x24 | 80495ed0 */ virtual u32 getTotalFreeSize();
/* vt 0x28 | 80495ee0 */ virtual u32 getAllocatableSize(s32 align);
/* vt 0x2C | 80495f00 */ virtual u32 adjust();
public:
/* 80495ab0 */ ExpHeap(MEMiHeapHead* heapHead);
/* 80495b70 */ static ExpHeap* create(void* block, u32 size, u16 attr);
/* 80495c30 */ static ExpHeap* create(u32 size, Heap* heap, u16 attr);
/* 80495d00 */ void setGroupID(u16 groupId);
/* 80495f80 */ u32 getSizeForMBlock(const void* block);
};
} // namespace EGG
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <types.h>
namespace EGG
{
class Fader {
public:
enum EStatus {
STATUS_PREPARE_IN,
STATUS_PREPARE_OUT,
STATUS_FADE_IN,
STATUS_FADE_OUT,
};
public:
// vtable at 0x00
/* vt 0x08 | 00000000 */ virtual void setStatus(EStatus) = 0;
/* vt 0x0C | 00000000 */ virtual EStatus getStatus() const = 0;
/* vt 0x10 | 00000000 */ virtual bool fadeIn() = 0;
/* vt 0x14 | 00000000 */ virtual bool fadeOut() = 0;
/* vt 0x18 | 00000000 */ virtual bool calc() = 0;
/* vt 0x1C | 00000000 */ virtual bool draw() = 0;
};
} // namespace EGG
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include <types.h>
namespace EGG
{
class File {
public:
File() : mIsOpen(false) {}
public:
/* vt 0x08 */ virtual ~File() {}
/* vt 0x0C */ virtual bool open(const char* path) = 0;
/* vt 0x10 */ virtual void close() = 0;
/* vt 0x14 */ virtual s32 readData(void* buffer, s32 length, s32 offset) = 0;
/* vt 0x18 */ virtual s32 writeData(const void* buffer, s32 length, s32 offset) = 0;
/* vt 0x1C */ virtual u32 getFileSize() const = 0;
/* 0x4 */ bool mIsOpen;
private: u8 pad[3];
};
} // namespace EGG
+22 -5
View File
@@ -1,11 +1,28 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
// [TODO: extend this]
namespace EGG {
class FrmHeap : public Heap {
};
}
class FrmHeap : public Heap {
public:
// vtable at 0x0 | 8056e9d0
/* vt 0x08 | 80495fe0 */ virtual ~FrmHeap();
/* vt 0x0C | 80496390 */ virtual eHeapKind getHeapKind() const;
/* vt 0x14 | 804961c0 */ virtual void* alloc(u32 size, s32 align);
/* vt 0x18 | 80496250 */ virtual void free(void* block);
/* vt 0x1C | 80496130 */ virtual void destroy();
/* vt 0x20 | 804962b0 */ virtual u32 resizeForMBlock(void* block, u32 size);
/* vt 0x24 | 804962c0 */ virtual u32 getTotalFreeSize();
/* vt 0x28 | 804962e0 */ virtual u32 getAllocatableSize(s32 align);
/* vt 0x2C | 804962f0 */ virtual u32 adjust();
public:
/* 80495fa0 */ FrmHeap(MEMiHeapHead* heapHead);
/* 80496060 */ static FrmHeap* create(void* block, u32 size, u16 attr);
/* 804962a0 */ void free(u32 flags);
/* 80496370 */ void recordState(u32 id); // non official for now
/* 80496380 */ void freeState(u32 id); // non official for now
};
} // namespace EGG
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG
{
class GraphicsFifo {
public:
// vtable 0x00 | 8056eb80
/* vt 0x08 | 80498e90*/ virtual ~GraphicsFifo();
public:
/* 0x04 */ void* mGxInitData;
/* 0x08 */ void* mBuffBase;
/* 0x0C */ u32 mBufSize;
public:
/* 80498e20 */ static void create(u32 size, Heap* heap);
/* 80498f30 */ GraphicsFifo(u32 size, Heap* heap);
public:
/* 80576798 */ static GraphicsFifo* sGraphicsFifo;
/* 8057679c */ static bool sGpStatus[4];
};
} // namespace EGG
+63 -73
View File
@@ -7,16 +7,13 @@
#include <rvl/OS.h>
#include <egg/core/eggAllocator.h>
#include <egg/core/eggDisposer.h>
#include <nw4r/ut/utList.h>
#include <egg/core/eggThread.h>
#ifndef HEAP_PRIVATE
#define HEAP_PRIVATE protected
#endif
#include <nw4r/ut/List.h>
#include <egg/prim/eggBitFlag.h>
namespace EGG {
class ExpHeap;
// class ExpHeap;
class Allocator;
struct HeapAllocArg {
@@ -35,14 +32,19 @@ struct HeapErrorArg {
inline HeapErrorArg() {}
};
typedef void (*ErrorCallback)(void*);
// Ghidra: Heap
// size: 0x34
// .text: [0x804953f0, 0x80495ab0]
struct HeapFreeArg {
u32 arg1; // Idk the args
u32 arg2;
};
typedef void (*HeapFreeCallback)(void*);
typedef void (*HeapCreateCallback)(void*);
typedef void (*HeapDestroyCallback)(void*);
class Heap : public Disposer {
public:
public:
enum eHeapKind {
HEAP_KIND_NONE = 0,
HEAP_KIND_EXPANDED,
@@ -50,73 +52,60 @@ public:
HEAP_KIND_UNIT,
HEAP_KIND_ASSERT,
};
// vtable at 0x0 | 8056e950
/* vt 0x08 | 804954c0 */ virtual ~Heap();
/* vt 0x0C | 00000000 */ virtual eHeapKind getHeapKind() const = 0;
/* vt 0x10 | 80495a40 */ virtual void initAllocator(Allocator* allocator, s32 align) = 0;
/* vt 0x14 | 00000000 */ virtual void* alloc(u32 size, s32 align) = 0;
/* vt 0x18 | 00000000 */ virtual void free(void* block) = 0;
/* vt 0x1C | 00000000 */ virtual void destroy() = 0;
/* vt 0x20 | 00000000 */ virtual u32 resizeForMBlock(void* block, u32 size) = 0;
/* vt 0x24 | 00000000 */ virtual u32 getTotalFreeSize() = 0;
/* vt 0x24 | 00000000 */ virtual u32 getAllocatableSize(s32 align) = 0;
/* vt 0x28 | 00000000 */ virtual u32 adjust() = 0;
public:
inline bool isExpHeap() { return getHeapKind() == HEAP_KIND_EXPANDED; }
// inline Heap* getParentHeap() { return mParentHeap; } // not part of ss
inline void* getStartAddress() { return this; }
// vtable at 0x0
/* 0x08 */ virtual ~Heap();
/* 0x0C */ virtual eHeapKind getHeapKind() const = 0;
/* 0x10 */ virtual void initAllocator(Allocator* allocator, s32 align) = 0;
/* 0x14 */ virtual void* alloc(u32 size, s32 align) = 0;
/* 0x18 */ virtual void free(void* block) = 0;
/* 0x1C */ virtual void destroy() = 0;
/* 0x20 */ virtual u32 resizeForMBlock(void* block, u32 size) = 0;
/* 0x24 */ virtual u32 getAllocatableSize(s32 align) = 0;
/* 0x28 */ virtual u32 adjust() = 0;
HEAP_PRIVATE :
static nw4r::ut::List sHeapList;
static OSMutex sRootMutex;
static Heap* sCurrentHeap;
static int sIsHeapListInitialized;
static Heap* sAllocatableHeap;
static ErrorCallback sErrorCallback;
static HeapAllocCallback sAllocCallback;
static void* sErrorCallbackArg;
static void* sAllocCallbackArg;
static class Thread* sAllocatableThread;
public:
// members
/* 0x10 */ MEMiHeapHead* mHeapHandle;
/* 0x14 */ void* mParentBlock;
// Heap* mParentHeap; // does not exist in ss
/* 0x18 */ TBitFlag<u16> mFlag;
/* 0x1C */ nw4r::ut::Node mNode;
/* 0x24 */ nw4r::ut::List mChildren;
/* 0x30 */ const char* mName; // set to "NoName" in ctor
enum HeapFlag {
// tstDisableAllocation, enableAllocation, disableAllocation
// setBit__Q23EGG12TBitFlag<Us>FUc
HEAP_FLAG_LOCKED = (1 << 0)
};
/* 0x18 */ u16 mFlag;
/* 0x1C */ nw4r::ut::Node mNode;
/* 0x24 */ nw4r::ut::List mChildren;
/* 0x30 */ const char* mName; // set to "NoName" in ctor
public:
static void initialize();
Heap(MEMiHeapHead* heapHandle);
private:
inline Heap(const Heap&) {}
/* 804953f0 */ static void initialize();
/* 80495430 */ Heap(MEMiHeapHead* heapHandle);
/* 80495690 */ static Heap* findHeap(MEMiHeapHead* heapHandle);
/* 80495730 */ Heap* findParentHeap();
/* 80495780 */ static Heap* findContainHeap(const void* memBlock);
/* 80495560 */ static void* alloc(u32 size, int align, Heap* heap);
/* 804957c0 */ static void free(void* memBlock, Heap* heap);
/* 80495830 */ void dispose();
/* 804958a0 */ void dump();
/* 804958b0 */ void dumpAll();
/* 804959a0 */ Heap* becomeCurrentHeap();
/* 80495a00 */ Heap* _becomeCurrentHeapWithoutLock();
public:
static void* alloc(u32 size, int align, Heap* heap);
template <typename T> static T* alloc(u32 count, Heap* heap, int align = 4) {
return reinterpret_cast<T*>(alloc(count * sizeof(T), align, heap));
}
template <typename T> static T* alloc(Heap* heap, int align = 4) {
return reinterpret_cast<T*>(alloc(sizeof(T), align, heap));
}
Heap* findParentHeap();
static Heap* findContainHeap(const void* memBlock);
static void free(void* memBlock, Heap* heap);
void dispose();
static void dumpAll();
Heap* becomeCurrentHeap();
public:
static void* addOffset(void* begin, u32 size) {
return reinterpret_cast<char*>(begin) + size;
@@ -136,24 +125,25 @@ public:
inline int getArenaEnd() {
return (int)mHeapHandle->end;
}
/* 80673ae8 */ static nw4r::ut::List sHeapList;
/* 80673af8 */ static OSMutex sRootMutex;
/* 80576740 */ static Heap* sCurrentHeap;
/* 80576744 */ static int sIsHeapListInitialized;
/* 80576748 */ static Heap* sAllocatableHeap;
/* 8057674c */ static ErrorCallback sErrorCallback;
/* 80576750 */ static HeapAllocCallback sAllocCallback;
/* 80576754 */ static HeapFreeCallback sFreeCallback;
/* 80576758 */ static void* sErrorCallbackArg;
/* 8057675c */ static void* sAllocCallbackArg;
/* 80576760 */ static void* sFreeCallbackArg;
/* 80576764 */ static HeapCreateCallback sCreateCallback;
/* 80576764 */ static HeapDestroyCallback sDestroyCallback;
};
} // namespace EGG
void* operator new(size_t size);
// __nwa(ulong, ulong)
void* operator new[](size_t size, u32 align);
// __nw(ulong, EGG::Heap *, int)
void* operator new(size_t size, EGG::Heap* heap, int align);
// __nwa(ulong)
void* operator new[](size_t size);
// __nwa(ulong, int)
void* operator new[](size_t size, int align);
// __nwa(ulong, EGG::Heap *, int)
void* operator new[](size_t size, EGG::Heap* heap, int align);
// __dl(void *)
void operator delete(void* p);
// __dla(void *)
void operator delete[](void*);
#undef HEAP_PRIVATE
/* 80495a60 */ void* operator new(size_t, void* p);
/* 80495a70 */ void* operator new(size_t size, EGG::Heap* heap, u32 align);
/* 80495a80 */ void* operator new(size_t size, EGG::Allocator* alloc);
/* 80495a90 */ void* operator new[](size_t size, u32 align);
/* 80495aa0 */ void* operator new[](size_t size, EGG::Heap* heap, int align);
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG
{
class Display;
class XfbManager;
class Video;
class ConfigurationData {
public:
// vtable at 0x0 | 8056ea8c
/* vt 0x08 | 00000000 */ virtual Video* getVideo() = 0;
/* vt 0x0C | 00000000 */ virtual Heap* getSystemHeap() = 0;
/* vt 0x10 | 00000000 */ virtual Display* getDisplay() = 0;
/* vt 0x14 | 00000000 */ virtual XfbManager* getXfbMgr() = 0;
/* vt 0x18 | 00000000 */ virtual void getPerfView() = 0;
/* vt 0x1C | 00000000 */ virtual void getScnMgr() = 0;
/* vt 0x20 | 00000000 */ virtual void getAudioMgr() = 0;
/* vt 0x24 | 800643d0 */ virtual void onBeginFrame();
/* vt 0x28 | 80064430 */ virtual void onEndFrame();
/* vt 0x2C | 80064ea0 */ virtual void initRenderMode();
/* vt 0x30 | 80497170 */ virtual void initMemory();
/* vt 0x34 | 804972f0 */ virtual void run();
public:
/* 0x04 */ u32 mRoot1HeapStart;
/* 0x08 */ u32 mRoot1HeapEnd;
/* 0x0C */ u32 mRoot2HeapStart;
/* 0x10 */ u32 mRoot2HeapEnd;
/* 0x14 */ u32 mMemSize;
/* 0x18 */ Heap* mRootHeapMem1;
/* 0x1C */ Heap* mRootHeapMem2;
/* 0x20 */ Heap* mRootHeapDebug;
/* 0x24 */ Heap* mSystemHeap;
/* 0x28 */ Thread* mSystemThread;
/* 0x2C */ u32 field_0x2C;
/* 0x30 */ u32 mSystemHeapStart;
/* 0x34 */ u32 mSystemHeapSize;
/* 0x38 */ u32 mGraphicsFifoSize;
/* 0x3C */ u32 field_0x3C;
};
class BaseSystem {
public:
/* 80576780 */ static ConfigurationData* mConfigData;
static XfbManager* getXfbMgr() { return mConfigData->getXfbMgr(); }
static Display* getDisplay() { return mConfigData->getDisplay(); }
static Video* getVideo() { return mConfigData->getVideo(); }
};
} // namespace EGG
+38 -2
View File
@@ -1,6 +1,42 @@
#pragma once
#include <types.h>
#include <rvl/OS.h>
#include <nw4r/ut/List.h>
#include <egg/core/eggHeap.h>
namespace EGG {
class Thread;
}
class Thread {
public: // vtable: 0x00 | 8056ea40
/* 0x08 | 80496a60 */ virtual ~Thread();
/* 0x0C | 80496dd0 */ virtual void* run();
/* 0x10 | 800bd600 */ virtual void onEnter();
/* 0x14 | 800bd5f0 */ virtual void onExit();
public:
/* 0x04 */ Heap* mContainingHeap;
/* 0x08 */ OSThread* mOSThread;
/* 0x0C */ OSMessageQueue mMesgQueue;
/* 0x2C */ OSMessage* mMesgBuffer;
/* 0x30 */ int mMesgCount;
/* 0x34 */ void* mStackMemory;
/* 0x38 */ u32 mStackSize;
/* 0x3C */ Heap* mAllocatableHeap;
/* 0x40 */ Heap* mCurrentHeap;
/* 0x44 */ nw4r::ut::Node mLink;
public:
/* 80496910 */ Thread(u32 stackSize, int msgCount, int priority, Heap* heap);
/* 804969e0 */ Thread(OSThread* osThread, int msgCount);
/* 80496b20 */ static Thread* findThread(OSThread* thread);
/* 80496b90 */ static void initialize();
/* 80496bd0 */ void setThreadCurrentHeap(Heap* heap);
/* 80496c70 */ static void switchThreadCallback(OSThread* from, OSThread* to);
/* 80496d60 */ void setCommonMesgQueue(int mesgCount, Heap* heap);
/* 80496dc0 */ static void* start(void* thread);
public:
/* 80673b10 */ static nw4r::ut::List sThreadList;
/* 80576770 */ static void (*sOldSwitchThreadCallback)(OSThread*, OSThread*);
};
} // namespace EGG
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <types.h>
#include <rvl/OS.h>
// This is seen in Animal Crossing: City Folk also. Idk where it belongs
// Seen between EGG::Thread and EGG::ConfigurationData (eggThread and eggSystem)
// dSysNandThread (or NandRequestThread ) inherits from eggThread,
// with part of that thread referencing tsome of these funcs
namespace EGG
{
class Unknown {
public:
u8 _[0xfC-0x00]; // size unsure, but this is the limit seen
/* 80496de0 */ void fn_80496de0(OSThread*);
/* 80496e30 */ void fn_80496e30(OSThread*);
/* 80496f10 */ void fn_80496f10();
/* 804970e0 */ void fn_804970e0(OSThread*, u8*);
};
} // namespace EGG
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <types.h>
#include <rvl/GX.h>
#include <rvl/VI.h>
#include <egg/prim/eggBitFlag.h>
namespace EGG
{
class Video {
public:
struct RenderModeObjSet {
GXRenderModeObj* table[10];
};
public:
/* 0x00 */ GXRenderModeObj const* pRenderMode;
/* 0x04 */ TBitFlag<u8> mFlag;
/* 0x08 */ u32 mConfiguredTime;
public:
/* inline */ Video() : pRenderMode(0), mFlag(), mConfiguredTime() {};
/* 80498690 */ void initialize(GXRenderModeObj*, const RenderModeObjSet*);
/* 804986f0 */ void configure(GXRenderModeObj*, const RenderModeObjSet*);
/* 80498800 */ static u32 getTickPerVRetrace(u32 tvFormat);
/* 80498860 */ static u32 getTickPerVRetrace();
/* 80498890 */ static GXRenderModeObj* getStandardRenderModeObj(RenderModeObjSet*);
public:
/* inline */ void setBlack(bool b) {
VISetBlack(!mFlag.onBit(0));
mFlag.toggleBit(0);
}
};
} // namespace EGG
+30
View File
@@ -0,0 +1,30 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG
{
class Xfb {
public:
// Non-Official assumed based on actions
enum XFBState{
XFB_UNPROCESSED,
XFB_COPIED,
XFB_SHOWN,
};
public:
/* 0x00 */ u16 mWidth;
/* 0x02 */ u16 mHeight;
/* 0x04 */ u8* mBuffer;
/* 0x08 */ XFBState mState;
/* 0x0C */ Xfb* mNext; // idk the actual order, but they always link to each other
/* 0x10 */ Xfb* mPrev; // idk the actual order, but they always link to each other
public:
/* 804989e0 */ void init(u16 width, u16 height, Heap* heap);
/* 80498a60 */ Xfb(Heap* heap);
/* 80498ad0 */ static u32 calcBufferSize(u16 width, u16 height);
};
} // namespace EGG
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <types.h>
#include <egg/core/eggXfb.h>
namespace EGG
{
class XfbManager {
public:
/* 0x0 */ Xfb* mNextXfb; // next xfb to process?
/* 0x4 */ Xfb* mToCopyXfb; // current xfb to use in copyEFB
/* 0x8 */ Xfb* mToShowXfb; // current xfb to use in setNextFrameBuffer
/* 0xC */ u8 mNumXfbs; // Total number of Xfbs ever attached
/* 0xD */ u8 mNumXfbs_Copy; // Unsure of purpose yet, but showing wont proceed until its under 3
public:
/* 80498af0 */ bool isRegisterd(Xfb* xfb) const; // yes. this is correct spelling
/* 80498b30 */ bool attach(Xfb* xfb);
/* 80498c10 */ void copyEFB(bool);
/* 80498d00 */ void setNextFrameBuffer();
};
} // namespace EGG
+1 -1
View File
@@ -72,8 +72,8 @@ namespace EGG
class DvdRipper;
class ExpHeap;
class Fader;
class FrmHeap;
class Heap;
class FrmHeap;
class Scene;
class SceneManager;
class Thread;
+12
View File
@@ -0,0 +1,12 @@
#pragma once
#include <types.h>
namespace EGG
{
struct Matrix34f{
f32 mData[3][4];
};
} // namespace EGG
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <types.h>
namespace EGG
{
struct Vector3f {
f32 x,y,z;
};
struct Vector2f {
f32 x,y;
};
} // namespace EGG
+63
View File
@@ -0,0 +1,63 @@
#pragma once
// Pulled from ogws
#include <types.h>
namespace EGG
{
template<typename T> class TBitFlag {
public:
T value;
inline void makeAllZero() {
value = T();
}
inline TBitFlag() {
makeAllZero();
}
inline T makeMask(u8 bit) const {
return 1 << bit;
}
inline bool on(T mask) const {
return value & mask;
}
inline bool off(T mask) const {
return !(value & mask);
}
inline void set(T mask) {
value |= mask;
}
inline void reset(T mask) {
value &= ~mask;
}
inline bool onBit(u8 bit) const {
return on(makeMask(bit));
}
inline bool offBit(u8 bit) const {
return off(makeMask(bit));
}
inline void setBit(u8 bit) {
set(makeMask(bit));
}
inline void resetBit(u8 bit) {
reset(makeMask(bit));
}
inline void toggleBit(u8 bit) {
if (!onBit(bit))
setBit(bit);
else
resetBit(bit);
}
inline void changeBit(u8 bit, bool b) {
if (b)
setBit(bit);
else
resetBit(bit);
}
inline T getDirect() {
return value;
}
};
} // namespace EGG
+55
View File
@@ -0,0 +1,55 @@
#pragma once
#include <types.h>
#include <egg/core/eggHeap.h>
namespace EGG
{
template <typename T>
class TBuffer {
public:
// vtable 0x00
/* vt 0x08 */ virtual ~TBuffer(){
delete[] mBuffer;
mBuffer = nullptr;
}
/* vt 0x0C */ virtual void allocate(int n, int){
mSize = n;
mBuffer = new T[n];
onAllocate(nullptr);
}
/* vt 0x10 */ virtual void allocate(int n, Heap* heap, int){
mSize = n;
if (heap == nullptr) heap = Heap::sCurrentHeap;
mBuffer = new(heap, 4) T[n];
onAllocate(heap);
}
/* vt 0x14 */ virtual void onAllocate(Heap*){
return;
}
/* vt 0x18 */ virtual void errRangeOver(){
return;
}
public:
/* 0x08 */ s32 mSize;
/* 0x0C */ T* mBuffer;
public:
inline TBuffer() : mSize(0), mBuffer(nullptr) {}
inline bool isRangeValid(int i) {
return (i >= 0 && i < mSize);
}
inline void checkRange(int i) {
if (!isRangeValid(i)) {
errRangeOver();
}
}
inline T& operator()(int i) {
checkRange(i);
return mBuffer[i];
}
inline s32 getSize() { return mSize; }
};
} // namespace EGG
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include <types.h>
namespace nw4r
{
namespace db {
void DirectPrint_Init();
}
} // namespace nw4r
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <types.h>
#include <rvl/GX.h>
namespace nw4r
{
namespace ut
{
struct Color : public _GXColor {
Color() {}
/* 80007bc0 */ ~Color();
Color(u32 color) {
*(u32*)this = color;
}
Color& operator=(u32 color) {
*(u32*)this = color;
return *this;
}
};
} // namespace ut
} // namespace nw4r
+7 -5
View File
@@ -1,3 +1,4 @@
#pragma once
#ifndef RVL_SDK_ARC_H
#define RVL_SDK_ARC_H
#include <rvl/types.h>
@@ -72,12 +73,13 @@ typedef struct ARCEntry {
const char* name; // at 0xC
} ARCEntry;
typedef struct ARCDir {
typedef struct ARCDirEntry {
ARCHandle* handle; // at 0x0
u32 path_begin; // at 0x4
u32 path_it; // at 0x8
u32 path_end; // at 0xC
} ARCDir;
} ARCDirEntry;
BOOL ARCGetCurrentDir(ARCHandle* handle, char* string, u32 maxlen);
BOOL ARCInitHandle(void* bin, ARCHandle* handle);
@@ -89,9 +91,9 @@ s32 ARCGetStartOffset(ARCFileInfo* info);
u32 ARCGetLength(ARCFileInfo* info);
BOOL ARCClose(ARCFileInfo* info);
BOOL ARCChangeDir(ARCHandle* info, const char* path);
BOOL ARCOpenDir(ARCHandle* info, const char* path, ARCDir* dir);
BOOL ARCReadDir(ARCDir* dir, ARCEntry* entry);
BOOL ARCCloseDir(ARCDir* dir);
BOOL ARCOpenDir(ARCHandle* info, const char* path, ARCDirEntry* dir);
BOOL ARCReadDir(ARCDirEntry* dir, ARCEntry* entry);
BOOL ARCCloseDir(ARCDirEntry* dir);
#ifdef __cplusplus
}
+27
View File
@@ -7,6 +7,33 @@ extern "C" {
extern BOOL __DVDLongFileNameFlag;
typedef void (*DVDCommandCallback)(s32, struct DVDCommandBlock*);
typedef void (*DVDFileCallback)(s32, struct DVDFileInfo*);
typedef struct DVDCommandBlock {
/* 0x00 */ struct DVDCommandBlock* next;
/* 0x04 */ struct DVDCommandBlock* prev;
/* 0x08 */ u32 command;
/* 0x0c */ s32 state;
/* 0x10 */ u32 offset;
/* 0x14 */ u32 length;
/* 0x18 */ void* addr;
/* 0x1c */ u32 currTransferSize;
/* 0x20 */ u32 transferredSize;
/* 0x24 */ DVDDiskID* id;
/* 0x28 */ DVDCommandCallback callback;
/* 0x2c */ void* userData;
} DVDCommandBlock;
typedef struct DVDFileInfo
{
/* 0x00 */ DVDCommandBlock cb;
/* 0x30 */ u32 startAddr;
/* 0x34 */ u32 length;
/* 0x38 */ DVDFileCallback* callback;
} DVDFileInfo;
#ifdef __cplusplus
}
#endif
+5 -4
View File
@@ -47,10 +47,11 @@ void __GXCalculateVLim(void);
void __GXSetVAT(void);
static void GXSetTexCoordGen(GXTexCoordID id, GXTexGenType type,
GXTexGenSrc src, u32 texMtxIdx) {
// TODO: What matrix index is this???
GXSetTexCoordGen2(id, type, src, texMtxIdx, FALSE, 125);
}
GXTexGenSrc src, u32 texMtxIdx) ;
// // TODO: What matrix index is this???
// GXSetTexCoordGen2(id, type, src, texMtxIdx, FALSE, 125);
// }
#ifdef __cplusplus
}
-1
View File
@@ -18,7 +18,6 @@ void GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord,
GXTexMapID map);
void GXSetNumIndStages(u8 num);
void GXSetTevDirect(GXTevStageID stage);
void __GXUpdateBPMask(void);
void __GXSetIndirectMask(u32 mask);
void __GXFlushTextureState(void);
+1 -1
View File
@@ -7,7 +7,7 @@ extern "C" {
void GXDrawCylinder(u8 sides);
void GXDrawSphere(u32 stacks, u32 sectors);
/* 803bcdb0 */ void GXDrawDone();
#ifdef __cplusplus
}
#endif
+4
View File
@@ -21,6 +21,10 @@ typedef struct _GXRenderModeObj {
u8 vfilter[7]; // at 0x32
} GXRenderModeObj;
void GXSetCopyFilter(u8, const u8[12][2], u8, const u8[7]);
void GXSetCopyClear(GXColor, u32 zClear);
void GXSetDispCopySrc(u16 left, u16 top, u16 width, u16 height);
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -7,7 +7,7 @@ extern "C" {
#endif
void GXBegin(GXPrimitive prim, GXVtxFmt fmt, u16 verts);
static void GXEnd(void) {}
static void GXEnd(void);
void GXSetLineWidth(u8 width, u32 offset);
void GXSetPointSize(u8 size, u32 offset);
+1 -1
View File
@@ -4,10 +4,10 @@
extern "C" {
#endif
#include <rvl/MEM/mem_heapCommon.h>
#include <rvl/MEM/mem_allocator.h>
#include <rvl/MEM/mem_expHeap.h>
#include <rvl/MEM/mem_frameHeap.h>
#include <rvl/MEM/mem_heapCommon.h>
#include <rvl/MEM/mem_list.h>
#ifdef __cplusplus
+1 -5
View File
@@ -1,6 +1,4 @@
#ifndef MACROS_H
#define MACROS_H
#pragma once
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
@@ -47,5 +45,3 @@
#define __attribute__(x)
#define __declspec(x)
#endif
#endif
+7
View File
@@ -0,0 +1,7 @@
#pragma once
#include <types.h>
class mFrustum_c {
};
+23 -21
View File
@@ -11,25 +11,27 @@ namespace EGG {
}
// TODO: Doc symbols and func locations
namespace mHeap {
EGG::ExpHeap* createExpHeap(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
void adjustExpHeap(EGG::Heap* heap);
s32 expHeapCost(s32 start, s32 size);
EGG::FrmHeap* createFrmHeap(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
void destroyFrmHeap(EGG::Heap* heap);
void adjustFrmHeap(EGG::Heap* heap);
s32 frmHeapCost(s32 start, s32 size);
void setTempHeap(EGG::Heap** prevHeap, EGG::Heap* tempNewHeap);
void restoreTempHeap(EGG::Heap** prevHeap);
void createHeap(s32 size, EGG::Heap*, char* name);
void saveCurrentHeap();
void restoreCurrentHeap();
EGG::Heap* makeFrmHeapAndSet(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
int getGameHeapNum();
EGG::Heap* createGameHeap(s32 heapNum, s32 size, EGG::Heap* parentHeap);
EGG::Heap* createGameHeap1(s32 size, EGG::Heap* parentHeap);
void createArchiveHeap(s32 size, EGG::Heap* parentHeap);
void createCommandHeap(s32 size, EGG::Heap* parentHeap);
void createDylinkHeap(s32 size, EGG::Heap* parentHeap);
void createAssertHeap(EGG::Heap* parentHeap);
EGG::Heap* makeHeapOnCurrentGameHeap(s32 size, char* name, s32 align, u32 unk);
/* 802f0f00 */ u8 copyAttribute(u32);
/* 802f0f40 */ EGG::Heap* setCurrentHeap(EGG::Heap*);
/* 802f0f50 */ EGG::ExpHeap* createExpHeap(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
/* 802f1060 */ void adjustExpHeap(EGG::Heap* heap);
/* 802f10d0 */ s32 expHeapCost(s32 start, s32 size);
/* 802f10f0 */ EGG::FrmHeap* createFrmHeap(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
/* 802f1200 */ void destroyFrmHeap(EGG::Heap* heap);
/* 802f1220 */ void adjustFrmHeap(EGG::Heap* heap);
/* 802f1290 */ s32 frmHeapCost(s32 start, s32 size);
/* 802f12b0 */ void setTempHeap(EGG::Heap** prevHeap, EGG::Heap* tempNewHeap);
/* 802f12f0 */ void restoreTempHeap(EGG::Heap** prevHeap);
/* 802f1350 */ void createHeap(s32 size, EGG::Heap*, char* name);
/* 802f13d0 */ void saveCurrentHeap();
/* 802f13e0 */ void restoreCurrentHeap();
/* 802f1410 */ EGG::Heap* makeFrmHeapAndSet(s32 size, EGG::Heap* parentHeap, char* name, s32 align, u32 unk);
/* 802f1450 */ int getGameHeapNum();
/* 802f1460 */ EGG::Heap* createGameHeap(s32 heapNum, s32 size, EGG::Heap* parentHeap);
/* 802f1510 */ EGG::Heap* createGameHeap1(s32 size, EGG::Heap* parentHeap);
/* 802f1560 */ void createArchiveHeap(s32 size, EGG::Heap* parentHeap);
/* 802f1590 */ void createCommandHeap(s32 size, EGG::Heap* parentHeap);
/* 802f15c0 */ void createDylinkHeap(s32 size, EGG::Heap* parentHeap);
/* 802f15f0 */ void createAssertHeap(EGG::Heap* parentHeap);
/* 802f1640 */ EGG::Heap* makeHeapOnCurrentGameHeap(s32 size, char* name, s32 align, u32 unk);
};
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// This file is a complete guess