diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9f38c245fc..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "include/lib/BrawlHeaders"] - path = include/lib/BrawlHeaders - url = https://github.com/Sammi-Husky/BrawlHeaders diff --git a/include/lib/BrawlHeaders b/include/lib/BrawlHeaders deleted file mode 160000 index 29c4ff16ce..0000000000 --- a/include/lib/BrawlHeaders +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 29c4ff16ce06241ea672ffd54e6415fbd02c0743 diff --git a/include/lib/BrawlHeaders/Brawl/Include/ac/ac_anim_cmd_impl.h b/include/lib/BrawlHeaders/Brawl/Include/ac/ac_anim_cmd_impl.h new file mode 100644 index 0000000000..2e227ab83a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ac/ac_anim_cmd_impl.h @@ -0,0 +1,139 @@ +#pragma once + +#include +#include +#include +#include + +// TODO: confirm class name +struct acCmdArgConv { + s32 argType; + // IntData, StringData, ValueIndexData, FloatData, AddressData, BoolData + s32 data; +}; + +class acCmdArg { + const acCmdArgConv* m_dataPtr; + u8 m_isNull; +public: + acCmdArg() : m_dataPtr(0), m_isNull(false) { } + + bool isNull() const { return m_isNull; } + void setNull(bool val) { m_isNull = val; } + void setDataPtr(const acCmdArgConv* ptr) { m_dataPtr = ptr; } + + // 0: getIntData + // 1: getFloatData + // 2: getAddressData + // 3: getBoolData? + // 4: getStringData? + // 5: getValueIndexData? + s32 getArgType() const { + if (m_isNull == 1) { + return -1; + } + return m_dataPtr->argType; + } + + s32 getIntData() const { + if (m_isNull == 1) { + return 0; + } + return m_dataPtr->data; + } + + float getFloatData() const { + if (m_isNull == 1) { + return 0.0f; + } + return m_dataPtr->data / 60000.0f; + } + + void* getAddressData() { + if (m_isNull == 1) { + return 0; + } + return (void*) m_dataPtr->data; + } +}; + +// TODO: confirm class name +struct acAnimCmdConv +{ + s8 group; // group 0 refers to systemCmds, >= 1 notSystemCmds + s8 type; // when group == 0, selects one of the 25 systemCmds to interpret + s8 argNum; + u8 option; + const acCmdArgConv* args; +}; + +// Currently, no real functions use this wrapper class. +// TODO: Confirm that this is really acCmdArgList, and +// use it in a legitimate way +struct acCmdArgList { + soArrayContractibleTable argList; + + acCmdArgList() : argList() { } + acCmdArgList(const acCmdArgConv* p1, s32 p2) : argList(p1, p2) { } + + ~acCmdArgList() { } + bool isEmpty() const { return argList.isEmpty(); } +}; + +class acAnimCmd : public soNullable { +public: + acAnimCmd() : soNullable(false) { } + acAnimCmd(bool isNull) : soNullable(isNull) { } + + virtual s8 getGroup() const = 0; + virtual s8 getType() const = 0; + virtual s32 getArgNum() const = 0; + virtual u8 getOption() const = 0; + virtual soArrayContractibleTable getArgList() = 0; + virtual bool getArg(acCmdArg* arg, s32 index) const = 0; + virtual const acAnimCmdConv* getCmdAddress() const = 0; + virtual bool isArgEmpty() const = 0; + virtual bool isValid() const = 0; + virtual ~acAnimCmd() { } +}; + +class acAnimCmdImpl : public acAnimCmd { +public: + const acAnimCmdConv* cmdAddr; + + acAnimCmdImpl() : acAnimCmd(false), cmdAddr(0) { } + virtual s8 getGroup() const; + virtual s8 getType() const; + virtual s32 getArgNum() const; + virtual u8 getOption() const; + virtual soArrayContractibleTable getArgList(); + virtual bool getArg(acCmdArg* arg, s32 index) const; + virtual const acAnimCmdConv* getCmdAddress() const { return cmdAddr; } + virtual bool isArgEmpty() const; + virtual bool isValid() const; + virtual ~acAnimCmdImpl() { } + + // TODO: made up deadstripped function to make soArrayFixed::isEmpty + // get emitted earlier + acCmdArgList getEmptyArgList(); +}; +static_assert(sizeof(acAnimCmdImpl) == 0xC, "Class is the wrong size!"); + +class acAnimCmdNull : public acAnimCmd { +public: + acAnimCmdNull() : acAnimCmd(true) { } + + virtual s8 getGroup() const; + virtual s8 getType() const; + virtual s32 getArgNum() const; + virtual u8 getOption() const; + virtual soArrayContractibleTable getArgList(); + virtual bool getArg(acCmdArg* arg, s32 index) const; + virtual const acAnimCmdConv* getCmdAddress() const; + virtual bool isArgEmpty() const; + virtual bool isValid() const; + virtual ~acAnimCmdNull(); +}; + +extern acCmdArg g_acCmdArg; +extern acAnimCmdNull g_acAnimCmdNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ac/ac_cmd_interpreter.h b/include/lib/BrawlHeaders/Brawl/Include/ac/ac_cmd_interpreter.h new file mode 100644 index 0000000000..6971dec8ab --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ac/ac_cmd_interpreter.h @@ -0,0 +1,120 @@ +#pragma once + +#include +#include +#include +#include +#include + +// TODO: confirm whether this class is really needed +class acCmdInterpreterBase { +public: + virtual bool dispatchCmdIf(const acAnimCmd* cmd); + virtual s32 dispatchCmdSwitch(const acAnimCmd* cmd) const; + virtual void interpretNotSystemCmd(); + virtual bool isBreakInterpret(); + virtual bool isSleepStackData(s32 kind) const; + virtual bool isSkipEnd() const; +}; + +struct acCmdInterpreterStackData { + // TODO: identify exact meaning of knd0 and knd7: + // knd0: used for isBreakInterpret, Wait + // knd7: if unk30Field2 = 2, used for Wait to determine how much to wait, if at all + enum Kind { + Invalid = -1, + knd0 = 0, + Frame = 1, + Loop = 2, + ReturnAddress = 3, + IfCondition = 4, + Switch = 5, + While = 6, + knd7 = 7, + }; + + acCmdInterpreterStackData(Kind knd = Invalid, s32 id = 0, bool bd = false, + const acAnimCmdConv* ad = nullptr, float fd = 0.0f) : + kind(knd), intData(id), boolData(bd), addressData(ad), floatData(fd) { } + + Kind kind; + s32 intData; // Loop count, or result of dispatchCmdSwitch + bool boolData; // If condition result, "found Case" flag for Switch + const acAnimCmdConv* addressData; // target address for jumps + float floatData; // some data for wait time calculations +}; + +class acCmdInterpreter : private acCmdInterpreterBase { + float m_fixedTimeStep; + float m_lastTimeStep; + const acAnimCmdConv* m_currentCmd; + const acAnimCmdConv* m_copyCurrentCmd; // purpose unclear + acAnimCmdImpl m_animCmd; // usually kept in sync with m_currentCmd + soArrayVector* m_stack; + float m_currentFrame; + float unk28; + float m_overshoot; + const s32 m_interpretMode:2; // -2 or -1 -> skip all commands, 0 -> use m_fixedTimeStep + s32 unk30Field2:3; // related to isSkipEnd + u8 m_dontAdvance; + u8 unk32; // appears to be unused + u8 m_reset; + +public: + acCmdInterpreter(soArrayVector* stk, + s32 mode, acAnimCmdConv* initCmd, const u8* resetMode, float fixedTimeStep); + ~acCmdInterpreter(); + + virtual bool dispatchCmdIf(const acAnimCmd* cmd) { return true; } + virtual s32 dispatchCmdSwitch(const acAnimCmd* cmd) const; + virtual void interpretNotSystemCmd(); + virtual bool isBreakInterpret(); + virtual bool isSleepStackData(s32 kind) const; + virtual bool isSkipEnd() const; + + void interpretCmd(float timeStep); + void resetInterpreter(float frame, const acAnimCmdConv *initCmd); + void skipCmd(); + acCmdInterpreterStackData* getLastSystemStackData(); + void popSystemStack(); + void pushSystemStack(const acCmdInterpreterStackData& stackData); + void skipNextIfGroup(bool skippingIfBlock); + void skipNextSwitchGroup(bool doNotSkipCases); + void skipNextNotSwitchGroup(); + void skipNextLoopGroup(); + void skipNextWhileGroup(); + const acAnimCmd* getCurrentCmd(); + bool testCurrentCmd() const; + void advanceCurrentCmd(); + const acAnimCmd* updateCurrentCmd(); + s32 getIdxOfStackData(acCmdInterpreterStackData::Kind kind) const; + void interpretOneCmd(); + void popStackToSize(s32 i); + void systemCmdFuncWaitSub(float waitTime); + void systemCmdFuncEnd(); + void systemCmdFuncWait(); + void systemCmdFuncFrame(); + void systemCmdFuncFrameClr(); + void systemCmdFuncLoop(); + void systemCmdFuncPool(); + void systemCmdFuncBreak(); + void systemCmdFuncCall(); + void systemCmdFuncReturn(); + void systemCmdFuncJump(); + void systemCmdFuncIf(); + void systemCmdFuncIfAnd(); + void systemCmdFuncIfOr(); + void systemCmdFuncElsIf(); + void systemCmdFuncElse(); + void systemCmdFuncEndIf(); + void systemCmdFuncSwitch(); + void systemCmdFuncCase(); + void systemCmdFuncDefault(); + void systemCmdFuncEndSwitch(); + void systemCmdFuncWhile(); + void systemCmdFuncWhileAnd(); + void systemCmdFuncWhileOr(); + void systemCmdFuncEndWhile(); + void systemCmdFuncBreakSwitch(); +}; +static_assert(sizeof(acCmdInterpreter) == 0x34, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ad/ad_autosave.h b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_autosave.h new file mode 100644 index 0000000000..afa3defe01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_autosave.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class adAutoSave : public gfTask { + u8 unk0[0x10]; +public: + virtual void processDefault(); + virtual void init(); + virtual ~adAutoSave(); + + static adAutoSave* create(bool p1); + static bool isAlive(); +}; +static_assert(sizeof(adAutoSave) == 0x50, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ad/ad_list.h b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_list.h new file mode 100644 index 0000000000..5de60eac90 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_list.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include + +template +struct adListNode { + adListNode* m_prev; + adListNode* m_next; + T m_val; +}; + +template +class adListInterface { +public: + virtual u32 count() const = 0; + virtual void reset() = 0; + virtual T* current() = 0; + virtual T* end() = 0; + virtual T get() const = 0; + virtual void set(T val) = 0; + virtual void next() = 0; + virtual void prev() = 0; + virtual void pushBack(T val) = 0; + virtual void remove() = 0; + virtual void eraseCurrentNode() = 0; +}; + +template +class adList : public adListInterface { + adListNode* m_start; + adListNode* m_end; + adListNode* m_current; + u32 m_count; +public: + virtual u32 count() const; + virtual void reset(); + virtual T* current(); + virtual T* end(); + virtual T get() const; + virtual void set(T val); + virtual void next(); + virtual void prev(); + virtual void pushBack(T val); + virtual void remove(); + virtual void eraseCurrentNode(); + + adList() : m_start(nullptr), m_end(nullptr), m_current(nullptr), + m_count(0) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ad/ad_static_data.h b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_static_data.h new file mode 100644 index 0000000000..b865b1feef --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ad/ad_static_data.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +struct adventureStaticData { + u32 unk0; + u8 unk4; + + static const u32 AllStepNum = 0x101; + static adventureStaticData s_adventureStaticData[AllStepNum]; +public: + static s32 getStepIndex(u32 p1); + static u32 getAllStepNum(); +}; +static_assert(sizeof(adventureStaticData) == 8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ai/ai_mgr.h b/include/lib/BrawlHeaders/Brawl/Include/ai/ai_mgr.h new file mode 100644 index 0000000000..d994d72c19 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ai/ai_mgr.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include +#include + +class aiMgr : public gfTask, public ftOutsideEventObserver { + char _76[828]; + +public: + virtual void processBegin(); + virtual void renderDebug(); + virtual ~aiMgr(); + + virtual void notifyEventOnDamage(int entryId, u32 hp, soDamage* damage); + virtual void notifyEventDead(int entryId, int deadCount, Fighter::Dead::Reason deadReason, int respawnFrames); + virtual void notifyEventChangeStart(int entryId, int playerNo, int activeInstanceIndex, ftKind); + virtual void notifyEventChangeEnd(int entryId, int playerNo, int activeInstanceIndex, ftKind); + + int setDangerZone(Vec2f* p1, Vec2f* p2, int index, bool, bool); + void delDangerZone(int); +}; +static_assert(sizeof(aiMgr) == 0x388, "Class is wrong size!"); + +extern aiMgr* g_aiMgr; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_camera_controller.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_camera_controller.h new file mode 100644 index 0000000000..4b34672828 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_camera_controller.h @@ -0,0 +1,71 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class CameraController : public gfTask { +public: + enum Kind { + None = 0x0, + Animation = 0x1, + AI = 0x2, + Adventure = 0x3, + AdventureFree = 0x4, + AnimationLocked = 0x5, + FighterTarget = 0x6, + Photo = 0x7, + MenuPad = 0x8, + MenuFixed = 0x9, + FigDisp1 = 0xa, + Tech = 0xb, + MeleeFixed = 0xc, + Demo = 0xd, + Default = 0xe + }; + + Kind m_currentControllerKind; + char _68[4]; + gfCameraController* m_currentController; + gfCameraController* m_defaultController; + cmAnimationController* m_animationController; + gfCameraController* m_fighterTargetController; + gfCameraController* m_aiController; + gfCameraController* m_meleeFixedController; + gfCameraController* m_adventureController; + gfCameraController* m_adventureFreeController; + gfCameraController* m_photoController; + gfCameraController* m_menuPadController; + gfCameraController* m_menuFixedController; + gfCameraController* m_figDisp1Controller; + gfCameraController* m_techController; + void* m_quake; + gfCameraController* m_demoController; + cmStageParam m_stageCameraParam; // 0x84 + cmStageParamPaused m_stageCameraParamPaused; // 0xC4 + cmStageParamFixed m_stageCameraParamFixed; // 0x110 + Rect2D m_stageCameraRange; // 0x128 + Rect2D m_stageDeadRange; // 0x138 + char _328[16]; // 0x148 + float unk158; + float unk15C; + float unk160; + float unk164; + char unk168[60]; + + virtual void processCamera(); + virtual void processDebug(); + virtual void renderDebug(); + virtual void init(); + virtual ~CameraController(); + + void changeInput(Kind cameraControllerKind); + void setRangeOffset(Vec2f* offset); + void setCameraRange(Rect2D*); + gfCameraController* getCameraController(Kind kind); + static CameraController* getInstance(); +}; +static_assert(sizeof(CameraController) == 420, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_ai.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_ai.h new file mode 100644 index 0000000000..65971e682e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_ai.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +class cmAIController : public gfCameraController { +public: + char _0x8[0xA8]; + Vec2f m_devilOffset; + char _0xb8[0xE0]; + + virtual void update(float p1); + virtual void draw(); + virtual ~cmAIController(); + virtual void updateCameraPosTarget(); + + void updateMeleeFix(float p1); + void resetDevilOffset(); + void accDevilOffset(Vec2f*); + +}; +static_assert(sizeof(cmAIController) == 0x198, "Class is wrong size!"); + +extern cmAIController* g_cmAIController; diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_anm.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_anm.h new file mode 100644 index 0000000000..58336f7e5e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_anm.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include +#include + +class cmAnimationController : public gfCameraController { + char _8[28]; + +public: + virtual void update(float); + + bool setScnAnmRes(nw4r::g3d::ResAnmScn, u32); + void releaseScnAnmRes(); +}; +static_assert(sizeof(cmAnimationController) == 0x24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_default.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_default.h new file mode 100644 index 0000000000..96df8890bd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_default.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +class cmDefaultController : public gfCameraController { +public: + virtual void update(float); +}; +static_assert(sizeof(cmDefaultController) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_melee_fixed.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_melee_fixed.h new file mode 100644 index 0000000000..077693f0e4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_melee_fixed.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class cmMeleeFixedController : public gfCameraController { +public: + cmMeleeFixedController(); + ~cmMeleeFixedController(); + virtual void update(float p1); +}; +static_assert(sizeof(cmMeleeFixedController) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_photo.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_photo.h new file mode 100644 index 0000000000..73d311f0dd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_controller_photo.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class cmPhotoController : public gfCameraController { +public: + void addCallBack(utListNode* cb); + void removeCallBack(utListNode* cb); + void setFreezeMode(void* p1); +}; + +class soPhotoController : public cmPhotoController { +public: + bool setFreezeMode(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_quake.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_quake.h new file mode 100644 index 0000000000..913a5b0a51 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_quake.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include + +class cmQuake { +public: + enum Amplitude { + Amplitude_None = 0x0, + Amplitude_M = 0x1, + Amplitude_Middle = 0x1, + Amplitude_S_Half = 0x2, + Amplitude_Small_Hf = 0x2, + Amplitude_S = 0x3, + Amplitude_Small = 0x3, + Amplitude_L = 0x4, + Amplitude_Large = 0x4, + Amplitude_XL = 0x5, + Amplitude_More_Large = 0x5, + }; + + char _[0x274]; +}; +static_assert(sizeof(cmQuake) == 0x274, "Class is wrong size!"); + +void cmReqQuake(cmQuake::Amplitude amplitude, Vec3f* offset); +void cmRemoveQuake(int index); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_stage_param.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_stage_param.h new file mode 100644 index 0000000000..2f6dee3bbb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_stage_param.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include + +struct cmStageParam { + Rect2D m_range; + float m_verticalRotationFactor; + float m_horizontalRotationFactor; + float m_minZ; + float m_maxZ; + Vec3f m_centerPos; + float m_fighterBubbleBufferMultiplier; + float m_48; + float m_speed; + float m_tiltThreshold; + float m_fov; +}; +static_assert(sizeof(cmStageParam) == 0x40, "Class is wrong size!"); + +struct cmStageParamFixed { + Vec3f m_centerPos; + float m_fov; + float m_verticalAngle; + float m_horizontalAngle; +}; +static_assert(sizeof(cmStageParamFixed) == 24, "Class is wrong size!"); + +struct cmStageParamPausedOffsetRange { + float m_0; + float m_4; + float m_8; + float m_12; + cmStageParamPausedOffsetRange(); +}; +static_assert(sizeof(cmStageParamPausedOffsetRange) == 16, "Class is wrong size!"); + +struct cmStageParamPaused { + float m_angle; + float m_zoomIn; + float m_zoomDefault; + float m_zoomOUt; + float m_rotYMin; + float m_rotYMax; + float m_rotXMin; + float m_rotXMax; + Vec3f m_centerPos; + cmStageParamPausedOffsetRange m_offsetRange; + char _60[16]; +}; +static_assert(sizeof(cmStageParamPaused) == 76, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/cm/cm_subject.h b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_subject.h new file mode 100644 index 0000000000..de5f2a6d01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/cm/cm_subject.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include + +class cmSubject { +public: + char _0[16]; + Vec3f m_pos; + char _28[16]; + Rect2D m_range; + Rect2D m_60; + Rect2D m_76; + char _92[40]; +}; +static_assert(sizeof(cmSubject) == 132, "Class is wrong size!"); + +class cmSubjectList { + // TODO +public: + static cmSubject* getSubjectByPlayerNo(u32 playerNo); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ec/ec_mgr.h b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_mgr.h new file mode 100644 index 0000000000..3b48cf8271 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_mgr.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class ecMgr; +extern ecMgr* g_ecMgr; +class ecMgr : public gfTask { +public: + u8 unk40[0x50]; + u32 unk90; + u32 unk94; + u8 unk98[0x10]; + + ecMgr(); + void setDrawPrio(int prio); + u32 setEffect(EfID effectID); + u32 setEffect(EfID effectID, Vec3f* pos); + u32 setEffect(EfID effectID, const Vec3f* pos, const Vec3f* rot, const Vec3f* scale); + void endEffect(u32); + void killEffect(u32, u32, u32); + void setParent(u32 handleId, nw4r::g3d::ScnMdl*, const char*, bool); + void setParent(u32 handleId, nw4r::g3d::ScnMdl*, u32, bool); + void setParent(u32 handleId1, u32 handleId2, const char*, bool); + void pushsetCurrentGroup(u32 p1); + void popCurrentGroup(); + void preSetAnmIdx(int chrIndex, int visIndex, int patIndex, int srtIndex, int clrIndex, int shpIndex); + void setGroundAttach(u32, soGroundModule* groundModule); + void setGroundAttach(u32, grCollisionLineWork* lineWork); + void setVisible(u32, bool isVisible); + void setVisibleGroup(u32, bool isVisible, u32, u32); + void setPos(u32, Vec3f* pos); + void setRot(u32, Vec3f* rot); + void setScl(u32, Vec3f* scale); + void setMdlTexpat(u32, u32); + void setMdlAnmIdx(u32, u32, s8); + void setMdlEnableUpdate(u32, bool, s8); + void setMdlFrame(u32, float, s8); + void setSlowRate(u32 effectHandleID, u32 slowMagnitude); + u32 searchResourceID(char* resourceName); + virtual ~ecMgr(); + + inline static ecMgr* getInstance() { return g_ecMgr; } + +}; +static_assert(sizeof(ecMgr) == 0xa8, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace.h b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace.h new file mode 100644 index 0000000000..7ae32c1491 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +struct ecTrace { + u8 unk0[0x1C]; + ecTrace* m_prev; + ecTrace* m_next; + u32 m_id; + u32 unk28; + u32 unk2C; + u8 unk30[0x1C]; + Vec3f unk4C; + Vec3f unk58; + Vec3f unk64; + u8 unk70[0x4]; + float unk74; + u8 unk78[0xC]; + ~ecTrace(); + bool update_just(); + void update_odd(float p1); + void renderXlu(); + + ecTrace(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 p7); + ecTrace(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6); + void end(u32 p1, u32 p2); + void pause(bool p1); +}; +static_assert(sizeof(ecTrace) == 0x84, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace_mgr.h b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace_mgr.h new file mode 100644 index 0000000000..72f9105de8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ec/ec_trace_mgr.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct ecTraceMgr { + ecTrace* m_head; + ecTrace* m_tail; + u32 m_nextId; + u32 m_length; + + ecTraceMgr(); + ~ecTraceMgr(); + void update_just(); + void update_odd(float p1); + void renderXlu(); + + u32 start(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 p7, u8 p8, + u32 p9, float p10); + u32 start(u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u8 p7, u32 p8, + float p9); + u32 regist(ecTrace* trace, u32 p2, u8 p3, float p4); + bool end(u32 id, u32 p2, u32 p3); + void endGroup(u32 p1, u32 p2, u32 p3); + void pauseGroup(bool p1, u32 p2, u32 p3); + bool setOffset(u32 id, const Vec3f& p2, const Vec3f& p3); + void setAttachEffect(u32 id, EfID efId, nw4r::g3d::ScnMdl* scnMdl, u32 nodeIndex, + const Vec3f* pos, const Vec3f* rot, const Vec3f* scale); + + ecTrace* getTraceById(u32 id) const { + if (id) + for (ecTrace* curr = m_head; curr; curr = curr->m_next) + if (curr->m_id == id) + return curr; + return nullptr; + } +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/ef/ef_id.h b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_id.h new file mode 100644 index 0000000000..b9ebf029a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_id.h @@ -0,0 +1,5301 @@ +#pragma once + +//#include + +enum EfID { + ef_ptc_common_hit_normal_a = 0x01, + ef_ptc_common_hit_normal_shock_wave = 0x02, + ef_ptc_common_hit_fire = 0x03, + ef_ptc_common_hit_elec = 0x04, + ef_ptc_common_hit_cut = 0x05, + ef_ptc_common_landing_smoke = 0x07, + ef_ptc_common_landing_smoke_s = 0x08, + ef_ptc_common_dash_smoke = 0x0a, + ef_ptc_common_down_smoke = 0x0b, + ef_ptc_common_flyroll_smoke = 0x0c, + ef_ptc_common_action_smoke_h = 0x0d, + ef_ptc_common_smash_flash = 0x10, + ef_ptc_common_smash_flash_s = 0x11, + ef_ptc_common_damage_fire = 0x12, + ef_ptc_common_damage_elec = 0x13, + ef_ptc_common_shield = 0x14, + ef_ptc_common_shield_smoke = 0x15, + ef_ptc_common_shield_damage = 0x16, + ef_ptc_common_dead = 0x17, + ef_ptc_common_bomb_a = 0x18, + ef_ptc_common_flame = 0x19, + ef_ptc_common_run_smoke = 0x1a, + ef_ptc_common_jump_smoke = 0x1b, + ef_ptc_common_turn_smoke = 0x1c, + ef_ptc_common_flash = 0x1d, + ef_ptc_common_jump_aerial = 0x1e, + ef_ptc_common_cliff_catch = 0x1f, + ef_ptc_common_guard_mark = 0x20, + ef_ptc_common_attack_smoke = 0x21, + ef_ptc_common_erase_smoke = 0x22, + ef_ptc_common_bomb_b = 0x23, + ef_ptc_common_action_smoke_v = 0x25, + ef_ptc_common_slip_spark = 0x26, + ef_ptc_common_horizontal_smoke_a = 0x27, + ef_ptc_common_horizontal_smoke_b = 0x28, + ef_ptc_common_vertical_smoke_a = 0x29, + ef_ptc_common_vertical_smoke_b = 0x2a, + ef_ptc_common_catch = 0x2c, + ef_ptc_common_piyopiyo = 0x2d, + ef_ptc_common_piyo = 0x2e, + ef_ptc_common_sleep = 0x2f, + ef_ptc_common_damage_hadou = 0x30, + ef_ptc_common_step_jump = 0x31, + ef_ptc_common_bound_smoke = 0x33, + ef_ptc_common_catch_2 = 0x34, + ef_ptc_common_item_get = 0x35, + ef_ptc_common_recovery = 0x36, + ef_ptc_common_item_arrival = 0x37, + ef_ptc_common_monsterball = 0x38, + ef_ptc_common_quake = 0x39, + ef_ptc_common_bomb_c = 0x3a, + ef_ptc_common_bomb_d = 0x3b, + ef_ptc_common_freezer = 0x3c, + ef_ptc_common_kusudama = 0x3d, + ef_ptc_common_hit_ice = 0x3f, + ef_ptc_common_hit_ice_shock_wave = 0x40, + ef_ptc_common_fire_flower = 0x41, + ef_ptc_common_smoke_screen = 0x42, + ef_ptc_common_thunder = 0x43, + ef_ptc_common_thunder_flash = 0x44, + ef_ptc_common_final_line = 0x47, + ef_ptc_common_final_aura = 0x48, + ef_ptc_common_clacker_shot = 0x49, + ef_ptc_common_clacker_bullet_s = 0x4a, + ef_ptc_common_clacker_bullet_l = 0x4b, + ef_ptc_common_clacker_bomb = 0x4c, + ef_ptc_common_bomb_e = 0x4d, + ef_ptc_common_water_splash = 0x4e, + ef_ptc_common_water_ripple = 0x4f, + ef_ptc_common_drown = 0x50, + ef_ptc_common_hit_normal_b = 0x51, + ef_ptc_common_damage_shien = 0x52, + ef_ptc_common_gekikara_aura = 0x53, + ef_ptc_common_gekikara_fire = 0x54, + ef_ptc_common_matchless = 0x55, + ef_ptc_common_superjumppunch = 0x57, + ef_ptc_common_ray_gun_shot = 0x59, + ef_ptc_common_rip_stick = 0x5a, + ef_ptc_common_star_rod_bullet = 0x5b, + ef_ptc_common_star_rod_shot = 0x5c, + ef_ptc_common_star_rod_shibuki = 0x5d, + ef_ptc_common_drown_out = 0x5e, + ef_ptc_common_screw = 0x5f, + ef_ptc_common_bomb_spark = 0x60, + ef_ptc_common_hit_poison = 0x61, + ef_ptc_common_badge = 0x63, + ef_ptc_common_deku = 0x64, + ef_ptc_common_smart_bomb = 0x65, + ef_ptc_common_box_00_break = 0x66, + ef_ptc_common_box_01_break = 0x67, + ef_ptc_common_box_02_break = 0x68, + ef_ptc_common_barrel_02_break = 0x69, + ef_ptc_common_dead_flash = 0x6a, + ef_ptc_common_warp_star = 0x6b, + ef_ptc_common_pasaran = 0x6c, + ef_ptc_common_dragoon_aparts = 0x6d, + ef_ptc_common_dragoon_bparts = 0x6e, + ef_ptc_common_dragoon_enter = 0x6f, + ef_ptc_common_dragoon_sight_fire = 0x70, + ef_ptc_common_dragoon_attack = 0x71, + ef_ptc_common_smash_ball = 0x72, + ef_ptc_common_soccer_ball = 0x73, + ef_ptc_common_assist = 0x74, + ef_ptc_common_super_star_flash = 0x75, + ef_ptc_common_heart_flash = 0x76, + ef_ptc_common_cdget = 0x77, + ef_ptc_common_dragoon_flash = 0x78, + ef_ptc_common_misfire = 0x79, + ef_ptc_common_absorption = 0x7a, + ef_ptc_common_asase_walk = 0x7b, + ef_ptc_common_asase_landing = 0x7c, + ef_ptc_common_spflash = 0x7d, + ef_ptc_common_warp_star_break = 0x7e, + ef_ptc_common_just_shield = 0x7f, + ef_ptc_common_ice_landing = 0x80, + ef_ptc_common_pasaran_spark = 0x81, + ef_ptc_common_chewing = 0x82, + ef_ptc_common_smash_plate_flash = 0x83, + ef_ptc_common_samus_change_flash_a = 0x84, + ef_ptc_common_szerosuit_entry_flash = 0x85, + ef_ptc_common_szerosuit_entry_smoke = 0x86, + ef_ptc_common_cliff_catch_2 = 0x87, + ef_ptc_mario_fireball = 0x10001, + ef_ptc_mario_fireball_shoot = 0x10002, + ef_ptc_mario_fireball_bound = 0x10003, + ef_ptc_mario_supermant_1 = 0x10004, + ef_ptc_mario_supermant_2 = 0x10005, + ef_ptc_mario_superjumppunch = 0x10006, + ef_ptc_mario_pump_shoot = 0x10007, + ef_ptc_mario_pump_hit = 0x10008, + ef_ptc_mario_pump_fade = 0x10009, + ef_ptc_mario_pump = 0x1000a, + ef_ptc_mario_pump_max = 0x1000b, + ef_ptc_donkey_head_bat = 0x20001, + ef_ptc_donkey_giant_punch = 0x20002, + ef_ptc_donkey_giant_punch_max = 0x20003, + ef_ptc_donkey_giant_punch_smoke = 0x20004, + ef_ptc_donkey_hand_slap = 0x20005, + ef_ptc_donkey_entry = 0x20006, + ef_ptc_link_arrow_ring = 0x30002, + ef_ptc_link_arrow_max = 0x30003, + ef_ptc_link_boomerang = 0x3000b, + ef_ptc_link_navy = 0x3000d, + ef_ptc_link_bomb_spark = 0x3000f, + ef_ptc_samus_jump_jet = 0x40001, + ef_ptc_samus_attack_bomb = 0x40002, + ef_ptc_samus_charge_shot_bullet = 0x40003, + ef_ptc_samus_charge_shot_hold = 0x40004, + ef_ptc_samus_charge_shot_shot = 0x40005, + ef_ptc_samus_charge_shot_max = 0x40006, + ef_ptc_samus_missile_straight = 0x40007, + ef_ptc_samus_missile_homing = 0x40008, + ef_ptc_samus_missile_shot = 0x40009, + ef_ptc_samus_screw_attack = 0x4000a, + ef_ptc_samus_appeal_s = 0x4000b, + ef_ptc_samus_gbeam = 0x4000c, + ef_ptc_yoshi_gorogorotamago = 0x50004, + ef_ptc_yoshi_tamagonage = 0x50005, + ef_ptc_yoshi_tamagoumi = 0x50007, + ef_ptc_kirby_suikomi = 0x60002, + ef_ptc_kirby_finalcutter = 0x60007, + ef_ptc_kirby_stone_start = 0x60008, + ef_ptc_kirby_stone_end = 0x60009, + ef_ptc_kirby_star = 0x6000d, + ef_ptc_fox_illusion_start = 0x70001, + ef_ptc_fox_illusion = 0x70003, + ef_ptc_fox_illusion_end = 0x70004, + ef_ptc_fox_reflector_flash = 0x70005, + ef_ptc_fox_reflector_start = 0x70006, + ef_ptc_fox_firefox_start = 0x70008, + ef_ptc_fox_firefox = 0x70009, + ef_ptc_fox_blaster_shot = 0x7000b, + ef_ptc_fox_reflector_ref = 0x7000c, + ef_ptc_fox_appeal_hi = 0x7000d, + ef_ptc_pikachu_c_03_attack_s_41 = 0x80001, + ef_ptc_pikachu_dengeki = 0x80003, + ef_ptc_pikachu_dengeki_bound = 0x80004, + ef_ptc_pikachu_dengeki_loop = 0x80005, + ef_ptc_pikachu_kaminari_hit = 0x80006, + ef_ptc_pikachu_kaminari_ground_hit = 0x80007, + ef_ptc_pikachu_kaminari_start = 0x80008, + ef_ptc_pikachu_kaminari_end = 0x80009, + ef_ptc_pikachu_kaminari_cloud = 0x8000a, + ef_ptc_pikachu_rocketzutsuki_charge = 0x8000b, + ef_ptc_pikachu_rocketzutsuki_bomb = 0x8000c, + ef_ptc_pikachu_rocketzutsuki_smoke = 0x8000d, + ef_ptc_luigi_fireball = 0x90001, + ef_ptc_luigi_fireball_shoot = 0x90002, + ef_ptc_luigi_fireball_bound = 0x90003, + ef_ptc_luigi_rocket = 0x90004, + ef_ptc_luigi_cyclone = 0x90005, + ef_ptc_captain_fphold = 0xa0002, + ef_ptc_captain_fnhand_fire = 0xa0003, + ef_ptc_captain_fnmain = 0xa0004, + ef_ptc_captain_fnmain_air = 0xa0005, + ef_ptc_captain_fnflash = 0xa0006, + ef_ptc_captain_fk = 0xa0007, + ef_ptc_captain_fpflash = 0xa0008, + ef_ptc_captain_entry = 0xa0009, + ef_ptc_captain_appeal_hi = 0xa000a, + ef_ptc_ness_psi_attack = 0xb0001, + ef_ptc_ness_pkthunder_a = 0xb0002, + ef_ptc_ness_pkthunder_b = 0xb0003, + ef_ptc_ness_pkthunder_c = 0xb0004, + ef_ptc_ness_pkthunder_hold = 0xb0005, + ef_ptc_ness_pkthunder_attack = 0xb0006, + ef_ptc_ness_pkfire_bullet = 0xb0007, + ef_ptc_ness_pkfire_bomb = 0xb0008, + ef_ptc_ness_pkflash_bullet = 0xb0009, + ef_ptc_ness_pkflash_bullet_end = 0xb000a, + ef_ptc_ness_pkflash_bomb = 0xb000b, + ef_ptc_ness_psi_magnet = 0xb000c, + ef_ptc_ness_entry = 0xb000d, + ef_ptc_koopa_breath = 0xc0001, + ef_ptc_koopa_breath_mouth_fire = 0xc0002, + ef_ptc_koopa_spinning_shell = 0xc0003, + ef_ptc_koopa_drop = 0xc0004, + ef_ptc_koopa_wait_breath = 0xc0005, + ef_ptc_koopa_giga_freeze = 0xc0006, + ef_ptc_koopa_giga_shien = 0xc0007, + ef_ptc_koopa_giga_smoke = 0xc0008, + ef_ptc_koopa_appeal_s = 0xc0009, + ef_ptc_koopa_entry = 0xc000a, + ef_ptc_koopa_change_flash_a = 0xc000b, + ef_ptc_koopa_change_flash_b = 0xc000c, + ef_ptc_koopa_change_flash_start_a = 0xc000d, + ef_ptc_koopa_change_flash_start_b = 0xc000e, + ef_ptc_peach_bomber = 0xd0001, + ef_ptc_peach_kinopio_gurad = 0xd0002, + ef_ptc_peach_kinopio_gurad_bullet = 0xd0003, + ef_ptc_peach_hikkonuki = 0xd0004, + ef_ptc_peach_entry = 0xd0005, + ef_ptc_peach_attack_hi_3 = 0xd0006, + ef_ptc_peach_appeal_s = 0xd0007, + ef_ptc_zelda_attack_a = 0xe0001, + ef_ptc_zelda_attack_b = 0xe0002, + ef_ptc_zelda_attack_hi_4 = 0xe0004, + ef_ptc_zelda_attack_s_4 = 0xe0005, + ef_ptc_zelda_flor_start = 0xe0006, + ef_ptc_zelda_flor_end = 0xe0007, + ef_ptc_zelda_nayru_flash = 0xe0009, + ef_ptc_zelda_din_start = 0xe000a, + ef_ptc_zelda_din_tama = 0xe000b, + ef_ptc_zelda_din_bomb = 0xe000c, + ef_ptc_zelda_change_start = 0xe000d, + ef_ptc_zelda_change_end = 0xe000e, + ef_ptc_zelda_shikomibari = 0xe000f, + ef_ptc_zelda_fushin_start = 0xe0010, + ef_ptc_zelda_fushin_end = 0xe0011, + ef_ptc_zelda_entry = 0xe0012, + ef_ptc_zelda_change_flash_a = 0xe0013, + ef_ptc_zelda_change_flash_b = 0xe0014, + ef_ptc_popo_ice_shot_smash = 0x100001, + ef_ptc_popo_ice_shot_appear = 0x100002, + ef_ptc_popo_ice_shot_cold_a = 0x100003, + ef_ptc_popo_ice_shot_cold_b = 0x100004, + ef_ptc_popo_gom_jump = 0x100005, + ef_ptc_popo_blizzard_shoot = 0x100006, + ef_ptc_popo_blizzard_bullet = 0x100007, + ef_ptc_popo_thammer = 0x100008, + ef_ptc_marth_counter = 0x120003, + ef_ptc_marth_entry = 0x120004, + ef_ptc_falco_vision_start = 0x140001, + ef_ptc_falco_vision = 0x140003, + ef_ptc_falco_vision_end = 0x140004, + ef_ptc_falco_reflector_flash = 0x140005, + ef_ptc_falco_reflector_start = 0x140006, + ef_ptc_falco_firebird_start = 0x140008, + ef_ptc_falco_firebird = 0x140009, + ef_ptc_falco_blaster_shot = 0x14000b, + ef_ptc_falco_reflector_ref = 0x14000c, + ef_ptc_ganon_majinken = 0x150001, + ef_ptc_ganon_majinken_hold = 0x150002, + ef_ptc_ganon_majinken_flash = 0x150003, + ef_ptc_ganon_rekkikyaku = 0x150004, + ef_ptc_ganon_engokua_flash = 0x150005, + ef_ptc_ganon_engokua_gr = 0x150006, + ef_ptc_ganon_engokua_ar = 0x150007, + ef_ptc_ganon_engokua = 0x150008, + ef_ptc_ganon_entry = 0x150009, + ef_ptc_ganon_entry_aura = 0x15000a, + ef_ptc_ganon_appeal_s = 0x15000b, + ef_ptc_wario_ppe_s = 0x160001, + ef_ptc_wario_ppe_m = 0x160002, + ef_ptc_wario_ppe_l = 0x160003, + ef_ptc_wario_ppe_l_2 = 0x160004, + ef_ptc_wario_ppe_fly = 0x160005, + ef_ptc_wario_ppe_fly_2 = 0x160006, + ef_ptc_wario_kamitsuki_open = 0x160007, + ef_ptc_wario_kamitsuki_bomb = 0x160008, + ef_ptc_wario_kamitsuki_bite = 0x160009, + ef_ptc_wario_corkscrew = 0x16000a, + ef_ptc_wario_bike_run_smoke = 0x16000b, + ef_ptc_wario_bike_break = 0x16000c, + ef_ptc_wario_kamitsuki_end = 0x16000d, + ef_ptc_wario_bike_run_smoke_s = 0x16000e, + ef_ptc_fin_wario_pika = 0x16000f, + ef_ptc_fin_warioman_gep = 0x160010, + ef_ptc_fin_wario_start_kml = 0x160011, + ef_ptc_fin_wario_kml = 0x160012, + ef_ptc_fin_wario_hokori = 0x160013, + ef_ptc_fin_warioman_pika = 0x160014, + ef_ptc_fin_wario_change_flash_a = 0x160015, + ef_ptc_fin_wario_change_flash_b = 0x160016, + ef_ptc_metaknight_drill_lush = 0x170015, + ef_ptc_metaknight_mantle_start = 0x170016, + ef_ptc_metaknight_mantle_end = 0x170017, + ef_ptc_pit_feather = 0x180005, + ef_ptc_pit_palutena_arrow_hold = 0x180007, + ef_ptc_pit_palutena_arrow = 0x180008, + ef_ptc_pit_palutena_arrow_stick = 0x180009, + ef_ptc_pit_ikaros_gokou = 0x18000a, + ef_ptc_pit_ikaros_flare = 0x18000b, + ef_ptc_pit_ikaros_wing_flare = 0x18000c, + ef_ptc_pit_palutena_arrow_flash = 0x18000d, + ef_ptc_pit_angering = 0x18000e, + ef_ptc_pit_kagaminotate = 0x18000f, + ef_ptc_pit_kagaminotate_ref = 0x180010, + ef_ptc_pit_angering_start = 0x180011, + ef_ptc_pit_angering_end = 0x180012, + ef_ptc_pit_entry = 0x180013, + ef_ptc_szerosuit_c_04_attack_lw_4 = 0x190001, + ef_ptc_szerosuit_muzzle_flash = 0x190002, + ef_ptc_szerosuit_paralyzer_bullet_s = 0x190003, + ef_ptc_szerosuit_paralyzer_bullet_l = 0x190004, + ef_ptc_szerosuit_paralyzer_hold = 0x190005, + ef_ptc_szerosuit_paralyzer_shot = 0x190006, + ef_ptc_szerosuit_paralyzer_hit = 0x190007, + ef_ptc_szerosuit_whip_a = 0x190009, + ef_ptc_szerosuit_whip_b = 0x19000a, + ef_ptc_szerosuit_plasma_whip = 0x19000c, + ef_ptc_szerosuit_final_end = 0x19000d, + ef_ptc_szerosuit_entry_end = 0x19000e, + ef_ptc_szerosuit_entry_end_2 = 0x19000f, + ef_ptc_pikmin_seiretsu = 0x1a0001, + ef_ptc_pikmin_hikkonuki = 0x1a0002, + ef_ptc_pikmin_order = 0x1a0003, + ef_ptc_pikmin_dead_red = 0x1a0004, + ef_ptc_pikmin_dead_blue = 0x1a0005, + ef_ptc_pikmin_dead_yellow = 0x1a0006, + ef_ptc_pikmin_dead_white = 0x1a0007, + ef_ptc_pikmin_dead_purple = 0x1a0008, + ef_ptc_pikmin_hit_red = 0x1a0009, + ef_ptc_pikmin_hit_blue = 0x1a000a, + ef_ptc_pikmin_hit_yellow = 0x1a000b, + ef_ptc_pikmin_hit_white = 0x1a000c, + ef_ptc_pikmin_hit_purple = 0x1a000d, + ef_ptc_pikmin_antenna = 0x1a000e, + ef_ptc_pikmin_antenna_01 = 0x1a000f, + ef_ptc_pikmin_antenna_02 = 0x1a0010, + ef_ptc_pikmin_antenna_03 = 0x1a0011, + ef_ptc_pikmin_antenna_04 = 0x1a0012, + ef_ptc_pikmin_antenna_05 = 0x1a0013, + ef_ptc_pikmin_antenna_2 = 0x1a0014, + ef_ptc_lucas_hold = 0x1b0001, + ef_ptc_lucas_psi_attack = 0x1b0002, + ef_ptc_lucas_attack_lw_4 = 0x1b0003, + ef_ptc_lucas_attack_hi_4 = 0x1b0004, + ef_ptc_lucas_pkthunder_a = 0x1b0005, + ef_ptc_lucas_pkthunder_b = 0x1b0006, + ef_ptc_lucas_pkthunder_c = 0x1b0007, + ef_ptc_lucas_pkthunder_hold = 0x1b0008, + ef_ptc_lucas_pkthunder_attack = 0x1b0009, + ef_ptc_lucas_pkfire_bullet = 0x1b000a, + ef_ptc_lucas_pkfire_bomb = 0x1b000b, + ef_ptc_lucas_pkfreeze_bullet = 0x1b000c, + ef_ptc_lucas_pkfreeze_bullet_end = 0x1b000d, + ef_ptc_lucas_pkfreeze_bomb = 0x1b000e, + ef_ptc_lucas_psi_magnet = 0x1b000f, + ef_ptc_diddy_attack_lw_3 = 0x1c0001, + ef_ptc_diddy_barreljet = 0x1c0002, + ef_ptc_diddy_popgun = 0x1c0003, + ef_ptc_diddy_popgun_peanut_brake = 0x1c0004, + ef_ptc_diddy_mflip_stick_attack = 0x1c0005, + ef_ptc_diddy_popgun_break_a = 0x1c0006, + ef_ptc_diddy_popgun_break_b = 0x1c0007, + ef_ptc_diddy_entry = 0x1c0008, + ef_ptc_poke_trainer_change_throw = 0x1d0001, + ef_ptc_poke_trainer_change_catch = 0x1d0002, + ef_ptc_poke_trainer_change_in = 0x1d0003, + ef_ptc_poke_trainer_change_out = 0x1d0004, + ef_ptc_poke_trainer_change_mball = 0x1d0005, + ef_ptc_poke_trainer_change_return = 0x1d0006, + ef_ptc_poke_lizardon_tail_fire = 0x1e0001, + ef_ptc_poke_lizardon_attack_fire = 0x1e0002, + ef_ptc_poke_lizardon_attack_hi_3 = 0x1e0003, + ef_ptc_poke_lizardon_mouth_fire = 0x1e0004, + ef_ptc_poke_lizardon_standby_fire = 0x1e0005, + ef_ptc_poke_lizardon_kaenhousya = 0x1e0006, + ef_ptc_poke_lizardon_iwakudaki = 0x1e0007, + ef_ptc_poke_lizardon_sorawotobu = 0x1e0008, + ef_ptc_poke_lizardon_attack_lw_4 = 0x1e0009, + ef_ptc_poke_lizardon_attack_air_f = 0x1e000a, + ef_ptc_poke_zenigame_attack_hi_4 = 0x1f0001, + ef_ptc_poke_zenigame_attack_water_a = 0x1f0002, + ef_ptc_poke_zenigame_attack_water_b = 0x1f0003, + ef_ptc_poke_zenigame_takinobori = 0x1f0004, + ef_ptc_poke_zenigame_takinobori_end = 0x1f0005, + ef_ptc_poke_zenigame_mizuteppo_shoot = 0x1f0006, + ef_ptc_poke_zenigame_mizuteppo_light = 0x1f0007, + ef_ptc_poke_zenigame_mizuteppo_fade = 0x1f0008, + ef_ptc_poke_zenigame_mizuteppo_hit = 0x1f0009, + ef_ptc_poke_zenigame_mizuteppo = 0x1f000a, + ef_ptc_poke_zenigame_karanikomoru = 0x1f000b, + ef_ptc_poke_zenigame_mizuteppo_max = 0x1f000c, + ef_ptc_poke_fushigisou_attack_hi_4 = 0x200001, + ef_ptc_poke_fushigisou_attack_air_hi = 0x200002, + ef_ptc_poke_fushigisou_attack_air_lw = 0x200003, + ef_ptc_poke_fushigisou_leaf = 0x200004, + ef_ptc_poke_fushigisou_tane_mg = 0x200009, + ef_ptc_poke_fushigisou_tane_mgtama = 0x20000a, + ef_ptc_poke_fushigisou_tane_mghit = 0x20000b, + ef_ptc_poke_fushigisou_tsurunomuchi = 0x20000e, + ef_ptc_poke_fushigisou_hcutter_leaf = 0x20000f, + ef_ptc_dedede_hammer_spin = 0x210002, + ef_ptc_dedede_super_dedede_jump_rise = 0x210007, + ef_ptc_dedede_suikomi = 0x210009, + ef_ptc_dedede_waddledee_dead = 0x21000a, + ef_ptc_dedede_waddledoo_thunder = 0x21000b, + ef_ptc_dedede_jet_hammer_hold = 0x21000c, + ef_ptc_dedede_jet_hammer_hold_max = 0x21000d, + ef_ptc_dedede_jet_hammer = 0x21000e, + ef_ptc_dedede_jet_hammer_max = 0x21000f, + ef_ptc_lucario_hadou = 0x220001, + ef_ptc_lucario_bone_flash_l = 0x220002, + ef_ptc_lucario_bone_flash_r = 0x220003, + ef_ptc_lucario_hadou_attack_a = 0x220004, + ef_ptc_lucario_hadou_attack_b = 0x220005, + ef_ptc_lucario_hadou_attack_c = 0x220006, + ef_ptc_lucario_hadoudan = 0x220007, + ef_ptc_lucario_hadoudan_max_l = 0x220008, + ef_ptc_lucario_hadoudan_max_r = 0x220009, + ef_ptc_lucario_sinsoku = 0x22000a, + ef_ptc_lucario_hakkei_near = 0x22000b, + ef_ptc_lucario_hakkei_far = 0x22000c, + ef_ptc_lucario_kagebunshin = 0x22000d, + ef_ptc_lucario_kagebunshin_split = 0x22000e, + ef_ptc_lucario_kagebunshin_appear = 0x22000f, + ef_ptc_lucario_hadoudan_tail = 0x220010, + ef_ptc_lucario_aura = 0x220011, + ef_ptc_lucario_hakkei = 0x220012, + ef_ptc_ike_hunka_sword_flare = 0x230002, + ef_ptc_ike_hunka = 0x230003, + ef_ptc_ike_hunka_max = 0x230004, + ef_ptc_ike_iaigiri = 0x230005, + ef_ptc_ike_counter = 0x230006, + ef_ptc_ike_entry = 0x230007, + ef_ptc_ike_appeal_lw = 0x230008, + ef_ptc_ike_hunka_sword_spin = 0x230009, + ef_ptc_robot_footmark = 0x240001, + ef_ptc_robot_jump_jet = 0x240004, + ef_ptc_robot_attack_jet = 0x240005, + ef_ptc_robot_attack_njet = 0x240006, + ef_ptc_robot_attack_lw_jet = 0x240007, + ef_ptc_robot_eye_flash = 0x240008, + ef_ptc_robot_attack_s_4_s = 0x240009, + ef_ptc_robot_robobeam_shot = 0x24000b, + ef_ptc_fin_robot_main = 0x24000f, + ef_ptc_fin_robot_end = 0x240010, + ef_ptc_fin_robot_main_2 = 0x240011, + ef_ptc_fin_robot_main_3 = 0x240012, + ef_ptc_purin_utau = 0x260001, + ef_ptc_purin_korogaru = 0x260002, + ef_ptc_purin_appeal_lw = 0x260003, + ef_ptc_toonlink_arrow_max = 0x2a0002, + ef_ptc_toonlink_bomb = 0x2a0007, + ef_ptc_toonlink_bomb_spark = 0x2a0008, + ef_ptc_toonlink_entry = 0x2a0009, + ef_ptc_wolf_reflector_flash = 0x2d0001, + ef_ptc_wolf_reflector_start = 0x2d0002, + ef_ptc_wolf_blaster_shot = 0x2d0005, + ef_ptc_wolf_reflector_ref = 0x2d0006, + ef_ptc_wolf_slash = 0x2d0008, + ef_ptc_snake_c_03_attack_s_4_s = 0x2f0001, + ef_ptc_snake_c_04_attack_hi_4 = 0x2f0002, + ef_ptc_snake_trench_morter_smoke = 0x2f0003, + ef_ptc_snake_c_04_attack_lw_4_start = 0x2f0004, + ef_ptc_snake_c_04_attack_lw_4_hold = 0x2f0005, + ef_ptc_snake_c_04_attack_lw_4 = 0x2f0007, + ef_ptc_snake_remote_missile_jet = 0x2f0008, + ef_ptc_snake_remote_missile = 0x2f0009, + ef_ptc_snake_cypher = 0x2f000a, + ef_ptc_snake_c_4 = 0x2f000b, + ef_ptc_snake_entry = 0x2f000c, + ef_ptc_snake_entry_thunder = 0x2f000d, + ef_ptc_snake_catch = 0x2f000e, + ef_ptc_snake_bomb_a = 0x2f000f, + ef_ptc_snake_bomb_b = 0x2f0010, + ef_ptc_snake_catch_attack = 0x2f0011, + ef_ptc_snake_entry_2 = 0x2f0012, + ef_ptc_sonic_attack_air_lw = 0x300003, + ef_ptc_sonic_spin_trace = 0x300004, + ef_ptc_sonic_spin_trace_l = 0x300006, + ef_ptc_sonic_idling = 0x300007, + ef_ptc_sonic_homing_trace = 0x300008, + ef_ptc_sonic_gimmick_jump = 0x300009, + ef_ptc_stg_final_zenpan = 0x330001, + ef_ptc_stg_final_star = 0x330002, + ef_ptc_stg_final_kirakira = 0x330003, + ef_ptc_stg_dolpic_hunsui = 0x340001, + ef_ptc_stg_mansion_lucrash = 0x350001, + ef_ptc_stg_mansion_ldcrash = 0x350002, + ef_ptc_stg_mansion_rucrash = 0x350003, + ef_ptc_stg_mansion_rdcrash = 0x350004, + ef_ptc_stg_mansion_pillar = 0x350005, + ef_ptc_stg_mansion_revival = 0x350006, + ef_ptc_stg_mansion_pillar_damage = 0x350007, + ef_ptc_stg_mansion_pillar_hit = 0x350008, + ef_ptc_stg_mario_past_suna_kemuri = 0x360001, + ef_ptc_stg_mario_past_taimatu = 0x360002, + ef_ptc_stg_mario_past_block_00 = 0x360003, + ef_ptc_stg_mario_past_block_01 = 0x360004, + ef_ptc_stg_jungle_block_hakai = 0x390001, + ef_ptc_stg_jungle_block_damage = 0x390002, + ef_ptc_stg_jungle_ita = 0x390003, + ef_ptc_stg_pirates_hougeki = 0x3a0001, + ef_ptc_stg_pirates_tamakiseki = 0x3a0002, + ef_ptc_stg_pirates_bakuhatu = 0x3a0003, + ef_ptc_stg_pirates_mizu_shibuki = 0x3a0004, + ef_ptc_stg_pirates_ship_shibuki = 0x3a0005, + ef_ptc_stg_pirates_syutugen = 0x3a0006, + ef_ptc_stg_norfair_prominence = 0x3c0001, + ef_ptc_stg_norfair_wave = 0x3c0002, + ef_ptc_stg_norfair_wave_2 = 0x3c0003, + ef_ptc_stg_norfair_wall_01 = 0x3c0004, + ef_ptc_stg_halberd_ririku = 0x3f0001, + ef_ptc_stg_halberd_cyakkan = 0x3f0002, + ef_ptc_stg_halberd_herohero = 0x3f0003, + ef_ptc_stg_starfox_battle_ship_enkei = 0x440001, + ef_ptc_stg_starfox_space_enkei = 0x440002, + ef_ptc_stg_starfox_bakuhatu = 0x440003, + ef_ptc_stg_starfox_bakuhatu_b = 0x440004, + ef_ptc_stg_starfox_inseki = 0x440005, + ef_ptc_stg_stadium_kemuri = 0x450001, + ef_ptc_stg_tengan_yukabreak = 0x460001, + ef_ptc_stg_tengan_syutugen = 0x460002, + ef_ptc_stg_tengan_eyeglow = 0x460003, + ef_ptc_stg_tengan_syoushitu = 0x460004, + ef_ptc_stg_tengan_aura = 0x460005, + ef_ptc_stg_tengan_yukahukkatu = 0x460006, + ef_ptc_stg_tengan_crecelia_kona = 0x460007, + ef_ptc_stg_tengan_crecelia_boomeran = 0x460008, + ef_ptc_stg_fzero_hibana = 0x470001, + ef_ptc_stg_ice_kemuri = 0x480001, + ef_ptc_stg_ice_ashiba = 0x480002, + ef_ptc_stg_ice_ryuhyou = 0x480003, + ef_ptc_stg_ice_ashiba_damage = 0x480004, + ef_ptc_stg_ice_turara_damage = 0x480005, + ef_ptc_stg_ice_fish_shibuki = 0x480006, + ef_ptc_stg_ice_fish_awa = 0x480007, + ef_ptc_stg_emblem_00_kemuri_b = 0x4a0001, + ef_ptc_stg_emblem_00_kemuri_c = 0x4a0002, + ef_ptc_stg_emblem_00_ishi = 0x4a0003, + ef_ptc_stg_emblem_01_lamp_fire_a = 0x4a0004, + ef_ptc_stg_emblem_01_lamp_fire_b = 0x4a0005, + ef_ptc_stg_emblem_01_lamp_fire_c = 0x4a0006, + ef_ptc_stg_emblem_00_zoucrash_l = 0x4a0007, + ef_ptc_stg_emblem_00_zoucrash_r = 0x4a0008, + ef_ptc_stg_emblem_02_kemuri = 0x4a0009, + ef_ptc_stg_emblem_00_zou_damage_l = 0x4a000a, + ef_ptc_stg_emblem_00_zou_damage_r = 0x4a000b, + ef_ptc_stg_emblem_00_kemuri_b_hi = 0x4a000c, + ef_ptc_stg_emblem_00_kemuri_c_hi = 0x4a000d, + ef_ptc_stg_emblem_02_kemuri_hi = 0x4a000e, + ef_ptc_stg_emblem_00_kemuri_a = 0x4b0001, + ef_ptc_stg_emblem_00_kemuri_b_2 = 0x4b0002, + ef_ptc_stg_emblem_00_kemuri_c_2 = 0x4b0003, + ef_ptc_stg_emblem_00_ishi_2 = 0x4b0004, + ef_ptc_stg_emblem_01_lamp_fire_a_2 = 0x4c0001, + ef_ptc_stg_emblem_01_lamp_fire_b_2 = 0x4c0002, + ef_ptc_stg_emblem_01_lamp_fire_c_2 = 0x4c0003, + ef_ptc_stg_madein_hammer = 0x4d0001, + ef_ptc_stg_madein_cracker = 0x4d0002, + ef_ptc_stg_earth_shibuki = 0x4e0001, + ef_ptc_stg_earth_hamon = 0x4e0002, + ef_ptc_stg_earth_haeru = 0x4e0003, + ef_ptc_stg_earth_taoreru = 0x4e0004, + ef_ptc_stg_palutena_ashiba_damage = 0x4f0001, + ef_ptc_stg_palutena_ashiba_break = 0x4f0002, + ef_ptc_stg_palutena_kumo_pahu = 0x4f0003, + ef_ptc_stg_palutena_ashiba_hukkatu = 0x4f0004, + ef_ptc_stg_newpork_syutugen = 0x510001, + ef_ptc_stg_newpork_syositu = 0x510002, + ef_ptc_stg_newpork_kowareyuka_damage = 0x510003, + ef_ptc_stg_newpork_kowareyuka_hakai = 0x510004, + ef_ptc_stg_metalgear_tower_rtcrash = 0x530001, + ef_ptc_stg_metalgear_tower_rbcrash = 0x530002, + ef_ptc_stg_metalgear_tower_ltcrash = 0x530003, + ef_ptc_stg_metalgear_tower_lbcrash = 0x530004, + ef_ptc_stg_metalgear_tenzyo_crash = 0x530005, + ef_ptc_stg_metalgear_hahenkemuri = 0x530006, + ef_ptc_stg_metalgear_snow_1 = 0x530007, + ef_ptc_stg_metalgear_snow_2 = 0x530008, + ef_ptc_stg_metalgear_snow_3 = 0x530009, + ef_ptc_stg_metalgear_tower_revival_r = 0x53000a, + ef_ptc_stg_metalgear_tower_revival_l = 0x53000b, + ef_ptc_stg_metalgear_tower_damage = 0x53000c, + ef_ptc_stg_greenhill_zimen_damage = 0x540001, + ef_ptc_stg_greenhill_marker = 0x540002, + ef_ptc_stg_plankton_awa = 0x560001, + ef_ptc_stg_dx_garden_rosoku_a = 0x5c0001, + ef_ptc_stg_dx_garden_rosoku_b = 0x5c0002, + ef_ptc_stg_dx_garden_sibuki_01 = 0x5c0003, + ef_ptc_stg_dx_garden_wani = 0x5c0004, + ef_ptc_stg_dx_onett_ha = 0x5d0001, + ef_ptc_stg_onett_kemuri = 0x5d0002, + ef_ptc_stg_dx_onett_carspin = 0x5d0003, + ef_ptc_stg_dx_greens_ibuki = 0x5e0001, + ef_ptc_stg_dx_greens_ha = 0x5e0002, + ef_ptc_stg_dx_greens_bomb = 0x5e0003, + ef_ptc_stg_dx_greens_smoke = 0x5e0004, + ef_ptc_stg_dx_pstadium_hanabi = 0x5f0001, + ef_ptc_stg_dx_pstadium_kemuri = 0x5f0002, + ef_ptc_stg_dx_pstadium_rock = 0x5f0003, + ef_ptc_stg_dx_pstadium_fire = 0x5f0004, + ef_ptc_stg_dx_pstadium_water_01 = 0x5f0005, + ef_ptc_stg_dx_pstadium_water_02 = 0x5f0006, + ef_ptc_stg_dx_pstadium_water_03 = 0x5f0007, + ef_ptc_stg_dx_corneria_syukou = 0x610001, + ef_ptc_stg_dx_corneria_hassya = 0x610002, + ef_ptc_stg_dx_corneria_shibuki = 0x610003, + ef_ptc_stg_dx_corneria_bakuhatu = 0x610004, + ef_ptc_stg_dx_zebes_yuge = 0x630001, + ef_ptc_stg_dx_zebes_haretu = 0x630002, + ef_ptc_stg_oldin_hashi_crash_1 = 0x640001, + ef_ptc_stg_oldin_hashi_crash_2 = 0x640002, + ef_ptc_stg_oldin_hahenkemuri = 0x640003, + ef_ptc_stg_oldin_hukkatu = 0x640004, + ef_ptc_stg_oldin_hashi_hukkatu_2 = 0x640005, + ef_ptc_stg_oldin_portaltubu = 0x640006, + ef_ptc_stg_homerun_crash = 0x650001, + ef_ptc_adv_cloud_rock = 0x670001, + ef_ptc_adv_cloud_kumo = 0x670002, + ef_ptc_adv_cloud_rock_15 = 0x670003, + ef_ptc_adv_cloud_rock_16 = 0x670004, + ef_ptc_adv_cloud_rock_17 = 0x670005, + ef_ptc_adv_cloud_effect = 0x670006, + ef_ptc_adv_cloud_effect_2 = 0x670007, + ef_ptc_adv_cloud_effect_3 = 0x670008, + ef_ptc_adv_cloud_effect_4 = 0x670009, + ef_ptc_adv_cloud_effect_5 = 0x67000a, + ef_ptc_adv_cloud_effect_6 = 0x67000b, + ef_ptc_adv_cloud_effect_7 = 0x67000c, + ef_ptc_adv_cloud_effect_8 = 0x67000d, + ef_ptc_adv_cloud_effect_9 = 0x67000e, + ef_ptc_adv_cloud_effect_10 = 0x67000f, + ef_ptc_adv_cloud_effect_11 = 0x670010, + ef_ptc_adv_cloud_effect_12 = 0x670011, + ef_ptc_adv_cloud_effect_13 = 0x670012, + ef_ptc_adv_cloud_effect_14 = 0x670013, + ef_ptc_adv_cloud_effect_15 = 0x670014, + ef_ptc_adv_cloud_effect_16 = 0x670015, + ef_ptc_adv_cloud_effect_17 = 0x670016, + ef_ptc_adv_cloud_effect_18 = 0x670017, + ef_ptc_adv_cloud_effect_19 = 0x670018, + ef_ptc_adv_jungle_effect = 0x680001, + ef_ptc_adv_jungle_sand = 0x680002, + ef_ptc_adv_jungle_water = 0x680003, + ef_ptc_adv_jungle_effect_2 = 0x680004, + ef_ptc_adv_jungle_effect_3 = 0x680005, + ef_ptc_adv_jungle_effect_4 = 0x680006, + ef_ptc_adv_jungle_effect_5 = 0x680007, + ef_ptc_adv_jungle_effect_6 = 0x680008, + ef_ptc_adv_jungle_fire_floor = 0x68000a, + ef_ptc_adv_jungle_effect_7 = 0x68000b, + ef_ptc_adv_jungle_effect_8 = 0x68000c, + ef_ptc_adv_jungle_effect_9 = 0x68000d, + ef_ptc_adv_jungle_effect_10 = 0x68000e, + ef_ptc_adv_jungle_effect_11 = 0x68000f, + ef_ptc_adv_jungle_effect_12 = 0x680010, + ef_ptc_adv_jungle_effect_13 = 0x680011, + ef_ptc_adv_jungle_effect_14 = 0x680012, + ef_ptc_adv_jungle_effect_15 = 0x680013, + ef_ptc_adv_jungle_effect_16 = 0x680014, + ef_ptc_adv_jungle_effect_17 = 0x680015, + ef_ptc_adv_jungle_effect_18 = 0x680016, + ef_ptc_adv_jungle_effect_19 = 0x680017, + ef_ptc_adv_jungle_effect_20 = 0x680018, + ef_ptc_adv_jungle_effect_21 = 0x680019, + ef_ptc_adv_river_sign_splash = 0x690001, + ef_ptc_adv_river_add_splash = 0x690002, + ef_ptc_adv_river_exit_splash = 0x690003, + ef_ptc_adv_river_catapult_splash = 0x690004, + ef_ptc_adv_river_truck_splash = 0x690005, + ef_ptc_adv_river_effect = 0x690006, + ef_ptc_adv_river_effect_2 = 0x690007, + ef_ptc_adv_river_effect_3 = 0x690008, + ef_ptc_adv_river_effect_4 = 0x690009, + ef_ptc_adv_river_effect_5 = 0x69000a, + ef_ptc_adv_river_effect_6 = 0x69000b, + ef_ptc_adv_river_effect_7 = 0x69000c, + ef_ptc_adv_river_effect_8 = 0x69000d, + ef_ptc_adv_river_effect_9 = 0x69000e, + ef_ptc_adv_river_effect_10 = 0x69000f, + ef_ptc_adv_river_effect_11 = 0x690010, + ef_ptc_adv_river_effect_12 = 0x690011, + ef_ptc_adv_river_effect_13 = 0x690012, + ef_ptc_adv_river_effect_14 = 0x690013, + ef_ptc_adv_river_effect_15 = 0x690014, + ef_ptc_adv_river_effect_16 = 0x690015, + ef_ptc_adv_river_effect_17 = 0x690016, + ef_ptc_adv_river_effect_18 = 0x690017, + ef_ptc_adv_river_effect_19 = 0x690018, + ef_ptc_adv_grass_effect = 0x6a0001, + ef_ptc_adv_grass_effect_2 = 0x6a0002, + ef_ptc_adv_grass_effect_3 = 0x6a0003, + ef_ptc_adv_grass_effect_4 = 0x6a0004, + ef_ptc_adv_grass_effect_5 = 0x6a0005, + ef_ptc_adv_grass_effect_6 = 0x6a0006, + ef_ptc_adv_grass_effect_7 = 0x6a0007, + ef_ptc_adv_grass_effect_8 = 0x6a0008, + ef_ptc_adv_grass_effect_9 = 0x6a0009, + ef_ptc_adv_grass_effect_10 = 0x6a000a, + ef_ptc_adv_grass_effect_11 = 0x6a000b, + ef_ptc_adv_grass_effect_12 = 0x6a000c, + ef_ptc_adv_grass_effect_13 = 0x6a000d, + ef_ptc_adv_grass_effect_14 = 0x6a000e, + ef_ptc_adv_grass_effect_15 = 0x6a000f, + ef_ptc_adv_grass_effect_16 = 0x6a0010, + ef_ptc_adv_grass_effect_17 = 0x6a0011, + ef_ptc_adv_grass_effect_18 = 0x6a0012, + ef_ptc_adv_grass_effect_19 = 0x6a0013, + ef_ptc_adv_grass_effect_20 = 0x6a0014, + ef_ptc_adv_grass_effect_21 = 0x6a0015, + ef_ptc_adv_grass_effect_22 = 0x6a0016, + ef_ptc_adv_grass_effect_23 = 0x6a0017, + ef_ptc_adv_grass_effect_24 = 0x6a0018, + ef_ptc_adv_zoo_01 = 0x6b0001, + ef_ptc_adv_zoo_wood_break = 0x6b0002, + ef_ptc_adv_zoo_box_break = 0x6b0003, + ef_ptc_adv_zoo_water = 0x6b0004, + ef_ptc_adv_test_23 = 0x6b0005, + ef_ptc_adv_test_24 = 0x6b0006, + ef_ptc_adv_zoo_01_2 = 0x6b0009, + ef_ptc_adv_zoo_01_3 = 0x6b000a, + ef_ptc_adv_zoo_01_4 = 0x6b000b, + ef_ptc_adv_zoo_01_5 = 0x6b000c, + ef_ptc_adv_zoo_01_6 = 0x6b000d, + ef_ptc_adv_zoo_01_7 = 0x6b000e, + ef_ptc_adv_zoo_01_8 = 0x6b000f, + ef_ptc_adv_zoo_01_9 = 0x6b0010, + ef_ptc_adv_zoo_01_10 = 0x6b0011, + ef_ptc_adv_zoo_01_11 = 0x6b0012, + ef_ptc_adv_zoo_01_12 = 0x6b0013, + ef_ptc_adv_zoo_01_13 = 0x6b0014, + ef_ptc_adv_zoo_01_14 = 0x6b0015, + ef_ptc_adv_zoo_01_15 = 0x6b0016, + ef_ptc_adv_zoo_01_16 = 0x6b0017, + ef_ptc_adv_zoo_01_17 = 0x6b0018, + ef_ptc_adv_zoo_01_18 = 0x6b0019, + ef_ptc_adv_fortress_effect = 0x6c0001, + ef_ptc_adv_fortress_effect_2 = 0x6c0002, + ef_ptc_adv_fortress_effect_3 = 0x6c0003, + ef_ptc_adv_fortress_effect_4 = 0x6c0004, + ef_ptc_adv_fortress_effect_5 = 0x6c0005, + ef_ptc_adv_fortress_effect_6 = 0x6c0006, + ef_ptc_adv_fortress_effect_7 = 0x6c0007, + ef_ptc_adv_fortress_effect_8 = 0x6c0008, + ef_ptc_adv_fortress_effect_9 = 0x6c0009, + ef_ptc_adv_fortress_effect_10 = 0x6c000a, + ef_ptc_adv_fortress_effect_11 = 0x6c000b, + ef_ptc_adv_fortress_effect_12 = 0x6c000c, + ef_ptc_adv_fortress_effect_13 = 0x6c000d, + ef_ptc_adv_fortress_effect_14 = 0x6c000e, + ef_ptc_adv_fortress_effect_15 = 0x6c000f, + ef_ptc_adv_fortress_effect_16 = 0x6c0010, + ef_ptc_adv_fortress_effect_17 = 0x6c0011, + ef_ptc_adv_fortress_effect_18 = 0x6c0012, + ef_ptc_adv_fortress_effect_19 = 0x6c0013, + ef_ptc_adv_fortress_effect_20 = 0x6c0014, + ef_ptc_adv_fortress_effect_21 = 0x6c0015, + ef_ptc_adv_fortress_effect_22 = 0x6c0016, + ef_ptc_adv_fortress_effect_23 = 0x6c0017, + ef_ptc_adv_fortress_effect_24 = 0x6c0018, + ef_ptc_adv_lakeside_effect = 0x6d0001, + ef_ptc_adv_lakeside_effect_2 = 0x6d0002, + ef_ptc_adv_lakeside_effect_3 = 0x6d0003, + ef_ptc_adv_lakeside_effect_4 = 0x6d0004, + ef_ptc_adv_lakeside_effect_5 = 0x6d0005, + ef_ptc_adv_lakeside_effect_6 = 0x6d0006, + ef_ptc_adv_lakeside_effect_7 = 0x6d0007, + ef_ptc_adv_lakeside_effect_8 = 0x6d0008, + ef_ptc_adv_lakeside_effect_9 = 0x6d0009, + ef_ptc_adv_lakeside_effect_10 = 0x6d000a, + ef_ptc_adv_lakeside_effect_11 = 0x6d000b, + ef_ptc_adv_lakeside_effect_12 = 0x6d000c, + ef_ptc_adv_lakeside_effect_13 = 0x6d000d, + ef_ptc_adv_lakeside_effect_14 = 0x6d000e, + ef_ptc_adv_lakeside_effect_15 = 0x6d000f, + ef_ptc_adv_lakeside_effect_16 = 0x6d0010, + ef_ptc_adv_lakeside_effect_17 = 0x6d0011, + ef_ptc_adv_lakeside_effect_18 = 0x6d0012, + ef_ptc_adv_lakeside_effect_19 = 0x6d0013, + ef_ptc_adv_lakeside_effect_20 = 0x6d0014, + ef_ptc_adv_lakeside_effect_21 = 0x6d0015, + ef_ptc_adv_lakeside_effect_22 = 0x6d0016, + ef_ptc_adv_lakeside_effect_23 = 0x6d0017, + ef_ptc_adv_lakeside_effect_24 = 0x6d0018, + ef_ptc_adv_cave_rock_break = 0x6e0001, + ef_ptc_adv_cave_rock_sign = 0x6e0002, + ef_ptc_adv_cave_rock_hit = 0x6e0003, + ef_ptc_adv_cave_rock_roll = 0x6e0004, + ef_ptc_adv_cave_effect = 0x6e0009, + ef_ptc_adv_cave_effect_2 = 0x6e000a, + ef_ptc_adv_cave_effect_3 = 0x6e000b, + ef_ptc_adv_cave_effect_4 = 0x6e000c, + ef_ptc_adv_cave_effect_5 = 0x6e000d, + ef_ptc_adv_cave_effect_6 = 0x6e000e, + ef_ptc_adv_cave_effect_7 = 0x6e000f, + ef_ptc_adv_cave_effect_8 = 0x6e0010, + ef_ptc_adv_cave_effect_9 = 0x6e0011, + ef_ptc_adv_cave_effect_10 = 0x6e0012, + ef_ptc_adv_cave_effect_11 = 0x6e0013, + ef_ptc_adv_cave_effect_12 = 0x6e0014, + ef_ptc_adv_cave_effect_13 = 0x6e0015, + ef_ptc_adv_cave_effect_14 = 0x6e0016, + ef_ptc_adv_cave_effect_15 = 0x6e0017, + ef_ptc_adv_cave_effect_16 = 0x6e0018, + ef_ptc_adv_test_26 = 0x6f0001, + ef_ptc_adv_ruinfront_effect = 0x6f0002, + ef_ptc_adv_ruinfront_effect_2 = 0x6f0003, + ef_ptc_adv_ruinfront_effect_3 = 0x6f0004, + ef_ptc_adv_ruinfront_effect_4 = 0x6f0005, + ef_ptc_adv_ruinfront_effect_5 = 0x6f0006, + ef_ptc_adv_ruinfront_effect_6 = 0x6f0007, + ef_ptc_adv_ruinfront_effect_7 = 0x6f0008, + ef_ptc_adv_ruinfront_effect_8 = 0x6f0009, + ef_ptc_adv_ruinfront_effect_9 = 0x6f000a, + ef_ptc_adv_ruinfront_effect_10 = 0x6f000b, + ef_ptc_adv_ruinfront_effect_11 = 0x6f000c, + ef_ptc_adv_ruinfront_effect_12 = 0x6f000d, + ef_ptc_adv_ruinfront_effect_13 = 0x6f000e, + ef_ptc_adv_ruinfront_effect_14 = 0x6f000f, + ef_ptc_adv_ruinfront_effect_15 = 0x6f0010, + ef_ptc_adv_ruinfront_effect_16 = 0x6f0011, + ef_ptc_adv_ruinfront_effect_17 = 0x6f0012, + ef_ptc_adv_ruinfront_effect_18 = 0x6f0013, + ef_ptc_adv_ruinfront_effect_19 = 0x6f0014, + ef_ptc_adv_ruinfront_effect_20 = 0x6f0015, + ef_ptc_adv_ruinfront_effect_21 = 0x6f0016, + ef_ptc_adv_ruinfront_effect_22 = 0x6f0017, + ef_ptc_adv_ruinfront_effect_23 = 0x6f0018, + ef_ptc_adv_ruin_thorn = 0x700001, + ef_ptc_adv_ruin_thorn_spear = 0x700002, + ef_ptc_adv_ruin = 0x700003, + ef_ptc_adv_ruin_2 = 0x700004, + ef_ptc_adv_ruin_3 = 0x700005, + ef_ptc_adv_ruin_4 = 0x700006, + ef_ptc_adv_ruin_5 = 0x700007, + ef_ptc_adv_ruin_6 = 0x700008, + ef_ptc_adv_ruin_7 = 0x700009, + ef_ptc_adv_ruin_8 = 0x70000a, + ef_ptc_adv_ruin_9 = 0x70000b, + ef_ptc_adv_ruin_10 = 0x70000c, + ef_ptc_adv_ruin_11 = 0x70000d, + ef_ptc_adv_ruin_12 = 0x70000e, + ef_ptc_adv_ruin_13 = 0x70000f, + ef_ptc_adv_ruin_14 = 0x700010, + ef_ptc_adv_ruin_15 = 0x700011, + ef_ptc_adv_ruin_16 = 0x700012, + ef_ptc_adv_ruin_17 = 0x700013, + ef_ptc_adv_ruin_18 = 0x700014, + ef_ptc_adv_ruin_19 = 0x700015, + ef_ptc_adv_ruin_20 = 0x700016, + ef_ptc_adv_ruin_21 = 0x700017, + ef_ptc_adv_ruin_22 = 0x700018, + ef_ptc_adv_wild_rock_break = 0x710001, + ef_ptc_adv_wild_rock_sign = 0x710002, + ef_ptc_adv_wild_rock_hit = 0x710003, + ef_ptc_adv_wild_rock_roll = 0x710004, + ef_ptc_adv_wild_effect = 0x710005, + ef_ptc_adv_wild_effect_2 = 0x710006, + ef_ptc_adv_wild_effect_3 = 0x710007, + ef_ptc_adv_wild_effect_4 = 0x710008, + ef_ptc_adv_wild_effect_5 = 0x710009, + ef_ptc_adv_wild_effect_6 = 0x71000a, + ef_ptc_adv_wild_effect_7 = 0x71000b, + ef_ptc_adv_wild_effect_8 = 0x71000c, + ef_ptc_adv_wild_effect_9 = 0x71000d, + ef_ptc_adv_wild_effect_10 = 0x71000e, + ef_ptc_adv_wild_effect_11 = 0x71000f, + ef_ptc_adv_wild_effect_12 = 0x710010, + ef_ptc_adv_wild_effect_13 = 0x710011, + ef_ptc_adv_wild_effect_14 = 0x710012, + ef_ptc_adv_wild_effect_15 = 0x710013, + ef_ptc_adv_wild_effect_16 = 0x710014, + ef_ptc_adv_wild_effect_17 = 0x710015, + ef_ptc_adv_wild_effect_18 = 0x710016, + ef_ptc_adv_wild_effect_19 = 0x710017, + ef_ptc_adv_wild_effect_20 = 0x710018, + ef_ptc_adv_cliff_ice_thorn = 0x720001, + ef_ptc_adv_cliff_ice_joint = 0x720002, + ef_ptc_adv_cliff_ice_joint_l = 0x720003, + ef_ptc_adv_cliff = 0x720004, + ef_ptc_adv_cliff_2 = 0x720005, + ef_ptc_adv_cliff_3 = 0x720006, + ef_ptc_adv_cliff_4 = 0x720007, + ef_ptc_adv_cliff_5 = 0x720008, + ef_ptc_adv_cliff_6 = 0x720009, + ef_ptc_adv_cliff_7 = 0x72000a, + ef_ptc_adv_cliff_8 = 0x72000b, + ef_ptc_adv_cliff_9 = 0x72000c, + ef_ptc_adv_cliff_10 = 0x72000d, + ef_ptc_adv_cliff_11 = 0x72000e, + ef_ptc_adv_cliff_12 = 0x72000f, + ef_ptc_adv_cliff_13 = 0x720010, + ef_ptc_adv_cliff_14 = 0x720011, + ef_ptc_adv_cliff_15 = 0x720012, + ef_ptc_adv_cliff_16 = 0x720013, + ef_ptc_adv_cliff_17 = 0x720014, + ef_ptc_adv_cliff_18 = 0x720015, + ef_ptc_adv_cliff_19 = 0x720016, + ef_ptc_adv_cliff_20 = 0x720017, + ef_ptc_adv_cliff_21 = 0x720018, + ef_ptc_adv_halberd_out_effect = 0x730001, + ef_ptc_adv_halberd_out_effect_2 = 0x730002, + ef_ptc_adv_halberd_out_effect_3 = 0x730003, + ef_ptc_adv_halberd_out_effect_4 = 0x730004, + ef_ptc_adv_halberd_out_effect_5 = 0x730005, + ef_ptc_adv_halberd_out_effect_6 = 0x730006, + ef_ptc_adv_halberd_out_effect_7 = 0x730007, + ef_ptc_adv_halberd_out_effect_8 = 0x730008, + ef_ptc_adv_halberd_out_effect_9 = 0x730009, + ef_ptc_adv_halberd_out_effect_10 = 0x73000a, + ef_ptc_adv_halberd_out_effect_11 = 0x73000b, + ef_ptc_adv_halberd_out_effect_12 = 0x73000c, + ef_ptc_adv_halberd_out_effect_13 = 0x73000d, + ef_ptc_adv_halberd_out_effect_14 = 0x73000e, + ef_ptc_adv_halberd_out_effect_15 = 0x73000f, + ef_ptc_adv_halberd_out_effect_16 = 0x730010, + ef_ptc_adv_halberd_out_effect_17 = 0x730011, + ef_ptc_adv_halberd_out_effect_18 = 0x730012, + ef_ptc_adv_halberd_out_effect_19 = 0x730013, + ef_ptc_adv_halberd_out_effect_20 = 0x730014, + ef_ptc_adv_halberd_out_effect_21 = 0x730015, + ef_ptc_adv_halberd_out_effect_22 = 0x730016, + ef_ptc_adv_halberd_out_effect_23 = 0x730017, + ef_ptc_adv_halberd_out_effect_24 = 0x730018, + ef_ptc_adv_halberd_in_lock_off = 0x740001, + ef_ptc_adv_cmn_trigger_break_hal = 0x740002, + ef_ptc_adv_cmn_explosion_break_hal = 0x740003, + ef_ptc_adv_cmn_brick_break_hal = 0x740004, + ef_ptc_adv_halberd_in_effect = 0x740005, + ef_ptc_adv_halberd_in_effect_2 = 0x740006, + ef_ptc_adv_halberd_in_effect_3 = 0x740007, + ef_ptc_adv_halberd_in_effect_4 = 0x740008, + ef_ptc_adv_halberd_in_effect_5 = 0x740009, + ef_ptc_adv_halberd_in_effect_6 = 0x74000a, + ef_ptc_adv_halberd_in_effect_7 = 0x74000b, + ef_ptc_adv_halberd_in_effect_8 = 0x74000c, + ef_ptc_adv_halberd_in_effect_9 = 0x74000d, + ef_ptc_adv_halberd_in_effect_10 = 0x74000e, + ef_ptc_adv_halberd_in_effect_11 = 0x74000f, + ef_ptc_adv_halberd_in_effect_12 = 0x740010, + ef_ptc_adv_halberd_in_effect_13 = 0x740011, + ef_ptc_adv_halberd_in_effect_14 = 0x740012, + ef_ptc_adv_halberd_in_effect_15 = 0x740013, + ef_ptc_adv_halberd_in_effect_16 = 0x740014, + ef_ptc_adv_halberd_in_effect_17 = 0x740015, + ef_ptc_adv_halberd_in_effect_18 = 0x740016, + ef_ptc_adv_halberd_in_effect_19 = 0x740017, + ef_ptc_adv_halberd_in_effect_20 = 0x740018, + ef_ptc_adv_ancient_out_effect = 0x750001, + ef_ptc_adv_ancient_out_effect_2 = 0x750002, + ef_ptc_adv_ancient_out_effect_3 = 0x750003, + ef_ptc_adv_ancient_out_effect_4 = 0x750004, + ef_ptc_adv_ancient_out_effect_5 = 0x750005, + ef_ptc_adv_ancient_out_effect_6 = 0x750006, + ef_ptc_adv_ancient_out_effect_7 = 0x750007, + ef_ptc_adv_ancient_out_effect_8 = 0x750008, + ef_ptc_adv_ancient_out_effect_9 = 0x750009, + ef_ptc_adv_ancient_out_effect_10 = 0x75000a, + ef_ptc_adv_ancient_out_effect_11 = 0x75000b, + ef_ptc_adv_ancient_out_effect_12 = 0x75000c, + ef_ptc_adv_ancient_out_effect_13 = 0x75000d, + ef_ptc_adv_ancient_out_effect_14 = 0x75000e, + ef_ptc_adv_ancient_out_effect_15 = 0x75000f, + ef_ptc_adv_ancient_out_effect_16 = 0x750010, + ef_ptc_adv_ancient_out_effect_17 = 0x750011, + ef_ptc_adv_ancient_out_effect_18 = 0x750012, + ef_ptc_adv_ancient_out_effect_19 = 0x750013, + ef_ptc_adv_ancient_out_effect_20 = 0x750014, + ef_ptc_adv_ancient_out_effect_21 = 0x750015, + ef_ptc_adv_ancient_out_effect_22 = 0x750016, + ef_ptc_adv_ancient_out_effect_23 = 0x750017, + ef_ptc_adv_ancient_out_effect_24 = 0x750018, + ef_ptc_adv_test_40 = 0x760001, + ef_ptc_adv_red = 0x760002, + ef_ptc_adv_blue = 0x760003, + ef_ptc_adv_green = 0x760004, + ef_ptc_adv_red_move = 0x760005, + ef_ptc_adv_blue_move = 0x760006, + ef_ptc_adv_green_move = 0x760007, + ef_ptc_adv_factory_effect = 0x760008, + ef_ptc_adv_factory_effect_2 = 0x760009, + ef_ptc_adv_factory_effect_3 = 0x76000a, + ef_ptc_adv_factory_effect_4 = 0x76000b, + ef_ptc_adv_factory_effect_5 = 0x76000c, + ef_ptc_adv_factory_effect_6 = 0x76000d, + ef_ptc_adv_factory_effect_7 = 0x76000e, + ef_ptc_adv_factory_effect_8 = 0x76000f, + ef_ptc_adv_factory_effect_9 = 0x760010, + ef_ptc_adv_factory_effect_10 = 0x760011, + ef_ptc_adv_factory_effect_11 = 0x760012, + ef_ptc_adv_factory_effect_12 = 0x760013, + ef_ptc_adv_factory_effect_13 = 0x760014, + ef_ptc_adv_factory_effect_14 = 0x760015, + ef_ptc_adv_factory_effect_15 = 0x760016, + ef_ptc_adv_factory_effect_16 = 0x760017, + ef_ptc_adv_factory_effect_17 = 0x760018, + ef_ptc_adv_dimen_brick_break = 0x770001, + ef_ptc_adv_dimen_brick_break_punch = 0x770002, + ef_ptc_adv_dimen_brick_break_bomb_red = 0x770003, + ef_ptc_adv_dimen_brick_break_bomb_blue = 0x770004, + ef_ptc_adv_dimension_effect = 0x770005, + ef_ptc_adv_dimension_effect_2 = 0x770006, + ef_ptc_adv_dimension_effect_3 = 0x770007, + ef_ptc_adv_dimension_effect_4 = 0x770008, + ef_ptc_adv_dimension_effect_5 = 0x770009, + ef_ptc_adv_dimension_effect_6 = 0x77000a, + ef_ptc_adv_dimension_effect_7 = 0x77000b, + ef_ptc_adv_dimension_effect_8 = 0x77000c, + ef_ptc_adv_dimension_effect_9 = 0x77000d, + ef_ptc_adv_dimension_effect_10 = 0x77000e, + ef_ptc_adv_dimension_effect_11 = 0x77000f, + ef_ptc_adv_dimension_effect_12 = 0x770010, + ef_ptc_adv_dimension_effect_13 = 0x770011, + ef_ptc_adv_dimension_effect_14 = 0x770012, + ef_ptc_adv_dimension_effect_15 = 0x770013, + ef_ptc_adv_dimension_effect_16 = 0x770014, + ef_ptc_adv_dimension_effect_17 = 0x770015, + ef_ptc_adv_dimension_effect_18 = 0x770016, + ef_ptc_adv_dimension_effect_19 = 0x770017, + ef_ptc_adv_dimension_effect_20 = 0x770018, + ef_ptc_adv_stadium_balloon = 0x780001, + ef_ptc_adv_stadium_kami = 0x780002, + ef_ptc_adv_stadium_hanabi = 0x780003, + ef_ptc_adv_stadium = 0x780004, + ef_ptc_adv_stadium_2 = 0x780005, + ef_ptc_adv_stadium_3 = 0x780006, + ef_ptc_adv_stadium_4 = 0x780007, + ef_ptc_adv_stadium_5 = 0x780008, + ef_ptc_adv_stadium_6 = 0x780009, + ef_ptc_adv_stadium_7 = 0x78000a, + ef_ptc_adv_stadium_8 = 0x78000b, + ef_ptc_adv_stadium_9 = 0x78000c, + ef_ptc_adv_stadium_10 = 0x78000d, + ef_ptc_adv_stadium_11 = 0x78000e, + ef_ptc_adv_stadium_12 = 0x78000f, + ef_ptc_adv_stadium_13 = 0x780010, + ef_ptc_adv_stadium_14 = 0x780011, + ef_ptc_adv_stadium_15 = 0x780012, + ef_ptc_adv_stadium_16 = 0x780013, + ef_ptc_adv_stadium_17 = 0x780014, + ef_ptc_adv_stadium_18 = 0x780015, + ef_ptc_adv_stadium_19 = 0x780016, + ef_ptc_adv_stadium_20 = 0x780017, + ef_ptc_adv_stadium_21 = 0x780018, + ef_ptc_adv_halberd_side_effect = 0x790001, + ef_ptc_adv_halberd_side_effect_2 = 0x790002, + ef_ptc_adv_halberd_side_effect_3 = 0x790003, + ef_ptc_adv_halberd_side_effect_4 = 0x790004, + ef_ptc_adv_halberd_side_effect_5 = 0x790005, + ef_ptc_adv_halberd_side_effect_6 = 0x790006, + ef_ptc_adv_halberd_side_effect_7 = 0x790007, + ef_ptc_adv_halberd_side_effect_8 = 0x790008, + ef_ptc_adv_halberd_side_effect_9 = 0x790009, + ef_ptc_adv_halberd_side_effect_10 = 0x79000a, + ef_ptc_adv_halberd_side_effect_11 = 0x79000b, + ef_ptc_adv_halberd_side_effect_12 = 0x79000c, + ef_ptc_adv_halberd_side_effect_13 = 0x79000d, + ef_ptc_adv_halberd_side_effect_14 = 0x79000e, + ef_ptc_adv_halberd_side_effect_15 = 0x79000f, + ef_ptc_adv_halberd_side_effect_16 = 0x790010, + ef_ptc_adv_halberd_side_effect_17 = 0x790011, + ef_ptc_adv_halberd_side_effect_18 = 0x790012, + ef_ptc_adv_halberd_side_effect_19 = 0x790013, + ef_ptc_adv_halberd_side_effect_20 = 0x790014, + ef_ptc_adv_halberd_side_effect_21 = 0x790015, + ef_ptc_adv_halberd_side_effect_22 = 0x790016, + ef_ptc_adv_halberd_side_effect_23 = 0x790017, + ef_ptc_adv_halberd_side_effect_24 = 0x790018, + ef_ptc_adv_store_effect = 0x7a0001, + ef_ptc_adv_store_effect_2 = 0x7a0002, + ef_ptc_adv_store_effect_3 = 0x7a0003, + ef_ptc_adv_store_effect_4 = 0x7a0004, + ef_ptc_adv_store_effect_5 = 0x7a0005, + ef_ptc_adv_store_effect_6 = 0x7a0006, + ef_ptc_adv_store_effect_7 = 0x7a0007, + ef_ptc_adv_store_effect_8 = 0x7a0008, + ef_ptc_adv_store_effect_9 = 0x7a0009, + ef_ptc_adv_store_effect_10 = 0x7a000a, + ef_ptc_adv_store_effect_11 = 0x7a000b, + ef_ptc_adv_store_effect_12 = 0x7a000c, + ef_ptc_adv_store_effect_13 = 0x7a000d, + ef_ptc_adv_store_effect_14 = 0x7a000e, + ef_ptc_adv_store_effect_15 = 0x7a000f, + ef_ptc_adv_store_effect_16 = 0x7a0010, + ef_ptc_adv_store_effect_17 = 0x7a0011, + ef_ptc_adv_store_effect_18 = 0x7a0012, + ef_ptc_adv_store_effect_19 = 0x7a0013, + ef_ptc_adv_store_effect_20 = 0x7a0014, + ef_ptc_adv_store_effect_21 = 0x7a0015, + ef_ptc_adv_store_effect_22 = 0x7a0016, + ef_ptc_adv_store_effect_23 = 0x7a0017, + ef_ptc_adv_store_effect_24 = 0x7a0018, + ef_ptc_adv_flying_plate_effect = 0x7b0001, + ef_ptc_adv_flying_plate_effect_2 = 0x7b0002, + ef_ptc_adv_flying_plate_effect_3 = 0x7b0003, + ef_ptc_adv_flying_plate_effect_4 = 0x7b0004, + ef_ptc_adv_flying_plate_effect_5 = 0x7b0005, + ef_ptc_adv_flying_plate_effect_6 = 0x7b0006, + ef_ptc_adv_flying_plate_effect_7 = 0x7b0007, + ef_ptc_adv_flying_plate_effect_8 = 0x7b0008, + ef_ptc_adv_flying_plate_effect_9 = 0x7b0009, + ef_ptc_adv_flying_plate_effect_10 = 0x7b000a, + ef_ptc_adv_flying_plate_effect_11 = 0x7b000b, + ef_ptc_adv_flying_plate_effect_12 = 0x7b000c, + ef_ptc_adv_flying_plate_effect_13 = 0x7b000d, + ef_ptc_adv_flying_plate_effect_14 = 0x7b000e, + ef_ptc_adv_flying_plate_effect_15 = 0x7b000f, + ef_ptc_adv_flying_plate_effect_16 = 0x7b0010, + ef_ptc_adv_flying_plate_effect_17 = 0x7b0011, + ef_ptc_adv_flying_plate_effect_18 = 0x7b0012, + ef_ptc_adv_flying_plate_effect_19 = 0x7b0013, + ef_ptc_adv_flying_plate_effect_20 = 0x7b0014, + ef_ptc_adv_flying_plate_effect_21 = 0x7b0015, + ef_ptc_adv_flying_plate_effect_22 = 0x7b0016, + ef_ptc_adv_flying_plate_effect_23 = 0x7b0017, + ef_ptc_adv_flying_plate_effect_24 = 0x7b0018, + ef_ptc_adv_escape_effect = 0x7c0001, + ef_ptc_adv_escape_effect_2 = 0x7c0002, + ef_ptc_adv_escape_effect_3 = 0x7c0003, + ef_ptc_adv_escape_effect_4 = 0x7c0004, + ef_ptc_adv_escape_effect_5 = 0x7c0005, + ef_ptc_adv_escape_effect_6 = 0x7c0006, + ef_ptc_adv_escape_effect_7 = 0x7c0007, + ef_ptc_adv_escape_effect_8 = 0x7c0008, + ef_ptc_adv_escape_effect_9 = 0x7c0009, + ef_ptc_adv_escape_effect_10 = 0x7c000a, + ef_ptc_adv_escape_effect_11 = 0x7c000b, + ef_ptc_adv_escape_effect_12 = 0x7c000c, + ef_ptc_adv_escape_effect_13 = 0x7c000d, + ef_ptc_adv_escape_effect_14 = 0x7c000e, + ef_ptc_adv_escape_effect_15 = 0x7c000f, + ef_ptc_adv_escape_effect_16 = 0x7c0010, + ef_ptc_adv_escape_effect_17 = 0x7c0011, + ef_ptc_adv_escape_effect_18 = 0x7c0012, + ef_ptc_adv_escape_effect_19 = 0x7c0013, + ef_ptc_adv_escape_effect_20 = 0x7c0014, + ef_ptc_adv_escape_effect_21 = 0x7c0015, + ef_ptc_adv_escape_effect_22 = 0x7c0016, + ef_ptc_adv_escape_effect_23 = 0x7c0017, + ef_ptc_adv_escape_effect_24 = 0x7c0018, + ef_ptc_kuribo_effect = 0x7d0001, + ef_ptc_kuribo_effect_2 = 0x7d0002, + ef_ptc_kuribo_effect_3 = 0x7d0003, + ef_ptc_kuribo_effect_4 = 0x7d0004, + ef_ptc_kuribo_effect_5 = 0x7d0005, + ef_ptc_kuribo_effect_6 = 0x7d0006, + ef_ptc_kuribo_effect_7 = 0x7d0007, + ef_ptc_kuribo_effect_8 = 0x7d0008, + ef_ptc_kuribo_effect_9 = 0x7d0009, + ef_ptc_kuribo_effect_10 = 0x7d000a, + ef_ptc_kuribo_effect_11 = 0x7d000b, + ef_ptc_kuribo_effect_12 = 0x7d000c, + ef_ptc_kuribo_effect_13 = 0x7d000d, + ef_ptc_kuribo_effect_14 = 0x7d000e, + ef_ptc_kuribo_effect_15 = 0x7d000f, + ef_ptc_kuribo_effect_16 = 0x7d0010, + ef_ptc_kuribo_effect_17 = 0x7d0011, + ef_ptc_kuribo_effect_18 = 0x7d0012, + ef_ptc_kuribo_effect_19 = 0x7d0013, + ef_ptc_kuribo_effect_20 = 0x7d0014, + ef_ptc_patapata_e_003 = 0x7e0001, + ef_ptc_patapata_e_003_2 = 0x7e0002, + ef_ptc_patapata_e_003_3 = 0x7e0003, + ef_ptc_patapata_e_003_4 = 0x7e0004, + ef_ptc_patapata_e_003_5 = 0x7e0005, + ef_ptc_patapata_e_003_6 = 0x7e0006, + ef_ptc_patapata_e_003_7 = 0x7e0007, + ef_ptc_patapata_e_003_8 = 0x7e0008, + ef_ptc_patapata_e_003_9 = 0x7e0009, + ef_ptc_patapata_e_003_10 = 0x7e000a, + ef_ptc_patapata_e_003_11 = 0x7e000b, + ef_ptc_patapata_e_003_12 = 0x7e000c, + ef_ptc_patapata_e_003_13 = 0x7e000d, + ef_ptc_patapata_e_003_14 = 0x7e000e, + ef_ptc_patapata_e_003_15 = 0x7e000f, + ef_ptc_patapata_e_003_16 = 0x7e0010, + ef_ptc_patapata_e_003_17 = 0x7e0011, + ef_ptc_patapata_e_003_18 = 0x7e0012, + ef_ptc_patapata_e_003_19 = 0x7e0013, + ef_ptc_patapata_e_003_20 = 0x7e0014, + ef_ptc_patapata_e_003_21 = 0x7e0015, + ef_ptc_killer_vernier = 0x800001, + ef_ptc_killer_kml = 0x800002, + ef_ptc_killer_vernier_2 = 0x800003, + ef_ptc_killer_vernier_3 = 0x800004, + ef_ptc_killer_vernier_4 = 0x800005, + ef_ptc_killer_vernier_5 = 0x800006, + ef_ptc_killer_vernier_6 = 0x800007, + ef_ptc_killer_vernier_7 = 0x800008, + ef_ptc_killer_vernier_8 = 0x800009, + ef_ptc_killer_vernier_9 = 0x80000a, + ef_ptc_killer_vernier_10 = 0x80000b, + ef_ptc_killer_vernier_11 = 0x80000c, + ef_ptc_killer_vernier_12 = 0x80000d, + ef_ptc_killer_vernier_13 = 0x80000e, + ef_ptc_killer_vernier_14 = 0x80000f, + ef_ptc_killer_vernier_15 = 0x800010, + ef_ptc_killer_vernier_16 = 0x800011, + ef_ptc_killer_vernier_17 = 0x800012, + ef_ptc_killer_vernier_18 = 0x800013, + ef_ptc_killer_vernier_19 = 0x800014, + ef_ptc_killer_vernier_20 = 0x800015, + ef_ptc_killer_vernier_21 = 0x800016, + ef_ptc_dekakuribo_tst_01 = 0x830001, + ef_ptc_dekakuribo_effect = 0x830002, + ef_ptc_dekakuribo_effect_2 = 0x830003, + ef_ptc_dekakuribo_effect_3 = 0x830004, + ef_ptc_dekakuribo_effect_4 = 0x830005, + ef_ptc_dekakuribo_effect_5 = 0x830006, + ef_ptc_dekakuribo_effect_6 = 0x830007, + ef_ptc_dekakuribo_effect_7 = 0x830008, + ef_ptc_dekakuribo_effect_8 = 0x830009, + ef_ptc_dekakuribo_effect_9 = 0x83000a, + ef_ptc_dekakuribo_effect_10 = 0x83000b, + ef_ptc_dekakuribo_effect_11 = 0x83000c, + ef_ptc_dekakuribo_effect_12 = 0x83000d, + ef_ptc_dekakuribo_effect_13 = 0x83000e, + ef_ptc_dekakuribo_effect_14 = 0x83000f, + ef_ptc_dekakuribo_effect_15 = 0x830010, + ef_ptc_dekakuribo_effect_16 = 0x830011, + ef_ptc_dekakuribo_effect_17 = 0x830012, + ef_ptc_dekakuribo_effect_18 = 0x830013, + ef_ptc_dekakuribo_effect_19 = 0x830014, + ef_ptc_gal_fireflash = 0x860001, + ef_ptc_gal_firebreath_00 = 0x860002, + ef_ptc_gal_firebreath_01 = 0x860003, + ef_ptc_gal_iceflash = 0x860004, + ef_ptc_gal_icebreath_00 = 0x860005, + ef_ptc_gal_icebreath_01 = 0x860006, + ef_ptc_gal_icehahen = 0x860007, + ef_ptc_gal_thunderflash = 0x860009, + ef_ptc_gal_thunderbreath_00 = 0x86000a, + ef_ptc_gal_thunderbreath_01 = 0x86000b, + ef_ptc_gal_thunderpika = 0x86000c, + ef_ptc_gal_iceflash_2 = 0x86000d, + ef_ptc_gal_iceflash_3 = 0x86000e, + ef_ptc_gal_iceflash_4 = 0x86000f, + ef_ptc_gal_iceflash_5 = 0x860010, + ef_ptc_gal_iceflash_6 = 0x860011, + ef_ptc_gal_iceflash_7 = 0x860012, + ef_ptc_gal_iceflash_8 = 0x860013, + ef_ptc_gal_iceflash_9 = 0x860014, + ef_ptc_gal_iceflash_10 = 0x860015, + ef_ptc_gal_iceflash_11 = 0x860016, + ef_ptc_gal_iceflash_12 = 0x860017, + ef_ptc_gal_iceflash_13 = 0x860018, + ef_ptc_gal_iceflash_14 = 0x860019, + ef_ptc_gal_iceflash_15 = 0x86001a, + ef_ptc_gal_iceflash_16 = 0x86001b, + ef_ptc_gal_iceflash_17 = 0x86001c, + ef_ptc_gal_iceflash_18 = 0x86001d, + ef_ptc_gal_iceflash_19 = 0x86001e, + ef_ptc_gal_iceflash_20 = 0x86001f, + ef_ptc_gal_iceflash_21 = 0x860020, + ef_ptc_gal_iceflash_22 = 0x860021, + ef_ptc_gal_iceflash_23 = 0x860022, + ef_ptc_gal_iceflash_24 = 0x860023, + ef_ptc_gal_iceflash_25 = 0x860024, + ef_ptc_gal_iceflash_26 = 0x860025, + ef_ptc_gal_iceflash_27 = 0x860026, + ef_ptc_gal_iceflash_28 = 0x860027, + ef_ptc_gal_iceflash_29 = 0x860028, + ef_ptc_gal_iceflash_30 = 0x860029, + ef_ptc_gal_iceflash_31 = 0x86002a, + ef_ptc_gal_iceflash_32 = 0x86002b, + ef_ptc_gal_iceflash_33 = 0x86002c, + ef_ptc_gal_iceflash_34 = 0x86002d, + ef_ptc_gal_iceflash_35 = 0x86002e, + ef_ptc_gal_iceflash_36 = 0x86002f, + ef_ptc_gal_iceflash_37 = 0x860030, + ef_ptc_gal_iceflash_38 = 0x860031, + ef_ptc_gal_iceflash_39 = 0x860032, + ef_ptc_gal_iceflash_40 = 0x860033, + ef_ptc_gal_iceflash_41 = 0x860034, + ef_ptc_gal_iceflash_42 = 0x860035, + ef_ptc_gal_iceflash_43 = 0x860036, + ef_ptc_gal_iceflash_44 = 0x860037, + ef_ptc_gal_iceflash_45 = 0x860038, + ef_ptc_gal_iceflash_46 = 0x860039, + ef_ptc_melorin_act_01 = 0x8a0001, + ef_ptc_melorin_act_01_2 = 0x8a0002, + ef_ptc_melorin_act_01_3 = 0x8a0003, + ef_ptc_melorin_act_01_4 = 0x8a0004, + ef_ptc_melorin_act_01_5 = 0x8a0005, + ef_ptc_melorin_act_01_6 = 0x8a0006, + ef_ptc_melorin_act_01_7 = 0x8a0007, + ef_ptc_melorin_act_01_8 = 0x8a0008, + ef_ptc_melorin_act_01_9 = 0x8a0009, + ef_ptc_melorin_act_01_10 = 0x8a000a, + ef_ptc_melorin_act_01_11 = 0x8a000b, + ef_ptc_melorin_act_01_12 = 0x8a000c, + ef_ptc_melorin_act_01_13 = 0x8a000d, + ef_ptc_melorin_act_01_14 = 0x8a000e, + ef_ptc_melorin_act_01_15 = 0x8a000f, + ef_ptc_melorin_act_01_16 = 0x8a0010, + ef_ptc_melorin_act_01_17 = 0x8a0011, + ef_ptc_melorin_act_01_18 = 0x8a0012, + ef_ptc_melorin_act_01_19 = 0x8a0013, + ef_ptc_melorin_act_01_20 = 0x8a0014, + ef_ptc_popperam_act_01 = 0x8b0007, + ef_ptc_popperam_act_02 = 0x8b0008, + ef_ptc_popperam_act_03 = 0x8b0009, + ef_ptc_popperam_act_04 = 0x8b000a, + ef_ptc_popperam_act_01_2 = 0x8b000b, + ef_ptc_popperam_act_01_3 = 0x8b000c, + ef_ptc_popperam_act_01_4 = 0x8b000d, + ef_ptc_popperam_act_01_5 = 0x8b000e, + ef_ptc_popperam_act_01_6 = 0x8b000f, + ef_ptc_popperam_act_01_7 = 0x8b0010, + ef_ptc_popperam_act_01_8 = 0x8b0011, + ef_ptc_popperam_act_01_9 = 0x8b0012, + ef_ptc_popperam_act_01_10 = 0x8b0013, + ef_ptc_popperam_act_01_11 = 0x8b0014, + ef_ptc_popperam_act_01_12 = 0x8b0015, + ef_ptc_popperam_act_01_13 = 0x8b0016, + ef_ptc_popperam_act_01_14 = 0x8b0017, + ef_ptc_popperam_act_01_15 = 0x8b0018, + ef_ptc_popperam_act_01_16 = 0x8b0019, + ef_ptc_popperam_act_01_17 = 0x8b001a, + ef_ptc_bitan_act_01 = 0x8d0001, + ef_ptc_bitan_act_01_2 = 0x8d0002, + ef_ptc_bitan_act_01_3 = 0x8d0003, + ef_ptc_bitan_act_01_4 = 0x8d0004, + ef_ptc_bitan_act_01_5 = 0x8d0005, + ef_ptc_bitan_act_01_6 = 0x8d0006, + ef_ptc_bitan_act_01_7 = 0x8d0007, + ef_ptc_bitan_act_01_8 = 0x8d0008, + ef_ptc_bitan_act_01_9 = 0x8d0009, + ef_ptc_bitan_act_01_10 = 0x8d000a, + ef_ptc_bitan_act_01_11 = 0x8d000b, + ef_ptc_bitan_act_01_12 = 0x8d000c, + ef_ptc_bitan_act_01_13 = 0x8d000d, + ef_ptc_bitan_act_01_14 = 0x8d000e, + ef_ptc_bitan_act_01_15 = 0x8d000f, + ef_ptc_bitan_act_01_16 = 0x8d0010, + ef_ptc_bitan_act_01_17 = 0x8d0011, + ef_ptc_bitan_act_01_18 = 0x8d0012, + ef_ptc_bitan_act_01_19 = 0x8d0013, + ef_ptc_bitan_act_01_20 = 0x8d0014, + ef_ptc_mechcannon_act_01 = 0x8e0001, + ef_ptc_mechcannon_act_01_2 = 0x8e0002, + ef_ptc_mechcannon_act_01_3 = 0x8e0003, + ef_ptc_mechcannon_act_01_4 = 0x8e0004, + ef_ptc_mechcannon_act_01_5 = 0x8e0005, + ef_ptc_mechcannon_act_01_6 = 0x8e0006, + ef_ptc_mechcannon_act_01_7 = 0x8e0007, + ef_ptc_mechcannon_act_01_8 = 0x8e0008, + ef_ptc_mechcannon_act_01_9 = 0x8e0009, + ef_ptc_mechcannon_act_01_10 = 0x8e000a, + ef_ptc_mechcannon_act_01_11 = 0x8e000b, + ef_ptc_mechcannon_act_01_12 = 0x8e000c, + ef_ptc_mechcannon_act_01_13 = 0x8e000d, + ef_ptc_mechcannon_act_01_14 = 0x8e000e, + ef_ptc_mechcannon_act_01_15 = 0x8e000f, + ef_ptc_mechcannon_act_01_16 = 0x8e0010, + ef_ptc_mechcannon_act_01_17 = 0x8e0011, + ef_ptc_mechcannon_act_01_18 = 0x8e0012, + ef_ptc_mechcannon_act_01_19 = 0x8e0013, + ef_ptc_mechcannon_act_01_20 = 0x8e0014, + ef_ptc_mizuo_effect = 0x8f0001, + ef_ptc_mizuo_effect_2 = 0x8f0002, + ef_ptc_mizuo_effect_3 = 0x8f0003, + ef_ptc_mizuo_effect_4 = 0x8f0004, + ef_ptc_mizuo_effect_5 = 0x8f0005, + ef_ptc_mizuo_effect_6 = 0x8f0006, + ef_ptc_mizuo_effect_7 = 0x8f0007, + ef_ptc_mizuo_effect_8 = 0x8f0008, + ef_ptc_mizuo_effect_9 = 0x8f0009, + ef_ptc_mizuo_effect_10 = 0x8f000a, + ef_ptc_mizuo_effect_11 = 0x8f000b, + ef_ptc_mizuo_effect_12 = 0x8f000c, + ef_ptc_mizuo_effect_13 = 0x8f000d, + ef_ptc_mizuo_effect_14 = 0x8f000e, + ef_ptc_mizuo_effect_15 = 0x8f000f, + ef_ptc_mizuo_effect_16 = 0x8f0010, + ef_ptc_mizuo_effect_17 = 0x8f0011, + ef_ptc_mizuo_effect_18 = 0x8f0012, + ef_ptc_mizuo_effect_19 = 0x8f0013, + ef_ptc_mizuo_effect_20 = 0x8f0014, + ef_ptc_roada_gas_01 = 0x900001, + ef_ptc_roada_gas_02 = 0x900002, + ef_ptc_roada_gas_03 = 0x900003, + ef_ptc_roada_gas_04 = 0x900004, + ef_ptc_roada_gas_05 = 0x900005, + ef_ptc_roada_gas_06 = 0x900006, + ef_ptc_roada_gas_07 = 0x900007, + ef_ptc_roada_gas_08 = 0x900008, + ef_ptc_roada_gas_09 = 0x900009, + ef_ptc_roada_gas_10 = 0x90000a, + ef_ptc_roada_gas_12 = 0x90000b, + ef_ptc_roada_gas_12_2 = 0x90000c, + ef_ptc_roada_gas_12_3 = 0x90000d, + ef_ptc_roada_gas_12_4 = 0x90000e, + ef_ptc_roada_gas_12_5 = 0x90000f, + ef_ptc_roada_gas_12_6 = 0x900010, + ef_ptc_roada_gas_12_7 = 0x900011, + ef_ptc_roada_gas_12_8 = 0x900012, + ef_ptc_roada_gas_12_9 = 0x900013, + ef_ptc_roada_gas_12_10 = 0x900014, + ef_ptc_roada_gas_12_11 = 0x900015, + ef_ptc_roada_gas_12_12 = 0x900016, + ef_ptc_roada_gas_12_13 = 0x900017, + ef_ptc_roada_gas_12_14 = 0x900018, + ef_ptc_roada_gas_12_15 = 0x900019, + ef_ptc_roada_gas_12_16 = 0x90001a, + ef_ptc_roada_gas_12_17 = 0x90001b, + ef_ptc_roada_gas_12_18 = 0x90001c, + ef_ptc_roada_gas_12_19 = 0x90001d, + ef_ptc_roada_gas_12_20 = 0x90001e, + ef_ptc_roada_gas_12_21 = 0x90001f, + ef_ptc_roada_gas_12_22 = 0x900020, + ef_ptc_roada_gas_12_23 = 0x900021, + ef_ptc_roada_gas_12_24 = 0x900022, + ef_ptc_roada_gas_12_25 = 0x900023, + ef_ptc_roada_gas_12_26 = 0x900024, + ef_ptc_roada_gas_12_27 = 0x900025, + ef_ptc_roada_gas_12_28 = 0x900026, + ef_ptc_roada_gas_12_29 = 0x900027, + ef_ptc_roada_gas_12_30 = 0x900028, + ef_ptc_roada_gas_12_31 = 0x900029, + ef_ptc_bombhead_fire = 0x910001, + ef_ptc_bombhead_hamon = 0x910002, + ef_ptc_bombhead_fire_2 = 0x910003, + ef_ptc_bombhead_fire_3 = 0x910004, + ef_ptc_bombhead_fire_4 = 0x910005, + ef_ptc_bombhead_fire_5 = 0x910006, + ef_ptc_bombhead_fire_6 = 0x910007, + ef_ptc_bombhead_fire_7 = 0x910008, + ef_ptc_bombhead_fire_8 = 0x910009, + ef_ptc_bombhead_fire_9 = 0x91000a, + ef_ptc_bombhead_fire_10 = 0x91000b, + ef_ptc_bombhead_fire_11 = 0x91000c, + ef_ptc_bombhead_fire_12 = 0x91000d, + ef_ptc_bombhead_fire_13 = 0x91000e, + ef_ptc_bombhead_fire_14 = 0x91000f, + ef_ptc_bombhead_fire_15 = 0x910010, + ef_ptc_bombhead_fire_16 = 0x910011, + ef_ptc_bombhead_fire_17 = 0x910012, + ef_ptc_bombhead_fire_18 = 0x910013, + ef_ptc_bombhead_fire_19 = 0x910014, + ef_ptc_bombhead_fire_20 = 0x910015, + ef_ptc_gyraan_effect = 0x930002, + ef_ptc_gyraan_effect_2 = 0x930003, + ef_ptc_gyraan_effect_3 = 0x930004, + ef_ptc_gyraan_effect_4 = 0x930005, + ef_ptc_gyraan_effect_5 = 0x930006, + ef_ptc_gyraan_effect_6 = 0x930007, + ef_ptc_gyraan_effect_7 = 0x930008, + ef_ptc_gyraan_effect_8 = 0x930009, + ef_ptc_gyraan_effect_9 = 0x93000a, + ef_ptc_gyraan_effect_10 = 0x93000b, + ef_ptc_gyraan_effect_11 = 0x93000c, + ef_ptc_gyraan_effect_12 = 0x93000d, + ef_ptc_gyraan_effect_13 = 0x93000e, + ef_ptc_gyraan_effect_14 = 0x93000f, + ef_ptc_gyraan_effect_15 = 0x930010, + ef_ptc_gyraan_effect_16 = 0x930011, + ef_ptc_gyraan_effect_17 = 0x930012, + ef_ptc_gyraan_effect_18 = 0x930013, + ef_ptc_gyraan_effect_19 = 0x930014, + ef_ptc_bucyulus_tuti = 0x940001, + ef_ptc_bucyulus_tuti_2 = 0x940002, + ef_ptc_bucyulus_tuti_3 = 0x940003, + ef_ptc_bucyulus_tuti_4 = 0x940004, + ef_ptc_bucyulus_tuti_5 = 0x940005, + ef_ptc_bucyulus_tuti_6 = 0x940006, + ef_ptc_bucyulus_tuti_7 = 0x940007, + ef_ptc_bucyulus_tuti_8 = 0x940008, + ef_ptc_bucyulus_tuti_9 = 0x940009, + ef_ptc_bucyulus_tuti_10 = 0x94000a, + ef_ptc_bucyulus_ase_1 = 0x94000b, + ef_ptc_bucyulus_ase_2 = 0x94000c, + ef_ptc_bucyulus_tuti_11 = 0x94000d, + ef_ptc_bucyulus_tuti_12 = 0x94000e, + ef_ptc_bucyulus_tuti_13 = 0x94000f, + ef_ptc_bucyulus_tuti_14 = 0x940010, + ef_ptc_bucyulus_tuti_15 = 0x940011, + ef_ptc_bucyulus_tuti_16 = 0x940012, + ef_ptc_bucyulus_tuti_17 = 0x940013, + ef_ptc_bucyulus_tuti_18 = 0x940014, + ef_ptc_bucyulus_tuti_19 = 0x940015, + ef_ptc_tautau_act_01 = 0x950001, + ef_ptc_tautau_act_01_2 = 0x950002, + ef_ptc_tautau_act_01_3 = 0x950003, + ef_ptc_tautau_act_01_4 = 0x950004, + ef_ptc_tautau_act_01_5 = 0x950005, + ef_ptc_tautau_act_01_6 = 0x950006, + ef_ptc_tautau_act_01_7 = 0x950007, + ef_ptc_tautau_act_01_8 = 0x950008, + ef_ptc_tautau_act_01_9 = 0x950009, + ef_ptc_tautau_act_01_10 = 0x95000a, + ef_ptc_tautau_act_01_11 = 0x95000b, + ef_ptc_tautau_act_01_12 = 0x95000c, + ef_ptc_tautau_act_01_13 = 0x95000d, + ef_ptc_tautau_act_01_14 = 0x95000e, + ef_ptc_tautau_act_01_15 = 0x95000f, + ef_ptc_tautau_act_01_16 = 0x950010, + ef_ptc_tautau_act_01_17 = 0x950011, + ef_ptc_tautau_act_01_18 = 0x950012, + ef_ptc_tautau_act_01_19 = 0x950013, + ef_ptc_tautau_act_01_20 = 0x950014, + ef_ptc_tautau_act_01_21 = 0x950015, + ef_ptc_bubot_goku = 0x960001, + ef_ptc_bubot_cannon = 0x960002, + ef_ptc_bubot_effect = 0x960003, + ef_ptc_bubot_effect_2 = 0x960004, + ef_ptc_bubot_effect_3 = 0x960005, + ef_ptc_bubot_effect_4 = 0x960006, + ef_ptc_bubot_effect_5 = 0x960007, + ef_ptc_bubot_effect_6 = 0x960008, + ef_ptc_bubot_effect_7 = 0x960009, + ef_ptc_bubot_effect_8 = 0x96000a, + ef_ptc_bubot_effect_9 = 0x96000b, + ef_ptc_bubot_effect_10 = 0x96000c, + ef_ptc_bubot_effect_11 = 0x96000d, + ef_ptc_bubot_effect_12 = 0x96000e, + ef_ptc_bubot_effect_13 = 0x96000f, + ef_ptc_bubot_effect_14 = 0x960010, + ef_ptc_bubot_effect_15 = 0x960011, + ef_ptc_bubot_effect_16 = 0x960012, + ef_ptc_bubot_effect_17 = 0x960013, + ef_ptc_bubot_effect_18 = 0x960014, + ef_ptc_flows_act_01 = 0x970001, + ef_ptc_flows_act_02 = 0x970002, + ef_ptc_flows_act_03 = 0x970003, + ef_ptc_flows_act_01_2 = 0x970004, + ef_ptc_flows_act_01_3 = 0x970005, + ef_ptc_flows_act_01_4 = 0x970006, + ef_ptc_flows_act_01_5 = 0x970007, + ef_ptc_flows_act_01_6 = 0x970008, + ef_ptc_flows_act_01_7 = 0x970009, + ef_ptc_flows_act_01_8 = 0x97000a, + ef_ptc_flows_act_01_9 = 0x97000b, + ef_ptc_flows_act_01_10 = 0x97000c, + ef_ptc_flows_act_01_11 = 0x97000d, + ef_ptc_flows_act_01_12 = 0x97000e, + ef_ptc_flows_act_01_13 = 0x97000f, + ef_ptc_flows_act_01_14 = 0x970010, + ef_ptc_flows_act_01_15 = 0x970011, + ef_ptc_flows_act_01_16 = 0x970012, + ef_ptc_flows_act_01_17 = 0x970013, + ef_ptc_flows_act_01_18 = 0x970014, + ef_ptc_aroaros_act_01 = 0x980001, + ef_ptc_aroaros_act_02 = 0x980002, + ef_ptc_aroaros_act_01_2 = 0x980003, + ef_ptc_aroaros_act_01_3 = 0x980004, + ef_ptc_aroaros_act_01_4 = 0x980005, + ef_ptc_aroaros_act_01_5 = 0x980006, + ef_ptc_aroaros_act_01_6 = 0x980007, + ef_ptc_aroaros_act_01_7 = 0x980008, + ef_ptc_aroaros_act_01_8 = 0x980009, + ef_ptc_aroaros_act_01_9 = 0x98000a, + ef_ptc_aroaros_act_01_10 = 0x98000b, + ef_ptc_aroaros_act_01_11 = 0x98000c, + ef_ptc_aroaros_act_01_12 = 0x98000d, + ef_ptc_aroaros_act_01_13 = 0x98000e, + ef_ptc_aroaros_act_01_14 = 0x98000f, + ef_ptc_aroaros_act_01_15 = 0x980010, + ef_ptc_aroaros_act_01_16 = 0x980011, + ef_ptc_aroaros_act_01_17 = 0x980012, + ef_ptc_aroaros_act_01_18 = 0x980013, + ef_ptc_aroaros_act_01_19 = 0x980014, + ef_ptc_aroaros_act_01_20 = 0x980015, + ef_ptc_aroaros_act_01_21 = 0x980016, + ef_ptc_botron_lava = 0x990001, + ef_ptc_botron_lava_2 = 0x990002, + ef_ptc_botron_lava_3 = 0x990003, + ef_ptc_botron_lava_4 = 0x990004, + ef_ptc_botron_lava_5 = 0x990005, + ef_ptc_botron_lava_6 = 0x990006, + ef_ptc_botron_lava_7 = 0x990007, + ef_ptc_botron_lava_8 = 0x990008, + ef_ptc_botron_lava_9 = 0x990009, + ef_ptc_botron_lava_10 = 0x99000a, + ef_ptc_botron_lava_11 = 0x99000b, + ef_ptc_botron_lava_12 = 0x99000c, + ef_ptc_botron_lava_13 = 0x99000d, + ef_ptc_botron_lava_14 = 0x99000e, + ef_ptc_botron_lava_15 = 0x99000f, + ef_ptc_botron_lava_16 = 0x990010, + ef_ptc_botron_lava_17 = 0x990011, + ef_ptc_botron_lava_18 = 0x990012, + ef_ptc_botron_lava_19 = 0x990013, + ef_ptc_botron_lava_20 = 0x990014, + ef_ptc_botron_lava_21 = 0x990015, + ef_ptc_jyakeel_core = 0x9a0001, + ef_ptc_jyakeel_core_2 = 0x9a0002, + ef_ptc_jyakeel_core_3 = 0x9a0003, + ef_ptc_jyakeel_core_4 = 0x9a0004, + ef_ptc_jyakeel_core_5 = 0x9a0007, + ef_ptc_jyakeel_core_6 = 0x9a0008, + ef_ptc_jyakeel_core_7 = 0x9a000b, + ef_ptc_jyakeel_thunderdarkflesh = 0x9a000c, + ef_ptc_jyakeel_thunderlightflash = 0x9a000d, + ef_ptc_jyakeel_thunder_01 = 0x9a000e, + ef_ptc_jyakeel_thunderline_01 = 0x9a000f, + ef_ptc_jyakeel_thunderline_02 = 0x9a0010, + ef_ptc_jyakeel_thunderpika = 0x9a0011, + ef_ptc_jyakeel_core_8 = 0x9a0012, + ef_ptc_jyakeel_core_9 = 0x9a0013, + ef_ptc_jyakeel_core_10 = 0x9a0014, + ef_ptc_jyakeel_fireflash = 0x9a0015, + ef_ptc_jyakeel_fire_01 = 0x9a0016, + ef_ptc_jyakeel_core_11 = 0x9a0017, + ef_ptc_jyakeel_core_12 = 0x9a0018, + ef_ptc_jyakeel_core_13 = 0x9a0019, + ef_ptc_jyakeel_core_14 = 0x9a001a, + ef_ptc_jyakeel_core_15 = 0x9a001b, + ef_ptc_jyakeel_core_16 = 0x9a001c, + ef_ptc_jyakeel_core_17 = 0x9a001d, + ef_ptc_jyakeel_core_18 = 0x9a001e, + ef_ptc_jyakeel_waterflash = 0x9a001f, + ef_ptc_jyakeel_water_01 = 0x9a0020, + ef_ptc_jyakeel_water_hit_1 = 0x9a0021, + ef_ptc_jyakeel_water_hitflash_1 = 0x9a0022, + ef_ptc_jyakeel_water_hamon = 0x9a0024, + ef_ptc_jyakeel_water_hit_0 = 0x9a0025, + ef_ptc_jyakeel_core_19 = 0x9a0026, + ef_ptc_jyakeel_core_20 = 0x9a0027, + ef_ptc_jyakeel_core_21 = 0x9a0028, + ef_ptc_jyakeel_core_22 = 0x9a0029, + ef_ptc_jyakeel_core_23 = 0x9a002a, + ef_ptc_jyakeel_core_24 = 0x9a002b, + ef_ptc_jyakeel_core_25 = 0x9a002c, + ef_ptc_jyakeel_core_26 = 0x9a002d, + ef_ptc_jyakeel_core_27 = 0x9a002e, + ef_ptc_jyakeel_core_28 = 0x9a002f, + ef_ptc_jyakeel_core_29 = 0x9a0030, + ef_ptc_jyakeel_core_30 = 0x9a0031, + ef_ptc_jyakeel_core_31 = 0x9a0032, + ef_ptc_jyakeel_core_32 = 0x9a0033, + ef_ptc_ghamgha_eyes = 0x9e0001, + ef_ptc_ghamgha_mazlfrash_01 = 0x9e0002, + ef_ptc_ghamgha_mazlfrash_02 = 0x9e0003, + ef_ptc_ghamgha_start = 0x9e0004, + ef_ptc_ghamgha_beam = 0x9e0005, + ef_ptc_ghamgha_tuti = 0x9e0006, + ef_ptc_ghamgha_effect = 0x9e0007, + ef_ptc_ghamgha_effect_2 = 0x9e0008, + ef_ptc_ghamgha_effect_3 = 0x9e0009, + ef_ptc_ghamgha_effect_4 = 0x9e000a, + ef_ptc_ghamgha_effect_5 = 0x9e000b, + ef_ptc_ghamgha_effect_6 = 0x9e000c, + ef_ptc_ghamgha_effect_7 = 0x9e000d, + ef_ptc_ghamgha_effect_8 = 0x9e000e, + ef_ptc_ghamgha_effect_9 = 0x9e000f, + ef_ptc_ghamgha_effect_10 = 0x9e0010, + ef_ptc_ghamgha_effect_11 = 0x9e0011, + ef_ptc_ghamgha_effect_12 = 0x9e0012, + ef_ptc_ghamgha_effect_13 = 0x9e0013, + ef_ptc_ghamgha_effect_14 = 0x9e0014, + ef_ptc_pacci_act_01 = 0xa00001, + ef_ptc_pacci_act_01_2 = 0xa00002, + ef_ptc_pacci_act_01_3 = 0xa00003, + ef_ptc_pacci_act_01_4 = 0xa00004, + ef_ptc_pacci_act_01_5 = 0xa00005, + ef_ptc_pacci_act_01_6 = 0xa00006, + ef_ptc_pacci_act_01_7 = 0xa00007, + ef_ptc_pacci_act_01_8 = 0xa00008, + ef_ptc_pacci_act_01_9 = 0xa00009, + ef_ptc_pacci_act_01_10 = 0xa0000a, + ef_ptc_pacci_act_01_11 = 0xa0000b, + ef_ptc_pacci_act_01_12 = 0xa0000c, + ef_ptc_pacci_act_01_13 = 0xa0000d, + ef_ptc_pacci_act_01_14 = 0xa0000e, + ef_ptc_pacci_act_01_15 = 0xa0000f, + ef_ptc_pacci_act_01_16 = 0xa00010, + ef_ptc_pacci_act_01_17 = 0xa00011, + ef_ptc_pacci_act_01_18 = 0xa00012, + ef_ptc_pacci_act_01_19 = 0xa00013, + ef_ptc_pacci_act_01_20 = 0xa00014, + ef_ptc_faulong_act_01 = 0xa10001, + ef_ptc_faulong_act_02 = 0xa10002, + ef_ptc_faulong_act_01_2 = 0xa10003, + ef_ptc_faulong_act_01_3 = 0xa10004, + ef_ptc_faulong_act_01_4 = 0xa10005, + ef_ptc_faulong_act_01_5 = 0xa10006, + ef_ptc_faulong_act_01_6 = 0xa10007, + ef_ptc_faulong_act_01_7 = 0xa10008, + ef_ptc_faulong_act_01_8 = 0xa10009, + ef_ptc_faulong_act_01_9 = 0xa1000a, + ef_ptc_faulong_act_01_10 = 0xa1000b, + ef_ptc_faulong_act_01_11 = 0xa1000c, + ef_ptc_faulong_act_01_12 = 0xa1000d, + ef_ptc_faulong_act_01_13 = 0xa1000e, + ef_ptc_faulong_act_01_14 = 0xa1000f, + ef_ptc_faulong_act_01_15 = 0xa10010, + ef_ptc_faulong_act_01_16 = 0xa10011, + ef_ptc_faulong_act_01_17 = 0xa10012, + ef_ptc_faulong_act_01_18 = 0xa10013, + ef_ptc_faulong_act_01_19 = 0xa10014, + ef_ptc_deathpod_mazlfrash_1 = 0xa20001, + ef_ptc_deathpod_kml = 0xa20003, + ef_ptc_deathpod_kml_2 = 0xa20004, + ef_ptc_deathpod_eyesgreenred = 0xa20005, + ef_ptc_deathpod_eyesred = 0xa20006, + ef_ptc_deathpod_eyesredgreen = 0xa20007, + ef_ptc_deathpod_kml_3 = 0xa20008, + ef_ptc_deathpod_kml_4 = 0xa20009, + ef_ptc_deathpod_kml_5 = 0xa2000a, + ef_ptc_deathpod_kml_6 = 0xa2000b, + ef_ptc_deathpod_kml_7 = 0xa2000c, + ef_ptc_deathpod_kml_8 = 0xa2000d, + ef_ptc_deathpod_kml_9 = 0xa2000e, + ef_ptc_deathpod_kml_10 = 0xa2000f, + ef_ptc_deathpod_kml_11 = 0xa20010, + ef_ptc_deathpod_kml_12 = 0xa20011, + ef_ptc_deathpod_kml_13 = 0xa20012, + ef_ptc_deathpod_kml_14 = 0xa20013, + ef_ptc_deathpod_kml_15 = 0xa20014, + ef_ptc_deathpod_kml_16 = 0xa20015, + ef_ptc_deathpod_kml_17 = 0xa20016, + ef_ptc_deathpod_kml_18 = 0xa20017, + ef_ptc_deathpod_kml_19 = 0xa20018, + ef_ptc_deathpod_kml_20 = 0xa20019, + ef_ptc_deathpod_kml_21 = 0xa2001a, + ef_ptc_deathpod_kml_22 = 0xa2001b, + ef_ptc_spar_flash = 0xa40001, + ef_ptc_spar_elec = 0xa40002, + ef_ptc_spar_hibana = 0xa40003, + ef_ptc_spar_elec_2 = 0xa40004, + ef_ptc_spar_effect = 0xa40005, + ef_ptc_spar_effect_2 = 0xa40006, + ef_ptc_spar_effect_3 = 0xa40007, + ef_ptc_spar_effect_4 = 0xa40008, + ef_ptc_spar_effect_5 = 0xa40009, + ef_ptc_spar_effect_6 = 0xa4000a, + ef_ptc_spar_flash_b = 0xa4000b, + ef_ptc_spar_elec_b = 0xa4000c, + ef_ptc_spar_hibana_b = 0xa4000d, + ef_ptc_spar_effect_7 = 0xa4000e, + ef_ptc_spar_effect_8 = 0xa4000f, + ef_ptc_spar_effect_9 = 0xa40010, + ef_ptc_spar_effect_10 = 0xa40011, + ef_ptc_spar_effect_11 = 0xa40012, + ef_ptc_spar_laser_1 = 0xa40013, + ef_ptc_spar_laser_2 = 0xa40014, + ef_ptc_kokkon_finger = 0xa50001, + ef_ptc_kokkon_eyes = 0xa50004, + ef_ptc_kokkon_mazlfrash = 0xa50005, + ef_ptc_kokkon_eyesstart = 0xa50006, + ef_ptc_kokkon_finger_2 = 0xa50007, + ef_ptc_kokkon_finger_3 = 0xa50008, + ef_ptc_kokkon_finger_4 = 0xa50009, + ef_ptc_kokkon_finger_5 = 0xa5000a, + ef_ptc_kokkon_finger_6 = 0xa5000b, + ef_ptc_kokkon_finger_7 = 0xa5000c, + ef_ptc_kokkon_finger_8 = 0xa5000d, + ef_ptc_kokkon_finger_9 = 0xa5000e, + ef_ptc_kokkon_finger_10 = 0xa5000f, + ef_ptc_kokkon_finger_11 = 0xa50010, + ef_ptc_kokkon_finger_12 = 0xa50011, + ef_ptc_kokkon_finger_13 = 0xa50012, + ef_ptc_kokkon_finger_14 = 0xa50013, + ef_ptc_kokkon_finger_15 = 0xa50014, + ef_ptc_kokkon_finger_16 = 0xa50015, + ef_ptc_kokkon_finger_17 = 0xa50016, + ef_ptc_kokkon_finger_18 = 0xa50017, + ef_ptc_kokkon_bomb_c = 0xa50029, + ef_ptc_kokkon_vertical_smoke_b = 0xa5002a, + ef_ptc_kokkon_beam = 0xa5002b, + ef_ptc_jdus_act_01 = 0xa60001, + ef_ptc_jdus_act_02 = 0xa60002, + ef_ptc_jdus_act_03 = 0xa60003, + ef_ptc_jdus_act_01_2 = 0xa60005, + ef_ptc_jdus_act_01_3 = 0xa60006, + ef_ptc_jdus_act_01_4 = 0xa60007, + ef_ptc_jdus_act_01_5 = 0xa60008, + ef_ptc_jdus_act_01_6 = 0xa60009, + ef_ptc_jdus_act_01_7 = 0xa6000a, + ef_ptc_jdus_act_01_8 = 0xa6000b, + ef_ptc_jdus_act_01_9 = 0xa6000c, + ef_ptc_jdus_act_01_10 = 0xa6000d, + ef_ptc_jdus_act_01_11 = 0xa6000e, + ef_ptc_jdus_act_01_12 = 0xa6000f, + ef_ptc_jdus_act_01_13 = 0xa60010, + ef_ptc_jdus_act_01_14 = 0xa60011, + ef_ptc_jdus_act_01_15 = 0xa60012, + ef_ptc_jdus_act_01_16 = 0xa60013, + ef_ptc_jdus_act_01_17 = 0xa60014, + ef_ptc_shelly_act_01 = 0xa90002, + ef_ptc_shelly_act_01_2 = 0xa90003, + ef_ptc_shelly_act_01_3 = 0xa90004, + ef_ptc_shelly_act_01_4 = 0xa90005, + ef_ptc_shelly_act_01_5 = 0xa90006, + ef_ptc_shelly_act_01_6 = 0xa90007, + ef_ptc_shelly_act_01_7 = 0xa90008, + ef_ptc_shelly_act_01_8 = 0xa90009, + ef_ptc_shelly_act_01_9 = 0xa9000a, + ef_ptc_shelly_act_01_10 = 0xa9000b, + ef_ptc_shelly_act_01_11 = 0xa9000c, + ef_ptc_shelly_act_01_12 = 0xa9000d, + ef_ptc_shelly_act_01_13 = 0xa9000e, + ef_ptc_shelly_act_01_14 = 0xa9000f, + ef_ptc_shelly_act_01_15 = 0xa90010, + ef_ptc_shelly_act_01_16 = 0xa90011, + ef_ptc_shelly_act_01_17 = 0xa90012, + ef_ptc_shelly_act_01_18 = 0xa90013, + ef_ptc_shelly_act_01_19 = 0xa90014, + ef_ptc_ngagog_small = 0xaa0001, + ef_ptc_ngagog_big = 0xaa0002, + ef_ptc_ngagog_big_2 = 0xaa0003, + ef_ptc_ngagog_big_3 = 0xaa0004, + ef_ptc_ngagog_big_4 = 0xaa0005, + ef_ptc_ngagog_big_5 = 0xaa0006, + ef_ptc_ngagog_big_6 = 0xaa0007, + ef_ptc_ngagog_big_7 = 0xaa0008, + ef_ptc_ngagog_big_8 = 0xaa0009, + ef_ptc_ngagog_big_9 = 0xaa000a, + ef_ptc_ngagog_big_10 = 0xaa000b, + ef_ptc_ngagog_big_11 = 0xaa000c, + ef_ptc_ngagog_big_12 = 0xaa000d, + ef_ptc_ngagog_big_13 = 0xaa000e, + ef_ptc_ngagog_big_14 = 0xaa000f, + ef_ptc_ngagog_big_15 = 0xaa0010, + ef_ptc_ngagog_big_16 = 0xaa0011, + ef_ptc_ngagog_big_17 = 0xaa0012, + ef_ptc_ngagog_big_18 = 0xaa0013, + ef_ptc_ngagog_big_19 = 0xaa0014, + ef_ptc_ngagog_big_20 = 0xaa0015, + ef_ptc_ngagog_big_21 = 0xaa0016, + ef_ptc_cymal_act_01 = 0xac0001, + ef_ptc_cymal_act_01_2 = 0xac0002, + ef_ptc_cymal_act_01_3 = 0xac0003, + ef_ptc_cymal_act_01_4 = 0xac0004, + ef_ptc_cymal_act_01_5 = 0xac0005, + ef_ptc_cymal_act_01_6 = 0xac0006, + ef_ptc_cymal_act_01_7 = 0xac0007, + ef_ptc_cymal_act_01_8 = 0xac0008, + ef_ptc_cymal_act_01_9 = 0xac0009, + ef_ptc_cymal_act_01_10 = 0xac000a, + ef_ptc_cymal_act_01_11 = 0xac000b, + ef_ptc_cymal_act_01_12 = 0xac000c, + ef_ptc_cymal_act_01_13 = 0xac000d, + ef_ptc_cymal_act_01_14 = 0xac000e, + ef_ptc_cymal_act_01_15 = 0xac000f, + ef_ptc_cymal_act_01_16 = 0xac0010, + ef_ptc_cymal_act_01_17 = 0xac0011, + ef_ptc_cymal_act_01_18 = 0xac0012, + ef_ptc_cymal_act_01_19 = 0xac0013, + ef_ptc_cymal_act_01_20 = 0xac0014, + ef_ptc_teckin_effect = 0xad0003, + ef_ptc_teckin_effect_2 = 0xad0004, + ef_ptc_teckin_effect_3 = 0xad0005, + ef_ptc_teckin_effect_4 = 0xad0006, + ef_ptc_teckin_effect_5 = 0xad0007, + ef_ptc_teckin_effect_6 = 0xad0008, + ef_ptc_teckin_effect_7 = 0xad0009, + ef_ptc_teckin_effect_8 = 0xad000a, + ef_ptc_teckin_effect_9 = 0xad000b, + ef_ptc_teckin_effect_10 = 0xad000c, + ef_ptc_teckin_effect_11 = 0xad000d, + ef_ptc_teckin_effect_12 = 0xad000e, + ef_ptc_teckin_effect_13 = 0xad000f, + ef_ptc_teckin_effect_14 = 0xad0010, + ef_ptc_teckin_effect_15 = 0xad0011, + ef_ptc_teckin_effect_16 = 0xad0012, + ef_ptc_teckin_effect_17 = 0xad0013, + ef_ptc_teckin_effect_18 = 0xad0014, + ef_ptc_teckin_effect_19 = 0xad0015, + ef_ptc_teckin_effect_20 = 0xad0016, + ef_ptc_teckin_hahen = 0xad0029, + ef_ptc_cataguard_act_01 = 0xae0001, + ef_ptc_cataguard_act_01_2 = 0xae0002, + ef_ptc_cataguard_act_01_3 = 0xae0003, + ef_ptc_cataguard_act_01_4 = 0xae0004, + ef_ptc_cataguard_act_01_5 = 0xae0005, + ef_ptc_cataguard_act_01_6 = 0xae0006, + ef_ptc_cataguard_act_01_7 = 0xae0007, + ef_ptc_cataguard_act_01_8 = 0xae0008, + ef_ptc_cataguard_act_01_9 = 0xae0009, + ef_ptc_cataguard_act_01_10 = 0xae000a, + ef_ptc_cataguard_act_01_11 = 0xae000b, + ef_ptc_cataguard_act_01_12 = 0xae000c, + ef_ptc_cataguard_act_01_13 = 0xae000d, + ef_ptc_cataguard_act_01_14 = 0xae000e, + ef_ptc_cataguard_act_01_15 = 0xae000f, + ef_ptc_cataguard_act_01_16 = 0xae0010, + ef_ptc_cataguard_act_01_17 = 0xae0011, + ef_ptc_cataguard_act_01_18 = 0xae0012, + ef_ptc_cataguard_act_01_19 = 0xae0013, + ef_ptc_cataguard_act_01_20 = 0xae0014, + ef_ptc_boobas_act_01 = 0xb00001, + ef_ptc_boobas_act_02 = 0xb00002, + ef_ptc_boobas_act_01_2 = 0xb00003, + ef_ptc_boobas_act_01_3 = 0xb00004, + ef_ptc_boobas_act_01_4 = 0xb00005, + ef_ptc_boobas_act_01_5 = 0xb00006, + ef_ptc_boobas_act_01_6 = 0xb00007, + ef_ptc_boobas_act_01_7 = 0xb00008, + ef_ptc_boobas_act_01_8 = 0xb00009, + ef_ptc_boobas_act_01_9 = 0xb0000a, + ef_ptc_boobas_act_01_10 = 0xb0000b, + ef_ptc_boobas_act_01_11 = 0xb0000c, + ef_ptc_boobas_act_01_12 = 0xb0000d, + ef_ptc_boobas_act_01_13 = 0xb0000e, + ef_ptc_boobas_act_01_14 = 0xb0000f, + ef_ptc_boobas_act_01_15 = 0xb00010, + ef_ptc_boobas_act_01_16 = 0xb00011, + ef_ptc_boobas_act_01_17 = 0xb00012, + ef_ptc_boobas_act_01_18 = 0xb00013, + ef_ptc_boobas_act_01_19 = 0xb00014, + ef_ptc_boobas_act_01_20 = 0xb00015, + ef_ptc_boobas_act_01_21 = 0xb00016, + ef_ptc_arman_eyes = 0xb10002, + ef_ptc_arman_eyes_02 = 0xb10003, + ef_ptc_arman_hit = 0xb10004, + ef_ptc_arman_mazlfrash = 0xb10005, + ef_ptc_arman_eyes_2 = 0xb10006, + ef_ptc_arman_eyes_3 = 0xb10007, + ef_ptc_arman_eyes_4 = 0xb10008, + ef_ptc_arman_eyes_5 = 0xb10009, + ef_ptc_arman_eyes_6 = 0xb1000a, + ef_ptc_arman_ase = 0xb1000b, + ef_ptc_arman_ase_2 = 0xb1000c, + ef_ptc_arman_eyes_7 = 0xb1000d, + ef_ptc_arman_eyes_8 = 0xb1000e, + ef_ptc_arman_eyes_9 = 0xb1000f, + ef_ptc_arman_eyes_10 = 0xb10010, + ef_ptc_arman_eyes_11 = 0xb10011, + ef_ptc_arman_eyes_12 = 0xb10012, + ef_ptc_arman_eyes_13 = 0xb10013, + ef_ptc_arman_eyes_14 = 0xb10014, + ef_ptc_arman_beam = 0xb10015, + ef_ptc_prim_kagemushi = 0xb20001, + ef_ptc_prim_fireball = 0xb20002, + ef_ptc_prim_mazlfrash_a = 0xb20007, + ef_ptc_prim_firebreath_01 = 0xb20008, + ef_ptc_prim_firebreath_02 = 0xb20009, + ef_ptc_prim_headfire = 0xb2000a, + ef_ptc_prim_scopebeam = 0xb2000b, + ef_ptc_prim_mazlfrash_b = 0xb2000c, + ef_ptc_prim_scopecharge = 0xb2000d, + ef_ptc_prim_sword_01 = 0xb2000e, + ef_ptc_prim_sword_02 = 0xb2000f, + ef_ptc_prim_sword_03 = 0xb20010, + ef_ptc_prim_sword_04 = 0xb20011, + ef_ptc_prim_sword_05 = 0xb20012, + ef_ptc_prim_fireball_2 = 0xb20013, + ef_ptc_prim_rush_01 = 0xb20014, + ef_ptc_prim_fireball_3 = 0xb20015, + ef_ptc_prim_fireball_4 = 0xb20016, + ef_ptc_prim_fireball_5 = 0xb20017, + ef_ptc_prim_fireball_6 = 0xb20018, + ef_ptc_prim_fireball_7 = 0xb20019, + ef_ptc_prim_fireball_8 = 0xb2001a, + ef_ptc_prim_fireball_9 = 0xb2001b, + ef_ptc_prim_fireball_10 = 0xb2001c, + ef_ptc_prim_fireball_11 = 0xb2001d, + ef_ptc_prim_fireball_12 = 0xb2001e, + ef_ptc_prim_swordgizagiza_a = 0xb2001f, + ef_ptc_prim_swordgizagiza_b = 0xb20020, + ef_ptc_prim_fireball_13 = 0xb20021, + ef_ptc_prim_fireball_14 = 0xb20022, + ef_ptc_prim_fireball_15 = 0xb20023, + ef_ptc_prim_fireball_16 = 0xb20024, + ef_ptc_prim_fireball_17 = 0xb20025, + ef_ptc_prim_fireball_18 = 0xb20026, + ef_ptc_prim_fireball_19 = 0xb20027, + ef_ptc_prim_fireball_20 = 0xb20028, + ef_ptc_prim_punchcharge = 0xb20029, + ef_ptc_prim_punchte = 0xb2002a, + ef_ptc_prim_punchwind = 0xb2002b, + ef_ptc_prim_punch_01 = 0xb2002c, + ef_ptc_prim_fireball_21 = 0xb2002d, + ef_ptc_prim_fireball_22 = 0xb2002e, + ef_ptc_prim_fireball_23 = 0xb2002f, + ef_ptc_prim_fireball_24 = 0xb20030, + ef_ptc_prim_fireball_25 = 0xb20031, + ef_ptc_prim_fireball_26 = 0xb20032, + ef_ptc_prim_fireball_27 = 0xb20033, + ef_ptc_robo_act_01 = 0xb70001, + ef_ptc_robo_act_02 = 0xb70002, + ef_ptc_robo_act_03 = 0xb70003, + ef_ptc_robo_act_01_2 = 0xb70004, + ef_ptc_robo_act_01_3 = 0xb70005, + ef_ptc_robo_act_01_4 = 0xb70006, + ef_ptc_robo_act_01_5 = 0xb70007, + ef_ptc_robo_act_01_6 = 0xb70008, + ef_ptc_robo_act_01_7 = 0xb70009, + ef_ptc_robo_act_01_8 = 0xb7000a, + ef_ptc_robo_act_01_9 = 0xb7000b, + ef_ptc_robo_act_01_10 = 0xb7000c, + ef_ptc_robo_act_01_11 = 0xb7000d, + ef_ptc_robo_act_01_12 = 0xb7000e, + ef_ptc_robo_act_01_13 = 0xb7000f, + ef_ptc_robo_act_01_14 = 0xb70010, + ef_ptc_robo_act_01_15 = 0xb70011, + ef_ptc_robo_act_01_16 = 0xb70012, + ef_ptc_robo_act_01_17 = 0xb70013, + ef_ptc_robo_act_01_18 = 0xb70014, + ef_ptc_bosspackun_punpun_01 = 0xb90001, + ef_ptc_bosspackun_punpun_02 = 0xb90002, + ef_ptc_bosspackun_effect = 0xb90007, + ef_ptc_bosspackun_effect_2 = 0xb90008, + ef_ptc_bosspackun_effect_3 = 0xb90009, + ef_ptc_bosspackun_jumploop = 0xb9000a, + ef_ptc_bosspackun_jumpup = 0xb9000c, + ef_ptc_bosspackun_jumpup_2 = 0xb9000d, + ef_ptc_bosspackun_tyakuti_01 = 0xb9000e, + ef_ptc_bosspackun_gabu = 0xb9000f, + ef_ptc_bosspackun_effect_4 = 0xb90010, + ef_ptc_bosspackun_effect_5 = 0xb90011, + ef_ptc_bosspackun_effect_6 = 0xb90012, + ef_ptc_bosspackun_effect_7 = 0xb90013, + ef_ptc_bosspackun_spark_r_1 = 0xb90014, + ef_ptc_bosspackun_spark_r_2 = 0xb90015, + ef_ptc_bosspackun_wind_r = 0xb90016, + ef_ptc_bosspackun_effect_8 = 0xb90017, + ef_ptc_bosspackun_effect_9 = 0xb90018, + ef_ptc_bosspackun_effect_10 = 0xb90019, + ef_ptc_bosspackun_effect_11 = 0xb9001a, + ef_ptc_bosspackun_effect_12 = 0xb9001b, + ef_ptc_bosspackun_effect_13 = 0xb9001c, + ef_ptc_bosspackun_effect_14 = 0xb9001d, + ef_ptc_bosspackun_spark_l_1 = 0xb9001e, + ef_ptc_bosspackun_spark_l_2 = 0xb9001f, + ef_ptc_bosspackun_wind_l = 0xb90020, + ef_ptc_bosspackun_effect_15 = 0xb90021, + ef_ptc_bosspackun_effect_16 = 0xb90022, + ef_ptc_bosspackun_effect_17 = 0xb90023, + ef_ptc_bosspackun_effect_18 = 0xb90024, + ef_ptc_bosspackun_effect_19 = 0xb90025, + ef_ptc_bosspackun_effect_20 = 0xb90026, + ef_ptc_bosspackun_effect_21 = 0xb90027, + ef_ptc_bosspackun_hit_0 = 0xb90028, + ef_ptc_bosspackun_hit_1 = 0xb90029, + ef_ptc_bosspackun_hit_2 = 0xb9002a, + ef_ptc_bosspackun_effect_22 = 0xb9002b, + ef_ptc_bosspackun_effect_23 = 0xb9002c, + ef_ptc_bosspackun_effect_24 = 0xb9002d, + ef_ptc_bosspackun_effect_25 = 0xb9002e, + ef_ptc_bosspackun_effect_26 = 0xb9002f, + ef_ptc_bosspackun_effect_27 = 0xb90030, + ef_ptc_bosspackun_effect_28 = 0xb90031, + ef_ptc_bosspackun_down = 0xb90032, + ef_ptc_bosspackun_effect_29 = 0xb90033, + ef_ptc_bosspackun_effect_30 = 0xb90034, + ef_ptc_bosspackun_effect_31 = 0xb90035, + ef_ptc_bosspackun_effect_32 = 0xb90036, + ef_ptc_bosspackun_effect_33 = 0xb90037, + ef_ptc_bosspackun_effect_34 = 0xb90038, + ef_ptc_bosspackun_effect_35 = 0xb90039, + ef_ptc_bosspackun_effect_36 = 0xb9003a, + ef_ptc_bosspackun_effect_37 = 0xb9003b, + ef_ptc_bosspackun_effect_38 = 0xb9003c, + ef_ptc_bosspackun_downsmoke_1_karada = 0xb90064, + ef_ptc_bosspackun_downhinoko_1_karada = 0xb90065, + ef_ptc_bosspackun_downfire_1_karada = 0xb90066, + ef_ptc_bosspackun_downsmoke_1_hand = 0xb90067, + ef_ptc_bosspackun_downhinoko_1_hand = 0xb90068, + ef_ptc_bosspackun_downfire_1_hand = 0xb90069, + ef_ptc_bosspackun_downsmoke_1_atama = 0xb9006a, + ef_ptc_bosspackun_downhinoko_1_atama = 0xb9006b, + ef_ptc_bosspackun_downfire_1_atama = 0xb9006c, + ef_ptc_rayquaza_light_ball = 0xba0001, + ef_ptc_rayquaza_light_ball_start = 0xba0002, + ef_ptc_rayquaza_light_ball_loop = 0xba0003, + ef_ptc_rayquaza_light_ball_yuka = 0xba0004, + ef_ptc_rayquaza_explosion = 0xba0005, + ef_ptc_rayquaza_thunder = 0xba0006, + ef_ptc_rayquaza_dig_start = 0xba0007, + ef_ptc_rayquaza_dig_attack = 0xba0008, + ef_ptc_rayquaza_iron_tail = 0xba0009, + ef_ptc_rayquaza_move_sky = 0xba000a, + ef_ptc_rayquaza_move_jump = 0xba000b, + ef_ptc_rayquaza_move_ground = 0xba000c, + ef_ptc_rayquaza_move_ground_short = 0xba000d, + ef_ptc_rayquaza_wait = 0xba000e, + ef_ptc_rayquaza_houkou = 0xba0013, + ef_ptc_rayquaza_sisen = 0xba0014, + ef_ptc_rayquaza_act_01 = 0xba0015, + ef_ptc_rayquaza_act_01_2 = 0xba0016, + ef_ptc_rayquaza_act_01_3 = 0xba0017, + ef_ptc_rayquaza_act_01_4 = 0xba0018, + ef_ptc_rayquaza_act_01_5 = 0xba0019, + ef_ptc_rayquaza_act_01_6 = 0xba001a, + ef_ptc_rayquaza_act_01_7 = 0xba001b, + ef_ptc_rayquaza_act_01_8 = 0xba001c, + ef_ptc_rayquaza_act_01_9 = 0xba001d, + ef_ptc_rayquaza_act_01_10 = 0xba001e, + ef_ptc_rayquaza_act_01_11 = 0xba001f, + ef_ptc_rayquaza_act_01_12 = 0xba0020, + ef_ptc_rayquaza_act_01_13 = 0xba0021, + ef_ptc_rayquaza_act_01_14 = 0xba0022, + ef_ptc_rayquaza_act_01_15 = 0xba0023, + ef_ptc_rayquaza_act_01_16 = 0xba0024, + ef_ptc_rayquaza_act_01_17 = 0xba0025, + ef_ptc_rayquaza_act_01_18 = 0xba0026, + ef_ptc_rayquaza_act_01_19 = 0xba0027, + ef_ptc_rayquaza_act_01_20 = 0xba0028, + ef_ptc_rayquaza_act_01_21 = 0xba0029, + ef_ptc_rayquaza_act_01_22 = 0xba002a, + ef_ptc_rayquaza_act_01_23 = 0xba002b, + ef_ptc_rayquaza_act_01_24 = 0xba002c, + ef_ptc_rayquaza_act_01_25 = 0xba002d, + ef_ptc_rayquaza_act_01_26 = 0xba002e, + ef_ptc_rayquaza_act_01_27 = 0xba002f, + ef_ptc_rayquaza_act_01_28 = 0xba0030, + ef_ptc_rayquaza_act_01_29 = 0xba0031, + ef_ptc_rayquaza_act_01_30 = 0xba0032, + ef_ptc_rayquaza_act_01_31 = 0xba0033, + ef_ptc_rayquaza_act_01_32 = 0xba0034, + ef_ptc_rayquaza_act_01_33 = 0xba0035, + ef_ptc_rayquaza_act_01_34 = 0xba0036, + ef_ptc_rayquaza_act_01_35 = 0xba0037, + ef_ptc_rayquaza_act_01_36 = 0xba0038, + ef_ptc_rayquaza_act_01_37 = 0xba0039, + ef_ptc_rayquaza_act_01_38 = 0xba003a, + ef_ptc_rayquaza_act_01_39 = 0xba003b, + ef_ptc_rayquaza_act_01_40 = 0xba003c, + ef_ptc_rayquaza_act_01_41 = 0xba003d, + ef_ptc_rayquaza_act_01_42 = 0xba003e, + ef_ptc_rayquaza_act_01_43 = 0xba003f, + ef_ptc_rayquaza_act_01_44 = 0xba0040, + ef_ptc_rayquaza_act_01_45 = 0xba0041, + ef_ptc_rayquaza_act_01_46 = 0xba0042, + ef_ptc_rayquaza_act_01_47 = 0xba0043, + ef_ptc_rayquaza_act_01_48 = 0xba0044, + ef_ptc_rayquaza_act_01_49 = 0xba0045, + ef_ptc_rayquaza_act_01_50 = 0xba0046, + ef_ptc_rayquaza_act_01_51 = 0xba0047, + ef_ptc_rayquaza_act_01_52 = 0xba0048, + ef_ptc_rayquaza_act_01_53 = 0xba0049, + ef_ptc_rayquaza_act_01_54 = 0xba004a, + ef_ptc_rayquaza_act_01_55 = 0xba004b, + ef_ptc_rayquaza_act_01_56 = 0xba004c, + ef_ptc_rayquaza_act_01_57 = 0xba004d, + ef_ptc_rayquaza_act_01_58 = 0xba004e, + ef_ptc_rayquaza_act_01_59 = 0xba004f, + ef_ptc_rayquaza_act_01_60 = 0xba0050, + ef_ptc_rayquaza_act_01_61 = 0xba0051, + ef_ptc_rayquaza_act_01_62 = 0xba0052, + ef_ptc_rayquaza_act_01_63 = 0xba0053, + ef_ptc_rayquaza_act_01_64 = 0xba0054, + ef_ptc_rayquaza_act_01_65 = 0xba0055, + ef_ptc_rayquaza_act_01_66 = 0xba0056, + ef_ptc_rayquaza_act_01_67 = 0xba0057, + ef_ptc_rayquaza_act_01_68 = 0xba0058, + ef_ptc_rayquaza_act_01_69 = 0xba0059, + ef_ptc_rayquaza_act_01_70 = 0xba005a, + ef_ptc_rayquaza_act_01_71 = 0xba005b, + ef_ptc_rayquaza_act_01_72 = 0xba005c, + ef_ptc_rayquaza_act_01_73 = 0xba005d, + ef_ptc_rayquaza_act_01_74 = 0xba005e, + ef_ptc_rayquaza_act_01_75 = 0xba005f, + ef_ptc_rayquaza_act_01_76 = 0xba0060, + ef_ptc_rayquaza_act_01_77 = 0xba0061, + ef_ptc_rayquaza_act_01_78 = 0xba0062, + ef_ptc_rayquaza_act_01_79 = 0xba0063, + ef_ptc_rayquaza_act_01_80 = 0xba0064, + ef_ptc_porky_wait_smoke_01 = 0xbc0001, + ef_ptc_porky_boost_smoke_01 = 0xbc0002, + ef_ptc_porky_heat_smoke = 0xbc0003, + ef_ptc_porky_jyouchu_bed = 0xbc0004, + ef_ptc_porky_jyouchu_lamp = 0xbc0005, + ef_ptc_porky_jyouchu_pipe = 0xbc0006, + ef_ptc_porky_jyouchu_safety = 0xbc0007, + ef_ptc_porky_jyouchu_capsule = 0xbc0008, + ef_ptc_porky_dig_s = 0xbc0009, + ef_ptc_porky_dig_m = 0xbc000a, + ef_ptc_porky_dig_l = 0xbc000b, + ef_ptc_porky_hotaru = 0xbc000c, + ef_ptc_porky_sky_thunder = 0xbc000d, + ef_ptc_porky_dead_smoke = 0xbc000e, + ef_ptc_porky_dead_thunder_part = 0xbc000f, + ef_ptc_porky_dead_thunder_all = 0xbc0010, + ef_ptc_porky_spark = 0xbc0011, + ef_ptc_porky_stab = 0xbc0012, + ef_ptc_porky_bomb_a = 0xbc0013, + ef_ptc_porky_bomb_b = 0xbc0014, + ef_ptc_porky_robo_bomb = 0xbc0015, + ef_ptc_porky_robo_light = 0xbc0016, + ef_ptc_porky_robo_ase = 0xbc0017, + ef_ptc_porky_robo_run_smoke = 0xbc0018, + ef_ptc_porky_spark_lightning = 0xbc0019, + ef_ptc_porky_spark_light_yuka = 0xbc001a, + ef_ptc_porky_spark_light_hand = 0xbc001b, + ef_ptc_porky_spark_head = 0xbc001c, + ef_ptc_porky_spark_light_loop = 0xbc001d, + ef_ptc_porky_sky_thunder_02 = 0xbc0020, + ef_ptc_porky_jyouchu_safety02 = 0xbc0021, + ef_ptc_porky_act_01 = 0xbc0022, + ef_ptc_porky_act_01_2 = 0xbc0023, + ef_ptc_porky_act_01_3 = 0xbc0024, + ef_ptc_porky_act_01_4 = 0xbc0025, + ef_ptc_porky_act_01_5 = 0xbc0026, + ef_ptc_porky_act_01_6 = 0xbc0027, + ef_ptc_porky_act_01_7 = 0xbc0028, + ef_ptc_porky_act_01_8 = 0xbc0029, + ef_ptc_porky_act_01_9 = 0xbc002a, + ef_ptc_porky_act_01_10 = 0xbc002b, + ef_ptc_porky_act_01_11 = 0xbc002c, + ef_ptc_porky_act_01_12 = 0xbc002d, + ef_ptc_porky_act_01_13 = 0xbc002e, + ef_ptc_porky_act_01_14 = 0xbc002f, + ef_ptc_porky_act_01_15 = 0xbc0030, + ef_ptc_porky_act_01_16 = 0xbc0031, + ef_ptc_porky_act_01_17 = 0xbc0032, + ef_ptc_porky_act_01_18 = 0xbc0033, + ef_ptc_porky_act_01_19 = 0xbc0034, + ef_ptc_porky_act_01_20 = 0xbc0035, + ef_ptc_porky_act_01_21 = 0xbc0036, + ef_ptc_porky_act_01_22 = 0xbc0037, + ef_ptc_porky_act_01_23 = 0xbc0038, + ef_ptc_porky_act_01_24 = 0xbc0039, + ef_ptc_porky_act_01_25 = 0xbc003a, + ef_ptc_porky_act_01_26 = 0xbc003b, + ef_ptc_porky_act_01_27 = 0xbc003c, + ef_ptc_porky_act_01_28 = 0xbc003d, + ef_ptc_porky_act_01_29 = 0xbc003e, + ef_ptc_porky_act_01_30 = 0xbc003f, + ef_ptc_porky_act_01_31 = 0xbc0040, + ef_ptc_porky_act_01_32 = 0xbc0041, + ef_ptc_porky_act_01_33 = 0xbc0042, + ef_ptc_porky_act_01_34 = 0xbc0043, + ef_ptc_porky_act_01_35 = 0xbc0044, + ef_ptc_porky_act_01_36 = 0xbc0045, + ef_ptc_porky_act_01_37 = 0xbc0046, + ef_ptc_porky_act_01_38 = 0xbc0047, + ef_ptc_porky_act_01_39 = 0xbc0048, + ef_ptc_porky_act_01_40 = 0xbc0049, + ef_ptc_porky_act_01_41 = 0xbc004a, + ef_ptc_porky_act_01_42 = 0xbc004b, + ef_ptc_porky_act_01_43 = 0xbc004c, + ef_ptc_porky_act_01_44 = 0xbc004d, + ef_ptc_porky_act_01_45 = 0xbc004e, + ef_ptc_porky_act_01_46 = 0xbc004f, + ef_ptc_porky_act_01_47 = 0xbc0050, + ef_ptc_porky_act_01_48 = 0xbc0051, + ef_ptc_porky_act_01_49 = 0xbc0052, + ef_ptc_porky_act_01_50 = 0xbc0053, + ef_ptc_porky_act_01_51 = 0xbc0054, + ef_ptc_porky_act_01_52 = 0xbc0055, + ef_ptc_porky_act_01_53 = 0xbc0056, + ef_ptc_porky_act_01_54 = 0xbc0057, + ef_ptc_porky_act_01_55 = 0xbc0058, + ef_ptc_porky_act_01_56 = 0xbc0059, + ef_ptc_porky_act_01_57 = 0xbc005a, + ef_ptc_porky_act_01_58 = 0xbc005b, + ef_ptc_porky_act_01_59 = 0xbc005c, + ef_ptc_porky_act_01_60 = 0xbc005d, + ef_ptc_porky_act_01_61 = 0xbc005e, + ef_ptc_porky_act_01_62 = 0xbc005f, + ef_ptc_porky_act_01_63 = 0xbc0060, + ef_ptc_porky_act_01_64 = 0xbc0061, + ef_ptc_porky_act_01_65 = 0xbc0062, + ef_ptc_porky_act_01_66 = 0xbc0063, + ef_ptc_porky_act_01_67 = 0xbc0064, + ef_ptc_galleom_smoke_s = 0xbd0001, + ef_ptc_galleom_smoke_m = 0xbd0002, + ef_ptc_galleom_smoke_l = 0xbd0003, + ef_ptc_galleom_arm_attack = 0xbd0004, + ef_ptc_galleom_arm_attack_s = 0xbd0005, + ef_ptc_galleom_wait_smoke_01 = 0xbd0006, + ef_ptc_galleom_wait_smoke_02 = 0xbd0007, + ef_ptc_galleom_wait_smoke_03 = 0xbd0008, + ef_ptc_galleom_boost_smoke_01 = 0xbd0009, + ef_ptc_galleom_boost_smoke_02 = 0xbd000a, + ef_ptc_galleom_boost_smoke_03 = 0xbd000b, + ef_ptc_galleom_cool_down = 0xbd000c, + ef_ptc_galleom_cool_down_s = 0xbd000d, + ef_ptc_galleom_hibana = 0xbd000e, + ef_ptc_galleom_hibana_s = 0xbd000f, + ef_ptc_galleom_muzzle_flash = 0xbd0010, + ef_ptc_galleom_muzzle_smoke = 0xbd0011, + ef_ptc_galleom_break_tunder = 0xbd0012, + ef_ptc_galleom_kakera_up = 0xbd0013, + ef_ptc_galleom_kazekiri = 0xbd0014, + ef_ptc_galleom_miss_smoke = 0xbd0015, + ef_ptc_galleom_miss_light = 0xbd0016, + ef_ptc_galleom_arm_attack_loop = 0xbd0017, + ef_ptc_galleom_act_01 = 0xbd0018, + ef_ptc_galleom_act_01_2 = 0xbd0019, + ef_ptc_galleom_act_01_3 = 0xbd001a, + ef_ptc_galleom_act_01_4 = 0xbd001b, + ef_ptc_galleom_act_01_5 = 0xbd001c, + ef_ptc_galleom_act_01_6 = 0xbd001d, + ef_ptc_galleom_act_01_7 = 0xbd0024, + ef_ptc_galleom_act_01_8 = 0xbd0025, + ef_ptc_galleom_act_01_9 = 0xbd0026, + ef_ptc_galleom_act_01_10 = 0xbd0027, + ef_ptc_galleom_act_01_11 = 0xbd0028, + ef_ptc_galleom_act_01_12 = 0xbd0029, + ef_ptc_galleom_act_01_13 = 0xbd002a, + ef_ptc_galleom_act_01_14 = 0xbd002b, + ef_ptc_galleom_act_01_15 = 0xbd002c, + ef_ptc_galleom_act_01_16 = 0xbd002d, + ef_ptc_galleom_act_01_17 = 0xbd002e, + ef_ptc_galleom_act_01_18 = 0xbd002f, + ef_ptc_galleom_act_01_19 = 0xbd0030, + ef_ptc_galleom_act_01_20 = 0xbd0031, + ef_ptc_galleom_act_01_21 = 0xbd0032, + ef_ptc_galleom_act_01_22 = 0xbd0033, + ef_ptc_galleom_act_01_23 = 0xbd0034, + ef_ptc_galleom_act_01_24 = 0xbd0035, + ef_ptc_galleom_act_01_25 = 0xbd0036, + ef_ptc_galleom_act_01_26 = 0xbd0037, + ef_ptc_galleom_act_01_27 = 0xbd0038, + ef_ptc_galleom_act_01_28 = 0xbd0039, + ef_ptc_galleom_act_01_29 = 0xbd003a, + ef_ptc_galleom_act_01_30 = 0xbd003b, + ef_ptc_galleom_act_01_31 = 0xbd003c, + ef_ptc_galleom_act_01_32 = 0xbd003d, + ef_ptc_galleom_act_01_33 = 0xbd003e, + ef_ptc_galleom_act_01_34 = 0xbd003f, + ef_ptc_galleom_act_01_35 = 0xbd0040, + ef_ptc_galleom_act_01_36 = 0xbd0041, + ef_ptc_galleom_act_01_37 = 0xbd0042, + ef_ptc_galleom_act_01_38 = 0xbd0043, + ef_ptc_galleom_act_01_39 = 0xbd0044, + ef_ptc_galleom_act_01_40 = 0xbd0045, + ef_ptc_galleom_act_01_41 = 0xbd0046, + ef_ptc_galleom_act_01_42 = 0xbd0047, + ef_ptc_galleom_act_01_43 = 0xbd0048, + ef_ptc_galleom_act_01_44 = 0xbd0049, + ef_ptc_galleom_act_01_45 = 0xbd004a, + ef_ptc_galleom_act_01_46 = 0xbd004b, + ef_ptc_galleom_act_01_47 = 0xbd004c, + ef_ptc_galleom_act_01_48 = 0xbd004d, + ef_ptc_galleom_act_01_49 = 0xbd004e, + ef_ptc_galleom_act_01_50 = 0xbd004f, + ef_ptc_galleom_act_01_51 = 0xbd0050, + ef_ptc_galleom_act_01_52 = 0xbd0051, + ef_ptc_galleom_act_01_53 = 0xbd0052, + ef_ptc_galleom_act_01_54 = 0xbd0053, + ef_ptc_galleom_act_01_55 = 0xbd0054, + ef_ptc_galleom_act_01_56 = 0xbd0055, + ef_ptc_galleom_act_01_57 = 0xbd0056, + ef_ptc_galleom_act_01_58 = 0xbd0057, + ef_ptc_galleom_act_01_59 = 0xbd0058, + ef_ptc_galleom_act_01_60 = 0xbd0059, + ef_ptc_galleom_act_01_61 = 0xbd005a, + ef_ptc_galleom_act_01_62 = 0xbd005b, + ef_ptc_galleom_act_01_63 = 0xbd005c, + ef_ptc_galleom_act_01_64 = 0xbd005d, + ef_ptc_galleom_act_01_65 = 0xbd005e, + ef_ptc_galleom_act_01_66 = 0xbd005f, + ef_ptc_galleom_act_01_67 = 0xbd0060, + ef_ptc_galleom_act_01_68 = 0xbd0061, + ef_ptc_galleom_act_01_69 = 0xbd0062, + ef_ptc_galleom_act_01_70 = 0xbd0063, + ef_ptc_galleom_act_01_71 = 0xbd0064, + ef_ptc_ridley_tailattacklong_1 = 0xbe0001, + ef_ptc_ridley_tailattacklong_2 = 0xbe0002, + ef_ptc_ridley_effect = 0xbe0003, + ef_ptc_ridley_effect_2 = 0xbe0004, + ef_ptc_ridley_effect_3 = 0xbe0005, + ef_ptc_ridley_effect_4 = 0xbe0006, + ef_ptc_ridley_effect_5 = 0xbe0007, + ef_ptc_ridley_effect_6 = 0xbe0008, + ef_ptc_ridley_effect_7 = 0xbe0009, + ef_ptc_ridley_tailattackshort_1 = 0xbe000a, + ef_ptc_ridley_tailattackshort_2 = 0xbe000b, + ef_ptc_ridley_effect_8 = 0xbe000c, + ef_ptc_ridley_effect_9 = 0xbe000d, + ef_ptc_ridley_effect_10 = 0xbe000e, + ef_ptc_ridley_effect_11 = 0xbe000f, + ef_ptc_ridley_effect_12 = 0xbe0010, + ef_ptc_ridley_effect_13 = 0xbe0011, + ef_ptc_ridley_effect_14 = 0xbe0012, + ef_ptc_ridley_effect_15 = 0xbe0013, + ef_ptc_ridley_tyakuti_01 = 0xbe0014, + ef_ptc_ridley_jumpup = 0xbe0015, + ef_ptc_ridley_jumpup_2 = 0xbe0016, + ef_ptc_ridley_tyakuti_02 = 0xbe0018, + ef_ptc_ridley_tyakuti_02_kakera = 0xbe0019, + ef_ptc_ridley_effect_16 = 0xbe001a, + ef_ptc_ridley_effect_17 = 0xbe001b, + ef_ptc_ridley_effect_18 = 0xbe001c, + ef_ptc_ridley_effect_19 = 0xbe001d, + ef_ptc_ridley_faction_01 = 0xbe001e, + ef_ptc_ridley_effect_20 = 0xbe001f, + ef_ptc_ridley_effect_21 = 0xbe0020, + ef_ptc_ridley_effect_22 = 0xbe0021, + ef_ptc_ridley_effect_23 = 0xbe0022, + ef_ptc_ridley_effect_24 = 0xbe0023, + ef_ptc_ridley_effect_25 = 0xbe0024, + ef_ptc_ridley_effect_26 = 0xbe0025, + ef_ptc_ridley_effect_27 = 0xbe0026, + ef_ptc_ridley_effect_28 = 0xbe0027, + ef_ptc_ridley_forwardattack_1 = 0xbe0028, + ef_ptc_ridley_effect_29 = 0xbe0029, + ef_ptc_ridley_effect_30 = 0xbe002a, + ef_ptc_ridley_effect_31 = 0xbe002b, + ef_ptc_ridley_effect_32 = 0xbe002c, + ef_ptc_ridley_effect_33 = 0xbe002d, + ef_ptc_ridley_effect_34 = 0xbe002e, + ef_ptc_ridley_effect_35 = 0xbe002f, + ef_ptc_ridley_effect_36 = 0xbe0030, + ef_ptc_ridley_effect_37 = 0xbe0031, + ef_ptc_ridley_rushattackwind_01 = 0xbe0032, + ef_ptc_ridley_rushattackwind_02 = 0xbe0033, + ef_ptc_ridley_rushattackkazeline = 0xbe0034, + ef_ptc_ridley_rushattackjimenkml = 0xbe0035, + ef_ptc_ridley_rushattack_01flash = 0xbe0036, + ef_ptc_ridley_rushattack_01karada = 0xbe0037, + ef_ptc_ridley_rushattack_01hane = 0xbe0038, + ef_ptc_ridley_rushattack_01hinokokarada = 0xbe0039, + ef_ptc_ridley_rushattack_01hinokohane = 0xbe003a, + ef_ptc_ridley_effect_38 = 0xbe003b, + ef_ptc_ridley_dive_1 = 0xbe003c, + ef_ptc_ridley_dive_2 = 0xbe003d, + ef_ptc_ridley_divekaze = 0xbe003e, + ef_ptc_ridley_effect_39 = 0xbe003f, + ef_ptc_ridley_effect_40 = 0xbe0040, + ef_ptc_ridley_effect_41 = 0xbe0041, + ef_ptc_ridley_effect_42 = 0xbe0042, + ef_ptc_ridley_effect_43 = 0xbe0043, + ef_ptc_ridley_effect_44 = 0xbe0044, + ef_ptc_ridley_effect_45 = 0xbe0045, + ef_ptc_ridley_waving_1 = 0xbe0046, + ef_ptc_ridley_waving_2 = 0xbe0047, + ef_ptc_ridley_wavingkaze = 0xbe0048, + ef_ptc_ridley_effect_46 = 0xbe0049, + ef_ptc_ridley_effect_47 = 0xbe004a, + ef_ptc_ridley_effect_48 = 0xbe004b, + ef_ptc_ridley_effect_49 = 0xbe004c, + ef_ptc_ridley_effect_50 = 0xbe004d, + ef_ptc_ridley_effect_51 = 0xbe004e, + ef_ptc_ridley_effect_52 = 0xbe004f, + ef_ptc_ridley_fallkaze = 0xbe0050, + ef_ptc_ridley_effect_53 = 0xbe0051, + ef_ptc_ridley_effect_54 = 0xbe0052, + ef_ptc_ridley_effect_55 = 0xbe0053, + ef_ptc_ridley_effect_56 = 0xbe0054, + ef_ptc_ridley_effect_57 = 0xbe0055, + ef_ptc_ridley_effect_58 = 0xbe0056, + ef_ptc_ridley_effect_59 = 0xbe0057, + ef_ptc_ridley_effect_60 = 0xbe0058, + ef_ptc_ridley_effect_61 = 0xbe0059, + ef_ptc_ridley_effect_62 = 0xbe005a, + ef_ptc_ridley_effect_63 = 0xbe005b, + ef_ptc_ridley_effect_64 = 0xbe005c, + ef_ptc_ridley_effect_65 = 0xbe005d, + ef_ptc_ridley_effect_66 = 0xbe005e, + ef_ptc_ridley_effect_67 = 0xbe005f, + ef_ptc_ridley_effect_68 = 0xbe0060, + ef_ptc_ridley_effect_69 = 0xbe0061, + ef_ptc_ridley_effect_70 = 0xbe0062, + ef_ptc_ridley_effect_71 = 0xbe0063, + ef_ptc_ridley_downfire_1 = 0xbe0064, + ef_ptc_ridley_downfire_1r = 0xbe0065, + ef_ptc_ridley_downfire_1l = 0xbe0066, + ef_ptc_ridley_downfire_1tail = 0xbe0067, + ef_ptc_ridley_downsmoke_1 = 0xbe0068, + ef_ptc_ridley_downflash = 0xbe0069, + ef_ptc_ridley_effect_72 = 0xbe006a, + ef_ptc_ridley_effect_73 = 0xbe006b, + ef_ptc_ridley_effect_74 = 0xbe006c, + ef_ptc_ridley_effect_75 = 0xbe006d, + ef_ptc_ridley_effect_76 = 0xbe006e, + ef_ptc_ridley_effect_77 = 0xbe006f, + ef_ptc_ridley_effect_78 = 0xbe0070, + ef_ptc_ridley_effect_79 = 0xbe0071, + ef_ptc_ridley_effect_80 = 0xbe0072, + ef_ptc_ridley_effect_81 = 0xbe0073, + ef_ptc_ridley_effect_82 = 0xbe0074, + ef_ptc_ridley_effect_83 = 0xbe0075, + ef_ptc_ridley_effect_84 = 0xbe0076, + ef_ptc_ridley_effect_85 = 0xbe0077, + ef_ptc_ridley_effect_86 = 0xbe0078, + ef_ptc_ridley_effect_87 = 0xbe0079, + ef_ptc_ridley_effect_88 = 0xbe007a, + ef_ptc_ridley_effect_89 = 0xbe007b, + ef_ptc_ridley_effect_90 = 0xbe007c, + ef_ptc_ridley_effect_91 = 0xbe007d, + ef_ptc_ridley_effect_92 = 0xbe007e, + ef_ptc_ridley_effect_93 = 0xbe007f, + ef_ptc_ridley_effect_94 = 0xbe0080, + ef_ptc_ridley_effect_95 = 0xbe0081, + ef_ptc_ridley_houkou = 0xbe0082, + ef_ptc_ridley_effect_96 = 0xbe0083, + ef_ptc_ridley_effect_97 = 0xbe0084, + ef_ptc_ridley_effect_98 = 0xbe0085, + ef_ptc_ridley_effect_99 = 0xbe0086, + ef_ptc_ridley_effect_100 = 0xbe0087, + ef_ptc_ridley_effect_101 = 0xbe0088, + ef_ptc_ridley_effect_102 = 0xbe0089, + ef_ptc_ridley_effect_103 = 0xbe008a, + ef_ptc_ridley_effect_104 = 0xbe008b, + ef_ptc_ridley_effect_105 = 0xbe008c, + ef_ptc_ridley_effect_106 = 0xbe008d, + ef_ptc_ridley_effect_107 = 0xbe008e, + ef_ptc_ridley_effect_108 = 0xbe008f, + ef_ptc_ridley_effect_109 = 0xbe0090, + ef_ptc_ridley_effect_110 = 0xbe0091, + ef_ptc_ridley_effect_111 = 0xbe0092, + ef_ptc_ridley_effect_112 = 0xbe0093, + ef_ptc_ridley_effect_113 = 0xbe0094, + ef_ptc_ridley_effect_114 = 0xbe0095, + ef_ptc_duon_jumploop = 0xbf0001, + ef_ptc_duon_jumpup = 0xbf0002, + ef_ptc_duon_jumpup_2 = 0xbf0003, + ef_ptc_duon_tyakuti_01 = 0xbf0004, + ef_ptc_duon_effect = 0xbf0005, + ef_ptc_duon_effect_2 = 0xbf0006, + ef_ptc_duon_effect_3 = 0xbf0007, + ef_ptc_duon_effect_4 = 0xbf0008, + ef_ptc_duon_effect_5 = 0xbf0009, + ef_ptc_duon_spin_attack_1 = 0xbf000a, + ef_ptc_duon_spin_attack_2 = 0xbf000b, + ef_ptc_duon_effect_6 = 0xbf000d, + ef_ptc_duon_effect_7 = 0xbf000e, + ef_ptc_duon_effect_8 = 0xbf000f, + ef_ptc_duon_effect_9 = 0xbf0010, + ef_ptc_duon_effect_10 = 0xbf0011, + ef_ptc_duon_effect_11 = 0xbf0012, + ef_ptc_duon_effect_12 = 0xbf0013, + ef_ptc_duon_sword_bow_1 = 0xbf0014, + ef_ptc_duon_sword_bow_1_kazekiri = 0xbf0015, + ef_ptc_duon_effect_13 = 0xbf0016, + ef_ptc_duon_effect_14 = 0xbf0017, + ef_ptc_duon_effect_15 = 0xbf0018, + ef_ptc_duon_effect_16 = 0xbf0019, + ef_ptc_duon_effect_17 = 0xbf001a, + ef_ptc_duon_effect_18 = 0xbf001b, + ef_ptc_duon_effect_19 = 0xbf001c, + ef_ptc_duon_effect_20 = 0xbf001d, + ef_ptc_duon_sword_attack_1 = 0xbf001e, + ef_ptc_duon_effect_21 = 0xbf0021, + ef_ptc_duon_effect_22 = 0xbf0022, + ef_ptc_duon_effect_23 = 0xbf0023, + ef_ptc_duon_effect_24 = 0xbf0024, + ef_ptc_duon_effect_25 = 0xbf0025, + ef_ptc_duon_effect_26 = 0xbf0026, + ef_ptc_duon_effect_27 = 0xbf0027, + ef_ptc_duon_sword_triple_attack_1 = 0xbf0028, + ef_ptc_duon_effect_28 = 0xbf002a, + ef_ptc_duon_effect_29 = 0xbf002b, + ef_ptc_duon_effect_30 = 0xbf002c, + ef_ptc_duon_effect_31 = 0xbf002d, + ef_ptc_duon_effect_32 = 0xbf002e, + ef_ptc_duon_effect_33 = 0xbf002f, + ef_ptc_duon_effect_34 = 0xbf0030, + ef_ptc_duon_effect_35 = 0xbf0031, + ef_ptc_duon_gun_laser_0 = 0xbf0032, + ef_ptc_duon_gun_laser_1 = 0xbf0033, + ef_ptc_duon_effect_36 = 0xbf0034, + ef_ptc_duon_effect_37 = 0xbf0035, + ef_ptc_duon_effect_38 = 0xbf0036, + ef_ptc_duon_effect_39 = 0xbf0037, + ef_ptc_duon_effect_40 = 0xbf0038, + ef_ptc_duon_effect_41 = 0xbf0039, + ef_ptc_duon_effect_42 = 0xbf003a, + ef_ptc_duon_effect_43 = 0xbf003b, + ef_ptc_duon_mazlfrash_1 = 0xbf003c, + ef_ptc_duon_mazlfrash_1_kml = 0xbf003d, + ef_ptc_duon_effect_44 = 0xbf003e, + ef_ptc_duon_effect_45 = 0xbf003f, + ef_ptc_duon_effect_46 = 0xbf0040, + ef_ptc_duon_effect_47 = 0xbf0041, + ef_ptc_duon_effect_48 = 0xbf0042, + ef_ptc_duon_effect_49 = 0xbf0043, + ef_ptc_duon_effect_50 = 0xbf0044, + ef_ptc_duon_effect_51 = 0xbf0045, + ef_ptc_duon_gun_homing = 0xbf0046, + ef_ptc_duon_effect_52 = 0xbf0047, + ef_ptc_duon_effect_53 = 0xbf0048, + ef_ptc_duon_effect_54 = 0xbf0049, + ef_ptc_duon_effect_55 = 0xbf004a, + ef_ptc_duon_effect_56 = 0xbf004b, + ef_ptc_duon_effect_57 = 0xbf004c, + ef_ptc_duon_effect_58 = 0xbf004d, + ef_ptc_duon_effect_59 = 0xbf004e, + ef_ptc_duon_effect_60 = 0xbf004f, + ef_ptc_duon_kagemushi_1 = 0xbf0050, + ef_ptc_duon_kagemushi_2 = 0xbf0051, + ef_ptc_duon_effect_61 = 0xbf0052, + ef_ptc_duon_effect_62 = 0xbf0053, + ef_ptc_duon_effect_63 = 0xbf0054, + ef_ptc_duon_effect_64 = 0xbf0055, + ef_ptc_duon_effect_65 = 0xbf0056, + ef_ptc_duon_effect_66 = 0xbf0057, + ef_ptc_duon_effect_67 = 0xbf0058, + ef_ptc_duon_effect_68 = 0xbf0059, + ef_ptc_duon_wpn_missile = 0xbf005a, + ef_ptc_duon_effect_69 = 0xbf005b, + ef_ptc_duon_effect_70 = 0xbf005c, + ef_ptc_duon_effect_71 = 0xbf005d, + ef_ptc_duon_effect_72 = 0xbf005e, + ef_ptc_duon_wpn_beam = 0xbf005f, + ef_ptc_duon_effect_73 = 0xbf0060, + ef_ptc_duon_effect_74 = 0xbf0061, + ef_ptc_duon_effect_75 = 0xbf0062, + ef_ptc_duon_effect_76 = 0xbf0063, + ef_ptc_duon_wpn_bomb_1 = 0xbf0065, + ef_ptc_duon_sword_rush_1 = 0xbf006e, + ef_ptc_duon_gun_rush_1 = 0xbf006f, + ef_ptc_duon_tyakuti_01_2 = 0xbf0096, + ef_ptc_duon_tyakuti_01_te1 = 0xbf0097, + ef_ptc_duon_spin_1 = 0xbf00dc, + ef_ptc_duon_spin_2 = 0xbf00dd, + ef_ptc_duon_effect_77 = 0xbf00de, + ef_ptc_duon_effect_78 = 0xbf00df, + ef_ptc_duon_effect_79 = 0xbf00e0, + ef_ptc_duon_effect_80 = 0xbf00e1, + ef_ptc_duon_effect_81 = 0xbf00e2, + ef_ptc_duon_effect_82 = 0xbf00e3, + ef_ptc_duon_effect_83 = 0xbf00e4, + ef_ptc_duon_effect_84 = 0xbf00e5, + ef_ptc_duon_effect_85 = 0xbf00e6, + ef_ptc_duon_effect_86 = 0xbf00e7, + ef_ptc_duon_effect_87 = 0xbf00e8, + ef_ptc_duon_effect_88 = 0xbf00e9, + ef_ptc_duon_effect_89 = 0xbf00ea, + ef_ptc_duon_effect_90 = 0xbf00eb, + ef_ptc_duon_effect_91 = 0xbf00ec, + ef_ptc_duon_effect_92 = 0xbf00ed, + ef_ptc_duon_effect_93 = 0xbf00ee, + ef_ptc_duon_effect_94 = 0xbf00ef, + ef_ptc_duon_effect_95 = 0xbf00f0, + ef_ptc_duon_effect_96 = 0xbf00f1, + ef_ptc_duon_effect_97 = 0xbf00f2, + ef_ptc_duon_effect_98 = 0xbf00f3, + ef_ptc_duon_effect_99 = 0xbf00f4, + ef_ptc_duon_effect_100 = 0xbf00f5, + ef_ptc_duon_effect_101 = 0xbf00f6, + ef_ptc_duon_effect_102 = 0xbf00f7, + ef_ptc_duon_effect_103 = 0xbf00f8, + ef_ptc_duon_effect_104 = 0xbf00f9, + ef_ptc_duon_effect_105 = 0xbf00fa, + ef_ptc_metaridley_wait_2 = 0xc00001, + ef_ptc_metaridley_effect = 0xc00002, + ef_ptc_metaridley_effect_2 = 0xc00003, + ef_ptc_metaridley_effect_3 = 0xc00004, + ef_ptc_metaridley_effect_4 = 0xc00005, + ef_ptc_metaridley_effect_5 = 0xc00006, + ef_ptc_metaridley_effect_6 = 0xc00007, + ef_ptc_metaridley_effect_7 = 0xc00008, + ef_ptc_metaridley_effect_8 = 0xc00009, + ef_ptc_metaridley_fallkaze = 0xc0000a, + ef_ptc_metaridley_tyakuti_01 = 0xc0000b, + ef_ptc_metaridley_jumpup = 0xc0000c, + ef_ptc_metaridley_jumpup_2 = 0xc0000d, + ef_ptc_metaridley_effect_9 = 0xc0000f, + ef_ptc_metaridley_effect_10 = 0xc00010, + ef_ptc_metaridley_effect_11 = 0xc00011, + ef_ptc_metaridley_effect_12 = 0xc00012, + ef_ptc_metaridley_effect_13 = 0xc00013, + ef_ptc_metaridley_rushattack_1a = 0xc00014, + ef_ptc_metaridley_rushattack_1b = 0xc00015, + ef_ptc_metaridley_effect_14 = 0xc00016, + ef_ptc_metaridley_effect_15 = 0xc00017, + ef_ptc_metaridley_effect_16 = 0xc00018, + ef_ptc_metaridley_effect_17 = 0xc00019, + ef_ptc_metaridley_effect_18 = 0xc0001a, + ef_ptc_metaridley_effect_19 = 0xc0001b, + ef_ptc_metaridley_effect_20 = 0xc0001c, + ef_ptc_metaridley_effect_21 = 0xc0001d, + ef_ptc_metaridley_slapattack_1a = 0xc0001e, + ef_ptc_metaridley_slapattack_1b = 0xc0001f, + ef_ptc_metaridley_slapattackhit = 0xc00020, + ef_ptc_metaridley_effect_22 = 0xc00021, + ef_ptc_metaridley_effect_23 = 0xc00022, + ef_ptc_metaridley_effect_24 = 0xc00023, + ef_ptc_metaridley_effect_25 = 0xc00024, + ef_ptc_metaridley_effect_26 = 0xc00025, + ef_ptc_metaridley_effect_27 = 0xc00026, + ef_ptc_metaridley_effect_28 = 0xc00027, + ef_ptc_metaridley_wingslap_attack_1a = 0xc00028, + ef_ptc_metaridley_wingslap_attack_1b = 0xc00029, + ef_ptc_metaridley_effect_29 = 0xc0002a, + ef_ptc_metaridley_effect_30 = 0xc0002b, + ef_ptc_metaridley_effect_31 = 0xc0002c, + ef_ptc_metaridley_effect_32 = 0xc0002d, + ef_ptc_metaridley_effect_33 = 0xc0002e, + ef_ptc_metaridley_effect_34 = 0xc0002f, + ef_ptc_metaridley_effect_35 = 0xc00030, + ef_ptc_metaridley_effect_36 = 0xc00031, + ef_ptc_metaridley_wpnfireball_01 = 0xc00032, + ef_ptc_metaridley_wpnfireball_01_bom1_s = 0xc00033, + ef_ptc_metaridley_wpnfireball_01_tyakudan1 = 0xc00034, + ef_ptc_metaridley_wpnfireball_01_tyakudan2 = 0xc00035, + ef_ptc_metaridley_clings_hibana_1 = 0xc00036, + ef_ptc_metaridley_clings_hibana_1_2 = 0xc00037, + ef_ptc_metaridley_effect_37 = 0xc00038, + ef_ptc_metaridley_effect_38 = 0xc00039, + ef_ptc_metaridley_effect_39 = 0xc0003a, + ef_ptc_metaridley_effect_40 = 0xc0003b, + ef_ptc_metaridley_wpnfireball_00 = 0xc0003c, + ef_ptc_metaridley_wpnfireball_00_bom1 = 0xc0003d, + ef_ptc_metaridley_effect_41 = 0xc0003e, + ef_ptc_metaridley_effect_42 = 0xc0003f, + ef_ptc_metaridley_effect_43 = 0xc00040, + ef_ptc_metaridley_effect_44 = 0xc00041, + ef_ptc_metaridley_effect_45 = 0xc00042, + ef_ptc_metaridley_effect_46 = 0xc00043, + ef_ptc_metaridley_effect_47 = 0xc00044, + ef_ptc_metaridley_effect_48 = 0xc00045, + ef_ptc_metaridley_effect_49 = 0xc00046, + ef_ptc_metaridley_effect_50 = 0xc00047, + ef_ptc_metaridley_effect_51 = 0xc00048, + ef_ptc_metaridley_effect_52 = 0xc00049, + ef_ptc_metaridley_effect_53 = 0xc0004a, + ef_ptc_metaridley_effect_54 = 0xc0004b, + ef_ptc_metaridley_effect_55 = 0xc0004c, + ef_ptc_metaridley_effect_56 = 0xc0004d, + ef_ptc_metaridley_effect_57 = 0xc0004e, + ef_ptc_metaridley_effect_58 = 0xc0004f, + ef_ptc_metaridley_flameball_start_1 = 0xc00050, + ef_ptc_metaridley_flameball_loop_1 = 0xc00051, + ef_ptc_metaridley_flameball_end_1 = 0xc00052, + ef_ptc_metaridley_flameball_end_2 = 0xc00053, + ef_ptc_metaridley_effect_59 = 0xc00054, + ef_ptc_metaridley_effect_60 = 0xc00055, + ef_ptc_metaridley_effect_61 = 0xc00056, + ef_ptc_metaridley_effect_62 = 0xc00057, + ef_ptc_metaridley_effect_63 = 0xc00058, + ef_ptc_metaridley_effect_64 = 0xc00059, + ef_ptc_metaridley_clings_loop_1 = 0xc0005a, + ef_ptc_metaridley_clings_loop_2 = 0xc0005b, + ef_ptc_metaridley_effect_65 = 0xc0005c, + ef_ptc_metaridley_effect_66 = 0xc0005d, + ef_ptc_metaridley_effect_67 = 0xc0005e, + ef_ptc_metaridley_effect_68 = 0xc0005f, + ef_ptc_metaridley_effect_69 = 0xc00060, + ef_ptc_metaridley_effect_70 = 0xc00061, + ef_ptc_metaridley_effect_71 = 0xc00062, + ef_ptc_metaridley_effect_72 = 0xc00063, + ef_ptc_metaridley_effect_73 = 0xc00064, + ef_ptc_metaridley_effect_74 = 0xc00065, + ef_ptc_metaridley_effect_75 = 0xc00066, + ef_ptc_metaridley_effect_76 = 0xc00067, + ef_ptc_metaridley_effect_77 = 0xc00068, + ef_ptc_metaridley_effect_78 = 0xc00069, + ef_ptc_metaridley_effect_79 = 0xc0006a, + ef_ptc_metaridley_effect_80 = 0xc0006b, + ef_ptc_metaridley_effect_81 = 0xc0006c, + ef_ptc_metaridley_effect_82 = 0xc0006d, + ef_ptc_metaridley_effect_83 = 0xc0006e, + ef_ptc_metaridley_effect_84 = 0xc0006f, + ef_ptc_metaridley_effect_85 = 0xc00070, + ef_ptc_metaridley_effect_86 = 0xc00071, + ef_ptc_metaridley_effect_87 = 0xc00072, + ef_ptc_metaridley_effect_88 = 0xc00073, + ef_ptc_metaridley_effect_89 = 0xc00074, + ef_ptc_metaridley_effect_90 = 0xc00075, + ef_ptc_metaridley_effect_91 = 0xc00076, + ef_ptc_metaridley_effect_92 = 0xc00077, + ef_ptc_metaridley_effect_93 = 0xc00078, + ef_ptc_metaridley_effect_94 = 0xc00079, + ef_ptc_metaridley_effect_95 = 0xc0007a, + ef_ptc_metaridley_effect_96 = 0xc0007b, + ef_ptc_metaridley_effect_97 = 0xc0007c, + ef_ptc_metaridley_effect_98 = 0xc0007d, + ef_ptc_metaridley_effect_99 = 0xc0007e, + ef_ptc_metaridley_effect_100 = 0xc0007f, + ef_ptc_metaridley_effect_101 = 0xc00080, + ef_ptc_metaridley_effect_102 = 0xc00081, + ef_ptc_metaridley_effect_103 = 0xc00082, + ef_ptc_metaridley_effect_104 = 0xc00083, + ef_ptc_metaridley_effect_105 = 0xc00084, + ef_ptc_metaridley_effect_106 = 0xc00085, + ef_ptc_metaridley_effect_107 = 0xc00086, + ef_ptc_metaridley_effect_108 = 0xc00087, + ef_ptc_metaridley_effect_109 = 0xc00088, + ef_ptc_metaridley_effect_110 = 0xc00089, + ef_ptc_metaridley_effect_111 = 0xc0008a, + ef_ptc_metaridley_effect_112 = 0xc0008b, + ef_ptc_metaridley_effect_113 = 0xc0008c, + ef_ptc_metaridley_effect_114 = 0xc0008d, + ef_ptc_metaridley_effect_115 = 0xc0008e, + ef_ptc_metaridley_effect_116 = 0xc0008f, + ef_ptc_metaridley_effect_117 = 0xc00090, + ef_ptc_metaridley_effect_118 = 0xc00091, + ef_ptc_metaridley_effect_119 = 0xc00092, + ef_ptc_metaridley_effect_120 = 0xc00093, + ef_ptc_metaridley_effect_121 = 0xc00094, + ef_ptc_metaridley_effect_122 = 0xc00095, + ef_ptc_metaridley_effect_123 = 0xc00096, + ef_ptc_metaridley_effect_124 = 0xc00097, + ef_ptc_metaridley_effect_125 = 0xc00098, + ef_ptc_metaridley_effect_126 = 0xc00099, + ef_ptc_metaridley_effect_127 = 0xc0009a, + ef_ptc_metaridley_effect_128 = 0xc0009b, + ef_ptc_metaridley_effect_129 = 0xc0009c, + ef_ptc_metaridley_effect_130 = 0xc0009d, + ef_ptc_metaridley_effect_131 = 0xc0009e, + ef_ptc_metaridley_effect_132 = 0xc0009f, + ef_ptc_metaridley_effect_133 = 0xc000a0, + ef_ptc_metaridley_effect_134 = 0xc000a1, + ef_ptc_metaridley_effect_135 = 0xc000a2, + ef_ptc_metaridley_effect_136 = 0xc000a3, + ef_ptc_metaridley_effect_137 = 0xc000a4, + ef_ptc_metaridley_effect_138 = 0xc000a5, + ef_ptc_metaridley_effect_139 = 0xc000a6, + ef_ptc_metaridley_effect_140 = 0xc000a7, + ef_ptc_metaridley_effect_141 = 0xc000a8, + ef_ptc_metaridley_effect_142 = 0xc000a9, + ef_ptc_metaridley_effect_143 = 0xc000aa, + ef_ptc_metaridley_effect_144 = 0xc000ab, + ef_ptc_metaridley_effect_145 = 0xc000ac, + ef_ptc_metaridley_effect_146 = 0xc000ad, + ef_ptc_metaridley_effect_147 = 0xc000ae, + ef_ptc_metaridley_effect_148 = 0xc000af, + ef_ptc_metaridley_effect_149 = 0xc000b0, + ef_ptc_metaridley_effect_150 = 0xc000b1, + ef_ptc_metaridley_effect_151 = 0xc000b2, + ef_ptc_metaridley_effect_152 = 0xc000b3, + ef_ptc_metaridley_effect_153 = 0xc000b4, + ef_ptc_metaridley_effect_154 = 0xc000b5, + ef_ptc_metaridley_effect_155 = 0xc000b6, + ef_ptc_metaridley_effect_156 = 0xc000b7, + ef_ptc_metaridley_effect_157 = 0xc000b8, + ef_ptc_metaridley_effect_158 = 0xc000b9, + ef_ptc_metaridley_effect_159 = 0xc000ba, + ef_ptc_metaridley_effect_160 = 0xc000bb, + ef_ptc_metaridley_effect_161 = 0xc000bc, + ef_ptc_metaridley_effect_162 = 0xc000bd, + ef_ptc_metaridley_effect_163 = 0xc000be, + ef_ptc_metaridley_effect_164 = 0xc000bf, + ef_ptc_metaridley_effect_165 = 0xc000c0, + ef_ptc_metaridley_effect_166 = 0xc000c1, + ef_ptc_metaridley_effect_167 = 0xc000c2, + ef_ptc_metaridley_effect_168 = 0xc000c3, + ef_ptc_metaridley_effect_169 = 0xc000c4, + ef_ptc_metaridley_effect_170 = 0xc000c5, + ef_ptc_metaridley_effect_171 = 0xc000c6, + ef_ptc_metaridley_effect_172 = 0xc000c7, + ef_ptc_taboo_spilit_attack = 0xc10001, + ef_ptc_taboo_spilit_attack_core = 0xc10002, + ef_ptc_taboo_spilit_attack_slit = 0xc10003, + ef_ptc_taboo_off_wave = 0xc10004, + ef_ptc_taboo_cannon = 0xc10005, + ef_ptc_taboo_machine_gun = 0xc10006, + ef_ptc_taboo_split_bomb = 0xc10007, + ef_ptc_taboo_comet_attack = 0xc10008, + ef_ptc_taboo_bomb = 0xc10009, + ef_ptc_taboo_teleport_bomb = 0xc1000a, + ef_ptc_taboo_chop = 0xc1000b, + ef_ptc_taboo_chain_attack_hibana = 0xc1000c, + ef_ptc_taboo_chain_attack_move = 0xc1000d, + ef_ptc_taboo_spark_s = 0xc1000e, + ef_ptc_taboo_spark_m = 0xc1000f, + ef_ptc_taboo_spark_l = 0xc10010, + ef_ptc_taboo_gigant_beam = 0xc10011, + ef_ptc_taboo_gigant_beam_eye = 0xc10012, + ef_ptc_taboo_dive_wait = 0xc10013, + ef_ptc_taboo_dive_attack = 0xc10014, + ef_ptc_taboo_dead = 0xc10015, + ef_ptc_taboo_spark_body = 0xc10016, + ef_ptc_taboo_machine_gun_ball = 0xc10017, + ef_ptc_taboo_dead_body = 0xc10018, + ef_ptc_taboo_spilit_attack_flip = 0xc10019, + ef_ptc_taboo_line = 0xc1001a, + ef_ptc_taboo_machine_gun_bomb = 0xc1001b, + ef_ptc_taboo = 0xc1001c, + ef_ptc_taboo_2 = 0xc1001d, + ef_ptc_taboo_wait = 0xc1001e, + ef_ptc_taboo_teleport = 0xc1001f, + ef_ptc_taboo_flash = 0xc10020, + ef_ptc_taboo_flash_s = 0xc10021, + ef_ptc_taboo_3 = 0xc10022, + ef_ptc_taboo_4 = 0xc10023, + ef_ptc_taboo_5 = 0xc10024, + ef_ptc_taboo_6 = 0xc10025, + ef_ptc_taboo_7 = 0xc10026, + ef_ptc_taboo_8 = 0xc10027, + ef_ptc_taboo_9 = 0xc10028, + ef_ptc_taboo_10 = 0xc10029, + ef_ptc_taboo_11 = 0xc1002a, + ef_ptc_taboo_12 = 0xc1002b, + ef_ptc_taboo_13 = 0xc1002c, + ef_ptc_taboo_14 = 0xc1002d, + ef_ptc_taboo_15 = 0xc1002e, + ef_ptc_taboo_16 = 0xc1002f, + ef_ptc_taboo_17 = 0xc10030, + ef_ptc_taboo_18 = 0xc10031, + ef_ptc_taboo_19 = 0xc10032, + ef_ptc_taboo_20 = 0xc10033, + ef_ptc_taboo_21 = 0xc10034, + ef_ptc_taboo_22 = 0xc10035, + ef_ptc_taboo_23 = 0xc10036, + ef_ptc_taboo_24 = 0xc10037, + ef_ptc_taboo_25 = 0xc10038, + ef_ptc_taboo_26 = 0xc10039, + ef_ptc_taboo_27 = 0xc1003a, + ef_ptc_taboo_28 = 0xc1003b, + ef_ptc_taboo_29 = 0xc1003c, + ef_ptc_taboo_30 = 0xc1003d, + ef_ptc_taboo_31 = 0xc1003e, + ef_ptc_taboo_32 = 0xc1003f, + ef_ptc_taboo_33 = 0xc10040, + ef_ptc_taboo_34 = 0xc10041, + ef_ptc_taboo_35 = 0xc10042, + ef_ptc_taboo_36 = 0xc10043, + ef_ptc_taboo_37 = 0xc10044, + ef_ptc_taboo_38 = 0xc10045, + ef_ptc_taboo_39 = 0xc10046, + ef_ptc_taboo_40 = 0xc10047, + ef_ptc_taboo_41 = 0xc10048, + ef_ptc_taboo_42 = 0xc10049, + ef_ptc_taboo_43 = 0xc1004a, + ef_ptc_taboo_44 = 0xc1004b, + ef_ptc_taboo_45 = 0xc1004c, + ef_ptc_taboo_46 = 0xc1004d, + ef_ptc_taboo_47 = 0xc1004e, + ef_ptc_taboo_48 = 0xc1004f, + ef_ptc_taboo_49 = 0xc10050, + ef_ptc_taboo_50 = 0xc10051, + ef_ptc_taboo_51 = 0xc10052, + ef_ptc_taboo_52 = 0xc10053, + ef_ptc_taboo_53 = 0xc10054, + ef_ptc_taboo_54 = 0xc10055, + ef_ptc_taboo_55 = 0xc10056, + ef_ptc_taboo_56 = 0xc10057, + ef_ptc_taboo_57 = 0xc10058, + ef_ptc_taboo_58 = 0xc10059, + ef_ptc_taboo_59 = 0xc1005a, + ef_ptc_taboo_60 = 0xc1005b, + ef_ptc_taboo_61 = 0xc1005c, + ef_ptc_taboo_62 = 0xc1005d, + ef_ptc_taboo_63 = 0xc1005e, + ef_ptc_taboo_64 = 0xc1005f, + ef_ptc_taboo_65 = 0xc10060, + ef_ptc_taboo_66 = 0xc10061, + ef_ptc_taboo_67 = 0xc10062, + ef_ptc_taboo_68 = 0xc10063, + ef_ptc_taboo_69 = 0xc10064, + ef_ptc_masterhand_beam_head = 0xc20002, + ef_ptc_masterhand_beam_hit = 0xc20003, + ef_ptc_masterhand_fling_attack = 0xc20004, + ef_ptc_masterhand_nigiru = 0xc20005, + ef_ptc_masterhand_dead = 0xc20006, + ef_ptc_masterhand_gun_charge = 0xc20007, + ef_ptc_masterhand_fling_wakka = 0xc20008, + ef_ptc_masterhand_act_01 = 0xc20009, + ef_ptc_masterhand_act_01_2 = 0xc2000a, + ef_ptc_masterhand_act_01_3 = 0xc2000b, + ef_ptc_masterhand_act_01_4 = 0xc2000c, + ef_ptc_masterhand_act_01_5 = 0xc2000d, + ef_ptc_masterhand_act_01_6 = 0xc2000e, + ef_ptc_masterhand_act_01_7 = 0xc2000f, + ef_ptc_masterhand_act_01_8 = 0xc20010, + ef_ptc_masterhand_act_01_9 = 0xc20011, + ef_ptc_masterhand_act_01_10 = 0xc20012, + ef_ptc_masterhand_act_01_11 = 0xc20013, + ef_ptc_masterhand_act_01_12 = 0xc20014, + ef_ptc_masterhand_act_01_13 = 0xc20015, + ef_ptc_masterhand_act_01_14 = 0xc20016, + ef_ptc_masterhand_act_01_15 = 0xc20017, + ef_ptc_masterhand_act_01_16 = 0xc20018, + ef_ptc_masterhand_act_01_17 = 0xc20019, + ef_ptc_masterhand_act_01_18 = 0xc2001a, + ef_ptc_masterhand_act_01_19 = 0xc2001b, + ef_ptc_masterhand_act_01_20 = 0xc2001c, + ef_ptc_masterhand_act_01_21 = 0xc2001d, + ef_ptc_masterhand_act_01_22 = 0xc2001e, + ef_ptc_masterhand_act_01_23 = 0xc2001f, + ef_ptc_masterhand_act_01_24 = 0xc20020, + ef_ptc_masterhand_act_01_25 = 0xc20021, + ef_ptc_masterhand_act_01_26 = 0xc20022, + ef_ptc_masterhand_act_01_27 = 0xc20023, + ef_ptc_masterhand_act_01_28 = 0xc20024, + ef_ptc_masterhand_act_01_29 = 0xc20025, + ef_ptc_masterhand_act_01_30 = 0xc20026, + ef_ptc_masterhand_act_01_31 = 0xc20027, + ef_ptc_masterhand_act_01_32 = 0xc20028, + ef_ptc_masterhand_act_01_33 = 0xc20029, + ef_ptc_masterhand_act_01_34 = 0xc2002a, + ef_ptc_masterhand_act_01_35 = 0xc2002b, + ef_ptc_masterhand_act_01_36 = 0xc2002c, + ef_ptc_masterhand_act_01_37 = 0xc2002d, + ef_ptc_masterhand_act_01_38 = 0xc2002e, + ef_ptc_masterhand_act_01_39 = 0xc2002f, + ef_ptc_masterhand_act_01_40 = 0xc20030, + ef_ptc_masterhand_act_01_41 = 0xc20031, + ef_ptc_masterhand_act_01_42 = 0xc20032, + ef_ptc_masterhand_act_01_43 = 0xc20033, + ef_ptc_masterhand_act_01_44 = 0xc20034, + ef_ptc_masterhand_act_01_45 = 0xc20035, + ef_ptc_masterhand_act_01_46 = 0xc20036, + ef_ptc_masterhand_act_01_47 = 0xc20037, + ef_ptc_masterhand_act_01_48 = 0xc20038, + ef_ptc_masterhand_act_01_49 = 0xc20039, + ef_ptc_masterhand_act_01_50 = 0xc2003a, + ef_ptc_masterhand_act_01_51 = 0xc2003b, + ef_ptc_masterhand_act_01_52 = 0xc2003c, + ef_ptc_masterhand_act_01_53 = 0xc2003d, + ef_ptc_masterhand_act_01_54 = 0xc2003e, + ef_ptc_masterhand_act_01_55 = 0xc2003f, + ef_ptc_masterhand_act_01_56 = 0xc20040, + ef_ptc_masterhand_act_01_57 = 0xc20041, + ef_ptc_masterhand_act_01_58 = 0xc20042, + ef_ptc_masterhand_act_01_59 = 0xc20043, + ef_ptc_masterhand_act_01_60 = 0xc20044, + ef_ptc_masterhand_act_01_61 = 0xc20045, + ef_ptc_masterhand_act_01_62 = 0xc20046, + ef_ptc_masterhand_act_01_63 = 0xc20047, + ef_ptc_masterhand_act_01_64 = 0xc20048, + ef_ptc_masterhand_act_01_65 = 0xc20049, + ef_ptc_masterhand_act_01_66 = 0xc2004a, + ef_ptc_masterhand_act_01_67 = 0xc2004b, + ef_ptc_masterhand_act_01_68 = 0xc2004c, + ef_ptc_masterhand_act_01_69 = 0xc2004d, + ef_ptc_masterhand_act_01_70 = 0xc2004e, + ef_ptc_masterhand_act_01_71 = 0xc2004f, + ef_ptc_masterhand_act_01_72 = 0xc20050, + ef_ptc_masterhand_act_01_73 = 0xc20051, + ef_ptc_masterhand_act_01_74 = 0xc20052, + ef_ptc_masterhand_act_01_75 = 0xc20053, + ef_ptc_masterhand_act_01_76 = 0xc20054, + ef_ptc_masterhand_act_01_77 = 0xc20055, + ef_ptc_masterhand_act_01_78 = 0xc20056, + ef_ptc_masterhand_act_01_79 = 0xc20057, + ef_ptc_masterhand_act_01_80 = 0xc20058, + ef_ptc_masterhand_act_01_81 = 0xc20059, + ef_ptc_masterhand_act_01_82 = 0xc2005a, + ef_ptc_masterhand_act_01_83 = 0xc2005b, + ef_ptc_masterhand_act_01_84 = 0xc2005c, + ef_ptc_masterhand_act_01_85 = 0xc2005d, + ef_ptc_masterhand_act_01_86 = 0xc2005e, + ef_ptc_masterhand_act_01_87 = 0xc2005f, + ef_ptc_masterhand_act_01_88 = 0xc20060, + ef_ptc_masterhand_act_01_89 = 0xc20061, + ef_ptc_masterhand_act_01_90 = 0xc20062, + ef_ptc_masterhand_act_01_91 = 0xc20063, + ef_ptc_masterhand_act_01_92 = 0xc20064, + ef_ptc_crazyhand_beam_head = 0xc30002, + ef_ptc_crazyhand_beam_hit = 0xc30003, + ef_ptc_crazyhand_fling_attack = 0xc30004, + ef_ptc_crazyhand_nigiru = 0xc30005, + ef_ptc_crazyhand_dead = 0xc30006, + ef_ptc_crazyhand_gun_charge = 0xc30007, + ef_ptc_crazyhand_fling_wakka = 0xc30008, + ef_ptc_crazyhand_act_01 = 0xc30009, + ef_ptc_crazyhand_act_01_2 = 0xc3000a, + ef_ptc_crazyhand_act_01_3 = 0xc3000b, + ef_ptc_crazyhand_act_01_4 = 0xc3000c, + ef_ptc_crazyhand_act_01_5 = 0xc3000d, + ef_ptc_crazyhand_act_01_6 = 0xc3000e, + ef_ptc_crazyhand_act_01_7 = 0xc3000f, + ef_ptc_crazyhand_act_01_8 = 0xc30010, + ef_ptc_crazyhand_act_01_9 = 0xc30011, + ef_ptc_crazyhand_act_01_10 = 0xc30012, + ef_ptc_crazyhand_act_01_11 = 0xc30013, + ef_ptc_crazyhand_act_01_12 = 0xc30014, + ef_ptc_crazyhand_act_01_13 = 0xc30015, + ef_ptc_crazyhand_act_01_14 = 0xc30016, + ef_ptc_crazyhand_act_01_15 = 0xc30017, + ef_ptc_crazyhand_act_01_16 = 0xc30018, + ef_ptc_crazyhand_act_01_17 = 0xc30019, + ef_ptc_crazyhand_act_01_18 = 0xc3001a, + ef_ptc_crazyhand_act_01_19 = 0xc3001b, + ef_ptc_crazyhand_act_01_20 = 0xc3001c, + ef_ptc_crazyhand_act_01_21 = 0xc3001d, + ef_ptc_crazyhand_act_01_22 = 0xc3001e, + ef_ptc_crazyhand_act_01_23 = 0xc3001f, + ef_ptc_crazyhand_act_01_24 = 0xc30020, + ef_ptc_crazyhand_act_01_25 = 0xc30021, + ef_ptc_crazyhand_act_01_26 = 0xc30022, + ef_ptc_crazyhand_act_01_27 = 0xc30023, + ef_ptc_crazyhand_act_01_28 = 0xc30024, + ef_ptc_crazyhand_act_01_29 = 0xc30025, + ef_ptc_crazyhand_act_01_30 = 0xc30026, + ef_ptc_crazyhand_act_01_31 = 0xc30027, + ef_ptc_crazyhand_act_01_32 = 0xc30028, + ef_ptc_crazyhand_act_01_33 = 0xc30029, + ef_ptc_crazyhand_act_01_34 = 0xc3002a, + ef_ptc_crazyhand_act_01_35 = 0xc3002b, + ef_ptc_crazyhand_act_01_36 = 0xc3002c, + ef_ptc_crazyhand_act_01_37 = 0xc3002d, + ef_ptc_crazyhand_act_01_38 = 0xc3002e, + ef_ptc_crazyhand_act_01_39 = 0xc3002f, + ef_ptc_crazyhand_act_01_40 = 0xc30030, + ef_ptc_crazyhand_act_01_41 = 0xc30031, + ef_ptc_crazyhand_act_01_42 = 0xc30032, + ef_ptc_crazyhand_act_01_43 = 0xc30033, + ef_ptc_crazyhand_act_01_44 = 0xc30034, + ef_ptc_crazyhand_act_01_45 = 0xc30035, + ef_ptc_crazyhand_act_01_46 = 0xc30036, + ef_ptc_crazyhand_act_01_47 = 0xc30037, + ef_ptc_crazyhand_act_01_48 = 0xc30038, + ef_ptc_crazyhand_act_01_49 = 0xc30039, + ef_ptc_crazyhand_act_01_50 = 0xc3003a, + ef_ptc_crazyhand_act_01_51 = 0xc3003b, + ef_ptc_crazyhand_act_01_52 = 0xc3003c, + ef_ptc_crazyhand_act_01_53 = 0xc3003d, + ef_ptc_crazyhand_act_01_54 = 0xc3003e, + ef_ptc_crazyhand_act_01_55 = 0xc3003f, + ef_ptc_crazyhand_act_01_56 = 0xc30040, + ef_ptc_crazyhand_act_01_57 = 0xc30041, + ef_ptc_crazyhand_act_01_58 = 0xc30042, + ef_ptc_crazyhand_act_01_59 = 0xc30043, + ef_ptc_crazyhand_act_01_60 = 0xc30044, + ef_ptc_crazyhand_act_01_61 = 0xc30045, + ef_ptc_crazyhand_act_01_62 = 0xc30046, + ef_ptc_crazyhand_act_01_63 = 0xc30047, + ef_ptc_crazyhand_act_01_64 = 0xc30048, + ef_ptc_crazyhand_act_01_65 = 0xc30049, + ef_ptc_crazyhand_act_01_66 = 0xc3004a, + ef_ptc_crazyhand_act_01_67 = 0xc3004b, + ef_ptc_crazyhand_act_01_68 = 0xc3004c, + ef_ptc_crazyhand_act_01_69 = 0xc3004d, + ef_ptc_crazyhand_act_01_70 = 0xc3004e, + ef_ptc_crazyhand_act_01_71 = 0xc3004f, + ef_ptc_crazyhand_act_01_72 = 0xc30050, + ef_ptc_crazyhand_act_01_73 = 0xc30051, + ef_ptc_crazyhand_act_01_74 = 0xc30052, + ef_ptc_crazyhand_act_01_75 = 0xc30053, + ef_ptc_crazyhand_act_01_76 = 0xc30054, + ef_ptc_crazyhand_act_01_77 = 0xc30055, + ef_ptc_crazyhand_act_01_78 = 0xc30056, + ef_ptc_crazyhand_act_01_79 = 0xc30057, + ef_ptc_crazyhand_act_01_80 = 0xc30058, + ef_ptc_crazyhand_act_01_81 = 0xc30059, + ef_ptc_crazyhand_act_01_82 = 0xc3005a, + ef_ptc_crazyhand_act_01_83 = 0xc3005b, + ef_ptc_crazyhand_act_01_84 = 0xc3005c, + ef_ptc_crazyhand_act_01_85 = 0xc3005d, + ef_ptc_crazyhand_act_01_86 = 0xc3005e, + ef_ptc_crazyhand_act_01_87 = 0xc3005f, + ef_ptc_crazyhand_act_01_88 = 0xc30060, + ef_ptc_crazyhand_act_01_89 = 0xc30061, + ef_ptc_crazyhand_act_01_90 = 0xc30062, + ef_ptc_crazyhand_act_01_91 = 0xc30063, + ef_ptc_crazyhand_act_01_92 = 0xc30064, + ef_ptc_falconflyer_vernierback = 0xc40001, + ef_ptc_falconflyer_pressattack = 0xc4000a, + ef_ptc_falconflyer_rush_attack = 0xc40014, + ef_ptc_falconflyer_slapflash_1 = 0xc4001e, + ef_ptc_falconflyer_slapthunder_1 = 0xc4001f, + ef_ptc_falconflyer_slapthunder_2 = 0xc40020, + ef_ptc_falconflyer_slapfire_1 = 0xc40021, + ef_ptc_falconflyer_slapsmoke_1 = 0xc40022, + ef_ptc_falconflyer_slapfire_2 = 0xc40023, + ef_ptc_falconflyer_slapsmoke_2 = 0xc40024, + ef_ptc_falconflyer_slapvernier = 0xc40025, + ef_ptc_falconflyer_clingsattackloop_0 = 0xc40028, + ef_ptc_falconflyer_clingsattackloop_1 = 0xc40029, + ef_ptc_falconflyer_clingsattackend_0 = 0xc40032, + ef_ptc_falconflyer_clingsattackend_1 = 0xc40033, + ef_ptc_falconflyer_wingslapvernier = 0xc4003c, + ef_ptc_falconflyer_flameball_1 = 0xc40046, + ef_ptc_falconflyer_effect = 0xc40050, + ef_ptc_falconflyer_effect_2 = 0xc40051, + ef_ptc_falconflyer_effect_3 = 0xc40052, + ef_ptc_falconflyer_effect_4 = 0xc40053, + ef_ptc_falconflyer_effect_5 = 0xc40054, + ef_ptc_falconflyer_effect_6 = 0xc40055, + ef_ptc_falconflyer_effect_7 = 0xc40056, + ef_ptc_falconflyer_effect_8 = 0xc40057, + ef_ptc_falconflyer_effect_9 = 0xc40058, + ef_ptc_falconflyer_effect_10 = 0xc40059, + ef_ptc_falconflyer_effect_11 = 0xc4005a, + ef_ptc_falconflyer_effect_12 = 0xc4005b, + ef_ptc_falconflyer_effect_13 = 0xc4005c, + ef_ptc_falconflyer_effect_14 = 0xc4005d, + ef_ptc_falconflyer_effect_15 = 0xc4005e, + ef_ptc_falconflyer_effect_16 = 0xc4005f, + ef_ptc_falconflyer_effect_17 = 0xc40060, + ef_ptc_falconflyer_effect_18 = 0xc40061, + ef_ptc_falconflyer_effect_19 = 0xc40062, + ef_ptc_falconflyer_effect_20 = 0xc40063, + ef_ptc_falconflyer_effect_21 = 0xc40064, + ef_ptc_falconflyer_effect_22 = 0xc40065, + ef_ptc_falconflyer_effect_23 = 0xc40066, + ef_ptc_falconflyer_effect_24 = 0xc40067, + ef_ptc_falconflyer_effect_25 = 0xc40068, + ef_ptc_falconflyer_effect_26 = 0xc40069, + ef_ptc_falconflyer_effect_27 = 0xc4006a, + ef_ptc_falconflyer_effect_28 = 0xc4006b, + ef_ptc_falconflyer_effect_29 = 0xc4006c, + ef_ptc_falconflyer_effect_30 = 0xc4006d, + ef_ptc_falconflyer_effect_31 = 0xc4006e, + ef_ptc_falconflyer_effect_32 = 0xc4006f, + ef_ptc_falconflyer_effect_33 = 0xc40070, + ef_ptc_falconflyer_effect_34 = 0xc40071, + ef_ptc_falconflyer_effect_35 = 0xc40072, + ef_ptc_falconflyer_effect_36 = 0xc40073, + ef_ptc_falconflyer_effect_37 = 0xc40074, + ef_ptc_falconflyer_effect_38 = 0xc40075, + ef_ptc_falconflyer_effect_39 = 0xc40076, + ef_ptc_falconflyer_effect_40 = 0xc40077, + ef_ptc_falconflyer_effect_41 = 0xc40078, + ef_ptc_falconflyer_effect_42 = 0xc40079, + ef_ptc_falconflyer_effect_43 = 0xc4007a, + ef_ptc_falconflyer_effect_44 = 0xc4007b, + ef_ptc_falconflyer_effect_45 = 0xc4007c, + ef_ptc_falconflyer_effect_46 = 0xc4007d, + ef_ptc_falconflyer_effect_47 = 0xc4007e, + ef_ptc_falconflyer_effect_48 = 0xc4007f, + ef_ptc_falconflyer_effect_49 = 0xc40080, + ef_ptc_falconflyer_effect_50 = 0xc40081, + ef_ptc_falconflyer_effect_51 = 0xc40082, + ef_ptc_falconflyer_effect_52 = 0xc40083, + ef_ptc_falconflyer_effect_53 = 0xc40084, + ef_ptc_falconflyer_effect_54 = 0xc40085, + ef_ptc_falconflyer_effect_55 = 0xc40086, + ef_ptc_falconflyer_effect_56 = 0xc40087, + ef_ptc_falconflyer_effect_57 = 0xc40088, + ef_ptc_falconflyer_effect_58 = 0xc40089, + ef_ptc_falconflyer_effect_59 = 0xc4008a, + ef_ptc_falconflyer_effect_60 = 0xc4008b, + ef_ptc_falconflyer_effect_61 = 0xc4008c, + ef_ptc_falconflyer_effect_62 = 0xc4008d, + ef_ptc_falconflyer_effect_63 = 0xc4008e, + ef_ptc_falconflyer_effect_64 = 0xc4008f, + ef_ptc_falconflyer_effect_65 = 0xc40090, + ef_ptc_falconflyer_effect_66 = 0xc40091, + ef_ptc_falconflyer_effect_67 = 0xc40092, + ef_ptc_falconflyer_effect_68 = 0xc40093, + ef_ptc_falconflyer_effect_69 = 0xc40094, + ef_ptc_falconflyer_effect_70 = 0xc40095, + ef_ptc_falconflyer_effect_71 = 0xc40096, + ef_ptc_falconflyer_effect_72 = 0xc40097, + ef_ptc_falconflyer_effect_73 = 0xc40098, + ef_ptc_falconflyer_effect_74 = 0xc40099, + ef_ptc_falconflyer_effect_75 = 0xc4009a, + ef_ptc_falconflyer_effect_76 = 0xc4009b, + ef_ptc_falconflyer_effect_77 = 0xc4009c, + ef_ptc_falconflyer_effect_78 = 0xc4009d, + ef_ptc_falconflyer_effect_79 = 0xc4009e, + ef_ptc_falconflyer_effect_80 = 0xc4009f, + ef_ptc_falconflyer_effect_81 = 0xc400a0, + ef_ptc_falconflyer_effect_82 = 0xc400a1, + ef_ptc_falconflyer_effect_83 = 0xc400a2, + ef_ptc_falconflyer_effect_84 = 0xc400a3, + ef_ptc_falconflyer_effect_85 = 0xc400a4, + ef_ptc_falconflyer_effect_86 = 0xc400a5, + ef_ptc_falconflyer_effect_87 = 0xc400a6, + ef_ptc_falconflyer_effect_88 = 0xc400a7, + ef_ptc_falconflyer_effect_89 = 0xc400a8, + ef_ptc_falconflyer_effect_90 = 0xc400a9, + ef_ptc_falconflyer_effect_91 = 0xc400aa, + ef_ptc_falconflyer_effect_92 = 0xc400ab, + ef_ptc_falconflyer_effect_93 = 0xc400ac, + ef_ptc_falconflyer_effect_94 = 0xc400ad, + ef_ptc_falconflyer_effect_95 = 0xc400ae, + ef_ptc_falconflyer_effect_96 = 0xc400af, + ef_ptc_falconflyer_effect_97 = 0xc400b0, + ef_ptc_falconflyer_effect_98 = 0xc400b1, + ef_ptc_falconflyer_effect_99 = 0xc400b2, + ef_ptc_falconflyer_effect_100 = 0xc400b3, + ef_ptc_falconflyer_effect_101 = 0xc400b4, + ef_ptc_falconflyer_effect_102 = 0xc400b5, + ef_ptc_falconflyer_effect_103 = 0xc400b6, + ef_ptc_falconflyer_effect_104 = 0xc400b7, + ef_ptc_falconflyer_effect_105 = 0xc400b8, + ef_ptc_falconflyer_effect_106 = 0xc400b9, + ef_ptc_falconflyer_effect_107 = 0xc400ba, + ef_ptc_falconflyer_effect_108 = 0xc400bb, + ef_ptc_falconflyer_effect_109 = 0xc400bc, + ef_ptc_falconflyer_effect_110 = 0xc400bd, + ef_ptc_falconflyer_effect_111 = 0xc400be, + ef_ptc_falconflyer_effect_112 = 0xc400bf, + ef_ptc_falconflyer_effect_113 = 0xc400c0, + ef_ptc_falconflyer_effect_114 = 0xc400c1, + ef_ptc_falconflyer_effect_115 = 0xc400c2, + ef_ptc_falconflyer_effect_116 = 0xc400c3, + ef_ptc_falconflyer_effect_117 = 0xc400c4, + ef_ptc_falconflyer_effect_118 = 0xc400c5, + ef_ptc_falconflyer_effect_119 = 0xc400c6, + ef_ptc_falconflyer_effect_120 = 0xc400c7, + ef_ptc_joe_act_01 = 0xc70001, + ef_ptc_joe_act_02 = 0xc70002, + ef_ptc_joe_act_03 = 0xc70003, + ef_ptc_joe_upper = 0xc70004, + ef_ptc_joe_smash = 0xc70005, + ef_ptc_joe_smash_hand = 0xc70006, + ef_ptc_joe_act_01_2 = 0xc70007, + ef_ptc_joe_act_01_3 = 0xc70008, + ef_ptc_joe_act_01_4 = 0xc70009, + ef_ptc_joe_act_01_5 = 0xc7000a, + ef_ptc_joe_act_01_6 = 0xc7000b, + ef_ptc_joe_act_01_7 = 0xc7000c, + ef_ptc_joe_act_01_8 = 0xc7000d, + ef_ptc_joe_act_01_9 = 0xc7000e, + ef_ptc_joe_act_01_10 = 0xc7000f, + ef_ptc_joe_act_01_11 = 0xc70010, + ef_ptc_joe_act_01_12 = 0xc70011, + ef_ptc_joe_act_01_13 = 0xc70012, + ef_ptc_joe_act_01_14 = 0xc70013, + ef_ptc_joe_act_01_15 = 0xc70014, + ef_ptc_waluigi_effect = 0xc80001, + ef_ptc_waluigi_effect_2 = 0xc80002, + ef_ptc_waluigi_effect_3 = 0xc80003, + ef_ptc_waluigi_effect_4 = 0xc80004, + ef_ptc_waluigi_effect_5 = 0xc80005, + ef_ptc_waluigi_effect_6 = 0xc80006, + ef_ptc_waluigi_effect_7 = 0xc80007, + ef_ptc_waluigi_effect_8 = 0xc80008, + ef_ptc_waluigi_effect_9 = 0xc80009, + ef_ptc_waluigi_effect_10 = 0xc8000a, + ef_ptc_waluigi_effect_11 = 0xc8000b, + ef_ptc_waluigi_effect_12 = 0xc8000c, + ef_ptc_waluigi_effect_13 = 0xc8000d, + ef_ptc_waluigi_effect_14 = 0xc8000e, + ef_ptc_waluigi_effect_15 = 0xc8000f, + ef_ptc_waluigi_effect_16 = 0xc80010, + ef_ptc_waluigi_effect_17 = 0xc80011, + ef_ptc_waluigi_effect_18 = 0xc80012, + ef_ptc_waluigi_effect_19 = 0xc80013, + ef_ptc_waluigi_effect_20 = 0xc80014, + ef_ptc_resetsan_act_01 = 0xc90001, + ef_ptc_resetsan_act_02 = 0xc90002, + ef_ptc_resetsan_act_03 = 0xc90003, + ef_ptc_resetsan_act_01_2 = 0xc90004, + ef_ptc_resetsan_act_01_3 = 0xc90005, + ef_ptc_resetsan_act_01_4 = 0xc90006, + ef_ptc_resetsan_act_01_5 = 0xc90007, + ef_ptc_resetsan_act_01_6 = 0xc90008, + ef_ptc_resetsan_act_01_7 = 0xc90009, + ef_ptc_resetsan_act_01_8 = 0xc9000a, + ef_ptc_resetsan_act_01_9 = 0xc9000b, + ef_ptc_resetsan_act_01_10 = 0xc9000c, + ef_ptc_resetsan_act_01_11 = 0xc9000d, + ef_ptc_resetsan_act_01_12 = 0xc9000e, + ef_ptc_resetsan_act_01_13 = 0xc9000f, + ef_ptc_resetsan_act_01_14 = 0xc90010, + ef_ptc_resetsan_act_01_15 = 0xc90011, + ef_ptc_resetsan_act_01_16 = 0xc90012, + ef_ptc_resetsan_act_01_17 = 0xc90013, + ef_ptc_resetsan_act_01_18 = 0xc90014, + ef_ptc_resetsan_act_01_19 = 0xc90015, + ef_ptc_resetsan_act_01_20 = 0xc90016, + ef_ptc_resetsan_act_01_21 = 0xc90017, + ef_ptc_nintendogs_act_01 = 0xca0001, + ef_ptc_nintendogs_act_02 = 0xca0002, + ef_ptc_nintendogs_act_03 = 0xca0003, + ef_ptc_nintendogs_act_01_2 = 0xca0004, + ef_ptc_nintendogs_act_01_3 = 0xca0005, + ef_ptc_nintendogs_act_01_4 = 0xca0006, + ef_ptc_nintendogs_act_01_5 = 0xca0007, + ef_ptc_nintendogs_act_01_6 = 0xca0008, + ef_ptc_nintendogs_act_01_7 = 0xca0009, + ef_ptc_nintendogs_act_01_8 = 0xca000a, + ef_ptc_nintendogs_act_01_9 = 0xca000b, + ef_ptc_nintendogs_act_01_10 = 0xca000c, + ef_ptc_nintendogs_act_01_11 = 0xca000d, + ef_ptc_nintendogs_act_01_12 = 0xca000e, + ef_ptc_nintendogs_act_01_13 = 0xca000f, + ef_ptc_nintendogs_act_01_14 = 0xca0010, + ef_ptc_nintendogs_act_01_15 = 0xca0011, + ef_ptc_nintendogs_act_01_16 = 0xca0012, + ef_ptc_nintendogs_act_01_17 = 0xca0013, + ef_ptc_nintendogs_act_01_18 = 0xca0014, + ef_ptc_cyborg_act_01 = 0xcb0002, + ef_ptc_cyborg_act_01_2 = 0xcb0003, + ef_ptc_cyborg_act_01_3 = 0xcb0004, + ef_ptc_cyborg_act_01_4 = 0xcb0005, + ef_ptc_cyborg_act_01_5 = 0xcb0006, + ef_ptc_cyborg_act_01_6 = 0xcb0007, + ef_ptc_cyborg_act_01_7 = 0xcb0008, + ef_ptc_cyborg_act_01_8 = 0xcb0009, + ef_ptc_cyborg_act_01_9 = 0xcb000a, + ef_ptc_cyborg_act_01_10 = 0xcb000b, + ef_ptc_cyborg_act_01_11 = 0xcb000c, + ef_ptc_cyborg_act_01_12 = 0xcb000d, + ef_ptc_cyborg_act_01_13 = 0xcb000e, + ef_ptc_cyborg_act_01_14 = 0xcb000f, + ef_ptc_cyborg_act_01_15 = 0xcb0010, + ef_ptc_cyborg_act_01_16 = 0xcb0011, + ef_ptc_cyborg_act_01_17 = 0xcb0012, + ef_ptc_cyborg_act_01_18 = 0xcb0013, + ef_ptc_cyborg_act_01_19 = 0xcb0014, + ef_ptc_cyborg_act_01_20 = 0xcb0015, + ef_ptc_shadow_wave_01 = 0xcc0001, + ef_ptc_shadow_thunder = 0xcc0002, + ef_ptc_shadow_wave_02 = 0xcc0003, + ef_ptc_shadow_wave_01_2 = 0xcc0004, + ef_ptc_shadow_wave_01_3 = 0xcc0005, + ef_ptc_shadow_wave_01_4 = 0xcc0006, + ef_ptc_shadow_wave_01_5 = 0xcc0007, + ef_ptc_shadow_wave_01_6 = 0xcc0008, + ef_ptc_shadow_wave_01_7 = 0xcc0009, + ef_ptc_shadow_wave_01_8 = 0xcc000a, + ef_ptc_shadow_wave_01_9 = 0xcc000b, + ef_ptc_shadow_wave_01_10 = 0xcc000c, + ef_ptc_shadow_wave_01_11 = 0xcc000d, + ef_ptc_shadow_wave_01_12 = 0xcc000e, + ef_ptc_shadow_wave_01_13 = 0xcc000f, + ef_ptc_shadow_wave_01_14 = 0xcc0010, + ef_ptc_shadow_wave_01_15 = 0xcc0011, + ef_ptc_shadow_wave_01_16 = 0xcc0012, + ef_ptc_shadow_wave_01_17 = 0xcc0013, + ef_ptc_shadow_wave_01_18 = 0xcc0014, + ef_ptc_shadow_wave_01_19 = 0xcc0015, + ef_ptc_shadow_wave_01_20 = 0xcc0016, + ef_ptc_shadow_wave_01_21 = 0xcc0017, + ef_ptc_shadow_wave_01_22 = 0xcc0018, + ef_ptc_shadow_wave_01_23 = 0xcc0019, + ef_ptc_shadow_wave_01_24 = 0xcc001a, + ef_ptc_shadow_wave_01_25 = 0xcc001b, + ef_ptc_shadow_wave_01_26 = 0xcc001c, + ef_ptc_shadow_wave_01_27 = 0xcc001d, + ef_ptc_shadow_wave_01_28 = 0xcc001e, + ef_ptc_shadow_wave_01_29 = 0xcc001f, + ef_ptc_shadow_wave_01_30 = 0xcc0020, + ef_ptc_shadow_wave_01_31 = 0xcc0021, + ef_ptc_shadow_wave_01_32 = 0xcc0022, + ef_ptc_shadow_wave_01_33 = 0xcc0023, + ef_ptc_shadow_wave_01_34 = 0xcc0024, + ef_ptc_shadow_wave_01_35 = 0xcc0025, + ef_ptc_shadow_wave_01_36 = 0xcc0026, + ef_ptc_shadow_wave_01_37 = 0xcc0027, + ef_ptc_shadow_wave_01_38 = 0xcc0028, + ef_ptc_shadow_wave_01_39 = 0xcc0029, + ef_ptc_shadow_wave_01_40 = 0xcc002a, + ef_ptc_shadow_wave_01_41 = 0xcc002b, + ef_ptc_shadow_wave_01_42 = 0xcc002c, + ef_ptc_excitebike_effect = 0xcd0001, + ef_ptc_excitebike_effect_2 = 0xcd0002, + ef_ptc_excitebike_effect_3 = 0xcd0003, + ef_ptc_excitebike_effect_4 = 0xcd0004, + ef_ptc_excitebike_effect_5 = 0xcd0005, + ef_ptc_excitebike_effect_6 = 0xcd0006, + ef_ptc_excitebike_effect_7 = 0xcd0007, + ef_ptc_excitebike_effect_8 = 0xcd0008, + ef_ptc_excitebike_effect_9 = 0xcd0009, + ef_ptc_excitebike_effect_10 = 0xcd000a, + ef_ptc_excitebike_effect_11 = 0xcd000b, + ef_ptc_excitebike_effect_12 = 0xcd000c, + ef_ptc_excitebike_effect_13 = 0xcd000d, + ef_ptc_excitebike_effect_14 = 0xcd000e, + ef_ptc_excitebike_effect_15 = 0xcd000f, + ef_ptc_excitebike_effect_16 = 0xcd0010, + ef_ptc_excitebike_effect_17 = 0xcd0011, + ef_ptc_excitebike_effect_18 = 0xcd0012, + ef_ptc_excitebike_effect_19 = 0xcd0013, + ef_ptc_excitebike_effect_20 = 0xcd0014, + ef_ptc_devil_kml = 0xce0001, + ef_ptc_devil_kml_2 = 0xce0002, + ef_ptc_devil_kml_3 = 0xce0003, + ef_ptc_devil_kml_4 = 0xce0004, + ef_ptc_devil_kml_5 = 0xce0005, + ef_ptc_devil_kml_6 = 0xce0006, + ef_ptc_devil_kml_7 = 0xce0007, + ef_ptc_devil_kml_8 = 0xce0008, + ef_ptc_devil_kml_9 = 0xce0009, + ef_ptc_devil_kml_10 = 0xce000a, + ef_ptc_devil_kml_11 = 0xce000b, + ef_ptc_devil_kml_12 = 0xce000c, + ef_ptc_devil_kml_13 = 0xce000d, + ef_ptc_devil_kml_14 = 0xce000e, + ef_ptc_devil_kml_15 = 0xce000f, + ef_ptc_devil_kml_16 = 0xce0010, + ef_ptc_devil_kml_17 = 0xce0011, + ef_ptc_devil_kml_18 = 0xce0012, + ef_ptc_devil_kml_19 = 0xce0013, + ef_ptc_devil_kml_20 = 0xce0014, + ef_ptc_devil_kml_21 = 0xce0015, + ef_ptc_hmbros_jumpsmoke = 0xcf0001, + ef_ptc_hmbros_effect = 0xcf0002, + ef_ptc_hmbros_effect_2 = 0xcf0003, + ef_ptc_hmbros_effect_3 = 0xcf0004, + ef_ptc_hmbros_effect_4 = 0xcf0005, + ef_ptc_hmbros_effect_5 = 0xcf0006, + ef_ptc_hmbros_effect_6 = 0xcf0007, + ef_ptc_hmbros_effect_7 = 0xcf0008, + ef_ptc_hmbros_effect_8 = 0xcf0009, + ef_ptc_hmbros_effect_9 = 0xcf000a, + ef_ptc_hmbros_effect_10 = 0xcf000b, + ef_ptc_hmbros_effect_11 = 0xcf000c, + ef_ptc_hmbros_effect_12 = 0xcf000d, + ef_ptc_hmbros_effect_13 = 0xcf000e, + ef_ptc_hmbros_effect_14 = 0xcf000f, + ef_ptc_hmbros_effect_15 = 0xcf0010, + ef_ptc_hmbros_effect_16 = 0xcf0011, + ef_ptc_hmbros_effect_17 = 0xcf0012, + ef_ptc_hmbros_effect_18 = 0xcf0013, + ef_ptc_hmbros_effect_19 = 0xcf0014, + ef_ptc_metroid_light = 0xd00001, + ef_ptc_metroid_act_01 = 0xd00002, + ef_ptc_metroid_light_2 = 0xd00003, + ef_ptc_metroid_light_3 = 0xd00004, + ef_ptc_metroid_light_4 = 0xd00005, + ef_ptc_metroid_light_5 = 0xd00006, + ef_ptc_metroid_light_6 = 0xd00007, + ef_ptc_metroid_light_7 = 0xd00008, + ef_ptc_metroid_light_8 = 0xd00009, + ef_ptc_metroid_light_9 = 0xd0000a, + ef_ptc_metroid_light_10 = 0xd0000b, + ef_ptc_metroid_light_11 = 0xd0000c, + ef_ptc_metroid_light_12 = 0xd0000d, + ef_ptc_metroid_light_13 = 0xd0000e, + ef_ptc_metroid_light_14 = 0xd0000f, + ef_ptc_metroid_light_15 = 0xd00010, + ef_ptc_metroid_light_16 = 0xd00011, + ef_ptc_metroid_light_17 = 0xd00012, + ef_ptc_metroid_light_18 = 0xd00013, + ef_ptc_metroid_light_19 = 0xd00014, + ef_ptc_metroid_light_20 = 0xd00015, + ef_ptc_wright_buil = 0xd20001, + ef_ptc_wright_bwa = 0xd20002, + ef_ptc_wright_bkml_01 = 0xd20003, + ef_ptc_wright_buil_2 = 0xd20004, + ef_ptc_wright_buil_3 = 0xd20005, + ef_ptc_wright_buil_4 = 0xd20006, + ef_ptc_wright_buil_5 = 0xd20007, + ef_ptc_wright_buil_6 = 0xd20008, + ef_ptc_wright_buil_7 = 0xd20009, + ef_ptc_wright_buil_8 = 0xd2000a, + ef_ptc_wright_buil_9 = 0xd2000b, + ef_ptc_wright_buil_10 = 0xd2000c, + ef_ptc_wright_buil_11 = 0xd2000d, + ef_ptc_wright_buil_12 = 0xd2000e, + ef_ptc_wright_buil_13 = 0xd2000f, + ef_ptc_wright_buil_14 = 0xd20010, + ef_ptc_wright_buil_15 = 0xd20011, + ef_ptc_wright_buil_16 = 0xd20012, + ef_ptc_wright_buil_17 = 0xd20013, + ef_ptc_wright_buil_18 = 0xd20014, + ef_ptc_wright_buil_19 = 0xd20015, + ef_ptc_wright_buil_20 = 0xd20016, + ef_ptc_wright_buil_21 = 0xd20017, + ef_ptc_stafy_a_413 = 0xd30001, + ef_ptc_stafy_attack = 0xd30003, + ef_ptc_stafy_kirakira = 0xd30004, + ef_ptc_stafy_a_413_2 = 0xd30005, + ef_ptc_stafy_a_413_3 = 0xd30006, + ef_ptc_stafy_a_413_4 = 0xd30007, + ef_ptc_stafy_a_413_5 = 0xd30008, + ef_ptc_stafy_a_413_6 = 0xd30009, + ef_ptc_stafy_a_413_7 = 0xd3000a, + ef_ptc_stafy_a_413_8 = 0xd3000b, + ef_ptc_stafy_a_413_9 = 0xd3000c, + ef_ptc_stafy_a_413_10 = 0xd3000d, + ef_ptc_stafy_a_413_11 = 0xd3000e, + ef_ptc_stafy_a_413_12 = 0xd3000f, + ef_ptc_stafy_a_413_13 = 0xd30010, + ef_ptc_stafy_a_413_14 = 0xd30011, + ef_ptc_stafy_a_413_15 = 0xd30012, + ef_ptc_stafy_a_413_16 = 0xd30013, + ef_ptc_stafy_a_413_17 = 0xd30014, + ef_ptc_stafy_a_413_18 = 0xd30015, + ef_ptc_stafy_a_413_19 = 0xd30016, + ef_ptc_stafy_a_413_20 = 0xd30017, + ef_ptc_tingle_effect = 0xd40001, + ef_ptc_tingle_curryflash = 0xd40002, + ef_ptc_tingle_curry_01karada = 0xd40003, + ef_ptc_tingle_curry_01te = 0xd40004, + ef_ptc_tingle_banana = 0xd40005, + ef_ptc_tingle_hammer = 0xd40006, + ef_ptc_tingle_balloon = 0xd40007, + ef_ptc_tingle_flower = 0xd40008, + ef_ptc_tingle_curry_01batibati = 0xd40009, + ef_ptc_tingle_start = 0xd4000a, + ef_ptc_tingle_effect_2 = 0xd4000b, + ef_ptc_tingle_effect_3 = 0xd4000c, + ef_ptc_tingle_effect_4 = 0xd4000d, + ef_ptc_tingle_effect_5 = 0xd4000e, + ef_ptc_tingle_effect_6 = 0xd4000f, + ef_ptc_tingle_effect_7 = 0xd40010, + ef_ptc_tingle_effect_8 = 0xd40011, + ef_ptc_tingle_effect_9 = 0xd40012, + ef_ptc_tingle_effect_10 = 0xd40013, + ef_ptc_tingle_effect_11 = 0xd40014, + ef_ptc_katana_act_01 = 0xd50001, + ef_ptc_katana_act_01_2 = 0xd50002, + ef_ptc_katana_act_01_3 = 0xd50003, + ef_ptc_katana_act_01_4 = 0xd50004, + ef_ptc_katana_act_01_5 = 0xd50005, + ef_ptc_katana_act_01_6 = 0xd50006, + ef_ptc_katana_act_01_7 = 0xd50007, + ef_ptc_katana_act_01_8 = 0xd50008, + ef_ptc_katana_act_01_9 = 0xd50009, + ef_ptc_katana_act_01_10 = 0xd5000a, + ef_ptc_katana_act_01_11 = 0xd5000b, + ef_ptc_katana_act_01_12 = 0xd5000c, + ef_ptc_katana_act_01_13 = 0xd5000d, + ef_ptc_katana_act_01_14 = 0xd5000e, + ef_ptc_katana_act_01_15 = 0xd5000f, + ef_ptc_katana_act_01_16 = 0xd50010, + ef_ptc_katana_act_01_17 = 0xd50011, + ef_ptc_katana_act_01_18 = 0xd50012, + ef_ptc_katana_act_01_19 = 0xd50013, + ef_ptc_katana_act_01_20 = 0xd50014, + ef_ptc_lin_main = 0xd60001, + ef_ptc_lin_effect = 0xd60002, + ef_ptc_lin_bg = 0xd60003, + ef_ptc_lin_bg_02 = 0xd60004, + ef_ptc_lin_effect_2 = 0xd60005, + ef_ptc_lin_effect_3 = 0xd60006, + ef_ptc_lin_effect_4 = 0xd60007, + ef_ptc_lin_effect_5 = 0xd60008, + ef_ptc_lin_effect_6 = 0xd60009, + ef_ptc_lin_effect_7 = 0xd6000a, + ef_ptc_lin_effect_8 = 0xd6000b, + ef_ptc_lin_effect_9 = 0xd6000c, + ef_ptc_lin_effect_10 = 0xd6000d, + ef_ptc_lin_effect_11 = 0xd6000e, + ef_ptc_lin_effect_12 = 0xd6000f, + ef_ptc_lin_effect_13 = 0xd60010, + ef_ptc_lin_effect_14 = 0xd60011, + ef_ptc_lin_effect_15 = 0xd60012, + ef_ptc_lin_effect_16 = 0xd60013, + ef_ptc_lin_end = 0xd60014, + ef_ptc_customrobo_gun = 0xd70001, + ef_ptc_customrobo_bomb = 0xd70002, + ef_ptc_customrobo_shot_gun = 0xd70003, + ef_ptc_customrobo_shot_bomb = 0xd70004, + ef_ptc_customrobo_move = 0xd70005, + ef_ptc_customrobo_gun_2 = 0xd70008, + ef_ptc_customrobo_gun_3 = 0xd70009, + ef_ptc_customrobo_gun_4 = 0xd7000a, + ef_ptc_customrobo_gun_5 = 0xd7000b, + ef_ptc_customrobo_gun_6 = 0xd7000c, + ef_ptc_customrobo_gun_7 = 0xd7000d, + ef_ptc_customrobo_gun_8 = 0xd7000e, + ef_ptc_customrobo_gun_9 = 0xd7000f, + ef_ptc_customrobo_gun_10 = 0xd70010, + ef_ptc_customrobo_gun_11 = 0xd70011, + ef_ptc_customrobo_gun_12 = 0xd70012, + ef_ptc_customrobo_gun_13 = 0xd70013, + ef_ptc_customrobo_gun_14 = 0xd70014, + ef_ptc_littlemac_jab = 0xd80001, + ef_ptc_littlemac_straight = 0xd80002, + ef_ptc_littlemac_finish = 0xd80003, + ef_ptc_littlemac_jab_2 = 0xd80004, + ef_ptc_littlemac_jab_3 = 0xd80005, + ef_ptc_littlemac_jab_4 = 0xd80006, + ef_ptc_littlemac_jab_5 = 0xd80007, + ef_ptc_littlemac_jab_6 = 0xd80008, + ef_ptc_littlemac_jab_7 = 0xd80009, + ef_ptc_littlemac_jab_8 = 0xd8000a, + ef_ptc_littlemac_jab_9 = 0xd8000b, + ef_ptc_littlemac_jab_10 = 0xd8000c, + ef_ptc_littlemac_jab_11 = 0xd8000d, + ef_ptc_littlemac_jab_12 = 0xd8000e, + ef_ptc_littlemac_jab_13 = 0xd8000f, + ef_ptc_littlemac_jab_14 = 0xd80010, + ef_ptc_littlemac_jab_15 = 0xd80011, + ef_ptc_littlemac_jab_16 = 0xd80012, + ef_ptc_littlemac_jab_17 = 0xd80013, + ef_ptc_littlemac_jab_18 = 0xd80014, + ef_ptc_littlemac_jab_19 = 0xd80015, + ef_ptc_littlemac_jab_20 = 0xd80016, + ef_ptc_littlemac_jab_21 = 0xd80017, + ef_ptc_tank_act_01 = 0xd90001, + ef_ptc_tank_act_02 = 0xd90002, + ef_ptc_tank_act_03 = 0xd90003, + ef_ptc_tank_act_01_2 = 0xd90004, + ef_ptc_tank_act_01_3 = 0xd90005, + ef_ptc_tank_act_01_4 = 0xd90006, + ef_ptc_tank_act_01_5 = 0xd90007, + ef_ptc_tank_act_01_6 = 0xd90008, + ef_ptc_tank_act_01_7 = 0xd90009, + ef_ptc_tank_act_01_8 = 0xd9000a, + ef_ptc_tank_act_01_9 = 0xd9000b, + ef_ptc_tank_act_01_10 = 0xd9000c, + ef_ptc_tank_act_01_11 = 0xd9000d, + ef_ptc_tank_act_01_12 = 0xd9000e, + ef_ptc_tank_act_01_13 = 0xd9000f, + ef_ptc_tank_act_01_14 = 0xd90010, + ef_ptc_tank_act_01_15 = 0xd90011, + ef_ptc_tank_act_01_16 = 0xd90012, + ef_ptc_tank_act_01_17 = 0xd90013, + ef_ptc_tank_act_01_18 = 0xd90014, + ef_ptc_jeff_rocket_smoke = 0xda0001, + ef_ptc_jeff_ase = 0xda0002, + ef_ptc_jeff_light_normal = 0xda0003, + ef_ptc_jeff_light_big = 0xda0004, + ef_ptc_jeff_rocket_smoke_2 = 0xda0005, + ef_ptc_jeff_rocket_smoke_3 = 0xda0006, + ef_ptc_jeff_rocket_smoke_4 = 0xda0007, + ef_ptc_jeff_rocket_smoke_5 = 0xda0008, + ef_ptc_jeff_rocket_smoke_6 = 0xda0009, + ef_ptc_jeff_rocket_smoke_7 = 0xda000a, + ef_ptc_jeff_rocket_smoke_8 = 0xda000b, + ef_ptc_jeff_rocket_smoke_9 = 0xda000c, + ef_ptc_jeff_rocket_smoke_10 = 0xda000d, + ef_ptc_jeff_rocket_smoke_11 = 0xda000e, + ef_ptc_jeff_rocket_smoke_12 = 0xda000f, + ef_ptc_jeff_rocket_smoke_13 = 0xda0010, + ef_ptc_jeff_rocket_smoke_14 = 0xda0011, + ef_ptc_jeff_rocket_smoke_15 = 0xda0012, + ef_ptc_jeff_rocket_smoke_16 = 0xda0013, + ef_ptc_jeff_rocket_smoke_17 = 0xda0014, + ef_ptc_barbara_bg = 0xdc0001, + ef_ptc_barbara_bg_2 = 0xdc0002, + ef_ptc_barbara_bg_3 = 0xdc0003, + ef_ptc_barbara_bg_4 = 0xdc0004, + ef_ptc_barbara_bg_5 = 0xdc0005, + ef_ptc_barbara_wave_01 = 0xdc0007, + ef_ptc_barbara_wave_02 = 0xdc0008, + ef_ptc_barbara_bg_6 = 0xdc0009, + ef_ptc_barbara_bg_7 = 0xdc000a, + ef_ptc_barbara_bg_8 = 0xdc000b, + ef_ptc_barbara_bg_9 = 0xdc000c, + ef_ptc_barbara_bg_10 = 0xdc000d, + ef_ptc_barbara_bg_11 = 0xdc000e, + ef_ptc_barbara_bg_12 = 0xdc000f, + ef_ptc_barbara_bg_13 = 0xdc0010, + ef_ptc_barbara_bg_14 = 0xdc0011, + ef_ptc_barbara_bg_15 = 0xdc0012, + ef_ptc_barbara_bg_16 = 0xdc0013, + ef_ptc_barbara_bg_17 = 0xdc0014, + ef_ptc_barbara_bg_18 = 0xdc0015, + ef_ptc_barbara_bg_19 = 0xdc0016, + ef_ptc_barbara_bg_20 = 0xdc0017, + ef_ptc_barbara_bg_21 = 0xdc0018, + ef_ptc_barbara_bg_22 = 0xdc0019, + ef_ptc_barbara_bg_23 = 0xdc001a, + ef_ptc_barbara_bg_24 = 0xdc001b, + ef_ptc_barbara_bg_25 = 0xdc001c, + ef_ptc_barbara_bg_26 = 0xdc001d, + ef_ptc_barbara_bg_27 = 0xdc001e, + ef_ptc_barbara_bg_28 = 0xdc001f, + ef_ptc_barbara_bg_29 = 0xdc0020, + ef_ptc_barbara_bg_30 = 0xdc0021, + ef_ptc_barbara_bg_31 = 0xdc0022, + ef_ptc_barbara_bg_32 = 0xdc0023, + ef_ptc_barbara_bg_33 = 0xdc0024, + ef_ptc_barbara_bg_34 = 0xdc0025, + ef_ptc_barbara_bg_35 = 0xdc0026, + ef_ptc_barbara_bg_36 = 0xdc0027, + ef_ptc_barbara_bg_37 = 0xdc0028, + ef_ptc_barbara_bg_38 = 0xdc0029, + ef_ptc_barbara_bg_39 = 0xdc002a, + ef_ptc_barbara_bg_40 = 0xdc002b, + ef_ptc_barbara_bg_41 = 0xdc002c, + ef_ptc_barbara_bg_42 = 0xdc002d, + ef_ptc_barbara_bg_43 = 0xdc002e, + ef_ptc_robin_handtail = 0xdd0001, + ef_ptc_robin_effect = 0xdd0002, + ef_ptc_robin_effect_2 = 0xdd0003, + ef_ptc_robin_effect_3 = 0xdd0004, + ef_ptc_robin_hand_00 = 0xdd0005, + ef_ptc_robin_effect_4 = 0xdd0006, + ef_ptc_robin_effect_5 = 0xdd0007, + ef_ptc_robin_effect_6 = 0xdd0008, + ef_ptc_robin_effect_7 = 0xdd0009, + ef_ptc_robin_effect_8 = 0xdd000a, + ef_ptc_robin_effect_9 = 0xdd000b, + ef_ptc_robin_effect_10 = 0xdd000c, + ef_ptc_robin_effect_11 = 0xdd000d, + ef_ptc_robin_effect_12 = 0xdd000e, + ef_ptc_robin_effect_13 = 0xdd000f, + ef_ptc_robin_hadou = 0xdd0010, + ef_ptc_robin_effect_14 = 0xdd0011, + ef_ptc_robin_effect_15 = 0xdd0012, + ef_ptc_robin_effect_16 = 0xdd0013, + ef_ptc_robin_effect_17 = 0xdd0014, + ef_ptc_robin_effect_18 = 0xdd0015, + ef_ptc_robin_effect_19 = 0xdd0016, + ef_ptc_robin_effect_20 = 0xdd0017, + ef_ptc_robin_effect_21 = 0xdd0018, + ef_ptc_robin_effect_22 = 0xdd0019, + ef_ptc_robin_effect_23 = 0xdd001a, + ef_ptc_robin_effect_24 = 0xdd001b, + ef_ptc_robin_effect_25 = 0xdd001c, + ef_ptc_robin_effect_26 = 0xdd001d, + ef_ptc_robin_effect_27 = 0xdd001e, + ef_ptc_robin_effect_28 = 0xdd001f, + ef_ptc_robin_effect_29 = 0xdd0020, + ef_ptc_robin_effect_30 = 0xdd0021, + ef_ptc_robin_effect_31 = 0xdd0022, + ef_ptc_robin_effect_32 = 0xdd0023, + ef_ptc_robin_effect_33 = 0xdd0024, + ef_ptc_robin_effect_34 = 0xdd0025, + ef_ptc_robin_effect_35 = 0xdd0026, + ef_ptc_robin_effect_36 = 0xdd0027, + ef_ptc_robin_effect_37 = 0xdd0028, + ef_ptc_robin_effect_38 = 0xdd0029, + ef_ptc_robin_effect_39 = 0xdd002a, + ef_ptc_robin_effect_40 = 0xdd002b, + ef_ptc_robin_effect_41 = 0xdd002c, + ef_ptc_robin_effect_42 = 0xdd002d, + ef_ptc_saki_act_01 = 0xde0002, + ef_ptc_saki_act_02 = 0xde0003, + ef_ptc_saki_act_03 = 0xde0004, + ef_ptc_saki_act_01_2 = 0xde0005, + ef_ptc_saki_act_01_3 = 0xde0006, + ef_ptc_saki_act_01_4 = 0xde0007, + ef_ptc_saki_act_01_5 = 0xde0008, + ef_ptc_saki_act_01_6 = 0xde0009, + ef_ptc_saki_act_01_7 = 0xde000a, + ef_ptc_saki_act_01_8 = 0xde000b, + ef_ptc_saki_act_01_9 = 0xde000c, + ef_ptc_saki_act_01_10 = 0xde000d, + ef_ptc_saki_act_01_11 = 0xde000e, + ef_ptc_saki_act_01_12 = 0xde000f, + ef_ptc_saki_act_01_13 = 0xde0010, + ef_ptc_saki_act_01_14 = 0xde0011, + ef_ptc_saki_act_01_15 = 0xde0012, + ef_ptc_saki_act_01_16 = 0xde0013, + ef_ptc_saki_act_01_17 = 0xde0014, + ef_ptc_saki_act_01_18 = 0xde0015, + ef_ptc_kururi_vernier = 0xdf0001, + ef_ptc_kururi_basi = 0xdf0004, + ef_ptc_kururi_tutistart = 0xdf0005, + ef_ptc_kururi_tutiloop = 0xdf0006, + ef_ptc_kururi_tutiend = 0xdf0007, + ef_ptc_kururi_basi_2 = 0xdf0008, + ef_ptc_kururi_basi_3 = 0xdf0009, + ef_ptc_kururi_basi_4 = 0xdf000a, + ef_ptc_kururi_basi_5 = 0xdf000b, + ef_ptc_kururi_basi_6 = 0xdf000c, + ef_ptc_kururi_basi_7 = 0xdf000d, + ef_ptc_kururi_basi_8 = 0xdf000e, + ef_ptc_kururi_basi_9 = 0xdf000f, + ef_ptc_kururi_basi_10 = 0xdf0010, + ef_ptc_kururi_basi_11 = 0xdf0011, + ef_ptc_kururi_basi_12 = 0xdf0012, + ef_ptc_kururi_basi_13 = 0xdf0013, + ef_ptc_kururi_basi_14 = 0xdf0014, + ef_ptc_kururi_basi_15 = 0xdf0015, + ef_ptc_kururi_basi_16 = 0xdf0016, + ef_ptc_kururi_basi_17 = 0xdf0017, + ef_ptc_kururi_basi_18 = 0xdf0018, + ef_ptc_fin_mario_hand_fire = 0xe00002, + ef_ptc_fin_mario_fire_remain = 0xe00003, + ef_ptc_fin_donkey_beat = 0xe10001, + ef_ptc_fin_donkey_onp_01 = 0xe10002, + ef_ptc_fin_donkey_onp_02 = 0xe10003, + ef_ptc_fin_donkey_crap = 0xe10004, + ef_ptc_fin_donkey_ase = 0xe10005, + ef_ptc_fin_donkey_star = 0xe10006, + ef_ptc_fin_donkey_oura = 0xe10007, + ef_ptc_fin_donkey_onp_all = 0xe10008, + ef_ptc_fin_donkey_end = 0xe10009, + ef_ptc_fin_donkey_beat_normal = 0xe1000a, + ef_ptc_fin_donkey_lump = 0xe1000b, + ef_ptc_fin_donkey_sound_bonus = 0xe1000c, + ef_ptc_fin_donkey_sound_normal = 0xe1000d, + ef_ptc_fin_donkey_beat_2 = 0xe1000e, + ef_ptc_fin_donkey_beat_3 = 0xe1000f, + ef_ptc_fin_donkey_beat_4 = 0xe10010, + ef_ptc_fin_donkey_beat_5 = 0xe10011, + ef_ptc_fin_donkey_beat_6 = 0xe10012, + ef_ptc_fin_donkey_beat_7 = 0xe10013, + ef_ptc_fin_donkey_beat_8 = 0xe10014, + ef_ptc_fin_donkey_beat_9 = 0xe10015, + ef_ptc_fin_donkey_beat_10 = 0xe10016, + ef_ptc_fin_donkey_beat_11 = 0xe10017, + ef_ptc_fin_donkey_beat_12 = 0xe10018, + ef_ptc_fin_donkey_beat_13 = 0xe10019, + ef_ptc_fin_donkey_beat_14 = 0xe1001a, + ef_ptc_fin_donkey_beat_15 = 0xe1001b, + ef_ptc_fin_donkey_beat_16 = 0xe1001c, + ef_ptc_fin_donkey_beat_17 = 0xe1001d, + ef_ptc_fin_donkey_beat_18 = 0xe1001e, + ef_ptc_fin_link_lazer = 0xe20003, + ef_ptc_fin_link_triforce_break = 0xe20004, + ef_ptc_fin_toon_link_lazer = 0xe30003, + ef_ptc_fin_toon_link_triforce_break = 0xe30004, + ef_ptc_fin_samus_main = 0xe40002, + ef_ptc_fin_samus_after_smoke = 0xe40003, + ef_ptc_fin_samus_end = 0xe40004, + ef_ptc_fin_samus_after = 0xe40005, + ef_ptc_fin_samus_change_flash_b = 0xe40006, + ef_ptc_fin_samus_change_flash_b_2 = 0xe40007, + ef_ptc_fin_yoshi_start = 0xe50001, + ef_ptc_fin_yoshi_fly = 0xe50002, + ef_ptc_fin_yoshi_fire = 0xe50003, + ef_ptc_fin_yoshi_canon = 0xe50004, + ef_ptc_fin_kirby_nabe_kml = 0xe60002, + ef_ptc_fin_kirby_nabe_fire = 0xe60003, + ef_ptc_fin_kirby_nabe_hamon = 0xe60004, + ef_ptc_fin_kirby_nabe_pepper = 0xe60006, + ef_ptc_fin_kirby_nabe_sibuki = 0xe60007, + ef_ptc_fin_kirby_nabe_splash = 0xe60008, + ef_ptc_fin_kirby_effect = 0xe60009, + ef_ptc_fin_kirby_start_01 = 0xe6000a, + ef_ptc_fin_kirby_start_02 = 0xe6000b, + ef_ptc_fin_kirby_start_03 = 0xe6000c, + ef_ptc_fin_kirby_effect_2 = 0xe6000d, + ef_ptc_fin_kirby_effect_3 = 0xe6000e, + ef_ptc_fin_kirby_effect_4 = 0xe6000f, + ef_ptc_fin_kirby_effect_5 = 0xe60010, + ef_ptc_fin_kirby_effect_6 = 0xe60011, + ef_ptc_fin_kirby_effect_7 = 0xe60012, + ef_ptc_fin_kirby_effect_8 = 0xe60013, + ef_ptc_fin_kirby_nabe_start1 = 0xe60014, + ef_ptc_fin_kirby_effect_9 = 0xe60015, + ef_ptc_fin_kirby_effect_10 = 0xe60016, + ef_ptc_fin_kirby_effect_11 = 0xe60017, + ef_ptc_fin_kirby_effect_12 = 0xe60018, + ef_ptc_fin_kirby_effect_13 = 0xe60019, + ef_ptc_fin_kirby_effect_14 = 0xe6001a, + ef_ptc_fin_kirby_effect_15 = 0xe6001b, + ef_ptc_fin_kirby_effect_16 = 0xe6001c, + ef_ptc_fin_kirby_effect_17 = 0xe6001d, + ef_ptc_fin_kirby_nabe_end1 = 0xe6001e, + ef_ptc_fin_kirby_nabe_end2 = 0xe6001f, + ef_ptc_fin_kirby_effect_18 = 0xe60020, + ef_ptc_fin_kirby_effect_19 = 0xe60021, + ef_ptc_fin_kirby_effect_20 = 0xe60022, + ef_ptc_fin_kirby_effect_21 = 0xe60023, + ef_ptc_fin_kirby_effect_22 = 0xe60024, + ef_ptc_fin_kirby_effect_23 = 0xe60025, + ef_ptc_fin_kirby_effect_24 = 0xe60026, + ef_ptc_fin_kirby_effect_25 = 0xe60027, + ef_ptc_fin_kirby_effect_26 = 0xe60028, + ef_ptc_fin_kirby_effect_27 = 0xe60029, + ef_ptc_fin_kirby_effect_28 = 0xe6002a, + ef_ptc_fin_kirby_effect_29 = 0xe6002b, + ef_ptc_fin_kirby_effect_30 = 0xe6002c, + ef_ptc_fin_kirby_effect_31 = 0xe6002d, + ef_ptc_fin_kirby_effect_32 = 0xe6002e, + ef_ptc_fin_kirby_effect_33 = 0xe6002f, + ef_ptc_fin_kirby_effect_34 = 0xe60030, + ef_ptc_fin_kirby_effect_35 = 0xe60031, + ef_ptc_fin_kirby_effect_36 = 0xe60032, + ef_ptc_fin_kirby_effect_37 = 0xe60033, + ef_ptc_fin_kirby_effect_38 = 0xe60034, + ef_ptc_fin_kirby_effect_39 = 0xe60035, + ef_ptc_fin_kirby_effect_40 = 0xe60036, + ef_ptc_fin_kirby_effect_41 = 0xe60037, + ef_ptc_fin_kirby_effect_42 = 0xe60038, + ef_ptc_fin_kirby_effect_43 = 0xe60039, + ef_ptc_fin_kirby_effect_44 = 0xe6003a, + ef_ptc_fin_kirby_effect_45 = 0xe6003b, + ef_ptc_fin_kirby_effect_46 = 0xe6003c, + ef_ptc_fin_kirby_effect_47 = 0xe6003d, + ef_ptc_fin_kirby_effect_48 = 0xe6003e, + ef_ptc_fin_kirby_effect_49 = 0xe6003f, + ef_ptc_fin_kirby_effect_50 = 0xe60040, + ef_ptc_fin_kirby_effect_51 = 0xe60041, + ef_ptc_fin_kirby_effect_52 = 0xe60042, + ef_ptc_fin_kirby_effect_53 = 0xe60043, + ef_ptc_fin_kirby_effect_54 = 0xe60044, + ef_ptc_fin_kirby_effect_55 = 0xe60045, + ef_ptc_fin_kirby_effect_56 = 0xe60046, + ef_ptc_fin_kirby_effect_57 = 0xe60047, + ef_ptc_fin_kirby_effect_58 = 0xe60048, + ef_ptc_fin_kirby_effect_59 = 0xe60049, + ef_ptc_fin_kirby_effect_60 = 0xe6004a, + ef_ptc_fin_kirby_effect_61 = 0xe6004b, + ef_ptc_fin_kirby_effect_62 = 0xe6004c, + ef_ptc_fin_kirby_effect_63 = 0xe6004d, + ef_ptc_fin_kirby_effect_64 = 0xe6004e, + ef_ptc_fin_kirby_effect_65 = 0xe6004f, + ef_ptc_fin_kirby_effect_66 = 0xe60050, + ef_ptc_fin_kirby_effect_67 = 0xe60051, + ef_ptc_fin_kirby_effect_68 = 0xe60052, + ef_ptc_fin_kirby_effect_69 = 0xe60053, + ef_ptc_fin_kirby_effect_70 = 0xe60054, + ef_ptc_fin_kirby_effect_71 = 0xe60055, + ef_ptc_fin_kirby_effect_72 = 0xe60056, + ef_ptc_fin_kirby_effect_73 = 0xe60057, + ef_ptc_fin_kirby_effect_74 = 0xe60058, + ef_ptc_fin_kirby_effect_75 = 0xe60059, + ef_ptc_fin_kirby_effect_76 = 0xe6005a, + ef_ptc_fin_kirby_effect_77 = 0xe6005b, + ef_ptc_fin_kirby_effect_78 = 0xe6005c, + ef_ptc_fin_kirby_effect_79 = 0xe6005d, + ef_ptc_fin_kirby_effect_80 = 0xe6005e, + ef_ptc_fin_kirby_effect_81 = 0xe6005f, + ef_ptc_fin_kirby_effect_82 = 0xe60060, + ef_ptc_fin_kirby_effect_83 = 0xe60061, + ef_ptc_fin_kirby_effect_84 = 0xe60062, + ef_ptc_fin_kirby_effect_85 = 0xe60063, + ef_ptc_fin_kirby_effect_86 = 0xe60064, + ef_ptc_fin_fox_muzzle_fire_sign = 0xe70001, + ef_ptc_fin_fox_muzzle_flash = 0xe70002, + ef_ptc_fin_fox_muzzle_flash_b = 0xe70003, + ef_ptc_fin_fox_roring = 0xe70004, + ef_ptc_fin_fox_roring_barnir = 0xe70005, + ef_ptc_fin_fox_buck_smoke = 0xe70006, + ef_ptc_fin_fox_move_smoke = 0xe70007, + ef_ptc_fin_fox_spark_01 = 0xe70008, + ef_ptc_fin_foxkakera_line = 0xe70009, + ef_ptc_fin_foxkakera_yuka = 0xe7000a, + ef_ptc_fin_fox_shoot = 0xe7000b, + ef_ptc_fin_fox_muzzle_smoke = 0xe7000c, + ef_ptc_fin_fox_act_01 = 0xe7000e, + ef_ptc_fin_fox_act_01_2 = 0xe7000f, + ef_ptc_fin_fox_act_01_3 = 0xe70010, + ef_ptc_fin_fox_act_01_4 = 0xe70011, + ef_ptc_fin_fox_act_01_5 = 0xe70012, + ef_ptc_fin_fox_act_01_6 = 0xe70013, + ef_ptc_fin_fox_act_01_7 = 0xe70014, + ef_ptc_fin_fox_act_01_8 = 0xe70015, + ef_ptc_fin_fox_act_01_9 = 0xe70016, + ef_ptc_fin_fox_act_01_10 = 0xe70017, + ef_ptc_fin_fox_act_01_11 = 0xe70018, + ef_ptc_fin_fox_act_01_12 = 0xe70019, + ef_ptc_fin_fox_act_01_13 = 0xe7001a, + ef_ptc_fin_fox_act_01_14 = 0xe7001b, + ef_ptc_fin_fox_act_01_15 = 0xe7001c, + ef_ptc_fin_fox_act_01_16 = 0xe7001d, + ef_ptc_fin_fox_act_01_17 = 0xe7001e, + ef_ptc_fin_fox_act_01_18 = 0xe7001f, + ef_ptc_fin_fox_act_01_19 = 0xe70020, + ef_ptc_fin_fox_act_01_20 = 0xe70021, + ef_ptc_fin_fox_act_01_21 = 0xe70022, + ef_ptc_fin_fox_act_01_22 = 0xe70023, + ef_ptc_fin_fox_act_01_23 = 0xe70024, + ef_ptc_fin_fox_act_01_24 = 0xe70025, + ef_ptc_fin_fox_act_01_25 = 0xe70026, + ef_ptc_fin_fox_act_01_26 = 0xe70027, + ef_ptc_fin_fox_act_01_27 = 0xe70028, + ef_ptc_fin_fox_act_01_28 = 0xe70029, + ef_ptc_fin_fox_act_01_29 = 0xe7002a, + ef_ptc_fin_fox_act_01_30 = 0xe7002b, + ef_ptc_fin_fox_act_01_31 = 0xe7002c, + ef_ptc_fin_fox_act_01_32 = 0xe7002d, + ef_ptc_fin_fox_act_01_33 = 0xe7002e, + ef_ptc_fin_fox_act_01_34 = 0xe7002f, + ef_ptc_fin_fox_act_01_35 = 0xe70030, + ef_ptc_fin_fox_act_01_36 = 0xe70031, + ef_ptc_fin_fox_act_01_37 = 0xe70032, + ef_ptc_fin_fox_act_01_38 = 0xe70033, + ef_ptc_fin_fox_act_01_39 = 0xe70034, + ef_ptc_fin_fox_act_01_40 = 0xe70035, + ef_ptc_fin_fox_act_01_41 = 0xe70036, + ef_ptc_fin_fox_act_01_42 = 0xe70037, + ef_ptc_fin_fox_act_01_43 = 0xe70038, + ef_ptc_fin_fox_act_01_44 = 0xe70039, + ef_ptc_fin_fox_act_01_45 = 0xe7003a, + ef_ptc_fin_fox_act_01_46 = 0xe7003b, + ef_ptc_fin_fox_act_01_47 = 0xe7003c, + ef_ptc_fin_fox_act_01_48 = 0xe7003d, + ef_ptc_fin_fox_act_01_49 = 0xe7003e, + ef_ptc_fin_fox_act_01_50 = 0xe7003f, + ef_ptc_fin_fox_act_01_51 = 0xe70040, + ef_ptc_fin_fox_act_01_52 = 0xe70041, + ef_ptc_fin_fox_act_01_53 = 0xe70042, + ef_ptc_fin_fox_act_01_54 = 0xe70043, + ef_ptc_fin_fox_act_01_55 = 0xe70044, + ef_ptc_fin_fox_act_01_56 = 0xe70045, + ef_ptc_fin_fox_act_01_57 = 0xe70046, + ef_ptc_fin_fox_act_01_58 = 0xe70047, + ef_ptc_fin_fox_act_01_59 = 0xe70048, + ef_ptc_fin_fox_act_01_60 = 0xe70049, + ef_ptc_fin_fox_act_01_61 = 0xe7004a, + ef_ptc_fin_fox_act_01_62 = 0xe7004b, + ef_ptc_fin_fox_act_01_63 = 0xe7004c, + ef_ptc_fin_fox_act_01_64 = 0xe7004d, + ef_ptc_fin_fox_act_01_65 = 0xe7004e, + ef_ptc_fin_fox_act_01_66 = 0xe7004f, + ef_ptc_fin_fox_act_01_67 = 0xe70050, + ef_ptc_fin_fox_act_01_68 = 0xe70051, + ef_ptc_fin_fox_act_01_69 = 0xe70052, + ef_ptc_fin_fox_act_01_70 = 0xe70053, + ef_ptc_fin_fox_act_01_71 = 0xe70054, + ef_ptc_fin_fox_act_01_72 = 0xe70055, + ef_ptc_fin_fox_act_01_73 = 0xe70056, + ef_ptc_fin_fox_act_01_74 = 0xe70057, + ef_ptc_fin_fox_act_01_75 = 0xe70058, + ef_ptc_fin_fox_act_01_76 = 0xe70059, + ef_ptc_fin_fox_act_01_77 = 0xe7005a, + ef_ptc_fin_fox_act_01_78 = 0xe7005b, + ef_ptc_fin_fox_act_01_79 = 0xe7005c, + ef_ptc_fin_fox_act_01_80 = 0xe7005d, + ef_ptc_fin_fox_act_01_81 = 0xe7005e, + ef_ptc_fin_fox_act_01_82 = 0xe7005f, + ef_ptc_fin_fox_act_01_83 = 0xe70060, + ef_ptc_fin_fox_act_01_84 = 0xe70061, + ef_ptc_fin_fox_act_01_85 = 0xe70062, + ef_ptc_fin_fox_act_01_86 = 0xe70063, + ef_ptc_fin_fox_act_01_87 = 0xe70064, + ef_ptc_fin_pikachu_act_01 = 0xe80001, + ef_ptc_fin_pikachu_act_02 = 0xe80002, + ef_ptc_fin_pikachu_act_03 = 0xe80003, + ef_ptc_fin_pikachu_act_01_2 = 0xe80004, + ef_ptc_fin_pikachu_act_01_3 = 0xe80005, + ef_ptc_fin_pikachu_act_01_4 = 0xe80006, + ef_ptc_fin_pikachu_act_01_5 = 0xe80007, + ef_ptc_fin_pikachu_act_01_6 = 0xe80008, + ef_ptc_fin_pikachu_act_01_7 = 0xe80009, + ef_ptc_fin_pikachu_act_01_8 = 0xe8000a, + ef_ptc_fin_pikachu_act_01_9 = 0xe8000b, + ef_ptc_fin_pikachu_act_01_10 = 0xe8000c, + ef_ptc_fin_pikachu_act_01_11 = 0xe8000d, + ef_ptc_fin_pikachu_act_01_12 = 0xe8000e, + ef_ptc_fin_pikachu_act_01_13 = 0xe8000f, + ef_ptc_fin_pikachu_act_01_14 = 0xe80010, + ef_ptc_fin_pikachu_act_01_15 = 0xe80011, + ef_ptc_fin_pikachu_act_01_16 = 0xe80012, + ef_ptc_fin_pikachu_act_01_17 = 0xe80013, + ef_ptc_fin_pikachu_act_01_18 = 0xe80014, + ef_ptc_fin_pikachu_act_01_19 = 0xe80015, + ef_ptc_fin_pikachu_act_01_20 = 0xe80016, + ef_ptc_fin_pikachu_act_01_21 = 0xe80017, + ef_ptc_fin_pikachu_act_01_22 = 0xe80018, + ef_ptc_fin_pikachu_act_01_23 = 0xe80019, + ef_ptc_fin_pikachu_act_01_24 = 0xe8001a, + ef_ptc_fin_pikachu_act_01_25 = 0xe8001b, + ef_ptc_fin_pikachu_act_01_26 = 0xe8001c, + ef_ptc_fin_pikachu_act_01_27 = 0xe8001d, + ef_ptc_fin_pikachu_act_01_28 = 0xe8001e, + ef_ptc_fin_captain_bunner_a = 0xea0001, + ef_ptc_fin_captain_bunner_b = 0xea0002, + ef_ptc_fin_captain_line_a = 0xea0003, + ef_ptc_fin_captain_line_b = 0xea0004, + ef_ptc_fin_ness_main = 0xeb0001, + ef_ptc_fin_koopa_change = 0xec0001, + ef_ptc_fin_peach_sakura_01 = 0xed0001, + ef_ptc_fin_peach_sakura_02 = 0xed0002, + ef_ptc_fin_peach_sakura_scr = 0xed0003, + ef_ptc_fin_peach_lip_hart = 0xed0004, + ef_ptc_fin_peach_light = 0xed0005, + ef_ptc_fin_peach_bit = 0xed0006, + ef_ptc_fin_peach = 0xed0007, + ef_ptc_fin_peach_2 = 0xed0008, + ef_ptc_fin_peach_3 = 0xed0009, + ef_ptc_fin_peach_4 = 0xed000b, + ef_ptc_fin_peach_5 = 0xed000c, + ef_ptc_fin_peach_6 = 0xed000d, + ef_ptc_fin_peach_7 = 0xed000e, + ef_ptc_fin_peach_8 = 0xed000f, + ef_ptc_fin_peach_9 = 0xed0010, + ef_ptc_fin_peach_10 = 0xed0011, + ef_ptc_fin_peach_11 = 0xed0012, + ef_ptc_fin_peach_12 = 0xed0013, + ef_ptc_fin_peach_13 = 0xed0014, + ef_ptc_fin_peach_14 = 0xed0015, + ef_ptc_fin_peach_15 = 0xed0016, + ef_ptc_fin_peach_16 = 0xed0017, + ef_ptc_fin_peach_17 = 0xed0018, + ef_ptc_fin_peach_18 = 0xed0019, + ef_ptc_fin_peach_19 = 0xed001a, + ef_ptc_fin_peach_20 = 0xed001b, + ef_ptc_fin_peach_21 = 0xed001c, + ef_ptc_fin_peach_22 = 0xed001d, + ef_ptc_fin_peach_23 = 0xed001e, + ef_ptc_fin_zelda_lightning = 0xee0001, + ef_ptc_fin_zelda_ring = 0xee0002, + ef_ptc_fin_zelda_hand = 0xee0003, + ef_ptc_fin_zelda_shoot = 0xee0004, + ef_ptc_fin_zelda_sign = 0xee0005, + ef_ptc_zelda_shoot_oura = 0xee0006, + ef_ptc_fin_zelda_act_01 = 0xee0007, + ef_ptc_fin_zelda_act_01_2 = 0xee0008, + ef_ptc_fin_zelda_act_01_3 = 0xee0009, + ef_ptc_fin_zelda_act_01_4 = 0xee000a, + ef_ptc_fin_zelda_act_01_5 = 0xee000b, + ef_ptc_fin_zelda_act_01_6 = 0xee000c, + ef_ptc_fin_zelda_act_01_7 = 0xee000d, + ef_ptc_fin_zelda_act_01_8 = 0xee000e, + ef_ptc_fin_zelda_act_01_9 = 0xee000f, + ef_ptc_fin_zelda_act_01_10 = 0xee0010, + ef_ptc_fin_zelda_act_01_11 = 0xee0011, + ef_ptc_fin_zelda_act_01_12 = 0xee0012, + ef_ptc_fin_zelda_act_01_13 = 0xee0013, + ef_ptc_fin_zelda_act_01_14 = 0xee0014, + ef_ptc_fin_zelda_act_01_15 = 0xee0015, + ef_ptc_fin_zelda_act_01_16 = 0xee0016, + ef_ptc_fin_zelda_act_01_17 = 0xee0017, + ef_ptc_fin_zelda_act_01_18 = 0xee0018, + ef_ptc_fin_zelda_act_01_19 = 0xee0019, + ef_ptc_fin_zelda_act_01_20 = 0xee001a, + ef_ptc_fin_zelda_act_01_21 = 0xee001b, + ef_ptc_fin_zelda_act_01_22 = 0xee001c, + ef_ptc_fin_zelda_act_01_23 = 0xee001d, + ef_ptc_fin_zelda_act_01_24 = 0xee001e, + ef_ptc_fin_zelda_act_01_25 = 0xee001f, + ef_ptc_fin_zelda_act_01_26 = 0xee0020, + ef_ptc_fin_zelda_act_01_27 = 0xee0021, + ef_ptc_fin_zelda_act_01_28 = 0xee0022, + ef_ptc_fin_zelda_act_01_29 = 0xee0023, + ef_ptc_fin_zelda_act_01_30 = 0xee0024, + ef_ptc_fin_zelda_act_01_31 = 0xee0025, + ef_ptc_fin_zelda_act_01_32 = 0xee0026, + ef_ptc_fin_zelda_act_01_33 = 0xee0027, + ef_ptc_fin_zelda_act_01_34 = 0xee0028, + ef_ptc_fin_zelda_act_01_35 = 0xee0029, + ef_ptc_fin_zelda_act_01_36 = 0xee002a, + ef_ptc_fin_zelda_act_01_37 = 0xee002b, + ef_ptc_fin_zelda_act_01_38 = 0xee002c, + ef_ptc_fin_zelda_act_01_39 = 0xee002d, + ef_ptc_fin_zelda_act_01_40 = 0xee002e, + ef_ptc_fin_zelda_act_01_41 = 0xee002f, + ef_ptc_fin_zelda_act_01_42 = 0xee0030, + ef_ptc_fin_zelda_act_01_43 = 0xee0031, + ef_ptc_fin_zelda_act_01_44 = 0xee0032, + ef_ptc_fin_zelda_act_01_45 = 0xee0033, + ef_ptc_fin_zelda_act_01_46 = 0xee0034, + ef_ptc_fin_zelda_act_01_47 = 0xee0035, + ef_ptc_fin_zelda_act_01_48 = 0xee0036, + ef_ptc_fin_zelda_act_01_49 = 0xee0037, + ef_ptc_fin_zelda_act_01_50 = 0xee0038, + ef_ptc_fin_zelda_act_01_51 = 0xee0039, + ef_ptc_fin_zelda_act_01_52 = 0xee003a, + ef_ptc_fin_zelda_act_01_53 = 0xee003b, + ef_ptc_fin_zelda_act_01_54 = 0xee003c, + ef_ptc_fin_zelda_act_01_55 = 0xee003d, + ef_ptc_fin_zelda_act_01_56 = 0xee003e, + ef_ptc_fin_zelda_act_01_57 = 0xee003f, + ef_ptc_fin_zelda_act_01_58 = 0xee0040, + ef_ptc_fin_zelda_act_01_59 = 0xee0041, + ef_ptc_fin_zelda_act_01_60 = 0xee0042, + ef_ptc_fin_zelda_act_01_61 = 0xee0043, + ef_ptc_fin_zelda_act_01_62 = 0xee0044, + ef_ptc_fin_zelda_act_01_63 = 0xee0045, + ef_ptc_fin_zelda_act_01_64 = 0xee0046, + ef_ptc_fin_zelda_act_01_65 = 0xee0047, + ef_ptc_fin_zelda_act_01_66 = 0xee0048, + ef_ptc_fin_zelda_act_01_67 = 0xee0049, + ef_ptc_fin_zelda_act_01_68 = 0xee004a, + ef_ptc_fin_zelda_act_01_69 = 0xee004b, + ef_ptc_fin_zelda_act_01_70 = 0xee004c, + ef_ptc_fin_zelda_act_01_71 = 0xee004d, + ef_ptc_fin_zelda_act_01_72 = 0xee004e, + ef_ptc_fin_zelda_act_01_73 = 0xee004f, + ef_ptc_fin_zelda_act_01_74 = 0xee0050, + ef_ptc_fin_zelda_act_01_75 = 0xee0051, + ef_ptc_fin_zelda_act_01_76 = 0xee0052, + ef_ptc_fin_zelda_act_01_77 = 0xee0053, + ef_ptc_fin_zelda_act_01_78 = 0xee0054, + ef_ptc_fin_zelda_act_01_79 = 0xee0055, + ef_ptc_fin_zelda_act_01_80 = 0xee0056, + ef_ptc_fin_zelda_act_01_81 = 0xee0057, + ef_ptc_fin_zelda_act_01_82 = 0xee0058, + ef_ptc_fin_zelda_act_01_83 = 0xee0059, + ef_ptc_fin_zelda_act_01_84 = 0xee005a, + ef_ptc_fin_zelda_act_01_85 = 0xee005b, + ef_ptc_fin_zelda_act_01_86 = 0xee005c, + ef_ptc_fin_zelda_act_01_87 = 0xee005d, + ef_ptc_fin_zelda_act_01_88 = 0xee005e, + ef_ptc_fin_zelda_act_01_89 = 0xee005f, + ef_ptc_fin_zelda_act_01_90 = 0xee0060, + ef_ptc_fin_zelda_act_01_91 = 0xee0061, + ef_ptc_fin_zelda_act_01_92 = 0xee0062, + ef_ptc_fin_zelda_act_01_93 = 0xee0063, + ef_ptc_fin_zelda_act_01_94 = 0xee0064, + ef_ptc_fin_iceclimber_kml_start_1 = 0xef0001, + ef_ptc_fin_iceclimber_dust_start_1 = 0xef0002, + ef_ptc_fin_iceclimber_eft = 0xef0003, + ef_ptc_fin_iceclimber_eft_2 = 0xef0004, + ef_ptc_fin_iceclimber_eft_3 = 0xef0005, + ef_ptc_fin_iceclimber_eft_4 = 0xef0006, + ef_ptc_fin_iceclimber_eft_5 = 0xef0007, + ef_ptc_fin_iceclimber_eft_6 = 0xef0008, + ef_ptc_fin_iceclimber_eft_7 = 0xef0009, + ef_ptc_fin_iceclimber_kml_loop_1 = 0xef000a, + ef_ptc_fin_iceclimber_dust_loop_1 = 0xef000b, + ef_ptc_fin_iceclimber_eft_8 = 0xef000c, + ef_ptc_fin_iceclimber_eft_9 = 0xef000d, + ef_ptc_fin_iceclimber_eft_10 = 0xef000e, + ef_ptc_fin_iceclimber_eft_11 = 0xef000f, + ef_ptc_fin_iceclimber_eft_12 = 0xef0010, + ef_ptc_fin_iceclimber_eft_13 = 0xef0011, + ef_ptc_fin_iceclimber_eft_14 = 0xef0012, + ef_ptc_fin_iceclimber_eft_15 = 0xef0013, + ef_ptc_fin_iceclimber_kml_end_1 = 0xef0014, + ef_ptc_fin_iceclimber_dust_end_1 = 0xef0015, + ef_ptc_fin_iceclimber_eft_16 = 0xef0016, + ef_ptc_fin_iceclimber_eft_17 = 0xef0017, + ef_ptc_fin_iceclimber_eft_18 = 0xef0018, + ef_ptc_fin_iceclimber_eft_19 = 0xef0019, + ef_ptc_fin_iceclimber_eft_20 = 0xef001a, + ef_ptc_fin_iceclimber_eft_21 = 0xef001b, + ef_ptc_fin_iceclimber_eft_22 = 0xef001c, + ef_ptc_fin_iceclimber_eft_23 = 0xef001d, + ef_ptc_fin_iceclimber_eft_24 = 0xef001e, + ef_ptc_fin_iceclimber_eft_25 = 0xef001f, + ef_ptc_fin_iceclimber_eft_26 = 0xef0020, + ef_ptc_fin_iceclimber_eft_27 = 0xef0021, + ef_ptc_fin_iceclimber_eft_28 = 0xef0022, + ef_ptc_fin_iceclimber_eft_29 = 0xef0023, + ef_ptc_fin_iceclimber_eft_30 = 0xef0024, + ef_ptc_fin_iceclimber_eft_31 = 0xef0025, + ef_ptc_fin_iceclimber_eft_32 = 0xef0026, + ef_ptc_fin_iceclimber_eft_33 = 0xef0027, + ef_ptc_fin_iceclimber_eft_34 = 0xef0028, + ef_ptc_fin_iceclimber_eft_35 = 0xef0029, + ef_ptc_fin_iceclimber_eft_36 = 0xef002a, + ef_ptc_fin_iceclimber_eft_37 = 0xef002b, + ef_ptc_fin_iceclimber_eft_38 = 0xef002c, + ef_ptc_fin_iceclimber_eft_39 = 0xef002d, + ef_ptc_fin_iceclimber_eft_40 = 0xef002e, + ef_ptc_fin_iceclimber_eft_41 = 0xef002f, + ef_ptc_fin_iceclimber_eft_42 = 0xef0030, + ef_ptc_fin_iceclimber_eft_43 = 0xef0031, + ef_ptc_fin_iceclimber_eft_44 = 0xef0032, + ef_ptc_fin_iceclimber_eft_45 = 0xef0033, + ef_ptc_fin_iceclimber_eft_46 = 0xef0034, + ef_ptc_fin_iceclimber_eft_47 = 0xef0035, + ef_ptc_fin_iceclimber_eft_48 = 0xef0036, + ef_ptc_fin_iceclimber_eft_49 = 0xef0037, + ef_ptc_fin_iceclimber_eft_50 = 0xef0038, + ef_ptc_fin_iceclimber_eft_51 = 0xef0039, + ef_ptc_fin_iceclimber_eft_52 = 0xef003a, + ef_ptc_fin_iceclimber_eft_53 = 0xef003b, + ef_ptc_fin_iceclimber_eft_54 = 0xef003c, + ef_ptc_fin_iceclimber_eft_55 = 0xef003d, + ef_ptc_fin_iceclimber_eft_56 = 0xef003e, + ef_ptc_fin_iceclimber_eft_57 = 0xef003f, + ef_ptc_fin_iceclimber_eft_58 = 0xef0040, + ef_ptc_fin_iceclimber_eft_59 = 0xef0041, + ef_ptc_fin_iceclimber_eft_60 = 0xef0042, + ef_ptc_fin_iceclimber_eft_61 = 0xef0043, + ef_ptc_fin_iceclimber_eft_62 = 0xef0044, + ef_ptc_fin_iceclimber_eft_63 = 0xef0045, + ef_ptc_fin_iceclimber_eft_64 = 0xef0046, + ef_ptc_fin_iceclimber_eft_65 = 0xef0047, + ef_ptc_fin_iceclimber_eft_66 = 0xef0048, + ef_ptc_fin_iceclimber_eft_67 = 0xef0049, + ef_ptc_fin_iceclimber_eft_68 = 0xef004a, + ef_ptc_fin_iceclimber_eft_69 = 0xef004b, + ef_ptc_fin_iceclimber_eft_70 = 0xef004c, + ef_ptc_fin_iceclimber_eft_71 = 0xef004d, + ef_ptc_fin_iceclimber_eft_72 = 0xef004e, + ef_ptc_fin_iceclimber_eft_73 = 0xef004f, + ef_ptc_fin_iceclimber_eft_74 = 0xef0050, + ef_ptc_fin_iceclimber_eft_75 = 0xef0051, + ef_ptc_fin_iceclimber_eft_76 = 0xef0052, + ef_ptc_fin_iceclimber_eft_77 = 0xef0053, + ef_ptc_fin_iceclimber_eft_78 = 0xef0054, + ef_ptc_fin_iceclimber_eft_79 = 0xef0055, + ef_ptc_fin_iceclimber_eft_80 = 0xef0056, + ef_ptc_fin_iceclimber_eft_81 = 0xef0057, + ef_ptc_fin_iceclimber_eft_82 = 0xef0058, + ef_ptc_fin_iceclimber_eft_83 = 0xef0059, + ef_ptc_fin_iceclimber_eft_84 = 0xef005a, + ef_ptc_fin_iceclimber_eft_85 = 0xef005b, + ef_ptc_fin_iceclimber_eft_86 = 0xef005c, + ef_ptc_fin_iceclimber_eft_87 = 0xef005d, + ef_ptc_fin_iceclimber_eft_88 = 0xef005e, + ef_ptc_fin_iceclimber_eft_89 = 0xef005f, + ef_ptc_fin_iceclimber_eft_90 = 0xef0060, + ef_ptc_fin_iceclimber_eft_91 = 0xef0061, + ef_ptc_fin_iceclimber_eft_92 = 0xef0062, + ef_ptc_fin_iceclimber_eft_93 = 0xef0063, + ef_ptc_fin_iceclimber_eft_94 = 0xef0064, + ef_ptc_fin_marth_start_kira = 0xf00001, + ef_ptc_fin_marth_lens_flare = 0xf00002, + ef_ptc_fin_marth_sword = 0xf00003, + ef_ptc_fin_marth_hit_01 = 0xf00004, + ef_ptc_fin_marth_run = 0xf00005, + ef_ptc_fin_marth_hit_end = 0xf00006, + ef_ptc_fin_marth_hit_01_2 = 0xf00007, + ef_ptc_fin_marth_hit_01_3 = 0xf00008, + ef_ptc_fin_marth_hit_01_4 = 0xf00009, + ef_ptc_fin_marth_hit_01_5 = 0xf0000a, + ef_ptc_fin_marth_hit_01_6 = 0xf0000b, + ef_ptc_fin_marth_hit_01_7 = 0xf0000c, + ef_ptc_fin_marth_hit_01_8 = 0xf0000d, + ef_ptc_fin_marth_hit_01_9 = 0xf0000e, + ef_ptc_fin_marth_hit_01_10 = 0xf0000f, + ef_ptc_fin_marth_hit_01_11 = 0xf00010, + ef_ptc_fin_marth_hit_01_12 = 0xf00011, + ef_ptc_fin_marth_hit_01_13 = 0xf00012, + ef_ptc_fin_marth_hit_01_14 = 0xf00013, + ef_ptc_fin_marth_hit_01_15 = 0xf00014, + ef_ptc_fin_marth_hit_01_16 = 0xf00015, + ef_ptc_fin_marth_hit_01_17 = 0xf00016, + ef_ptc_fin_marth_hit_01_18 = 0xf00017, + ef_ptc_fin_marth_hit_01_19 = 0xf00018, + ef_ptc_fin_marth_hit_01_20 = 0xf00019, + ef_ptc_fin_marth_hit_01_21 = 0xf0001a, + ef_ptc_fin_marth_hit_01_22 = 0xf0001b, + ef_ptc_fin_marth_hit_01_23 = 0xf0001c, + ef_ptc_fin_marth_hit_01_24 = 0xf0001d, + ef_ptc_fin_marth_hit_01_25 = 0xf0001e, + ef_ptc_fin_gamewatch_act_01 = 0xf10001, + ef_ptc_fin_gamewatch_act_01_2 = 0xf10002, + ef_ptc_fin_gamewatch_act_01_3 = 0xf10003, + ef_ptc_fin_gamewatch_act_01_4 = 0xf10004, + ef_ptc_fin_gamewatch_act_01_5 = 0xf10005, + ef_ptc_fin_gamewatch_act_01_6 = 0xf10006, + ef_ptc_fin_gamewatch_act_01_7 = 0xf10007, + ef_ptc_fin_gamewatch_act_01_8 = 0xf10008, + ef_ptc_fin_gamewatch_act_01_9 = 0xf10009, + ef_ptc_fin_gamewatch_act_01_10 = 0xf1000a, + ef_ptc_fin_gamewatch_act_01_11 = 0xf1000b, + ef_ptc_fin_gamewatch_act_01_12 = 0xf1000c, + ef_ptc_fin_gamewatch_act_01_13 = 0xf1000d, + ef_ptc_fin_gamewatch_act_01_14 = 0xf1000e, + ef_ptc_fin_gamewatch_act_01_15 = 0xf1000f, + ef_ptc_fin_gamewatch_act_01_16 = 0xf10010, + ef_ptc_fin_gamewatch_act_01_17 = 0xf10011, + ef_ptc_fin_gamewatch_act_01_18 = 0xf10012, + ef_ptc_fin_gamewatch_act_01_19 = 0xf10013, + ef_ptc_fin_gamewatch_act_01_20 = 0xf10014, + ef_ptc_fin_gamewatch_act_01_21 = 0xf10015, + ef_ptc_fin_gamewatch_act_01_22 = 0xf10016, + ef_ptc_fin_gamewatch_act_01_23 = 0xf10017, + ef_ptc_fin_gamewatch_act_01_24 = 0xf10018, + ef_ptc_fin_gamewatch_act_01_25 = 0xf10019, + ef_ptc_fin_gamewatch_act_01_26 = 0xf1001a, + ef_ptc_fin_gamewatch_act_01_27 = 0xf1001b, + ef_ptc_fin_gamewatch_act_01_28 = 0xf1001c, + ef_ptc_fin_gamewatch_act_01_29 = 0xf1001d, + ef_ptc_fin_gamewatch_act_01_30 = 0xf1001e, + ef_ptc_fin_gamewatch_act_01_31 = 0xf1001f, + ef_ptc_fin_gamewatch_act_01_32 = 0xf10020, + ef_ptc_fin_gamewatch_act_01_33 = 0xf10021, + ef_ptc_fin_gamewatch_act_01_34 = 0xf10022, + ef_ptc_fin_gamewatch_act_01_35 = 0xf10023, + ef_ptc_fin_gamewatch_act_01_36 = 0xf10024, + ef_ptc_fin_gamewatch_act_01_37 = 0xf10025, + ef_ptc_fin_gamewatch_act_01_38 = 0xf10026, + ef_ptc_fin_gamewatch_act_01_39 = 0xf10027, + ef_ptc_fin_gamewatch_act_01_40 = 0xf10028, + ef_ptc_fin_gamewatch_act_01_41 = 0xf10029, + ef_ptc_fin_gamewatch_act_01_42 = 0xf1002a, + ef_ptc_fin_gamewatch_act_01_43 = 0xf1002b, + ef_ptc_fin_gamewatch_act_01_44 = 0xf1002c, + ef_ptc_fin_gamewatch_act_01_45 = 0xf1002d, + ef_ptc_fin_gamewatch_act_01_46 = 0xf1002e, + ef_ptc_fin_gamewatch_act_01_47 = 0xf1002f, + ef_ptc_fin_gamewatch_act_01_48 = 0xf10030, + ef_ptc_fin_gamewatch_act_01_49 = 0xf10031, + ef_ptc_fin_gamewatch_act_01_50 = 0xf10032, + ef_ptc_fin_gamewatch_act_01_51 = 0xf10033, + ef_ptc_fin_gamewatch_act_01_52 = 0xf10034, + ef_ptc_fin_gamewatch_act_01_53 = 0xf10035, + ef_ptc_fin_gamewatch_act_01_54 = 0xf10036, + ef_ptc_fin_gamewatch_act_01_55 = 0xf10037, + ef_ptc_fin_gamewatch_act_01_56 = 0xf10038, + ef_ptc_fin_gamewatch_act_01_57 = 0xf10039, + ef_ptc_fin_gamewatch_act_01_58 = 0xf1003a, + ef_ptc_fin_gamewatch_act_01_59 = 0xf1003b, + ef_ptc_fin_gamewatch_act_01_60 = 0xf1003c, + ef_ptc_fin_gamewatch_act_01_61 = 0xf1003d, + ef_ptc_fin_gamewatch_act_01_62 = 0xf1003e, + ef_ptc_fin_gamewatch_act_01_63 = 0xf1003f, + ef_ptc_fin_gamewatch_act_01_64 = 0xf10040, + ef_ptc_fin_gamewatch_act_01_65 = 0xf10041, + ef_ptc_fin_gamewatch_act_01_66 = 0xf10042, + ef_ptc_fin_gamewatch_act_01_67 = 0xf10043, + ef_ptc_fin_gamewatch_act_01_68 = 0xf10044, + ef_ptc_fin_gamewatch_act_01_69 = 0xf10045, + ef_ptc_fin_gamewatch_act_01_70 = 0xf10046, + ef_ptc_fin_gamewatch_act_01_71 = 0xf10047, + ef_ptc_fin_gamewatch_act_01_72 = 0xf10048, + ef_ptc_fin_gamewatch_act_01_73 = 0xf10049, + ef_ptc_fin_gamewatch_act_01_74 = 0xf1004a, + ef_ptc_fin_gamewatch_act_01_75 = 0xf1004b, + ef_ptc_fin_gamewatch_act_01_76 = 0xf1004c, + ef_ptc_fin_gamewatch_act_01_77 = 0xf1004d, + ef_ptc_fin_gamewatch_act_01_78 = 0xf1004e, + ef_ptc_fin_gamewatch_act_01_79 = 0xf1004f, + ef_ptc_fin_gamewatch_act_01_80 = 0xf10050, + ef_ptc_fin_gamewatch_act_01_81 = 0xf10051, + ef_ptc_fin_gamewatch_act_01_82 = 0xf10052, + ef_ptc_fin_gamewatch_act_01_83 = 0xf10053, + ef_ptc_fin_gamewatch_act_01_84 = 0xf10054, + ef_ptc_fin_gamewatch_act_01_85 = 0xf10055, + ef_ptc_fin_gamewatch_act_01_86 = 0xf10056, + ef_ptc_fin_gamewatch_act_01_87 = 0xf10057, + ef_ptc_fin_gamewatch_act_01_88 = 0xf10058, + ef_ptc_fin_gamewatch_act_01_89 = 0xf10059, + ef_ptc_fin_gamewatch_act_01_90 = 0xf1005a, + ef_ptc_fin_gamewatch_act_01_91 = 0xf1005b, + ef_ptc_fin_gamewatch_act_01_92 = 0xf1005c, + ef_ptc_fin_gamewatch_act_01_93 = 0xf1005d, + ef_ptc_fin_gamewatch_act_01_94 = 0xf1005e, + ef_ptc_fin_gamewatch_act_01_95 = 0xf1005f, + ef_ptc_fin_gamewatch_act_01_96 = 0xf10060, + ef_ptc_fin_gamewatch_act_01_97 = 0xf10061, + ef_ptc_fin_gamewatch_act_01_98 = 0xf10062, + ef_ptc_fin_gamewatch_act_01_99 = 0xf10063, + ef_ptc_fin_gamewatch_act_01_100 = 0xf10064, + ef_ptc_fin_ganon_aura_01 = 0xf20001, + ef_ptc_fin_ganon_aura_02leg = 0xf20002, + ef_ptc_fin_ganon_aura_02hand = 0xf20003, + ef_ptc_fin_ganon_ind_01 = 0xf20004, + ef_ptc_fin_ganon_rock_01 = 0xf20005, + ef_ptc_fin_ganon_te = 0xf20006, + ef_ptc_fin_ganon_te_02 = 0xf20007, + ef_ptc_fin_ganon_dash_1 = 0xf20008, + ef_ptc_fin_ganon_attackaura_1 = 0xf20009, + ef_ptc_fin_ganon_attack_1 = 0xf2000a, + ef_ptc_fin_ganon_attack_2 = 0xf2000b, + ef_ptc_fin_ganon_attack_3 = 0xf2000c, + ef_ptc_fin_ganon_endbg = 0xf2000d, + ef_ptc_fin_ganon_end_00 = 0xf2000e, + ef_ptc_fin_ganon_end_01 = 0xf2000f, + ef_ptc_fin_ganon_aura_01_2 = 0xf20011, + ef_ptc_fin_ganon_aura_01_3 = 0xf20012, + ef_ptc_fin_ganon_aura_01_4 = 0xf20013, + ef_ptc_fin_ganon_aura_01_5 = 0xf20014, + ef_ptc_fin_ganon_aura_01_6 = 0xf20015, + ef_ptc_fin_ganon_aura_01_7 = 0xf20016, + ef_ptc_fin_ganon_aura_01_8 = 0xf20017, + ef_ptc_fin_ganon_aura_01_9 = 0xf20018, + ef_ptc_fin_ganon_aura_01_10 = 0xf20019, + ef_ptc_fin_ganon_aura_01_11 = 0xf2001a, + ef_ptc_fin_ganon_aura_01_12 = 0xf2001b, + ef_ptc_fin_ganon_aura_01_13 = 0xf2001c, + ef_ptc_fin_ganon_aura_01_14 = 0xf2001d, + ef_ptc_fin_ganon_aura_01_15 = 0xf2001e, + ef_ptc_fin_wario_goku = 0xf30001, + ef_ptc_fin_wario_goku_2 = 0xf30002, + ef_ptc_fin_wario_goku_3 = 0xf30003, + ef_ptc_fin_wario_goku_4 = 0xf30004, + ef_ptc_fin_wario_goku_5 = 0xf30005, + ef_ptc_fin_wario_goku_6 = 0xf30006, + ef_ptc_fin_wario_goku_7 = 0xf30007, + ef_ptc_fin_wario_goku_8 = 0xf30008, + ef_ptc_fin_wario_goku_9 = 0xf30009, + ef_ptc_fin_wario_goku_10 = 0xf3000a, + ef_ptc_fin_wario_goku_11 = 0xf3000b, + ef_ptc_fin_wario_goku_12 = 0xf3000c, + ef_ptc_fin_wario_goku_13 = 0xf3000d, + ef_ptc_fin_wario_goku_14 = 0xf3000e, + ef_ptc_fin_wario_goku_15 = 0xf3000f, + ef_ptc_fin_wario_goku_16 = 0xf30010, + ef_ptc_fin_wario_goku_17 = 0xf30011, + ef_ptc_fin_wario_goku_18 = 0xf30012, + ef_ptc_fin_wario_goku_19 = 0xf30013, + ef_ptc_fin_wario_goku_20 = 0xf30014, + ef_ptc_fin_wario_goku_21 = 0xf30015, + ef_ptc_fin_wario_goku_22 = 0xf30016, + ef_ptc_fin_wario_goku_23 = 0xf30017, + ef_ptc_fin_wario_goku_24 = 0xf30018, + ef_ptc_fin_wario_goku_25 = 0xf30019, + ef_ptc_fin_wario_goku_26 = 0xf3001a, + ef_ptc_fin_wario_goku_27 = 0xf3001b, + ef_ptc_fin_wario_goku_28 = 0xf3001c, + ef_ptc_fin_wario_goku_29 = 0xf3001d, + ef_ptc_fin_wario_goku_30 = 0xf3001e, + ef_ptc_fin_wario_goku_31 = 0xf3001f, + ef_ptc_fin_wario_goku_32 = 0xf30020, + ef_ptc_fin_wario_goku_33 = 0xf30021, + ef_ptc_fin_wario_goku_34 = 0xf30022, + ef_ptc_fin_wario_goku_35 = 0xf30023, + ef_ptc_fin_wario_goku_36 = 0xf30024, + ef_ptc_fin_wario_goku_37 = 0xf30025, + ef_ptc_fin_wario_goku_38 = 0xf30026, + ef_ptc_fin_wario_goku_39 = 0xf30027, + ef_ptc_fin_wario_goku_40 = 0xf30028, + ef_ptc_fin_wario_goku_41 = 0xf30029, + ef_ptc_fin_wario_goku_42 = 0xf3002a, + ef_ptc_fin_wario_goku_43 = 0xf3002b, + ef_ptc_fin_wario_goku_44 = 0xf3002c, + ef_ptc_fin_wario_goku_45 = 0xf3002d, + ef_ptc_fin_wario_goku_46 = 0xf3002e, + ef_ptc_fin_wario_goku_47 = 0xf3002f, + ef_ptc_fin_wario_goku_48 = 0xf30030, + ef_ptc_fin_wario_goku_49 = 0xf30031, + ef_ptc_fin_wario_goku_50 = 0xf30032, + ef_ptc_fin_wario_goku_51 = 0xf30033, + ef_ptc_fin_wario_goku_52 = 0xf30034, + ef_ptc_fin_wario_goku_53 = 0xf30035, + ef_ptc_fin_wario_goku_54 = 0xf30036, + ef_ptc_fin_wario_goku_55 = 0xf30037, + ef_ptc_fin_wario_goku_56 = 0xf30038, + ef_ptc_fin_wario_goku_57 = 0xf30039, + ef_ptc_fin_wario_goku_58 = 0xf3003a, + ef_ptc_fin_wario_goku_59 = 0xf3003b, + ef_ptc_fin_wario_goku_60 = 0xf3003c, + ef_ptc_fin_wario_goku_61 = 0xf3003d, + ef_ptc_fin_wario_goku_62 = 0xf3003e, + ef_ptc_fin_wario_goku_63 = 0xf3003f, + ef_ptc_fin_wario_goku_64 = 0xf30040, + ef_ptc_fin_wario_goku_65 = 0xf30041, + ef_ptc_fin_wario_goku_66 = 0xf30042, + ef_ptc_fin_wario_goku_67 = 0xf30043, + ef_ptc_fin_wario_goku_68 = 0xf30044, + ef_ptc_fin_wario_goku_69 = 0xf30045, + ef_ptc_fin_wario_goku_70 = 0xf30046, + ef_ptc_fin_wario_goku_71 = 0xf30047, + ef_ptc_fin_wario_goku_72 = 0xf30048, + ef_ptc_fin_wario_goku_73 = 0xf30049, + ef_ptc_fin_wario_goku_74 = 0xf3004a, + ef_ptc_fin_wario_goku_75 = 0xf3004b, + ef_ptc_fin_wario_goku_76 = 0xf3004c, + ef_ptc_fin_wario_goku_77 = 0xf3004d, + ef_ptc_fin_wario_goku_78 = 0xf3004e, + ef_ptc_fin_wario_goku_79 = 0xf3004f, + ef_ptc_fin_wario_goku_80 = 0xf30050, + ef_ptc_fin_wario_goku_81 = 0xf30051, + ef_ptc_fin_wario_goku_82 = 0xf30052, + ef_ptc_fin_wario_goku_83 = 0xf30053, + ef_ptc_fin_wario_goku_84 = 0xf30054, + ef_ptc_fin_wario_goku_85 = 0xf30055, + ef_ptc_fin_wario_goku_86 = 0xf30056, + ef_ptc_fin_wario_goku_87 = 0xf30057, + ef_ptc_fin_wario_goku_88 = 0xf30058, + ef_ptc_fin_wario_goku_89 = 0xf30059, + ef_ptc_fin_wario_goku_90 = 0xf3005a, + ef_ptc_fin_wario_goku_91 = 0xf3005b, + ef_ptc_fin_wario_goku_92 = 0xf3005c, + ef_ptc_fin_wario_goku_93 = 0xf3005d, + ef_ptc_fin_wario_goku_94 = 0xf3005e, + ef_ptc_fin_wario_goku_95 = 0xf3005f, + ef_ptc_fin_wario_goku_96 = 0xf30060, + ef_ptc_fin_wario_goku_97 = 0xf30061, + ef_ptc_fin_wario_goku_98 = 0xf30062, + ef_ptc_fin_wario_goku_99 = 0xf30063, + ef_ptc_fin_wario_goku_100 = 0xf30064, + ef_ptc_fin_metaknight_hit = 0xf40002, + ef_ptc_fin_pit_ikaros_trace = 0xf50001, + ef_ptc_fin_szerosuit_main = 0xf60001, + ef_ptc_fin_szerosuit_end = 0xf60002, + ef_ptc_fin_szerosuit_change_flash = 0xf60003, + ef_ptc_fin_szerosuit_main_2 = 0xf60004, + ef_ptc_fin_pikmin_main = 0xf70001, + ef_ptc_fin_pikmin_rise_jet = 0xf70002, + ef_ptc_fin_pikmin_fall_jet = 0xf70003, + ef_ptc_fin_lucas_main = 0xf80001, + ef_ptc_fin_diddy_jet_s = 0xf90001, + ef_ptc_fin_diddy_jet_l = 0xf90002, + ef_ptc_fin_diddy_bomb = 0xf90003, + ef_ptc_fin_diddy_shoot = 0xf90004, + ef_ptc_fin_pt_g_fire_daimonji = 0xfa0001, + ef_ptc_fin_pt_g_fire_shoot = 0xfa0002, + ef_ptc_fin_pt_g_fire_breath = 0xfa0003, + ef_ptc_fin_pt_z_mizuteppo_shoot = 0xfa0004, + ef_ptc_fin_pt_h_beem01 = 0xfa0005, + ef_ptc_fin_poke_trainer_act_01 = 0xfa0006, + ef_ptc_fin_poke_trainer_act_01_2 = 0xfa0007, + ef_ptc_fin_poke_trainer_act_01_3 = 0xfa0008, + ef_ptc_fin_poke_trainer_act_01_4 = 0xfa0009, + ef_ptc_fin_poke_trainer_act_01_5 = 0xfa000a, + ef_ptc_fin_poke_trainer_act_01_6 = 0xfa000b, + ef_ptc_fin_poke_trainer_act_01_7 = 0xfa000c, + ef_ptc_fin_poke_trainer_act_01_8 = 0xfa000d, + ef_ptc_fin_poke_trainer_act_01_9 = 0xfa000e, + ef_ptc_fin_poke_trainer_act_01_10 = 0xfa000f, + ef_ptc_fin_poke_trainer_act_01_11 = 0xfa0010, + ef_ptc_fin_poke_trainer_act_01_12 = 0xfa0011, + ef_ptc_fin_poke_trainer_act_01_13 = 0xfa0012, + ef_ptc_fin_poke_trainer_act_01_14 = 0xfa0013, + ef_ptc_fin_poke_trainer_act_01_15 = 0xfa0015, + ef_ptc_fin_poke_trainer_act_01_16 = 0xfa0016, + ef_ptc_fin_poke_trainer_act_01_17 = 0xfa0017, + ef_ptc_fin_poke_trainer_act_01_18 = 0xfa0018, + ef_ptc_fin_poke_trainer_act_01_19 = 0xfa0019, + ef_ptc_fin_poke_trainer_act_01_20 = 0xfa001a, + ef_ptc_fin_poke_trainer_act_01_21 = 0xfa001b, + ef_ptc_fin_poke_trainer_act_01_22 = 0xfa001c, + ef_ptc_fin_poke_trainer_act_01_23 = 0xfa001d, + ef_ptc_fin_poke_trainer_act_01_24 = 0xfa001e, + ef_ptc_fin_lucario_hold = 0xfc0002, + ef_ptc_fin_lucario_hit_ground = 0xfc0003, + ef_ptc_fin_ike_fall = 0xfd0002, + ef_ptc_fin_ike_start = 0xfd0003, + ef_ptc_fin_ike_end = 0xfd0004, + ef_ptc_fin_ike_fall_sword_flare = 0xfd0005, + ef_ptc_fin_ike_cloud = 0xfd0006, + ef_ptc_fin_ike_jump = 0xfd0007, + ef_ptc_fin_purin_main = 0xff0001, + ef_ptc_fin_wolf_muzzle_fire_sign = 0x1000001, + ef_ptc_fin_wolf_muzzle_flash = 0x1000002, + ef_ptc_fin_wolf_muzzle_flash_b = 0x1000003, + ef_ptc_fin_wolf_roring = 0x1000004, + ef_ptc_fin_wolf_roring_barnir = 0x1000005, + ef_ptc_fin_wolf_buck_smoke = 0x1000006, + ef_ptc_fin_wolf_move_smoke = 0x1000007, + ef_ptc_fin_wolf_spark_01 = 0x1000008, + ef_ptc_fin_wolfkakera_line = 0x1000009, + ef_ptc_fin_wolfkakera_yuka = 0x100000a, + ef_ptc_fin_wolf_shoot = 0x100000b, + ef_ptc_fin_wolf_muzzle_smoke = 0x100000c, + ef_ptc_fin_snake_shoot = 0x1010001, + ef_ptc_fin_snake_bullet_smoke = 0x1010002, + ef_ptc_fin_snake_bomb = 0x1010003, + ef_ptc_fin_sonic_aura = 0x1020002, + ef_ptc_adv_cmn_cannon = 0x1030001, + ef_ptc_adv_cmn_fireball = 0x1030002, + ef_ptc_adv_cmn_dead = 0x1030003, + ef_ptc_adv_cmn_bullet = 0x1030004, + ef_ptc_adv_cmn_return = 0x1030005, + ef_ptc_adv_cmn_add = 0x1030006, + ef_ptc_adv_cmn_in_enem = 0x1030007, + ef_ptc_adv_cmn_change_blt = 0x1030008, + ef_ptc_adv_cmn_dead_enem = 0x1030009, + ef_ptc_adv_cmn_bullet_dead = 0x103000a, + ef_ptc_adv_cmn_save = 0x103000b, + ef_ptc_adv_cmn_warp = 0x103000c, + ef_ptc_adv_cmn_change_fig = 0x103000d, + ef_ptc_adv_cmn_change_fig_boss = 0x103000e, + ef_ptc_adv_cmn_stop = 0x103000f, + ef_ptc_adv_cmn_slow = 0x1030010, + ef_ptc_adv_cmn_slow_taboo = 0x1030011, + ef_ptc_adv_cmn_break_dead = 0x1030012, + ef_ptc_adv_cmn_power_up = 0x1030013, + ef_ptc_adv_cmn_absorb = 0x1030014, + ef_ptc_adv_cmn_lv_up = 0x1030015, + ef_ptc_adv_cmn_2_preturn = 0x1030016, + ef_ptc_adv_cmn_2_preturn_in = 0x1030017, + ef_ptc_adv_cmn_muteki = 0x1030018, + ef_ptc_adv_cmn_truck_splash = 0x1030019, + ef_ptc_adv_cmn_brick_break_nat = 0x103001a, + ef_ptc_adv_cmn_cannon_2 = 0x103001b, + ef_ptc_adv_cmn_brick_break_nat_punch = 0x103001c, + ef_ptc_adv_cmn_door_add = 0x103001d, + ef_ptc_adv_cmn_explosion_break_nat = 0x103001e, + ef_ptc_adv_cmn_brick_add = 0x103001f, + ef_ptc_adv_cmn_truck_spark = 0x1030020, + ef_ptc_adv_cmn_truck_break = 0x1030021, + ef_ptc_adv_cmn_airmine = 0x1030022, + ef_ptc_adv_cmn_switch_01 = 0x1030023, + ef_ptc_adv_cmn_explosion_break_def = 0x1030024, + ef_ptc_adv_cmn_brick_break_def = 0x1030025, + ef_ptc_adv_cmn_itembox_blue_add = 0x1030026, + ef_ptc_adv_cmn_itembox_blue_break = 0x1030027, + ef_ptc_adv_cmn_itembox_orange_add = 0x1030028, + ef_ptc_adv_cmn_itembox_orange_break = 0x1030029, + ef_ptc_adv_common_generator_break = 0x103002a, + ef_ptc_adv_cmn_wall_add = 0x103002b, + ef_ptc_adv_cmn_roof_drop_landing = 0x103002c, + ef_ptc_adv_roof_drop_landing_fortress = 0x103002d, + ef_ptc_adv_roof_drop_landing_toge = 0x103002e, + ef_ptc_adv_cmn_wall_slide = 0x103002f, + ef_ptc_adv_cmn_wall_slide_out = 0x1030030, + ef_ptc_adv_cmn_stool_break = 0x1030031, + ef_ptc_adv_cmn_brick_break_box = 0x1030032, + ef_ptc_adv_cmn_trigger_break_def = 0x1030033, + ef_ptc_adv_cmn_bullet_s = 0x1030034, + ef_ptc_adv_cmn_bullet_m = 0x1030035, + ef_ptc_adv_cmn_bullet_l = 0x1030036, + ef_ptc_adv_cmn_explosion_break_nat_2 = 0x1030037, + ef_ptc_adv_cmn_poke_return = 0x1030038, + ef_ptc_adv_cmn_poke_return_in = 0x1030039, + ef_ptc_adv_common_generator_hit = 0x103003a, + ef_ptc_adv_cmn_roof_drop = 0x103003b, + ef_ptc_adv_cmn_roof_drop_s = 0x103003c, + ef_ptc_adv_cmn_roof_drop_landing_s = 0x103003d, + ef_ptc_adv_cmn_roof_drop_l = 0x103003e, + ef_ptc_adv_cmn_roof_drop_landing_l = 0x103003f, + ef_ptc_adv_cmn_brick_break_nat_punch_yokonaga = 0x1030040, + ef_ptc_adv_cmn_brick_break_nat_punch_tatenaga = 0x1030041, + ef_ptc_adv_cmn_wall_slide_landing = 0x1030042, + ef_ptc_adv_cmn_wall_slide_landing_out = 0x1030043, + ef_ptc_adv_cmn_stool_break_cave = 0x1030044, + ef_ptc_adv_cmn_cannon_3 = 0x1030045, + ef_ptc_adv_cmn_cannon_4 = 0x1030046, + ef_ptc_adv_cmn_cannon_5 = 0x1030047, + ef_ptc_adv_cmn_cannon_6 = 0x1030048, + ef_ptc_adv_cmn_cannon_7 = 0x1030049, + ef_ptc_adv_cmn_cannon_8 = 0x103004a, + ef_ptc_adv_cmn_cannon_9 = 0x103004b, + ef_ptc_adv_cmn_cannon_10 = 0x103004c, + ef_ptc_adv_cmn_cannon_11 = 0x103004d, + ef_ptc_adv_cmn_cannon_12 = 0x103004e, + ef_ptc_adv_cmn_cannon_13 = 0x103004f, + ef_ptc_adv_cmn_cannon_14 = 0x1030050, + ef_ptc_adv_cmn_cannon_15 = 0x1030051, + ef_ptc_adv_cmn_cannon_16 = 0x1030052, + ef_ptc_adv_cmn_cannon_17 = 0x1030053, + ef_ptc_adv_cmn_cannon_18 = 0x1030054, + ef_ptc_adv_cmn_cannon_19 = 0x1030055, + ef_ptc_adv_cmn_cannon_20 = 0x1030056, + ef_ptc_adv_cmn_cannon_21 = 0x1030057, + ef_ptc_adv_cmn_cannon_22 = 0x1030058, + ef_ptc_adv_cmn_cannon_23 = 0x1030059, + ef_ptc_adv_cmn_cannon_24 = 0x103005a, + ef_ptc_adv_cmn_cannon_25 = 0x103005b, + ef_ptc_adv_cmn_cannon_26 = 0x103005c, + ef_ptc_adv_cmn_cannon_27 = 0x103005d, + ef_ptc_adv_cmn_cannon_28 = 0x103005e, + ef_ptc_adv_cmn_cannon_29 = 0x103005f, + ef_ptc_adv_cmn_cannon_30 = 0x1030060, + ef_ptc_adv_cmn_cannon_31 = 0x1030061, + ef_ptc_adv_cmn_cannon_32 = 0x1030062, + ef_ptc_adv_cmn_cannon_33 = 0x1030063, + ef_ptc_adv_cmn_cannon_34 = 0x1030064, + ef_ptc_adv_cmn_cannon_35 = 0x1030065, + ef_ptc_adv_cmn_cannon_36 = 0x1030066, + ef_ptc_adv_cmn_cannon_37 = 0x1030067, + ef_ptc_adv_cmn_cannon_38 = 0x1030068, + ef_ptc_adv_cmn_cannon_39 = 0x1030069, + ef_ptc_adv_cmn_cannon_40 = 0x103006a, + ef_ptc_adv_cmn_cannon_41 = 0x103006b, + ef_ptc_adv_cmn_cannon_42 = 0x103006c, + ef_ptc_adv_cmn_cannon_43 = 0x103006d, + ef_ptc_adv_cmn_cannon_44 = 0x103006e, + ef_ptc_adv_cmn_cannon_45 = 0x103006f, + ef_ptc_adv_cmn_cannon_46 = 0x1030070, + ef_ptc_adv_cmn_cannon_47 = 0x1030071, + ef_ptc_adv_cmn_cannon_48 = 0x1030072, + ef_ptc_adv_cmn_cannon_49 = 0x1030073, + ef_ptc_adv_cmn_cannon_50 = 0x1030074, + ef_ptc_adv_cmn_cannon_51 = 0x1030075, + ef_ptc_adv_cmn_cannon_52 = 0x1030076, + ef_ptc_adv_cmn_cannon_53 = 0x1030077, + ef_ptc_adv_cmn_cannon_54 = 0x1030078, + ef_ptc_adv_cmn_cannon_55 = 0x1030079, + ef_ptc_adv_cmn_cannon_56 = 0x103007a, + ef_ptc_adv_cmn_cannon_57 = 0x103007b, + ef_ptc_adv_cmn_cannon_58 = 0x103007c, + ef_ptc_adv_cmn_cannon_59 = 0x103007d, + ef_ptc_adv_cmn_cannon_60 = 0x103007e, + ef_ptc_adv_cmn_cannon_61 = 0x103007f, + ef_ptc_adv_cmn_cannon_62 = 0x1030080, + ef_ptc_adv_cmn_cannon_63 = 0x1030081, + ef_ptc_adv_cmn_cannon_64 = 0x1030082, + ef_ptc_adv_cmn_cannon_65 = 0x1030083, + ef_ptc_adv_cmn_cannon_66 = 0x1030084, + ef_ptc_adv_cmn_cannon_67 = 0x1030085, + ef_ptc_adv_cmn_cannon_68 = 0x1030086, + ef_ptc_adv_cmn_cannon_69 = 0x1030087, + ef_ptc_adv_cmn_cannon_70 = 0x1030088, + ef_ptc_adv_cmn_cannon_71 = 0x1030089, + ef_ptc_adv_cmn_cannon_72 = 0x103008a, + ef_ptc_adv_cmn_cannon_73 = 0x103008b, + ef_ptc_adv_cmn_cannon_74 = 0x103008c, + ef_ptc_adv_cmn_cannon_75 = 0x103008d, + ef_ptc_adv_cmn_cannon_76 = 0x103008e, + ef_ptc_adv_cmn_cannon_77 = 0x103008f, + ef_ptc_adv_cmn_cannon_78 = 0x1030090, + ef_ptc_adv_cmn_cannon_79 = 0x1030091, + ef_ptc_adv_cmn_cannon_80 = 0x1030092, + ef_ptc_adv_cmn_cannon_81 = 0x1030093, + ef_ptc_adv_cmn_cannon_82 = 0x1030094, + ef_ptc_adv_cmn_cannon_83 = 0x1030095, + ef_ptc_adv_cmn_cannon_84 = 0x1030096, + ef_ptc_adv_cmn_cannon_85 = 0x1030097, + ef_ptc_adv_cmn_cannon_86 = 0x1030098, + ef_ptc_pokemon_tosakinto = 0x1040001, + ef_ptc_pokemon_achamo = 0x1040002, + ef_ptc_pokemon_mew = 0x1040003, + ef_ptc_pokemon_entei = 0x1040006, + ef_ptc_pokemon_sirnight = 0x1040008, + ef_ptc_pokemon_jirachi = 0x1040009, + ef_ptc_pokemon_fire_01 = 0x104000a, + ef_ptc_pokemon_fire_02 = 0x104000b, + ef_ptc_pokemon_fire_03 = 0x104000c, + ef_ptc_pokemon_mew_02 = 0x104000d, + ef_ptc_pokemon_fire_04 = 0x104000e, + ef_ptc_pokemon_pochama_01 = 0x104000f, + ef_ptc_pokemon_pochama_02 = 0x1040010, + ef_ptc_pokemon_pochama_03 = 0x1040011, + ef_ptc_pokemon_manyula_01 = 0x1040012, + ef_ptc_pokemon_manyula_02 = 0x1040013, + ef_ptc_pokemon_manaphy_03 = 0x1040014, + ef_ptc_pokemon_manaphy_01 = 0x1040015, + ef_ptc_pokemon_manaphy_02 = 0x1040016, + ef_ptc_pokemon_latiaslatios_01 = 0x1040018, + ef_ptc_pokemon_latiaslatios_02 = 0x1040019, + ef_ptc_pokemon_latiaslatios_03 = 0x104001a, + ef_ptc_pokemon_kyogre_01 = 0x104001b, + ef_ptc_pokemon_kyogre_02 = 0x104001c, + ef_ptc_pokemon_fire_05 = 0x104001d, + ef_ptc_pokemon_deoxys_01 = 0x104001f, + ef_ptc_pokemon_deoxys_02 = 0x1040020, + ef_ptc_pokemon_hitodeman_01 = 0x1040021, + ef_ptc_pokemon_hitodeman_02 = 0x1040022, + ef_ptc_pokemon_hitodeman_03 = 0x1040024, + ef_ptc_pokemon_deoxys_03 = 0x1040025, + ef_ptc_pokemon_nyarth_01 = 0x1040026, + ef_ptc_pokemon_chicorita_01 = 0x1040027, + ef_ptc_pokemon_chicorita_02 = 0x1040028, + ef_ptc_pokemon_gokulin_01 = 0x1040029, + ef_ptc_pokemon_togepy_01 = 0x104002a, + ef_ptc_pokemon_togepy_02 = 0x104002b, + ef_ptc_pokemon_togepy_03 = 0x104002c, + ef_ptc_pokemon_kireihana_01 = 0x104002d, + ef_ptc_pokemon_kireihana_02 = 0x104002e, + ef_ptc_pokemon_gonbe_01 = 0x104002f, + ef_ptc_pokemon_sonans_01 = 0x1040030, + ef_ptc_pokemon_gonbe_02 = 0x1040031, + ef_ptc_pokemon_suicune_01 = 0x1040034, + ef_ptc_pokemon_suicune_02 = 0x1040035, + ef_ptc_pokemon_houou_01 = 0x1040036, + ef_ptc_pokemon_houou_02 = 0x1040037, + ef_ptc_pokemon_lugia_01 = 0x104003a, + ef_ptc_pokemon_lugia_02 = 0x104003b, + ef_ptc_pokemon_celebi_01 = 0x104003c, + ef_ptc_pokemon_entei_02 = 0x104003d, + ef_ptc_pokemon_entei_03 = 0x104003e, + ef_ptc_pokemon_togepy_04 = 0x104003f, + ef_ptc_pokemon_togepy_05 = 0x1040040, + ef_ptc_pokemon_metagross_01 = 0x1040042, + ef_null37 = 0x1040043, + ef_null38 = 0x1040044, + ef_null39 = 0x1040045, + ef_ptc_pokemon_lugia_03 = 0x1040046, + ef_ptc_pokemon_lugia_04 = 0x1040047, + ef_ptc_pokemon_marumine_01 = 0x1040048, + ef_ptc_pokemon_marumine_02 = 0x1040049, + ef_ptc_pokemon_marumine_03 = 0x104004a, + ef_ptc_pokemon_groudon_01 = 0x104004b, + ef_ptc_pokemon_groudon_02 = 0x104004c, + ef_ptc_pokemon_groudon_03 = 0x104004d, + ef_ptc_pokemon_enemy_in = 0x104004e, + ef_ptc_pokemon_assist_out = 0x104004f, + ef_ptc_pokemon_pokemon_out = 0x1040050, + ef_ptc_kb_mario_fireball = 0x1050001, + ef_ptc_kb_mario_fireball_shoot = 0x1050002, + ef_ptc_kb_mario_fireball_bound = 0x1050003, + ef_ptc_kb_donkey_giant_punch = 0x1060001, + ef_ptc_kb_donkey_giant_punch_max = 0x1060002, + ef_ptc_kb_donkey_giant_punch_smoke = 0x1060003, + ef_ptc_kb_link_arrow_ring = 0x1070001, + ef_ptc_kb_link_arrow_max = 0x1070002, + ef_ptc_kb_samus_charge_shot_bullet = 0x1080001, + ef_ptc_kb_samus_charge_shot_hold = 0x1080002, + ef_ptc_kb_samus_charge_shot_shot = 0x1080003, + ef_ptc_kb_samus_charge_shot_max = 0x1080004, + ef_ptc_kb_yoshi_tamagoumi = 0x1090002, + ef_ptc_kb_fox_blaster_shot = 0x10a0002, + ef_ptc_kb_pikachu_dengeki = 0x10b0001, + ef_ptc_kb_pikachu_dengeki_bound = 0x10b0002, + ef_ptc_kb_pikachu_dengeki_loop = 0x10b0003, + ef_ptc_kb_luigi_fireball = 0x10c0001, + ef_ptc_kb_luigi_fireball_shoot = 0x10c0002, + ef_ptc_kb_luigi_fireball_bound = 0x10c0003, + ef_ptc_kb_captain_fphold = 0x10d0002, + ef_ptc_kb_captain_fpflash = 0x10d0003, + ef_ptc_kb_ness_pkflash_bullet = 0x10e0001, + ef_ptc_kb_ness_pkflash_bullet_end = 0x10e0002, + ef_ptc_kb_ness_pkflash_bomb = 0x10e0003, + ef_ptc_kb_koopa_breath = 0x10f0001, + ef_ptc_kb_koopa_breath_mouth_fire = 0x10f0002, + ef_ptc_kb_peach_kinopio_gurad = 0x1100001, + ef_ptc_kb_peach_kinopio_gurad_bullet = 0x1100002, + ef_ptc_kb_zelda_nayru_flash = 0x1110002, + ef_ptc_kb_zelda_shikomibari = 0x1110003, + ef_ptc_kb_popo_ice_shot_smash = 0x1130001, + ef_ptc_kb_popo_ice_shot_appear = 0x1130002, + ef_ptc_kb_popo_ice_shot_cold_a = 0x1130003, + ef_ptc_kb_popo_ice_shot_cold_b = 0x1130004, + ef_ptc_kb_falco_blaster_shot = 0x1160002, + ef_ptc_kb_ganon_majinken = 0x1170001, + ef_ptc_kb_ganon_majinken_hold = 0x1170002, + ef_ptc_kb_ganon_majinken_flash = 0x1170003, + ef_ptc_kb_wario_kamitsuki_open = 0x1180001, + ef_ptc_kb_wario_kamitsuki_bomb = 0x1180002, + ef_ptc_kb_wario_kamitsuki_bite = 0x1180003, + ef_ptc_kb_wario_kamitsuki_end = 0x1180004, + ef_ptc_kb_pit_palutena_arrow_hold = 0x11a0002, + ef_ptc_kb_pit_palutena_arrow = 0x11a0003, + ef_ptc_kb_pit_palutena_arrow_stick = 0x11a0004, + ef_ptc_kb_pit_palutena_arrow_flash = 0x11a0005, + ef_ptc_kb_szerosuit_muzzle_flash = 0x11b0001, + ef_ptc_kb_szerosuit_paralyzer_bullet_s = 0x11b0002, + ef_ptc_kb_szerosuit_paralyzer_bullet_l = 0x11b0003, + ef_ptc_kb_szerosuit_paralyzer_hold = 0x11b0004, + ef_ptc_kb_szerosuit_paralyzer_shot = 0x11b0005, + ef_ptc_kb_szerosuit_paralyzer_hit = 0x11b0006, + ef_ptc_kb_pikmin_hikkonuki = 0x11c0001, + ef_ptc_kb_pikmin_antenna = 0x11c0002, + ef_ptc_kb_pikmin_antenna_01 = 0x11c0003, + ef_ptc_kb_pikmin_antenna_02 = 0x11c0004, + ef_ptc_kb_pikmin_antenna_03 = 0x11c0005, + ef_ptc_kb_pikmin_antenna_04 = 0x11c0006, + ef_ptc_kb_pikmin_antenna_05 = 0x11c0007, + ef_ptc_kb_pikmin_antenna_2 = 0x11c0008, + ef_ptc_kb_lucas_pkfreeze_bullet = 0x11d0001, + ef_ptc_kb_lucas_pkfreeze_bullet_end = 0x11d0002, + ef_ptc_kb_lucas_pkfreeze_bomb = 0x11d0003, + ef_ptc_kb_diddy_popgun = 0x11e0001, + ef_ptc_kb_diddy_popgun_peanut_brake = 0x11e0002, + ef_ptc_kb_diddy_popgun_break_a = 0x11e0003, + ef_ptc_kb_diddy_popgun_break_b = 0x11e0004, + ef_ptc_kb_poke_lizardon_mouth_fire = 0x11f0001, + ef_ptc_kb_poke_lizardon_kaenhousya = 0x11f0002, + ef_ptc_kb_poke_zenigame_mizuteppo_shoot = 0x1200001, + ef_ptc_kb_poke_zenigame_mizuteppo_light = 0x1200002, + ef_ptc_kb_poke_zenigame_mizuteppo_fade = 0x1200003, + ef_ptc_kb_poke_zenigame_mizuteppo_hit = 0x1200004, + ef_ptc_kb_poke_zenigame_mizuteppo = 0x1200005, + ef_ptc_kb_poke_zenigame_mizuteppo_max = 0x1200006, + ef_ptc_kb_poke_fushigisou_leaf = 0x1210001, + ef_ptc_kb_poke_fushigisou_tane_mg = 0x1210002, + ef_ptc_kb_poke_fushigisou_tane_mgtama = 0x1210003, + ef_ptc_kb_poke_fushigisou_tane_mghit = 0x1210004, + ef_ptc_kb_dedede_suikomi = 0x1220001, + ef_ptc_kb_lucario_hadoudan = 0x1230001, + ef_ptc_kb_lucario_hadoudan_max_l = 0x1230002, + ef_ptc_kb_lucario_hadoudan_max_r = 0x1230003, + ef_ptc_kb_lucario_hadoudan_tail = 0x1230004, + ef_ptc_kb_ike_hunka_sword_flare = 0x1240001, + ef_ptc_kb_ike_hunka = 0x1240002, + ef_ptc_kb_ike_hunka_max = 0x1240003, + ef_ptc_kb_robot_robobeam_shot = 0x1250001, + ef_ptc_kb_purin_korogaru = 0x1260001, + ef_ptc_kb_toonlink_arrow_max = 0x1270001, + ef_ptc_kb_wolf_blaster_shot = 0x1280002, + ef_ptc_kb_sonic_homing_trace = 0x12a0001, + ef_ptc_kb_sonic_spin_trace_l = 0x12a0004, + ef_ptc_stg_target_lv_1_crash = 0x12b0001, + ef_ptc_stg_target_lv_2_crash = 0x12b0002, + ef_ptc_stg_target_lv_3_crash = 0x12b0003, + ef_ptc_stg_target_lv_4_crash = 0x12b0004, + ef_ptc_stg_target_lv_5_crash = 0x12b0005, + ef_ptc_coinshooter_get_aru = 0x1310001, + ef_ptc_coinshooter_get_nai = 0x1310002, + ef_ptc_coinshooter_zako_bakuhatu = 0x1310003, + ef_ptc_coinshooter_muteki = 0x1310004, + ef_ptc_coinshooter_missile_kemuri = 0x1310005, + ef_ptc_coinshooter_missile_bakuhatu = 0x1310006, + ef_ptc_coinshooter_coin_erase = 0x1310007, + ef_ptc_coinshoote_coin_hit = 0x1310008, + ef_ptc_coinshooter_gekitui_yotyou = 0x1310009, + ef_ptc_coinshooter_hentai_zenmetu = 0x131000a, + ef_ptc_cleargetter_box_crash_red = 0x1320001, + ef_ptc_cleargetter_box_crash_blue = 0x1320002, + ef_ptc_chararoll_shot_01_l = 0x1330001, + ef_ptc_chararoll_shot_01_s = 0x1330002, + ef_ptc_chararoll_shot_02_l = 0x1330003, + ef_ptc_chararoll_shot_02_s = 0x1330004, + +}; + +enum EfResourceID { + Ef_Resource_Common = 0x0, + Ef_Resource_Fighter_Mario = 0x1, + Ef_Resource_Fighter_Donkey = 0x2, + Ef_Resource_Fighter_Link = 0x3, + Ef_Resource_Fighter_Samus = 0x4, + Ef_Resource_Fighter_Yoshi = 0x5, + Ef_Resource_Fighter_Kirby = 0x6, + Ef_Resource_Fighter_Fox = 0x7, + Ef_Resource_Fighter_Pikachu = 0x8, + Ef_Resource_Fighter_Luigi = 0x9, + Ef_Resource_Fighter_Captain = 0xA, + Ef_Resource_Fighter_Ness = 0xB, + Ef_Resource_Fighter_Koopa = 0xC, + Ef_Resource_Fighter_Peach = 0xD, + Ef_Resource_Fighter_Zelda = 0xE, + Ef_Resource_Fighter_Sheik = 0xF, + Ef_Resource_Fighter_Popo = 0x10, + Ef_Resource_Fighter_Nana = 0x11, + Ef_Resource_Fighter_Marth = 0x12, + Ef_Resource_Fighter_GameWatch = 0x13, + Ef_Resource_Fighter_Falco = 0x14, + Ef_Resource_Fighter_Ganon = 0x15, + Ef_Resource_Fighter_Wario = 0x16, + Ef_Resource_Fighter_MetaKnight = 0x17, + Ef_Resource_Fighter_Pit = 0x18, + Ef_Resource_Fighter_SZeroSuit = 0x19, + Ef_Resource_Fighter_Pikmin = 0x1A, + Ef_Resource_Fighter_Lucas = 0x1B, + Ef_Resource_Fighter_Diddy = 0x1C, + Ef_Resource_Fighter_PokeTrainer = 0x1D, + Ef_Resource_Fighter_PokeLizardon = 0x1E, + Ef_Resource_Fighter_PokeZenigame = 0x1F, + Ef_Resource_Fighter_PokeFushigisou = 0x20, + Ef_Resource_Fighter_Dedede = 0x21, + Ef_Resource_Fighter_Lucario = 0x22, + Ef_Resource_Fighter_Ike = 0x23, + Ef_Resource_Fighter_Robot = 0x24, + Ef_Resource_Fighter_PraMai = 0x25, + Ef_Resource_Fighter_Purin = 0x26, + Ef_Resource_Fighter_Mewtwo = 0x27, + Ef_Resource_Fighter_Roy = 0x28, + Ef_Resource_Fighter_DrMario = 0x29, + Ef_Resource_Fighter_ToonLink = 0x2A, + Ef_Resource_Fighter_ToonZelda = 0x2B, + Ef_Resource_Fighter_ToonSheik = 0x2C, + Ef_Resource_Fighter_Wolf = 0x2D, + Ef_Resource_Fighter_Dixie = 0x2E, + Ef_Resource_Fighter_Snake = 0x2F, + Ef_Resource_Fighter_Sonic = 0x30, + Ef_Resource_Fighter_GKoopa = 0x31, + Ef_Resource_Stage_BattleField = 0x32, + Ef_Resource_Stage_Final = 0x33, + Ef_Resource_Stage_Dolpic = 0x34, + Ef_Resource_Stage_Mansion = 0x35, + Ef_Resource_Stage_MarioPast = 0x36, + Ef_Resource_Stage_Kart = 0x37, + Ef_Resource_Stage_Donkey = 0x38, + Ef_Resource_Stage_Jungle = 0x39, + Ef_Resource_Stage_Pirates = 0x3A, + Ef_Resource_Stage_Norfair = 0x3C, + Ef_Resource_Stage_Orpheon = 0x3D, + Ef_Resource_Stage_Crayon = 0x3E, + Ef_Resource_Stage_Halberd = 0x3F, + Ef_Resource_Stage_StarFox = 0x44, + Ef_Resource_Stage_Stadium = 0x45, + Ef_Resource_Stage_Tengan = 0x46, + Ef_Resource_Stage_FZero = 0x47, + Ef_Resource_Stage_Ice = 0x48, + Ef_Resource_Stage_GW = 0x49, + Ef_Resource_Stage_Emblem = 0x4A, + Ef_Resource_Stage_Emblem00 = 0x4B, + Ef_Resource_Stage_Emblem01 = 0x4C, + Ef_Resource_Stage_Madein = 0x4D, + Ef_Resource_Stage_Earth = 0x4E, + Ef_Resource_Stage_Palutena = 0x4F, + Ef_Resource_Stage_Famicom = 0x50, + Ef_Resource_Stage_Newpork = 0x51, + Ef_Resource_Stage_Village = 0x52, + Ef_Resource_Stage_MetalGear = 0x53, + Ef_Resource_Stage_GreenHill = 0x54, + Ef_Resource_Stage_PictChat = 0x55, + Ef_Resource_Stage_Plankton = 0x56, + Ef_Resource_Stage_DxShrine = 0x5A, + Ef_Resource_Stage_DxYorster = 0x5B, + Ef_Resource_Stage_DxGarden = 0x5C, + Ef_Resource_Stage_DxOnett = 0x5D, + Ef_Resource_Stage_DxGreens = 0x5E, + Ef_Resource_Stage_DxPStadium = 0x5F, + Ef_Resource_Stage_DxRCruise = 0x60, + Ef_Resource_Stage_DxCorneria = 0x61, + Ef_Resource_Stage_DxBigBlue = 0x62, + Ef_Resource_Stage_DxZebes = 0x63, + Ef_Resource_Stage_Oldin = 0x64, + Ef_Resource_Stage_HomeRun = 0x65, + Ef_Resource_Stage_StageEdit = 0x66, + Ef_Resource_Adv_Cloud = 0x67, + Ef_Resource_Adv_Jungle = 0x68, + Ef_Resource_Adv_River = 0x69, + Ef_Resource_Adv_Grass = 0x6A, + Ef_Resource_Adv_Zoo = 0x6B, + Ef_Resource_Adv_Fortress = 0x6C, + Ef_Resource_Adv_Lakeside = 0x6D, + Ef_Resource_Adv_Cave = 0x6E, + Ef_Resource_Adv_Ruinfront = 0x6F, + Ef_Resource_Adv_Ruin = 0x70, + Ef_Resource_Adv_Wild = 0x71, + Ef_Resource_Adv_Cliff = 0x72, + Ef_Resource_Adv_HalberdOut = 0x73, + Ef_Resource_Adv_HalberdIn = 0x74, + Ef_Resource_Adv_AncientOut = 0x75, + Ef_Resource_Adv_Factory = 0x76, + Ef_Resource_Adv_Dimension = 0x77, + Ef_Resource_Adv_Stadium = 0x78, + Ef_Resource_Adv_HalberdSide = 0x79, + Ef_Resource_Adv_Store = 0x7A, + Ef_Resource_Adv_FlyingPlate = 0x7B, + Ef_Resource_Adv_Escape = 0x7C, + Ef_Resource_Kuribo = 0x7D, + Ef_Resource_Enemy_Patapata = 0x7E, + Ef_Resource_Enemy_HammerBros = 0x7F, + Ef_Resource_Enemy_Killer = 0x80, + Ef_Resource_Enemy_Met = 0x81, + Ef_Resource_Enemy_Karon = 0x82, + Ef_Resource_Enemy_DekaKuribo = 0x83, + Ef_Resource_Enemy_Blowm = 0x84, + Ef_Resource_Enemy_Ploum = 0x85, + Ef_Resource_Enemy_Gal = 0x86, + Ef_Resource_Enemy_GalThunder = 0x87, + Ef_Resource_Enemy_GalFire = 0x88, + Ef_Resource_Enemy_GalIce = 0x89, + Ef_Resource_Enemy_Melorin = 0x8A, + Ef_Resource_Enemy_Popperam = 0x8B, + Ef_Resource_Enemy_Whauel = 0x8C, + Ef_Resource_Enemy_Bitan = 0x8D, + Ef_Resource_Enemy_MechCannon = 0x8E, + Ef_Resource_Enemy_Mizuo = 0x8F, + Ef_Resource_Enemy_Roada = 0x90, + Ef_Resource_Enemy_Bombhead = 0x91, + Ef_Resource_Enemy_Blossa = 0x92, + Ef_Resource_Enemy_Gyraan = 0x93, + Ef_Resource_Enemy_Bucyulus = 0x94, + Ef_Resource_Enemy_Tautau = 0x95, + Ef_Resource_Enemy_Bubot = 0x96, + Ef_Resource_Enemy_Flows = 0x97, + Ef_Resource_Enemy_Aroaros = 0x98, + Ef_Resource_Enemy_Botron = 0x99, + Ef_Resource_Enemy_Jyakeel = 0x9A, + Ef_Resource_Enemy_Dyeburn = 0x9B, + Ef_Resource_Enemy_Torista = 0x9C, + Ef_Resource_Enemy_Wiiems = 0x9D, + Ef_Resource_Enemy_Ghamgha = 0x9E, + Ef_Resource_Enemy_Kyan = 0x9F, + Ef_Resource_Enemy_Pacci = 0xA0, + Ef_Resource_Enemy_Faulong = 0xA1, + Ef_Resource_Enemy_Deathpod = 0xA2, + Ef_Resource_Enemy_Byushi = 0xA3, + Ef_Resource_Enemy_Spar = 0xA4, + Ef_Resource_Enemy_Kokkon = 0xA5, + Ef_Resource_Enemy_Jdus = 0xA6, + Ef_Resource_Enemy_Arrians = 0xA7, + Ef_Resource_Enemy_Mite = 0xA8, + Ef_Resource_Enemy_Shelly = 0xA9, + Ef_Resource_Enemy_Ngagog = 0xAA, + Ef_Resource_Enemy_Gunnatter = 0xAB, + Ef_Resource_Enemy_Cymal = 0xAC, + Ef_Resource_Enemy_Teckin = 0xAD, + Ef_Resource_Enemy_Cataguard = 0xAE, + Ef_Resource_Enemy_Siralamos = 0xAF, + Ef_Resource_Enemy_Boobas = 0xB0, + Ef_Resource_Enemy_Arman = 0xB1, + Ef_Resource_Enemy_Prim = 0xB2, + Ef_Resource_Enemy_Waddledee = 0xB3, + Ef_Resource_Enemy_Waddledoo = 0xB4, + Ef_Resource_Enemy_BladeKnight = 0xB5, + Ef_Resource_Enemy_BrontoBurt = 0xB6, + Ef_Resource_Enemy_Robo = 0xB7, + Ef_Resource_Enemy_Bonkers = 0xB8, + Ef_Resource_Enemy_BossPackun = 0xB9, + Ef_Resource_Enemy_Rayquaza = 0xBA, + Ef_Resource_Enemy_PorkyStatue = 0xBB, + Ef_Resource_Enemy_Porky = 0xBC, + Ef_Resource_Enemy_Galleom = 0xBD, + Ef_Resource_Enemy_Ridley = 0xBE, + Ef_Resource_Enemy_Duon = 0xBF, + Ef_Resource_Enemy_MetaRidley = 0xC0, + Ef_Resource_Enemy_Taboo = 0xC1, + Ef_Resource_Enemy_MasterHand = 0xC2, + Ef_Resource_Enemy_CrazyHand = 0xC3, + Ef_Resource_Enemy_FalconFlyer = 0xC4, + Ef_Resource_Assist_Jugem = 0xC5, + Ef_Resource_Assist_Goroh = 0xC6, + Ef_Resource_Assist_Joe = 0xC7, + Ef_Resource_Assist_Waluigi = 0xC8, + Ef_Resource_Assist_Resetsan = 0xC9, + Ef_Resource_Assist_Nintendogs = 0xCA, + Ef_Resource_Assist_Cyborg = 0xCB, + Ef_Resource_Assist_Shadow = 0xCC, + Ef_Resource_Assist_Excitebike = 0xCD, + Ef_Resource_Assist_Devil = 0xCE, + Ef_Resource_Assist_HammerBros = 0xCF, + Ef_Resource_Assist_Metroid = 0xD0, + Ef_Resource_Assist_Ridley = 0xD1, + Ef_Resource_Assist_Wright = 0xD2, + Ef_Resource_Assist_Stafy = 0xD3, + Ef_Resource_Assist_Tingle = 0xD4, + Ef_Resource_Assist_Katana = 0xD5, + Ef_Resource_Assist_Lin = 0xD6, + Ef_Resource_Assist_CustomRobo = 0xD7, + Ef_Resource_Assist_LittleMac = 0xD8, + Ef_Resource_Assist_Tank = 0xD9, + Ef_Resource_Assist_Jeff = 0xDA, + Ef_Resource_Assist_Heririn = 0xDB, + Ef_Resource_Assist_Barbara = 0xDC, + Ef_Resource_Assist_Robin = 0xDD, + Ef_Resource_Assist_Saki = 0xDE, + Ef_Resource_Assist_Kururi = 0xDF, + Ef_Resource_Final_Mario = 0xE0, + Ef_Resource_Final_Donkey = 0xE1, + Ef_Resource_Final_Link = 0xE2, + Ef_Resource_Final_ToonLink = 0xE3, + Ef_Resource_Final_Samus = 0xE4, + Ef_Resource_Final_Yoshi = 0xE5, + Ef_Resource_Final_Kirby = 0xE6, + Ef_Resource_Final_Fox = 0xE7, + Ef_Resource_Final_Pikachu = 0xE8, + Ef_Resource_Final_Luigi = 0xE9, + Ef_Resource_Final_Captain = 0xEA, + Ef_Resource_Final_Ness = 0xEB, + Ef_Resource_Final_Koopa = 0xEC, + Ef_Resource_Final_Peach = 0xED, + Ef_Resource_Final_Zelda = 0xEE, + Ef_Resource_Final_IceClimber = 0xEF, + Ef_Resource_Final_Marth = 0xF0, + Ef_Resource_Final_GameWatch = 0xF1, + Ef_Resource_Final_Ganon = 0xF2, + Ef_Resource_Final_Wario = 0xF3, + Ef_Resource_Final_MetaKnight = 0xF4, + Ef_Resource_Final_Pit = 0xF5, + Ef_Resource_Final_SZeroSuit = 0xF6, + Ef_Resource_Final_Pikmin = 0xF7, + Ef_Resource_Final_Lucas = 0xF8, + Ef_Resource_Final_Diddy = 0xF9, + Ef_Resource_Final_PokeTrainer = 0xFA, + Ef_Resource_Final_Dedede = 0xFB, + Ef_Resource_Final_Lucario = 0xFC, + Ef_Resource_Final_Ike = 0xFD, + Ef_Resource_Final_Robot = 0xFE, + Ef_Resource_Final_Purin = 0xFF, + Ef_Resource_Final_Wolf = 0x100, + Ef_Resource_Final_Snake = 0x101, + Ef_Resource_Final_Sonic = 0x102, + Ef_Resource_Adv_Common = 0x103, + Ef_Resource_Pokemon = 0x104, + Ef_Resource_Copy_Mario = 0x105, + Ef_Resource_Copy_Donkey = 0x106, + Ef_Resource_Copy_Link = 0x107, + Ef_Resource_Copy_Samus = 0x108, + Ef_Resource_Copy_Yoshi = 0x109, + Ef_Resource_Copy_Fox = 0x10A, + Ef_Resource_Copy_Pikachu = 0x10B, + Ef_Resource_Copy_Luigi = 0x10C, + Ef_Resource_Copy_Captain = 0x10D, + Ef_Resource_Copy_Ness = 0x10E, + Ef_Resource_Copy_Koopa = 0x10F, + Ef_Resource_Copy_Peach = 0x110, + Ef_Resource_Copy_Zelda = 0x111, + Ef_Resource_Copy_Sheik = 0x112, + Ef_Resource_Copy_Popo = 0x113, + Ef_Resource_Copy_Marth = 0x114, + Ef_Resource_Copy_GameWatch = 0x115, + Ef_Resource_Copy_Falco = 0x116, + Ef_Resource_Copy_Ganon = 0x117, + Ef_Resource_Copy_Wario = 0x118, + Ef_Resource_Copy_MetaKnight = 0x119, + Ef_Resource_Copy_Pit = 0x11A, + Ef_Resource_Copy_SZeroSuit = 0x11B, + Ef_Resource_Copy_Pikmin = 0x11C, + Ef_Resource_Copy_Lucas = 0x11D, + Ef_Resource_Copy_Diddy = 0x11E, + Ef_Resource_Copy_PokeLizardon = 0x11F, + Ef_Resource_Copy_PokeZenigame = 0x120, + Ef_Resource_Copy_PokeFushigisou = 0x121, + Ef_Resource_Copy_Dedede = 0x122, + Ef_Resource_Copy_Lucario = 0x123, + Ef_Resource_Copy_Ike = 0x124, + Ef_Resource_Copy_Robot = 0x125, + Ef_Resource_Copy_Purin = 0x126, + Ef_Resource_Copy_ToonLink = 0x127, + Ef_Resource_Copy_Wolf = 0x128, + Ef_Resource_Copy_Snake = 0x129, + Ef_Resource_Copy_Sonic = 0x12A, + Ef_Resource_Stage_Target = 0x12B, + Ef_Resource_Fighter_WarioMan = 0x12C, + Ef_Resource_Fighter_ZakoBoy = 0x12D, + Ef_Resource_Fighter_ZakoGirl = 0x12E, + Ef_Resource_Fighter_ZakoChild = 0x12F, + Ef_Resource_Fighter_ZakoBall = 0x130, + Ef_Resource_Minigame_CoinShooter = 0x131, + Ef_Resource_Minigame_ClearGetter = 0x132, + Ef_Resource_Minigame_CharaRoll = 0x133, + Ef_Resource_Menu_Seal = 0x134, + Ef_Resource_Menu_SlDisplay = 0x135, + Ef_Resource_Menu_Notice = 0x136 + +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen.h b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen.h new file mode 100644 index 0000000000..2002c7f23d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class efScreen; +extern efScreen* g_efScreen; +class efScreen { + char _spacer[492]; + +public: + int requestFill(float, int, int, GXColor*); + + inline static efScreen* getInstance() { return g_efScreen; } +}; + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen_handle.h b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen_handle.h new file mode 100644 index 0000000000..62e0a775af --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ef/ef_screen_handle.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class efScreenHandle { + s8 unk0; +public: + bool isValid() const; +}; +static_assert(sizeof(efScreenHandle) == 1, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman.h b/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman.h new file mode 100644 index 0000000000..edc907bee8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emArman : public Enemy { + u8 unk5310[0x3398]; +public: + emArman(u32 p1, emCreate* create); + virtual ~emArman(); + // TODO: emArman virtual functions +}; +static_assert(sizeof(emArman) == 0x86a8, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman_param_accesser.h new file mode 100644 index 0000000000..d876643aec --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/arman/em_arman_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emArmanParam { + +}; + +class emArmanParamAccesser : public emExtendParamAccesser { +public: + emArmanParamAccesser(); + virtual ~emArmanParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emArmanParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emArmanParamAccesser g_emArmankParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/arman/wnem_proc_arman.h b/include/lib/BrawlHeaders/Brawl/Include/em/arman/wnem_proc_arman.h new file mode 100644 index 0000000000..284f820c20 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/arman/wnem_proc_arman.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class wnemArmanProc { +public: + static void ArmEnter(wnemSimple* wn, soModuleAccesser* acc); + static void ArmExit(wnemSimple* wn, soModuleAccesser* acc); + static void ArmIdol(wnemSimple* wn); + static void ArmDead(wnemSimple* wn, soModuleAccesser* acc); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros.h b/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros.h new file mode 100644 index 0000000000..c16a33c112 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emAroaros : public Enemy { + u8 unk5310[0xa6c]; +public: + emAroaros(u32 p1, emCreate* create); + virtual ~emAroaros(); + // TODO: emAroaros virtual functions +}; +static_assert(sizeof(emAroaros) == 0x5d7c, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros_param_accesser.h new file mode 100644 index 0000000000..f4ea24172f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/aroaros/em_aroaros_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emAroarosParam { + +}; + +class emAroarosParamAccesser : public emExtendParamAccesser { +public: + emAroarosParamAccesser(); + virtual ~emAroarosParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emAroarosParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emAroarosParamAccesser g_emAurorosParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan.h b/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan.h new file mode 100644 index 0000000000..bc539e502c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +class emBitan : public Enemy { + u8 unk5310[0x620]; +public: + emBitan(u32 p1, emCreate* create); + virtual ~emBitan(); + // TODO: emBitan virtual functions +}; +static_assert(sizeof(emBitan) == 0x5930, "Class is wrong size!"); + + + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan_param_accesser.h new file mode 100644 index 0000000000..d05003088d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bitan/em_bitan_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBitanParam { + +}; + +class emBitanParamAccesser : public emExtendParamAccesser { +public: + emBitanParamAccesser(); + virtual ~emBitanParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBitanParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBitanParamAccesser g_emBytanParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead.h b/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead.h new file mode 100644 index 0000000000..c55db78af0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class emBombhead : public Enemy { + u8 unk5310[0x2d10]; +public: + emBombhead(u32 p1, emCreate* create); + virtual ~emBombhead(); + // TODO: emBombhead virtual functions +}; +static_assert(sizeof(emBombhead) == 0x8020, "Class is wrong size!"); + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead_param_accesser.h new file mode 100644 index 0000000000..50a71553c8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bombhead/em_bombhead_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBombheadParam { + +}; + +class emBombheadParamAccesser : public emExtendParamAccesser { +public: + emBombheadParamAccesser(); + virtual ~emBombheadParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBombheadParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBombheadParamAccesser g_emBombedParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas.h b/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas.h new file mode 100644 index 0000000000..8eacbf5518 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class emBoobas : public Enemy { + u8 unk5310[0xa14]; +public: + emBoobas(u32 p1, emCreate* create); + virtual ~emBoobas(); + // TODO: emBoobas virtual functions +}; +static_assert(sizeof(emBoobas) == 0x5d24, "Class is wrong size!"); + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas_param_accesser.h new file mode 100644 index 0000000000..907b852407 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/boobas/em_boobas_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBoobasParam { + +}; + +class emBoobasParamAccesser : public emExtendParamAccesser { +public: + emBoobasParamAccesser(); + virtual ~emBoobasParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBoobasParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBoobasParamAccesser g_emBorborasParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun.h b/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun.h new file mode 100644 index 0000000000..9f583a99cc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class emBosspackun : public Enemy { + u8 unk5310[0x5030]; +public: + emBosspackun(u32 p1, emCreate* create); + virtual ~emBosspackun(); + // TODO: emBosspackun virtual functions +}; +static_assert(sizeof(emBosspackun) == 0xa340, "Class is wrong size!"); + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun_param_accesser.h new file mode 100644 index 0000000000..9f2515e7ae --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bosspackun/em_bosspackun_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBosspackunParam { + +}; + +class emBosspackunParamAccesser : public emExtendParamAccesser { +public: + emBosspackunParamAccesser(); + virtual ~emBosspackunParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBosspackunParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBosspackunParamAccesser g_emPeteyPiranhaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron.h b/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron.h new file mode 100644 index 0000000000..294c3bf544 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +class emBotron : public Enemy { + u8 unk5310[0x918]; +public: + emBotron(u32 p1, emCreate* create); + virtual ~emBotron(); + // TODO: emBotron virtual functions +}; +static_assert(sizeof(emBotron) == 0x5c28, "Class is wrong size!"); + + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron_param_accesser.h new file mode 100644 index 0000000000..934e5f45cd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/botron/em_botron_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBotronParam { + +}; + +class emBotronParamAccesser : public emExtendParamAccesser { +public: + emBotronParamAccesser(); + virtual ~emBotronParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBotronParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBotronParamAccesser g_emBuckotParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus.h b/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus.h new file mode 100644 index 0000000000..dea89cdf7e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +class emBucyulus : public Enemy { + u8 unk5310[0x76c]; +public: + emBucyulus(u32 p1, emCreate* create); + virtual ~emBucyulus(); + // TODO: emBucyulus virtual functions +}; +static_assert(sizeof(emBucyulus) == 0x5a7c, "Class is wrong size!"); + + + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus_param_accesser.h new file mode 100644 index 0000000000..70962fecda --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/bucyulus/em_bucyulus_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emBucyulusParam { + +}; + +class emBucyulusParamAccesser : public emExtendParamAccesser { +public: + emBucyulusParamAccesser(); + virtual ~emBucyulusParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emBucyulusParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emBucyulusParamAccesser g_emBucculusParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard.h b/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard.h new file mode 100644 index 0000000000..2983ff4ef6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class emCataguard : public Enemy { + u8 unk5310[0xa6c]; +public: + emCataguard(u32 p1, emCreate* create); + virtual ~emCataguard(); + // TODO: emCataguard virtual functions +}; +static_assert(sizeof(emCataguard) == 0x5d7c, "Class is wrong size!"); + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard_param_accesser.h new file mode 100644 index 0000000000..71d5974b60 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/cataguard/em_cataguard_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emCataguardParam { + +}; + +class emCataguardParamAccesser : public emExtendParamAccesser { +public: + emCataguardParamAccesser(); + virtual ~emCataguardParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emCataguardParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emCataguardParamAccesser g_emAutolanceParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand.h b/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand.h new file mode 100644 index 0000000000..d83050173a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emCrazyhand : public Enemy { + u8 unk5310[0xe10]; +public: + emCrazyhand(u32 p1, emCreate* create); + virtual ~emCrazyhand(); + // TODO: emCrazyhand virtual functions +}; +static_assert(sizeof(emCrazyhand) == 0x6120, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand_param_accesser.h new file mode 100644 index 0000000000..47229548b8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/crazyhand/em_crazyhand_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emCrazyhandParam { + +}; + +class emCrazyhandParamAccesser : public emExtendParamAccesser { +public: + emCrazyhandParamAccesser(); + virtual ~emCrazyhandParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emCrazyhandParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emCrazyhandParamAccesser g_emCrazyHandParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal.h b/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal.h new file mode 100644 index 0000000000..0f2897edbf --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emCymal : public Enemy { + u8 unk5310[0x5a8]; +public: + emCymal(u32 p1, emCreate* create); + virtual ~emCymal(); + // TODO: emCymal virtual functions +}; +static_assert(sizeof(emCymal) == 0x58b8, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal_param_accesser.h new file mode 100644 index 0000000000..6bc1fca150 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/cymal/em_cymal_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emCymalParam { + +}; + +class emCymalParamAccesser : public emExtendParamAccesser { +public: + emCymalParamAccesser(); + virtual ~emCymalParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emCymalParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emCymalParamAccesser g_emCymulParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod.h b/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod.h new file mode 100644 index 0000000000..93c1e6b515 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emDeathpod : public Enemy { + u8 unk5310[0x7ec]; +public: + emDeathpod(u32 p1, emCreate* create); + virtual ~emDeathpod(); + // TODO: emDeathpod virtual functions +}; +static_assert(sizeof(emDeathpod) == 0x5afc, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod_param_accesser.h new file mode 100644 index 0000000000..d5324209b6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/deathpod/em_deathpod_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emDeathpodParam { + +}; + +class emDeathpodParamAccesser : public emExtendParamAccesser { +public: + emDeathpodParamAccesser(); + virtual ~emDeathpodParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emDeathpodParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emDeathpodParamAccesser g_emRoturretParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo.h b/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo.h new file mode 100644 index 0000000000..edb9302a54 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emDekakuribo : public Enemy { + u8 unk5310[0x9a8]; +public: + emDekakuribo(u32 p1, emCreate* create); + virtual ~emDekakuribo(); + // TODO: emDekakuribo virtual functions +}; +static_assert(sizeof(emDekakuribo) == 0x5cb8, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo_param_accesser.h new file mode 100644 index 0000000000..5970c801e0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/dekakuribo/em_dekakuribo_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emDekakuriboParam { + +}; + +class emDekakuriboParamAccesser : public emExtendParamAccesser { +public: + emDekakuriboParamAccesser(); + virtual ~emDekakuriboParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emDekakuriboParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emDekakuriboParamAccesser g_emGiantGoombaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon.h b/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon.h new file mode 100644 index 0000000000..af5869c66a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emDuon : public Enemy { + u8 unk5310[0x12fc]; +public: + emDuon(u32 p1, emCreate* create); + virtual ~emDuon(); + // TODO: emDuon virtual functions +}; +static_assert(sizeof(emDuon) == 0x660c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon_param_accesser.h new file mode 100644 index 0000000000..a61b6b77a7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/duon/em_duon_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emDuonParam { + +}; + +class emDuonParamAccesser : public emExtendParamAccesser { +public: + emDuonParamAccesser(); + virtual ~emDuonParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emDuonParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emDuonParamAccesser g_emDuonParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_ai_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_ai_module_impl.h new file mode 100644 index 0000000000..9a34a4cc3e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_ai_module_impl.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include + +struct emAIInfo { + u8 unk0[0x4]; + s32 unk4; +}; +// TODO size assertion + +class emAIModuleImpl : public soAnimCmdEventObserver, public soCollisionAttackEventObserver { +public: + emAIInfo* getCurrentAIInfo(); +}; +static_assert(sizeof(emAIModuleImpl) == 0x18, "Class is wrong size!"); +// TODO fix size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_all.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_all.h new file mode 100644 index 0000000000..e6e196da29 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_all.h @@ -0,0 +1,106 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_archive.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_archive.h new file mode 100644 index 0000000000..1c8e60d5c5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_archive.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +class emArchive { + int enmCommonResourceId; + int brresResourceId; + int paramResourceId; + int weaponResourceId; + int faceTexBrresResourceId; + int extendBrresResourceId; +}; +static_assert(sizeof(emArchive) == 24, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_area_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_area_module_impl.h new file mode 100644 index 0000000000..d8dd47d6ad --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_area_module_impl.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include +#include + +class emAreaModuleImpl : public soAreaModuleImpl { +public: + static s32 getTargetFoundDistance(soModuleAccesser* acc, s32 p2); + static bool isTargetFoundDir(soModuleAccesser* acc, s32 p2, s32 p3); + static Vec3f getTargetPos(soModuleAccesser* acc, u32 p2, bool p3); + static bool isExistTarget(soModuleAccesser* acc, u32 p2); + + bool checkArea(soModuleAccesser* acc, u32 p2, u32 p3); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_create.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_create.h new file mode 100644 index 0000000000..c11bbd1844 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_create.h @@ -0,0 +1,785 @@ +#pragma once + +#include +#include +#include +#include + +enum emKind { + Enemy_Invalid = -0x1, + Enemy_Goomba = 0x0, + Enemy_Kuribo = 0x0, + Enemy_Poppant = 0x1, + Enemy_Popperam = 0x1, + Enemy_Feyesh = 0x2, + Enemy_Pacci = 0x2, + Enemy_Jyk = 0x3, + Enemy_Jyakeel = 0x3, + Enemy_Auroros = 0x4, + Enemy_Aroaros = 0x4, + Enemy_Cymul = 0x5, + Enemy_Cymal = 0x5, + Enemy_Roturret = 0x6, + Enemy_Deathpod = 0x6, + Enemy_Borboras = 0x7, + Enemy_Boobas = 0x7, + Enemy_GiantGoomba = 0x8, + Enemy_DekaKuribo = 0x8, + Enemy_Buckot = 0x9, + Enemy_Botron = 0x9, + Enemy_Bucculus = 0xA, + Enemy_Bucyulus = 0xA, + Enemy_Greap = 0xB, + Enemy_Gyraan = 0xB, + Enemy_Armight = 0xC, + Enemy_SirAlamos = 0xC, + Enemy_BulletBill = 0xD, + Enemy_Killer = 0xD, + Enemy_Roader = 0xE, + Enemy_Roada = 0xE, + Enemy_Spaak = 0xF, + Enemy_Spar = 0xF, + Enemy_Mite = 0x10, + Enemy_Ticken = 0x11, + Enemy_Teckin = 0x11, + Enemy_Towtow = 0x12, + Enemy_Tautau = 0x12, + Enemy_HammerBro = 0x13, + Enemy_HammerBros = 0x13, + Enemy_Bytan = 0x14, + Enemy_Bitan = 0x14, + Enemy_Floow = 0x15, + Enemy_Flows = 0x15, + Enemy_Puppit = 0x16, + Enemy_Kokkon = 0x16, + Enemy_Primid = 0x17, + Enemy_Prim = 0x17, + Enemy_Shellpod = 0x18, + Enemy_Shelly = 0x18, + Enemy_Koopa = 0x19, + Enemy_Patapata = 0x19, + Enemy_Shaydas = 0x1A, + Enemy_Jdus = 0x1A, + Enemy_Bombed = 0x1B, + Enemy_Bombhead = 0x1B, + Enemy_Primid_Metal = 0x1C, + Enemy_Prim_Metal = 0x1C, + Enemy_Nagagog = 0x1D, + Enemy_Ngagog = 0x1D, + Enemy_Trowlon = 0x1E, + Enemy_Faulong = 0x1E, + Enemy_Primid_Big = 0x1F, + Enemy_Prim_Big = 0x1F, + Enemy_Primid_Boom = 0x20, + Enemy_Prim_Boomerang = 0x20, + Enemy_Primid_Fire = 0x21, + Enemy_Prim_Fire = 0x21, + Enemy_Primid_Scope = 0x22, + Enemy_Prim_SuperScope = 0x22, + Enemy_Primid_Sword = 0x23, + Enemy_Prim_Sword = 0x23, + Enemy_Gamyga = 0x24, + Enemy_Ghamgha = 0x24, + Enemy_ROB_Blaster = 0x25, + Enemy_Robo_Beam = 0x25, + Enemy_ROB_Distance = 0x26, + Enemy_Robo_Distance = 0x26, + Enemy_ROB_Launcher = 0x27, + Enemy_Robo_Homing = 0x27, + Enemy_ROB_Sentry = 0x28, + Enemy_Robo_Punch = 0x28, + Enemy_Autolance = 0x29, + Enemy_Cataguard = 0x29, + Enemy_Armank = 0x2A, + Enemy_Arman = 0x2A, + Enemy_Glire = 0x2B, + Enemy_Gal_Fire = 0x2B, + Enemy_Glice = 0x2C, + Enemy_Gal_Ice = 0x2C, + Enemy_Glunder = 0x2D, + Enemy_Gal_Thunder = 0x2D, + Enemy_Boss_PeteyPiranha = 0x2E, + Enemy_Boss_BossPackun = 0x2E, + Enemy_GamygaBase = 0x2F, + Enemy_Ghamghabase = 0x2F, + Enemy_Ghamghabase_01 = 0x2F, + Enemy_Ghamghabase_02 = 0x30, + Enemy_Ghamghabase_03 = 0x31, + Enemy_Ghamghabase_04 = 0x32, + Enemy_Boss_Galleom = 0x33, + Enemy_Boss_Ridley = 0x34, + Enemy_Boss_Rayquaza = 0x35, + Enemy_Boss_Duon = 0x36, + Enemy_Boss_Porky = 0x37, + Enemy_Boss_MetaRidley = 0x38, + Enemy_Boss_Metaridley = 0x38, + Enemy_Boss_FalconFlyer = 0x39, + Enemy_Boss_Falconflyer = 0x39, + Enemy_Boss_Tabuu = 0x3A, + Enemy_Boss_Taboo = 0x3A, + Enemy_Boss_MasterHand = 0x3B, + Enemy_Boss_Masterhand = 0x3B, + Enemy_Boss_CrazyHand = 0x3C, + Enemy_Boss_Crazyhand = 0x3C +}; +typedef emKind EnemyKind; + +union i32f { + s32 i; + float f; + bool b; + u8 u8a[4]; +}; + +// TODO: is this emValueAccesser? +struct UnkParamAccesser { + u32 unk0; + u8 unk4[0xBC]; + u32 unkC0; + u8 unkC4[0x20]; + u32 unkE4; + u8 unkE8[0x18]; + u32 unk100; + float unk104; + float unk108; + float unk10C; + u32 unk110; + u8 unk114[0xC]; + u32 unk120; + u32 unk124; + u8 unk128[0x8]; + u32 unk130; + u8 unk134[0xC]; + u32 unk140; + s32 unk144; + s32 unk148; + s32 unk14C; + float unk150; + u32 unk154; + u8 unk158[0xC]; + u32 unk164; + u8 unk168[0xC]; + u32 unk174; + u8 unk178[0x4]; + u32 unk17C; + u32 unk180; + u8 unk184[0x4]; + u32 unk188; + u8 unk18C[0x8]; + u32 unk194; + u8 unk198[0xC]; + u32 unk1A4; + u32 unk1A8; + u32 unk1AC; + s32 unk1B0; + s32 unk1B4; + u32 unk1B8; + u8 unk1BC[0x4]; + u32 unk1C0; + float unk1C4; + float unk1C8; + u32 unk1CC; + u32 unk1D0; + u8 unk1D4[0x14]; + u32 unk1E8; + u8 unk1EC[0x8]; + u32 unk1F4; + u8 unk1F8[0x8]; + u32 unk200; + u8 unk204[0x4]; + u32 unk208; + u8 unk20C[0x18]; + u32 unk224; + u8 unk228[0x4]; + u32 unk22C; + u8 unk230[0x4]; + u32 unk234; + u8 unk238[0x8]; + u32 unk240; + u32 unk244; + u32 unk248; + u8 unk24C[0x4]; + u32 unk250; + u32 unk254; + u32 unk258; + u8 unk25C[0x8]; + s32 unk264; + s32 unk268; + u8 unk26C[0x8]; + u32 unk274; + float unk278; + s32 unk27C; + u32 unk280; + u32 unk284; + u32 unk288; + float unk28C; + float unk290; + i32f unk294; + float unk298; + s32 unk29C; + float unk2A0; + s32 unk2A4; + float unk2A8; + float unk2AC; + u32 unk2B0; + u8 unk2B4[0xC]; + float unk2C0; + u32 unk2C4; + u32 unk2C8; + u8 unk2CC[0x4]; + u32 unk2D0; + u8 unk2D4[0x10]; + u32 unk2E4; + u32 unk2E8; + u8 unk2EC; + s32 unk2F0; + float unk2F4; + float unk2F8; + u32 unk2FC; + u32 unk300; + s32 unk304; + s32 unk308; + float unk30C; + float unk310; + float unk314; + float unk318; + float unk31C; + float unk320; + float unk324; + float unk328; + i32f unk32C; + i32f unk330; + float unk334; + float unk338; + float unk33C; + i32f unk340; + i32f unk344; + float unk348; + i32f unk34C; + float unk350; + float unk354; + float unk358; + s32 unk35C; + s32 unk360; + s32 unk364; + i32f unk368; + i32f unk36C; + i32f unk370; + s32 unk374; + float unk378; + i32f unk37C; + float unk380; + u32 unk384; + float unk388; + float unk38C; + float unk390; + float unk394; + i32f unk398; + u32 unk39C; + u32 unk3A0; + u8 unk3A4[0x4]; + u32 unk3A8; + u8 unk3AC[0x4]; + s32 unk3B0; + s32 unk3B4; + s32 unk3B8; + float unk3BC; + float unk3C0; + float unk3C4; + u32 unk3C8; + u32 unk3CC; + u32 unk3D0; + u8 unk3D4[0x4]; + u32 unk3D8; + u8 unk3DC[0x8]; + u32 unk3E4; + u32 unk3E8; + u8 unk3EC[0x4]; + u32 unk3F0; + u8 unk3F4[0x4]; + u32 unk3F8; + u32 unk3FC; + u32 unk400; + s32 unk404; + s32 unk408; + float unk40C; + float unk410; + float unk414; + float unk418; + u32 unk41C; + u8 unk420[0x4]; + u32 unk424; + u32 unk428; + u32 unk42C; + u8 unk430[0x4]; + s32 unk434; + s32 unk438; + u32 unk43C; + u32 unk440; + u32 unk444; + u8 unk448[0x4]; + u32 unk44C; + u32 unk450; + u8 unk454[0x4]; + u32 unk458; + u32 unk45C; + u8 unk460[0x4]; + u32 unk464; + u32 unk468; + u8 unk46C[0x4]; + u32 unk470; + u32 unk474; + u8 unk478[0x4]; + u32 unk47C; + u32 unk480; + u8 unk484[0x4]; + s32 unk488; + s32 unk48C; + s32 unk490; + s32 unk494; + u32 unk498; + u32 unk49C; + float unk4A0; + float unk4A4; + float unk4A8; + float unk4AC; + u8 unk4B0[0x4]; + u32 unk4B4; + u8 unk4B8[0x4]; + u32 unk4BC; + u32 unk4C0; + i32f unk4C4; + i32f unk4C8; + i32f unk4CC; + float unk4D0; + float unk4D4; + float unk4D8; + s32 unk4DC; + u32 unk4E0; + u8 unk4E4[0x4]; + u32 unk4E8; + u32 unk4EC; + u32 unk4F0; + u32 unk4F4; + u32 unk4F8; + u8 unk4FC; + s32 unk500; + s32 unk504; + u32 unk508; + s32 unk50C; + float unk510; + u32 unk514; + u32 unk518; + u32 unk51C; + u32 unk520; + u32 unk524; + u8 unk528[0x4]; + s32 unk52C; + u8 unk530[0x4]; + u32 unk534; + u8 unk538[0x4]; + float unk53C; + s32 unk540; + float unk544; + float unk548; + float unk54C; + u32 unk550; + u8 unk554[0x18]; + u32 unk56C; + u8 unk570[0x4]; + u32 unk574; + u32 unk578; + u8 unk57C[0x4]; + u32 unk580; + u32 unk584; + u32 unk588; + u8 unk58C[0x4]; + u32 unk590; + u32 unk594; + u8 unk598[0x4]; + u32 unk59C; + u8 unk5A0[0x8]; + u32 unk5A8; + u32 unk5AC; + u8 unk5B0[0x4]; + s32 unk5B4; + s32 unk5B8; + s32 unk5BC; + s32 unk5C0; + s32 unk5C4; + i32f unk5C8; + i32f unk5CC; + s32 unk5D0; + s32 unk5D4; + float unk5D8; + float unk5DC; + float unk5E0; + float unk5E4; + float unk5E8; + float unk5EC; + float unk5F0; + u32 unk5F4; + u8 unk5F8[0x4]; + u32 unk5FC; + u32 unk600; + u8 unk604[0x8]; + s32 unk60C; + s32 unk610; + s32 unk614; + s32 unk618; + float unk61C; + float unk620; + float unk624; + float unk628; + float unk62C; + u32 unk630; + u32 unk634; + u32 unk638; + u32 unk63C; + u32 unk640; + u32 unk644; + u32 unk648; + s32 unk64C; + u8 unk650; + u32 unk654; + u8 unk658[0x4]; + s32 unk65C; + s32 unk660; + u32 unk664; + u32 unk668; + u32 unk66C; + u32 unk670; + u32 unk674; + u32 unk678; + u8 unk67C[0x4]; + u32 unk680; + u32 unk684; + u32 unk688; + u32 unk68C; + u32 unk690; + float unk694; + float unk698; + float unk69C; + u32 unk6A0; + u8 unk6A4[0x4]; + u32 unk6A8; + u32 unk6AC; + float unk6B0; + float unk6B4; + u32 unk6B8; + u8 unk6BC[0x4]; + u32 unk6C0; + u32 unk6C4; + u8 unk6C8[0x4]; + u32 unk6CC; + u8 unk6D0[0x8]; + u32 unk6D8; + u8 unk6DC[0x4]; + u32 unk6E0; + u32 unk6E4; + u32 unk6E8; + u8 unk6EC[0x4]; + u32 unk6F0; + u8 unk6F4[0x8]; + u32 unk6FC; + u32 unk700; + u8 unk704[0x4]; + u32 unk708; + u8 unk70C[0x4]; + u32 unk710; + u32 unk714; + u32 unk718; + u8 unk71C[0x4]; + u32 unk720; + u8 unk724[0x4]; + u32 unk728; + u32 unk72C; + u8 unk730[0x8]; + u32 unk738; + u8 unk73C; + u32 unk740; + u32 unk744; + u8 unk748[0x8]; + u32 unk750; + u8 unk754[0x8]; + u32 unk75C; + u8 unk760[0x8]; + u32 unk768; + u8 unk76C[0x8]; + u32 unk774; + u8 unk778[0x8]; + u32 unk780; + u32 unk784; + u32 unk788; + u32 unk78C; + u8 unk790[0x4]; + u32 unk794; + u32 unk798; + u8 unk79C[0x8]; + u32 unk7A4; + u8 unk7A8[0x8]; + u32 unk7B0; + u8 unk7B4[0x8]; + u32 unk7BC; + u8 unk7C0[0x8]; + u32 unk7C8; + u8 unk7CC[0x4]; + u32 unk7D0; + u32 unk7D4; + u8 unk7D8[0x8]; + s32 unk7E0; + float unk7E4; + u32 unk7E8; + u32 unk7EC; + u8 unk7F0[0x8]; + u32 unk7F8; + u32 unk7FC; + u8 unk800[0x4]; + u32 unk804; + u32 unk808; + u8 unk80C[0x4]; + u32 unk810; + u8 unk814[0x4]; + float unk818; + u32 unk81C; + u8 unk820; + u32 unk824; + u32 unk828; + u8 unk82C[0x8]; + s32 unk834; + s32 unk838; + u32 unk83C; + u8 unk840[0x4]; + s32 unk844; + s32 unk848; + s32 unk84C; + s32 unk850; + u32 unk854; + u8 unk858[0x4]; + u32 unk85C; + u32 unk860; + u8 unk864[0x40]; + u32 unk8A4; + u8 unk8A8[0x18]; + float unk8C0; + u8 unk8C4[0x8]; + u32 unk8CC; + u8 unk8D0[0x8]; + u32 unk8D8; + u32 unk8DC; + u8 unk8E0[0x20]; + u32 unk900; + u8 unk904[0x8]; + u32 unk90C; + u8 unk910[0x10]; + u32 unk920; + u8 unk924[0x18]; + u32 unk93C; + u8 unk940[0x8]; + u32 unk948; + u8 unk94C[0x8]; + u32 unk954; + u8 unk958[0x14]; + u32 unk96C; + u8 unk970[0x8]; + u32 unk978; + u8 unk97C[0x4]; + u32 unk980; + u8 unk984[0x18]; + u32 unk99C; + u8 unk9A0[0x4]; + u32 unk9A4; + u8 unk9A8[0x1C]; + float unk9C4; + float unk9C8; + float unk9CC; + float unk9D0; + s32 unk9D4; + s32 unk9D8; + float unk9DC; + i32f unk9E0; + float unk9E4; + float unk9E8; + float unk9EC; + float unk9F0; + float unk9F4; + float unk9F8; + float unk9FC; + float unkA00; + float unkA04; + float unkA08; + float unkA0C; + u32 unkA10; + u8 unkA14[0x8]; + u32 unkA1C; + u8 unkA20[0x8]; + u32 unkA28; + u8 unkA2C[0x4]; + u32 unkA30; + u32 unkA34; + u32 unkA38; + u8 unkA3C[0x4]; + float unkA40; + float unkA44; + float unkA48; + s32 unkA4C; + u8 unkA50[0x14]; + u32 unkA64; + u8 unkA68[0x8]; + u32 unkA70; + u8 unkA74[0x2C]; + u32 unkAA0; + u8 unkAA4[0x2C]; + u32 unkAD0; + u8 unkAD4[0x20]; + u32 unkAF4; + u8 unkAF8[0x8]; + u32 unkB00; + u8 unkB04[0x20]; + u32 unkB24; + u8 unkB28[0x20]; + u32 unkB48; + u8 unkB4C[0x8]; + u32 unkB54; + u8 unkB58[0x30]; + s32 unkB88; + s32 unkB8C; + s32 unkB90; + s32 unkB94; + s32 unkB98; + s32 unkB9C; + s32 unkBA0; + float unkBA4; + float unkBA8; + float unkBAC; + float unkBB0; + float unkBB4; + float unkBB8; + float unkBBC; + float unkBC0; + float unkBC4; + float unkBC8; + float unkBCC; + float unkBD0; + float unkBD4; + float unkBD8; + u32 unkBDC; + u8 unkBE0[0xC]; + u32 unkBEC; + u8 unkBF0[0x8]; + u32 unkBF8; + u8 unkBFC[0x8]; + u32 unkC04; + u8 unkC08[0x8]; + u32 unkC10; + u8 unkC14[0x8]; + u32 unkC1C; + u8 unkC20[0x20]; + u32 unkC40; + u8 unkC44[0x20]; + u32 unkC64; + u8 unkC68[0x20]; + u32 unkC88; + u8 unkC8C[0x20]; + u32 unkCAC; + u8 unkCB0[0x14]; + u32 unkCC4; + u8 unkCC8[0xB8]; + u32 unkD80; + u8 unkD84[0x188]; + u32 unkF0C; + u8 unkF10[0x17C]; + u32 unk108C; + u8 unk1090[0x20]; + u32 unk10B0; + u8 unk10B4[0xC]; + u32 unk10C0; + u8 unk10C4[0x38]; + u32 unk10FC; + u8 unk1100[0x44]; + u32 unk1144; + u8 unk1148[0x38]; + u32 unk1180; + u8 unk1184[0x38]; + u32 unk11BC; + u8 unk11C0[0x44]; + u32 unk1204; + u8 unk1208[0x38]; + u32 unk1240; + u8 unk1244[0x14]; + u32 unk1258; + u8 unk125C[0x14]; + u32 unk1270; + u8 unk1274[0x14]; + u32 unk1288; + u8 unk128C[0x14]; + u32 unk12A0; + u8 unk12A4[0x14]; + u32 unk12B8; + u8 unk12BC[0x14]; + u32 unk12D0; + u8 unk12D4[0x14]; + u32 unk12E8; + u8 unk12EC[0x14]; + u32 unk1300; + u8 unk1304[0x14]; + u32 unk1318; + u8 unk131C[0x14]; + float unk1330; + float unk1334; + float unk1338; + float unk133C; + float unk1340; + s32 unk1344; + u32 unk1348; + u8 unk134C[0x4]; + u32 unk1350; + u8 unk1354[0x4]; + float unk1358; + float unk135C; + float unk1360; + u32 unk1364; + u8 unk1368[0xC]; + u32 unk1374; + u8 unk1378[0x4]; + u32 unk137C; + u8 unk1380[0xC]; + u32 unk138C; + u8 unk1390[0xC]; + u32 unk139C; + u8 unk13A0[0xC]; + float unk13AC; + u32 unk13B0; + u8 unk13B4[0x78]; + u32 unk142C; + u8 unk1430[0x78]; + u32 unk14A8; + u8 unk14AC[0x78]; + u32 unk1524; + u8 unk1528[0x78]; + u32 unk15A0; + u8 unk15A4[0x24]; + u32 unk15C8; +}; + +class emCreate { +public: + u8 m_difficulty; + EnemyKind m_enemyKind; + int m_teamNo; + float m_startLr; + Vec3f m_startPos; + u32 m_startStatusKind; + u8 m_level; + float m_36; + Rect2D m_territoryRange; + int m_connectedTriggerId; + void* m_epbm; + UnkParamAccesser* m_epsp; + grGimmickMotionPath* m_motionPath; + int m_parentCreateId; + + emCreate(); + virtual ~emCreate(); +}; +static_assert(sizeof(emCreate) == 80, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_extend_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_extend_param_accesser.h new file mode 100644 index 0000000000..1779835065 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_extend_param_accesser.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include + +class emExtendParamAccesser : public soParamAccesser { +public: + emExtendParamAccesser(u32 index); + virtual ~emExtendParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + + static void reset(emExtendParamAccesser* acc, u32 index); + static emExtendParamAccesser* getAccesser(u32 index); +}; +static_assert(sizeof(emExtendParamAccesser) == 0xC, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_external_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_external_value_accesser.h new file mode 100644 index 0000000000..a1937485e7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_external_value_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class emExternalValueAccesser : public soExternalValueAccesser { +public: + static Vec3f getCenterPos(Enemy* em); + static bool isCanGetRareItem(Enemy* em); + static s32 getHitStopFrame(Enemy* em); + static float getHp(Enemy* em, u32 taskId); + static float getMaxHp(Enemy* em, u32 taskId); + static s32 getNameMsgId(Enemy* em, u32 taskId); + static float getScore(Enemy* em); + static bool isCanAutoRemove(Enemy* em); + static bool isClipIn(Enemy* em); + static bool isFigure(Enemy* em); + static nw4r::g3d::ResFileData* getFaceTexPtr(Enemy* em, u32 taskId); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_info.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_info.h new file mode 100644 index 0000000000..17b5faa1df --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_info.h @@ -0,0 +1,58 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class emInfo : public soInfo { +public: + typedef Enemy* (*CreateEnemyFunc_t)(u32, emCreate*); + typedef void (*ModifyExParamFunc_t)(emResourceModuleImpl* p1, emCreate const* p2); + typedef void (*DeleteExParamFunc_t)(emResourceModuleImpl* p1); + static const s32 NumEnemies = 61; +private: + static const u32 NodeNumTable[NumEnemies]; + static const u32 MotionNumTable[NumEnemies]; + static const u32 StatusNumTable[NumEnemies]; + static const u32 KineticEnergyNumTable[NumEnemies]; + static const u32 KineticEnergyParamAryPtrGetIdTable[NumEnemies]; + static const u32 AreaNumTable[NumEnemies]; + static const u32 AreaParamAryPtrGetIdTable[NumEnemies]; + static const u32 TargetSearchNumTable[NumEnemies]; + static const u32 TargetSearchParamAryPtrGetIdTable[NumEnemies]; + static const u32 AINumTable[NumEnemies]; + static const u32 SEIdTable[NumEnemies]; + static const u32 StandByStatusKindTable[NumEnemies]; +public: + static CreateEnemyFunc_t CreateFuncPtrTable[NumEnemies]; + static ModifyExParamFunc_t ModifyExParamFuncPtrTable[NumEnemies]; + static DeleteExParamFunc_t DeleteExParamFuncPtrTable[NumEnemies]; + + static emInfo* getInstance(); + + emInfo(); + virtual ~emInfo(); + virtual bool isInvalidKind(int kind); + virtual int getInvalidKind(); + virtual const char* getNamePtr(int kind); + virtual u32 getMotionNum(int kind); + virtual u32 getStatusNum(int kind); + u32 isPrimKind(EnemyKind kind); + u32 getNodeNum(EnemyKind kind); + u32 getKineticEnergyNum(EnemyKind kind); + u32 getKineticEnergyParamAryPtrGetId(EnemyKind kind); + u32 getAreaNum(EnemyKind kind); + u32 getAreaParamAryPtrGetId(EnemyKind kind); + u32 getTargetSearchNum(EnemyKind kind); + u32 getTargetSearchParamAryPtrGetId(EnemyKind kind); + u32 getAINum(EnemyKind kind); + CreateEnemyFunc_t getCreateFuncPtr(EnemyKind kind); + ModifyExParamFunc_t getExParamModifyFuncPtr(EnemyKind kind); + DeleteExParamFunc_t getExParamDeleteFuncPtr(EnemyKind kind); + u32 getSEId(EnemyKind kind); + u32 StandByStatusKind(EnemyKind kind); +}; +static_assert(sizeof(emInfo) == 0x4, "Class has the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_manager.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_manager.h new file mode 100644 index 0000000000..2da77e8459 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_manager.h @@ -0,0 +1,57 @@ +#pragma once + +#include +#include +#include +#include + +class emManager { + + template + class Entry { + char _0[0x4]; + EnemyKind m_enemyKind; + int m_parentCreateId; + int m_createId; + int m_soundGroupOffset; + T* m_dataPtr; + }; + static_assert(sizeof(Entry) == 0x18, "Class is wrong size!"); + + u32 m_numEnemyEntries; + Entry* m_enemyEntries; + char _8[4]; + u32 m_numArchiveEntries; + Entry* m_archiveEntries; + char _20[4]; + u8 m_primidFaceType; + char _25[3]; + + virtual ~emManager(); + +public: + bool isCompArchive(int id); + bool isCompArchiveAll(); + int getPreloadArchiveCountFromKind(EnemyKind enemyKind); + int getPreloadArchiveCreateIdFromKind(EnemyKind enemyKind); + emArchive* getPreloadArchivePtrFromKind(EnemyKind enemyKind); +#ifdef MATCHING + int preloadArchive(gfArchive* param, gfArchive* brres, gfArchive* enmCommon, gfArchive* primFaceBrres, EnemyKind enemyKind, bool isSoundRequest); +#else + int preloadArchive(gfArchive* param, gfArchive* brres, gfArchive* enmCommon, gfArchive* primFaceBrres, EnemyKind enemyKind, bool isSoundRequest, HeapType heapType = Heaps::StageResource); // Custom optional parameters for specifying what heap to load enemy resources into +#endif + int createEnemy(emCreate* create); + void removeEnemy(int id); + bool isEnemyExist(int id); + void removeEnemyAll(); + void removeArchiveAll(); + void removeArchive(int id); + static void create(u32 numEntries1, u32 numEntries2, u8 primidFaceType); + static void remove(); + u32 getEnemyCount(); + u32 getEnemyCountFromKind(EnemyKind enemyKind); + Enemy* getEnemyPtrFromId(int createId); + Entry* getEntryPreloadArchivePtrFromId(int createId); + static emManager* getInstance(); +}; +static_assert(sizeof(emManager) == 32, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_target_search_unit.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_target_search_unit.h new file mode 100644 index 0000000000..6feba8ca39 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_target_search_unit.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include + +class emTargetSearchUnit : public soTargetSearchUnit { +public: + emTargetSearchUnit(); + ~emTargetSearchUnit(); + virtual bool checkTargetExist(soModuleAccesser* acc, u32 p2); + virtual bool checkTargetInArea(soModuleAccesser* acc, u32 p2, u32 p3); + virtual Vec3f getTargetPos(soModuleAccesser* acc, u32 p2); + virtual Vec3f getSelfPos(soModuleAccesser* acc); + virtual void initInterval(soModuleAccesser* acc); +}; +static_assert(sizeof(emTargetSearchUnit) == 0x18, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_value_accesser.h new file mode 100644 index 0000000000..4f07eadca3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_value_accesser.h @@ -0,0 +1,67 @@ +#include +#include +#include +#include + +class emValueAccesser : public soValueAccesser { +public: + enum ParamFloat { + + }; + + enum ParamInt { + + + }; + + enum ParamIndefinite { + + + }; + + enum VariableFloat { + Var_Float_Sum_Speed = 1000, + Var_Float_Kinetic_Angle_From_Speed = 1001, + + Var_Float_HP_Rest_Rate = 1026, + Var_Float_Kinetic_Speed_Angle_With_Touch_Ground = 1027, + Var_Float_Goal_Pos_X = 1028, + Var_Float_Goal_Pos_Y = 1029, + + Var_Float_HP_Diff_From_Prev_HP = 1048, + Var_Float_Kinetic_Reflect_Num_Add_Value = 1049, + + Var_Float_Center_Pos_X = 1051, + Var_Float_Center_Pos_Y = 1052, + Var_Float_Parent_Enemy_Strength = 1053, + }; + + enum VariableInt { + Var_Int_Frame_Counter_1 = 21000, + Var_Int_Frame_Counter_2 = 21001, + Var_Int_Frame_Counter_3 = 21002, + + Var_Int_Enemy_Kind = 21007, + Var_Int_Frame_Counter_4 = 21008, + Var_Int_Connected_Trigger_Id = 21009, + Var_Int_Level = 21010, + Var_Int_Communication_Item_Port_Data = 21011, + Var_Int_Parent_Enemy_Status_Kind = 21012, + Var_Int_Communication_Item_Situation_Kind = 21013, + }; + + enum VariableIndefinite { + Var_Indefinite_Motion_Path = 41000, + }; + + virtual soParamAccesser* getExtendParamAccesser(); + virtual ~emValueAccesser(); + virtual float getConstantFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getConstantIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getConstantIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + + virtual float getVariableFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getVariableIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getVariableIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/em_weapon_manager.h b/include/lib/BrawlHeaders/Brawl/Include/em/em_weapon_manager.h new file mode 100644 index 0000000000..762176c8a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/em_weapon_manager.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include +#include +#include + +class emWeaponManager : public utStageObjectPool { + char _spacer[0x270]; + +public: + virtual ~emWeaponManager(); + virtual void activateObject(wnemSimple* wnem, float, float, int, int, void*, int, Vec3f*, int, int, u8, int, u16); + virtual void deactivateObject(wnemSimple* wnem); + virtual void resetProcFncList(); + virtual void resetManageWeaponList(); + wnemSimple* GetManagedWeapon(u32 taskId, u32 p2, u32 p3); + wnemSimple* GetManagedWeaponFromTaskID(u32 taskId); + wnemSimple* findWeapon(int taskId, u32 unk1, u32 unk2); + + static void create(); + static void remove(); + static emWeaponManager* getInstance(); +}; +static_assert(sizeof(emWeaponManager) == 0x298, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/enemy.h b/include/lib/BrawlHeaders/Brawl/Include/em/enemy.h new file mode 100644 index 0000000000..3bbbfd8523 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/enemy.h @@ -0,0 +1,96 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class Enemy : public StageObject, public soStatusEventObserver, public soCollisionAttackEventObserver, public soCollisionSearchEventObserver, public soCaptureEventObserver, public soCollisionAbsorberEventObserver, public soCollisionReflectorEventObserver { + + EnemyKind m_enemyKind; // 0xAC + u8 unkB0[0x4]; + int m_connectedTriggerId; + u32 m_difficulty; + u32 m_level; + u8 unkC0[0x8]; + grGimmickMotionPath* m_motionPath; + u8 unkCC[0x10]; + soModuleAccesser moduleAccesser; + u8 unk1BC[0xF4C]; + emAIModuleImpl m_aiModule; // 0x1108 + u8 unk110C[0x5310 - 0x1108 - sizeof(emAIModuleImpl)]; + +public: + struct Kinetic { + struct Energy { + enum Id { + Id_Jostle = 0x8, + Id_Ground_Movement = 0x9, + }; + }; + }; + + enum MessageKind { + Message_None = -1, + Message_Damage = 1, + Message_Destruct = 3, + Message_Remove = 4, + }; + + emAIModuleImpl& getAIModule() { return m_aiModule; } + Vec3f getCenterPos(); + s32 getNameMsgId(); + nw4r::g3d::ResFileData* getFaceTexPtr(u32 p1); + nw4r::g3d::ResFileData* getFaceTexPtr(); + bool isCanAutoRemove(); + bool isCanCreateItem(); + + virtual void processUpdate(); + virtual void processFixPosition(); + virtual void processHit(); + virtual void processGameProc(); + virtual void init(); + virtual ~Enemy(); + + virtual void updatePosture(bool); + virtual void processFixPositionPreAnimCmd(); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual void updateNodeSRT(); + virtual bool isTreadPassive(); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + + virtual float getScore(); + virtual void activate(Vec3f* spawnPos, float lr, float, int statusKind); + virtual void deactivate(); + virtual bool isSetableNode(int); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackCheck(u32 flags); + virtual void notifyEventCollisionSearch(soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionSearchCheck(); + virtual void notifyEventCollisionAbsorber(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual bool notifyEventCollisionAbsorberCheck(); + virtual void notifyEventCollisionReflector(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionReflectorSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionReflectorCheck(); + virtual bool notifyEventCaptureStatus(soModuleAccesser* moduleAccesser, int taskId, int, int); + virtual bool emCreateFigure(int variation); + virtual bool emShootItem(itKind, int variation, void*, float); + virtual bool emItemInformationReturnEnemy(int instanceId); + virtual bool shoot(int, int, int); // TODO: Verify parameters + virtual bool addParts(int, int); + + template + static Enemy* createInstance(u32 p1, emCreate* create) { + return new (Heaps::EnemyInstance) T(p1, create); + } +}; +static_assert(sizeof(Enemy) == 0x5310, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer.h b/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer.h new file mode 100644 index 0000000000..e55c9fc96b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emFalconflyer : public Enemy { + u8 unk5310[0x734]; +public: + emFalconflyer(u32 p1, emCreate* create); + virtual ~emFalconflyer(); + // TODO: emFalconflyer virtual functions +}; +static_assert(sizeof(emFalconflyer) == 0x5a44, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer_param_accesser.h new file mode 100644 index 0000000000..f9572de5c5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/falconflyer/em_falconflyer_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emFalconflyerParam { + +}; + +class emFalconflyerParamAccesser : public emExtendParamAccesser { +public: + emFalconflyerParamAccesser(); + virtual ~emFalconflyerParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emFalconflyerParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emFalconflyerParamAccesser g_emFalconFlyerParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong.h b/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong.h new file mode 100644 index 0000000000..b881cb4f6c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emFaulong : public Enemy { + u8 unk5310[0x8c4]; +public: + emFaulong(u32 p1, emCreate* create); + virtual ~emFaulong(); + // TODO: emFaulong virtual functions +}; +static_assert(sizeof(emFaulong) == 0x5bd4, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong_param_accesser.h new file mode 100644 index 0000000000..557ab89b63 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/faulong/em_faulong_param_accesser.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct emFaulongParam { + +}; + +class emFaulongParamAccesser : public emExtendParamAccesser { +public: + emFaulongParamAccesser(); + virtual ~emFaulongParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emFaulongParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emFaulongParamAccesser g_emTrowlonParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows.h b/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows.h new file mode 100644 index 0000000000..2e955ad412 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emFlows : public Enemy { + u8 unk5310[0xa74]; +public: + emFlows(u32 p1, emCreate* create); + virtual ~emFlows(); + // TODO: emFlows virtual functions +}; +static_assert(sizeof(emFlows) == 0x5d84, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows_param_accesser.h new file mode 100644 index 0000000000..1e11da3ee7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/flows/em_flows_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emFlowsParam { + +}; + +class emFlowsParamAccesser : public emExtendParamAccesser { +public: + emFlowsParamAccesser(); + virtual ~emFlowsParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emFlowsParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emFlowsParamAccesser g_emFloowParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire.h b/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire.h new file mode 100644 index 0000000000..3cea9fb37e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emGalfire : public Enemy { + u8 unk5310[0x784]; +public: + emGalfire(u32 p1, emCreate* create); + virtual ~emGalfire(); + // TODO: emGalfire virtual functions +}; +static_assert(sizeof(emGalfire) == 0x5a94, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire_param_accesser.h new file mode 100644 index 0000000000..43d04d5f2c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/galfire/em_galfire_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emGalfireParam { + +}; + +class emGalfireParamAccesser : public emExtendParamAccesser { +public: + emGalfireParamAccesser(); + virtual ~emGalfireParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emGalfireParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emGalfireParamAccesser g_emGlireParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom.h b/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom.h new file mode 100644 index 0000000000..e21eaa99a5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emGalleom : public Enemy { + u8 unk5310[0x1560]; +public: + emGalleom(u32 p1, emCreate* create); + virtual ~emGalleom(); + // TODO: emGalleom virtual functions +}; +static_assert(sizeof(emGalleom) == 0x6870, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom_param_accesser.h new file mode 100644 index 0000000000..c3bf4b4524 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/galleom/em_galleom_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emGalleomParam { + +}; + +class emGalleomParamAccesser : public emExtendParamAccesser { +public: + emGalleomParamAccesser(); + virtual ~emGalleomParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emGalleomParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emGalleomParamAccesser g_emGalleomParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha.h b/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha.h new file mode 100644 index 0000000000..12f86520a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emGhamgha : public Enemy { + u8 unk5310[0x858]; +public: + emGhamgha(u32 p1, emCreate* create); + virtual ~emGhamgha(); + // TODO: emGhamgha virtual functions +}; +static_assert(sizeof(emGhamgha) == 0x5b68, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha_param_accesser.h new file mode 100644 index 0000000000..af21f23618 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ghamgha/em_ghamgha_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emGhamghaParam { + +}; + +class emGhamghaParamAccesser : public emExtendParamAccesser { +public: + emGhamghaParamAccesser(); + virtual ~emGhamghaParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emGhamghaParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emGhamghaParamAccesser g_emGamygaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase.h b/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase.h new file mode 100644 index 0000000000..69c97aae6f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emGhamghabase : public Enemy { + u8 unk5310[0x65c]; +public: + emGhamghabase(u32 p1, emCreate* create); + virtual ~emGhamghabase(); + // TODO: emGhamghabase virtual functions +}; +static_assert(sizeof(emGhamghabase) == 0x596c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase_param_accesser.h new file mode 100644 index 0000000000..75a85e8f27 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ghamghabase/em_ghamghabase_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emGhamghabaseParam { + +}; + +class emGhamghabaseParamAccesser : public emExtendParamAccesser { +public: + emGhamghabaseParamAccesser(); + virtual ~emGhamghabaseParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emGhamghabaseParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emGhamghabaseParamAccesser g_emGamygaBaseParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan.h b/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan.h new file mode 100644 index 0000000000..66cf0ad025 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emGyraan : public Enemy { + u8 unk5310[0x4f3c]; +public: + emGyraan(u32 p1, emCreate* create); + virtual ~emGyraan(); + // TODO: emGyraan virtual functions +}; +static_assert(sizeof(emGyraan) == 0xa24c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan_param_accesser.h new file mode 100644 index 0000000000..31e743eca1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/gyraan/em_gyraan_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emGyraanParam { + +}; + +class emGyraanParamAccesser : public emExtendParamAccesser { +public: + emGyraanParamAccesser(); + virtual ~emGyraanParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emGyraanParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emGyraanParamAccesser g_emGreapParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros.h b/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros.h new file mode 100644 index 0000000000..4057fb6a1f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +class emHammerbros : public Enemy { + u8 unk5310[0xb94]; +public: + emHammerbros(u32 p1, emCreate* create); + virtual ~emHammerbros(); + // TODO: emHammerbros virtual functions +}; +static_assert(sizeof(emHammerbros) == 0x5ea4, "Class is wrong size!"); + + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros_param_accesser.h new file mode 100644 index 0000000000..4e8724be59 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/hammerbros/em_hammerbros_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emHammerbrosParam { + +}; + +class emHammerbrosParamAccesser : public emExtendParamAccesser { +public: + emHammerbrosParamAccesser(); + virtual ~emHammerbrosParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emHammerbrosParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emHammerbrosParamAccesser g_emHammerBroParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus.h b/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus.h new file mode 100644 index 0000000000..732380e27a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emJdus : public Enemy { + u8 unk5310[0xb14]; +public: + emJdus(u32 p1, emCreate* create); + virtual ~emJdus(); + // TODO: emJdus virtual functions +}; +static_assert(sizeof(emJdus) == 0x5e24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus_param_accesser.h new file mode 100644 index 0000000000..3f2b82daff --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/jdus/em_jdus_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emJdusParam { + +}; + +class emJdusParamAccesser : public emExtendParamAccesser { +public: + emJdusParamAccesser(); + virtual ~emJdusParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emJdusParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emJdusParamAccesser g_emShaydasParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel.h b/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel.h new file mode 100644 index 0000000000..2c1823761a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emJyakeel : public Enemy { + u8 unk5310[0x424]; +public: + emJyakeel(u32 p1, emCreate* create); + virtual ~emJyakeel(); + // TODO: emJyakeel virtual functions +}; +static_assert(sizeof(emJyakeel) == 0x5734, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel_param_accesser.h new file mode 100644 index 0000000000..6452ec78a2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/jyakeel/em_jyakeel_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emJyakeelParam { + +}; + +class emJyakeelParamAccesser : public emExtendParamAccesser { +public: + emJyakeelParamAccesser(); + virtual ~emJyakeelParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emJyakeelParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emJyakeelParamAccesser g_emJykParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer.h b/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer.h new file mode 100644 index 0000000000..3d7ded7855 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emKiller : public Enemy { + u8 unk5310[0x734]; +public: + emKiller(u32 p1, emCreate* create); + virtual ~emKiller(); + // TODO: emKiller virtual functions +}; +static_assert(sizeof(emKiller) == 0x5a44, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer_param_accesser.h new file mode 100644 index 0000000000..1bf82487ab --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/killer/em_killer_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emKillerParam { + +}; + +class emKillerParamAccesser : public emExtendParamAccesser { +public: + emKillerParamAccesser(); + virtual ~emKillerParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emKillerParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emKillerParamAccesser g_emBulletBillParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon.h b/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon.h new file mode 100644 index 0000000000..f0040f9b55 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emKokkon : public Enemy { + u8 unk5310[0x9d0]; +public: + emKokkon(u32 p1, emCreate* create); + virtual ~emKokkon(); + // TODO: emKokkon virtual functions +}; +static_assert(sizeof(emKokkon) == 0x5ce0, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon_param_accesser.h new file mode 100644 index 0000000000..d481fd6a3c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/kokkon/em_kokkon_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emKokkonParam { + +}; + +class emKokkonParamAccesser : public emExtendParamAccesser { +public: + emKokkonParamAccesser(); + virtual ~emKokkonParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emKokkonParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emKokkonParamAccesser g_emPuppitParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo.h b/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo.h new file mode 100644 index 0000000000..181f3e68a1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emKuribo : public Enemy { + u8 unk5310[0xa14]; +public: + emKuribo(u32 p1, emCreate* create); + virtual ~emKuribo(); + // TODO: emKuribo virtual functions +}; +static_assert(sizeof(emKuribo) == 0x5d24, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo_param_accesser.h new file mode 100644 index 0000000000..a8e02e444d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/kuribo/em_kuribo_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emKuriboParam { + +}; + +class emKuriboParamAccesser : public emExtendParamAccesser { +public: + emKuriboParamAccesser(); + virtual ~emKuriboParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emKuriboParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emKuriboParamAccesser g_emGoombaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand.h b/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand.h new file mode 100644 index 0000000000..522aa09208 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emMasterhand : public Enemy { + u8 unk5310[0xb6c]; +public: + emMasterhand(u32 p1, emCreate* create); + virtual ~emMasterhand(); + // TODO: emMasterhand virtual functions +}; +static_assert(sizeof(emMasterhand) == 0x5e7c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand_param_accesser.h new file mode 100644 index 0000000000..a40396ecc5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/masterhand/em_masterhand_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emMasterhandParam { + +}; + +class emMasterhandParamAccesser : public emExtendParamAccesser { +public: + emMasterhandParamAccesser(); + virtual ~emMasterhandParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emMasterhandParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emMasterhandParamAccesser g_emMasterHandParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley.h b/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley.h new file mode 100644 index 0000000000..71aa076ff1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emMetaridley : public Enemy { + u8 unk5310[0x1b1c]; +public: + emMetaridley(u32 p1, emCreate* create); + virtual ~emMetaridley(); + // TODO: emMetaridley virtual functions +}; +static_assert(sizeof(emMetaridley) == 0x6e2c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley_param_accesser.h new file mode 100644 index 0000000000..94a98e7fcf --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/metaridley/em_metaridley_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emMetaridleyParam { + +}; + +class emMetaridleyParamAccesser : public emExtendParamAccesser { +public: + emMetaridleyParamAccesser(); + virtual ~emMetaridleyParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emMetaridleyParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emMetaridleyParamAccesser g_emMetaRidleyParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite.h b/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite.h new file mode 100644 index 0000000000..5cf2e3d6f3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emMite : public Enemy { + u8 unk5310[0x7d4]; +public: + emMite(u32 p1, emCreate* create); + virtual ~emMite(); + // TODO: emMite virtual functions +}; +static_assert(sizeof(emMite) == 0x5ae4, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite_param_accesser.h new file mode 100644 index 0000000000..05b38ca336 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/mite/em_mite_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emMiteParam { + +}; + +class emMiteParamAccesser : public emExtendParamAccesser { +public: + emMiteParamAccesser(); + virtual ~emMiteParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emMiteParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emMiteParamAccesser g_emMiteParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog.h b/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog.h new file mode 100644 index 0000000000..901de0f6fd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emNgagog : public Enemy { + u8 unk5310[0xaf4]; +public: + emNgagog(u32 p1, emCreate* create); + virtual ~emNgagog(); + // TODO: emNgagog virtual functions +}; +static_assert(sizeof(emNgagog) == 0x5e04, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog_param_accesser.h new file mode 100644 index 0000000000..50e29dcee3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ngagog/em_ngagog_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emNgagogParam { + +}; + +class emNgagogParamAccesser : public emExtendParamAccesser { +public: + emNgagogParamAccesser(); + virtual ~emNgagogParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emNgagogParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emNgagogParamAccesser g_emNagagogParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci.h b/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci.h new file mode 100644 index 0000000000..6e54beab01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emPacci : public Enemy { + u8 unk5310[0xda8]; +public: + emPacci(u32 p1, emCreate* create); + virtual ~emPacci(); + // TODO: emPacci virtual functions +}; +static_assert(sizeof(emPacci) == 0x60b8, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci_param_accesser.h new file mode 100644 index 0000000000..fe7413ff37 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/pacci/em_pacci_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emPacciParam { + +}; + +class emPacciParamAccesser : public emExtendParamAccesser { +public: + emPacciParamAccesser(); + virtual ~emPacciParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emPacciParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emPacciParamAccesser g_emFeyeshParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata.h b/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata.h new file mode 100644 index 0000000000..85c98cbc6c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emPatapata : public Enemy { + u8 unk5310[0xb04]; +public: + emPatapata(u32 p1, emCreate* create); + virtual ~emPatapata(); + // TODO: emPatapata virtual functions +}; +static_assert(sizeof(emPatapata) == 0x5e14, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata_param_accesser.h new file mode 100644 index 0000000000..3c827c3c45 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/patapata/em_patapata_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emPatapataParam { + +}; + +class emPatapataParamAccesser : public emExtendParamAccesser { +public: + emPatapataParamAccesser(); + virtual ~emPatapataParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emPatapataParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emPatapataParamAccesser g_emKoopaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam.h b/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam.h new file mode 100644 index 0000000000..bb1a4139c7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emPopperam : public Enemy { + u8 unk5310[0x938]; +public: + emPopperam(u32 p1, emCreate* create); + virtual ~emPopperam(); + // TODO: emPopperam virtual functions +}; +static_assert(sizeof(emPopperam) == 0x5c48, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam_param_accesser.h new file mode 100644 index 0000000000..20807734de --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/popperam/em_popperam_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emPopperamParam { + +}; + +class emPopperamParamAccesser : public emExtendParamAccesser { +public: + emPopperamParamAccesser(); + virtual ~emPopperamParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emPopperamParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emPopperamParamAccesser g_emPoppantParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky.h b/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky.h new file mode 100644 index 0000000000..c7b59b7faa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emPorky : public Enemy { + u8 unk5310[0x10f0]; +public: + emPorky(u32 p1, emCreate* create); + virtual ~emPorky(); + // TODO: emPorky virtual functions +}; +static_assert(sizeof(emPorky) == 0x6400, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky_param_accesser.h new file mode 100644 index 0000000000..809f0c7f3d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/porky/em_porky_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emPorkyParam { + +}; + +class emPorkyParamAccesser : public emExtendParamAccesser { +public: + emPorkyParamAccesser(); + virtual ~emPorkyParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emPorkyParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emPorkyParamAccesser g_emPorkyParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim.h b/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim.h new file mode 100644 index 0000000000..3f2d948d25 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emPrim : public Enemy { + u8 unk5310[0x595c]; +public: + emPrim(u32 p1, emCreate* create); + virtual ~emPrim(); + // TODO: emPrim virtual functions +}; +static_assert(sizeof(emPrim) == 0xac6c, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim_param_accesser.h new file mode 100644 index 0000000000..1d61df1f1b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/prim/em_prim_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emPrimParam { + +}; + +class emPrimParamAccesser : public emExtendParamAccesser { +public: + emPrimParamAccesser(); + virtual ~emPrimParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emPrimParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emPrimParamAccesser g_emPrimidParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza.h b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza.h new file mode 100644 index 0000000000..8e828cc897 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emRayquaza : public Enemy { + u8 unk5310[0x1230]; +public: + emRayquaza(u32 p1, emCreate* create); + virtual ~emRayquaza(); + // TODO: emRayquaza virtual functions +}; +static_assert(sizeof(emRayquaza) == 0x6540, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza_param_accesser.h new file mode 100644 index 0000000000..c3a3c27687 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/em_rayquaza_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRayquazaParam { + +}; + +class emRayquazaParamAccesser : public emExtendParamAccesser { +public: + emRayquazaParamAccesser(); + virtual ~emRayquazaParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRayquazaParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRayquazaParamAccesser g_emRayquazaParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/wnem_proc_rayquaza.h b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/wnem_proc_rayquaza.h new file mode 100644 index 0000000000..f3bcbed156 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/rayquaza/wnem_proc_rayquaza.h @@ -0,0 +1,10 @@ +#pragma once + +#include + +class wnemRayquazaProc { +public: + static void LightBallFly(wnemSimple* wn); + static void LightBallLanding(wnemSimple* wn); + static void LightBallDisappear(wnemSimple* wn); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/resource/em_resource_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/resource/em_resource_module_impl.h new file mode 100644 index 0000000000..1619a5d7d0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/resource/em_resource_module_impl.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +// TODO: Determine size +class emResourceModuleImpl : public soResourceModuleImpl { +public: + void* unk18; + void* unk1C; + void* unk20; + void* unk24; + void* unk28; + UnkParamAccesser* unk2C; + void* unk30; + UnkParamAccesser* unk34; + EnemyKind m_kind; + + emResourceModuleImpl( + u32 paramArchiveId, + soResourceIdAccesserImpl* resourceIdAccessor, + u32 emCommonArchiveId, + emCreate* create); + virtual ~emResourceModuleImpl(); + void ModifyParam(emCreate* create); + nw4r::g3d::ResFileData* getInfoTexFile(u32 p1, u32 p2); + + template + static void ModifyExParam(emResourceModuleImpl* p1, emCreate const* create) { + p1->unk2C = create->m_epsp ? create->m_epsp : p1->unk34; + } + + template + static void DeleteExParam(emResourceModuleImpl* p1) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley.h b/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley.h new file mode 100644 index 0000000000..5598a3559e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emRidley : public Enemy { + u8 unk5310[0x19bc]; +public: + emRidley(u32 p1, emCreate* create); + virtual ~emRidley(); + // TODO: emRidley virtual functions +}; +static_assert(sizeof(emRidley) == 0x6ccc, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley_param_accesser.h new file mode 100644 index 0000000000..917597b3c2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/ridley/em_ridley_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRidleyParam { + +}; + +class emRidleyParamAccesser : public emExtendParamAccesser { +public: + emRidleyParamAccesser(); + virtual ~emRidleyParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRidleyParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRidleyParamAccesser g_emRidleyParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada.h b/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada.h new file mode 100644 index 0000000000..06ff1247fe --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emRoada : public Enemy { + u8 unk5310[0x77c]; +public: + emRoada(u32 p1, emCreate* create); + virtual ~emRoada(); + // TODO: emRoada virtual functions +}; +static_assert(sizeof(emRoada) == 0x5a8c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada_param_accesser.h new file mode 100644 index 0000000000..89dc6f4762 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/roada/em_roada_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRoadaParam { + +}; + +class emRoadaParamAccesser : public emExtendParamAccesser { +public: + emRoadaParamAccesser(); + virtual ~emRoadaParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRoadaParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRoadaParamAccesser g_emRoaderParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam.h b/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam.h new file mode 100644 index 0000000000..6461856c9d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class emRobobeam : public Enemy { + u8 unk5310[0xe7c]; +public: + emRobobeam(u32 p1, emCreate* create); + virtual ~emRobobeam(); + // TODO: emRobobeam virtual functions +}; +static_assert(sizeof(emRobobeam) == 0x618c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam_param_accesser.h new file mode 100644 index 0000000000..e9cb8e983f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robobeam/em_robobeam_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRobobeamParam { + +}; + +class emRobobeamParamAccesser : public emExtendParamAccesser { +public: + emRobobeamParamAccesser(); + virtual ~emRobobeamParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRobobeamParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRobobeamParamAccesser g_emROBBlasterParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance.h b/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance.h new file mode 100644 index 0000000000..8e9612f718 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emRobodistance : public Enemy { + u8 unk5310[0xf3c]; +public: + emRobodistance(u32 p1, emCreate* create); + virtual ~emRobodistance(); + // TODO: emRobodistance virtual functions +}; +static_assert(sizeof(emRobodistance) == 0x624c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance_param_accesser.h new file mode 100644 index 0000000000..e238c43485 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robodistance/em_robodistance_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRobodistanceParam { + +}; + +class emRobodistanceParamAccesser : public emExtendParamAccesser { +public: + emRobodistanceParamAccesser(); + virtual ~emRobodistanceParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRobodistanceParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRobodistanceParamAccesser g_emROBDistanceParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming.h b/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming.h new file mode 100644 index 0000000000..1073f05cf5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emRobohoming : public Enemy { + u8 unk5310[0xe54]; +public: + emRobohoming(u32 p1, emCreate* create); + virtual ~emRobohoming(); + // TODO: emRobohoming virtual functions +}; +static_assert(sizeof(emRobohoming) == 0x6164, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming_param_accesser.h new file mode 100644 index 0000000000..873e8b04c5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robohoming/em_robohoming_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRobohomingParam { + +}; + +class emRobohomingParamAccesser : public emExtendParamAccesser { +public: + emRobohomingParamAccesser(); + virtual ~emRobohomingParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRobohomingParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRobohomingParamAccesser g_emROBLauncherParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch.h b/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch.h new file mode 100644 index 0000000000..6b96ef6948 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emRobopunch : public Enemy { + u8 unk5310[0xf1c]; +public: + emRobopunch(u32 p1, emCreate* create); + virtual ~emRobopunch(); + // TODO: emRobopunch virtual functions +}; +static_assert(sizeof(emRobopunch) == 0x622c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch_param_accesser.h new file mode 100644 index 0000000000..155448aa6b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/robopunch/em_robopunch_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emRobopunchParam { + +}; + +class emRobopunchParamAccesser : public emExtendParamAccesser { +public: + emRobopunchParamAccesser(); + virtual ~emRobopunchParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emRobopunchParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emRobopunchParamAccesser g_emROBSentryParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly.h b/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly.h new file mode 100644 index 0000000000..4251c283e2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emShelly : public Enemy { + u8 unk5310[0xf90]; +public: + emShelly(u32 p1, emCreate* create); + virtual ~emShelly(); + // TODO: emShelly virtual functions +}; +static_assert(sizeof(emShelly) == 0x62a0, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly_param_accesser.h new file mode 100644 index 0000000000..de9cd457c9 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/shelly/em_shelly_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emShellyParam { + +}; + +class emShellyParamAccesser : public emExtendParamAccesser { +public: + emShellyParamAccesser(); + virtual ~emShellyParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emShellyParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emShellyParamAccesser g_emShellpodParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos.h b/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos.h new file mode 100644 index 0000000000..8af0effe4b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emSiralamos : public Enemy { + u8 unk5310[0x5364]; +public: + emSiralamos(u32 p1, emCreate* create); + virtual ~emSiralamos(); + // TODO: emSiralamos virtual functions +}; +static_assert(sizeof(emSiralamos) == 0xa674, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos_param_accesser.h new file mode 100644 index 0000000000..bbb201171f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/siralamos/em_siralamos_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emSiralamosParam { + +}; + +class emSiralamosParamAccesser : public emExtendParamAccesser { +public: + emSiralamosParamAccesser(); + virtual ~emSiralamosParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emSiralamosParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emSiralamosParamAccesser g_emArmightParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar.h b/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar.h new file mode 100644 index 0000000000..21e9d454a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class emSpar : public Enemy { + u8 unk5310[0xc0c]; +public: + emSpar(u32 p1, emCreate* create); + virtual ~emSpar(); + // TODO: emSpar virtual functions +}; +static_assert(sizeof(emSpar) == 0x5f1c, "Class is wrong size!"); + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar_param_accesser.h new file mode 100644 index 0000000000..2599862a23 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/spar/em_spar_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emSparParam { + +}; + +class emSparParamAccesser : public emExtendParamAccesser { +public: + emSparParamAccesser(); + virtual ~emSparParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emSparParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emSparParamAccesser g_emSpaakParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/stop/em_stop_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/stop/em_stop_module_impl.h new file mode 100644 index 0000000000..3253f8b752 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/stop/em_stop_module_impl.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include +#include + +class emStopModuleImpl : public soStopModuleImpl { +public: + emStopModuleImpl(soModuleAccesser* acc); + virtual ~emStopModuleImpl(); +}; +static_assert(sizeof(emStopModuleImpl) == 0x24, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo.h b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo.h new file mode 100644 index 0000000000..511f4df1ba --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emTaboo : public Enemy { + u8 unk5310[0x2248]; +public: + emTaboo(u32 p1, emCreate* create); + virtual ~emTaboo(); + // TODO: emTaboo virtual functions +}; +static_assert(sizeof(emTaboo) == 0x7558, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo_param_accesser.h new file mode 100644 index 0000000000..599f4a7eeb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/em_taboo_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emTabooParam { + +}; + +class emTabooParamAccesser : public emExtendParamAccesser { +public: + emTabooParamAccesser(); + virtual ~emTabooParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emTabooParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emTabooParamAccesser g_emTabuuParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/taboo/wnem_proc_taboo.h b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/wnem_proc_taboo.h new file mode 100644 index 0000000000..7051bf2afc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/taboo/wnem_proc_taboo.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +class wnemTabooProc { +public: + static void BodySplitBulletFly(wnemSimple* wn); + static void BodySplitBulletExplosion(wnemSimple* wn); + static void CometBulletFly(wnemSimple* wn); + static void CometBulletExplosion(wnemSimple* wn); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau.h b/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau.h new file mode 100644 index 0000000000..b80c4c7d8c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emTautau : public Enemy { + u8 unk5310[0xb0c]; +public: + emTautau(u32 p1, emCreate* create); + virtual ~emTautau(); + // TODO: emTautau virtual functions +}; +static_assert(sizeof(emTautau) == 0x5e1c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau_param_accesser.h new file mode 100644 index 0000000000..13faee6f79 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/tautau/em_tautau_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emTautauParam { + +}; + +class emTautauParamAccesser : public emExtendParamAccesser { +public: + emTautauParamAccesser(); + virtual ~emTautauParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emTautauParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emTautauParamAccesser g_emTowtowParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin.h b/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin.h new file mode 100644 index 0000000000..3313478be0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class emTeckin : public Enemy { + u8 unk5310[0xa24]; +public: + emTeckin(u32 p1, emCreate* create); + virtual ~emTeckin(); + // TODO: emTeckin virtual functions +}; +static_assert(sizeof(emTeckin) == 0x5d34, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin_param_accesser.h new file mode 100644 index 0000000000..e2a08d5121 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/teckin/em_teckin_param_accesser.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct emTeckinParam { + +}; + +class emTeckinParamAccesser : public emExtendParamAccesser { +public: + emTeckinParamAccesser(); + virtual ~emTeckinParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; +static_assert(sizeof(emTeckinParamAccesser) == 0xC, "Class is the wrong size!"); + +extern emTeckinParamAccesser g_emTickenParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_heap_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_heap_module_impl.h new file mode 100644 index 0000000000..7b1f7c8cc9 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_heap_module_impl.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include +#include + +class wnemHeapModuleImpl : public soHeapModule { + HeapType unk8; + HeapType unkC; +public: + wnemHeapModuleImpl(HeapType p1, HeapType p2); + virtual ~wnemHeapModuleImpl(); + virtual HeapType getInstanceHeap() const { return unk8; } + virtual HeapType getNWModelInstanceHeap() const { return unkC; } + virtual HeapType getNWMotionInstanceHeap() const { return unk8; } + virtual u32 getSlotNo() const; +}; +static_assert(sizeof(wnemHeapModuleImpl) == 0x10, "Class is wrong size!"); + +extern wnemHeapModuleImpl g_wnemHeapModule; diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_report.h b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_report.h new file mode 100644 index 0000000000..28e159d5a3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_report.h @@ -0,0 +1,3 @@ +#pragma once + +void wnemReport(const char* fmt, ...); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_resource_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_resource_module_impl.h new file mode 100644 index 0000000000..301fa2951c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wn_em_resource_module_impl.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include +#include + +class wnemResourceModuleImpl : public soResourceModuleImpl { +public: + wnemResourceModuleImpl(u32 p1, soResourceIdAccesser* rsrcIdAcc, u8 p3); + ~wnemResourceModuleImpl(); +}; +static_assert(sizeof(wnemResourceModuleImpl) == 0x18, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wnem_proc_common.h b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wnem_proc_common.h new file mode 100644 index 0000000000..283c9aba01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/em/wnem/wnem_proc_common.h @@ -0,0 +1,6 @@ +#pragma once + +class wnemCommonProc { +public: + static void Report(const char* fmt, ...); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/fighter.h b/include/lib/BrawlHeaders/Brawl/Include/ft/fighter.h new file mode 100644 index 0000000000..0963b4f5c3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/fighter.h @@ -0,0 +1,1505 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class itCustomizerInterface; +class ftOwner; + +class Fighter : public StageObject, public soStatusEventObserver, public soSituationEventObserver, public soCollisionAttackEventObserver, public soCollisionHitEventObserver, public soCollisionShieldEventObserver, public soCollisionReflectorEventObserver, public soCollisionAbsorberEventObserver, public soCollisionSearchEventObserver, public soCaptureEventObserver, public soItemManageEventObserver, public soMotionEventObserver, public soDamageEventObserver, public ftEntryEventObserver, public soTurnEventObserver { +public: + struct Status { + enum Kind { + Wait = 0x0, + Walk = 0x1, + Walk_Brake = 0x2, + Dash = 0x3, + Run = 0x4, + Run_Brake = 0x5, + Turn = 0x6, + Turn_Dash = 0x7, + Turn_Run = 0x8, + Turn_Run_Brake = 0x9, + Jump_Squat = 0xA, + Jump = 0xB, + Jump_Aerial = 0xC, + Fly = 0xD, + Fall = 0xE, + Fall_Aerial = 0xF, + Fall_Special = 0x10, + Squat = 0x11, + Squat_Wait = 0x12, + Squat_F = 0x13, + Squat_B = 0x14, + Squat_Rv = 0x15, + Landing = 0x16, + Landing_Light = 0x17, + Landing_Attack_Air = 0x18, + Landing_Fall_Special = 0x19, + Guard_On = 0x1A, + Guard = 0x1B, + Guard_Off = 0x1C, + Guard_Damage = 0x1D, + Escape = 0x1E, + Escape_F = 0x1F, + Escape_B = 0x20, + Escape_Air = 0x21, + Rebound_Stop = 0x22, + Rebound = 0x23, + Attack = 0x24, + Attack_100 = 0x25, + Attack_Dash = 0x26, + Attack_S3 = 0x27, + Attack_Hi3 = 0x28, + Attack_Lw3 = 0x29, + Attack_S4_Start = 0x2A, + Attack_S4_Hold = 0x2B, + Attack_S4 = 0x2C, + Attack_Lw4_Start = 0x2D, + Attack_Lw4_Hold = 0x2E, + Attack_Lw4 = 0x2F, + Attack_Hi4_Start = 0x30, + Attack_Hi4_Hold = 0x31, + Attack_Hi4 = 0x32, + Attack_Air = 0x33, + Catch = 0x34, + Catch_Pull = 0x35, + Catch_Dash = 0x36, + Catch_Dash_Pull = 0x37, + Catch_Turn = 0x38, + Catch_Wait = 0x39, + Catch_Attack = 0x3A, + Catch_Cut = 0x3B, + Throw = 0x3C, + Capture_Pulled = 0x3D, + Capture_Wait = 0x3E, + Capture_Damage = 0x3F, + Capture_Cut = 0x40, + Capture_Jump = 0x41, + Capture_Thrown = 0x42, + Damage = 0x43, + Damage_Air = 0x44, + Damage_Fly = 0x45, + Damage_Fly_Roll = 0x46, + Damage_Fly_Reflect_Lr = 0x47, + Damage_Fly_Reflect_U = 0x48, + Damage_Fall = 0x49, + Down = 0x4A, + Down_Spot = 0x4B, + Down_Continue = 0x4C, + Down_Wait = 0x4D, + Down_Wait_Continue = 0x4E, + Down_Eat = 0x4F, + Lay_Down = 0x50, + Down_Stand = 0x51, + Down_Stand_Fb = 0x52, + Down_Stand_Attack = 0x53, + Down_Damage = 0x54, + Down_Reflect_Lr = 0x55, + Shield_Break_Fly = 0x56, + Shield_Break_Fall = 0x57, + Shield_Break_Down = 0x58, + FuraFura_Stand = 0x59, + FuraFura = 0x5A, + FuraFura_End = 0x5B, + Damage_Song_Start = 0x5C, + Damage_Song = 0x5D, + Damage_Song_End = 0x5E, + Bind = 0x5F, + Passive = 0x60, + Passive_Fb = 0x61, + Passive_Wall = 0x62, + Passive_Wall_Jump = 0x63, + Passive_Ceil = 0x64, + Stop_Wall = 0x65, + Stop_Ceil = 0x66, + Wall_Jump = 0x67, + Attach_Wall = 0x68, + Attach_Wall_Wait = 0x69, + Detach_Wall = 0x6A, + Detach_Wall_Fall = 0x6B, + Detach_Wall_Jump = 0x6C, + Tread_Jump = 0x6D, + Tread_Damage = 0x6E, + Tread_Damage_Rv = 0x6F, + Tread_Damage_Air = 0x70, + Tread_Fall = 0x71, + Pass = 0x72, + Cliff_Catch_Move = 0x73, + Cliff_Catch = 0x74, + Cliff_Wait = 0x75, + Cliff_Attack = 0x76, + Cliff_Climb = 0x77, + Cliff_Escape = 0x78, + Cliff_Jump1 = 0x79, + Cliff_Jump2 = 0x7A, + Cliff_Jump3 = 0x7B, + Ottoto = 0x7C, + Ottoto_Wait = 0x7D, + Miss_Foot = 0x7E, + Air_Lasso = 0x7F, + Air_Lasso_Reach = 0x80, + Air_Lasso_Hang = 0x81, + Air_Lasso_Rewind = 0x82, + Air_Lasso_Failure = 0x83, + Glide_Start = 0x84, + Glide = 0x85, + Glide_Landing = 0x86, + Glide_Attack = 0x87, + Glide_End = 0x88, + Slip = 0x89, + Slip_Down = 0x8A, + Slip_Turn = 0x8B, + Slip_Dash = 0x8C, + Slip_Wait = 0x8D, + Slip_Stand = 0x8E, + Slip_Stand_Attack = 0x8F, + Slip_Stand_F = 0x90, + Slip_Stand_B = 0x91, + Ladder_Catch = 0x92, + Ladder_Catch_End = 0x93, + Ladder_Wait = 0x94, + Ladder_End = 0x95, + Item_Pickup_Light = 0x96, + Item_Pickup_Heavy = 0x97, + Item_Lift_Wait = 0x98, + Item_Lift_Turn = 0x99, + Item_Lift_Walk = 0x9A, + Item_Throw = 0x9B, + Item_Throw_Dash = 0x9C, + Item_Throw_Heavy = 0x9D, + Item_Swing = 0x9E, + Item_Swing_S3 = 0x9F, + Item_Swing_S4_Start = 0xA0, + Item_Swing_S4 = 0xA1, + Item_Swing_S4_Hold = 0xA2, + Item_Swing_Dash = 0xA3, + Item_Shoot_Wait = 0xA4, + Item_Shoot_Walk_F = 0xA5, + Item_Shoot_Walk_Brake_F = 0xA6, + Item_Shoot_Walk_B = 0xA7, + Item_Shoot_Walk_Brake_B = 0xA8, + Item_Shoot_Dash_F = 0xA9, + Item_Shoot_Dash_B = 0xAA, + Item_Shoot_Jump_Squat = 0xAB, + Item_Shoot_Jump = 0xAC, + Item_Shoot_Air = 0xAD, + Item_Shoot_Landing = 0xAE, + Item_Screw_Jump = 0xAF, + Item_Screw_Jump_Aerial = 0xB0, + Item_Screw_Fall = 0xB1, + Item_Assist_Hoist = 0xB2, + Swim_Dive = 0xB3, + Swim_Rise = 0xB4, + Swim_Up = 0xB5, + Swim_Wait = 0xB6, + Swim = 0xB7, + Swim_End = 0xB8, + Swim_Turn = 0xB9, + Swim_Jump = 0xBA, + Swim_Drown = 0xBB, + Swim_Drown_Out = 0xBC, + Dead = 0xBD, + Rebirth = 0xBE, + Gimmick_Door = 0xBF, + Gimmick_Barrel = 0xC0, + Gimmick_Catapult = 0xC1, + Gimmick_Truck = 0xC2, + Gimmick_Spring = 0xC3, + Gimmick_Spring_Jump = 0xC4, + Gimmick_Spring_Back = 0xC5, + Gimmick_Eaten = 0xC6, + Bury = 0xC7, + Bury_Wait = 0xC8, + Bury_Jump = 0xC9, + Ice = 0xCA, + Ice_Jump = 0xCB, + Bitten_Wario_Start = 0xCC, + Bitten_Wario = 0xCD, + Bitten_Wario_End = 0xCE, + Clung_Captain = 0xCF, + Swallowed = 0xD0, + Swallowed_Drink = 0xD1, + Swallowed_Capture = 0xD2, + Swallowed_Thrown_Star = 0xD3, + Swallowed_Thrown = 0xD4, + Swallowed_Canceled = 0xD5, + Clung_Diddy = 0xD6, + Clung_Damage_Diddy = 0xD7, + Clung_Thrown_Diddy = 0xD8, + Shouldered_Donkey_Start = 0xD9, + Shouldered_Donkey = 0xDA, + Shouldered_Donkey_Thrown = 0xDB, + Warpstar = 0xDC, + Warpstar_Jump = 0xDD, + Dragoon_Ride = 0xDE, + Hammer_Wait = 0xDF, + Hammer_Walk = 0xE0, + Hammer_Turn = 0xE1, + Hammer_Jump_Squat = 0xE2, + Hammer_Jump = 0xE3, + Hammer_Fall = 0xE4, + Hammer_Landing = 0xE5, + Clung_Ganon = 0xE6, + Catched_Ganon = 0xE7, + Catched_Air_Ganon = 0xE8, + Catched_Air_Fall_Ganon = 0xE9, + Catched_Air_End_Ganon = 0xEA, + Capture_Yoshi = 0xEB, + Yoshi_Egg = 0xEC, + Link_Final = 0xED, + Koopa_Dived = 0xEE, + Metaknight_Final = 0xEF, + Pit_Fall = 0xF0, + Throw_Kirby = 0xF1, + Big = 0xF2, + Small = 0xF3, + Heart_Swap = 0xF4, + Heart_Swap_End = 0xF5, + Adv_Follow = 0xF6, + Ike_Final_Damage_Fly = 0xF7, + Ike_Final_Damage = 0xF8, + Ike_Final_Damage_Fall = 0xF9, + Capture_Masterhand = 0xFA, + Final_Visual_Attack_Other = 0xFB, + Captain_Final_Start = 0xFC, + Captain_Final_FuraFura = 0xFD, + Captain_Final_Clash = 0xFE, + Captain_Final_End = 0xFF, + Kirby_Final_Damage_Fly = 0x100, + Kirby_Final_Damage_Wait = 0x101, + Capture_Gokulin = 0x102, + Capture_Cut_Gokulin = 0x103, + Capture_Taboo = 0x104, + Capture_Bucyulus = 0x105, + Capture_Cut_Bucyulus = 0x106, + Capture_Pulled_Yoshi = 0x107, + Capture_Wait_Yoshi = 0x108, + Capture_Damage_Yoshi = 0x109, + Capture_Cut_Yoshi = 0x10A, + Standby = 0x10B, + Appeal = 0x10C, + Smash_Appeal = 0x10D, + Entry = 0x10E, + Win = 0x10F, + Lose = 0x110, + Test_Motion = 0x111 + }; + + struct Transition { + enum TermId { + Term_Wait = 10000, + Term_Wait_From_Run_Brake = 10001, + Term_Fall = 10002, + Term_Fall_Aerial = 10003, + Term_Fall_Special = 10004, + Term_Damage_Fall = 10005, + Term_Damage_Fly_Reflect_L = 10006, // TODO: Verify + Term_Damage_Fly_Reflect_R = 10007, // TODO: Verify + Term_Damage_Fly_Reflect_U = 10008, // TODO: Verify + Term_Dash_To_Run = 10009, + Term_Slip = 10010, + Term_Run = 10011, + Term_Down = 10012, + Term_Down_Wait = 10013, + Term_Down_Stand = 10014, + Term_Down_Damage_Fall = 10015, + Term_Down_Damage_Reflect_L = 10016, + Term_Down_Damage_Reflect_R = 10017, + Term_Passive = 10018, + Term_Passive_Fb = 10019, + Term_Passive_Wall = 10020, + Term_Passive_Wall_Jump = 10021, + Term_Passive_Wall_Jump_Button = 10022, + Term_Passive_Ceil = 10023, + Term_Stop_Wall = 10024, + Term_Stop_Ceil = 10025, + Term_Landing = 10026, + Term_Landing_Light = 10027, + Term_Landing_Attack_Air = 10028, + Term_Landing_Fall_Special = 10029, + Term_Cliff_Catch = 10030, + Term_Glide = 10031, + Term_Glide_Landing = 10032, + Term_Squat_Wait = 10033, + Term_Catch_Wait = 10034, + Term_Capture_Wait = 10035, + Term_Capture_Cut = 10036, + Term_Cont_Escape = 10037, + Term_Cont_Escape_F = 10038, + Term_Cont_Escape_B = 10039, + Term_Cont_Guard_On = 10040, + Term_Cont_Guard = 10041, + Term_Cont_Jump_Squat = 10042, + Term_Cont_Jump_Squat_Button = 10043, + Term_Cont_Dash = 10044, + Term_Cont_Run_Brake = 10045, + Term_Cont_Turn = 10046, + Term_Cont_Turn_Run = 10047, + Term_Cont_Turn_Dash = 10048, + Term_Cont_Turn_Dash_Dash = 10049, + Term_Cont_Slip_Turn = 10050, + Term_Cont_Squat = 10051, + Term_Cont_Squat_Rv = 10052, + Term_Cont_Squat_Wait = 10053, + Term_Cont_Squat_F = 10054, + Term_Cont_Squat_B = 10055, + Term_Cont_Appeal_Hi = 10056, + Term_Cont_Appeal_S = 10057, + Term_Cont_Appeal_Lw = 10058, + Term_Cont_Walk = 10059, + Term_Cont_Escape_Air = 10060, + Term_Cont_Jump_Aerial = 10061, + Term_Cont_Jump_Aerial_Button = 10062, + Term_Cont_Tread_Jump = 10063, + Term_Cont_Tread_Jump_Button = 10064, + Term_Cont_Tread_Jump_No_Trigger = 10065, + Term_Cont_Fly = 10066, + Term_Cont_Fly_Button = 10067, + Term_Cont_Fly_Next = 10068, + Term_Cont_Cliff_Attack = 10069, + Term_Cont_Cliff_Special = 10070, + Term_Cont_Cliff_Escape = 10071, + Term_Cont_Cliff_Climb = 10072, + Term_Cont_Cliff_Fall = 10073, + Term_Cont_Cliff_Jump = 10074, + Term_Cont_Cliff_Jump_Button = 10075, + Term_Cont_Glide_Start = 10076, + Term_Cont_Glide_End = 10077, + Term_Cont_Glide_Attack = 10078, + Term_Cont_Pass = 10079, + Term_Cont_Air_Lasso = 10080, + Term_Cont_Attack = 10081, + Term_Cont_Attack_100 = 10082, + Term_Cont_Attack_Dash = 10083, + Term_Cont_Attack_S3 = 10084, + Term_Cont_Attack_Hi3 = 10085, + Term_Cont_Attack_Lw3 = 10086, + Term_Cont_Attack_S4 = 10087, + Term_Cont_Attack_S4_Start = 10088, + Term_Cont_Attack_S4_Hold = 10089, + Term_Cont_Attack_Hi4 = 10090, + Term_Cont_Attack_Hi4_Start = 10091, + Term_Cont_Attack_Hi4_Hold = 10092, + Term_Cont_Attack_Lw4 = 10093, + Term_Cont_Attack_Lw4_Start = 10094, + Term_Cont_Attack_Lw4_Hold = 10095, + Term_Cont_Attack_Air = 10096, + Term_Cont_Special_N = 10097, + Term_Cont_Special_S = 10098, + Term_Cont_Special_Hi = 10099, + Term_Cont_Special_Lw = 10100, + Term_Cont_Throw_Fb = 10101, + Term_Cont_Throw_Hi = 10102, + Term_Cont_Throw_Lw = 10103, + Term_Cont_Catch = 10104, + Term_Cont_Catch_Dash = 10105, + Term_Cont_Catch_Turn = 10106, + Term_Cont_Capture_Jump_Button = 10107, + Term_Cont_Capture_Jump = 10108, + Term_Cont_Item_Pickup_Light = 10109, + Term_Cont_Item_Pickup_Heavy = 10110, + Term_Cont_Item_Throw = 10111, + Term_Cont_Item_Throw_Guard = 10112, + Term_Cont_Item_Throw_Force = 10113, + Term_Cont_Item_Throw_Force_Dash = 10114, + Term_Cont_Item_Throw_Dash = 10115, + Term_Cont_Item_Throw_Dash_Clacker = 10116, + Term_Cont_Item_Swing_Bat_4 = 10117, + Term_Cont_Item_Swing_4 = 10118, + Term_Cont_Item_Swing_4_Hold = 10119, + Term_Cont_Item_Swing_3 = 10120, + Term_Cont_Item_Swing = 10121, + Term_Cont_Item_Swing_Dash = 10122, + Term_Cont_Item_Shoot = 10123, + Term_Cont_Item_Shoot_S3 = 10124, + Term_Cont_Item_Shoot_S4 = 10125, + Term_Cont_Item_Shoot_Wait = 10126, + Term_Cont_Item_Shoot_Walk_F = 10127, + Term_Cont_Item_Shoot_Walk_F_Brake = 10128, + Term_Cont_Item_Shoot_Walk_B = 10129, + Term_Cont_Item_Shoot_Walk_B_Brake = 10130, + Term_Cont_Item_Shoot_Dash_F = 10131, + Term_Cont_Item_Shoot_Dash_B = 10132, + Term_Cont_Item_Shoot_Air = 10133, + Term_Cont_Item_Shoot_Air_Pass = 10134, + Term_Cont_Item_Shoot_Jump_Button = 10135, + Term_Cont_Item_Shoot_Jump = 10136, + Term_Cont_Item_Shoot_Turn_Dash = 10137, + Term_Cont_Item_Shoot_Landing = 10138, + Term_Item_Gekikara_Wait = 10139, + Term_Item_Gekikara_Run = 10140, + Term_Cont_Item_Gekikara_Run_Brake = 10141, + Term_Throw_Kirby_Ground = 10142, + Term_Final = 10143, + Term_Throw_Enemy = 10144, + Term_Smash_Appeal = 10145, // TODO: Verify + }; + + enum TermGroupId { + // 0x0 + Group_Chk_Ground_Special = 0x1, + Group_Chk_Ground_Item = 0x2, + Group_Chk_Ground_Catch = 0x3, + Group_Chk_Ground_Attack = 0x4, + Group_Chk_Ground_Escape = 0x5, + Group_Chk_Ground_Guard = 0x6, + Group_Chk_Ground_Jump = 0x7, + Group_Chk_Ground = 0x8, + Group_Chk_Air_Landing = 0x9, + Group_Chk_Air_Cliff = 0xA, + Group_Chk_Air_Special = 0xB, + Group_Chk_Air_Item_Throw = 0xC, + Group_Chk_Air_Lasso = 0xD, + Group_Chk_Air_Escape = 0xE, + Group_Chk_Air_Attack = 0xF, + Group_Chk_Air_Tread_Jump = 0x10, + Group_Chk_Air_Wall_Jump = 0x11, + Group_Chk_Air_Jump_Aerial = 0x12, + // 0x13 + }; + }; + + struct Work { + enum Int { + + }; + + enum Float { + Float_Reserve_Hold_Rate = 0x21000000, + Float_Rebound_Frame = 0x21000001, + Float_Rebound_Lr = 0x21000002, + }; + + enum Flag { + Flag_Reserve_Dive = 0x22000002, + Flag_Reserve_Check_Dead_Area_Force = 0x22000004, + Flag_Reserve_Jump_Mini = 0x22000006, + Flag_Reserve_Jump_From_Tread = 0x22000007, + Flag_Reserve_Jump_From_Ladder = 0x22000008, + + Flag_Reserve_Jump_From_Shoot = 0x2200000A, + Flag_Reserve_Jump_From_Water = 0x2200000B, + Flag_Reserve_Jump_From_Spring = 0x2200000C, + Flag_Reserve_Disable_Outside_Energy = 0x2200000D, + }; + }; + + struct Attack_Air { + struct Work { + enum Int { + Int_Motion_Kind = 0x20000000, + }; + enum Float { + + }; + enum Flag { + + }; + }; + }; + + struct Tread { + struct Work { + enum Int { + + }; + enum Float { + Float_Jump_Speed_Mul = 0x21000004, + }; + enum Flag { + + }; + }; + }; + + struct Item_Throw { + struct Work { + enum Int { + + }; + enum Float { + Float_Lr = 0x21000004, + }; + enum Flag { + + }; + }; + }; + + struct Ladder { + struct Work { + enum Int { + + }; + enum Float { + Float_Ladder_Upper_X = 0x21000004, + Float_Ladder_Upper_Y = 0x21000005, + Float_Ladder_End_X = 0x21000005, + Float_Ladder_End_Y = 0x21000006, + Float_Ladder_End_Start_X = 0x21000007, + Float_Ladder_End_Start_Y = 0x21000008, + }; + enum Flag { + Flag_Fall = 0x22000010, + }; + }; + }; + + struct Swim { + struct Work { + enum Int { + Int_Water_Task_Id = 0x20000002, + Int_Eff_Counter = 0x20000003, + Int_No_Water_Frame = 0x20000004, + }; + enum Float { + + }; + enum Flag { + Flag_Damage = 0x22000010 + }; + }; + }; + + struct Dead { + struct Work { + enum Int { + }; + enum Float { + }; + enum Flag { + }; + }; + }; + + struct Gimmick_Door { + enum Step { + Step_Turn = 0x0, + Step_Walk_To_Center = 0x1, + Step_Walk_Through = 0x2, + Step_Wait = 0x3, + }; + struct Work { + enum Int { + Int_Step = 0x20000000, + }; + enum Float { + Float_Center_X = 0x21000004, + Float_Center_Y = 0x21000005, + }; + enum Flag { + Flag_No_Into = 0x22000010, + }; + }; + }; + + struct Gimmick_Spring { + struct Work { + enum Int { + + }; + enum Float { + Float_Shoot_Speed_Y = 0x21000004, + Float_Shoot_Angle = 0x21000005, + }; + enum Flag { + + }; + }; + }; + + struct Gimmick_Barrel { + enum Step { + Step_In = 0x0, + Step_Shoot_Wait = 0x1, + Step_Shoot = 0x2, + }; + struct Work { + enum Int { + Int_Step = 0x20000000, + Int_Break_Hitstop_Frame = 0x20000002, + }; + enum Float { + Float_Fall_Speed = 0x21000004, + Float_Shoot_Offset_X = 0x21000005, + Float_Shoot_Offset_Y = 0x21000006, + }; + enum Flag { + Flag_End_Speed = 0x22000010, + }; + }; + }; + + struct Gimmick_Truck { + struct Work { + enum Int { + + }; + enum Float { + Float_Speed_X = 0x21000004, + Float_Speed_Y = 0x21000005, + }; + enum Flag { + Flag_Run = 0x22000010, + }; + }; + }; + }; + + struct Motion { + enum Kind { + Wait_1 = 0x0, + Wait_2 = 0x1, + Wait_3 = 0x2, + Tex_Anim = 0x3, + + Wait_Item = 0x5, + Item_Hand_Pickup = 0x6, + Item_Hand_Have = 0x7, + Item_Hand_Grip = 0x8, + Item_Hand_Smash = 0x9, + Walk_Slow = 0xA, + Walk_Middle = 0xB, + Walk_Fast = 0xC, + Walk_Brake = 0xD, + Dash = 0xE, + Run = 0xF, + Run_Brake = 0x10, + Turn = 0x11, + Turn_Run = 0x12, + Turn_Run_Brake = 0x13, + Jump_Squat = 0x14, + Jump_F = 0x15, + Jump_F_ = 0x16, + Jump_B = 0x17, + Jump_B_ = 0x18, + Jump_Aerial_F = 0x19, + Jump_Aerial_B = 0x1A, + Special_N_Cancel = 0x1B, + Special_Air_N_Cancel = 0x1C, + Appeal_Brawl_Lw_R = 0x1D, + Appeal_Brawl_Lw_L = 0x1E, + Appeal_Brawl_S = 0x1F, + Fall = 0x20, + Fall_F = 0x21, + Fall_B = 0x22, + Fall_Aerial = 0x23, + Fall_Aerial_F = 0x24, + Fall_Aerial_B = 0x25, + Fall_Special = 0x26, + Fall_Special_F = 0x27, + Fall_Special_B = 0x28, + Damage_Fall = 0x29, + Squat = 0x2A, + Squat_Wait = 0x2B, + Squat_Wait_2 = 0x2C, + Squat_Wait_Item = 0x2D, + Squat_F = 0x2E, + Squat_B = 0x2F, + Squat_Rv = 0x30, + Landing_Light = 0x31, + Landing_Heavy = 0x32, + Landing_Fall_Special = 0x33, + Step_Jump = 0x34, + Step_Pose = 0x35, + Step_Back = 0x36, + Step_Air_Pose = 0x37, + Step_Fall = 0x38, + Glide_Start = 0x39, + Glide_Direction = 0x3A, + Glide_Wing = 0x3B, + Glide_Attack = 0x3C, + Glide_End = 0x3D, + Glide_Landing = 0x3E, + Guard_On = 0x3F, + Guard = 0x40, + Guard_Off = 0x41, + Guard_Damage = 0x42, + Escape_N = 0x43, + Escape_F = 0x44, + Escape_B = 0x45, + Escape_Air = 0x46, + Rebound = 0x47, + Attack_11 = 0x48, + Attack_12 = 0x49, + Attack_13 = 0x4A, + Attack_100_Start = 0x4B, + Attack_100 = 0x4C, + Attack_End = 0x4D, + Attack_Dash = 0x4E, + Attack_S3_Hi = 0x4F, + Attack_S3_S = 0x50, + Attack_Dash_Air = 0x51, + + Attack_S3_Lw = 0x53, + Attack_Hi_3 = 0x54, + Attack_Lw_3 = 0x55, + Attack_S4_Start = 0x56, + Attack_S4_Hi = 0x57, + Attack_S4_S = 0x58, + + Attack_S4_Lw = 0x5A, + Attack_S4_Hold = 0x5B, + Attack_Hi_4_Start = 0x5C, + Attack_Hi_4 = 0x5D, + Attack_Hi_4_Hold = 0x5E, + Attack_Lw_4_Start = 0x5F, + Attack_Lw_4 = 0x60, + Attack_Lw_4_Hold = 0x61, + Attack_Air_N = 0x62, + Attack_Air_F = 0x63, + Attack_Air_B = 0x64, + Attack_Air_Hi = 0x65, + Attack_Air_Lw = 0x66, + Landing_Air_N = 0x67, + Landing_Air_F = 0x68, + Landing_Air_B = 0x69, + Landing_Air_Hi = 0x6A, + Landing_Air_Lw = 0x6B, + Catch = 0x6C, + Catch_Dash = 0x6D, + Catch_Turn = 0x6E, + Catch_Wait = 0x6F, + Catch_Attack = 0x70, + Catch_Cut = 0x71, + Throw_B = 0x72, + Throw_F = 0x73, + Throw_Hi = 0x74, + Throw_Lw = 0x75, + Thrown_B = 0x76, + Thrown_F = 0x77, + Thrown_Hi = 0x78, + Thrown_Lw = 0x79, + Thrown_Dx_B = 0x7A, + Thrown_Dx_F = 0x7B, + Thrown_Dx_Hi = 0x7C, + Thrown_Dx_Lw = 0x7D, + Capture_Pulled_Hi = 0x7E, + Capture_Wait_Hi = 0x7F, + Capture_Damage_Hi = 0x80, + Capture_Pulled_Lw = 0x81, + Capture_Wait_Lw = 0x82, + Capture_Damage_Lw = 0x83, + Capture_Pulled_Snake = 0x84, + Capture_Wait_Snake = 0x85, + Capture_Damage_Snake = 0x86, + Capture_Pulled_Snake_ = 0x87, + Capture_Wait_Snake_ = 0x88, + Capture_Damage_Snake_ = 0x89, + Capture_Pulled_Dx_Snake = 0x8A, + Capture_Wait_Dx_Snake = 0x8B, + Capture_Damage_Dx_Snake = 0x8C, + Capture_Pulled_Dx_Snake_ = 0x8D, + Capture_Wait_Dx_Snake_ = 0x8E, + Capture_Damage_Dx_Snake_ = 0x8F, + Capture_Pulled_Big_Snake = 0x90, + Capture_Wait_Big_Snake = 0x91, + Capture_Damage_Big_Snake = 0x92, + Capture_Pulled_Big_Snake_ = 0x93, + Capture_Wait_Big_Snake_ = 0x94, + Capture_Damage_Big_Snake_ = 0x95, + Capture_Cut = 0x96, + Capture_Jump = 0x97, + Damage_Hi_1 = 0x98, + Damage_Hi_2 = 0x99, + Damage_Hi_3 = 0x9A, + Damage_N_1 = 0x9B, + Damage_N_2 = 0x9C, + Damage_N_3 = 0x9D, + Damage_Lw_1 = 0x9E, + Damage_Lw_2 = 0x9F, + Damage_Lw_3 = 0xA0, + Damage_Air_1 = 0xA1, + Damage_Air_2 = 0xA2, + Damage_Air_3 = 0xA3, + Damage_Fly_Hi = 0xA4, + Damage_Fly_N = 0xA5, + Damage_Fly_Lw = 0xA6, + Damage_Fly_Top = 0xA7, + Damage_Fly_Roll = 0xA8, + Damage_Elec = 0xA9, + Down_Bound_U = 0xAA, + Down_Wait_U = 0xAB, + Down_Damage_U = 0xAC, + Down_Damage_U_3 = 0xAD, + Down_Eat_U = 0xAE, + Down_Stand_U = 0xAF, + Down_Attack_U = 0xB0, + Down_Forward_U = 0xB1, + Down_Back_U = 0xB2, + Down_Bound_D = 0xB3, + Down_Wait_D = 0xB4, + Down_Damage_D = 0xB5, + Down_Damage_D_3 = 0xB6, + Down_Eat_D = 0xB7, + Down_Stand_D = 0xB8, + Down_Attack_D = 0xB9, + Down_Forward_D = 0xBA, + Down_Back_D = 0xBB, + Down_Spot_U = 0xBC, + Down_Spot_D = 0xBD, + Passive = 0xBE, + Passive_Stand_F = 0xBF, + Passive_Stand_B = 0xC0, + Passive_Wall = 0xC1, + Passive_Wall_Jump = 0xC2, + Passive_Ceil = 0xC3, + Passive_Wall_Attach = 0xC4, + FuraFura = 0xC5, + FuraFura_Start_U = 0xC6, + FuraFura_Start_D = 0xC7, + FuraFura_End = 0xC8, + Fura_Sleep_Start = 0xC9, + Fura_Sleep_Loop = 0xCA, + Fura_Sleep_End = 0xCB, + Swallowed = 0xCC, + Pass = 0xCD, + Ottotto = 0xCE, + Ottotto_Wait = 0xCF, + Wall_Damage = 0xD0, + Stop_Ceil = 0xD1, + Stop_Wall = 0xD2, + Stop_Ceil_ = 0xD3, + Miss_Foot = 0xD4, + Cliff_Catch = 0xD5, + Cliff_Wait = 0xD6, + Cliff_Attack_Quick = 0xD7, + Cliff_Climb_Quick = 0xD8, + Cliff_Escape_Quick = 0xD9, + Cliff_Jump_Quick_1 = 0xDA, + Cliff_Jump_Quick_2 = 0xDB, + Cliff_Attack_Slow = 0xDC, + Cliff_Climb_Slow = 0xDD, + Cliff_Escape_Slow = 0xDE, + Cliff_Jump_Slow_1 = 0xDF, + Cliff_Jump_Slow_2 = 0xE0, + Slip_Down = 0xE1, + Slip = 0xE2, + Slip_Turn = 0xE3, + Slip_Dash = 0xE4, + Slip_Wait = 0xE5, + Slip_Stand = 0xE6, + Slip_Attack = 0xE7, + Slip_Escape_F = 0xE8, + Slip_Escape_B = 0xE9, + Air_Catch = 0xEA, + Air_Catch_Pose = 0xEB, + Air_Catch_Hit = 0xEC, + Air_Catch_ = 0xED, + Swim_Rise = 0xEE, + Swim_Up = 0xEF, + Swim_Up_Damage = 0xF0, + Swim = 0xF1, + Swim_F = 0xF2, + Swim_End = 0xF3, + Swim_Turn = 0xF4, + Swim_Drown = 0xF5, + Swim_Drown_Out = 0xF6, + Light_Get = 0xF7, + Light_Walk_Get = 0xF8, + Light_Eat = 0xF9, + Walk_Eat = 0xFA, + Heavy_Get = 0xFB, + Heavy_Walk_1 = 0xFC, + Heavy_Walk_2 = 0xFD, + Light_Throw_Drop = 0xFE, + Light_Throw_F = 0xFF, + Light_Throw_B = 0x100, + Light_Throw_Hi = 0x101, + Light_Throw_Lw = 0x102, + Light_Throw_F_ = 0x103, + Light_Throw_B_ = 0x104, + Light_Throw_Hi_ = 0x105, + Light_Throw_Lw_ = 0x106, + Light_Throw_Dash = 0x107, + Light_Throw_Air_F = 0x108, + Light_Throw_Air_B = 0x109, + Light_Throw_Air_Hi = 0x10A, + Light_Throw_Air_Lw = 0x10B, + Light_Throw_Air_F_ = 0x10C, + Light_Throw_Air_B_ = 0x10D, + Light_Throw_Air_Hi_ = 0x10E, + Light_Throw_Air_Lw_ = 0x10F, + Heavy_Throw_F = 0x110, + Heavy_Throw_B = 0x111, + Heavy_Throw_Hi = 0x112, + Heavy_Throw_Lw = 0x113, + Heavy_Throw_F_ = 0x114, + Heavy_Throw_B_ = 0x115, + Heavy_Throw_Hi_ = 0x116, + Heavy_Throw_Lw_ = 0x117, + Smash_Throw_F = 0x118, + Smash_Throw_B = 0x119, + Smash_Throw_Hi = 0x11A, + Smash_Throw_Lw = 0x11B, + Smash_Throw_Dash = 0x11C, + Smash_Throw_Air_F = 0x11D, + Smash_Throw_Air_B = 0x11E, + Smash_Throw_Air_Hi = 0x11F, + Smash_Throw_Air_Lw = 0x120, + Swing_1_Sword = 0x121, + Swing_3_Sword = 0x122, + Swing_4_Start_Sword = 0x123, + Swing_4_Sword = 0x124, + Swing_4_2_Sword = 0x125, + Swing_4_Hold_Sword = 0x126, + Swing_Dash_Sword = 0x127, + Swing_1_Bat = 0x128, + Swing_3_Bat = 0x129, + Swing_4_Bat = 0x12A, + Swing_Dash_Bat = 0x12B, + Swing_1_Harisen = 0x12C, + Swing_3_Harisen = 0x12D, + Swing_4_Start_Harisen = 0x12E, + Swing_4_Harisen = 0x12F, + Swing_4_2_Harisen = 0x130, + Swing_4_Hold_Harisen = 0x131, + Swing_Dash_Harisen = 0x132, + Swing_1_StarRod = 0x133, + Swing_3_StarRod = 0x134, + Swing_4_Start_StarRod = 0x135, + Swing_4_StarRod = 0x136, + Swing_4_2_StarRod = 0x137, + Swing_4_Hold_StarRod = 0x138, + Swing_Dash_StarRod = 0x139, + Swing_1_LipStick = 0x13A, + Swing_3_LipStick = 0x13B, + Swing_4_Start_LipStick = 0x13C, + Swing_4_LipStick = 0x13D, + Swing_4_2_LipStick = 0x13E, + Swing_4_Hold_LipStick = 0x13F, + Swing_Dash_LipStick = 0x140, + Item_Hammer_Wait = 0x141, + Item_Hammer_Move = 0x142, + Item_Hammer_Air = 0x143, + Item_Hammer_Wait_ = 0x144, + Item_Hammer_Move_ = 0x145, + Item_Hammer_Air_ = 0x146, + Item_Warpstar_Ride = 0x147, + Item_Screw = 0x148, + Item_Screw_Aerial = 0x149, + Item_Screw_Fall = 0x14A, + Guard_On_ = 0x14B, + Item_Dragoon_Get = 0x14C, + Item_Dragoon_Ride = 0x14D, + Item_Big = 0x14E, + Item_Small = 0x14F, + Item_Legs_Wait = 0x150, + Item_Legs_Slow_F = 0x151, + Item_Legs_Middle_F = 0x152, + Item_Legs_Fast_F = 0x153, + Item_Legs_Brake_F = 0x154, + Item_Legs_Dash_F = 0x155, + Item_Legs_Slow_B = 0x156, + Item_Legs_Middle_B = 0x157, + Item_Legs_Fast_B = 0x158, + Item_Legs_Brake_B = 0x159, + Item_Legs_Dash_B = 0x15A, + Item_Legs_Jump_Squat = 0x15B, + Item_Legs_Landing = 0x15C, + Item_Shoot_Gun = 0x15D, + Item_Shoot_Air_Gun = 0x15E, + Item_Shoot_Gun_Empty = 0x15F, + Item_Shoot_Air_Gun_Empty = 0x160, + Item_Shoot_Flower = 0x161, + Item_Shoot_Air_Flower = 0x162, + Item_Scope_Start = 0x163, + Item_Scope_Rapid = 0x164, + Item_Scope_Fire = 0x165, + Item_Scope_End = 0x166, + Item_Scope_Air_Start = 0x167, + Item_Scope_Air_Rapid = 0x168, + Item_Scope_Air_Fire = 0x169, + Item_Scope_Air_End = 0x16A, + Item_Scope_Start_Empty = 0x16B, + Item_Scope_Rapid_Empty = 0x16C, + Item_Scope_Fire_Empty = 0x16D, + Item_Scope_End_Empty = 0x16E, + Item_Scope_Air_Start_Empty = 0x16F, + Item_Scope_Air_Rapid_Empty = 0x170, + Item_Scope_Air_Fire_Empty = 0x171, + Item_Scope_Air_End_Empty = 0x172, + Item_Launcher = 0x173, + Item_Launcher_Fire = 0x174, + Item_Launcher_Air_Fire = 0x175, + Item_Launcher_Empty = 0x176, + Item_Launcher_Fire_Empty = 0x177, + Item_Launcher_Air_Fire_Empty = 0x178, + Item_Launcher_Fall = 0x179, + Item_Launcher_Air = 0x17A, + Item_Assist = 0x17B, + Gekikara_Wait = 0x17C, + Barrel = 0x17D, + Catapult = 0x17E, + Ladder_Wait = 0x17F, + Ladder_Up = 0x180, + Ladder_Down = 0x181, + Ladder_Catch_R = 0x182, + Ladder_Catch_L = 0x183, + Ladder_Catch_Air_R = 0x184, + Ladder_Catch_Air_L = 0x185, + Ladder_Catch_End_R = 0x186, + Ladder_Catch_End_L = 0x187, + Rope_Catch = 0x188, + Rope_Fishing = 0x189, + Special_N_Bitten_Start = 0x18A, + Special_N_Bitten = 0x18B, + Special_N_Bitten_End = 0x18C, + Special_Air_N_Bitten_Start = 0x18D, + Special_Air_N_Bitten = 0x18E, + Special_Air_N_Bitten_End = 0x18F, + Special_N_Dx_Bitten_Start = 0x190, + Special_N_Dx_Bitten = 0x191, + Special_N_Dx_Bitten_End = 0x192, + Special_Air_N_Dx_Bitten_Start = 0x193, + Special_Air_N_Dx_Bitten = 0x194, + Special_Air_N_Dx_Bitten_End = 0x195, + Special_N_Big_Bitten_Start = 0x196, + Special_N_Big_Bitten = 0x197, + Special_N_Big_Bitten_End = 0x198, + Special_Air_N_Big_Bitten_Start = 0x199, + Special_AIr_N_Big_Bitten = 0x19A, + Special_Air_N_Big_Bitten_End = 0x19B, + Special_Hi_Capture = 0x19C, + Special_Hi_Dx_Capture = 0x19D, + Special_S_Stick_Capture = 0x19E, + Special_S_Stick_Attack_Capture = 0x19F, + Special_S_Stick_Jump_Capture = 0x1A0, + Special_S_Dx_Stick_Capture = 0x1A1, + Special_S_Dx_Stick_Attack_Capture = 0x1A2, + Special_S_Dx_Stick_Jump_Capture = 0x1A3, + Thrown_Zitabata = 0x1A4, + Thrown_Dx_Zitabata = 0x1A5, + Thrown_Girl_Zitabata = 0x1A6, + Thrown_F_F = 0x1A7, + Thrown_F_B = 0x1A8, + Thrown_F_Hi = 0x1A9, + Thrown_F_Lw = 0x1AA, + Thrown_Dx_F_F = 0x1AB, + Thrown_Dx_F_B = 0x1AC, + Thrown_Dx_F_Hi = 0x1AD, + Thrown_Dx_F_Lw = 0x1AE, + Ganon_Special_Hi_Capture = 0x1AF, + Ganon_Special_Hi_Dx_Capture = 0x1B0, + Special_S_Capture = 0x1B1, + Special_Air_S_Catch_Capture = 0x1B2, + Special_Air_S_Fall_Capture = 0x1B3, + Special_Air_S_Capture = 0x1B4, + Special_S_Dx_Capture = 0x1B5, + Special_Air_S_Dx_Catch_Capture = 0x1B6, + Special_Air_S_Dx_Fall_Capture = 0x1B7, + Special_Air_S_Dx_Capture = 0x1B8, + Special_N_Egg = 0x1B9, + Special_S_Zitabata = 0x1BA, + Special_S_Dx_Zitabata = 0x1BB, + Appeal_Hi_R = 0x1BC, + Appeal_Hi_L = 0x1BD, + Appeal_S_R = 0x1BE, + Appeal_S_L = 0x1BF, + Appeal_Lw_R = 0x1C0, + Appeal_Lw_L = 0x1C1, + Entry_R = 0x1C2, + Entry_L = 0x1C3, + Win_1 = 0x1C4, + Win_1_Wait = 0x1C5, + Win_2 = 0x1C6, + Win_2_Wait = 0x1C7, + Win_3 = 0x1C8, + Win_3_Wait = 0x1C9, + Lose = 0x1CA, + Damage_Face = 0x1CB, + Dark = 0x1CC, + Spycloak = 0x1CD, + }; + }; + + struct Link : StageObject::Link { + enum No { + + }; + + enum EventKind { + Event_Metaknight_Final = 1101, + }; + }; + + struct Area { + enum Kind { + Body = 0x0, + + Tread_Jump_Check = 0x2, + + Item_Pickup = 0x6, + Item_Pickup_Air = 0x7, + Wind = 0x8 + }; + }; + + struct Model { + enum NodeId { + Node_Metroid = 201, + + Node_Correct_Throw = 300, + Node_Correct_Hip = 301, + Node_Correct_XRot = 302, + Node_Correct_YRot = 303, + Node_Correct_Trans = 304, + }; + }; + + struct Kinetic { + struct Energy { + enum Id { + Id_Motion = 0x0, + Id_Gravity = 0x1, + Id_Control = 0x2, + Id_Stop = 0x3, + Id_Damage = 0x4, + Id_Env_Wind = 0x5, + Id_Ground_Movement = 0x6, + Id_Jostle = 0x7, + }; + }; + }; + + struct Instance { + struct Work { + enum Int { + Int_Entry_Id = 0x10000000, + Int_Jump_Count = 0x10000001, + Int_Cliff_No_Catch_Frame = 0x10000002, + Int_Wall_Jump_Count = 0x10000003, + Int_Wall_Jump_Past_Frame = 0x10000004, + Int_Tread_Jump_Count = 0x10000005, + Int_No_Tread_Frame = 0x10000006, + Int_Tread_Target_Id = 0x10000007, + Int_Tread_Target_Category = 0x10000008, + Int_No_Slip_Frame = 0x10000009, + Int_No_Damage_Slip_Frame = 0x1000000A, + Int_No_Attach_Wall_Frame = 0x1000000B, + Int_Attach_Wall_Count = 0x1000000C, + Int_Speed_Y_Stable_Frame = 0x1000000D, + Int_No_Barrel_Frame = 0x1000000E, + Int_No_Catapult_Frame = 0x1000000F, + Int_No_Ground_Damage_Frame = 0x10000010, + Int_No_Ladder_Frame = 0x10000011, + Int_No_Spring_Frame = 0x10000012, + Int_Water_Jump_Count = 0x10000013, + Int_Water_Into_Frame = 0x10000014, + Int_Gimmick_Id = 0x10000015, + Int_Gimmick_Event_Manage_Id = 0x10000016, + Int_Gimmick_Kind = 0x10000017, + Int_Flower_Counter = 0x10000018, + Int_Gekikara_Counter = 0x10000019, + Int_Gekikara_Shoot_Counter = 0x1000001A, + Int_Hammer_Counter = 0x1000001B, + Int_Hammer_Throw_Counter = 0x1000001C, + Int_Hammer_SE_Handle = 0x1000001D, + Int_SuperStar_Counter = 0x1000001E, + Int_SuperStar_SE_Handle = 0x1000001F, + Int_Cursor_Frame = 0x10000020, + Int_Kinoko_Frame = 0x10000021, + Int_Thunder_Frame = 0x10000022, + Int_Scaling_Status = 0x10000023, + Int_Scaling_Kind = 0x10000024, + Int_Metal_Frame = 0x10000025, + Int_No_Heal_Frame = 0x10000026, + Int_No_Water_InOut_Frame = 0x10000027, + Int_Dead_Reason = 0x10000028, + Int_Dead_Mode = 0x10000029, + Int_Dead_Rebirth_Wait_Frame = 0x1000002A, + Int_Auto_Heal_Count = 0x1000002B, // TODO: Verify + Int_Succeed_Hit_Count = 0x1000002C, + Int_Loupe_Frame = 0x1000002D, + Int_Curry_SE_Handle = 0x1000002E, + Int_Heart_Swap_Target_Entry_Id = 0x1000002F, + Int_Heart_Swap_Item_Id = 0x10000030, + Int_No_Final_Frame = 0x10000031, // TODO: Verify + Int_Heal_Eff_Id = 0x10000032, + Int_Catch_Motion_Offset = 0x10000033, // TODO: Verify + Int_Thrown_Motion_Offset = 0x10000034, // TODO: Verify + Int_Attack_Serial_Id = 0x10000035, + Int_Color = 0x10000036, + Int_Status_Start_Turn_Frame = 0x10000037, + Int_Damage_Reaction_Frame = 0x10000038, + Int_Meteor_Counter_Frame = 0x10000039, + Int_Badge_Stop_Frame = 0x1000003A, // TODO: Verify + Int_Screw_Jump_Count = 0x1000003B, + Int_No_Pickup_Item_Frame = 0x1000003C, // TODO: Verify + Int_Fly_Reflect_Count = 0x1000003D, + Int_Air_Lasso_Count = 0x1000003E, + Int_Damage_Entry_Id = 0x1000003F, + }; + enum Float { + Float_Landing_Frame = 0x11000000, + Float_Fall_X_Accel_Mul = 0x11000001, + Float_Wall_Jump_Dir = 0x11000002, + Float_Guard_Shield = 0x11000003, + Float_Guard_Shield_Min = 0x11000004, // TODO: Verify + Float_Guard_Shield_Max = 0x11000005, // TODO: Verify + Float_Flower_Total_Damage = 0x11000006, + Float_Gekikara_Angle = 0x11000007, + Float_Gekikara_Angle_Speed = 0x11000008, + Float_Scaling_Start_Scale = 0x11000009, + Float_Scaling_End_Scale = 0x1100000A, + Float_Scaling_Init_Scale = 0x1100000B, + Float_Metal_Power = 0x1100000C, + Float_Succeed_Hit_Damage = 0x1100000D, + Float_Reaction_Cheer = 0x1100000E, + Float_Damage_Speed_Reserved_X = 0x1100000F, // TODO: Verify (set in ftKineticTransactor::changeKinetic) + Float_Damage_Speed_Reserved_Y = 0x11000010, // TODO: Verify + Float_Init_Pitch = 0x11000011, + Float_Cursor_Offset_Y = 0x11000012, + }; + enum Flag { + Flag_Dead_End = 0x12000000, + Flag_No_Dead = 0x12000001, + Flag_Catch_Cliff = 0x12000002, + Flag_Disable_Landing_Cancel = 0x12000003, // TODO: Verify + Flag_No_Pickup_Item = 0x12000004, + Flag_Tread_No_Trigger = 0x12000005, + Flag_Final = 0x12000006, + Flag_Final_Status = 0x12000007, + Flag_Final_Available = 0x12000008, + Flag_Flower = 0x12000009, + Flag_Gekikara = 0x1200000A, + Flag_Hammer = 0x1200000B, + Flag_Hammer_No_Attack = 0x1200000C, + Flag_Hammer_No_Drift = 0x1200000D, + Flag_Star = 0x1200000E, + Flag_Screw = 0x1200000F, + Flag_Pikmin_Final_No_Reaction = 0x12000010, // TODO: Verify + Flag_Paralyze_Damage = 0x12000011, + Flag_Metal = 0x12000012, + Flag_Rabbit_Cap = 0x12000013, + Flag_Kinoko = 0x12000014, + Flag_Thunder = 0x12000015, + Flag_No_Glide = 0x12000016, // TODO: Verify + Flag_Dead_Area_Out = 0x12000017, + Flag_KnockOut = 0x12000018, + Flag_Loupe = 0x12000019, + Flag_Loupe_Damage = 0x1200001A, + Flag_Cursor = 0x1200001B, + Flag_Name_Cursor = 0x1200001C, + Flag_Rebirth_No_Move = 0x1200001D, + Flag_Final_Discretion = 0x1200001E, + Flag_Kirby_Copy_Dedede = 0x1200001F, + Flag_Speed_Damage = 0x12000020, + Flag_Disable_Scaling = 0x12000021, + Flag_Disable_Cliff_Catch = 0x12000022, + Flag_Rebirth_Adventure = 0x12000023, + Flag_Disable_Ottotto = 0x12000024, + Flag_Disable_Slip = 0x12000025, + Flag_Slow = 0x12000026, + Flag_Slow_Cause_Timer = 0x12000027, + Flag_Whole_Slow = 0x12000028, + Flag_No_Dead_Up = 0x12000029, + Flag_Item_Throw_4 = 0x1200002A, + Flag_Assist = 0x1200002B, + Flag_Check_Catch = 0x1200002C, + Flag_Cracker_Launcher = 0x1200002D, + Flag_Sub_Fighter = 0x1200002E, + Flag_No_Swim = 0x1200002F, + Flag_Disable_Curry_Shot = 0x12000030, + Flag_Disable_Interrupt_Swim = 0x12000031, + Flag_Disable_Interrupt_Scaling = 0x12000032, + Flag_Voice_Mute = 0x12000033, + Flag_Enable_Warp_On_Damage = 0x12000034, + Flag_Hit_Reflector = 0x12000035, + Flag_Inhaled = 0x12000036, + Flag_Paralyze_Stop = 0x12000037, + Flag_Calc_Cursor_Pos_Force = 0x12000038, + Flag_No_Speed_Operation_Chk = 0x12000039, // TODO: Verify + Flag_Force_Loupe = 0x1200003A, // TODO: Verify + Flag_Capture_Yoshi = 0x1200003B, + Flag_Cursor_On_Posture = 0x1200003C, + }; + }; + }; + + struct Scaling { + enum Status { + Status_None = 0x0, + Status_End_Small = 0x1, + Status_End_Big = 0x2, + Status_Big = 0x3, + Status_To_Big = 0x4, + Status_Small = 0x5, + Status_To_Small = 0x6, + }; + + enum Kind { + Kind_None = -0x1, + Kind_Status = 0x0, + Kind_Kinoko = 0x1, + Kind_Thunder = 0x2, + }; + + enum Type { + Type_None = -0x1, + Type_Big = 0x0, + Type_Small = 0x1, + }; + }; + + struct Dead { + enum Reason { + Reason_Invalid = -0x1, + Reason_Outside_Up = 0x0, + Reason_Outside_Down = 0x1, + Reason_Outside_Left = 0x2, + Reason_Outside_Right = 0x3, + Reason_Ground_Crush = 0x4, + Reason_KnockOut = 0x5, + Reason_Knockout_Explode = 0x6, + Reason_Instant_Death = 0x6, + Reason_KnockOut_SelfDestruct = 0x7, + }; + + enum Mode { + Mode_Normal = 0x0, + Mode_DeadUp_Star = 0x1, + Mode_DeadUp_Fall = 0x2 + }; + }; + + int m_entryId; + char _272[44]; + ftOutsideEventPresenter m_outsideEventPresenter; + char _332[72]; + + Fighter(s32 entryId, ftKind kind, Heaps::HeapType instHeap, soModuleAccesser* acc); + + virtual void processUpdate(); + virtual void processFixPosition(); + virtual void processHit(); + virtual void processFixCamera(); + virtual void processEnd(); + virtual ~Fighter(); + + virtual Input* getInput(); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual bool checkTransitionStatus(u32); + virtual bool isTreadPassive(); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual void updateRoughPos(); + + // TODO: Verify parameters + virtual void postCreate(); + virtual Fighter* getPartner(); + virtual void attachInstance(); + virtual void detachInstance(); + virtual void standbyAdvFollow(); +#ifdef MATCHING + virtual void onStartFinal(); +#else + virtual void onStartFinal(int variantID = -1, itCustomizerInterface** customizer = NULL); // Note: Optional parameters for modding purposes to use custom customizers +#endif + virtual void onEndFinal(); + virtual void toDead(Dead::Reason deadReason); + virtual int checkDead(); + virtual void onDeadEnd(); + virtual void toKnockOut(); + virtual void activate(); + virtual void onActivate(); + virtual void onDeactivate(); + virtual void onStart(int); + virtual void postStart(int); + virtual void setCursor(bool); + virtual void setNameCursor(bool); + virtual void setLoupe(bool); + virtual void setLoupeDamage(bool); + virtual u32 getChangeSucceedOption(); + virtual void changeSucceedCore(void*, int); + virtual void setupChangeSucceedWork(void*); + virtual bool setupChangeSucceedEffect(); + virtual void change(void*, int); + virtual void touchItem(soLinkTouchItemEventArgs*); + virtual bool setMetal(bool setStatus, float health, int unk3); + virtual void onSetMetal(bool); + virtual void onHitReflector(soModuleAccesser* moduleAccesser, bool); + virtual void dropItemCheck(soDamage *, bool); + virtual bool isHeartSwapEnableCondition(); + virtual void analyzeSeal(void*); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackFighter(void* unk, soModuleAccesser* moduleAccesser); + virtual ftOwner* getOwner(); + virtual ftKind getFtKind(); + virtual bool isInclude(float* rect, Vec3f* out); + virtual void eatItem(soLinkTouchItemEventArgs *); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackCheck(u32 flags); + virtual void notifyEventCollisionShield(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionShieldSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionShieldCheck(); + virtual void notifyEventCollisionReflector(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionReflectorSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionReflectorCheck(); + virtual void notifyEventCollisionAbsorber(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual bool notifyEventCollisionAbsorberCheck(); + virtual bool notifyEventCaptureStatus(soModuleAccesser* moduleAccesser, int taskId, int, int); + virtual void notifyEventCollisionSearch(soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionSearchCheck(); + virtual void notifyEventChangeCollisionHit(int index, soModuleAccesser* moduleAccesser); + virtual void notifyEventOnDamage(soDamage* damage, bool, soModuleAccesser* moduleAccesser); + virtual void notifyEventAddDamage(soDamage* damage, soModuleAccesser* moduleAccesser); + virtual void setTeam(int, int); + virtual void setVisibility(int); + virtual void notifyEventTurn(float, float, soModuleAccesser* moduleAccesser); + virtual bool notifyHaveItemPreCheck(BaseItem* item, bool*); + virtual void notifyHaveItem(itParam::SizeKind, BaseItem* item, u32 nodeIndex, u32 index, bool); + virtual void notifyAttachItem(BaseItem* item, u32 nodeIndex, u32 attachNodeIndex, bool, bool); + virtual void notifyUseItem(BaseItem* item, u32 nodeIndex, int*); + virtual void notifyThrowItem(BaseItem* item, u32 nodeIndex, int*); + virtual void notifyDropItem(BaseItem*); + virtual void notifyShootBulletItem(BaseItem* item); + virtual void notifyEjectItem(BaseItem* item, u32 index, bool); + virtual void notifyEjectAttachItem(BaseItem* item, u32 index, bool); + virtual void notifyVisibilityItem(BaseItem* item, int, bool, u8); + virtual void notifyEventSetDamage(float); + virtual void notifyEventChangeAdvUnit(); + virtual void notifyEventBeat(); + virtual void playEatSE(); + virtual void onInhaled(); + virtual bool isInhaled(); + virtual void offInhaled(); + virtual void notifyEventPikminFinalAttack(float, int); + virtual void trainerStart(float, Vec3f*, Vec3f*, int, bool); + virtual void trainerRestart(float*, bool, bool); + virtual void disappear(bool); + virtual bool isEnableCancel(); + virtual void* getCancelModule(); + virtual void* getStatusGimmickUniqProcessPool(); + virtual void* getVirtualNodeMatrixPool(); + + void start(Vec3f* pos, float lr, float damage, int, bool); + void setCurry(bool setStatus, int unk2); + void setHammer(bool setStatus, int unk2); + void setSuperStar(bool setStatus, int duration, bool); + void setFlower(bool setStatus, float rate, float size, int unk4, bool unk5); + void setSlow(bool setStatus, int slowStrength, int duration, bool useTimerEffect); + void setHeartSwap(int givingPlayerEntryID, int givingPlayerEntryId, bool setStatus); + void startScaling(Scaling::Kind, Scaling::Type); + void warp(Vec3f* pos, float lr, u32 showEffect); + void setupEquipment(); +}; +static_assert(sizeof(Fighter) == 404, "Class is wrong size!"); + +struct ftLinkDeadEventArgs : public soLinkEventArgs { + Fighter::Dead::Reason m_deadReason; + + inline ftLinkDeadEventArgs(Fighter::Dead::Reason deadReason) : soLinkEventArgs(StageObject::Link::Event_Dead), m_deadReason(deadReason) {} +}; +static_assert(sizeof(ftLinkDeadEventArgs) == 0xc, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_impl.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_impl.h new file mode 100644 index 0000000000..8fe57050e7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_impl.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +class ftAudience { +public: + virtual ~ftAudience(); + virtual void activate(); + virtual void deactivate(); + virtual void reqHandclapDead(float, bool); + virtual float correctCheerReaction(float, float); + virtual void reqCallFgmStopCheer(); + virtual void checkCheer(float, int entryId1, int entryId2); + virtual bool checkTumultRange(float); + virtual bool checkTumultLanding(float, float, int entryId); + virtual bool checkTumultFallSpecial(float, int entryId); + virtual void checkCheerDefeat(int entryId); +}; +static_assert(sizeof(ftAudience) == 4, "Class is wrong size!"); + +class ftAudienceImpl : public gfTask, public ftAudience { + char _68[4]; + int m_entryId; + char _76[4]; + float m_80; + char _84[44]; + +public: + virtual void processFixPosition(); + virtual ~ftAudienceImpl(); + + virtual void activate(); + virtual void deactivate(); + virtual void reqHandclapDead(float, bool); + virtual float correctCheerReaction(float, float); + virtual void reqCallFgmStopCheer(); + virtual void checkCheer(float, int entryId1, int entryId2); + virtual bool checkTumultRange(float); + virtual bool checkTumultLanding(float, float, int entryId); + virtual bool checkTumultFallSpecial(float, int entryId); + virtual void checkCheerDefeat(int entryId); +}; +static_assert(sizeof(ftAudienceImpl) == 128, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_manager.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_manager.h new file mode 100644 index 0000000000..a9f69d074b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_audience_manager.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +class ftAudienceNull : public ftAudience { +public: + virtual ~ftAudienceNull(); + virtual void activate(); + virtual void deactivate(); + virtual void reqHandclapDead(float, bool); + virtual float correctCheerReaction(float, float); + virtual void reqCallFgmStopCheer(); + virtual void checkCheer(float, int entryId1, int entryId2); + virtual bool checkTumultRange(float); + virtual bool checkTumultLanding(float, float, int entryId); + virtual bool checkTumultFallSpecial(float, int entryId); + virtual void checkCheerDefeat(int entryId); +}; +static_assert(sizeof(ftAudienceNull) == 4, "Class is wrong size!"); + +class ftAudienceManager { +public: + ftAudienceImpl* m_audienceImpl; + ftAudienceNull* m_audienceNull; + ftAudience* m_audience; +}; +static_assert(sizeof(ftAudienceManager) == 12, "Class is wrong size!"); + +extern ftAudienceManager* g_ftAudienceManager; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_bombhei_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_bombhei_log.h new file mode 100644 index 0000000000..13db373671 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_bombhei_log.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ftBombheiLog +{ +public: + ftBombheiLog(); + ~ftBombheiLog(); +}; +static_assert(sizeof(ftBombheiLog) == 0x1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_cancel_module.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_cancel_module.h new file mode 100644 index 0000000000..89b2b16dcc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_cancel_module.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class ftCancelModule : public soNullable { +public: + ftCancelModule(bool isNull) : soNullable(isNull) { } + virtual void postInitialize(soModuleAccesser* moduleAccesser) = 0; + virtual bool isEnableCancel() const = 0; + virtual void processFixPosition() = 0; + virtual void unableCancelStatus() = 0; +}; +static_assert(sizeof(ftCancelModule) == 0x8, "Class is the wrong size!"); + +class ftCancelModuleImpl : + public ftCancelModule, + public soStatusEventObserver, + public soAnimCmdEventObserver, + public soSituationEventObserver { + + void enableCancelTransitionGroup(SituationKind kind); +public: + ftCancelModuleImpl(soModuleAccesser* accsr); + // UBFIX should have been virtual + ~ftCancelModuleImpl() { } + virtual void postInitialize(soModuleAccesser* moduleAccesser); + virtual bool isEnableCancel() const; + virtual void processFixPosition(); + virtual void unableCancelStatus(); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, s32 unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); +}; +// TODO size assertion + +class ftCancelModuleNull : public ftCancelModule { +public: + ftCancelModuleNull() : ftCancelModule(true) { } + virtual void postInitialize(soModuleAccesser* moduleAccesser) { } + virtual bool isEnableCancel() const { return false; } + virtual void processFixPosition() { } + virtual void unableCancelStatus() { } +}; +static_assert(sizeof(ftCancelModuleNull) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_class_info.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_class_info.h new file mode 100644 index 0000000000..10dcfd5a97 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_class_info.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include + +class ftClassInfo : private soNull, public soNullable { +public: + ftClassInfo(bool isNull = false); + + virtual ~ftClassInfo(); + virtual ftClassInfo* create() const = 0; + + void setClassInfo(ftKind kind, ftClassInfo* info); + static ftClassInfo* getClassInfo(ftKind kind); +}; +static_assert(sizeof(ftClassInfo) == 0xC, "Class is the wrong size!"); + +class ftClassInfoNull : public ftClassInfo { +public: + ftClassInfoNull() : ftClassInfo(true) { } + + virtual ~ftClassInfoNull(); + virtual ftClassInfo* create() const; +}; +static_assert(sizeof(ftClassInfoNull) == 0xC, "Class is the wrong size!"); + +extern ftClassInfoNull g_ftClassInfoNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_combo_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_combo_log.h new file mode 100644 index 0000000000..be11a799c0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_combo_log.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ftComboLog +{ +public: + ftComboLog(); + ~ftComboLog(); +}; +static_assert(sizeof(ftComboLog) == 0x1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_common_data_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_common_data_accesser.h new file mode 100644 index 0000000000..fc490fa4b5 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_common_data_accesser.h @@ -0,0 +1,77 @@ +#pragma once + +#include +#include +#include +#include + +struct soAnimCmdDisguiseList { + s32 unk0; + void* unk4; +}; + +struct ftData { + ftMotionData* motionData; + ftVisibilityData* visibilityData; + u8 unk8[0xC]; + ftStatusData* statusData; + u8 unk18[0x14]; + ftPreCheckAnimCmdData* preCheckAnimCmdData; + void* unk30; + void* unk34; + void* unk38; + void* unk3C; + u8 unk40[0x10]; + soAnimCmdDisguiseList* unk50; + soAnimCmdDisguiseList* unk54; +}; + +struct ftParam { + u8 unk0[0xB4]; + float modelScale; + u8 unkB8[0x1E0]; + float slopeAngleLimit; +}; + +struct ftParamEtc { + +}; + +struct ftKindData { + ftData* data; + ftParam** params; + ftParamEtc* ParamEtc; +}; + +struct ftDataCommon { + soCommonParam* soCommonParams[2]; + ftCommonParam* ftCommonParams[2]; + void* commonActionEntryScripts; + void* commonActionExitScripts; + void* flashOverlayScripts; + ftShakeData* shakeData; + u8 unk20[0x8]; + ftJostleData* jostleData; + u8 unk2C[0x1C]; + GXColor subColors; + ftEffectCommonData* effectCommonData; + ftEffectScreenData* effectScreenData; + ftIkData* ikData; +}; + +struct ftCommonData { + ftDataCommon* dataCommon; + ftCommonParam** commonParams; + ftCommonParamFloat commonFloatParams[2]; + ftCommonParamInt commonIntParams[2]; + ftCommonParamIndefinite commonIndefiniteParams[2]; +}; + +class ftCommonDataAccesser { +public: + ftData* getData(ftKind kind) const; + ftParam* getParam(ftKind kind) const; +}; + +extern ftCommonData g_ftCommonData; +extern ftCommonDataAccesser g_ftCommonDataAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_create.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_create.h new file mode 100644 index 0000000000..22833a351d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_create.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct ftCreate { + int m_entryId; + ftKind m_kind; + HeapType m_instanceHeapType; + HeapType m_nwModelInstanceHeapType; + HeapType m_nwMotionInstanceHeapType; +}; + +class ftInstanceManager; +extern ftInstanceManager g_ftInstanceManager; +class ftInstanceManager { + char _0x0[0x18c]; +public: + Fighter* create(ftCreate* create); + + inline static ftInstanceManager* getInstance() { return &g_ftInstanceManager; } +}; +static_assert(sizeof(ftInstanceManager) == 0x18c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry.h new file mode 100644 index 0000000000..962a92e0ef --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry.h @@ -0,0 +1,158 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class Fighter; +class ftOwner; + +enum ftKind { + Fighter_Mario = 0x0, + Fighter_DonkeyKong = 0x1, + Fighter_Donkey = 0x1, + Fighter_Link = 0x2, + Fighter_Samus = 0x3, + Fighter_Yoshi = 0x4, + Fighter_Kirby = 0x5, + Fighter_Fox = 0x6, + Fighter_Pikachu = 0x7, + Fighter_Luigi = 0x8, + Fighter_CaptainFalcon = 0x9, + Fighter_Captain = 0x9, + Fighter_Ness = 0xA, + Fighter_Bowser = 0xb, + Fighter_Koopa = 0xb, + Fighter_Peach = 0xc, + Fighter_Zelda = 0xd, + Fighter_Sheik = 0xe, + Fighter_Popo = 0xf, + Fighter_Nana = 0x10, + Fighter_Marth = 0x11, + Fighter_MrGameAndWatch = 0x12, + Fighter_GameWatch = 0x12, + Fighter_Falco = 0x13, + Fighter_Ganondorf = 0x14, + Fighter_Ganon = 0x14, + Fighter_Wario = 0x15, + Fighter_MetaKnight = 0x16, + Fighter_Pit = 0x17, + Fighter_ZeroSuitSamus = 0x18, + Fighter_SZeroSuit = 0x18, + Fighter_Olimar = 0x19, + Fighter_Pikmin = 0x19, + Fighter_Lucas = 0x1a, + Fighter_DiddyKong = 0x1b, + Fighter_Diddy = 0x1b, + Fighter_PokemonTrainer = 0x1c, + Fighter_PokeTrainer = 0x1c, + Fighter_Charizard = 0x1d, + Fighter_PokeLizardon = 0x1d, + Fighter_Squirtle = 0x1e, + Fighter_PokeZenigame = 0x1e, + Fighter_Ivysaur = 0x1f, + Fighter_PokeFushigisou = 0x1f, + Fighter_KingDedede = 0x20, + Fighter_Dedede = 0x20, + Fighter_Lucario = 0x21, + Fighter_Ike = 0x22, + Fighter_ROB = 0x23, + Fighter_Robot = 0x23, + Fighter_Jigglypuff = 0x25, + Fighter_Purin = 0x25, + Fighter_ToonLink = 0x29, + Fighter_Wolf = 0x2c, + Fighter_Snake = 0x2e, + Fighter_Sonic = 0x2f, + Fighter_Mewtwo = 0x26, + Fighter_Roy = 0x27, + Fighter_PlusleMinun = 0x24, + Fighter_PraMai = 0x24, + Fighter_DrMario = 0x28, + Fighter_ToonZelda = 0x2a, + Fighter_ToonSheik = 0x2b, + Fighter_DixieKong = 0x2d, + Fighter_Dixie = 0x2d, + Fighter_GigaBowser = 0x30, + Fighter_GKoopa = 0x30, + Fighter_WarioMan = 0x31, + Fighter_Alloy_Red = 0x32, + Fighter_Zako_Boy = 0x32, + Fighter_Alloy_Blue = 0x33, + Fighter_Zako_Girl = 0x33, + Fighter_Alloy_Yellow = 0x34, + Fighter_Zako_Child = 0x34, + Fighter_Alloy_Green = 0x35, + Fighter_Zako_Ball = 0x35, + Fighter_MarioD = 0x36, + Fighter_Count = 0x37, +}; +typedef ftKind FighterKind; + +class ftEntryEventObserver : public soEventObserver { +public: + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventSetDamage(float); + virtual void notifyEventBeat(); + virtual void notifyEventDeadPartner(int index); + virtual void notifyEventPartnerResourcePrepared(); + virtual void notifyEventChangeAdvUnit(); + virtual void notifyEventWarp(); + virtual void notifyEventPokemonStart(int); + virtual void notifyEventPokemonRequestChange(Vec3f*, float*); + virtual void notifyEventPokemonTrainerUpdate(); + virtual void notifyEventPokemonCollect(); + virtual void notifyEventPokemonChangeCancel(); + virtual void notifyEventPokemonSpecial(int, int); + virtual void notifyEventPokemonAppeal(); + virtual void notifyEventSetRumble(int, int); + virtual void notifyEventStopRumble(int); + virtual void notifyEventPokemonRebirthEnd(); + virtual void notifyEventPokemonAttack(); + virtual void notifyEventPokemonInflict(); + virtual void notifyEventPokemonDamage(); + virtual void notifyEventPokeTrainerReplace(u8); + virtual void notifyEventPikminFinalAttack(float, int); + virtual void notifyEventKirbyResourceLoaded(int index); + virtual void notifyEventKirbyResourceUnLoaded(int index); + virtual void notifyEventExitFighter(int, int); + char _spacer1[2]; +}; +static_assert(sizeof(ftEntryEventObserver) == 12, "Class is wrong size!"); + +class ftEntry { +public: + virtual ~ftEntry(); + + struct Instance { + ftKind m_kind; + Fighter* m_fighter; + }; + + int m_entryId; + u8 m_entryCount; + char _0x9; + s8 m_activeInstanceIndex; + char _0xb[2]; + bool m_isReady; + char _0xe[3]; + u8 _0x11; + char _0x12[6]; + int m_slotIndex; + char _0x1c[10]; + u8 m_finalSmashAmount; // custom - how full the FS meter is in REX's FS meter special mode + char _0x1e[1]; + ftOwner* m_owner; + ftInput* m_input; + Instance m_instances[4]; + int m_heartSwapEntryId; + char _0x54[4]; + int m_playerNo; + gmCharacterKind m_characterKind; + int m_pointTeam; + char _0x64[480]; +}; +static_assert(sizeof(ftEntry) == 0x244, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry_manager.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry_manager.h new file mode 100644 index 0000000000..888941a6fe --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_entry_manager.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include + +class ftEntryManager; +extern ftEntryManager* g_ftEntryManager; +class ftEntryManager { + ftEntry* m_entries; + u32 m_entryCount; + soArrayVector m_entryArrayVector; + char _0x38[20]; +public: + virtual ~ftEntryManager(); + + ftEntry* getEntity(u32 entryId); + + inline static ftEntryManager* getInstance() { return g_ftEntryManager; } +}; +static_assert(sizeof(ftEntryManager) == 0x50, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_extend_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_extend_param_accesser.h new file mode 100644 index 0000000000..ef43cdf3a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_extend_param_accesser.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include +#include +#include + +class ftExtendParamAccesser : public soParamAccesser { + ftKind m_kind; +public: + ftExtendParamAccesser(ftKind kind); + static ftExtendParamAccesser* getAccesser(ftKind kind); + static bool isExistAccesser(ftKind kind); + + virtual ~ftExtendParamAccesser(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) { return nullptr; } + virtual void setup(const u8* extData) = 0; +}; +static_assert(sizeof(ftExtendParamAccesser) == 0x10, "Class is the wrong size!"); + +// TODO: T1 and T3 always equal 3999 and 24999 and have unknown purpose +template +class ftExtendParamAccesserEx : public ftExtendParamAccesser { +protected: + static const s32 NumVariations = 2; + static const s32 OffsetFloat = 4000; + static const s32 OffsetInt = 24000; + + // Byte offsets to pointers to ExtendParam structures + static const u32 OffsetExt1 = 0x7C; + static const u32 OffsetExt2 = 0x80; + static const u32 OffsetExt3 = 0x84; + + const float* m_floats[NumVariations][NumFloats+1]; + const int* m_ints[NumVariations][NumInts+1]; +public: + ftExtendParamAccesserEx(ftKind kind) + : ftExtendParamAccesser(kind) { } + virtual ~ftExtendParamAccesserEx() { } + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) { + return m_floats[soValueAccesser::getValueVariation()][p2 - OffsetFloat][p3]; + } + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) { + return m_ints[soValueAccesser::getValueVariation()][p2 - OffsetInt][p3]; + } + virtual void setup(const u8* extData) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_external_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_external_value_accesser.h new file mode 100644 index 0000000000..44d1d4e06b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_external_value_accesser.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include +#include + +namespace ftExternalValueAccesser { + float getWeight(Fighter* fighter); + Vec3f getHipPos(Fighter* fighter); +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_fighter_build_data.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_fighter_build_data.h new file mode 100644 index 0000000000..6e3f5fbd50 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_fighter_build_data.h @@ -0,0 +1,69 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class ftFighterBuildData : public soModuleAccesserBuildData { + s32 m_entryId; + ftKind m_kind; + ftData* m_ftData; + u8 m_resGroupNo; + s32 m_team; + soModuleAccesser* m_moduleAccsr; + void* m_cameraRangeSet; + void* m_cameraClipSphereSet; + Heaps::HeapType m_instHeap; + Heaps::HeapType m_nwModelInstHeap; + Heaps::HeapType m_nwMotionInstHeap; +public: + ftFighterBuildData(s32 entryId, ftKind kind, Heaps::HeapType instHeap, + Heaps::HeapType nwModelInstHeap, + Heaps::HeapType nwMotionInstHeap, + u8 resGroupNo, soModuleAccesser* acc, + s32 team, void* cameraRangeSet, + void* cameraClipSphereSet); + + virtual u32 getMdlResId() const; + virtual u32 getAnmResId() const; + virtual u8 getResGroupNo() const; + virtual ftMotionData* getMotionData() const; + virtual ftShakeData* getShakeData() const; + virtual ftVisibilityData* getVisibilityData() const; + virtual ftStatusData* getStatusData() const; + virtual soGroundConditionChecker* getGroundConditionChecker() const; + virtual void* getEffectNodeData() const; + virtual void* getEffectEmitData() const; + virtual ftEffectCommonData* getEffectCommonData() const; + virtual ftEffectScreenData* getEffectScreenData() const; + virtual ftIkData* getIkData() const; + virtual float getModelScale() const; + virtual soParamAccesser* getParamAccesser() const; + virtual s32 getAreaCategory() const; + virtual void* getCameraRangeSet() const; + virtual void* getCameraClipSphereSet() const; + virtual void* getItemNodeData() const; + virtual void* getModelExtendNodeTable() const; + virtual ftJostleData* getJostleData() const; + virtual ftPreCheckAnimCmdData* getPreCheckAnimCmdData() const; + virtual ~ftFighterBuildData() { } + virtual s32 getTeam() const { return m_team; } + virtual Heaps::HeapType getInstanceHeap() const { return m_instHeap; } + virtual Heaps::HeapType getNWModelInstanceHeap() const { return m_nwModelInstHeap; } + virtual Heaps::HeapType getNWMotionInstanceHeap() const { return m_nwMotionInstHeap; } + virtual s32 getHeapSlotNo() const; + virtual ftSoundIdExchangerImpl* getSoundIdExchanger() const; + virtual float getSlopeAngleLimit() const; + virtual void* getAnimCmdData(u32 eventThread, s32 p2) const; + + soAnimCmdDisguiseList* getAnimCmdDisguiseList(bool p1, s32 actionType) const; +}; +static_assert(sizeof(ftFighterBuildData) == 0x30, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_info.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_info.h new file mode 100644 index 0000000000..a177757cad --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_info.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include +#include + +class ftInfo : public soInfo { +public: + enum AttackComboType { + Attack_Combo_None = 0x0, + Attack_Combo_Hit = 0x1, + Attack_Combo_Succeed = 0x2, + }; + + enum Attack100Type { + Attack_100_None = 0x0, + Attack_100_Normal = 0x1, + }; + + enum JumpAerialType { + Jump_Aerial_None = 0x0, + Jump_Aerial_Normal = 0x1, + Jump_Aerial_Fly = 0x2 + }; + + enum GlideType { + Glide_None = 0x0, + Glide_Normal = 0x1, + }; + + enum SquatWalkType { + Squat_Walk_None = 0x0, + Squat_Walk_Normal = 0x1 + }; + + enum AttackDashType { + Attack_Dash_Wait = 0x0, + Attack_Dash_Squat_Wait = 0x1, + }; + + enum WallJumpType { + Wall_Jump_None = 0x0, + Wall_Jump_Normal = 0x1, + }; + + enum AttachWallType { + Attach_Wall_None = 0x0, + Attach_Wall_Normal = 0x1, + }; + + enum AirLassoType { + Air_Lasso_None = 0x0, + Air_Lasso_Normal = 0x1, + }; + + enum MotionShareType { + Motion_Share_Normal = 0x0, + Motion_Share_Taro = 0x1, + Motion_Share_Big = 0x2, + Motion_Share_Girl = 0x3, + }; + + enum CaptureMotionHeight { + Capture_Motion_High = 0x0, + Capture_Motion_Low = 0x1 + }; + +public: + virtual ~ftInfo() { } + virtual bool isInvalidKind(int kind); + virtual int getInvalidKind(); + virtual const char* getNamePtr(int kind); + virtual u32 getMotionNum(int kind); + virtual u32 getStatusNum(int kind); + + static ftInfo* getInstance(); + +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_input.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_input.h new file mode 100644 index 0000000000..f8ae9abbe6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_input.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +class ftEntry; + +class ftInput { + char _0x0[4]; + ftEntry* m_entry; + char _0x8[24]; +}; +static_assert(sizeof(ftInput) == 0x20, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_item_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_item_log.h new file mode 100644 index 0000000000..ecc2679b63 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_item_log.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ftItemLog +{ +public: + ftItemLog(); + ~ftItemLog(); +}; +static_assert(sizeof(ftItemLog) == 0x1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kill_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kill_log.h new file mode 100644 index 0000000000..6e1778d310 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kill_log.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ftKillLog +{ +public: + ftKillLog(); + ~ftKillLog(); +}; +static_assert(sizeof(ftKillLog) == 0x1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kind_conversion.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kind_conversion.h new file mode 100644 index 0000000000..b91cfb1c80 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_kind_conversion.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include +#include +#include + +namespace ftKindConversion { + u32 convertKind(gmCharacterKind, ftKind* out); +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log.h new file mode 100644 index 0000000000..9594250e14 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +struct ftLogActionInfo { + char _[0x8]; +}; +static_assert(sizeof(ftLogActionInfo) == 0x8, "Class is wrong size!"); + +class ftLog { + ftLogData m_logData; +public: + ftLogDataAccesser m_logDataAccesser; + ftTrickLog m_trickLog; + ftComboLog m_comboLog; + ftKillLog m_killLog; + ftItemLog m_itemLog; + ftBombheiLog m_bombheiLog; + ftLogActionInfo m_logActionInfo; + ftLogAttackInfoModule m_logAttackInfoModule; + ftLogPatternModule m_logPatternModule; + + ftLog(); + ~ftLog(); +}; +static_assert(sizeof(ftLog) == 0x50C, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_attack_info_module.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_attack_info_module.h new file mode 100644 index 0000000000..025bb75570 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_attack_info_module.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include +#include + +class ftLogAttackInfoModule { + soArrayVector m_logAttackInfoArrayVector; +public: + ftLogAttackInfoModule(); + ~ftLogAttackInfoModule(); + void addAttackInfo(const soLogAttackInfo&); + soLogAttackInfo& getAttackInfo(u32); +}; +static_assert(sizeof(ftLogAttackInfoModule) == 0x84, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_data_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_data_accesser.h new file mode 100644 index 0000000000..8031bafb0f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_log_data_accesser.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +struct ftLogData { + char _[0x1b0]; +}; +static_assert(sizeof(ftLogData) == 0x1b0, "Class is wrong size!"); + +class ftLogDataAccesser { + char _[0x24c]; +public: + ftLogDataAccesser(); + ~ftLogDataAccesser(); + + void addFloat(float val, u32, u32); + void addInt(int val, u32, u32); + + float getFloat(u32, u32); + int getInt(u32, u32); + bool isFlag(u32, u32); + + void offFlag(u32, u32); + void onFlag(u32, u32); + void setFlag(bool, u32, u32); + void setFloat(float, u32, u32); + void setInt(int, u32, u32); + + void setup(ftLogData* logData); + void reset(); +}; +static_assert(sizeof(ftLogDataAccesser) == 0x24c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_manager.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_manager.h new file mode 100644 index 0000000000..4370409fd4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_manager.h @@ -0,0 +1,178 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class ftOutsideEventObserver : public soEventObserver { +public: + ftOutsideEventObserver() : soEventObserver(0) {}; + ftOutsideEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + // TODO: Verify params + virtual void notifyEventOnDamage(int entryId, u32 hp, soDamage* damage); + virtual void notifyEventSetDamage(int entryId, float, u32 percent, bool, bool); + virtual void notifyEventRecover(int entryId, int); + virtual void notifyEventOutsideDeadArea(int entryId, soGroundUtil::DeadAreaCheckResult, bool*); + virtual void notifyEventAppeal(int entryId, int); + virtual void notifyEventDead(int entryId, int deadCount, Fighter::Dead::Reason deadReason, int respawnFrames); + virtual void notifyEventBeat(int entryId1, int entryId2); + virtual void notifyEventSuicide(int entryId); + virtual void notifyEventChangeStart(int entryId, int playerNo, int activeInstanceIndex, ftKind); + virtual void notifyEventChangeEnd(int entryId, int playerNo, int activeInstanceIndex, ftKind); + virtual void notifyEventChangeAppear(); + virtual void notifyEventAddDragoonParts(int entryId, int); + virtual void notifyEventCompDragoonParts(int entryId); + virtual void notifyEventRemoveDragoonParts(int entryId, int); + virtual void notifyEventResetDragoonParts(int entryId); + virtual void notifyEventReEntryRequestFighter(); + virtual void notifyEventSetCursor(int entryId, u32 index); + virtual void notifyEventSetNameCursor(int entryId, u32 index); + virtual void notifyEventSetLoupe(int entryId, u32 index); + virtual void notifyEventStartFinal(int entryId); + virtual void notifyEventEndFinal(int entryId); + virtual void notifyEventRemoveEntry(int entryId); + virtual void notifyEventFinalSlow(int entryId, float, int); + virtual void notifyEventFinalSlowCancel(int entryId); + virtual void notifyEventFinalStop(int entryId); + virtual void notifyEventFinalStopCancel(int entryId); + virtual void notifyEventEntryEnd(int entryId); + virtual void notifyEventResultEnd(int entryId); + virtual void notifyEventGetItem(int entryId, itKind kind, int itVariation, int genParamId, int instanceId); + virtual void notifyEventSucceedHit(int entryId, u32 consecutiveHits, float totalDamage); + virtual void notifyEventResultWin(int entryId, int); + virtual void notifyEventYoshiEggStart(int entryId); + virtual void notifyEventYoshiEggEnd(int entryId); + virtual void notifyEventOnInput(int entryId); + virtual void notifyEventPikminMakeBloomAll(int entryId); + virtual void notifyEventKirbyCopySetup(int entryId, int); + virtual void notifyEventKirbyCopyCancel(int entryId, int); + virtual void notifyEventKnockout(int entryId); + virtual void notifyEventHeartSwapStart(int entryId1, int entryId2); + virtual void notifyEventHeartSwapEnd(int, int); + + char _spacer1[2]; +}; +static_assert(sizeof(ftOutsideEventObserver) == 12, "Class is wrong size!"); + +class ftManagerAbstract : public soNull, public gfTask, public ftOutsideEventObserver, public soDisposeInstanceEventObserver, public soLogEventObserver { + // Note: Done so that vtable placement is proper +}; + +class ftManager; +extern ftManager* g_ftManager; +class ftManager : public ftManagerAbstract { + +public: + char _104[2]; + GameRule m_gameRule : 8; + char _107[2]; + bool m_isStamina; + bool m_isTeams : 1; + bool m_isTeamAttack : 1; + bool : 1; + bool : 1; + bool m_noOnePatternOffsett : 1; // no staling + bool : 1; + bool m_noDeadUp : 1; + bool m_isHomerun : 1; + char _111[1]; + int m_finalStatus; + int m_finalEntryId; + int m_noDiscretionFinalCount; + char _122[21]; + s8 m_parasitePlayerNo; // custom + char _146[34]; + soEventManageModuleImpl m_eventManageModule; + char m_200[4]; + short m_manageID; + char _206[132]; + ftEntryManager* m_entryManager; + ftSlotManager* m_slotManager; + void* m_dataProvider; + + virtual ~ftManager(); + + virtual void processBegin(); + virtual void processUpdate(); + virtual void processHit(); + virtual void processEnd(); + virtual void processDebug(); + + virtual void notifyEventKirbyCopySetup(int entryId, int); + virtual void notifyEventKirbyCopyCancel(int entryId, int); + + virtual void notifyDisposeInstance(bool, int, int taskId); + virtual void notifyDrawDone(); + + virtual void notifyEventEntryEnd(int entryId); + virtual void notifyEventResultEnd(int entryId); + void notifyReplacePokeTrainer(int param1); + + virtual void notifyLogEventCollisionHit(float, int taskId1, int taskId2, int); + virtual void notifyLogEventDead(int entryId1, int entryId2, int, int); + + bool isValidEntryId(int entryId); + int getEntryCount(); + int getEntryId(int playerNo); + int getEntryIdFromIndex(int index); + int getEntryIdFromTaskId(int taskId, int* outInstanceIndex); + int getScoreEntryId(int entryId); + int getPlayerNo(int entryId); + s32 getSlotNo(s32 entryId); + bool isFighterActivate(int entryId, int); + Fighter* getFighter(int entryId, int instanceIndex); + Fighter* getSubFighter(int entryId); + ftOwner* getOwner(int entryId); + int getTeam(int entryId, bool unk2, bool unk3); + Vec3f getFighterCenterPos(int entryId, int unk); + float getFighterLr(int entryId, int unk); + int getFighterOperationType(int entryId); + int getFighterOperationStatus(int entryId); + Fighter* searchNearFighter(float unk1, float radius, Vec3f* pos, int team, bool unk4); + void setHeal(int entryId, float heal); + void setCurry(int entryId); + void setSuperStar(int entryId); + void setSlow(int inflictingTeam, bool setStatus, int slowStrength, int slowDuration); + void setTimerSlow(int inflictingEntryId, bool setStatus, int slowStrength, int slowDuration); + void setScaling(int entryId, Fighter::Scaling::Kind, Fighter::Scaling::Type); + void setInfiniteScaling(int entryId, Fighter::Scaling::Kind, Fighter::Scaling::Type); + void setThunder(int inflictingEntryId, int unk2); + void setWarpFighter(int entryId, Vec3f* pos, float lr, u32 flags); + void setFighterOperationStatus(int entryId, int fighterOperationStatus); + void setFinal(int entryId, bool isDiscretion); + bool addDragoon(int entryId, u32 variation); + + void pickupCoin(int entryId, int amount); + void setDead(int entryId, int unk1, int unk2); + void setBeat(int losingEntryId, int winningEntryId); + void setSuicide(int entryId); + bool isProcessHeartSwap(int entryId); + void toKnockOutHeartSwapOpposite(int entryId, soDamageAttackerInfo* attackerInfo); + + bool isReadySlot(int slotIndex); + bool isReadyRemoveSlot(int slotIndex); + void removeSlot(int slotIndex); + + inline bool hasHitPoint(int entryId) { + return getOwner(entryId)->getHitPointMax() != 0; + }; + + inline static ftManager* getInstance() { return g_ftManager; } +}; + +static_assert(sizeof(ftManager) == 0x160, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_outside_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_outside_event_presenter.h new file mode 100644 index 0000000000..20d6b18e0a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_outside_event_presenter.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class ftOutsideEventPresenter : public soEventPresenter { + int m_entryId; + +public: + virtual ~ftOutsideEventPresenter(); + + void notifyOutsideEventKnockout(); +}; +static_assert(sizeof(ftOutsideEventPresenter) == 16, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_owner.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_owner.h new file mode 100644 index 0000000000..117adbeb8f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_owner.h @@ -0,0 +1,70 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct ftOwnerData { + char _[0x838]; + ftLog m_log; +}; +static_assert(sizeof(ftOwnerData) == 0xd44, "Class is wrong size!"); + +class ftOwner { + ftOwnerData* m_data; + void* m_input; + short _8; + u8 _10; + u8 _11; + +public: + virtual ~ftOwner(); + virtual bool isSubOwner(); + virtual void setDamage(float damage, bool); + virtual float getDamage(); + virtual void setStartDamage(float startDamage); + virtual float getStartDamage(); + virtual float getHitPoint(); + virtual void setBeatCount(int playerIndex, int beatCount); + virtual u32 getCheerDefeatFrame(); + virtual void setSuicideCount(short suicideCount); + virtual void setLogFloat(float, u32 index1, u32 index2); + virtual void addLogFloat(float, u32 index1, u32 index2); + virtual void setLogInt(int, u32 index1, u32 index2); + virtual void addLogInt(int, u32 index1, u32 index2); + virtual void setLogFlag(bool, u32 index1, u32 index2); + virtual void onLogFlag(u32 index1, u32 index2); + virtual void offLogFlag(u32 index1, u32 index2); + virtual void setLogActionInfo(ftLogActionInfo); + virtual void addAttackInfo(const soLogAttackInfo&); + virtual void addAttackPattern(const soLogAttackInfo&); + + void setTeam(int team); + void setPointTeam(int pointTeam); + int setDeadCount(int deadCount); + int getDeadCount(); + void addLostCoin(int numCoinsToAdd); + int getCoin(); + float getCoinDropRate(); + void addCoin(int numCoinsToAdd); + int getBeatCount(int playerIndex); + int getSuicideCount(); + int getStockCount(); + float getHitPointMax(); + void setMetal(bool); + void setFinal(bool, bool); + void setRabbitCap(bool); + void setReflector(bool); + void setFlower(bool); + void setCurry(bool); + void setInfiniteScaling(Fighter::Scaling::Kind, Fighter::Scaling::Type); + void setHitPointMax(float); + void setSlipMul(float); + void setSlipInterval(bool); + void setResultWinRotY(float); + + inline ftLog& getLog() const { return m_data->m_log; }; +}; +static_assert(sizeof(ftOwner) == 16, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_param_customize_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_param_customize_module_impl.h new file mode 100644 index 0000000000..a02093ca88 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_param_customize_module_impl.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class ftParamCustomizeModuleImpl : soParamCustomizeModuleImpl { + u8 unk10[0x4]; + soModuleAccesser* m_moduleAccsr; + u8 unk18[0x520]; + u32 m_customizeBits; + u8 unk53C[0x154]; + float m_walkSpeedMul; // +0x690 +public: + ftParamCustomizeModuleImpl(soModuleAccesser* accsr); + virtual ~ftParamCustomizeModuleImpl(); + virtual void activate(); + virtual void setDefault(); + virtual void addCustomize(u8); + virtual void removeCustomize(u8); + virtual bool isCustomize(u32 bit) const { + return (m_customizeBits & (1 << bit)); + } + virtual float getAttackPowerMul(void* p1); + virtual float getAttackPowerMulArticle(); + virtual float getAttackReactionMul(); + virtual float getWalkSpeedMul() { + return m_walkSpeedMul; + } + virtual int getParamInt(u32, u32); + virtual float getParamFloat(u32, u32); + virtual void* getParamIndefinite(u32, u32); + + virtual void applyKinoko(float p1); + virtual void applyThunder(float p1); + virtual void applyRabbitCap(); + virtual void applyMetal(); + virtual void calc(); + + void reconstruct(); +}; +static_assert(sizeof(ftParamCustomizeModuleImpl) == 0x694, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_pattern_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_pattern_log.h new file mode 100644 index 0000000000..144d3ad8f7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_pattern_log.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include + +class ftLogPatternModule { + soArrayVector m_logAttackInfoArrayVector; + u8 _0x78; + char _0x79[3]; +public: + ftLogPatternModule(); + ~ftLogPatternModule(); + void addAttackPattern(const soLogAttackInfo&); + void clearPattern(); + float getPowerMul(const soLogAttackInfo&); +}; +static_assert(sizeof(ftLogPatternModule) == 0x7C, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_resource_id_accesser_impl.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_resource_id_accesser_impl.h new file mode 100644 index 0000000000..86b31d6b8e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_resource_id_accesser_impl.h @@ -0,0 +1,55 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class ftResourceIdAccesserImpl : public soResourceIdAccesser { + soModuleAccesser* m_moduleAccsr; +public: + ftResourceIdAccesserImpl(soModuleAccesser* acc) : + soResourceIdAccesser(false), m_moduleAccsr(acc) { } + virtual ~ftResourceIdAccesserImpl() { } + virtual u32 getTexResId() { return getMdlResId(); } + virtual u32 getMdlResId(); + virtual u32 getAnmResId(); + virtual u32 getBinResId(); + virtual u32 getArchiveId() { return 0xFFFFFFFF; } + virtual u32 getEtcResId(); + virtual u32 getMdlArchiveId(); + virtual u32 getTexArchiveId(); + virtual u32 getAnmArchiveId(); + virtual u32 getEtcArchiveId(); + virtual u32 getBinArchiveId(); + virtual u32 getKirbyResId(); + + u32 getFinalResId(); + u32 getEntryResId(); + u32 getResultResId(); +}; +static_assert(sizeof(ftResourceIdAccesserImpl) == 0xC, "Class is the wrong size!"); + +class ftKirbyResourceIdAccesserImpl : public ftResourceIdAccesserImpl { +public: + ftKirbyResourceIdAccesserImpl(soModuleAccesser* acc) : + ftResourceIdAccesserImpl(acc) { } + virtual ~ftKirbyResourceIdAccesserImpl() { } + virtual u32 getTexResId(); + virtual u32 getKirbyResId(); +}; +static_assert(sizeof(ftKirbyResourceIdAccesserImpl) == 0xC, "Class is the wrong size!"); + +class ftPopoResourceIdAccesserImpl : public ftResourceIdAccesserImpl { + u32 m_mdlResIndex; +public: + ftPopoResourceIdAccesserImpl(soModuleAccesser* acc) : + ftResourceIdAccesserImpl(acc), m_mdlResIndex(0) { } + virtual ~ftPopoResourceIdAccesserImpl() { } + virtual void setMdlResIndex(u16 idx) { m_mdlResIndex = idx; } + virtual void setTexResIndex(u16 idx) { } + virtual u32 getTexResIndex() { return 0; } + virtual u32 getMdlResIndex() { return m_mdlResIndex; } +}; +static_assert(sizeof(ftPopoResourceIdAccesserImpl) == 0x10, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot.h new file mode 100644 index 0000000000..3464d0503c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include + +class ftSlot { +public: + virtual ~ftSlot(); + char _0x15b[0x157]; + u8 m_costumeId; + u8 _0x15c; + char _0x15d[3]; + gmCharacterKind m_characterKind; + HeapType m_instanceHeapType; + HeapType m_resourceHeapType; + char _0x16c[8]; + int m_slotNo; + char _0x178[0x35C]; +}; +static_assert(sizeof(ftSlot) == 0x4d4, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot_manager.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot_manager.h new file mode 100644 index 0000000000..00edf68bb8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_slot_manager.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +class ftSlotManager; +extern ftSlotManager* g_ftSlotManager; +class ftSlotManager { +public: + ftSlot* m_slots; + u32 m_slotCount; + char _0x8[0x538]; + + inline static ftSlotManager* getInstance() { return g_ftSlotManager; } +}; +static_assert(sizeof(ftSlotManager) == 0x540, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_sound_id_exchanger_impl.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_sound_id_exchanger_impl.h new file mode 100644 index 0000000000..ca6683bd99 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_sound_id_exchanger_impl.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include +#include + +class ftSoundIdExchangerImpl : public soSoundIdExchanger { +public: + virtual ~ftSoundIdExchangerImpl(); + virtual SndID getId(SndID sndID, soModuleAccesser* moduleAccesser); + virtual int getStepId(int); + virtual int getLandingId(int); + virtual bool isVoiceId(int); + virtual bool isVoiceMute(int); +}; + +class ftKirbySoundIdExchangerImpl : public ftSoundIdExchangerImpl { +public: + virtual ~ftKirbySoundIdExchangerImpl(); + virtual bool isVoiceId(int); +}; + +extern ftSoundIdExchangerImpl g_ftSoundIdExchangerImpl; +extern ftKirbySoundIdExchangerImpl g_ftKirbySoundIdExchangerImpl; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_status_uniq_process_gimmick.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_status_uniq_process_gimmick.h new file mode 100644 index 0000000000..94bb24b93b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_status_uniq_process_gimmick.h @@ -0,0 +1,212 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class ftStatusUniqProcessGimmick : public soStatusUniqProcess, public soGimmickEventObserver { + soModuleAccesser* m_moduleAccsr; +public: + ftStatusUniqProcessGimmick(soModuleAccesser* moduleAccesser); + void presentEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); + + virtual ~ftStatusUniqProcessGimmick() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); + virtual void notifyEventGimmick(soGimmickEventArgs* eventInfo, int* taskId); +}; +static_assert(sizeof(ftStatusUniqProcessGimmick) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickEaten : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickEaten(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickEaten() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +// TODO confirm size +// static_assert(sizeof(ftStatusUniqProcessGimmickEaten) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickTruck : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickTruck(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickTruck() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(ftStatusUniqProcessGimmickTruck) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickSpring : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickSpring(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickSpring() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(ftStatusUniqProcessGimmickSpring) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickLadder : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickLadder(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickLadder() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + virtual void execFixPos(soModuleAccesser* moduleAccesser); + + // TODO add non-virtual member functions +}; +static_assert(sizeof(ftStatusUniqProcessGimmickLadder) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickCatapult : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickCatapult(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickCatapult() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(ftStatusUniqProcessGimmickCatapult) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickDoor : public ftStatusUniqProcessGimmick { +public: + ftStatusUniqProcessGimmickDoor(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickDoor() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void execStatus(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(ftStatusUniqProcessGimmickDoor) == 0x14, "Class is the wrong size!"); + +class ftStatusUniqProcessGimmickBarrel : public ftStatusUniqProcessGimmick { + u8 unk14[0x4]; +public: + ftStatusUniqProcessGimmickBarrel(soModuleAccesser* acc) : ftStatusUniqProcessGimmick(acc) { } + virtual ~ftStatusUniqProcessGimmickBarrel() { } + virtual void initStatus(soModuleAccesser* moduleAccesser); + virtual void exitStatus(soModuleAccesser* moduleAccesser, int); + virtual void execStatus(soModuleAccesser* moduleAccesser); + virtual void execStop(soModuleAccesser* moduleAccesser); + virtual void execFixPos(soModuleAccesser* moduleAccesser); + + virtual void notifyEvent(soGimmickEventArgs* eventInfo, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(ftStatusUniqProcessGimmickBarrel) == 0x18, "Class is the wrong size!"); + +class ftStatusGimmickUniqProcessPool : public soNullable { +public: + ftStatusGimmickUniqProcessPool(bool isNull) : soNullable(isNull) { } + virtual ~ftStatusGimmickUniqProcessPool() { } + virtual soStatusUniqProcess* getUniqProcessBarrel() = 0; + virtual soStatusUniqProcess* getUniqProcessDoor() = 0; + virtual soStatusUniqProcess* getUniqProcessCatapult() = 0; + virtual soStatusUniqProcess* getUniqProcessLadder() = 0; + virtual soStatusUniqProcess* getUniqProcessSpring() = 0; + virtual soStatusUniqProcess* getUniqProcessTruck() = 0; + virtual soStatusUniqProcess* getUniqProcessEaten() = 0; +}; +static_assert(sizeof(ftStatusGimmickUniqProcessPool) == 0x8, "Class is the wrong size!"); + +class ftStatusGimmickUniqProcessPoolImpl : public ftStatusGimmickUniqProcessPool { + ftStatusUniqProcessGimmickBarrel m_barrelProc; + ftStatusUniqProcessGimmickDoor m_doorProc; + ftStatusUniqProcessGimmickCatapult m_catapultProc; + ftStatusUniqProcessGimmickLadder m_ladderProc; + ftStatusUniqProcessGimmickSpring m_springProc; + ftStatusUniqProcessGimmickTruck m_truckProc; + ftStatusUniqProcessGimmickEaten m_eatenProc; +public: + ftStatusGimmickUniqProcessPoolImpl(soModuleAccesser* acc) : + ftStatusGimmickUniqProcessPool(false), + m_barrelProc(acc), + m_doorProc(acc), + m_catapultProc(acc), + m_ladderProc(acc), + m_springProc(acc), + m_truckProc(acc), + m_eatenProc(acc) { } + + virtual ~ftStatusGimmickUniqProcessPoolImpl() { } + + virtual soStatusUniqProcess* getUniqProcessBarrel() { + return &m_barrelProc; + } + + virtual soStatusUniqProcess* getUniqProcessDoor() { + return &m_doorProc; + } + + virtual soStatusUniqProcess* getUniqProcessCatapult() { + return &m_catapultProc; + } + + virtual soStatusUniqProcess* getUniqProcessLadder() { + return &m_ladderProc; + } + + virtual soStatusUniqProcess* getUniqProcessSpring() { + return &m_springProc; + } + + virtual soStatusUniqProcess* getUniqProcessTruck() { + return &m_truckProc; + } + + virtual soStatusUniqProcess* getUniqProcessEaten() { + return &m_eatenProc; + } +}; +// TODO: confirm size +// static_assert(sizeof(ftStatusGimmickUniqProcessPoolImpl) == 0x98, "Class is the wrong size!"); + +class ftStatusGimmickUniqProcessPoolNull : public ftStatusGimmickUniqProcessPool { +public: + virtual ~ftStatusGimmickUniqProcessPoolNull() { } + + virtual soStatusUniqProcess* getUniqProcessBarrel() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessDoor() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessCatapult() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessLadder() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessSpring() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessTruck() { + return &g_soStatusUniqProcessNull; + } + + virtual soStatusUniqProcess* getUniqProcessEaten() { + return &g_soStatusUniqProcessNull; + } +}; +static_assert(sizeof(ftStatusGimmickUniqProcessPoolNull) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_system.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_system.h new file mode 100644 index 0000000000..0059ffef4b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_system.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +class ftSystem { + u32 unk0; + u32 unk4; +public: + ftSystem() : unk0(0), unk4(0) { } + ~ftSystem(); + void setCommonResourceData(u32 p1, u32 p2); +}; +static_assert(sizeof(ftSystem) == 8, "Class is the wrong size!"); + +extern ftSystem g_ftSystem; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_trick_log.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_trick_log.h new file mode 100644 index 0000000000..50883f7f2a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_trick_log.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ftTrickLog +{ +public: + ftTrickLog(); + ~ftTrickLog(); +}; +static_assert(sizeof(ftTrickLog) == 0x1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_value_accesser.h new file mode 100644 index 0000000000..c844f1a1b8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_value_accesser.h @@ -0,0 +1,672 @@ +#pragma once + +#include +#include +#include +#include +#include + +class ftValueAccesser : public soValueAccesser { +public: + enum ParamFloat { + Customize_Param_Float_Walk_Accel_Mul = 3001, + Customize_Param_Float_Walk_Accel_Add = 3002, + Customize_Param_Float_Walk_Speed_Max = 3003, + Customize_Param_Float_Ground_Brake = 3004, + Customize_Param_Float_Dash_Speed = 3005, + Customize_Param_Float_Run_Accel_Mul = 3006, + Customize_Param_Float_Run_Accel_Add = 3007, + Customize_Param_Float_Run_Speed_Max = 3008, + + Customize_Param_Float_Ground_Speed_X_Limit = 3010, + Customize_Param_Float_Guard_Speed_Limit = 3011, + Customize_Param_Float_Jump_Speed_X = 3012, + Customize_Param_Float_Jump_Speed_Y = 3013, + Customize_Param_Float_Jump_Speed_X_Mul = 3014, + Customize_Param_Float_Jump_Speed_X_Max = 3015, + Customize_Param_Float_Mini_Jump_Speed_Y = 3016, + Customize_Param_Float_Jump_Aerial_Speed_Y = 3017, + Customize_Param_Float_Jump_Aerial_Speed_X_Mul = 3018, + Customize_Param_Float_Tread_Jump_Speed_Y_Mul = 3019, + Customize_Param_Float_Tread_Mini_Jump_Speed_Y_Mul = 3020, + Customize_Param_Float_Tread_Fall_Recovery_Frame = 3021, + Customize_Param_Float_Meteor_Recovery_Frame = 3022, + Customize_Param_Float_Air_Accel_Y = 3023, + Customize_Param_Float_Air_Speed_Y_Stable = 3024, + Customize_Param_Float_Air_Brake_Y = 3025, + + Customize_Param_Float_Air_Accel_X_Mul = 3027, + Customize_Param_Float_Air_Accel_X_Add = 3028, + Customize_Param_Float_Air_Speed_X_Stable = 3029, + Customize_Param_Float_Air_Brake_X = 3030, + Customize_Param_Float_Dive_Speed_Y = 3031, + + Customize_Param_Float_Combo_Attack_12_End = 3034, + Customize_Param_Float_Combo_Attack_13_End = 3035, + Customize_Param_Float_Combo_Attack_32_End = 3036, + Customize_Param_Float_Combo_Attack_33_End = 3037, + Customize_Param_Float_Combo_Attack_42_End = 3038, + Customize_Param_Float_Flip_Dir_Frame = 3039, + + Customize_Param_Float_Weight = 3041, + Customize_Param_Float_Scale = 3042, + Customize_Param_Float_Result_Scale_Mul = 3043, + Customize_Param_Float_Height = 3044, + Customize_Param_Float_Expand_Height = 3045, + Customize_Param_Float_Shield_Radius = 3046, + Customize_Param_Float_Shield_Break_Y = 3047, + Customize_Param_Float_Jostle_Weight = 3048, + Customize_Param_Float_Effect_Scale = 3049, + Customize_Param_Float_Entry_Stand_Scale = 3050, + + Customize_Param_Float_Cliff_Jump_Speed_X = 3057, + Customize_Param_Float_Cliff_Jump_Speed_Y = 3058, + Customize_Param_Float_Item_Lift_Accel_Mul = 3059, + Customize_Param_Float_Item_Lift_Accel_Add = 3060, + Customize_Param_Float_Item_Lift_Speed_Max = 3061, + Customize_Param_Float_Item_Grip_Offset_X = 3062, + Customize_Param_Float_Item_Grip_Offset_Y = 3063, + Customize_Param_Float_Item_Grip_Offset_Z = 3064, + Customize_Param_Float_Throw_Item_Speed_Mul = 3065, + Customize_Param_Float_Throw_Item_Power_Mul = 3066, + Customize_Param_Float_Shoot_Walk_Accel_Mul = 3067, + Customize_Param_Float_Shoot_Walk_Accel_Add = 3068, + Customize_Param_Float_Shoot_Walk_Speed_Max = 3069, + Customize_Param_Float_Shoot_Dash_Speed_F = 3070, + Customize_Param_Float_Shoot_Dash_Speed_B = 3071, + + Customize_Param_Float_Landing_Frame_Light = 3073, + Customize_Param_Float_Landing_Frame = 3074, + Customize_Param_Float_Landing_Attack_Air_Frame_N = 3075, + Customize_Param_Float_Landing_Attack_Air_Frame_F = 3076, + Customize_Param_Float_Landing_Attack_Air_Frame_B = 3077, + Customize_Param_Float_Landing_Attack_Air_Frame_Hi = 3078, + Customize_Param_Float_Landing_Attack_Air_Frame_Lw = 3079, + Customize_Param_Float_Cursor_Offset_Y = 3080, + Customize_Param_Float_Passive_Wall_Speed_X = 3081, + Customize_Param_Float_Passive_Wall_Jump_Speed_X = 3082, + Customize_Param_Float_Passive_Wall_Jump_Speed_Y = 3083, + Customize_Param_Float_Passive_Ceil_Speed_X = 3084, + Customize_Param_Float_Wall_Jump_Enable_Speed_X = 3085, + Customize_Param_Float_Ladder_Speed_U_Max = 3086, + Customize_Param_Float_Ladder_Speed_D_Max = 3087, + Customize_Param_Float_Wind_Resistance = 3088, + Customize_Param_Float_Swim_Rise_Accel_Y = 3089, + Customize_Param_Float_Swim_Rise_Stable_Speed_Y = 3090, + Customize_Param_Float_Swim_Accel_Mul = 3091, + Customize_Param_Float_Swim_Speed_Mul = 3092, + Customize_Param_Float_Swim_Brake = 3093, + Customize_Param_Float_Swim_Drown_Out_Accel_Y_Frame = 3094, + Customize_Param_Float_Star_Scale = 3095, + Customize_Param_Float_Egg_Scale = 3096, + Customize_Param_Float_Egg_Collision_Offset_1_X = 3097, + Customize_Param_Float_Egg_Collision_Offset_1_Y = 3098, + Customize_Param_Float_Egg_Collision_Offset_1_Z = 3099, + Customize_Param_Float_Egg_Collision_Offset_2_X = 3100, + Customize_Param_Float_Egg_Collision_Offset_2_Y = 3101, + Customize_Param_Float_Egg_Collision_Offset_2_Z = 3102, + Customize_Param_Float_Egg_Collision_Size = 3103, + Customize_Param_Float_Barrel_Attack_Offset_X = 3104, + Customize_Param_Float_Barrel_Attack_Offset_Y = 3105, + Customize_Param_Float_Barrel_Attack_Offset_Z = 3106, + Customize_Param_Float_Barrel_Attack_Size = 3107, + Customize_Param_Float_Ice_Offset_Y = 3108, + Customize_Param_Float_Ice_Offset_Z = 3109, + Customize_Param_Float_Ice_Radius = 3110, + Customize_Param_Float_Ice_Jump_Speed_Y_Mul = 3111, + Customize_Param_Float_Ice_Jump_Speed_X = 3112, + + Customize_Param_Float_Slope_Top_Angle_Max = 3114, + + + Common_Param_Float_Walk_Stick_X = 3117, + + Common_Param_Float_Walk_Motion_Rate_Max = 49952, + Common_Param_Float_Turn_Stick_X = 3121, + Common_Param_Float_Dash_Stick_X = 3122, + Common_Param_Float_Dash_Escape_Frame = 3123, // TODO: Verify + Common_Param_Float_Turn_Dash_Frame = 3124, // TODO: Verify + Common_Param_Float_Dash_End_Speed_Mul = 3125, + Common_Param_Float_Run_Stick_X = 3126, + + Common_Param_Float_Run_Brake_Brake_Mul = 3128, + + Common_Param_Float_Turn_Run_Stick_X = 3130, + + Common_Param_Float_Squat_Stick_Y = 3133, + Common_Param_Float_Squat_F_Stick_X_Min = 3134, + Common_Param_Float_Squat_F_Stick_X_Max = 3135, + Common_Param_Float_Squat_B_Stick_X_Min = 3136, + Common_Param_Float_Squat_B_Stick_X_Max = 3137, + Common_Param_Float_Jump_Stick_Y = 3138, + Common_Param_Float_Jump_Neutral_X = 3139, + Common_Param_Float_Jump_Neutral_Y = 3140, // TODO: Verify + Common_Param_Float_Jump_Run_Stick_Y = 3141, + Common_Param_Float_Jump_Speed_Y_Mul = 3142, + + Common_Param_Float_Escape_Stick_Y = 3148, + Common_Param_Float_Escape_Fb_Stick_X = 3149, + + Common_Param_Float_Attack_S3_Stick_X = 3151, + Common_Param_Float_Attack_S3_Stick_Dir_Hi = 3152, + Common_Param_Float_Attack_S3_Stick_Dir_Lw = 3153, + Common_Param_Float_Attack_Hi3_Stick_Y = 3154, + Common_Param_Float_Attack_Lw3_Stick_Y = 3155, + Common_Param_Float_Attack_S4_Stick_Dir_Hi = 3156, + Common_Param_Float_Attack_S4_Stick_Dir_Lw = 3157, + Common_Param_Float_Attack_Hi4_Stick_Y = 3158, + Common_Param_Float_Attack_Hi4_Flick_Y = 3159, + Common_Param_Float_Attack_Lw4_Stick_Y = 3160, + Common_Param_Float_Attack_Lw4_Flick_Y = 3161, + + Common_Param_Float_Attack_Air_Neutral_X = 3164, + Common_Param_Float_Attack_Air_Neutral_Y = 3165, + + Common_Param_Float_Dive_Cont_Value = 3167, + + Common_Param_Float_Hit_Stop_Squat_Mul = 3171, + Common_Param_Float_Hit_Stop_Guard_Mul = 3172, // TODO: Verify + + Common_Param_Float_Down_Frame = 3179, + Common_Param_Float_Stand_Stick_Y = 3180, + Common_Param_Float_Stand_Fb_Stick_X = 3181, + + Common_Param_Float_Special_Stick_X = 3185, + Common_Param_Float_Special_Stick_Y = 3186, + Common_Param_Float_Pass_Stick_Y = 3187, + Common_Param_Float_Pass_Speed_Y = 3188, + + Common_Param_Float_Cliff_Catch_Cancel_Stick_Y = 3192, + + Common_Param_Float_Spring_Jump_Mul = 3197, + Common_Param_Float_Passive_Fb_Cont_Value = 3198, + Common_Param_Float_Passive_Ground_Damage_Speed_Mul = 3199, + Common_Param_Float_FuraFura_Frame = 3200, + + Common_Param_Float_FuraFura_Recovery = 3202, + Common_Param_Float_FuraFura_Recovery_Clatter = 3203, + + Common_Param_Float_Slip_Damage_Rate_Max = 3206, + Common_Param_Float_Slip_Damage_Rate_Min = 3207, + Common_Param_Float_Slip_Mul = 3208, + Common_Param_Float_Slip_Dash_Rate_Max = 3209, + Common_Param_Float_Slip_Dash_Rate_Min = 3210, + Common_Param_Float_Slip_Turn_Rate_Max = 3211, + Common_Param_Float_Slip_Turn_Rate_Min = 3212, + Common_Param_Float_Loupe_Damage_Limit = 3213, + Common_Param_Float_Loupe_Damage = 3214, + Common_Param_Float_Cursor_Fly_Speed = 3215, + Common_Param_Float_Cursor_Disp_Camera_Distance = 3216, + Common_Param_Float_Discretion_Final_Rate = 3217, + Common_Param_Float_Discretion_Final_Rate_Add = 3218, + Common_Param_Float_Discretion_Final_Rate_Max = 3219, + Common_Param_Float_Stop_Ceil_Speed_X_Mul = 3220, + Common_Param_Float_Stop_Ceil_Speed_Y_Mul = 3221, + Common_Param_Float_Stop_Ceil_Speed_X_Stable_Mul = 3222, + Common_Param_Float_Wall_Jump_Stick_X = 3223, + Common_Param_Float_Wall_Jump_Speed_Dec = 3224, + Common_Param_Float_Wall_Jump_Speed_X_Dec = 3225, + Common_Param_Float_Tread_Jump_Speed_Dec = 3226, + Common_Param_Float_Tread_Jump_Speed_Limit = 3227, + Common_Param_Float_Attach_Wall_Slant_Max = 3228, + Common_Param_Float_Attack_Wall_Slant_Min = 3229, + Common_Param_Float_Attach_Wall_Frame_Mul = 3230, + Common_Param_Float_Detach_Wall_Jump_X_Mul = 3231, + + Common_Param_Float_Shield_Max = 3233, + Common_Param_Float_Shield_Scale_Min = 3234, + + Common_Param_Float_Shield_Dec = 3237, + Common_Param_Float_Shield_Recovery = 3238, + Common_Param_Float_Shield_Reset = 3239, + Common_Param_Float_Shield_Damage_Mul = 3240, + Common_Param_Float_Shield_Damage_Add = 3241, + Common_Param_Float_Shield_SetOff_Mul = 3242, + Common_Param_Float_Shield_SetOff_Add = 3243, + Common_Param_Float_Shield_SetOff_Speed_Mul = 3244, + Common_Param_Float_Shield_SetOff_Speed_Max = 3245, + + Common_Param_Float_Shield_Stiff_Mul_Attack_Air = 3248, + Common_Param_Float_Shield_Stiff_Mul_Attack_4 = 3249, + Common_Param_Float_Shield_Comp_Mul = 3250, + Common_Param_Float_Just_Shield_Rebound_Speed_Mul = 3251, + Common_Param_Float_Shield_Rebound_Speed_Mul = 3252, + Common_Param_Float_Shield_Rebound_Speed_Add = 3253, + Common_Param_Float_Shield_Rebound_Air_Brake = 3254, + Common_Param_Float_Shield_Rebound_Ground_Brake = 3255, + + Common_Param_Float_Capture_Recovery = 3259, + Common_Param_Float_Capture_Recovery_Clatter = 3260, + + Common_Param_Float_Capture_Cut_Dist_X = 3264, // TODO: Verify + Common_Param_Float_Capture_Cut_Dist_Y = 3265, // TODO: Verify + Common_Param_Float_Capture_Cut_Frame_Damage_Mul = 3266, + + Common_Param_Float_Capture_Cut_Brake_Mul = 3268, // TODO: Verify + Common_Param_Float_Capture_Cut_Ground_Speed = 3269, + Common_Param_Float_Capture_Cut_Speed_X = 3270, + Common_Param_Float_Capture_Cut_Speed_Y = 3271, + + Common_Param_Float_Fly_Effect_Smoke_Speed_Threshold = 3281, + Common_Param_Float_Fly_Effect_Smoke_Rate = 3282, + + Common_Param_Float_Damage_Fly_Reflect_Speed = 3284, + Common_Param_Float_Damage_Fly_Reflect_Speed_Mul = 3285, + + Common_Param_Float_Damage_Fly_Speed_Y_Mul_Base_Accel = 3288, + Common_Param_Float_Damage_Fly_Speed_Y_Mul = 3289, + + Common_Param_Float_Damage_Fly_Cloud_Through_Speed = 3291, + Common_Param_Float_Damage_Fly_Cloud_Through_Out_Speed_Mul = 3292, + Common_Param_Float_Damage_Ground_Mul = 3293, + Common_Param_Float_Damage_Air_Brake = 3294, + Common_Param_Float_Damage_Speed_Composition_Speed = 3295, + + Common_Param_Float_Dead_Up_Damage_Speed = 3302, + + Common_Param_Float_Damage_Fly_Ind_Speed_Max = 3308, + Common_Param_Float_Damage_Fly_Ind_Speed_Min = 3309, + Common_Param_Float_Damage_Fly_Ind_Speed_Succeed_Mul = 3310, + Common_Param_Float_Damage_Fly_Ind_Weight_Mul = 3311, + Common_Param_Float_Damage_Song_Frame = 3312, + Common_Param_Float_Damage_Song_Frame_Bonus_Rank = 3313, + Common_Param_Float_Damage_Song_Frame_Bonus_Handi = 3314, + Common_Param_Float_Damage_Song_Frame_Bonus_Reaction = 3315, + Common_Param_Float_Damage_Song_Frame_Bonus_Damage = 3316, + Common_Param_Float_Damage_Song_Recovery = 3317, + Common_Param_Float_Damage_Song_Recovery_Clatter = 3318, + Common_Param_Float_Damage_Song_Fall_Speed_Limit = 3319, + Common_Param_Float_Damage_Bind_Frame = 3320, + Common_Param_Float_Damage_Bind_Frame_Bonus_Rank = 3321, + Common_Param_Float_Damage_Bind_Frame_Bonus_Handi = 3322, + Common_Param_Float_Damage_Bind_Frame_Bonus_Reaction = 3323, + Common_Param_Float_Damage_Bind_Frame_Bonus_Damage = 3324, + Common_Param_Float_Damage_Bind_Recovery = 3325, + Common_Param_Float_Damage_Bind_Recovery_Clatter = 3326, + Common_Param_Float_Damage_Bury_Frame = 3327, + Common_Param_Float_Damage_Bury_Frame_Bonus_Rank = 3328, + Common_Param_Float_Damage_Bury_Frame_Bonus_Handi = 3329, + Common_Param_Float_Damage_Bury_Frame_Bonus_Reaction = 3330, + Common_Param_Float_Damage_Bury_Frame_Bonus_Damage = 3331, + Common_Param_Float_Damage_Bury_Recovery = 3332, + Common_Param_Float_Damage_Bury_Recovery_Clatter = 3333, + Common_Param_Float_Damage_Bury_Jump_Speed_Y_Mul = 3334, + Common_Param_Float_Damage_Bury_Jump_No_Attack_Frame_Value = 3335, + Common_Param_Float_Damage_Bury_Damage_Reaction_Sub = 3336, + Common_Param_Float_Damage_Ice_Fall_Y_Mul = 3337, + Common_Param_Float_Damage_Ice_Reflect_Break_Speed = 3338, + Common_Param_Float_Damage_Ice_Reflect_Speed_Mul = 3339, + Common_Param_Float_Damage_Ice_Damage_Dec_Mul = 3340, + Common_Param_Float_Damage_Ice_Damage_Reaction_Dec_Mul = 3341, + Common_Param_Float_Damage_Ice_Damage_Air_Brake = 3342, + Common_Param_Float_Damage_Ice_Rot_Speed_Min = 3343, + Common_Param_Float_Damage_Ice_Rot_Speed_Max = 3344, + Common_Param_Float_Damage_Ice_Frame_Damage_Mul = 3345, + Common_Param_Float_Damage_Ice_Recovery = 3346, + Common_Param_Float_Damage_Ice_Recovery_Clatter = 3347, + Common_Param_Float_Damage_Ice_Recovery_Damage = 3348, + Common_Param_Float_Damage_Ice_Effect_Radius = 3349, + Common_Param_Float_Ladder_Stick_Y = 3350, + Common_Param_Float_Ladder_Cancel_Frame = 3351, + Common_Param_Float_Ladder_Jump_Y_Mul = 3352, + + Common_Param_Float_Wind_Air_Brake = 3354, + Common_Param_Float_Swim_Dive_Speed_Mul = 3355, + Common_Param_Float_Swim_Jump_Charge_Accel_Y = 3356, + Common_Param_Float_Swim_Jump_Speed_Y_Mul = 3357, + Common_Param_Float_Swim_Drown_Frame_Dec_Damage_Rate = 3358, + Common_Param_Float_Swim_Drown_Speed_X_Mul = 3359, + + Common_Param_Float_Barrel_Cursor_Offset_Y = 3373, + Common_Param_Float_Truck_Cursor_Offset_Y = 3374, + + Common_Param_Float_Bitten_Frame_Add = 3375, + Common_Param_Float_Bitten_Frame_Damage_Mul = 3376, + Common_Param_Float_Bitten_Recovery_Clatter = 3377, + Common_Param_Float_Bitten_Motion_Rate = 3378, + Common_Param_Float_Bitten_Motion_Rate_Frame = 3379, + Common_Param_Float_Bitten_Flick_Frame = 3380, // TODO: Verify + Common_Param_Float_Kirby_Swallowed_Offset_X = 3381, + Common_Param_Float_Kirby_Swallowed_Offset_Y = 3382, + Common_Param_Float_Kirby_Swallowed_Speed_X = 3383, + Common_Param_Float_Kirby_Swallowed_Speed_Y = 3384, + Common_Param_Float_Kirby_Swallowed_Comp_Dist = 3385, + Common_Param_Float_Kirby_SwallowedCatch_Recovery_Clatter = 3386, + Common_Param_Float_Kirby_SwallowedCatch_Recovery = 3387, + Common_Param_Float_Kirby_SwallowedCatch_Frame = 3388, + Common_Param_Float_Kirby_SwallowedThrown_Recovery_Clatter = 3389, + Common_Param_Float_Kirby_SwallowedThrown_Recovery = 3390, + Common_Param_Float_Kirby_SwallowedThrown_Frame = 3391, + + Common_Param_FLoat_Kirby_SwallowedThrown_Exit_Frame = 3393, + Common_Param_Float_Kirby_SwallowedThrown_Exit_Speed_X = 3394, + Common_Param_Float_Kirby_SwallowedThrown_Exit_Speed_Y = 3395, + + Common_Param_Float_Shouldered_Frame_Add = 3400, + Common_Param_Float_Shouldered_Frame_Damage_Mul = 3401, + Common_Param_Float_Shouldered_Recovery_Clatter = 3402, + Common_Param_Float_Shouldered_Recovery_Clatter_Air = 3403, + Common_Param_Float_Dedede_Swallowed_Offset_X = 3404, + Common_Param_Float_Dedede_Swallowed_Offset_Y = 3405, + Common_Param_Float_Dedede_Swallowed_Speed_X = 3406, + Common_Param_Float_Dedede_Swallowed_Speed_Y = 3407, + Common_Param_Float_Dedede_Swallowed_Comp_Dist = 3408, + Common_Param_Float_Dedede_SwallowedCatch_Recovery_Clatter = 3409, + Common_Param_Float_Dedede_SwallowedCatch_Recovery = 3410, + Common_Param_Float_Dedede_SwallowedCatch_Frame = 3411, + Common_Param_Float_Dedede_SwallowedThrown_Recovery_Clatter = 3412, + Common_Param_Float_Dedede_SwallowedThrown_Recovery = 3413, + Common_Param_Float_Dedede_SwallowedThrown_Frame = 3414, + Common_Param_Float_Dedede_SwallowedThrown_Exit_Frame = 3415, + Common_Param_Float_Dedede_SwallowedThrown_Exit_Speed_X = 3416, + Common_Param_Float_Dedede_SwallowedThrown_Exit_Speed_Y = 3417, + Common_Param_Float_Dedede_SwallowedEscape_Offset_X = 3418, + Common_Param_Float_Dedede_SwallowedEscape_Offset_Y = 3419, +// Common_Param_Float_Dedede_SwallowedEscape_1 = 3420, // TODO: Check what these are +// Common_Param_Float_Dedede_SwallowedEscape_2 = 3421, +// Common_Param_Float_Dedede_SwallowedEscape_3 = 3422, + Common_Param_Float_Diddy_Clung_Frame_Add = 3423, + Common_Param_Float_Diddy_Clung_Frame_Damage_Mul = 3424, + Common_Param_Float_Diddy_Clung_Frame_Handicap_Mul = 3425, + Common_Param_Float_Diddy_Clung_Frame_Air_Mul = 3426, + Common_Param_Float_Diddy_Clung_Recovery_Clatter = 3427, + Common_Param_Float_Diddy_Clung_Stop_Speed_X = 3428, + + Common_Param_Float_Item_Lift_Walk_Stick_X = 3447, + Common_Param_Float_Item_Turn_Stick_X = 3448, + + Common_Param_Float_Shoot_Jump_Speed_Y_Mul = 3454, + Common_Param_Float_Item_Pickup_Light_Walk_Mul = 3455, + Common_Param_Float_Damage_Drop_Dragoon_Angle = 3456, + Common_Param_Float_Damage_Drop_Dragoon_Speed = 3457, + Common_Param_Float_Flower_Recovery = 3458, + Common_Param_Float_Flower_Recovery_Clatter = 3459, + Common_Param_Float_Flower_Frame_Max = 3460, + Common_Param_Float_Flower_Damage_Add_Frame_Rate = 3461, + Common_Param_Float_Flower_Scale_Min = 3462, + Common_Param_Float_Flower_Scale_Max = 3463, + Common_Param_Float_Flower_Damage_Add_Scale_Rate = 3464, + Common_Param_Float_Flower_Static_Scale = 3465, + Common_Param_Float_Gekikara_Motion_Rate = 3466, + Common_Param_Float_Gekikara_Fire_Shoot_Angle = 3467, + Common_Param_Float_Gekikara_Fire_Shoot_Angle_Speed = 3468, + Common_Param_Float_Gekikara_Fire_Shoot_Angle_Min = 3469, + Common_Param_Float_Gekikara_Fire_Shoot_Angle_Max = 3470, + Common_Param_Float_Screw_Jump_Speed_Y_Mul = 3471, + Common_Param_Float_Kinoko_More_Giant_Scale = 3472, + Common_Param_Float_Kinoko_Giant_Scale = 3473, + Common_Param_Float_Kinoko_Small_Scale = 3474, + Common_Param_Float_Kinoko_More_Small_Scale = 3475, + Common_Param_Float_Kinoko_Pitch_Big = 3476, + Common_Param_Float_Kinoko_Pitch_Small = 3477, + Common_Param_Float_Kinoko_Bonus_Damage = 3478, + Common_Param_Float_Thunder_More_Giant_Scale = 3479, + Common_Param_Float_Thunder_Giant_Scale = 3480, + Common_Param_Float_Thunder_Small_Scale = 3481, + Common_Param_Float_Thunder_More_Small_Scale = 3482, + Common_Param_Float_Thunder_Pitch_Big = 3483, + Common_Param_Float_Thunder_Pitch_Small = 3484, + Common_Param_Float_Metal_Cancel_Damage = 3485, + Common_Param_Float_Metal_Damage_Reaction_Sub = 3486, + Common_Param_Float_Team_Healing_Heal_Team_Mul = 3487, + Common_Param_Float_Team_Healing_Heal_Opponent_Rate = 3488, + Common_Param_Float_Team_Healing_Heal_Opponent_Mul = 3489, + Common_Param_Float_Pit_Fall_Speed = 3490, + Common_Param_Float_Pit_Fall_Accel = 3491, + Common_Param_Float_Pit_Fall_Speed_Max = 3492, + + + Owner_Param_Float_Damage_Ratio = 3502, + Owner_Param_Float_Attack_Reaction_Mul = 3503, + Owner_Param_Float_Damage_Reaction_Mul = 3504, + Owner_Param_Float_Special_Glow_Attack = 3505, + Owner_Param_Float_Auto_Handi = 3506, + Owner_Param_Float_Slip_Mul = 3507, + Owner_Param_Float_Result_Win_Rot_Y = 3508, + }; + + enum ParamInt { + Customize_Param_Int_Run_Brake_Attack_Dash_Frame = 23001, + Customize_Param_Int_Jump_Squat_Frame = 23002, + Customize_Param_Int_Jump_Count_Max = 23003, + Customize_Param_Int_Jump_Glide_Frame = 23004, + + // 23006 Something to do with team healer damage opponent rate? used in Fighter::touchItem + Customize_Param_Int_Landing_Heavy_Frame = 23007, + Customize_Param_Int_Damage_Fly_Smoke_Node_Index = 23008, + Customize_Param_Int_No_Ladder_Frame = 23009, + Customize_Param_Int_Ladder_Hand_Node_Index_1 = 23010, + Customize_Param_Int_Ladder_Hand_Node_Index_2 = 23011, + Customize_Param_Int_Star_Attack_Power = 23012, + Customize_Param_Int_Barrel_Attack_Node_Index = 23013, + Customize_Param_Int_Ice_Node_Index = 23014, + + Customize_Param_Int_Dead_Rare_SE_Rate = 23017, + + // 23027 + + + Common_Param_Int_Dash_Flick_X = 23031, + Common_Param_Int_Dash_Speed_Keep_Frame = 23032, + Common_Param_Int_Re_Dash_Frame = 23033, + Common_Param_Int_Turn_Dash_Frame = 23034, // TODO: verify + Common_Param_Int_Jump_Initial_Frame = 23035, + Common_Param_Int_Jump_Flick_Y = 23036, + Common_Param_Int_Escape_Flick_Y = 23037, + Common_Param_Int_Escape_Fb_Flick_X = 23038, + Common_Param_Int_Dive_Flick_Frame = 23039, + + Common_Param_Int_Hit_Stop_Delay_Flick_Frame = 23041, + Common_Param_Int_Damage_Turn_Reverse_Cont_Frame = 23042, + Common_Param_Int_Status_Start_Turn_Frame = 23043, + Common_Param_Int_Special_Smash_Flick_X = 23044, // TODO: Verify + Common_Param_Int_Special_Air_N_Turn_Frame = 23045, + Common_Param_Int_Pass_Flick_Y = 23046, + Common_Param_Int_Cliff_Catch_Move_Frame = 23047, + Common_Param_Int_Cliff_Catch_Time_Quick = 23048, + Common_Param_Int_Cliff_Wait_Air_Xlu_Max_Air_Frame = 23049, + Common_Param_Int_Cliff_No_Catch_Frame = 23050, + Common_Param_Int_Cliff_Wait_Xlu_Frame = 23051, + Common_Param_Int_Passive_Trigger_Frame = 23052, + Common_Param_Int_No_Rapid_Frame_Value = 23053, + Common_Param_Int_Passive_Wall_Stop_Frame = 23054, + + Common_Param_Int_Air_Escape_Passive_Trigger_Frame = 23056, + + Common_Param_Int_Slip_Damage_Disable_Frame = 23057, + Common_Param_Int_Slip_Wait_Frame = 23058, + Common_Param_Int_Slip_Disable_Frame = 23059, + + Common_Param_Int_Damage_Drop_Smash_Ball = 23063, + Common_Param_Int_Damage_Drop_Smash_Ball_Handicap = 23064, + + Common_Param_Int_Discretion_Final_Point_Diff = 23067, + Common_Param_Int_No_Discretion_Final_Beat_Count = 23068, + Common_Param_Int_Wall_Jump_Interval_Frame = 23069, + Common_Param_Int_Wall_Jump_Flick_X = 23070, + Common_Param_Int_Wall_Jump_Stop_Frame = 23071, + Common_Param_Int_Wall_Jump_Disable_Cont_Frame = 23072, + Common_Param_Int_Tread_Attack_Frame = 23073, // TODO: Verify + Common_Param_Int_Attach_Wall_Frame = 23074, + Common_Param_Int_Attach_Wall_Disable_Frame = 23075, + Common_Param_Int_Shield_Min_Frame = 23076, + + Common_Param_Int_Shield_Just_Frame = 23078, + Common_Param_Int_Continue_Just_Shield_Count = 23079, + Common_Param_Int_Guard_Off_Cancel_Frame = 23080, + Common_Param_Int_Catch_Dash_Frame = 23081, + Common_Param_Int_Catch_Turn_Frame = 23082, + + Common_Param_Int_Capture_Cut_Jump_Button_Count = 23084, + Common_Param_Int_Capture_Cut_Frame = 23085, + Common_Param_Int_Throw_Invincible_Frame = 23086, + + Common_Param_Int_Damage_Fly_Attack_Frame = 23088, + Common_Param_Int_Damage_Fly_Escape_Frame = 23089, + + Common_Param_Int_Rebirth_Move_Frame = 23100, + Common_Param_Int_Rebirth_Wait_Frame = 23101, + Common_Param_Int_Rebirth_Invincible_Frame = 23102, + + Common_Param_Int_Bury_Down_Frame = 23104, + Common_Param_Int_Bury_Physics_Invalid_Frame = 23105, + Common_Param_Int_Ice_Jump_Stiff_Frame = 23106, + Common_Param_Int_Ground_Damage_Disable_Frame = 23107, + + Common_Param_Int_Swim_Jump_Charge_Frame = 23109, + Common_Param_Int_Swim_Jump_Speed_Y_Dec_Count = 23110, + Common_Param_Int_Swim_Effect_Interval_Frame = 23111, + Common_Param_Int_Swim_Drown_Frame = 23112, + Common_Param_Int_Swim_Drown_Out_Frame = 23113, + Common_Param_Int_Swim_Drown_Effect_Interval_Frame = 23114, + + Common_Param_Int_Item_Throw_4_Flick = 23124, + Common_Param_Int_Item_Air_Throw_4_Flick = 23125, + Common_Param_Int_Item_Catch_Frame_Attack_Dash = 23126, + Common_Param_Int_Item_Air_Catch_Frame = 23127, + Common_Param_Int_Item_Air_Catch_Frame_Escape = 23128, + Common_Param_Int_Item_No_Air_Catch_Frame = 23129, + Common_Param_Int_Damage_Drop_Item = 23130, + Common_Param_Int_Damage_Drop_Item_Empty = 23131, + + Common_Param_Int_Damage_Drop_Dragoon = 23142, + Common_Param_Int_Damage_Drop_Dragoon_Handicap = 23143, + Common_Param_Int_Dragoon_Invincible_Frame = 23144, + + Common_Param_Int_Gekikara_Frame = 23148, + Common_Param_Int_Gekikara_Fire_Shoot_Interval = 23149, + Common_Param_Int_Hammer_Frame = 23150, + Common_Param_Int_Hammer_Landing_Frame = 23151, + Common_Param_Int_Hammer_Throw_Frame = 23152, + Common_Param_Int_Golden_Hammer_Frame = 23153, + Common_Param_Int_Golden_Hammer_Hande_Frame = 23154, + Common_Param_Int_Golden_Hammer_Beat_Dec_Frame = 23155, + Common_Param_Int_Golden_Hammer_End_Flash_Frame = 23156, + Common_Param_Int_Golden_Hammer_Drift_Frame = 23157, + //Common_Param_Int_Golden_Hammer_ = 23158, + Common_Param_Int_Super_Star_Frame = 23159, + Common_Param_Int_Super_Star_SE_Frame = 23160, + Common_Param_Int_Kinoko_Frame = 23161, + Common_Param_Int_Kinoko_Bonus_Max = 23162, + Common_Param_Int_Thunder_Frame = 23163, + + Common_Param_Int_Metal_Frame = 23165, + Common_Param_Int_Timer_Slow_Mag = 23166, + Common_Param_Int_Timer_Frame = 23167, + + Common_Param_Int_Timer_Beat_Dec_Frame = 23169, + + + Owner_Param_Int_Shield_Break_Frame_Add = 23174, + Owner_Param_Int_Swim_Drown_Frame_Add = 23175, + Entry_Param_Int_Rank = 23176, + Owner_Param_Int_Stock_Count = 23177, + + + Info_Param_Int_Attack_Combo_Type = 23180, + Info_Param_Int_Attack_Combo_Max = 23181, + Info_Param_Int_Attack_100_Type = 23182, + Info_Param_Int_S3_Combo_Max = 23183, + Info_Param_Int_S4_Combo_Max = 23184, + Info_Param_Int_Jump_Aerial_Type = 23185, + Info_Param_Int_Glide_Type = 23186, + Info_Param_Int_Squat_Walk_Type = 23187, + Info_Param_Int_Attack_Dash_Type = 23188, + Info_Param_Int_Wall_Jump_Type = 23189, + Info_Param_Int_Attach_Wall_Type = 23190, + Info_Param_Int_Air_Lasso_Type = 23191, + Info_Param_Int_Motion_Share_Type = 23192, + Info_Param_Int_Capture_Motion_Height = 23193, + }; + + enum ParamIndefinite { + + }; + + enum VariableFloat { + Var_Float_Kinetic_Sum_Speed = 1000, + Var_Float_Kinetic_Sum_Speed_X = 1001, + Var_Float_Kinetic_Sum_Speed_Y = 1002, + Var_Float_Motion_Trans_Move_Speed_X = 1003, + Var_Float_Motion_Trans_Move_Speed_Y = 1004, + Var_Float_Kinetic_Energy_Damage_Speed = 1005, + Var_Float_Kinetic_Energy_Damage_Speed_X = 1006, + Var_Float_Kinetic_Energy_Damage_Speed_X_Rv = 1007, + Var_Float_Kinetic_Energy_Damage_Speed_Y = 1008, + Var_Float_Kinetic_Energy_Damage_Speed_Y_Rv = 1009, + Var_Float_Controller_Stick_X = 1010, + Var_Float_Controller_Stick_X_Lr = 1011, + Var_Float_Controller_Stick_X_Lr_Rv = 1012, + Var_Float_Controller_Stick_X_Abs = 1013, + Var_Float_Controller_Stick_X_Rv = 1014, + + Var_Float_Controller_Stick_X_Kinetic_Sum_Speed_Lr = 1017, + Var_Float_Controller_Stick_Y = 1018, + Var_Float_Controller_Stick_Y_Abs = 1019, + Var_Float_Controller_Stick_Y_Rv = 1020, + Var_Float_Controller_Stick_Dir = 1021, + Var_Float_Controller_Stick_Prev_X = 1022, + Var_Float_Controller_Stick_Prev_X_Lr = 1023, + Var_Float_Controller_Stick_Prev_X_Lr_Rv = 1024, + Var_Float_Controller_Stick_Prev_X_Abs = 1025, + Var_Float_Controller_Stick_Prev_Y = 1026, + Var_Float_Controller_Stick_Prev_Y_Abs = 1027, + Var_Float_Controller_Stick_Prev_Y_Rv = 1028, + Var_Float_Throw_Item_Speed = 1029, + Var_Float_Throw_Item_Angle = 1030, + Var_Float_Throw_Item_Power = 1031, + Var_Float_Item_Pickup_Light_Range = 1032, + Var_Float_Item_Swing_Motion_Rate = 1033, + Var_Float_Tread_Jump_Speed_Y = 1034, + Var_Float_Motion_Frame = 1035, + Var_Float_Motion_Rate = 1036, + }; + + enum VariableInt { + Var_Int_Combo_Count = 21000, + Var_Int_Controller_Flick_X = 21001, + Var_Int_Controller_Flick_Y = 21002, + Var_Int_Controller_Flick_No_Reset_X = 21003, + Var_Int_Controller_Flick_No_Reset_Y = 21004, + Var_Int_Controller_Flick_After_X = 21005, + Var_Int_Controller_Flick_After_Y = 21006, + Var_Int_Controller_Flick_X_Dir = 21007, + Var_Int_Controller_Flick_Y_Dir = 21008, + Var_Int_Controller_Trigger_1_Count = 21009, + Var_Int_Controller_Trigger_1_Count_Prev = 21010, + Var_Int_Controller_Trigger_2_Count = 21011, + Var_Int_Controller_Trigger_2_Count_Prev = 21012, + Var_Int_Controller_Trigger_3_Count = 21013, + Var_Int_Controller_Trigger_3_Count_Prev = 21014, + Var_Int_Controller_Trigger_4_Count = 21015, + Var_Int_Controller_Trigger_4_Count_Prev = 21016, + Var_Int_Controller_Trigger_5_Count = 21017, + Var_Int_Controller_Trigger_5_Count_Prev = 21018, + Var_Int_Controller_Flick_X_Lr = 21019, + Var_Int_Controller_Flick_X_Lr_Rv = 21020, + Var_Int_Controller_Flick_After_X_Lr_Rv = 21021, + Var_Int_Item_Swing_1_Motion_Kind = 21022, + Var_Int_Item_Swing_3_Motion_Kind = 21023, + Var_Int_Item_Swing_4_Motion_Kind = 21024, + Var_Int_Item_Swing_Dash_Motion_Kind = 21025, + Var_Int_Item_Wait_Motion_Kind = 21026, + Var_Int_Item_Squat_Wait_Motion_Kind = 21027, + Var_Int_Win_Pose_Kind = 21028, + Var_Int_Player_Color_Kind = 21029, + }; + + virtual soParamAccesser* getExtendParamAccesser(); + virtual ~ftValueAccesser(); + virtual float getConstantFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getConstantIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getConstantIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + + virtual float getVariableFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getVariableIntCore(soModuleAccesser* moduleAccesser, u32, u32); + + virtual bool isControllerValueCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual bool isEnableSpeedOperationCore(soModuleAccesser* moduleAccesser); + + +}; + diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/ft_virtual_node_matrix_pool.h b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_virtual_node_matrix_pool.h new file mode 100644 index 0000000000..5603cab1c4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/ft_virtual_node_matrix_pool.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include + +class ftVirtualNodeMatrixPool : public soNullable { +public: + ftVirtualNodeMatrixPool(bool isNull) : soNullable(isNull) { } + virtual ~ftVirtualNodeMatrixPool() = 0; + virtual void* getHitMatrix() = 0; + virtual void* getCommonMatrix() = 0; + virtual void* getExtendMatrix() = 0; +}; +static_assert(sizeof(ftVirtualNodeMatrixPool) == 0x8, "Class is the wrong size!"); + +class ftVirtualNodeMatrixPoolImpl : public ftVirtualNodeMatrixPool { + // TODO types of data members and return types of member functions + u8 m_hitMatrix[0x3C0]; + u8 m_commonMatrix[0x90]; + u8 m_extendMatrix[0x60]; +public: + ftVirtualNodeMatrixPoolImpl() : ftVirtualNodeMatrixPool(false) { } + virtual ~ftVirtualNodeMatrixPoolImpl() { } + virtual void* getHitMatrix() { return &m_hitMatrix; } + virtual void* getCommonMatrix() { return &m_commonMatrix; } + virtual void* getExtendMatrix() { return &m_extendMatrix; } +}; +static_assert(sizeof(ftVirtualNodeMatrixPoolImpl) == 0x4B8, "Class is the wrong size!"); + +class ftVirtualNodeMatrixPoolNull : public ftVirtualNodeMatrixPool { +public: + ftVirtualNodeMatrixPoolNull() : ftVirtualNodeMatrixPool(true) { } + virtual ~ftVirtualNodeMatrixPoolNull() { } + virtual void* getHitMatrix() { return nullptr; } + virtual void* getCommonMatrix() { return nullptr; } + virtual void* getExtendMatrix() { return nullptr; } +}; +static_assert(sizeof(ftVirtualNodeMatrixPoolNull) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/lucario/ft_lucario_param_customize_module.h b/include/lib/BrawlHeaders/Brawl/Include/ft/lucario/ft_lucario_param_customize_module.h new file mode 100644 index 0000000000..912af6e89a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/lucario/ft_lucario_param_customize_module.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class ftLucarioParamCustomizeModule : ftParamCustomizeModuleImpl { +public: + ftLucarioParamCustomizeModule(soModuleAccesser* accsr); + virtual ~ftLucarioParamCustomizeModule(); + virtual float getAttackPowerMul(void* p1); +}; +static_assert(sizeof(ftLucarioParamCustomizeModule) == 0x694, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ft/purin/ft_purin_extend_param_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/ft/purin/ft_purin_extend_param_accesser.h new file mode 100644 index 0000000000..8e329fbabe --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ft/purin/ft_purin_extend_param_accesser.h @@ -0,0 +1,167 @@ +#include +#include +#include +#include + +#pragma once + +// TODO: identify the special moves these ExtendParam classes are for + +struct ftPurinExtendParamClass1 { + int unk0; + int unk4; + float unk8; + float unkC; + float unk10; + float unk14; + float unk18; + float unk1C; + float unk20; + float unk24; + float unk28; + float unk2C; + float unk30; + float unk34; + float unk38; + int unk3C; + float unk40; + float unk44; + float unk48; + float unk4C; + float unk50; + float unk54; + float unk58; + float unk5C; + float unk60; + float unk64; + int unk68; + float unk6C; + float unk70; + float unk74; + float unk78; + float unk7C; + float unk80; + float unk84; + float unk88; + float unk8C; + float unk90; + float unk94; + float unk98; + float unk9C; + float unkA0; + float unkA4; +}; + +struct ftPurinExtendParamClass2 { + float unk0; + float unk4; + float unk8; + float unkC; + float unk10; + float unk14; + float unk18; +}; + +struct ftPurinExtendParamClass3 { + float unk0; + float unk4; + float unk8; + float unkC; +}; + +// TODO: Match without the const_cast hack +// TODO: UBFIX endianness + +class ftPurinExtendParamAccesser : public ftExtendParamAccesserEx<3999, 49, 24999, 4> { + const ftPurinExtendParamClass1* group1(const u8* base) { + return *(ftPurinExtendParamClass1* const*)(base + OffsetExt1); + } + + const ftPurinExtendParamClass1* group1Cast(const u8* base) { + return *(ftPurinExtendParamClass1**)(base + OffsetExt1); + } + + const ftPurinExtendParamClass2* group2(const u8* base) { + return *(ftPurinExtendParamClass2* const*)(base + OffsetExt2); + } + + const ftPurinExtendParamClass2* group2Cast(const u8* base) { + return *(ftPurinExtendParamClass2**)(base + OffsetExt2); + } + + const ftPurinExtendParamClass3* group3(const u8* base) { + return *(ftPurinExtendParamClass3* const*)(base + OffsetExt3); + } + + const ftPurinExtendParamClass3* group3Cast(const u8* base) { + return *(ftPurinExtendParamClass3**)(base + OffsetExt3); + } + +public: + ftPurinExtendParamAccesser() : ftExtendParamAccesserEx(Fighter_Jigglypuff) { } + virtual ~ftPurinExtendParamAccesser() { } + + virtual void setup(const u8* extData) { + for (s32 i = 0; i < NumVariations; i++) { + m_floats[i][0] = &group1(extData)->unk8; + m_floats[i][1] = &group1(extData)->unkC; + m_floats[i][2] = &group1(extData)->unk10; + m_floats[i][3] = &group1(extData)->unk14; + m_floats[i][4] = &group1(extData)->unk18; + m_floats[i][5] = &group1(extData)->unk1C; + m_floats[i][6] = &group1(extData)->unk20; + m_floats[i][7] = &group1(extData)->unk24; + m_floats[i][8] = &group1(extData)->unk28; + m_floats[i][9] = &group1(extData)->unk2C; + m_floats[i][10] = &group1(extData)->unk30; + m_floats[i][11] = &group1(extData)->unk34; + m_floats[i][12] = &group1(extData)->unk38; + m_floats[i][13] = &group1(extData)->unk40; + m_floats[i][14] = &group1(extData)->unk44; + m_floats[i][15] = &group1(extData)->unk48; + m_floats[i][16] = &group1(extData)->unk4C; + m_floats[i][17] = &group1(extData)->unk50; + m_floats[i][18] = &group1(extData)->unk54; + m_floats[i][19] = &group1(extData)->unk58; + m_floats[i][20] = &group1(extData)->unk5C; + m_floats[i][21] = &group1(extData)->unk60; + m_floats[i][22] = &group1(extData)->unk64; + m_floats[i][23] = &group1(extData)->unk6C; + m_floats[i][24] = &group1(extData)->unk70; + m_floats[i][25] = &group1(extData)->unk74; + m_floats[i][26] = &group1(extData)->unk78; + m_floats[i][27] = &group1(extData)->unk7C; + m_floats[i][28] = &group1(extData)->unk80; + m_floats[i][29] = &group1(extData)->unk84; + m_floats[i][30] = &group1(extData)->unk88; + m_floats[i][31] = &group1(extData)->unk8C; + m_floats[i][32] = &group1(extData)->unk90; + m_floats[i][33] = &group1(extData)->unk94; + m_floats[i][34] = &group1(extData)->unk98; + m_floats[i][35] = &group1(extData)->unk9C; + m_floats[i][36] = &group1(extData)->unkA0; + m_floats[i][37] = &group1(extData)->unkA4; + + m_floats[i][38] = &group2Cast(extData)->unk0; + m_floats[i][39] = &group2(extData)->unk4; + m_floats[i][40] = &group2(extData)->unk8; + m_floats[i][41] = &group2(extData)->unkC; + m_floats[i][42] = &group2(extData)->unk10; + m_floats[i][43] = &group2(extData)->unk14; + m_floats[i][44] = &group2(extData)->unk18; + + m_floats[i][45] = &group3Cast(extData)->unk0; + m_floats[i][46] = &group3(extData)->unk4; + m_floats[i][47] = &group3(extData)->unk8; + m_floats[i][48] = &group3(extData)->unkC; + + m_ints[i][0] = &group1Cast(extData)->unk0; + m_ints[i][1] = &group1(extData)->unk4; + m_ints[i][2] = &group1(extData)->unk3C; + m_ints[i][3] = &group1(extData)->unk68; + } + } +}; +static_assert(sizeof(ftPurinExtendParamAccesser) == 0x1C8, "Class is the wrong size!"); + +extern ftPurinExtendParamAccesser g_ftPurinExtendParamAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene.h new file mode 100644 index 0000000000..933a6a48b3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene.h @@ -0,0 +1,93 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class gfSceneRoot : public gfTask { +public: + enum LayerType { + Layer_Ground = 0x0, + Layer_Ground_And_Chara = 0x1, + Layer_Chara = 0x2, + Layer_All = 0x3, + Layer_Fighter = 0x3, + Layer_Stage_Object = 0x3, + Layer_Ground2 = 0x3, + Layer_Effect = 0x4, + Layer_Effect_Fighter = 0x5, + Layer_Special_Stage_Object = 0x6, + Layer_Effect2D = 0x7, + Layer_Info = 0x8, + }; + + char _64[20]; + nw4r::g3d::AnmScnRes* m_anmScnRes; + char _88[12]; + union TransformFlag { + u32 m_mask; + struct { + bool m_flag31 : 1; // 0x80000000 + bool m_flag30 : 1; // 0x40000000 + bool m_flag29 : 1; // 0x20000000 + bool m_flag28 : 1; // 0x10000000 + bool m_flag27 : 1; // 0x8000000 + bool m_flag26 : 1; // 0x4000000 + bool m_flag25 : 1; // 0x2000000 + bool m_reverseLr : 1; // 0x1000000 + bool m_flag23 : 1; // 0x800000 + bool m_flag22 : 1; // 0x400000 + bool m_flag21 : 1; // 0x200000 + bool m_flag20 : 1; // 0x100000 + bool m_flag19 : 1; // 0x80000 + bool m_flag18 : 1; // 0x40000 + bool m_flag17 : 1; // 0x20000 + bool m_flag16 : 1; // 0x10000 + bool m_flag15 : 1; // 0x8000 + bool m_flag14 : 1; // 0x4000 + bool m_flag13 : 1; // 0x2000 + bool m_flag12 : 1; // 0x1000 + bool m_flag11 : 1; // 0x800 + bool m_flag10 : 1; // 0x400 + bool m_flag9 : 1; // 0x200 + bool m_flag8 : 1; // 0x100 + bool m_flag7 : 1; // 0x80 + bool m_flag6 : 1; // 0x40 + bool m_flag5 : 1; // 0x20 + bool m_flag4 : 1; // 0x10 + bool m_flag3 : 1; // 0x8 + bool m_flag2 : 1; // 0x4 + bool m_flag1 : 1; // 0x2 + bool m_flag0 : 1; // 0x1 + }; + } m_transformFlag; + + char _104[1044]; + float m_shadowPitch; + float m_shadowYaw; + float m_1156; + char _1160[132]; + + virtual void processAnim(); + virtual void processFixCamera(); + virtual void renderPre(); + virtual void renderOpa(); + virtual void renderXlu(); + virtual void renderDebug(); + virtual ~gfSceneRoot(); + + void setCurrentFrame(float); + void removeResAnmScn(); + nw4r::g3d::LightObj* getLightObj(u8 p1); + void updateZoneLightSet(u8 p1, u8 p2); + void setUseCopyFB(u8 p1); + + bool add(gfSceneRoot::LayerType lt, nw4r::g3d::ScnMdl* scnMdl); + bool remove(nw4r::g3d::ScnMdl* scnMdl); +}; +static_assert(sizeof(gfSceneRoot) == 1292, "Class is wrong size!"); + +extern gfSceneRoot* g_gfSceneRoot; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_event.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_event.h new file mode 100644 index 0000000000..771871da45 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_event.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +class gfSceneRootEvent : public utListNode { +public: + virtual void notify(s32 p1) = 0; +}; + +class gfSceneRootEventList { + gfSceneRootEvent* head; +public: + ~gfSceneRootEventList(); + void notify(s32 p1); +}; +static_assert(sizeof(gfSceneRootEventList) == 0x4, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_light_resource.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_light_resource.h new file mode 100644 index 0000000000..2549b4bb93 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_3d_scene_light_resource.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include + +class gfLightResHandle { + u8 unk0; +public: + nw4r::g3d::LightObj* getCharacterLight(); + void setZoneLightSet(u8 p1); +}; +static_assert(sizeof(gfLightResHandle) == 1, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_application.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_application.h new file mode 100644 index 0000000000..ba09f00d82 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_application.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include +#include + +struct vcBootParam { + u8 unk0[0x54]; + void init(int argc, const char* argv[]); +}; +// TODO size assertion + +class gfApplication; +extern gfApplication* g_gfApplication; +class gfApplication { +public: + u8 unk0[0xD0]; + gfKeepFrameBuffer unkD0; + u8 unkD1[0x13]; + int m_e4; + u8 unkE8[0x10]; + u16 m_frameRate; + u8 unkFA[0x1A]; + gfCallBackList m_114; + u8 unk118[0x4]; + vcBootParam m_bootParam; + + gfApplication(); + ~gfApplication(); + void init(); + void reset(); + void restart(); + void mainLoop(); + void exit(); + + inline static gfApplication* getInstance() { return g_gfApplication; } +}; +static_assert(sizeof(gfApplication) == 0x170, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive.h new file mode 100644 index 0000000000..7655f694bc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive.h @@ -0,0 +1,70 @@ +#pragma once + +#include +#include +#include +#include + +enum ARCNodeType { + Data_Type_None = 0x0, + Data_Type_Misc = 0x1, + Data_Type_Model = 0x2, + Data_Type_Tex = 0x3, + Data_Type_Anim = 0x4, + Data_Type_Scene = 0x5, + Data_Type_6 = 0x6, + Data_Type_Group = 0x7, + Data_Type_Effect = 0x8 +}; + +class gfArchiveFileHeader { + // TODO + u8 unk0[0x4]; + u16 unk4; +public: + void* getDataChunk(); +}; +// TODO size assertion + +class gfArchive { +public: + // 0 + gfArchive* m_prevArchive; + // 4 + gfArchive* m_nextArchive; + // 8 + char _spacer[0x1]; + bool unk9 : 1; + s16 m_refCount; // 0xA + u8 unkC[0x8]; + // 20 + void* m_Heap; + // 24 + char _spacer1[0x10]; + // 40 + char m_archiveFilePath[64]; + // 104 + int* m_entries; + // 108 + gfFileIOHandle* m_requestHandle; + // 112 + int m_returnStatus; + // 116 + char _spacer2[4]; + + // 120 + gfArchive(); + gfArchive(HeapType heap, int* unk1); + virtual void notify(int unk1, gfFileIORequest* unk2); + void* getData(ARCNodeType nodeType, int fileIndex, u16 archiveId); + void* getData(int groupID, ARCNodeType nodeType, int fileIndex, u16 archiveId); + void* getData(ARCNodeType nodeType, int fileIndex, int* nodeSize, u16 archiveId); + void* getData(int groupID, ARCNodeType nodeType, int fileIndex, int* nodeSize, u16 archiveId); + void setFileImage(void* data, int nodeSize, HeapType heapType); + void update(); + ~gfArchive(); + + // 124 + char _spacer3[4]; +}; +static_assert(sizeof(gfArchive) == 0x80, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_db.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_db.h new file mode 100644 index 0000000000..9ea11a30bb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_db.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct gfArchiveDatabaseEntry { + gfArchive* m_archive; + bool unk4_b7 : 1; + bool m_isOwner : 1; + bool m_isActive : 1; + gfArchiveDatabaseEntry* m_next; +}; +static_assert(sizeof(gfArchiveDatabaseEntry) == 0xC, "Class is the wrong size!"); + +class gfArchiveDatabase { + u16 m_capacity; + u16 m_size; + gfArchiveDatabaseEntry* m_entries; + gfArchiveDatabaseEntry m_rawData[]; // UBFIX: C99 flexible array member + + s32 findAvail() const { + for (s32 i = 0; i < m_capacity; i++) { + if (!m_entries[i].m_isActive) { + return i; + } + } + return -1; + } +public: + static gfArchiveDatabase* create(u32 size, Heaps::HeapType heap); + + void* operator new (size_t size, Heaps::HeapType heap, u32 count) { + return gfHeapManager::alloc(heap, + count * sizeof(gfArchiveDatabaseEntry) + size); + } + + gfArchiveDatabase(u32 cap) { + m_entries = m_rawData; + m_capacity = cap; + m_size = 0; + for (s32 i = 0; i < m_capacity; i++) { + gfArchiveDatabaseEntry* ep = &m_entries[i]; + ep->m_archive = nullptr; + ep->unk4_b7 = ep->m_isActive = false; + ep->m_isOwner = true; + ep->m_next = nullptr; + } + } + ~gfArchiveDatabase(); + s32 add(gfArchive* arc, bool makeOwner); + gfArchive* get(s32 i) const; +}; +static_assert(sizeof(gfArchiveDatabase) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_manager.h new file mode 100644 index 0000000000..0bc69c7995 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_archive_manager.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +class gfArchiveManager { + nw4r::ut::LinkList m_archives; + nw4r::ut::LinkList m_unused; +public: + gfArchiveManager() { } + void update(); + void pushback(gfArchive* arc); + void remove(gfArchive* arc); + static void create(); +}; +static_assert(sizeof(gfArchiveManager) == 0x18, "Class is the wrong size!"); + +extern gfArchiveManager* g_gfArchiveManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_area.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_area.h new file mode 100644 index 0000000000..265e20f634 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_area.h @@ -0,0 +1,77 @@ +#pragma once + +#include +#include +#include + +class gfArea { + +public: + enum ShapeType { + Shape_Rectangle = 0x0, + Shape_Circle = 0x1, + Shape_Triangle = 0x2, + }; + + enum Group { + Group_None = 0x0, + Group_Fighter = 0x1, + Fighter_Group_Body = 0x1, + Fighter_Group_Tread_Passive = 0x2, + Fighter_Group_Tread_Passive_No_Trigger = 0x3, + Fighter_Group_Item_Pickup = 0x4, + + Group_Enemy = 0x9, + Enemy_Group_Body = 0x9, + Enemy_Group_Tread_Passive = 0xA, + + Group_Item = 0x11, + Item_Group_Body = 0x11, + Item_Group_Pickup_Small = 0x12, + Item_Group_Pickup_Large = 0x13, + + Group_Stage = 0x15, + Stage_Group_Gimmick_Normal = 0x15, + Stage_Group_Gimmick_Ladder = 0x16, + Stage_Group_Gimmick_Elevator = 0x17, + + Stage_Group_Space_Normal = 0x19, + Stage_Group_Space_Wind = 0x1A, + Stage_Group_Space_Movement_Area = 0x1B, + Stage_Group_Space_Water = 0x1C, + + Group_Weapon = 0x1D, + Weapon_Group_Body = 0x1D, + Weapon_Group_Abnormal = 0x1E, + Weapon_Group_Spring = 0x1F, + }; + + char _0x0[8]; + int m_checkTargetGroup; + int m_checkTargetLocalGroup; + int m_id; + int m_teamId; + ShapeType m_shapeType; + char _0x1C[1]; + Group m_group : 8; + char _0x1E[2]; + Vec2f m_pos; + char _0x28[4]; + char _aaabBox[0x10]; + int m_ownerId; + char _0x40[4]; + + virtual bool testIntersectShape(void* unk); + virtual void debugDrawImp(); + virtual void notifyIntersect(int unk); + virtual void update(); + virtual bool testIncludePos(Vec2f* pos); +}; +static_assert(sizeof(gfArea) == 0x48, "Class is wrong size!"); + +class gfAreaEventReciver { +public: + virtual void reciveEvent(gfArea*, gfArea*); +}; + +typedef gfAreaEventReciver gfAreaEventReceiver; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_callback.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_callback.h new file mode 100644 index 0000000000..bd3e46e203 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_callback.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include + +class gfCallBack { +public: + gfCallBack* m_next; + + gfCallBack() : m_next(nullptr) { } + virtual void userProc() = 0; + virtual ~gfCallBack() { } +}; +static_assert(sizeof(gfCallBack) == 0x8, "Class is wrong size!"); + +class gfCallBackList { +public: + gfCallBack* m_head; + + gfCallBackList() : m_head(nullptr) { } + void add(gfCallBack* cb); + bool remove(gfCallBack* cb); + void process(); +}; +static_assert(sizeof(gfCallBackList) == 0x4, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera.h new file mode 100644 index 0000000000..712a2e389a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera.h @@ -0,0 +1,81 @@ +#pragma once + +#include +#include +#include + +class gfCamera { +public: + struct OrthoParam { + float m_top; + float m_bottom; + float m_left; + float m_right; + }; + + enum ProjectionType { + Projection_Orthogonal = 0x0, + Projection_Perspective = 0x1, + }; + + union TransformFlag { + u16 m_mask; + struct { + bool m_flag15 : 1; // 0x8000 + bool m_flag14 : 1; // 0x4000 + bool m_flag13 : 1; // 0x2000 + bool m_flag12 : 1; // 0x1000 + bool m_flag11 : 1; // 0x800 + bool m_flag10 : 1; // 0x400 + bool m_flag9 : 1; // 0x200 + bool m_flag8 : 1; // 0x100 + bool m_flag7 : 1; // 0x80 + bool m_rotate : 1; // 0x40 + bool m_flag5 : 1; // 0x20 + bool m_flag4 : 1; // 0x10 + bool m_flag3 : 1; // 0x8 + bool m_flag2 : 1; // 0x4 + bool m_flag1 : 1; // 0x2 + bool m_flag0 : 1; // 0x1 + }; + }; + + char _spacer[96]; + Vec3f m_targetPos; + Vec3f m_centerPos; + char _0x78[24]; + Vec3f m_0x90; + Vec3f m_0x9C; + char _0xA8[24]; + Vec3f m_rot; + float unkCC; + float unkD0; + char _0xD4[8]; + float m_near; + float m_far; + char _spacer2[4]; + OrthoParam m_orthoParam; + TransformFlag m_transformFlag; + TransformFlag unkFA; + + char _spacer3[4]; + ProjectionType m_projectionType; + char _spacer4[48]; + + void calc(); + void setGX(); + void calcProjection3Dto2D(Vec3f*, Vec2f*); + void renderDebug(); +}; +static_assert(sizeof(gfCamera) == 308, "Class is wrong size!"); + +class gfCameraManager { +public: + gfCamera m_cameras[6]; + char _spacer[8]; + + inline gfCamera* getCamera(u32 index) { return &m_cameras[index]; } + + static gfCameraManager* getManager(); +}; +static_assert(sizeof(gfCameraManager) == 0x740, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera_controller.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera_controller.h new file mode 100644 index 0000000000..f97af489e6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_camera_controller.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class gfCameraController { +protected: + gfCameraManager* m_cameraManager; + +public: + gfCameraController() : m_cameraManager(nullptr) { } + virtual void update(float) = 0; + virtual void draw(); +}; +static_assert(sizeof(gfCameraController) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_capture_util.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_capture_util.h new file mode 100644 index 0000000000..8b07390d1a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_capture_util.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include + +class gfJpegEncodeWork : public gfThread { + s32 unk340_1 : 8; + Heaps::HeapType unk340_2 : 8; + u16 unk342; + u16 unk344; + s32 unk348; + u32 unk34C; + s32 unk350; + u32 unk354; + u32 unk358; +public: + virtual void run(); +}; +static_assert(sizeof(gfJpegEncodeWork) == 0x360, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_copyefb.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_copyefb.h new file mode 100644 index 0000000000..fc3a1d5d85 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_copyefb.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include + +struct gfCopyEFB { + char _0[4]; + void* m_texBuffer; + u32 m_texBufferSize; + char _12[4]; + GXTexObj m_gxTexObj; + bool m_isValid; + char _49[3]; +}; +static_assert(sizeof(gfCopyEFB) == 52, "Class is wrong size!"); + +class gfCopyEFBMgr { +public: + gfCopyEFB m_copyEFBs[2]; + bool m_104; + char _105[3]; + int m_108; + + void createCopyEFB(int index, HeapType heapType); + void getEFB(int index); + void drawCopyEFB(int index, GXColor* color); + + bool isValid(int index); + GXTexObj* getCopyEFBTex(int index); + static gfCopyEFBMgr* getInstance(); +}; +static_assert(sizeof(gfCopyEFBMgr) == 112, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_decomp.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_decomp.h new file mode 100644 index 0000000000..f5f9d5b909 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_decomp.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include + +namespace CompressionAlgo { + enum Enum { + LZ = 0x10, + Huffman = 0x20, + RL = 0x30 + }; +} + +class gfDecomp { +public: + bool m_ready; + CompressionAlgo::Enum m_algo; + void* m_decompData; + u32 m_decompSize; + void* m_heapAddr; // +0x10 + CXUncompContext m_ctx; + + u8 unk18[0x1F0]; + + gfDecomp(void* heapAddr) : + m_ready(false), + m_decompData(nullptr), + m_decompSize(0), + m_heapAddr(heapAddr) { } + void decomp(const CXStream* src, u32 streamLen); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_draw.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_draw.h new file mode 100644 index 0000000000..f250ce4131 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_draw.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +void gfDrawResetLight(); +void gfDrawSetupCoord2D(); +void gfDrawSetVtxPosColorPrimEnvironment(); +void gfDrawSetVtxPosColorTexPrimEnvironment(); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_check.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_check.h new file mode 100644 index 0000000000..60909af7e3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_check.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include + +class gfErrorCheckCallback : public gfFileIO::ErrorCallback { + u16 unk8; +public: + virtual ~gfErrorCheckCallback() { } + virtual void userProc() { + u32 p1 = 4; + switch (static_cast(unk8)) { + case -4: + p1 = 5; + break; + case -9: + p1 = 6; + break; + case -11: + p1 = 7; + break; + default: + break; + } + gfErrorManager::getInstance()->notifyError(p1, 0); + } +}; +static_assert(sizeof(gfErrorCheckCallback) == 0xC, "Class is the wrong size!"); + +class gfErrorCheck { +public: + static void init(); + static void check(); +}; +static_assert(sizeof(gfErrorCheck) == 0x1, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_manager.h new file mode 100644 index 0000000000..21f1deaac1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_error_manager.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class gfErrorManager { +public: + bool m_isFatal : 1; + bool m_isSuspended : 1; // i.e., waiting for you to re-insert the disc + bool m_unused : 1; + bool m_isMoviePaused : 1; + s32 m_errorCode : 8; + s32 m_reasonCode; // A subcode for certain kinds of errors + nw4r::ut::Color m_msgBgColor; + nw4r::ut::Color m_msgTextColor; + void* m_fontData; + Message* m_msgScreen; + u32 m_updateDone; + + // UBFIX: This constructor does not initialize m_updateDone + gfErrorManager(); + void update(); + void renderPre(); + void render(); + void notifyError(u32 errorCode, u32 reasonCode); + void notifyErrorRecovery(bool skip); + + // Error codes relating to the disc being ejected are recoverable + bool isRecoverable(u32 code) const { + return (code == 1 || code == 2 || code == 3); + } + + void suspendGame(bool& statusChanged, u32 errCode) { + statusChanged = false; + if (m_isSuspended) { + if (m_isFatal) + return; + bool isFatal = !isRecoverable(errCode); + if (isFatal) + statusChanged = true; + } else { + if (mvMoviePlayer::getInstance()) { + m_isMoviePaused = mvMoviePlayer::getInstance()->isPause(); + if (!m_isMoviePaused) + mvMoviePlayer::getInstance()->setPause(); + } + if (g_sndSystem) + g_sndSystem->specialPause(); + if (g_gfHomeMenu) + g_gfHomeMenu->kill(); + statusChanged = true; + m_isSuspended = true; + g_gfPadSystem->pauseNotify(); + } + } + + static gfErrorManager* getInstance(); + static gfErrorManager* create(); +}; +static_assert(sizeof(gfErrorManager) == 0x1C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io.h new file mode 100644 index 0000000000..01b2db9392 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io.h @@ -0,0 +1,84 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class gfFileIO { +public: + typedef void (*MountStatusCB)(); + enum FS_TYPE { + MCS, + DVD, + NAND, + SD, + VF + }; + + class ErrorCallback : public gfCallBack { }; + + static int readFile(gfFileIORequest* request); + static int readDVDFile(gfFileIORequest* request); + static int readSDFile(gfFileIORequest* request); + static int readNANDFile(gfFileIORequest* request); + static int readVFFile(gfFileIORequest* request); + static int writeFile(gfFileIORequest* request); + static int writeSDFile(gfFileIORequest* request); + static int writeVFFile(gfFileIORequest* request); + static int writeNANDFile(gfFileIORequest* request); + static int writeNandCacheFile(gfFileIORequest* request); + static int writeNandCacheFileCRC(gfFileIORequest* request); + static int deleteFile(gfFileIORequest* request); + static int createDir(gfFileIORequest* request); + static int createDirNAND(gfFileIORequest* request); + static int createDirSD(gfFileIORequest* request); + static int createDirVF(gfFileIORequest* request); + static int createVFSystemFile(gfFileIORequest* request); + static int mountVFSystemFile(gfFileIORequest* request); + static int unmountVFSystemFile(gfFileIORequest* request); + static int formatVFSystemFile(gfFileIORequest* request); + static int mountSD(gfFileIORequest* request); + static int unmountSD(gfFileIORequest* request); + static int readDir(gfFileIORequest* request); + static int readDirNAND(gfFileIORequest* request); + static int readDirVFSub(gfFileIORequest* request); + static int checkFreeSize(gfFileIORequest* request); + static FS_TYPE checkFSType(const char* filepath); + static int checkFile(const char* filepath); + static int checkFile(gfFileIORequest* request); + static int checkFileNAND(gfFileIORequest* request); + static int checkFileSD(gfFileIORequest* request); + static int checkFileVF(gfFileIORequest* request); + static int checkDir(gfFileIORequest* request); + static int checkDirSD(gfFileIORequest* request); + static int checkDirVF(gfFileIORequest* request); + static int findfirstFile(gfFileIORequest* request); + static int findfirstSD(gfFileIORequest* request); + static int findfirstVF(gfFileIORequest* request); + static int findFileCount(gfFileIORequest* request); + static int copyToNANDCache(gfFileIORequest* request); + static int deleteFromNANDCache(gfFileIORequest* request); + static bool checkSDInserted(); + static bool checkSDWriteProtected(); + static void FAInsertCallback(); + static void FAEjectCallback(); + static const DVDDiskID* getDVDDiskId(); + static int getFileNumSD(gfFileIORequest* request); + static int getFileNumVF(gfFileIORequest* request); + static int getFileSize(const char* path); + static int getFindFirstFileSD(gfFileIORequest* request); + static int getFindFirstFileVF(gfFileIORequest* request); + static int gfFACreateDir(const char* filepath); + static int gfNandErrorCheck(unsigned int unk1); // TODO + static int gfNandSetTmpPath(unsigned int unk1, const char* filepath); + static int gfVFCreateDir(const char* filepath); + static void gfVFErrorCheck(); + static void initialize(); + static void server(); + static void setPermissionNANDFile(const char* request, unsigned int perms); + static void setFatalErrorCallback(ErrorCallback* cb); + static void setSDMountStatusCallback(MountStatusCB cb); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_handle.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_handle.h new file mode 100644 index 0000000000..3e29d41aff --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_handle.h @@ -0,0 +1,106 @@ +#pragma once + +#include +#include +#include +#include +#include + + +/* + * This class seems to be a helper wrapper around the gfFileIORequest. It handles the construction and + * submission of the request, but doesn't hold other data of its own as far as I can tell. It is used + * internally within gfArchive. + * +*/ +class gfFileIOHandle { +public: + // 0 + gfFileIORequest* m_request; + + // Stuff to check on the request once it has been started. + bool isReady() const; + int getReturnStatus() const; + void* getBuffer() const; + int getSize() const; + const void* getPool() const; + void release(); + bool cancelRequest(); + bool isCanceled() const; + bool isCancelRequested() const; + + // Asynchronous "request" methods. These will craft the gfFileIORequest for you and + // submit it to the gfFileIOManager. You are responsible for checking in on them as far as I can tell. + bool createDirRequest(const char* filepath); + bool checkDirRequest(const char* filepath); + bool checkFileRequest(const char* filepath); + bool checkFreeSize(const char* filepath); + + /* + * Some notes about read request behavior. + * - IMPORTANT: The addr parameter is actually the heap address. These read methods will *always* alloc your + * buffer for you, and I believe it is the caller's responsiblity to delete it. + * - I'm not sure why but readRequest would hang and not ever return the correct isReady(). + * I'm not sure if its because in my testing I was trying to read a file that I had just + * written, but I had no issues using readRequestNoSync. readRequestCached I did not test. + * - The read() method is a synchronous variant of readRequestNoCached with a thread sleep loop. Nice. + * - Setting length to 0 will read the whole file. + * - The lengths here are in bytes. + * - The lengths are a minimum length to read, not a maximum. If your file is too small, the read will + * fail. If you are worried about file size, I would probably use CheckFileSizeRequest or something along + * those lines. That's what the read() calls do internally. + * - Using a filepath like "sd:/foo/bar" works. + * - + */ + bool read(const char* filepath, HeapType heap, int offset); + bool read(const char* filepath, const void* addr, int offset); + bool read(const char* filepath, void* addr, int offset); + bool readRequest(const char* filename, HeapType heap, int length, int offset); + bool readRequest(const char* filepath, const void* addr, int length, int offset); + bool readRequest(const char* filepath, void* addr, int length, int offset); + bool readRequestCached(const char* filepath, HeapType heap, int length, int offset); + bool readRequestCached(const char* filepath, const void* addr, int length, int offset); + bool readRequestCached(const char* filepath, void* addr, int length, int offset); + bool readRequestNoSync(const char* filepath, HeapType heap, int length, int offset); + bool readRequestNoSync(const char* filepath, void* addr, int length, int offset); + bool findFileCountRequest(const char* filepath); + bool findfirstRequest(const char* filepath, HeapType heap); + bool del(const char* filepath); + + // The length is not allowed to be below 32 bytes. If the length is 0, it will create the + // file and write nothing. If the length is positive but below 32, it will write 32 bytes, + // potentially over-reading your buffer. + // + // It is also worth mentioning that "offset" is the offset of the file to append from, not the + // offset in the src buffer. + bool writeRequest(const char* filepath, void* addr, int length, int offset); + // filepath for writeNAND seems to be "/my/file/path". It seems to be used internally to load + // fighter misc data into NAND for some purpose. + bool writeNAND(void* addr, int length, const char* filepath); + + bool mountSD(); + bool unmountSD(); + + // the unknown param is often 0, and I suspect it's some kind of format specifier. + // it goes to 0x15 on the request. + bool mountVF(u8 unk, const char* filepath); + bool createVFSystemFile(const char* filepath, int length); + // another unknown parameter to the request's 0x15 + bool formatVF(int unk); + bool unmountVF(u8 unk); + gfFileIOHandle() : m_request(nullptr) { } + + ~gfFileIOHandle(); + + // the gfFileIONotify seems to be an abstract class. There is a gfArchiveNotify that seems to be used to tell + // a gfArchive that the operation is done. It seems like it's acting like a destructor and freeing a bunch of + // stuff. + void setNotify(void* gfFileIONotify); + + void ensureLoaded() { + if (!m_request) { + m_request = g_gfFileIOManager->allocRequest(); + } + } +}; +static_assert(sizeof(gfFileIOHandle) == 0x4, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_manager.h new file mode 100644 index 0000000000..69b140ca64 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_manager.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include +#include + +class gfFileIOManager { +public: + char _0x0[4]; + gfThread* m_thread; + gfFileIORequestQueue* m_queue1; + gfFileIORequestQueue* m_queue2; + char _0x10[0x88]; + bool unk98 : 1; + u8 unk99[0x3]; +public: + u32 getNumActiveRequests() { return m_queue1->getSize(); }; + + gfFileIORequest* allocRequest(); + bool freeRequest(gfFileIORequest* req); + void push(gfFileIORequest* req); +}; +static_assert(sizeof(gfFileIOManager) == 0x9c, "Wrong size for class!"); + +extern gfFileIOManager* g_gfFileIOManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_request.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_request.h new file mode 100644 index 0000000000..b3699137b3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_file_io_request.h @@ -0,0 +1,87 @@ +#pragma once + +#include +#include +#include +#include + +class gfFileIORequest { +public: + enum Kind { + Read = 0, + Write = 1, + Del = 2, + CreateDir = 3, + CreateVFSystemFile = 5, + MountVF = 6, + UnmountVF = 7, + FormatVF = 8, + MountSD = 9, + UnmountSD = 10, + CheckFreeSize = 12, + CheckFile = 13, + CheckDir = 14, + FindFirst = 15, + FindFileCount = 16, + WriteNAND = 20, + }; + + // 0x0 + char* m_pFilepath; + // 0x4 + int m_offset; + // 0x8 + int m_readLen; + // 0xC + void* m_dest; + // 0x10 + const void* m_heap; + // 0x14 + s32 m_returnStatus : 8; + // 0x15 -- seems to be either a format specifier or id used by the VF operations. + u8 m_vfUnk : 8; + + u8 unk16_b7 : 1; + bool m_isCached : 1; + u8 unk16_b5_0 : 6; + // Bits 3+4 are involved in whether or not handle->release() frees this request. + + u8 unk17_b7 : 1; + bool unk17_b6 : 1; + bool unk17_b5 : 1; + bool m_isCancelRequested : 1; + bool m_isCanceled : 1; + bool unk17_b2 : 1; + bool unk17_b1 : 1; + bool unk17_b0 : 1; + + // 0x18 + bool unk18_b7 : 1; + u8 unk18_b6 : 1; + bool unk18_b5 : 1; + bool unk18_b4 : 1; + Kind m_kind : 8; + s32 m_isReady : 8; + + // 0x1C + u16 m_crc16; + + // 0x20 + void* m_notifyCallback; + char m_filepath[128]; + + ~gfFileIORequest(); + void setParam(const char* filepath); + void setReadParam(const char* filepath, const void* addr, int length, int offset); + void setReadParam(const char* filepath, void* addr, int length, int offset); + void setWriteParam(const char* filepath, void* addr, int len, int offset); +}; + +class gfFileIORequestQueue { + OSMutex m_mtx; + utQueue* m_queue; +public: + u32 getSize() { return m_queue->size(); } + gfFileIORequestQueue(); +}; +static_assert(sizeof(gfFileIORequestQueue) == 0x1c, "Wrong size for class!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_game_application.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_game_application.h new file mode 100644 index 0000000000..55ba97806f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_game_application.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include +#include + +class gfGameApplication { +public: + char unk[0xD0]; + gfKeepFrameBuffer keepFB; + gfGameApplication(); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_gameframe_counter.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_gameframe_counter.h new file mode 100644 index 0000000000..d494a3f1ef --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_gameframe_counter.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +class gfGameFrameCounter { + u32 m_startFrame; + u32 m_latestStopFrame; + u32 m_stoppedFrames; + static const u32 ResetState = 0xFFFFFFFF; + +public: + void reset(); + void start(); + void stop(); + u32 getCounter() const; +}; +static_assert(sizeof(gfGameFrameCounter) == 0xC, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_heap_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_heap_manager.h new file mode 100644 index 0000000000..6fcfd9a79d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_heap_manager.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include +#include + +class gfHeapManager { +public: + static int getMaxFreeSize(Heaps::HeapType heapType); + static void dumpAll(); + static void dumpList(); + static void createHeap(int heapId, const char* heapName, int memArena, int heapSize); + + static void* alloc(Heaps::HeapType heapType, size_t size); + static void* alloc(Heaps::HeapType heapType, size_t size, s32 align); + static void free(void* ptr); + static MEMAllocator* getMEMAllocator(Heaps::HeapType heapType); + static void* getHeap(Heaps::HeapType heapType); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_homemenu.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_homemenu.h new file mode 100644 index 0000000000..9797272249 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_homemenu.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +class gfHomeMenu { +public: + bool setBan(u32 p1, u32 p2); + void kill(); + void start(); +}; +// TODO size assertion + +extern gfHomeMenu* g_gfHomeMenu; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_keep_fb.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_keep_fb.h new file mode 100644 index 0000000000..1cb3595d37 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_keep_fb.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +class gfKeepFrameBuffer { + bool m_isActive : 1; + bool m_needsUpdate : 1; +public: + void endKeepScreen(); + void startKeepScreen(); + void render(); + void update(); +}; +static_assert(sizeof(gfKeepFrameBuffer) == 1, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_pool.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_pool.h new file mode 100644 index 0000000000..48a391cc5c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_pool.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include + +class gfMemoryPool; + +struct HeapInfo { + const char* m_name; + gfMemoryPool* m_memoryPool; + u32 m_size; + u32 m_arena; +}; +extern HeapInfo g_HeapInfos[0x47]; + +class gfMemoryPool { +public: + u32 getMaxFreeBlockSize(); + + static void* alloc(void* heapAddr, size_t size, int align); + static gfMemoryPool* create(void* heapAddr, size_t size, const char* heapName); + + /** + * @brief Custom function to create a memory pool at a specific address + * + * @param heapAddr Start address of the memory pool + * @param heapName Name to assign the memory pool + * @param heapID ID of the memory pool + * @param size Size of the memory pool + * @param arena Whether this pool resides in MEM1 or MEM2 + */ + static gfMemoryPool* create(void* heapAddr, const char* heapName, int heapID, size_t size, int arena) + { + gfMemoryPool* pool = create(heapAddr, size, heapName); + g_HeapInfos[heapID].m_name = heapName; + g_HeapInfos[heapID].m_memoryPool = pool; + g_HeapInfos[heapID].m_size = size; + g_HeapInfos[heapID].m_arena = arena; + return pool; + } +}; // class gfMemoryPool diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_util.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_util.h new file mode 100644 index 0000000000..83091c14ea --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_memory_util.h @@ -0,0 +1,6 @@ +#pragma once + +#include +#include + +void gfMemFill(void* dest, u8 value, size_t count); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_model.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_model.h new file mode 100644 index 0000000000..fed8bdff62 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_model.h @@ -0,0 +1,222 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class gfModelAnimation { +public: + nw4r::g3d::ResFile m_resFile; + char _spacer[4]; + + nw4r::g3d::AnmObjVisRes* m_anmObjVisRes; + nw4r::g3d::AnmObjChrRes* m_anmObjChrRes; + nw4r::g3d::AnmObjTexPatRes* m_anmObjTexPatRes; + nw4r::g3d::AnmObjTexSrtRes* m_anmObjTexSrtRes; + nw4r::g3d::AnmObjMatClrRes* m_anmObjMatClrRes; + nw4r::g3d::AnmObjShpRes* m_anmObjShpRes; + + gfModelAnimation(nw4r::g3d::ResFile* resFile, nw4r::g3d::ResMdl* resMdl, bool doBind, u32 animIndex, HeapType heapType); + gfModelAnimation(nw4r::g3d::ResFile* resFile, nw4r::g3d::ResMdl* resMdl, bool doBind, const char* animName, HeapType heapType); + + u32 getFrameCount(); + float getFrame(); + void setFrame(float frame); + float getUpdateRate(); + void setUpdateRate(float updateRate); + void setLoop(bool shouldLoop); + void setLoopNode(bool shouldLoop); + void setLoopVisible(bool shouldLoop); + void setLoopTex(bool shouldLoop); + void setLoopTexSrt(bool shouldLoop); + void setLoopMatCol(bool shouldLoop); + void unbindNodeAnim(nw4r::g3d::ScnMdl* sceneModel); + void unbindVisibleAnim(nw4r::g3d::ScnMdl* sceneModel); + void unbindTexAnim(nw4r::g3d::ScnMdl* sceneModel); + void unbindTexSrtAnim(nw4r::g3d::ScnMdl* sceneModel); + void unbindMatColAnim(nw4r::g3d::ScnMdl* sceneModel); + void unbindShapeAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindNodeAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindVisibleAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindTexAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindTexSrtAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindMatColAnim(nw4r::g3d::ScnMdl* sceneModel); + void bindShapeAnim(nw4r::g3d::ScnMdl* sceneModel); + + static void unbind(nw4r::g3d::ScnMdl* sceneModel); + static void bind(nw4r::g3d::ScnMdl* sceneModel, gfModelAnimation* modelAnim); +}; +static_assert(sizeof(gfModelAnimation) == 32, "Class is wrong size!"); + +// Size: 32 + +//Various inlines used by menu objects effects, and many ground objects +//TODO: find better names for these functions +inline void setVisibilityAnim(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { +// if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) + int instanceSize; + nw4r::g3d::ResAnmVis anim = modelAnim->m_resFile.GetResAnmVis((u32)animId); + + MEMAllocator* allocator = gfHeapManager::getMEMAllocator(heap); + if (anim.IsValid()) + { + nw4r::g3d::AnmObjVisRes* anmObj = nw4r::g3d::AnmObjVisRes::Construct(allocator, &instanceSize, anim, model); + if (anmObj != NULL) + { + anmObj->Bind(model); + + if (modelAnim->m_anmObjVisRes != NULL) + { + modelAnim->m_anmObjVisRes->Destroy(); + } + + modelAnim->m_anmObjVisRes = anmObj; + } + } + // } +} + +inline void setVisibilityAnim2(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { + if (animId < modelAnim->m_resFile.GetResAnmVisNumEntries()) { + // int instanceSize; + setVisibilityAnim(animId,model, modelAnim, heap); + } +} + + +inline void setChrAnim(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { +// if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) + int instanceSize; + nw4r::g3d::ResAnmChr anim = modelAnim->m_resFile.GetResAnmChr((u32)animId); + + MEMAllocator* allocator = gfHeapManager::getMEMAllocator(heap); + if (anim.IsValid()) + { + nw4r::g3d::AnmObjChrRes* anmObj = nw4r::g3d::AnmObjChrRes::Construct(allocator, &instanceSize, anim, model, false); + if (anmObj != NULL) + { + anmObj->Bind(model); + + if (modelAnim->m_anmObjChrRes != NULL) + { + modelAnim->m_anmObjChrRes->Destroy(); + } + + modelAnim->m_anmObjChrRes = anmObj; + } + } + // } +} + +inline void setChrAnim2(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { + if (animId < modelAnim->m_resFile.GetResAnmChrNumEntries()) { + // int instanceSize; + setChrAnim(animId,model, modelAnim,heap); + } +} + + +inline void setTexPatAnim(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { +// if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) + int instanceSize; + nw4r::g3d::ResAnmTexPat anim = modelAnim->m_resFile.GetResAnmTexPat((u32)animId); + + if (anim.IsValid()) + { + MEMAllocator* allocator = gfHeapManager::getMEMAllocator(heap); + nw4r::g3d::AnmObjTexPatRes* anmObj = nw4r::g3d::AnmObjTexPatRes::Construct(allocator, &instanceSize, anim, model, false); + if (anmObj != NULL) + { + anmObj->Bind(model); + + if (modelAnim->m_anmObjTexPatRes != NULL) + { + modelAnim->m_anmObjTexPatRes->Destroy(); + } + + modelAnim->m_anmObjTexPatRes = anmObj; + } + } + // } +} + +inline void setTexPatAnim2(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { + if (animId < modelAnim->m_resFile.GetResAnmTexPatNumEntries()) { + // int instanceSize; + setTexPatAnim(animId,model, modelAnim,heap); + } +} + + +inline void setTexSortAnim(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { +// if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) + int instanceSize; + nw4r::g3d::ResAnmTexSrt anim = modelAnim->m_resFile.GetResAnmTexSrt((u32)animId); + + if (anim.IsValid()) + { + MEMAllocator* allocator = gfHeapManager::getMEMAllocator(heap); + nw4r::g3d::AnmObjTexSrtRes* anmObj = nw4r::g3d::AnmObjTexSrtRes::Construct(allocator, &instanceSize, anim, model, false); + if (anmObj != NULL) + { + anmObj->Bind(model); + + if (modelAnim->m_anmObjTexSrtRes != NULL) + { + modelAnim->m_anmObjTexSrtRes->Destroy(); + } + + modelAnim->m_anmObjTexSrtRes = anmObj; + } + } + // } +} + +inline void setTexSortAnim2(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { + if (animId < modelAnim->m_resFile.GetResAnmTexSrtNumEntries()) { + // int instanceSize; + setTexSortAnim(animId,model, modelAnim,heap); + } +} + + +inline void setColorAnim(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { +// if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) + int instanceSize; + nw4r::g3d::ResAnmClr anim = modelAnim->m_resFile.GetResAnmClr((u32)animId); + + //MEMAllocator* allocator = gfHeapManager::getMEMAllocator(Heaps::StageInstance); + if (anim.IsValid()) + { + MEMAllocator* allocator = gfHeapManager::getMEMAllocator(heap); + nw4r::g3d::AnmObjMatClrRes* anmObj = nw4r::g3d::AnmObjMatClrRes::Construct(allocator, &instanceSize, anim, model, false); + if (anmObj != NULL) + { + anmObj->Bind(model); + + if (modelAnim->m_anmObjMatClrRes != NULL) + { + modelAnim->m_anmObjMatClrRes->Destroy(); + } + + modelAnim->m_anmObjMatClrRes = anmObj; + } + } + // } +} + +inline void setColorAnim2(u8 animId,nw4r::g3d::ResMdl model, gfModelAnimation* modelAnim, Heaps::HeapType heap) { + if (animId < modelAnim->m_resFile.GetResAnmClrNumEntries()) { + // int instanceSize; + setColorAnim(animId,model, modelAnim,heap); + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_module.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_module.h new file mode 100644 index 0000000000..459eaa765d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_module.h @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include +#include + +// Documentation from Brawllib + +class gfModuleHeader : public OSModuleHeader { +public: + u32 getTextSectionAddr(); +}; + +class gfModule { +public: + gfModuleHeader* m_header; + void* m_bssAddr; + char m_flags; + + static gfModule* create(void* heap, void* buffer, size_t size); +}; + +class gfModuleInfo { +public: + gfModule* m_module; + int m_buffer; + int m_size; + char _12[4]; + void* m_heap; + gfFileIOHandle* m_fileHandle; + char _24; + char m_flags; + char m_moduleName; + char _30[33]; +}; +static_assert(sizeof(gfModuleInfo) == 60, "Class is wrong size!"); + +class gfModuleManager { + +public: + HeapType m_loadHeap; + void* m_loadHeapAddr; + gfModuleInfo m_moduleInfos[16]; + + struct LoadRequestResult { + void* _0; + }; + + void setTempolaryLoadHeap(HeapType heapType); + void destroy(const char* moduleName); + void loadModuleRequestOnImage(const char* moduleName, HeapType heapType, gfModuleHeader* moduleHeader, int* nodeSize); + bool isLoaded(const char* moduleName); + static void loadModuleRequest(LoadRequestResult*, gfModuleManager*, const char* moduleName, HeapType heapType, bool, bool); + + static gfModuleManager* getInstance(); +}; +static_assert(sizeof(gfModuleManager) == 968, "Class is wrong size!"); + +extern gfModuleManager* g_gfModuleManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_monitor.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_monitor.h new file mode 100644 index 0000000000..b17f94c331 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_monitor.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +// TODO: fields might be public and/or volatile +class gfMonitorThread : public gfThread { + u32 unk340; + u8 unk344[0x4]; + s64 m_lastDrawTime; + bool unk350_b7 : 1; + bool unk350_b6 : 1; +public: + virtual void run(); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_queue.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_queue.h new file mode 100644 index 0000000000..d9bf0ca495 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_queue.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include + +// A circular queue of arrays of NCols gfPadStatus objects +// with a capacity of NRows-1 +class gfPadStatusQueue { + static const s32 NRows = 4; + static const s32 NCols = 8; + + // Note: m_front and m_back are row selectors + u16 m_front; + u16 m_back; + gfPadStatus m_padStats[NRows][NCols]; + +public: + // BUG(?): This only calls init() on the left half of the m_padStats table + gfPadStatusQueue(); + // NOTE: This method does not clear the queue fully; it leaves the + // most recently pushed element. If the queue is already empty, however, + // then it's a no-op + void clear(); + void push(const gfPadStatus padStatus[NCols]); + bool pop(gfPadStatus output[NCols]); +}; +static_assert(sizeof(gfPadStatusQueue) == 0x804, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_status.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_status.h new file mode 100644 index 0000000000..af1c87d745 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_status.h @@ -0,0 +1,120 @@ +#pragma once + +#include +#include + +/* Masks for the bitfields for each button in gfPadButtons */ +#define GF_PAD_BUTTON_BIT_START 0x1000 +#define GF_PAD_BUTTON_BIT_Y 0x0800 +#define GF_PAD_BUTTON_BIT_X 0x0400 +#define GF_PAD_BUTTON_BIT_B 0x0200 +#define GF_PAD_BUTTON_BIT_A 0x0100 +#define GF_PAD_BUTTON_BIT_L 0x0040 +#define GF_PAD_BUTTON_BIT_R 0x0020 +#define GF_PAD_BUTTON_BIT_Z 0x0010 +#define GF_PAD_BUTTON_BIT_DPAD_UP 0x0008 +#define GF_PAD_BUTTON_BIT_DPAD_DOWN 0x0004 +#define GF_PAD_BUTTON_BIT_DPAD_RIGHT 0x0002 +#define GF_PAD_BUTTON_BIT_DPAD_LEFT 0x0001 + +namespace gfPadError { + ENUM_S8(PadError, + NONE = 0, + NO_CONTROLLER = -1, + NOT_READY = -2, + TRANSFER = -3 + ); +} + +namespace gfPadType { + enum PadType { + GCC = 0, + WII_CLASSIC = 1, + WIIMOTE = 2, + NUNCHUK = 3 + }; +} + +union gfPadButtons { + enum Buttons { + DLeft = 0x1, + DDown = 0x2, + DRight = 0x4, + DUp = 0x8, + Z = 0x10, + R = 0x20, + L = 0x40, + A = 0x100, + B = 0x200, + X = 0x400, + Y = 0x800, + Start = 0x1000, + }; + u32 bits; + struct { + u16 _padding; + u16 _0x0: 3; + u16 m_start: 1; + u16 m_y: 1; + u16 m_x: 1; + u16 m_b: 1; + u16 m_a: 1; + u16 _0x9: 1; + u16 m_l: 1; + u16 m_r: 1; + u16 m_z: 1; + u16 m_dpadUp: 1; + u16 m_dpadDown: 1; + u16 m_dpadRight: 1; + u16 m_dpadLeft: 1; + }; +}; + +struct gfPadStatus { + gfPadButtons m_buttonsCurrentFrame; // 0x0 + gfPadButtons m_buttonsCurrentFrame2; // 0x4 + gfPadButtons m_buttonsHeld; // 0x8 + gfPadButtons m_buttonsPressedThisFrame; // 0xC + gfPadButtons m_buttonsReleasedThisFrame; // 0x10 + gfPadButtons m_buttonsPressedThisFrame2; // 0x14 + + /* + * These floats all have to do with wiimote motion tracking. I can't be bothered + * at the moment to figure out precisely what values they correspond to, but + * they are always 0 if you are using a gamecube controller. + */ + float _0x18; + float _0x1c; + float _0x20; + float _0x24; + float _0x28; + float _0x2c; + + char m_stickX; + char m_stickY; + char m_subStickX; + char m_subStickY; + char m_lTriggerAnalog; + char m_rTriggerAnalog; + char _0x36; + + char _0x37; + gfPadError::PadError m_error; + char _0x39; + char _0x3a; + char _0x3b; + + gfPadType::PadType m_controllerType; + + void init(); + void clamp(); + void update(gfPadStatus* previousPad); + bool isButtonAOn(); + bool isButtonAOnEdge(); + bool isButtonAOnRepeat(); + bool isButtonStartOnEdge(); + + void convSysStatusToMenuStatus(gfPadStatus* destination); + +}; +static_assert(sizeof(gfPadStatus) == 0x40, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_system.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_system.h new file mode 100644 index 0000000000..8b3d70ac44 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_system.h @@ -0,0 +1,200 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define GF_PAD_SYSTEM_GET_ALL_PADS 0xF0 + +class gfPadSystem { +public: + gfPadSystem(); + void clearPadEdgeRepert(); + void clearPadQueue(); + void consumeFrameCounter(int frames); + static gfPadSystem* create(); + void createRumbleSystem(); + void disconectWiiControler(); + + u32 getGamePadQueueCount(); + + // of these 3, the sys pad variation is used extensively + // throughout brawl, anywhere in any of the menus. If you + // ask for padNum 0xF0, you'll get the merged pad instead. + void getDebugPadStatus(int padNum, gfPadStatus* dest); + void getSysPadStatus(int padNum, gfPadStatus* dest); + void getGamePadStatus(int padNum, gfPadStatus* dest); + + // This arg is &-ed with g_motorMask before applying. + // It also checks bit 6 of _0x35 before proceeding. + void maskMotor(u16); + + // These merge functions appear to be widely used for input that can come from any player, and + // are also used to internally to populate the 0x844+ gfPadStatus fields. + // The mask here lets you skip controllers based on the mask, so bit 1 being 0 means that player 1 will be skipped. + static void merge(gfPadStatus* src, int numPads, u32 mask, gfPadStatus* dest); + // Same as above with a mask of 0xFFFF. + static void merge(gfPadStatus* src, int numPads, gfPadStatus* dest); + + void pauseNotify(); + + // Runs 0x35 & 0x7F and passes all parameters to WPADReadGameData + u32 readGameDataRequest(int, int, int, int); + void setConnectCallback(int); + // This mask is saved to 0xb58 + void startMotor(int padNum, u16 mask); + void startMotor(int padNum); // Defaults mask to 0xFFFF + void stopMotor(int padNum); + void stopMotorH(int padNum); // seems identical to stopMotor. + void stopMotorAllForce(); + + void startSimpleSync(); // Runs 0x34 & 0xBF + + + // This is the function where the game pads at 0x444 get updated. Some observations: + // It is called by the IpSwitch which then uses it to record inputs + // or presumably do network buffering and other trickery. + // + // It seems to check bit 3 of 0x34 to determine whether to read from the + // sys pads or the pad queue. + // + // It sets bit 8 of 0x34 when it reads. + // + // It checks the player num bit of 0x3e before it reads. + // + // If 0x34 bit 1, it masks out the start button of every pad. + // + // If 0x3e bit 9, it zeroes the pad at 0x884 + void updateGame(); + + // Runs updateLowGc() and updateLowWii() + void updateLow(); + + // appears to read some masks and do some bookkeeping to 0x944 + // Reads up to 4 gc pads. + void updateLowGC(gfPadStatus* dest); + + // A lot more complex than updateLowWii, but similar concept. + // Reads up to 4 wiimotes. + void updateLowWii(gfPadStatus* dest); + + + // This is called at the top of the main game loop. + // + // Step 1: systemPads -> debugPads + // Step 2: debugPads -> menu conversion -> menuPads + // Step 3: Does some bookkeeping involving unknown data area 0x944 and unknown flags 0xb48 and 0xb49 + // Step 4: debugPads & ~m_sysExcludedPadMask -> sysPadsMerged + // Step 5: debugPads & m_debugPadMask -> debugPadsMerged + // Step 6: menuPads -> menuPadsMerged + // Step 7: Some motor control stuff. + void updateSystem(); + + // Sets 0xb6c to data and 0x35 bit 8 to 1 + void wpadGameDataCallback(int data); + // Unsure about the parameters to this. + void wpadSimpleSyncCallback(); + // Clears 0x35 bit 8, params are passed to WPADWriteGameData() + u32 writeGameDataRequest(int, int, int, int); + static void _alarmCallback(OSAlarm* alarm, OSContext* ctx); + + OSAlarm m_alarm; + + // mask stuff in here + // observed with 0x00000289 + char _0x30[0x4]; + + // option bitfield, observed with value 0x88. + u8 _0x34; + + // option bitfield, observed with value 0x4C + u8 _0x35; + + // 0x36, observed with value 0x0001 + short m_unkCounter; + + // 0x38, observed with value 0xFFFF + u16 m_debugPadMask; + + // 0x3A, observed with value 0x0000 + u16 m_sysExcludedPadMask; + + // 0x3C, Used in updateGamePads to determine which pads go to m_gamePadMerged. + // observed with value 0xFFFF + u16 m_gamePadMask; + + // Observed with value 0x0000 + u16 _0x3e; + + // 0x40 + gfPadStatus m_systemPads[8]; + + // 0x240 + gfPadStatusQueue* m_padQueue; + + // 0x244 + // It is unclear what the difference is between debug + // pads and game pads, but I speculate that it has to + // do with their devkit having separate controllers that + // handle their debug mode stuff. + gfPadStatus m_debugGcnPads[4]; + gfPadStatus m_debugWiiPads[4]; + + // 0x444 + // Seems to be the same as the debug pads, but with + // the start button permanently masked out. It might + // get updated at a different time in the frame as well. + gfPadStatus m_gameGcnPads[4]; + gfPadStatus m_gameWiiPads[4]; + + // 0x644 + // These go through some conversion in gfPadStatus::convSysStatusToMenuStatus + gfPadStatus m_menuGcnPads[4]; + gfPadStatus m_menuWiiPads[4]; + + // 0x844 + gfPadStatus m_sysPadMerged; + // 0x884 + gfPadStatus m_gamePadMerged; + // 0x8c4 + gfPadStatus m_menuPadMerged; + // 0x904 + gfPadStatus m_debugPadMerged; + + // 0x944 + // There's approximately 0x200 bytes of unknown structure that doesn't look + // like pad data until about 0xb50. After that there is the rumble motor at 0xb68; + char _0x944[0x200]; + + int _0xb44; + + // Clamped to 100 + u8 _0xb48; + // Clamped to 7 + u8 _0xb49; + + // 0xb4a, Unsure of what this does precisely, but it's + // used in a few rumble-related functions. + u16 m_motorMask; + + int _0xb4c[2]; + + // 0xb54, is a *gfThread + void* m_controllerThread; + + // 0xb58 + // set by startMotor() and stopMotor() per player. + u16 m_padMotorMasks[8]; + + // 0xb68 + gfRumble* m_gfRumble; + + // 0xb6c, set by wpadGameDataCallback + int m_gameData; + char _0xb70[8]; +}; +static_assert(sizeof(gfPadSystem) == 0xb78, "gfPadSystem is the wrong size!"); + +extern gfPadSystem* g_gfPadSystem; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_thread.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_thread.h new file mode 100644 index 0000000000..e15234c09f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_pad_thread.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class gfPadReadThread : public gfThread { + bool unk340; +public: + virtual void run(); +}; +static_assert(sizeof(gfPadReadThread) == 0x348, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_resource_loader.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_resource_loader.h new file mode 100644 index 0000000000..e2edfb8bc2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_resource_loader.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class gfResourceLoader { + gfFileIOHandle m_handle; + void* m_compressedRsrcPtr; + u32 m_allocSize; + u32 m_rsrcSize; + void* m_rsrcPtr; + HeapType m_heapTy; + gfArchive* m_archive; + bool m_isLoaded : 1; + bool m_doCachedRead : 1; + + void* load(HeapType heapTy, const char* path, gfArchive* archive, u32 size); + +public: + void* loadResource(HeapType heapTy, const char* path, gfArchive* archive, u32 freeSpaceToLeave); + void* loadResourceMemSizeOrder(HeapType heapTy, const char* path, gfArchive* archive, u32 size); + bool isLoaded(); + void freeResource(); + + gfResourceLoader() { + m_compressedRsrcPtr = nullptr; + m_allocSize = 0; + m_rsrcSize = 0; + m_rsrcPtr = nullptr; + m_isLoaded = false; + m_doCachedRead = true; + m_archive = nullptr; + m_heapTy = Heaps::Invalid; + } + ~gfResourceLoader() { freeResource(); } +}; +static_assert(sizeof(gfResourceLoader) == 0x20, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_rumble.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_rumble.h new file mode 100644 index 0000000000..902d46d446 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_rumble.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +struct gfRumble { + void lbSetRumble(s32, s32, s32, s32, s32); + void lbStopRumble(s32); + void HSD_PadRumbleRemove(s32); + void HSD_PadRumbleRemoveId(s32, s32, s32); + void HSD_PadRumbleRemoveMask(s32, u32); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_scene.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_scene.h new file mode 100644 index 0000000000..a4a3943d47 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_scene.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include + +class gfScene { +public: + const char* m_sceneName; + virtual void start() = 0; + virtual s32 process() = 0; + virtual s32 exit() = 0; + virtual void setModule() { } + + bool setLoadModule(const char* name, bool p2); + + gfScene(const char* name) : m_sceneName(name) { } +}; +static_assert(sizeof(gfScene) == 8, "Class is wrong size!"); + +class gfSequence { +public: + const char* m_sequenceName; + virtual void start(); + virtual void setNext(); + virtual void exit(); +}; +static_assert(sizeof(gfSequence) == 8, "Class is wrong size!"); + +class gfSceneManager { +public: + gfScene* m_prevScene; + gfScene* m_currentScene; + gfScene* m_nextScene; + gfSequence* m_prevSequence; + gfSequence* m_currentSequence; + gfSequence* m_nextSequence; + gfScene* m_scenes[100]; + gfSequence* m_sequences[50]; + int m_sceneCount; + int m_sequenceCount; + char _spacer3[8]; + int m_memoryLayout; // 0x280 + int unk1; + int processStep; + char _spacer4[148]; + + gfScene* searchScene(const char* sceneName); + static gfSceneManager* getInstance(); +}; +static_assert(sizeof(gfSceneManager) == 800, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_shutdown_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_shutdown_manager.h new file mode 100644 index 0000000000..335cc4f6a8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_shutdown_manager.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include + +class gfShutdownManager { +public: + bool unk0_b7 : 1; + bool m_reset : 1; + bool m_powerOff : 1; + bool m_returnToWiiMenu : 1; + bool unk0_b3 : 1; + s32 unk0 : 8; + gfCallBackList unk4; + gfReturnStatusCallbackList unk8; + bool unkC; + bool unkD; + + // BUG(?): this ctor doesn't initialize unk0_b3 + gfShutdownManager() : unk0_b7(true), m_reset(false), m_powerOff(false), + m_returnToWiiMenu(false), unk0(0), + unk4(), unk8(), unkC(false), unkD(true) { } + void initilize(); + static void ResetCallback(); + static void PowerOffCallback(); + void enterRestartProcess(); + void enterReturnToWiiMenuProcess(); + void update(); +}; +static_assert(sizeof(gfShutdownManager) == 0x10, "Class is the wrong size!"); + +extern gfShutdownManager g_gfShutdownManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_slow_manager.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_slow_manager.h new file mode 100644 index 0000000000..03a39fe20c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_slow_manager.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +struct gfSlowRequestId { + u8 m_id; +}; + +class gfSlowManager { + static const u32 StateInactive = 0; + static const u32 StateActive = 1; + struct SlowRequest { + u8 m_state : 8; + u8 m_slowRate; + }; + + static const u32 NRequests = 16; + SlowRequest m_reqs[NRequests]; +public: + static void reset(); + // Set the global slow rate to the highest rate requested + static void update(); + static gfSlowRequestId requestSlow(u8 rate); + static bool removeRequest(const u8& idx); + static u8 getSlowRate(); + static u8 getSlowRate(const u8& idx); + static float getQuickRate(); + static float getRealTimeRate(); +}; +// TODO: size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_system_callback.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_system_callback.h new file mode 100644 index 0000000000..f8c94512d1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_system_callback.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +class gfReturnStatusCallback { +public: + gfReturnStatusCallback* m_next; + virtual bool returnStatus() const = 0; +}; +static_assert(sizeof(gfReturnStatusCallback) == 0x8, "Class is the wrong size!"); + +class gfReturnStatusCallbackList { + gfReturnStatusCallback* m_head; +public: + gfReturnStatusCallbackList() : m_head(nullptr) { } + void add(gfReturnStatusCallback* node); + bool remove(gfReturnStatusCallback* node); + bool process() const; +}; +static_assert(sizeof(gfReturnStatusCallbackList) == 0x4, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task.h new file mode 100644 index 0000000000..80e4e2f4bc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task.h @@ -0,0 +1,127 @@ +#pragma once + +#include +#include +#include + +class gfTask { +public: + enum Category { + Category_None = 0x0, + Category_Enemy = 0x2, + Category_Ground = 0x6, + Category_GrCollision = 0x7, + Category_Menu = 0x8, + Category_Fighter = 0xA, + Category_Item = 0xB, + Category_Weapon = 0xC, + Category_Effect = 0xE, + Category_Info = 0x12, + Category_Camera = 0x15, + Category_Visual = 0x1F, + Category_Stage = 0x21, + Category_Physics = 0x23, + Category_AI = 0x24, + Category_CoinShooter = 0x25, + Category_Network = 0x26, + Category_SoCollision = 0x27, + }; + + enum Render { + Render_Pre, + Render_Opa, + Render_Xlu, + }; + + enum ProcessType { + Process_Default, + Process_Begin, + Process_Anim, + Process_Update, + Process_PreMapCorrection, + Process_MapCorrection, + Process_FixPosition, + Process_PreCollision, + Process_Collision, + Process_Catch, + Process_Hit, + Process_Camera, + Process_FixCamera, + Process_Effect, + Process_GameProc, + Process_End, + }; + + const char* m_taskName; + gfTask* m_prev; // TODO: suspend list and priority list prev? + gfTask* m_next; // TODO: suspend list and priority list next? + gfTask* m_0xC; // TODO: category list prev? + gfTask* m_0x10; // TODO: category list next? + gfTask* m_0x14; // TODO: unk31 list prev? + gfTask* m_0x18; // TODO: unk31 list next? + gfTask* m_connectedTask; + gfTask* m_attachedTask; + gfTask* m_nextTask; + u32 m_taskId; + u8 _0 : 1; + bool m_alive : 1; + bool unk2C_b5 : 1; + u8 _1: 1; + bool unk2C_b3 : 1; + bool unk2C_b2 : 1; + bool unk2C_b1 : 1; + bool unk2C_b0 : 1; + u32 _2 : 1; + s32 m_status : 8; + Category m_taskCategory : 8; + u32 _4 : 7; + u8 unk30; + u8 unk31; + u16 unk32; + u16 unk34; // Note: MSBit is 'isPaused' + gfCallBackList unk38; + + bool getFlag1() const { return unk2C_b1; } + bool getFlag2() const { return unk2C_b2; } + bool getFlag5() const { return unk2C_b5; } + bool isAlive() const { return m_alive; } + s32 getStatus() const { return m_status; } + void setStatus(s32 st) { m_status = st; } + + gfTask(const char* name, Category category, int unk2, int unk3, bool unk4); + virtual void processDefault(); + virtual void processBegin(); + virtual void processAnim(); + virtual void processUpdate(); + virtual void processPreMapCorrection(); + virtual void processMapCorrection(); + virtual void processFixPosition(); + virtual void processPreCollision(); + virtual void processCollision(); + virtual void processCatch(); + virtual void processHit(); + virtual void processCamera(); + virtual void processFixCamera(); + virtual void processEffect(); + virtual void processGameProc(); + virtual void processEnd(); + virtual void renderPre(); + virtual void renderOpa(); + virtual void renderXlu(); + virtual void processDebug(); + virtual void renderDebug(); + virtual void init(); + virtual ~gfTask(); + + void updateId(); + void process(ProcessType taskType); + void render(Render kind); + void setPaused(bool paused); + void link(bool p1); + void unlink(); + void exit(); + int getId(); + Category getCategory(); + static gfTask* getTask(int taskId); +}; +static_assert(sizeof(gfTask) == 0x40, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task_scheduler.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task_scheduler.h new file mode 100644 index 0000000000..14a0e6ab6b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_task_scheduler.h @@ -0,0 +1,91 @@ +#pragma once + +#include +#include +#include + +// TODO: Task priority request record? +struct UnkTaskRequest { + gfTask* m_task; + u32 m_taskId; + u8 m_priority; + gfTask::Category m_category : 8; + UnkTaskRequest(bool clear = true) { + if (clear) { + m_task = nullptr; + m_taskId = 0; + m_priority = 0; + m_category = gfTask::Category_None; + } + } +}; +static_assert(sizeof(UnkTaskRequest) == 0xC, "Class is the wrong size!"); + +class gfTaskScheduler { + static const s32 unk14Size = 17; + static const s32 unk58Size = 40; + static const s32 unkF8Size = 14; + + s32 unk0_1 : 8; + u32 unk0_2 : 8; + bool unk2_b7 : 1; + u32 unk2 : 15; + u16 m_numRegisteredTasks; + u16 unk6; + gfTask* unk8; + gfTask* unkC; + gfTask* unk10; + gfTask* unk14[unk14Size]; // grouped by priority? + gfTask* unk58[unk58Size]; // grouped by Category + gfTask* unkF8[unkF8Size]; // grouped by unk31 + gfTask* m_suspendList; + u8 unk134[0xC]; + u16 m_numPendingPrioUpdates; + UnkTaskRequest m_pendingPrioUpdates[0x4]; + u32 unk174; +public: + static gfTaskScheduler* create(); + static gfTaskScheduler* getInstance(); + void clear(); + void updateStatusPre(); + void process(bool p1); + void renderPre(); + void render(); + void updateStatus(); + void removeFromSuspendList(gfTask* task); + void unlinkProcessList(gfTask* task); + void unlink(gfTask* task); + void link(gfTask* task); + void registTask(gfTask* task); + bool isRegist(const gfTask* task) const; + gfTask* getTask(const char* name); + gfTask* getTask(u32 id); + gfTask* getTask(gfTask::Category ctgry, u32 pos); + gfTask* getTaskById(gfTask::Category ctgry, u32 id); + void setPauseCategory(gfTask::Category ctgry, bool isPaused); + void changeTaskPriorityRequest(u32 id, u8 priority); + + gfTaskScheduler() : + unk0_1(0), + unk0_2(0), + m_numRegisteredTasks(0), + unk6(0), + unk8(nullptr), + unkC(nullptr), + unk10(nullptr), + m_suspendList(nullptr) { + m_numPendingPrioUpdates = 0; + clear(); + } + + void unregistTask(gfTask* task) { + (void)task; + m_numRegisteredTasks--; + } + + s32 getUnk0_1() const { return unk0_1; } + void setUnk2_7() { unk2_b7 = true; } +}; +static_assert(sizeof(gfTaskScheduler) == 0x178, "Class is the wrong size!"); + +extern gfTaskScheduler* g_taskScheduler; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gf/gf_thread.h b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_thread.h new file mode 100644 index 0000000000..16f6144f77 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gf/gf_thread.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include +#include + +class gfRunnable { +public: + virtual void run() = 0; +}; +static_assert(sizeof(gfRunnable) == 0x4, "Class is the wrong size!"); + +class gfThread : public gfRunnable { +protected: + u8 unk4[0x4]; + OSThread m_thread; // 0x8 + u32 m_stackSize; // 0x320 + void* m_stackLow; // 0x324 + void* m_stackHi; // 0x328 + const char* m_name; + u32 m_priority; // 0x330 + u8 unk334[0x4]; + u16 m_flags; // 0x338 + gfRunnable* m_startRoutine; // 0x33C +public: + gfThread() { + createThread(this, 0x1F, 0x1000, Heaps::Thread); + } + virtual void run() { } + ~gfThread(); + void createThread(gfRunnable* startRoutine, u32 priority, u32 stackSize, Heaps::HeapType heap); + static void* startThread(void* arg); +}; +static_assert(sizeof(gfThread) == 0x340, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global.h new file mode 100644 index 0000000000..b4bab35487 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class GameGlobal { +public: + /* data */ + gmAppData* m_appData; // 0x00 + char _0[0x4]; // 0x04 + gmGlobalModeMelee* m_modeMelee; // 0x08 + char _1[0x04]; // 0x0C + gmSelCharData* m_selCharData; // 0x10 + gmSelStageData* m_selStageData; // 0x14 + gmResultInfo* m_resultInfo; // 0x18 + gmSetRule* m_setRule; // 0x1C + char _3[0x04]; // 0x20 + gmGlobalRecord* m_record; // 0x24 + gmGlobalRecord::NameData* m_nameRecords; // 0x28 + gmTournamentData* m_tournamentData; // 0x2C + gmAdvData* m_advData; // 0x30 + nteGlobalData* m_nteData; // 0x34 + char _4[0x04]; // 0x38 + gmGlobalCorps* m_corps; // 0x3C + gmStageEditData* m_stageEditData; // 0x40 + gmStageData* m_stageData; // 0x44 + char _6[0x8]; // 0x48 + + gmGlobalRecord::MenuData* getGlobalRecordMenuDatap(); + float getGameFrame() const; + void updateGameFrame(); + u32 getSlowRate() const; + void setSlowRate(u8 rate); + + static int getLanguage(); + static GameGlobal* getInstance(); +}; +static_assert(sizeof(GameGlobal) == 0x50, "Class is wrong size!"); + +extern GameGlobal* g_GameGlobal; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_corps.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_corps.h new file mode 100644 index 0000000000..5dcf18f2ca --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_corps.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +struct gmPlayerCorpsInitData { + gmCharacterKind m_characterKind : 8; // 0x00 + u8 m_costumeId; // 0x01 + s8 m_stockCount; // 0x02 + u8 m_cpuType; // 0x03 + s8 m_cpuRank; // 0x04 + char _1[0x03]; // 0x05 + float m_attackReactionMul; // 0x08 + float m_damageReactionMul; // 0x0C + float m_scale; // 0x10 + +}; +static_assert(sizeof(gmPlayerCorpsInitData) == 0x14, "Class is wrong size!"); + +class gmGlobalCorps { +public: + u8 _0; // 0x00 + s8 m_numFightersToBeat; // 0x01 + u8 _1; // 0x02 + s8 m_numFightersInCurrentStage; // 0x03 + char _2[0x19]; // 0x04 + s8 m_remainingFightersToBeat; // 0x1D + char _3[0x06]; // 0x1E + gmPlayerCorpsInitData m_playersInitData[0x24]; // 0x24 +}; +static_assert(sizeof(gmGlobalCorps) == 0x2f4, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_mode_melee.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_mode_melee.h new file mode 100644 index 0000000000..b9aac85619 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_mode_melee.h @@ -0,0 +1,417 @@ +#pragma once + +#include +#include +#include + +class gmItSwitch { +public: + enum Frequency { + Frequency_None = 0x0, + Frequency_Low = 0x1, + Frequency_Medium = 0x2, + Frequency_High = 0x3, + Frequency_VeryHigh = 0x4, // Custom + Frequency_Intense = 0x5, // Custom + Frequency_BombRain = 0x6 // Custom + }; + + struct ItemSwitch { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_cd : 1; + bool m_trophy : 1; + bool m_sticker : 1; + bool m_screwAttack : 1; + bool m_franklinBadge : 1; + bool m_teamHealer : 1; + bool m_soccerBall : 1; + bool m_unira : 1; + bool m_spring : 1; + bool m_bumper : 1; + bool m_bananaPeel : 1; + bool m_greenShell : 1; + bool m_mrSaturn : 1; + bool m_hothead : 1; + bool m_pitfall : 1; + bool m_smokeBall : 1; + bool m_freezie : 1; + bool m_dekuNut : 1; + bool m_smartBomb : 1; + bool m_gooeyBomb : 1; + bool m_motionSensorBomb : 1; + bool m_bobOmb : 1; + bool m_crackerLauncher : 1; + bool m_fireFlower : 1; + bool m_rayGun : 1; + bool m_superScope : 1; + bool m_goldenHammer : 1; + bool m_hammer : 1; + bool m_starRod : 1; + bool m_lipStick : 1; + bool m_fan : 1; + bool m_homeRunBat : 1; + bool m_beamSword : 1; + bool m_lightning : 1; + bool m_timer : 1; + bool m_superspicyCurry : 1; + bool m_bunnyHood : 1; + bool m_metalBox : 1; + bool m_starman : 1; + bool m_warpStar : 1; + bool m_poisonMushroom : 1; + bool m_superMushroom : 1; + bool m_dragoonParts : 1; + bool m_heartContainer : 1; + bool m_maximTomato : 1; + bool m_food : 1; + bool m_sandBag : 1; + bool m_blastBox : 1; + bool m_containers : 1; + bool m_pokeBall : 1; + bool m_assistTrophy : 1; + bool m_smashBall : 1; + }; + struct { // Custom + bool m_extra3 : 1; + bool m_extra2 : 1; + bool m_extra1 : 1; + bool m_containerPartyBall : 1; + bool m_containerRollingCrate : 1; + bool m_containerCrate : 1; + bool m_containerBarrel : 1; + bool m_containerCapsule : 1; + bool m_containersExplode : 1; + bool m_containersHaveEnemies : 1; + bool m_containersHaveItems : 1; + bool m_passiveAggression : 1; + bool m_mayhem : 1; + bool m_extra : 1; + bool m_stage : 1; + bool m_screwAttack : 1; + bool m_franklinBadge : 1; + bool m_teamHealer : 1; + bool m_soccerBall : 1; + bool m_unira : 1; + bool m_spring : 1; + bool m_bumper : 1; + bool m_bananaPeel : 1; + bool m_greenShell : 1; + bool m_mrSaturn : 1; + bool m_hothead : 1; + bool m_pitfall : 1; + bool m_smokeBall : 1; + bool m_freezie : 1; + bool m_dekuNut : 1; + bool m_smartBomb : 1; + bool m_gooeyBomb : 1; + bool m_motionSensorBomb : 1; + bool m_bobOmb : 1; + bool m_crackerLauncher : 1; + bool m_fireFlower : 1; + bool m_rayGun : 1; + bool m_superScope : 1; + bool m_goldenHammer : 1; + bool m_hammer : 1; + bool m_starRod : 1; + bool m_lipStick : 1; + bool m_fan : 1; + bool m_homeRunBat : 1; + bool m_beamSword : 1; + bool m_lightning : 1; + bool m_timer : 1; + bool m_superspicyCurry : 1; + bool m_bunnyHood : 1; + bool m_metalBox : 1; + bool m_starman : 1; + bool m_warpStar : 1; + bool m_poisonMushroom : 1; + bool m_superMushroom : 1; + bool m_dragoonParts : 1; + bool m_heartContainer : 1; + bool m_maximTomato : 1; + bool m_food : 1; + bool m_sandBag : 1; + bool m_blastBox : 1; + bool m_containers : 1; + bool m_pokeBall : 1; + bool m_assistTrophy : 1; + bool m_smashBall : 1; + } ex; + }; + } m_item; + + struct PokemonSwitch { + union { + struct { + bool : 1; + bool : 1; + bool m_bonsly : 1; + bool m_suicune : 1; + bool m_wobuffet : 1; + bool m_gardevoir : 1; + bool m_goldeen : 1; + bool m_togepi : 1; + bool m_piplup : 1; + bool m_meowth : 1; + bool m_mew : 1; + bool m_metagross : 1; + bool m_electrode : 1; + bool m_weavile : 1; + bool m_manaphy : 1; + bool m_lugia : 1; + bool m_latiasLatios : 1; + bool m_kyogre : 1; + bool m_bellosom : 1; + bool m_snorlax : 1; + bool m_jirachi : 1; + bool m_hoOh : 1; + bool m_staryu : 1; + bool m_gulpin : 1; + bool m_groudon : 1; + bool m_deoxys : 1; + bool m_munchlax : 1; + bool m_moltres : 1; + bool m_entei : 1; + bool m_chikorita : 1; + bool m_celebi : 1; + bool m_torchic : 1; + }; + struct { // Custom + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_bonsly : 1; + bool m_suicune : 1; + bool m_wobuffet : 1; + bool m_gardevoir : 1; + bool m_goldeen : 1; + bool m_togepi : 1; + bool m_piplup : 1; + bool m_meowth : 1; + bool m_metagross : 1; + bool m_electrode : 1; + bool m_weavile : 1; + bool m_manaphy : 1; + bool m_lugia : 1; + bool m_latiasLatios : 1; + bool m_kyogre : 1; + bool m_bellosom : 1; + bool m_snorlax : 1; + bool m_hoOh : 1; + bool m_staryu : 1; + bool m_gulpin : 1; + bool m_groudon : 1; + bool m_deoxys : 1; + bool m_munchlax : 1; + bool m_moltres : 1; + bool m_entei : 1; + bool m_chikorita : 1; + bool m_torchic : 1; + } ex; + }; + } m_pokemon; + + struct AssistSwitch { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_drWright : 1; + bool m_waluigi : 1; + bool m_tingle : 1; + bool m_infantryTank : 1; + bool m_starfy : 1; + bool m_shadow : 1; + bool m_saki : 1; + bool m_isaac : 1; + bool m_mrResetti : 1; + bool m_nintendog : 1; + bool m_metroid : 1; + bool m_littleMac : 1; + bool m_lyn : 1; + bool m_jillDozer : 1; + bool m_katAna : 1; + bool m_helirin : 1; + bool m_hammerBro : 1; + bool m_knuckleJoe : 1; + bool m_lakitu : 1; + bool m_jeff : 1; + bool m_excitebike : 1; + bool m_devil : 1; + bool m_samuraiGoroh : 1; + bool m_rayMKII : 1; + bool m_grayFox : 1; + bool m_barbara : 1; + bool m_andross : 1; + } m_assist; +}; +static_assert(sizeof(gmItSwitch) == 0x10, "Class is wrong size!"); + +class gmMeleeInitData { +public: + GameMode m_gameMode : 6; + char _0x0_0 : 2; + GameRule m_gameRule : 3; + u8 m_numPlayers : 3; + u8 m_0x1_0 : 2; + bool m_0x2_7 : 1; // 0x02 + bool m_0x2_6 : 1; + bool m_0x2_5 : 1; + bool m_0x2_4 : 1; + bool m_0x2_3 : 1; + bool m_0x2_2 : 1; + bool m_0x2_1 : 1; + bool m_isTeamAttack : 1; + bool m_0x3_7 : 1; // 0x03 + bool m_0x3_6 : 1; + bool m_isStamina : 1; + bool m_0x3_4 : 1; + bool m_allowPause : 1; + bool m_0x3_2 : 1; + bool m_hideDamageGauge : 1; + bool m_0x3_0 : 1; + bool m_scoreDisplay : 1; // 0x04 + bool m_0x4_6 : 1; + bool m_0x4_5 : 1; + bool m_0x4_4 : 1; + bool m_0x4_3 : 1; + bool m_0x4_2 : 1; + bool m_0x4_1 : 1; + bool m_0x4_0 : 1; + char _0x5[0x2]; // 0x05 + bool m_0x7_7 : 1; // 0x07 + bool m_0x7_6 : 1; + bool m_0x7_5 : 1; + bool m_0x7_4 : 1; + bool m_0x7_3 : 1; + bool m_0x7_2 : 1; + bool m_0x7_1 : 1; + bool m_isAmplifySongAttack : 1; + bool m_playeMode : 1; // 0x08 + u8 m_eventId : 7; // 0x08 + u8 m_scoreToWin; // custom + char _0xA[0x1]; // 0x0A + bool m_isTeams; // 0x0B + gmCorpsKind m_corpsKind : 8; // 0x0C + char _0xd[0x1]; // 0x09 + gmItSwitch::Frequency m_itemFrequency : 8; // 0x0E + s8 m_suicideScoreMultiplier; // 0x0F + char _0x10[0x02]; // 0x10 + srStageKind m_stageKind : 16; // 0x12 + u8 m_subStageKind; // 0x14 + char _0x15[0x3]; // 0x15 + s32 m_timeLimitFrames; // 0x18 + char _0x1c[0x5]; // 0x1C + bool m_isStaminaKnockback : 1; // custom + bool m_isStaminaDeadZoneWrap : 1; // custom + bool m_isHazardOff : 1; // custom + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + char _0x22[6]; + + gmItSwitch m_itSwitch; // 0x28 + char _0x38[0x08]; // 0x38 + float m_cameraShakeScale; // 0x40 + char _0x44[0x04]; // 0x44 + float m_gameSpeed; // 0x48 + char _0x4c[0x2C]; // 0x4C + short m_globalOffenseRatio; // 0x78 + short m_globalDefenseRatio; // 0x7A + char _0x7c[0x05]; // 0x7C + u8 m_0x81; // 0x81 + char _0x82[0x0E]; // 0x82 +}; +static_assert(sizeof(gmMeleeInitData) == 0x90, "Class is wrong size!"); + +class gmPlayerInitData { +public: + gmCharacterKind m_characterKind : 8; // 0x00 (Otherwise known as SlotID) + u8 m_state; // 0x01 + u8 m_playerId; // 0x02 + u8 m_playerNo; // 0x03 + s8 m_stockCount; // 0x04 + s8 m_colorFileNo; // 0x05 + s8 m_colorNo; // 0x06 + s8 m_controllerNo; // 0x07 + s8 m_startPointIdx; // 0x08 + char _0x9[0x02]; // 0x09 + s8 m_teamNo; // 0x0B + wchar_t m_name[5]; // 0x0c + char _0x16[2]; // 0x16 + u8 m_nameIndex; // 0x18 + char _0x17; +#ifdef MATCHING + bool m_isNoVoice; // 0x1A +#else + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_isNoVoice : 1; +#endif + bool : 1; // 0x1B + bool : 1; + bool : 1; + bool m_isMetal : 1; + bool : 1; + bool m_isSpycloak : 1; + bool : 1; + bool : 1; + bool m_isStamina : 1; // 0x1C + bool : 1; + bool : 1; + bool m_isRebirthXlu : 1; + bool m_isRabbitCap : 1; + bool m_isFlower : 1; + bool m_isCurry : 1; + bool m_isReflector : 1; + char _0x1D[1]; + u8 m_cpuType; // 0x1E + u8 m_cpuRank; // 0x1F + char _0x20[0x02]; // 0x20 + short m_startDamage; // 0x22 + short m_hitPointMax; // 0x24 + char _0x26[0x02]; // 0x26 + short m_glowAttack; // 0x28 + short m_glowDefense; // 0x2A + float m_attackRatio; // 0x2C + float m_damageRatio; // 0x30 + float m_attackReactionMul; // 0x34 + float m_damageReactionMul; // 0x38 + char _0x3C[0x04]; // 0x3C + float m_scale; // 0x40 + float m_visibilityScale; // 0x44 + float m_gravity; // 0x48 + char _0x4C[0x10]; // 0x4C +}; +static_assert(sizeof(gmPlayerInitData) == 0x5C, "Class is wrong size!"); + +class gmGlobalModeMelee { +public: + char _0[0x08]; // 0x00 + gmMeleeInitData m_meleeInitData; // 0x08 + gmPlayerInitData m_playersInitData[MAX_PLAYERS]; // 0x98 + char _1[4]; +}; +static_assert(sizeof(gmGlobalModeMelee) == 0x320, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_record.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_record.h new file mode 100644 index 0000000000..eb1bca43d9 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_global_record.h @@ -0,0 +1,282 @@ +#pragma once + +#include +#include +#include + +struct gmGlobalRecord { + + struct InfoAppFlagData { + enum State { + State_Locked = 0x0, + State_Unlocked = 0x1, + State_Received = 0x2, + State_UnlockedReceived = 0x3, + }; + + State m_unlocked75mStage : 2; + State m_unlockedLuigiMansionStage : 2; + State m_unlockedWolfFighter : 2; + State m_unlockedToonLinkFighter : 2; + State m_unlockedJigglypuffFighter : 2; + State m_unlockedSonicFighter : 2; + State m_unlockedMrGameAndWatchFighter : 2; + State m_unlockedGanondorfFighter : 2; + State m_unlockedROBFighter : 2; + State m_unlockedSnakeFighter : 2; + State m_unlockedLucarioFighter : 2; + State m_unlockedCaptainFalconFighter : 2; + State m_unlockedFalcoFighter : 2; + State m_unlockedLuigiFighter : 2; + State m_unlockedMarthFighter : 2; + State m_unlockedNessFighter : 2; + State m_encounteredCelebi : 2; + State m_encounteredMew : 2; + State m_unlockedRandomStageChoice : 2; + State m_unlockedAdditionalRules : 2; + State m_unlockedBossBattlesMode : 2; + State m_unlockedAllStarMode : 2; + State m_unlockedBigBlueStage : 2; + State m_unlockedPokemonStadiumStage : 2; + State m_unlockedGreenGreensStage : 2; + State m_unlockedJungleJapesStage : 2; + State m_unlockedFlatZone2Stage : 2; + State m_unlockedGreenHillZoneStage : 2; + State m_unlockedHanenbowStage : 2; + State m_unlockedMarioBrosStage : 2; + State m_unlockedSpearPillarStage : 2; + State m_unlockedPirateShipStage : 2; + State m_filledAllGWChronicleTitles : 2; + State m_unlockedSMWMasterpiece : 2; + State m_unlockedOOTMasterpiece : 2; + State m_unlockedSMB2Masterpiece : 2; + State m_unlockedFZeroMasterpiece : 2; + State m_unlockedDonkeyKongMasterpiece : 2; + State m_unlockedStageBuilderPartsC : 2; + State m_unlockedStageBuilderPartsB : 2; + State m_unlockedStageBuilderPartsA : 2; + State m_unlockedShadowAssist : 2; + State m_unlockedGrayFoxAssist : 2; + State m_unlockedBarbaraAssist : 2; + State m_unlockedInfantryAssist : 2; + State m_unlockedIsaacAssist : 2; + State m_unlockedCustomRoboAssist : 2; + State m_encounteredJirachi : 2; + State m_have400DifferentTrophies : 2; + State m_have300DifferentTrophies : 2; + State m_have200DifferentTrophies : 2; + State m_have100DifferentTrophies : 2; + State m_gotAllSubspaceBossTrophies : 2; + State m_gotAllSubspaceEnemyTrophies : 2; + State m_filledAllWiiChronicleTitles : 2; + State m_filledAllDSChronicleTitles : 2; + State m_filledAllGCNChronicleTitles : 2; + State m_filledAllGBAChronicleTitles : 2; + State m_filledAllN64ChronicleTitles : 2; + State m_filledAllVBChronicleTitles : 2; + State m_filledAllSNESChronicleTitles : 2; + State m_filledAllGBChronicleTitles : 2; + State m_empty : 2; + State m_filledAllNESChronicleTitles : 2; + State m_clearedAllStarAllFighters : 2; + State m_clearedAllStar : 2; + State m_clearedSubspace : 2; + State m_clearedClassicAllFighters : 2; + State m_clearedClassic : 2; + State m_have250Songs : 2; + State m_have200Songs : 2; + State m_have150Songs : 2; + State m_have100Songs : 2; + State m_have600DifferentStickers : 2; + State m_have500DifferentStickers : 2; + State m_have400DifferentStickers : 2; + State m_have300DifferentStickers : 2; + State m_have200DifferentStickers : 2; + State m_have100DifferentStickers : 2; + State m_have500DifferentTrophies : 2; + State m_cleared41SoloEvents : 2; + State m_cleared20SoloEvents : 2; + State m_clearedBossBattlesIntense : 2; + State m_clearedAllStarIntense : 2; + State m_clearedAllSubspaceStagesIntense : 2; + State m_clearedClassicIntenseOneStock : 2; + State m_clearedClassicIntense : 2; + State m_clearedTargetSmashLevel5AllFighters : 2; + State m_clearedTargetSmashLevel4AllFighters : 2; + State m_clearedTargetSmashLevel3AllFighters : 2; + State m_clearedTargetSmashLevel2AllFighters : 2; + State m_clearedTargetSmashLevel1AllFighters : 2; + State m_cleared15MinuteSmash : 2; + State m_cleared100ManSmash : 2; + State m_clearedBossBattlesAllFighters : 2; + State m_clearedBossBattles : 2; + State m_played10000Matches : 2; + State m_played1000Matches : 2; + State m_played100Matches : 2; + State m_gotAllOnlineFriendIcons : 2; + State m_filledAllChronicleTitles : 2; + State m_gotAllMasterpieces : 2; + State m_gotAllSongs : 2; + State m_gotAllStageBuilderParts : 2; + State m_gotAllStickers : 2; + State m_gotAllTrophies : 2; + State m_gotAllAssistTrophies : 2; + State m_gotAllSubspaceMovies : 2; + State m_gotAllStages : 2; + State m_gotAllFighters : 2; + State m_cleared21CoOpEvents : 2; + State m_cleared10CoOpEvents : 2; + }; + static_assert(sizeof(InfoAppFlagData) == 28, "Class is wrong size!"); + + struct EventHiScoreData { + u32 m_easyScores[51]; + u32 m_normalScores[51]; + u32 m_hardScores[51]; + }; + + struct MenuData { + + union StageSwitch { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_dxPStadium : 1; + bool m_dxZebes : 1; + bool m_dxBigBlue : 1; + bool m_dxCorneria : 1; + bool m_dxCruise : 1; + bool m_dxGreens : 1; + bool m_dxOnett : 1; + bool m_dxGarden : 1; + bool m_dxYorster : 1; + bool m_dxShrine : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_plankton : 1; + bool m_pictChat : 1; + bool m_greenHill : 1; + bool m_metalGear : 1; + bool m_village : 1; + bool m_newPork : 1; + bool m_famicom : 1; + bool m_palutena : 1; + bool m_earth : 1; + bool m_madein : 1; + bool m_emblem : 1; + bool m_gW : 1; + bool m_ice : 1; + bool m_fZero : 1; + bool m_tengan : 1; + bool m_stadium : 1; + bool m_starFox : 1; + bool m_halberd : 1; + bool m_crayon : 1; + bool m_orpheon : 1; + bool m_norfair : 1; + bool m_oldin : 1; + bool m_pirates : 1; + bool m_jungle : 1; + bool m_donkey : 1; + bool m_kart : 1; + bool m_marioPast : 1; + bool m_mansion : 1; + bool m_dolpic : 1; + bool m_final : 1; + bool m_battle : 1; + }; + struct { + u32 m_meleeMask; + u32 m_normalMask; + }; + }; + + u8 m_itemFrequency; + char _1[7]; + gmItSwitch::ItemSwitch m_itemSwitch; + char _16[10]; + u8 m_language; + char _27[5]; + StageSwitch m_stageSwitch; + + bool m_isWidescreen : 1; + bool m_41_6 : 1; + bool m_41_5 : 1; + bool m_41_4 : 1; + bool m_41_3 : 1; + bool m_41_2 : 1; + bool m_41_1 : 1; + bool m_41_0 : 1; + char _41[3]; + }; + + struct NameData { + char _0[0x124]; + }; + static_assert(sizeof(NameData) == 0x124, "Class is wrong size!"); + + char _0[28]; + + InfoAppFlagData m_infoAppFlagData; + + char _56[756]; + + EventHiScoreData m_eventHiScoreData[2]; + + char _2036[28]; + + MenuData m_menuData; // 2064 + + char _spacer[0x34B4]; +}; +static_assert(sizeof(gmGlobalRecord) == 0x3cf0, "Class is wrong size!"); + +struct nteGlobalData { + char _spacer[0x88]; // 0x00 +}; +static_assert(sizeof(nteGlobalData) == 0x88, "Class is wrong size!"); + + +struct gmAdvData { + + struct Record { + struct LevelClear { + u32 m_state; // 0x00 + s32 m_difficulty; // 0x04 + u32 m_unk1; // 0x08 + s32 m_percent; // 0x0C + u32 m_unk2; // 0x10 + }; + static_assert(sizeof(LevelClear) == 0x14, "Class is wrong size!"); + + char _0[0x04]; // 0x00 + LevelClear m_levelClears[34]; // 0x04 + char unk2AC[0x467C]; + u32 unk4928; + u32 unk492C; + }; + static_assert(sizeof(Record) == 0x4930, "Class is wrong size!"); + + Record m_record; + char unk4930[0x28]; +}; +static_assert(sizeof(gmAdvData) == 0x4958, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_lib.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_lib.h new file mode 100644 index 0000000000..201a39923f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_lib.h @@ -0,0 +1,244 @@ +#pragma once + +#include +#include + +#define MAX_PLAYERS 7 + +struct gmAppData { + char _0x0[0x30]; +}; +static_assert(sizeof(gmAppData) == 0x30, "Class is wrong size!"); + +bool gmCheckExistFigure(u16 id); + +enum GameMode { + Game_Mode_Melee = 0x0, + Game_Mode_Tournament = 0x1, + Game_Mode_Simple = 0x2, + Game_Mode_Simple_Target = 0x3, + Game_Mode_AllStar = 0x4, + Game_Mode_Rest = 0x5, + Game_Mode_Adventure = 0x6, + Game_Mode_Event = 0x7, + Game_Mode_Target = 0x8, + Game_Mode_Homerun = 0x9, + Game_Mode_Kumite = 0xA, + + Game_Mode_Training = 0xD, + Game_Mode_Net_Friend = 0xE, + Game_Mode_Net_Friend_Practice = 0xF, + Game_Mode_Net_Kumite = 0x10, + Game_Mode_Net_Kumite_Practice = 0x11, + Game_Mode_Net_Homerun = 0x12, + Game_Mode_Net_Homerun_Practice = 0x13, + + Game_Mode_Net_Watch = 0x17, + Game_Mode_Net_Okiraku = 0x18, + Game_Mode_Net_Okiraku_Practice = 0x19, + + Game_Mode_Net_Team = 0x1C, + Game_Mode_Net_Team_Practice = 0x1D, + + Game_Mode_Button = 0x1F, + Game_Mode_Result = 0x20, + Game_Mode_Demo = 0x21, + + +}; + +enum GameRule { + Game_Rule_Time = 0x0, + Game_Rule_Stock = 0x1, + Game_Rule_Coin = 0x2 +}; + +enum gmCorpsKind { + Corps_None = 0x0, + Corps_Target = 0x3, + Corps_Simple = 0x4, + Corps_Kumite_Man_10 = 0x5, + Corps_Kumite_Man_100 = 0x6, + Corps_Kumite_Minute_3 = 0x7, + Corps_Kumite_Minute_15 = 0x8, + Corps_Kumite_Endless = 0x9, + Corps_Kumite_Cruel = 0xA, +}; + +enum gmCharacterKind { + Character_Mario = 0x0, + Character_DonkeyKong = 0x1, Character_Donkey = 0x1, + Character_Link = 0x2, + Character_Samus = 0x3, + Character_ZeroSuitSamus = 0x4, Character_SZeroSuit = 0x4, + Character_Yoshi = 0x5, + Character_Kirby = 0x6, + Character_Fox = 0x7, + Character_Pikachu = 0x8, + Character_Luigi = 0x9, + Character_CaptainFalcon = 0xa, Character_Captain = 0xa, + Character_Ness = 0xb, + Character_Bowser = 0xc, Character_Koopa = 0xc, + Character_Peach = 0xd, + Character_Zelda = 0xe, + Character_Sheik = 0xf, + Character_IceClimbers = 0x10, Character_IceClimber = 0x10, + Character_IceClimbers_Popo = 0x11, Character_IceClimber_Popo = 0x11, + Character_IceClimbers_Nana = 0x12, Character_IceClimber_Nana = 0x12, + Character_Marth = 0x13, + Character_MrGameAndWatch = 0x14, Character_GameWatch = 0x14, + Character_Falco = 0x15, + Character_Ganondorf = 0x16, Character_Ganon = 0x16, + Character_Wario = 0x17, + Character_MetaKnight = 0x18, + Character_Pit = 0x19, + Character_Olimar = 0x1a, Character_Pikmin = 0x1a, + Character_Lucas = 0x1b, + Character_DiddyKong = 0x1c, Character_Diddy = 0x1c, + Character_PokeLizardon_Trainer = 0x1d, Character_Charizard_Trainer = 0x1d, + Character_PokeLizardon_Solo = 0x1e, Character_Charizard_Solo = 0x1e, + Character_PokeZenigame_Trainer = 0x1f, Character_Squirtle_Trainer = 0x1f, + Character_PokeZenigame_Solo = 0x20, Character_Squirtle_Solo = 0x20, + Character_PokeFushigisou_Trainer = 0x21, Character_Ivysaur_Trainer = 0x21, + Character_PokeFushigisou_Solo = 0x22, Character_Ivysaur_Solo = 0x22, + Character_KingDedede = 0x23, Character_Dedede = 0x23, + Character_Lucario = 0x24, + Character_Ike = 0x25, + Character_ROB = 0x26, Character_Robot = 0x26, + Character_Jigglypuff = 0x27, Character_Purin = 0x27, + Character_ToonLink = 0x28, + Character_Wolf = 0x29, + Character_Snake = 0x2a, + Character_Sonic = 0x2b, + Character_GigaBowser = 0x2c, Character_GKoopa = 0x2c, + Character_WarioMan = 0x2d, + Character_Alloy_Red = 0x2e, Character_Zako_Boy = 0x2e, + Character_Alloy_Blue = 0x2f, Character_Zako_Girl = 0x2f, + Character_Alloy_Yellow = 0x30, Character_Zako_Child = 0x30, + Character_Alloy_Green = 0x31, Character_Zako_Ball = 0x31, + Character_MarioD = 0x32, + Character_Boss_PeteyPiranha = 0x33, Character_Boss_BossPackun = 0x33, + Character_Boss_Rayquaza = 0x34, + Character_Boss_PorkyStatue = 0x35, + Character_Boss_Porky = 0x36, + Character_Boss_Galloem = 0x37, + Character_Boss_Ridley = 0x38, + Character_Boss_Duon = 0x39, + Character_Boss_MetaRidley = 0x3a, + Character_Boss_Tabuu = 0x3b, Character_Boss_Taboo = 0x3b, + Character_Boss_MasterHand = 0x3c, + Character_Boss_CrazyHand = 0x3d, + Character_SelectNone = 0x3e, + Character_PokemonTrainer = 0x48, Character_PokeTrainer = 0x48, + Character_SamusSZeroSuit = 0x49, + Character_ZeldaShiek = 0x4a, + Character_Invalid = 0xff, +}; + +namespace Stages { + enum srStageKind { + BattleField = 0x01, + Battle = 0x01, + FinalDestination = 0x02, + Final = 0x02, + DelfinoPlaza = 0x03, + Dolpic = 0x03, + LuigiMansion = 0x04, + Mansion = 0x04, + MushroomyKingdom = 0x05, + MarioPast = 0x05, + MarioCircuit = 0x06, + Kart = 0x06, + _75m = 0x07, + Donkey = 0x07, + RumbleFalls = 0x08, + Jungle = 0x08, + PirateShip = 0x09, + Pirates = 0x09, + Norfair = 0x0B, + FrigateOrpheon = 0x0C, + Orpheon = 0x0C, + YoshiIsland = 0x0D, + Crayon = 0x0D, + Halberd = 0x0E, + LylatCruise = 0x13, + StarFox = 0x13, + PokemonStadium2 = 0x14, + Stadium = 0x14, + SpearPillar = 0x15, + Tengan = 0x15, + PortTown = 0x16, + FZero = 0x16, + Summit = 0x17, + Ice = 0x17, + FlatZone2 = 0x18, + GW = 0x18, + CastleSiege = 0x19, + Emblem = 0x19, + WarioWare = 0x1C, + Madein = 0x1C, + DistantPlanet = 0x1D, + Earth = 0x1D, + Skyworld = 0x1E, + Palutena = 0x1E, + MarioBros = 0x1F, + Famicom = 0x1F, + NewPorkCity = 0x20, + NewPork = 0x20, + Smashville = 0x21, + Village = 0x21, + ShadowMoses = 0x22, + MetalGear = 0x22, + GreenHillZone = 0x23, + GreenHill = 0x23, + PictoChat = 0x24, + PictChat = 0x24, + Hanenbow = 0x25, + Plankton = 0x25, + Config = 0x26, + Result = 0x28, + Temple = 0x29, + DxShrine = 0x29, + YoshiIslandMelee = 0x2A, + DxYorster = 0x2A, + JungleJapes = 0x2B, + DxGarden = 0x2B, + Onett = 0x2C, + DxOnett = 0x2C, + GreenGreens = 0x2D, + DxGreens = 0x2D, + PokemonStadium = 0x2E, + DxPStadium = 0x2E, + RainbowCruise = 0x2F, + DxCruise = 0x2F, + Corneria = 0x30, + DxCorneria = 0x30, + BigBlue = 0x31, + DxBigBlue = 0x31, + Brinstar = 0x32, + DxZebes = 0x32, + BridgeOfEldin = 0x33, + Oldin = 0x33, + HomeRunContest = 0x34, + Homerun = 0x34, + Builder = 0x35, + Edit = 0x35, + RestArea = 0x36, + Heal = 0x36, + OnlineTraining = 0x37, + OTrain = 0x37, + TargetSmash = 0x38, + Target = 0x38, + TargetBreak = 0x38, + TBreak = 0x38, + CharacterRoll = 0x39, + CharaRoll = 0x39, + CRoll = 0x39, + Subspace = 0x3d, + Adventure = 0x3d, + BattleFieldS = 0x41, + BattleS = 0x41 + }; +}; // namespace Stages + +typedef Stages::srStageKind srStageKind; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_result_info.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_result_info.h new file mode 100644 index 0000000000..adab622373 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_result_info.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include + +struct gmPlayerResultInfo { + gmCharacterKind m_characterKind : 8; + u8 m_state; + s8 m_colorFileIdx; + char _3[3]; + u8 m_teamNo; + char _7[1]; + s16 m_hitPointMax; + u8 m_startStockCount; + char _11[1]; + s16 m_startDamage; + u8 m_rank; + char _15[1]; + u32 m_koCount; + u32 m_deadCount; + u16 m_suicideCount; + u16 m_playerBeatCounts[MAX_PLAYERS]; + u32 m_coins; + u32 m_pickupCoins; + u32 m_lostCoins; + char _26[548]; + int m_rankCount; + char _604[80]; +}; +static_assert(sizeof(gmPlayerResultInfo) == 684, "Class is wrong size!"); + +class gmResultInfo { +public: + enum DecisionKind { + Decision_Timeup = 0x1, + Decision_Win = 0x2, + Decision_Team_Win = 0x3, + Decision_Failure = 0x4, + Decision_Complete = 0x5, + Decision_Success = 0x6, + Decision_Event_Success = 0x7, + Decision_Event_Failure = 0x8, + Decision_NoContest = 0x9, + }; + + char _0[1]; + GameRule m_gameRule : 8; + bool m_isTeams; + char _4[0xc]; + u8 m_numWinners; + char _16[15]; + s8 m_winningPlayer; + char _32[4]; + gmPlayerResultInfo m_playersResultInfo[MAX_PLAYERS]; + char _4824[0xa0]; + DecisionKind m_decisionKind : 8; + char _0x1379[11]; + int m_framesElapsed; +}; +static_assert(sizeof(gmResultInfo) == 0x1388, "Class is wrong size!"); + +namespace static_checks { + +} // namespace static_checks diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_char_data.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_char_data.h new file mode 100644 index 0000000000..434134608f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_char_data.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +struct gmSelCharData { + char _spacer[0xb8]; // 0x00 + gmPlayerInitData m_playersInitData[MAX_PLAYERS]; + char _0x33c[4]; +}; +static_assert(sizeof(gmSelCharData) == 0x340, "Class is wrong size!"); + +namespace static_checks { + +} // namespace static_checks diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_stage_data.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_stage_data.h new file mode 100644 index 0000000000..9703b9deaa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_sel_stage_data.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include + +struct gmSelStageData { + char _0[34]; + srStageKind m_stageKind : 16; + u8 m_subStageKind; + char _37[771]; +}; +static_assert(sizeof(gmSelStageData) == 808, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_set_rule.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_set_rule.h new file mode 100644 index 0000000000..50da279d01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_set_rule.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +struct gmSetRule { + char _0[0x2]; + u8 _1 : 5; + GameRule m_rule : 3; + u8 m_timeMinutes; + u8 m_stockCount; + u8 m_handicap; + u8 m_damageRatio; // Multiplied by 10 + u8 m_stageChoice; + u8 m_stockTimeMinutes; + u8 m_isTeamAttack; + u8 m_allowPause; + u8 m_showScoreDisplay; + u8 m_showDamageGauge; + char _13[11]; + u8 m_spMeleeSetting1; // 0x18 + u8 m_spMeleeSetting2; // 0x19 + u8 m_spMeleeSetting3; // 0x1A + u8 m_spMeleeSetting4; // 0x1B + u8 m_spMeleeSetting5; // 0x1C + u8 m_spMeleeSetting6; // 0x1D + u8 m_spMeleeSetting7; // 0x1E + u8 m_spMeleeSetting8; // 0x1F + char _32[0x68]; // 0x20 +}; +static_assert(sizeof(gmSetRule) == 0x88, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_data.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_data.h new file mode 100644 index 0000000000..ba4448fbae --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_data.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include + +struct gmStageData { + struct ItemCollection { + u16 m_num; + short m_variations[256]; + u8 m_kinds[256]; + }; + + short m_exSetting; + char _2[2]; + float m_motionRatio; + float m_motionSubRatio; + ItemCollection m_itemCollection; + char _782[2310]; +}; +static_assert(sizeof(gmStageData) == 3092, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_edit_data.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_edit_data.h new file mode 100644 index 0000000000..0f75ab1895 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_stage_edit_data.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +struct gmStageEditData { + char _spacer[0x24e4]; // 0x00 +}; +static_assert(sizeof(gmStageEditData) == 0x24e4, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_syssave_task.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_syssave_task.h new file mode 100644 index 0000000000..a7280f4fc1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_syssave_task.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +class gmSysSave : public gfReturnStatusCallback { +public: + static gmSysSave* create(Heaps::HeapType heap); + virtual bool returnStatus() const; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gm/gm_tournament_data.h b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_tournament_data.h new file mode 100644 index 0000000000..94a039b5fe --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gm/gm_tournament_data.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +struct gmTournamentData { + char _spacer[0x510]; // 0x00 +}; +static_assert(sizeof(gmTournamentData) == 0x510, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision.h new file mode 100644 index 0000000000..477062018c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision.h @@ -0,0 +1,59 @@ +#pragma once + +#include +#include +#include +#include +#include + +class Stage; + +class grCollision { +public: + // 0 + short m_index; + // 2 + short m_vtxLen; + // 4 + short m_lineLen; + // 6 + short m_jointLen; + // 8 + grCollData* m_collData; + // 12 + grCollData::VtxData* m_vtxDatas; + // 16 + Vec2f* m_vtxPositions; + // 20 + grCollisionLine* m_lines; + // 24 + grCollisionJoint* m_joints; + // 28 + clAABBox2D m_aabBox; + // 44 + char _spacer[4]; + // 48 + void* m_next; + // 52 + void* m_prev; + // TOTAL_SIZE == 56 +public: + static grCollision* create(Stage* stage, void* colData, Ground* ground, int unk2); + grCollision(void* colData, int unk1, int unk2); + ~grCollision(); + + grCollisionJoint* getJoint(u16 nodeIndex); + grCollisionLine* getLine(u16 index); + void getSegment(clSegment2D* outSegment, grCollisionLine* line); + + +}; +static_assert(sizeof(grCollision) == 56, "Class is wrong size!"); + +// TODO: magic number 52 could be the size of a class +struct grCollisionList : public nw4r::ut::LinkList { + +}; +// TODO size assertion + +extern grCollisionList g_grCollisionList; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_data.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_data.h new file mode 100644 index 0000000000..e4a92e87fa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_data.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include + +class grCollData { +public: + struct VtxData { + Vec2f m_pos; + }; + + struct JointData { + char _spacer[0x4C]; + const char m_name[0x20]; // +0x4C + }; + + struct LineData { + short m_pointX; + short m_pointY; + char _spacer[12]; + }; + + u16 m_vtxLen; + short m_lineLen; + short m_jointLen; + short m_unk1; + VtxData* m_vtxDatas; + LineData* m_lineDatas; + JointData* m_jointDatas; + u8 unk14[0x14]; + + const char* getJointNodeName(u32 nodeIndex); +}; +static_assert(sizeof(grCollData) == 0x28, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_handle.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_handle.h new file mode 100644 index 0000000000..d52837ec64 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_handle.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +class grCollisionHandle { + u16* m_idPtr; + u16 m_id; + static const u32 InvalidID = 0x0000FFFFu; + // TODO more fields? +public: + grCollisionHandle(u16* idPtr); + bool isValid(); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_joint.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_joint.h new file mode 100644 index 0000000000..f15e3b5d73 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_joint.h @@ -0,0 +1,126 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class grCollision; +class Ground; + +class grCollisionJoint { +public: + // 0 + char _spacer[16]; + // 16 + clAABBox2D m_aabBox; + // 32 + char _spacer2[16]; + // 48 + grCollision* m_collision; + // 52 + grCollisionLine* m_lines; + // 56 + grCollData::VtxData* m_vtxDatas; + // 60 + char _spacer3[12]; + // 72 + bool m_0x48_31 : 1; + bool m_0x48_30 : 1; + bool m_0x48_29 : 1; + bool m_0x48_28 : 1; + bool m_0x48_27 : 1; + bool m_0x48_26 : 1; + bool m_0x48_25 : 1; + bool m_0x48_24 : 1; + bool m_0x48_23 : 1; + bool m_0x48_22 : 1; + bool m_0x48_21 : 1; + bool m_0x48_20 : 1; + bool m_0x48_19 : 1; + bool m_0x48_18 : 1; + bool m_0x48_17 : 1; + bool m_0x48_16 : 1; + bool m_0x48_15 : 1; + bool m_0x48_14 : 1; + bool m_0x48_13 : 1; + bool m_0x48_12 : 1; + bool m_0x48_11 : 1; + bool m_0x48_10 : 1; + bool m_0x48_9 : 1; + bool m_0x48_8 : 1; + bool m_0x48_7 : 1; + bool m_0x48_6 : 1; + bool m_0x48_5 : 1; + bool m_0x48_4 : 1; + bool m_0x48_3 : 1; + bool m_0x48_2 : 1; + bool m_0x48_1 : 1; + bool m_0x48_0 : 1; + + u16 m_vtxLen; + + u16 _0x4E; + + // 80 + u16 m_nodeIndex; + // 82 + union { + struct { + bool m_0x52_15 : 1; + bool m_rightLedgeDisabled : 1; + bool m_leftLedgeDisabled : 1; + bool m_0x52_12 : 1; + bool m_0x52_11 : 1; + bool m_0x52_10 : 1; + bool m_0x52_9 : 1; + bool m_0x52_8 : 1; + bool m_0x52_7 : 1; + bool m_0x52_6 : 1; + bool m_0x52_5 : 1; + bool m_0x52_4 : 1; + bool m_0x52_3 : 1; + bool m_0x52_2 : 1; + bool m_0x52_1 : 1; + bool m_0x52_0 : 1; + }; + u16 m_0x52; + }; + + // 84 + bool m_0x54_7 : 1; + bool m_0x54_6 : 1; + bool m_0x54_5 : 1; + bool m_0x54_4 : 1; + bool m_0x54_3 : 1; + bool m_0x54_2 : 1; + bool m_0x54_1 : 1; + bool m_0x54_0 : 1; + // 85 + bool m_0x55_7 : 1; + bool m_0x55_6 : 1; + bool m_0x55_5 : 1; + bool m_0x55_4 : 1; + bool m_0x55_3 : 1; + bool m_0x55_2 : 1; + bool m_0x55_1 : 1; + bool m_0x55_0 : 1; + // 86 + bool m_0x56_7 : 1; + bool m_0x56_6 : 1; + bool m_0x56_5 : 1; + bool m_0x56_4 : 1; + bool m_0x56_3 : 1; + bool m_0x56_2 : 1; + bool m_0x56_1 : 1; + bool m_0x56_0 : 1; + // 88 + Ground* m_ground; + // 92 + Matrix* m_matrix; + + grCollisionLine* getLine(u16 index); +}; +static_assert(sizeof(grCollisionJoint) == 96, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_line.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_line.h new file mode 100644 index 0000000000..f19c134a0e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_line.h @@ -0,0 +1,133 @@ +#pragma once + +#include +#include + +struct grCollisionLine { + enum MaterialType { + Material_None = 0x0, + Material_Rock = 0x1, + Material_Grass = 0x2, + Material_Soil = 0x3, + Material_Wood = 0x4, + Material_Iron = 0x5, + Material_NibuIron = 0x6, + Material_DullIron = 0x6, + Material_Carpet = 0x7, + Material_NumeNume = 0x8, + Material_Slimy = 0x8, + Material_Creature = 0x9, + Material_Asase = 0xA, + Material_Water = 0xA, + Material_Soft = 0xB, + Material_TuruTuru = 0xC, + Material_Slippery = 0xC, + Material_Snow = 0xD, + Material_Ice = 0xE, + Material_GameWatch = 0xF, + Material_Oil = 0x10, + Material_Danbouru = 0x11, + Material_Cardboard = 0x11, + Material_Damage1 = 0x12, + Material_Damage2 = 0x13, + Material_Damage3 = 0x14, + Material_Plankton = 0x15, + Material_Cloud = 0x16, + Material_Akuukan = 0x17, + Material_Subspace = 0x17, + Material_Brick = 0x18, + Material_NoAttr = 0x19, + Material_Famicom = 0x1A, + Material_Mario = 0x1A, + Material_Fence = 0x1B, + Material_WireNetting = 0x1B, + Material_Sand = 0x1C, + Material_HomeRun = 0x1D, + Material_Asase_Earth = 0x1E, + Material_Water_Earth = 0x1E, + }; + + typedef u32 CategoryMask; + static const CategoryMask CATEGORY_MASK_NONE = 0; + static const CategoryMask CATEGORY_MASK_FIGHTER = 1 << 0; + static const CategoryMask CATEGORY_MASK_ENEMY = CATEGORY_MASK_FIGHTER; + static const CategoryMask CATEGORY_MASK_DEFAULT = CATEGORY_MASK_FIGHTER; + static const CategoryMask CATEGORY_MASK_ITEM = 1 << 1; // Note: Item instances set a mask of CATEGORY_MASK_FIGHTER | CATEGORY_MASK_ITEM (see BaseItem::reset) + static const CategoryMask CATEGORY_MASK_OTHER = 1 << 2; + static const CategoryMask CATEGORY_MASK_POKETRAINER = CATEGORY_MASK_OTHER; // Note: PokeTrainer only on some stages (see ftPokeTrainerWanderingModule::start) + static const CategoryMask CATEGORY_MASK_ALL = CATEGORY_MASK_FIGHTER | CATEGORY_MASK_ITEM | CATEGORY_MASK_OTHER; + + // 0 + short m_point0Index; + // 2 + short m_point1Index; + // 4 + char _spacer[8]; + + union + { + struct + { + // 12 + u8 : 1; + u8 : 1; + + // 14 + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_isEdit : 1; + bool m_isCrush : 1; + bool m_isDive : 1; // for Bucculus + bool m_isTargetOther : 1; + bool m_isTargetItem : 1; + bool m_isTargetFighter : 1; + bool m_isRight : 1; + bool m_isLeft: 1; + bool m_isUpper : 1; + bool m_isUnder : 1; + }; + struct + { + // 12 + u8 : 1; + u8 : 1; + + // 14 + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; // for Bucculus + CategoryMask m_targetCategory : 3; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + }; + }; + + // 16 + bool m_noAttach : 1; + bool m_isHangL : 1; + bool m_isHangR : 1; + bool : 1; + bool m_isCloud : 1; + bool m_isRotating : 1; + bool : 1; + bool m_isThroughable : 1; + + // 17 + MaterialType m_materialType : 8; + + // 18 + char _pad[2]; +}; +static_assert(sizeof(grCollisionLine) == 20, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_linework.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_linework.h new file mode 100644 index 0000000000..a6aa392128 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_linework.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include + +class grCollision; + +class grCollisionLineWork { + // 0 + grCollisionLine* m_collisionLine; + // 4 + grCollisionJoint* m_collisionJoint; + // 8 + grCollision* m_collision; + // 12 + char _spacer[4]; +}; +static_assert(sizeof(grCollisionLineWork) == 16, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape.h new file mode 100644 index 0000000000..56bf7ea85e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape.h @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include +#include + +class grCollShape { +public: + virtual void init(); + virtual int getType() const; + virtual void getAABBox(clAABBox2D& aabBox); + virtual void setDownPos(const Vec2f& downPos); + virtual void setLeftPos(const Vec2f& leftPos); + virtual void setRightPos(const Vec2f& rightPos); + virtual void setCenterPos(const Vec2f& centerPos); + virtual void setTopPos(const Vec2f& topPos); + virtual Vec2f getCenterPos() const; + virtual Vec2f getDownPos() const; + virtual Vec2f getLeftPos() const; + virtual Vec2f getRightPos() const; + virtual Vec2f getTopPos() const; + virtual void move(const Vec2f& displacement); + virtual void set(grCollShape& collShape); + virtual float getHeight() const; + virtual float getWidth() const; + virtual void test(); + virtual void updateAABBox(); + virtual void setLR(const Vec2f& centerPos, const Vec2f& left, const Vec2f& right); + virtual void setUD(const Vec2f& centerPos, const Vec2f& up, const Vec2f& down); + virtual void setLR(const Vec2f& left, const Vec2f& right); + virtual void modifyDownY(float downY); + + static const float gUnk805a2a20; + static const float gUnk805a2a24; + static const float gUnk805a2a28; +}; +static_assert(sizeof(grCollShape) == 4, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_circle.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_circle.h new file mode 100644 index 0000000000..f3ec78fea7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_circle.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include + +class grCollShapeCircle : public grCollShape { + clCircle2D m_circle; +public: + virtual void init(); + virtual int getType() const; + virtual void getAABBox(clAABBox2D& aabBox); + virtual void setDownPos(const Vec2f& downPos); + virtual void setLeftPos(const Vec2f& leftPos); + virtual void setRightPos(const Vec2f& rightPos); + virtual void setCenterPos(const Vec2f& centerPos); + virtual void setTopPos(const Vec2f& topPos); + virtual Vec2f getCenterPos() const; + virtual Vec2f getDownPos() const; + virtual Vec2f getLeftPos() const; + virtual Vec2f getRightPos() const; + virtual Vec2f getTopPos() const; + virtual void move(const Vec2f& displacement); + virtual void set(grCollShape& collShape); + virtual float getHeight() const; + virtual float getWidth() const; + virtual void test(); + virtual void updateAABBox(); + virtual void setLR(const Vec2f& centerPos, const Vec2f& left, const Vec2f& right); + virtual void setUD(const Vec2f& centerPos, const Vec2f& up, const Vec2f& down); + virtual void setLR(const Vec2f& left, const Vec2f& right); + virtual void modifyDownY(float downY); +}; +static_assert(sizeof(grCollShapeCircle) == 16, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_rhombus.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_rhombus.h new file mode 100644 index 0000000000..c640bab9f4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_shape_rhombus.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include + +class grCollShapeRhombus : public grCollShape { + clRhombus2D m_rhombus; +public: + virtual void init(); + virtual int getType() const; + virtual void getAABBox(clAABBox2D& aabBox); + virtual void setDownPos(const Vec2f& downPos); + virtual void setLeftPos(const Vec2f& leftPos); + virtual void setRightPos(const Vec2f& rightPos); + virtual void setCenterPos(const Vec2f& centerPos); + virtual void setTopPos(const Vec2f& topPos); + virtual Vec2f getCenterPos() const; + virtual Vec2f getDownPos() const; + virtual Vec2f getLeftPos() const; + virtual Vec2f getRightPos() const; + virtual Vec2f getTopPos() const; + virtual void move(const Vec2f& displacement); + virtual void set(grCollShape& collShape); + virtual float getHeight() const; + virtual float getWidth() const; + virtual void test(); + virtual void updateAABBox(); + virtual void setLR(const Vec2f& centerPos, const Vec2f& left, const Vec2f& right); + virtual void setUD(const Vec2f& centerPos, const Vec2f& up, const Vec2f& down); + virtual void setLR(const Vec2f& left, const Vec2f& right); + virtual void modifyDownY(float downY); +}; +static_assert(sizeof(grCollShapeRhombus) == 60, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_status.h b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_status.h new file mode 100644 index 0000000000..d91d8f56d2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/collision/gr_collision_status.h @@ -0,0 +1,150 @@ +#pragma once + +#include +#include +#include +#include +#include + +class grCollStatus { +public: + + enum TracerType { + + }; + + enum Setting { + Setting_None = 0x0, + Setting_Ground = 0x1, + Setting_Air = 0x2, + Setting_Cliff = 0x3, + }; + + enum TouchId { + Touch_Up = 0x0, + Touch_Left = 0x1, + Touch_Right = 0x2, + Touch_Down = 0x3, + Touch_Up_Left = 0x4, + Touch_Up_Right = 0x5, + Touch_Down_Left = 0x6, + Touch_Down_Right = 0x7, + }; + typedef u8 TouchMask; + static const TouchMask TOUCH_MASK_NONE = 0x0; + static const TouchMask TOUCH_MASK_UP = 1 << Touch_Up; + static const TouchMask TOUCH_MASK_LEFT = 1 << Touch_Left; + static const TouchMask TOUCH_MASK_RIGHT = 1 << Touch_Right; + static const TouchMask TOUCH_MASK_DOWN = 1 << Touch_Down; + static const TouchMask TOUCH_MASK_UP_LEFT = 1 << Touch_Up_Left; + static const TouchMask TOUCH_MASK_UP_RIGHT = 1 << Touch_Up_Right; + static const TouchMask TOUCH_MASK_DOWN_LEFT = 1 << Touch_Down_Left; + static const TouchMask TOUCH_MASK_DOWN_RIGHT = 1 << Touch_Down_Right; + static const TouchMask TOUCH_MASK_ALL = TOUCH_MASK_UP | TOUCH_MASK_LEFT | TOUCH_MASK_RIGHT | TOUCH_MASK_DOWN | TOUCH_MASK_UP_LEFT | TOUCH_MASK_UP_RIGHT | TOUCH_MASK_DOWN_LEFT | TOUCH_MASK_DOWN_RIGHT; + + // 0 + grCollStatus* m_next; + // 4 + grCollStatus* m_prev; + // 8 + Setting m_setting : 8; + u32 m_0x8_0 : 24; + + char _spacer[2]; + // 14 + union { + struct { + u16 : 7; + bool m_noPassableCheck : 1; + u16 : 8; + }; + u16 m_exclusiveLineAttr; + }; + // 16 + int m_taskId; + // 20 + char _spacer2[65]; + // 85 + char m_cliffTeam; + // 86 + char _spacer3[6]; + // 92 + grCollShape* m_prevCollShape; + // 96 + grCollShape* m_currentCollShape; + // 100 + char _spacer4[10]; + // 110 + char m_targetLineCategory; + // 111 + char _spacer5[2]; + // 113 + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_isCalcLineMove : 1; + // 114 + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_isCloudThrough : 1; + // 115 + bool m_isCloudThroughOut : 1; + bool : 1; + bool m_isCorrectIgnoreSlope : 1; + TracerType m_tracerType : 1; + bool m_isEventToGround : 1; + bool : 1; + bool : 1; + bool : 1; + + char _116[1]; + + // 117 + + bool m_touchDown : 1; + bool m_touchUp : 1; + bool m_touchLeft : 1; + bool m_touchRight : 1; + bool m_touchUpRight : 1; + bool m_touchUpLeft : 1; + bool m_touchDownRight : 1; + bool m_touchDownLeft : 1; + + // 118 + char _spacer6[10]; + // 128 + grCollision* m_collision; + // 132 + Vec2f m_unk; + // 140 + Vec2f m_touchLineSpeed; + // 148 + char _spacer7[32]; + // 180 + Vec2f m_180[3]; + // 204 + char _spacer8[8]; + // 212 + grCollisionLineWork m_collLineWorkArray[19]; + // 516 + grCollShape m_collShape; + // 520 + char _spacer9[116]; + // TOTAL SIZE == 636 + void getPos(Vec2f*); +}; +static_assert(sizeof(grCollStatus) == 636, "Class is wrong size!"); + +class grCollStatusEventReceiver { +public: + virtual void receive(int, bool); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_calc_world_callback.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_calc_world_callback.h new file mode 100644 index 0000000000..585f7aa7c4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_calc_world_callback.h @@ -0,0 +1,71 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class grNodeCallbackData { +public: + int m_nodeIndex; + union { + struct { + int _pad : 25; + bool m_flag6 : 1; // & 0x40 + bool m_flag5 : 1; // & 0x20 + bool m_flag4 : 1; // & 0x10 + bool m_flag3 : 1; // & 8 + bool m_flag2 : 1; // & 4 + bool m_flag1 : 1; // & 2 + bool m_flag0 : 1; // & 1 + }; + u32 m_flags; + }; + + Vec3f m_pos; + Vec3f m_rot; + Vec3f m_scale; + Vec3f m_offsetPos; + Vec3f m_offsetRot; + Vec3f m_offsetScale; + Matrix m_matrix; +}; +static_assert(sizeof(grNodeCallbackData) == 128, "Class is wrong size!"); + +class grCalcWorldCallBack : public nw4r::g3d::ICalcWorldCallBack { + +public: + grNodeCallbackData* m_nodeCallbackDatas; + unsigned int m_numNodeCallbackData; + unsigned int m_index; + + virtual ~grCalcWorldCallBack(); + virtual void ExecCallbackA(int* unk1, int unk2, int* unk3); // TODO + virtual void ExecCallbackB(int* unk1, int unk2, int* unk3); // TODO + virtual void ExecCallbackC(); // TODO + virtual int initialize(bool unk1, HeapType heapType); + virtual int clearAll(); + + inline void setup(u32 numNodes, u32 flags, HeapType heapType = Heaps::StageInstance) { + m_numNodeCallbackData = numNodes; + this->initialize(0, heapType); + for (u32 i = 0; i < numNodes; i++) { + m_nodeCallbackDatas[i].m_flags |= flags; + + } + } + + inline void setup(u32 numNodes, const u32* flags, HeapType heapType = Heaps::StageInstance) { + m_numNodeCallbackData = numNodes; + this->initialize(0, heapType); + for (u32 i = 0; i < numNodes; i++) { + m_nodeCallbackDatas[i].m_flags |= flags[i]; + + } + } +}; +static_assert(sizeof(grCalcWorldCallBack) == 16, "Class is wrong size!"); + +// Size: 16 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick.h new file mode 100644 index 0000000000..bb63aab00e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick.h @@ -0,0 +1,475 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct grGimmickMotionPathData { + enum PathMode { + Path_Return = 0x0, + Path_Loop = 0x1, + Path_Once = 0x2, + }; + + float m_motionRatio; + char m_index; + PathMode m_pathMode : 8; + char m_mdlIndex; + char m_7; + + inline grGimmickMotionPathData() {} + inline grGimmickMotionPathData(float motionRatio, u8 index, PathMode pathMode, u8 mdlIndex, u8 unk) : m_motionRatio(motionRatio), m_index(index), m_pathMode(pathMode), m_mdlIndex(mdlIndex), m_7(unk) {} + inline grGimmickMotionPathData(float motionRatio, u8 index, PathMode pathMode, u8 mdlIndex) : m_motionRatio(motionRatio), m_index(index), m_pathMode(pathMode), m_mdlIndex(mdlIndex), m_7(0) {} + inline grGimmickMotionPathData(float motionRatio, u8 index, u8 mdlIndex, u8 unk) : m_motionRatio(motionRatio), m_index(index), m_pathMode(Path_Return), m_mdlIndex(mdlIndex), m_7(unk) {} + + inline void set(float motionRatio, u8 index, u8 mdlIndex, u8 unk) { + m_motionRatio = motionRatio; + m_index = index; + m_mdlIndex = mdlIndex; + m_7 = unk; + } + + inline void set(float motionRatio, u8 index, PathMode pathMode, u8 mdlIndex, u8 unk) { + m_motionRatio = motionRatio; + m_index = index; + m_pathMode = pathMode; + m_mdlIndex = mdlIndex; + m_7 = unk; + } +}; +static_assert(sizeof(grGimmickMotionPathData) == 8, "Class is wrong size!"); + + +class grGimmickMotionPathInfo; +class grGimmickMotionPath; + +class grVisibleProduction { + virtual ~grVisibleProduction(); + virtual void updateProduct(); + virtual void initialize(); + virtual void remove(); + virtual void setStart(); + virtual void productFlowStandby(); + virtual void productFlowStart(); + virtual void productFlowProducing(); + virtual void productFlowEnd(); + virtual void setEnable(bool enable); + virtual bool isEnable(); + virtual bool isFinished(); + virtual bool isStandby(); + virtual bool isExecuting(); + virtual bool isVisiblePermission(); + virtual void setForcedEnding(); + + int m_0x4; + float m_0x8; + bool m_enabled; + bool m_visiblePermission; + char _padding[2]; +}; + +class grGimmick : public Ground { + +public: + struct AttackData { + float m_damage; + Vec3f m_offsetPos; + float m_size; + int m_vector; + int m_reactionEffect; + int m_reactionFix; + int m_reactionAdd; + char _spacer[4]; + soCollisionAttackData::Attribute m_attribute; + bool m_isSetOffOn; + bool m_noSetOffThru; +#ifdef MATCHING + bool m_targetSituationAir; +#else + u32 : 6; + bool m_targetSituationODD : 1; + bool m_targetSituationAir : 1; +#endif + bool m_targetSituationGround; + float m_slipChance; // custom + float m_hitStopFrame; // custom + float m_hitStopDelay; // custom +#ifdef MATCHING + unsigned int m_serialHitFrame; +#else + bool m_isDirect : 1; + bool m_isInvalidInvincible : 1; + bool m_isInvalidXlu : 1; + soCollisionAttackData::LrCheck m_lrCheck : 3; + bool m_isCatch : 1; + bool m_noTeam : 1; + bool m_noHitStop : 1; + bool m_noEffect : 1; + bool m_noTransaction : 1; + soCollisionAttackData::Region m_region : 5; + unsigned int m_serialHitFrame : 16; +#endif + soCollisionAttackData::SoundLevel m_soundLevel; + soCollisionAttackData::SoundAttribute m_soundAttribute; + bool m_noScale; +#ifdef MATCHING + soCollision::ShapeType m_shapeType : 8; +#else + u8 : 6; + bool m_isDeath100 : 1; // custom + soCollision::ShapeType m_shapeType : 1; +#endif + char _spacer3[2]; + union { // custom + struct { + u16 m_noTargetCategory; + u16 m_noTargetPart; + }; + struct { + unsigned int _pad2 : 6; + bool m_noTargetCategoryFloor : 1; + bool m_noTargetCategoryItemE : 1; // Soccer Ball, Blast Box etc. + bool m_noTargetCategoryWall : 1; + bool m_noTargetCategoryGimmick : 1; + bool m_noTargetCategory5 : 1; + bool m_noTargetCategory4 : 1; + bool m_noTargetCategoryItem : 1; // Barrel, Crate etc. + bool m_noTargetCategory2 : 1; + bool m_noTargetCategoryEnemy : 1; + bool m_noTargetCategoryFighter : 1; + unsigned int _pad1 : 12; + bool m_noTargetPartLeg : 1; + bool m_noTargetPartKnee : 1; + bool m_noTargetPartArm : 1; + bool m_noTargetPartBody : 1; + }; + }; + + unsigned int m_nodeIndex; + int m_power; + + inline AttackData() {}; + + inline AttackData(Vec3f* offsetPos, float size, int vector, + int reactionEffect, int reactionFix, int reactionAdd, + soCollisionAttackData::Attribute attribute, bool isSetOffOn, bool noSetOffThru, + bool targetSituationAir, bool targetSituationGround, unsigned int serialHitFrame, + soCollisionAttackData::SoundLevel soundLevel, + soCollisionAttackData::SoundAttribute soundAttribute, bool noScale, + soCollision::ShapeType shapeType, unsigned int nodeIndex, int power) { + initialize(offsetPos, size, vector, reactionEffect, reactionFix, reactionAdd, attribute, isSetOffOn, + noSetOffThru, targetSituationAir, targetSituationGround, serialHitFrame, soundLevel, + soundAttribute, noScale, shapeType, nodeIndex, power); + + }; + + inline AttackData(float damage, + int reactionEffect, int reactionFix, int reactionAdd, + soCollisionAttackData::Attribute attribute, bool isSetOffOn, bool noSetOffThru, + bool targetSituationAir, unsigned int serialHitFrame, + soCollisionAttackData::SoundLevel soundLevel, + soCollisionAttackData::SoundAttribute soundAttribute, bool noScale, + bool targetSituationGround = true, int vector = 361) { + initialize(damage, reactionEffect, reactionFix, reactionAdd, attribute, isSetOffOn, noSetOffThru, + targetSituationAir, serialHitFrame, soundLevel, soundAttribute, noScale, targetSituationGround, + vector); + }; + + inline void initialize(Vec3f* offsetPos, float size, int vector, + int reactionEffect, int reactionFix, int reactionAdd, + soCollisionAttackData::Attribute attribute, bool isSetOffOn, bool noSetOffThru, + bool targetSituationAir, bool targetSituationGround, unsigned int serialHitFrame, + soCollisionAttackData::SoundLevel soundLevel, + soCollisionAttackData::SoundAttribute soundAttribute, bool noScale, + soCollision::ShapeType shapeType, unsigned int nodeIndex, int power) { + MEMINIT(this); + m_offsetPos = *offsetPos; + m_size = size; + m_vector = vector; + m_reactionEffect = reactionEffect; + m_reactionFix = reactionFix; + m_reactionAdd = reactionAdd; + m_attribute = attribute; + m_isSetOffOn = isSetOffOn; + m_noSetOffThru = noSetOffThru; + m_targetSituationAir = targetSituationAir; + m_targetSituationGround = targetSituationGround; + m_serialHitFrame = serialHitFrame; + m_soundLevel = soundLevel; + m_soundAttribute = soundAttribute; + m_noScale = noScale; + m_shapeType = shapeType; + m_nodeIndex = nodeIndex; + m_power = power; + }; + + inline void initialize(float damage, + int reactionEffect, int reactionFix, int reactionAdd, + soCollisionAttackData::Attribute attribute, bool isSetOffOn, bool noSetOffThru, + bool targetSituationAir, unsigned int serialHitFrame, + soCollisionAttackData::SoundLevel soundLevel, + soCollisionAttackData::SoundAttribute soundAttribute, bool noScale, + bool targetSituationGround = true, int vector = 361) { + MEMINIT(this); + m_damage = damage; + m_reactionEffect = reactionEffect; + m_reactionFix = reactionFix; + m_reactionAdd = reactionAdd; + m_attribute = attribute; + m_isSetOffOn = isSetOffOn; + m_noSetOffThru = noSetOffThru; + m_targetSituationAir = targetSituationAir; + m_serialHitFrame = serialHitFrame; + m_soundLevel = soundLevel; + m_soundAttribute = soundAttribute; + m_noScale = noScale; + + m_targetSituationGround = targetSituationGround; + m_vector = vector; + }; + }; + static_assert(sizeof(AttackData) == 88, "Class is wrong size!"); + + struct HitData { + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + float m_size; + u8 m_nodeIndex; + char _29[3]; + }; + static_assert(sizeof(HitData) == 32, "Class is wrong size!"); + + struct AttackDetails { + union { + soCollision::CategoryMask m_targetCategory; + struct { + unsigned int _pad : 22; + bool m_targetCategoryFloor : 1; + bool m_targetCategoryItemE : 1; // Soccer Ball, Blast Box etc. + bool m_targetCategoryWall : 1; + bool m_targetCategoryGimmick : 1; + bool m_targetCategory5 : 1; + bool m_targetCategory4 : 1; + bool m_targetCategoryItem : 1; // Barrel, Crate etc. + bool m_targetCategory2 : 1; + bool m_targetCategoryEnemy : 1; + bool m_targetCategoryFighter : 1; + }; + }; + char m_unk1; + bool m_targetSituationODD; + char _spacer[2]; + soCollisionAttackData::LrCheck m_lrCheck; + float m_hitStopFrame; + }; + static_assert(sizeof(AttackDetails) == 16, "Class is wrong size!"); + + struct SimpleEffectData { + int m_id; + short m_repeatFrame; + short m_nodeIndex; + short m_endFrame; + short m_0xc; + }; + + struct Effect_Info { + enum State { + State_Inactive = 0x0, + State_Start = 0x1, + State_Active = 0x2, + }; + + State m_state : 16; + short m_0x2; + float m_framesActive; + int m_handleId; + int m_id; + u32 m_repeatFrame; + u32 m_endFrame; + short m_nodeIndex; + short m_generatorIndex; + Vec2f m_offsetPos; + float m_scale; + + inline void set(SndID sndId, u32 repeatFrame, short nodeIndex, u32 endFrame, Vec2f offsetPos) { + m_id = sndId; + m_repeatFrame = repeatFrame; + m_nodeIndex = nodeIndex; + m_endFrame = endFrame; + m_offsetPos = offsetPos; + } + + inline void set(EfID efId, u32 repeatFrame, short nodeIndex, u32 endFrame, Vec2f offsetPos, float scale) { + m_id = efId; + m_repeatFrame = repeatFrame; + m_nodeIndex = nodeIndex; + m_endFrame = endFrame; + m_offsetPos = offsetPos; + m_scale = scale; + } + }; + + // 5C + int m_soundGeneratorNum; + // 60 + snd3DGenerator* m_soundGenerators; + // 64 + int m_soundEffectNum; + // 68 + Effect_Info* m_soundEffects; + // 6C + int m_effectNum; + // 70 + Effect_Info* m_effects; + // 74 + char _spacer6[8]; + // 7C + void* m_gimmickData; + // 80 + u32 m_unk1; + // 84 + int m_nodeIndex; + // 88 + bool m_isUpdate; + // 89 + char unk3[3]; + // 8C + grGimmickMotionPath* m_gimmickMotionPath; + // 90 + grCalcWorldCallBack m_calcWorldCallBack; + // A0 + union { + struct { + u8 m_motionPathFlagPadding : 6; + bool m_isMotionPathRotate : 1; + bool m_isMotionPathTranslate : 1; + }; + u8 m_motionPathFlags; + }; + + // A1 + bool m_transparencyFlag; + // A2 + char _spacer7[2]; + // A4 + union { + struct { + u32 m_transparencySettingPadding : 27; + bool m_transparencySetting4 : 1; + bool m_transparencySetting3 : 1; + bool m_transparencySetting2 : 1; + bool m_transparencySetting1 : 1; + bool m_transparencySetting0 : 1; + }; + u32 m_transparencySettings; + }; + // A8 + char _spacer8[20]; + // BC + grVisibleProduction* m_visibleProductions[4]; + // CC + char _spacer9[0x40]; + + grGimmick(const char* taskName); + + virtual void processUpdate(); + virtual void renderDebug(); + virtual void update(float deltaFrame); + virtual void bindData(gfArchive* data); + virtual void setVisibilityAttachedEffect(u32 unk1); + virtual bool setNode(); + virtual void setMotionRatio(float ratio); + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual ~grGimmick(); + + virtual void invalidatedByCameraClipping(); + virtual void setTransparencyFlag(char flag); + virtual void updateCallback(u32 index); + virtual void fixedPosition(float unk1); + virtual void setTgtNode(const char* unk1); + virtual char* getTgtNode(); + virtual void setGimmickData(void* gimmickData) { m_gimmickData = gimmickData; } + virtual void* getGimmickData() { return m_gimmickData; } + virtual void changeNodeAnim(u32 chrIndex, u32 modelAnimIndex); + virtual void createFadeVisibleProduction(float unk); + virtual void createSoundEffectVisibleProductionForExcel(u32 unk1, u32 unk2, u32 unk3); + virtual void createEffectVisibleProductionForExcel(SimpleEffectData* simpleEffectData, u32* visProdIndexPtr, grVisibleProduction* visProds[]); + virtual void setSimpleEffectVisibleProduction(); // TODO + virtual void dbDispInvalidatedByCameraClippingSphere(); // TODO + virtual void setTransparency(u32 unk1, u32 unk2); + virtual u8 getTransparencyFlag() { return m_transparencyFlag; } + + void changeMatColAnim(u32 clrIndex, u32 modelAnimIndex); + void changeShapeAnim(u32 shpIndex, u32 modelAnimIndex); + void changeTexAnim(u32 patIndex, u32 modelAnimIndex); + void changeTexSrtAnim(u32 srtIndex, u32 modelAnimIndex); + void changeVisibleAnim(u32 visIndex, u32 modelAnimIndex); + void createAttachMotionPath(grGimmickMotionPathInfo* motionPathInfo, stTriggerData* triggerData, const char* nodeName); + void createEffectWork(int numEffects); + void createIsValidTrigger(stTriggerData* triggerData); + void createSimpleEffectData(SimpleEffectData* simpleEffectData, int effectId, const char* nodeName); + void createSoundWork(u32 unk1, u32 unk2); + u32 getMaterialColor(int* unk1, const char* unk2, u32* sceneModelIndex); + u32 getMaterialTevColor(int* unk1, const char* unk2, u32* sceneModelIndex); + void getMatrix(Matrix* matrix); + void makeCalcuCallback(u32 numCallbackData, HeapType heapType); + void setAttachPathdataFrame(float frame); + void setCalcuCallbackRoot(u32 unk1); + void setMaterialAlpha(const char* unk1, u32 unk2); + void setMaterialColor(u32* unk1, const char* unk2, u32* unk3, u32* sceneModelIndex); + void setMaterialTevColor(u32* unk1, const char* unk2, u32* unk3, u32* sceneModelIndex); + void setMatrix(Matrix* matrix); + void setPos(Matrix* matrix); + void setPos(Vec3f* pos); + void setPos(float x, float y, float z); + void setPosGimmickEffect(u32 index, Vec3f* pos); + void setPRSGimmickEffect(u32 index); + void setRot(Vec3f* rot); + void setRot(float x, float y, float z); + void setScale(Vec3f* scale); + void setScale(float x, float y, float z); + Vec3f getPos(); + Vec3f getRot(); + Vec3f getScale(); + void startGimmickEffect(u32 index); + void startGimmickSE(u32 index); + void stopGimmickEffect(u32 index); + void stopGimmickSE(u32 index); + void updataGimmickEffect(float unk1); + void updataGimmickSE(float unk1); + void updateProduction(float unk1); +}; +static_assert(sizeof(grGimmick) == 0x14c, "Class is wrong size!"); + +struct grGimmickMotionPathInfo { + gfArchive* m_archive; + grGimmickMotionPathData* m_motionPathData; + union { + struct { + union { + struct { + u8 : 6; + bool m_isRotate : 1; + bool m_isTranslate : 1; + u32 : 24; + }; + struct { + u32 m_flags; + }; + }; + }; + }; + + grGimmick::SimpleEffectData* m_0xc; + grGimmick::SimpleEffectData* m_0x10; + grGimmick::SimpleEffectData* m_0x14; + grGimmick::SimpleEffectData* m_0x18; + grGimmick::SimpleEffectData* m_0x1c; + grGimmick::SimpleEffectData* m_0x20; + + inline grGimmickMotionPathInfo(gfArchive* archive, grGimmickMotionPathData* motionPathData, bool isRotate, bool isTranslate) : m_archive(archive), m_motionPathData(motionPathData), m_isRotate(isRotate), m_isTranslate(isTranslate), m_0xc(NULL), m_0x10(NULL), m_0x14(NULL), m_0x18(NULL), m_0x1c(NULL), m_0x20(NULL) {} + inline grGimmickMotionPathInfo(gfArchive* archive, grGimmickMotionPathData* motionPathData, u32 flags) : m_archive(archive), m_motionPathData(motionPathData), m_flags(flags), m_0xc(NULL), m_0x10(NULL), m_0x14(NULL), m_0x18(NULL), m_0x1c(NULL), m_0x20(NULL) {} +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_area_common.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_area_common.h new file mode 100644 index 0000000000..f6e0a997c1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_area_common.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +class grGimmickAreaCommon : public grYakumono { +protected: + stGimmickAreaData* m_gimmickAreaData; + soAreaData m_areaData; + soSet m_areaDataSet; + ykAreaData m_ykData; + +public: + grGimmickAreaCommon(const char* taskName); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual ~grGimmickAreaCommon(); + +}; +static_assert(sizeof(grGimmickAreaCommon) == 0x188, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_catapult.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_catapult.h new file mode 100644 index 0000000000..7ea0140cbc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_catapult.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include + +struct grGimmickCatapultData { + grGimmickMotionPathData m_motionPathData; + stGimmickAreaData m_areaData; + float m_startMoveFrame; + float m_52; + float m_56; + float m_vector; + char _64[16]; + u8 m_mdlIndex; + bool m_isFaceLeft; + bool m_useNoHelperWarp; + char _82[1]; + + inline grGimmickCatapultData() { + + }; + + inline grGimmickCatapultData(float startMoveFrame, float unk1, float unk2, float vector, u8 mdlIndex, bool isFaceLeft, bool useNoHelperWarp, + float motionRatio, u8 motionPathIndex, u8 motionPathMdlIndex, u8 motionPathUnk, + Vec2f* areaPos, Vec2f* areaRange) { + initialize(startMoveFrame, unk1, unk2, vector, mdlIndex, isFaceLeft, useNoHelperWarp, + motionRatio, motionPathIndex, motionPathMdlIndex, motionPathUnk, + areaPos, areaRange); + }; + + inline void initialize(float startMoveFrame, float unk1, float unk2, float vector, u8 mdlIndex, bool isFaceLeft, bool useNoHelperWarp, + float motionRatio, u8 motionPathIndex, u8 motionPathMdlIndex, u8 motionPathUnk, + Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_startMoveFrame = startMoveFrame; + m_52 = unk1; + m_56 = unk2; + m_vector = vector; + m_mdlIndex = mdlIndex; + m_isFaceLeft = isFaceLeft; + m_useNoHelperWarp = useNoHelperWarp; + m_motionPathData.set(motionRatio, motionPathIndex, motionPathMdlIndex, motionPathUnk); + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickCatapultData) == 84, "Class is wrong size!"); + +class grGimmickCatapult : public grYakumono { + +protected: + grGimmickCatapultData* m_catapultData; + grGimmickMotionPath* m_motionPath; + u8 m_state; + char m_345[3]; + float m_frameCount; + char m_352[8]; + int m_360; + int m_364; + soAreaData m_areaData; + soSet m_areaDataSet; + ykAreaData m_ykData; + +public: + inline grGimmickCatapult(const char* taskName) : grYakumono(taskName) + { + m_motionPath = NULL; + m_state = 0; + m_frameCount = 0.0; + m_360 = -1; + m_364 = -1; + }; + virtual void processFixPosition(); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual ~grGimmickCatapult(); + + void presentFighterPosEvent(); + + static grGimmickCatapult* create(s16 mdlIndex, const char* taskName); +}; +static_assert(sizeof(grGimmickCatapult) == 420, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_ladder.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_ladder.h new file mode 100644 index 0000000000..e151c8ddbd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_ladder.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include + +struct grGimmickLadderData { + grGimmickMotionPathData m_motionPathData; + stGimmickAreaData m_areaData; + u8 m_mdlIndex; + char m_49; + bool m_restrictUpExit; + bool m_51; + char m_nodeName[32]; // unused + stTriggerData m_isValidTriggerData; + stTriggerData m_motionPathTriggerData; + + inline grGimmickLadderData() { + + }; + + inline grGimmickLadderData(u8 mdlIndex, int unk1, bool restrictUpExit, int unk2, const char* nodeName, + Vec2f* areaPos, Vec2f* areaRange) { + initialize(mdlIndex, unk1, restrictUpExit, unk2, nodeName, + areaPos, areaRange); + }; + + inline void initialize(u8 mdlIndex, int unk1, bool restrictUpExit, int unk2, const char* nodeName, + Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_mdlIndex = mdlIndex; + m_49 = unk1; + m_restrictUpExit = restrictUpExit; + m_51 = unk2; + strcpy(m_nodeName, nodeName); + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickLadderData) == 92, "Class is wrong size!"); + +class grGimmickLadder : public grYakumono { +protected: + grGimmickLadderData* m_ladderData; + soAreaData m_areaData; + soSet m_areaDataSet; + ykAreaData m_ykData; + Vec3f m_upperOffsetPos; + Vec3f m_underOffsetPos; + +public: + grGimmickLadder(const char* taskName); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual bool disableArea(); + virtual bool setSleepArea(bool); + virtual void setInitializeFlag(); + virtual ~grGimmickLadder(); + virtual void getUpperNode(Vec3f* pos); + virtual void getUnderNode(Vec3f* pos); + + static grGimmickLadder* create(s16 mdlIndex, const char* taskName); +}; +static_assert(sizeof(grGimmickLadder) == 416, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_motion_path.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_motion_path.h new file mode 100644 index 0000000000..79fd32e734 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_motion_path.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include + +class grGimmickMotionPath : public grGimmick { + +public: + char _spacer[4]; + float m_frame; + char _spacer2[12]; + unsigned int m_frameCount; + grGimmickMotionPathData* m_motionPathData; + char _spacer3[20]; + int m_nodeIndex; + char m_nodeName[32]; + + grGimmickMotionPath(const char* taskName, const char* nodeName); + virtual void processAnim(); + virtual void loadGroundData(nw4r::g3d::ResFile, u32 unk2, gfSceneRoot::LayerType unk3); + virtual int getModelCount(); + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void update(float deltaFrame); + virtual ~grGimmickMotionPath(); + + virtual bool isMoveEnd(); + virtual bool isReturnEnd(); + virtual void setFrameModelAnim(); + virtual void clearFrame(); + + static grGimmickMotionPath* create(int mdlIndex, const char* nodeName, const char* taskName); + + void startMove(); + void startMove(float deltaFrame); + void setFrameUpdate(float); + void setFrame(float frame); + void applyEndFrame(); + float getFrame(); + bool isEndFrame(); + bool isStartFrame(); + void getTRS(Vec3f* pos, Vec3f* rotation, Vec3f* scale); + void stopStartSE(); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_spring.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_spring.h new file mode 100644 index 0000000000..a75f31b8a4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_spring.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include + +struct grGimmickSpringData { +public: + grGimmickMotionPathData m_motionPathData; + stGimmickAreaData m_areaData; + Vec2f m_pos; + float m_rot; + float m_bounce; + char _64[8]; + u8 m_mdlIndex; + u8 m_collIndex; + char _74[2]; + stTriggerData m_triggerData; + + inline grGimmickSpringData() { + + }; + + inline grGimmickSpringData(Vec2f* pos, float bounce, u8 mdlIndex, Vec2f* areaPos, Vec2f* areaRange) { + initialize(pos, bounce, mdlIndex, areaPos, areaRange); + }; + + inline grGimmickSpringData(Vec2f* pos, float rot, float bounce, u8 mdlIndex, Vec2f* areaPos, Vec2f* areaRange) { + initialize(pos, rot, bounce, mdlIndex, areaPos, areaRange); + }; + + inline void initialize(Vec2f* pos, float bounce, u8 mdlIndex, Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_pos = *pos; + m_bounce = bounce; + m_mdlIndex = mdlIndex; + m_areaData.set(areaPos, areaRange); + }; + + inline void initialize(Vec2f* pos, float rot, float bounce, u8 mdlIndex, Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_pos = *pos; + m_rot = rot; + m_bounce = bounce; + m_mdlIndex = mdlIndex; + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickSpringData) == 80, "Class is wrong size!"); + +class grGimmickSpring : public grYakumono { + +protected: + enum State { + State_Rest = 0x0, + State_On = 0x1, + State_Off = 0x2 + }; + + grGimmickSpringData* m_springData; + int m_276; + State m_state : 8; + char _281[3]; + float m_animFrame; + u32 m_animOnLength; + u32 m_animOffLength; + soAreaData m_areaData; + soSet m_areaDataSet; + ykAreaData m_ykData; + +public: + grGimmickSpring(const char* taskName); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual ~grGimmickSpring(); + virtual void setInitializeFlag(); + virtual bool setSleepArea(bool); + virtual bool disableArea(); + virtual void setMotionOff(); + virtual void getTopNode(Vec3f* pos); + + void presentPosEvent(); + void presentShootEvent(); +}; +static_assert(sizeof(grGimmickSpring) == 412, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_warpzone.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_warpzone.h new file mode 100644 index 0000000000..015fe47a27 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_gimmick_warpzone.h @@ -0,0 +1,67 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct grGimmickWarpData { + grGimmickMotionPathData m_motionPathData; + stGimmickAreaData m_areaData; + char _48[32]; + u8 m_mdlIndex; + char _81[3]; + Vec2f m_pos; + SndID m_sndIDs[2]; + char _100[8]; + stTriggerData m_warpTriggerData; + char _112[12]; + stTriggerData m_isValidTriggerData; + + inline grGimmickWarpData() { + + }; + + inline grGimmickWarpData(Vec2f* pos, u8 mdlIndex, SndID sndIn, SndID sndOut, + Vec2f* areaPos, Vec2f* areaRange) { + initialize(pos, mdlIndex, sndIn, sndOut, + areaPos, areaRange); + }; + + inline void initialize(Vec2f* pos, u8 mdlIndex, SndID sndIn, SndID sndOut, + Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_pos = *pos; + m_mdlIndex = mdlIndex; + m_sndIDs[0] = sndIn, + m_sndIDs[1] = sndOut, + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickWarpData) == 128, "Class is wrong size!"); + +class grGimmickWarpZone : public grYakumono { +protected: + grGimmickWarpData* m_warpData; + u8 m_state; + char _277[3]; + float m_frameCount; + Vec3f m_warpDest; + u8 m_warpType; + bool m_isNotAuto; + char m_298[2]; + soAreaData m_areaData; + soSet m_areaDataSet; + ykAreaData m_ykData; + +public: + grGimmickWarpZone(const char* taskName); + virtual ~grGimmickWarpZone(); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void setInitializeFlag(); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual void setWarpAttrData(Vec3f* warpDest, u8 warpType, bool isNotAuto); +}; +static_assert(sizeof(grGimmickWarpZone) == 416, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_madein.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_madein.h new file mode 100644 index 0000000000..84b20f338d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_madein.h @@ -0,0 +1,138 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class grMadein : public grSeqYakumono { +public: + enum AttackPreset { + Attack_Default = 0x0, + Attack_Up = 0x1, + Attack_Left = 0x2, + Attack_Right = 0x3, + Attack_Overwrite = 0x4, + }; + + class AttackInfo { + public: + float m_size; + Vec3f m_offsetPos; + char _spacer[0x18]; + AttackPreset m_preset; + }; + + class HitPointInfo { + public: + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + char _spacer[12]; + float m_size; + float m_lastDamageTaken; + float m_lastSide; + char _spacer2[8]; + int m_lastPlayerHit; + int m_nodeIndex; + }; + + class StageHitData { + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + float m_size; + char _spacer[8]; + int m_nodeIndex; + char _spacer2[20]; + }; + + enum HitCategory { + Hit_Category_Gimmick = 0x0, + Hit_Category_Wall = 0x1, + Hit_Category_Enemy = 0x2 + }; + +protected: + AttackInfo* m_attackInfo; + HitPointInfo* m_hitPointInfo; + soCollisionAttackData* m_overwriteAttackData; + StageHitData* m_stageHitData; + bool m_300_7 : 1; // | 0x80 + bool m_hasAttack : 1; // | 0x40 + bool m_hasHitPoint : 1; // | 0x20 + bool m_isHit : 1; // | 0x10 + HitCategory m_hitCategory : 2; // | 0x4, 0x8 + bool m_isLandedOn : 1; // | 0x2 + bool m_useLandCheck : 1; // | 0x1 + char _301[3]; + float m_304; + char _308[4]; + int m_landerTaskId; + char _316[38]; + +public: + void createAttackPoint(); + void createAttackPointNormal(soCollisionAttackData* attackData); + void deleteAttackPoint(); + void deleteHitPoint(); + void endEntity(); + float getEntityFrame(); + soCollisionAttackData* getOverwriteAttackData(); + soCollisionAttackData* getOverwiteAttackData(); + void initializeEntity(); + bool isEndEntity(); + bool isFrameEndOffset(float unk); + bool isFrameOffset(float unk); + void pauseEntity(bool isPause); + void setAttack(float size, Vec3f* offsetPos); + void setHitPoint(float size, Vec3f* startOffsetPos, Vec3f* endOffsetPos, bool, int nodeIndex); + void setMatrix(Matrix matrix, void* unk1); + void setMotion(u32 anmIndex); + void setMotionDetails(u32 anmChrIndex, u32 anmVisIndex, u32 anmTexPatIndex, u32 anmTexSrtIndex, u32 anmClrIndex); + void setupYakumonoClass(); + void startEntity(); + void startEntityAutoLoop(); + void startEntityLoop(int unk1); + void switchToMatrix(); + inline void setAttackPreset(AttackPreset preset) { + this->m_attackInfo->m_preset = preset; + }; + inline soCollisionAttackData* setAttackOverwrite() { + Vec3f pos(0.0, 0.0, 0.0); + this->setAttack(0, &pos); + this->m_attackInfo->m_preset = Attack_Overwrite; + return this->getOverwriteAttackData(); + } + inline void setAttack(float size, Vec3f* offsetPos, AttackPreset preset) { + this->setAttack(size, offsetPos); + this->m_attackInfo->m_preset = preset; + if (preset == Attack_Overwrite) { + this->getOverwriteAttackData(); + } + } + inline int getLanderTaskId() { + return this->m_landerTaskId; + }; + + inline int isHit() { + return this->m_isHit; + }; + + inline int getLastDamageTaken() { + return this->m_hitPointInfo->m_lastDamageTaken; + }; + + grMadein(const char* taskName); + virtual void setTgtNode(const char* unk1); + virtual char* getTgtNode(); + virtual void onDamage(int index, soDamage* damage, soDamageAttackerInfo* attackerInfo); + virtual void onInflictEach(soCollisionLog* collisionLog, float power); + virtual void receiveCollMsg_Landing(grCollStatus* collStatus, grCollisionJoint* collisionJoint, bool isFirstContact); + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void update(float deltaFrame); + virtual ~grMadein(); + + static grMadein* create(int mdlIndex, const char* tgtNodeName, const char* taskName, HeapType heapType); +}; +static_assert(sizeof(grMadein) == 0x1a4, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_norfair_player_area_check.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_norfair_player_area_check.h new file mode 100644 index 0000000000..2368b406b1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_norfair_player_area_check.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +struct grPlayerAreaCheckData { +public: + stGimmickAreaData m_areaData; + char _0x28[4]; +}; +static_assert(sizeof(grPlayerAreaCheckData) == 0x2C, "Class is wrong size!"); + +class grPlayerAreaCheck : public grGimmickAreaCommon { +protected: + grPlayerAreaCheckData _playerAreaCheckData; + grPlayerAreaCheckData* m_playerAreaCheckData; + char _0x1b8[0x28]; + int m_0x1E0; + int m_0x1E4; + char _0x1E8[4]; + bool m_playerChecks[4]; + +public: + inline grPlayerAreaCheck(const char* taskName) : grGimmickAreaCommon(taskName) { + m_0x1E0 = 0; + m_0x1E4 = 0; + this->makeCalcuCallback(1, Heaps::StageInstance); + this->setCalcuCallbackRoot(3); + m_playerChecks[0] = 0; + m_playerChecks[1] = 0; + m_playerChecks[2] = 0; + m_playerChecks[3] = 0; + }; + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual ~grPlayerAreaCheck(); + + void setArea(int posX, int posY, int rangeX, int rangeY); + + static grPlayerAreaCheck* create(int mdlIndex, const char* taskName); + +}; +static_assert(sizeof(grPlayerAreaCheck) == 0x1f0, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_path.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_path.h new file mode 100644 index 0000000000..2e853bd773 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_path.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +struct grFixedPath { + struct UnkClass { + u8 unk0[0xC]; + }; + static_assert(sizeof(UnkClass) == 0xC, "Class is the wrong size!"); + + u16 m_offsetToNextEntry; + UnkClass* m_data; + u8 unk8[0x38]; +}; +static_assert(sizeof(grFixedPath) == 0x40, "Class is the wrong size!"); + +class grFixedPathCollection { + u32 m_count; + grFixedPath* m_paths; + u8 unk8[0x18]; + grFixedPath m_pathData[]; // UBFIX: C99 flexible array member +public: + void relocation(); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_poke_trainer.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_poke_trainer.h new file mode 100644 index 0000000000..1a1f15c485 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_poke_trainer.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include + +class grPokeTrainer : public grYakumono { +protected: + Vec3f* m_posWork; + Vec3f* m_posDstWork; + int m_nNode; + int m_eNode; + +public: + grPokeTrainer(const char* taskName); + virtual void processAnim(); + virtual void update(float deltaFrame); + virtual bool setNode(); + virtual void updateCallback(float deltaFrame); + virtual void setPosWork(Vec3f*); + virtual void setPosDstWork(Vec3f*); + virtual ~grPokeTrainer(); + +}; +static_assert(sizeof(grPokeTrainer) == 0x160, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_seq_yakumono.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_seq_yakumono.h new file mode 100644 index 0000000000..96a94ff18d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_seq_yakumono.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include + +class grSeqYakumono : public grYakumono { + +protected: + class SeSeqBank { + char _0[8]; + }; + static_assert(sizeof(SeSeqBank) == 8, "Class is wrong size!"); + + SeSeqBank* m_seSeqBanks; + u32 m_numSeSeqBanks; + + char _spacer[4]; + +public: + grSeqYakumono(const char* taskName); + void createSeSeqWork(int unk1); + void playSeSeq(float unk1, int unk2); + void playSeSeq(float unk1, float unk2, float unk3); + void registSeSeq(unsigned int unk1, int unk2, int unk3); + + virtual ~grSeqYakumono(); +}; +static_assert(sizeof(grSeqYakumono) == 348, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium.h new file mode 100644 index 0000000000..2734a212fa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include + +class grStadium : public grYakumono { +protected: + float m_0x110; + float m_scaleY; + float m_0x118; +public: + grStadium(const char* taskName); + virtual void update(float deltaFrame); + virtual void updateCallback(u32 index); + virtual void setScaleY(float scaleY); + virtual float getScaleY(); + virtual ~grStadium(); + +}; +static_assert(sizeof(grStadium) == 348, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium_vision.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium_vision.h new file mode 100644 index 0000000000..b26c3fbb1a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_stadium_vision.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include + +class grStadiumVision : public grStadium { + +public: + enum MessageDisplay { + MessageDisplay_None = 0x0, + MessageDisplay_Ready = 0x1, + MessageDisplay_Count_5 = 0x2, + MessageDisplay_Count_4 = 0x3, + MessageDisplay_Count_3 = 0x4, + MessageDisplay_Count_2 = 0x5, + MessageDisplay_Count_1 = 0x6, + MessageDisplay_Go = 0x7, + MessageDisplay_SuddenDeath = 0x8, + MessageDisplay_Time = 0x9, + MessageDisplay_Success = 0xa, + MessageDisplay_Failure = 0xb, + MessageDisplay_Game = 0xc, + MessageDisplay_Leader = 0xd, + MessageDisplay_Overview = 0xe, + MessageDisplay_Defeated_1 = 0xf, + MessageDisplay_Defeated_2 = 0x10, + MessageDisplay_Defeated_3 = 0x11, + MessageDisplay_Defeated_4 = 0x12, + }; + + void* m_msgBinData; + u8 m_352; + char _353[3]; + int m_stadiumType; + MessageDisplay m_messageDisplay : 8; + char _361[3]; + float _364; + Message* message; + float m_372; + float m_376; + float m_380; + float m_384; + float m_388; + float m_392; + float m_396; + short m_400; + short m_402; + short m_404; + short m_406; + short m_408; + short m_410; + short m_412; + u8 m_414; + char _415; + + grStadiumVision(const char* taskName); + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void update(float deltaFrame); + virtual ~grStadiumVision(); + + void setDisplay(bool); + + static grStadiumVision* create(int mdlIndex, const char* tgtNodeName, const char* taskName); +}; +static_assert(sizeof(grStadiumVision) == 416, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_tengan_event.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_tengan_event.h new file mode 100644 index 0000000000..add337f593 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_tengan_event.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include + +class grTenganEvent { +public: + enum State { + NoEvent = 0, + Running = 1, + ReadyEnd = 2 + }; + + float m_framesElapsed; // +0x0 + float m_minFrames; // +0x4 + float m_maxFrames; // +0x8 + float m_framesLeft; // +0xC + float m_manualFramesLeft; // +0x10 + Vec3f m_posSpline[4]; // +0x14 + Vec3f m_rotSpline[4]; // +0x44 + Vec3f m_scaleSpline[4]; // unused + State m_state; // +0xA4 + s32 m_phase; // +0xA8 + + grTenganEvent(); + ~grTenganEvent(); + void update(float delta); + void set(float min, float max); + bool start(); + void end(); + bool isEvent() const; + bool isReadyEnd() const; + s32 getPhase() const; + void setPhase(s32 phase); +}; +static_assert(sizeof(grTenganEvent) == 172, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_visible_production_effect.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_visible_production_effect.h new file mode 100644 index 0000000000..3d5aad2260 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_visible_production_effect.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +class grVisibleProductionEffect : public grVisibleProduction { + virtual ~grVisibleProductionEffect(); + virtual void initialize(); + virtual void remove(); + virtual void productFlowStandby(); + virtual void productFlowStart(); + virtual void productFlowProducing(); + virtual void productFlowEnd(); + virtual void setForcedEnding(); + + grGimmick* m_ground; + char _spacer[52]; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono.h new file mode 100644 index 0000000000..b992ea7e1d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono.h @@ -0,0 +1,72 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class grYakumono : public grGimmick { + +protected: + Yakumono* m_yakumono; + +public: + grYakumono(const char* taskName); + virtual void processUpdate(); + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void setValid(u32 unk1); + virtual void setValidAttachedEffect(u32 unk1); + virtual void preExit(); + virtual void setTransparency(u32 unk1, u32 unk2); + virtual ~grYakumono(); + + virtual void onDamage(int index, soDamage* damage, soDamageAttackerInfo* attackerInfo); + virtual void onInflict(soCollisionLog* collisionLog, u32 unk2, float power); + virtual void onInflictEach(soCollisionLog* collisionLog, float power); + virtual void onGimmickEvent(soGimmickEventArgs* eventInfo, int* taskId); + virtual bool enableYakumono(u32 unk1); + virtual bool disableYakumono(u32 unk1, u32 unk2); + virtual bool enableHit(u32 unk1, u32 unk2); + virtual bool disableHit(u32 unk1, u32 unk2); + virtual bool disableAttack(u32 unk1); + virtual bool enableArea(); + virtual bool disableArea(); + virtual bool setSleepArea(bool unk1); + virtual bool setTeamYakumonoOwnerId(u32 teamOwnerId); + virtual bool setTeamYakumono(u32 teamId, u32 teamOwnerId); + virtual bool getTeamYakumono(int* team); + virtual bool setOffsetAttack(Vec3f* offsetPos, int index); + virtual void setAreaGimmick(soAreaData* areaData, soSet* areaInit, ykAreaData* data, bool unk4); + virtual void setAttackGimmick(int index, int groupIndex, u32 nodeIndex, AttackData* grAttackData, + AttackDetails* grAttackDetails); + virtual void setSoCollisionAttackData(soCollisionAttackData* attackData, AttackData* grAttackData, + AttackDetails* grAttackDetails); + virtual void setAttackGimmickDetails(soCollisionAttackData* attackData, float size, float tripRate, + float hitstopMultiplier, float sdiMultiplier, int power, Vec3f* offsetPos, + int vector, int reactionEffect, int reactionFix, int reactionAdd, + u32 nodeIndex, soCollision::CategoryMask collisionCategoryMask, soCollision::SituationMask collisionSituationMask, + bool unk1, soCollision::PartMask collisionPartMask, soCollisionAttackData::Attribute attribute, + soCollisionAttackData::SoundLevel soundLevel, soCollisionAttackData::SoundAttribute soundAttr, + bool isClankable, bool unk2, bool unk3, bool isShieldable, bool isReflectable, + bool isAbsorbable, u32 addedShieldDamage, u32 detectionRate, bool unk5, bool ignoreInvincibility, + bool ignoreIntangibility, soCollisionAttackData::LrCheck lrCheck, + bool unk6, bool unk7, bool disableHitstop, bool disableHitGfx, + bool disableFlinch, soCollisionAttackData::Region region, bool isShapeCapsule); + virtual bool isEnableAttackPersonAttacked(u32 unk1, u32 unk2, u32 unk3); + virtual bool isEnableAttackAttribute(u32 unk1, u32 unk2); + + void clearAttackerInfo(); + int getPlayerNumber(int* unk1); + int getPlayerNumber(grCollStatus* collStatus); + bool isSubFighter(int* unk1); + void setAreaShape(int unk1, float* unk2, float* unk3); + void setAttackSize(int index, int unk2, float size); + void setAttackTargetCategory(int index, soCollision::CategoryMask categoryMask); + void setSleepAttack(bool isSleep); + void setSleepHit(bool isSleep); + void setSituationODD(); +}; +static_assert(sizeof(grYakumono) == 0x150, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono_punch_slider.h b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono_punch_slider.h new file mode 100644 index 0000000000..819438b567 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/gr_yakumono_punch_slider.h @@ -0,0 +1,91 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct grGimmickPunchSliderData { + grGimmickMotionPathData m_motionPathData; + grGimmickMotionPathData m_sliderPathData; + grGimmick::HitData m_hitData; + char _48[4]; + grGimmick::AttackData m_attackData; + char _140[8]; + float m_148; + float m_152; + float m_156; + float m_160; + float m_164; + float m_168; + float m_difficultyMotionRatios[15]; + stTriggerData m_triggerData; + char _232[12]; + u8 m_mdlIndex; + char _249[3]; + char m_ballNodeName[32]; + char _284[4]; + + inline grGimmickPunchSliderData() { + + }; + + inline grGimmickPunchSliderData(float unk1, float unk2, float unk3, float unk4, float unk5, float unk6, + grGimmick::AttackData* attackData, float hitSize, const char* nodeName, + float motionRatio, u8 motionPathIndex, grGimmickMotionPathData::PathMode pathMode, u8 motionPathMdlIndex, u8 motionPathUnk, + float sliderRatio, u8 sliderPathIndex, u8 sliderPathMdlIndex, u8 sliderPathUnk) { + initialize(unk1, unk2, unk3, unk4, unk5, unk6, + attackData, hitSize, nodeName, + motionRatio, motionPathIndex, pathMode, motionPathMdlIndex, motionPathUnk, + sliderRatio, sliderPathIndex, sliderPathMdlIndex, sliderPathUnk); + }; + + inline void initialize(float unk1, float unk2, float unk3, float unk4, float unk5, float unk6, + grGimmick::AttackData* attackData, float hitSize, const char* nodeName, + float motionRatio, u8 motionPathIndex, grGimmickMotionPathData::PathMode pathMode, u8 motionPathMdlIndex, u8 motionPathUnk, + float sliderRatio, u8 sliderPathIndex, u8 sliderPathMdlIndex, u8 sliderPathUnk) { + + MEMINIT(this); + m_148 = unk1; + m_152 = unk2; + m_156 = unk3; + m_160 = unk4; + m_164 = unk5; + m_168 = unk6; + m_attackData = *attackData; + m_hitData.m_size = hitSize; + strcpy(m_ballNodeName, nodeName); + m_motionPathData.set(motionRatio, motionPathIndex, pathMode, motionPathMdlIndex, motionPathUnk); + m_sliderPathData.set(sliderRatio, sliderPathIndex, grGimmickMotionPathData::Path_Return, sliderPathMdlIndex, sliderPathUnk); + }; +}; +static_assert(sizeof(grGimmickPunchSliderData) == 288, "Class is wrong size!"); + +class grYakumonoPunchSlider : public grYakumono { +protected: + grGimmickMotionPath* m_sliderMotionPath; + grGimmickPunchSliderData* m_sliderData; + u8 m_280; + char _281[3]; + int m_ballNodeIndex; + int m_polyGlowNodeIndex; + int m_292; + char _296[32]; + soCollisionHitData m_hitData; + soSet m_hitDataSet; + ykDataGroup m_ykDataGroup; + ykData m_ykData; + +public: + grYakumonoPunchSlider(const char* taskName); + virtual ~grYakumonoPunchSlider(); + virtual void update(float deltaFrame); + virtual void startup(gfArchive* archive, u32 unk1, gfSceneRoot::LayerType layerType); + virtual void onDamage(int index, soDamage* damage, soDamageAttackerInfo* attackerInfo); + virtual void onInflict(soCollisionLog* collisionLog, u32 unk2, float power); + virtual void updateMove(float deltaFrame); + virtual void createMotionPath(); + virtual void setCulcCallback(gfArchive* archive); +}; +static_assert(sizeof(grYakumonoPunchSlider) == 452, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/gr/ground.h b/include/lib/BrawlHeaders/Brawl/Include/gr/ground.h new file mode 100644 index 0000000000..f6e4ca991c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/gr/ground.h @@ -0,0 +1,178 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Stage; + +class Ground : public gfTask { +public: + enum CollCategory + { + Coll_Category_Fighter = 0x0, + Coll_Category_Enemy = 0x1, + Coll_Category_Item = 0x2, + }; + typedef u32 CollCategoryMask; + static const CollCategoryMask COLL_CATEGORY_MASK_FIGHTER = 1 << Coll_Category_Fighter; + static const CollCategoryMask COLL_CATEGORY_MASK_ENEMY = 1 << Coll_Category_Enemy; + static const CollCategoryMask COLL_CATEGORY_MASK_ITEM = 1 << Coll_Category_Item; + static const CollCategoryMask COLL_CATEGORY_MASK_ALL = COLL_CATEGORY_MASK_FIGHTER | COLL_CATEGORY_MASK_ENEMY | COLL_CATEGORY_MASK_ITEM; + + struct CollCategoryFlag { + union { + struct { + u32 : 29; + bool m_item : 1; + bool m_enemy : 1; + bool m_fighter : 1; + }; + CollCategoryMask m_mask; + }; + inline CollCategoryFlag() {} + inline CollCategoryFlag(CollCategoryMask bits) : m_mask(bits) {} + }; + + // 0 + nw4r::g3d::ResFile m_resFile; + // 4 + nw4r::g3d::ScnMdl** m_sceneModels; // TODO: supposed to be a wrapper of some kind + // 8 + gfModelAnimation** m_modelAnims; + // C + grCollision* m_collision; + // 10 + Ground* m_nextGround; + // 14 + char _spacer2[0x4]; + // 18 + u32 m_modelAnimNum; + // 1C + u16 m_mdlIndex; + // 1E + char _spacer3[2]; + // 20 + void* m_stageData; + // 24 + float m_motionRatio; + // 28 + char _align[4]; + // 2c + bool m_isVisible : 1; + bool m_isVisibleByClipping : 1; + bool m_isEnableCollisionStatus : 1; + bool m_isEnableCollisionStatusByClipping : 1; + bool m_isEnableCalcCollision : 1; + bool m_hasBindedData : 1; + bool m_hasUpdatedG3dCalcWorld : 1; + bool m_isUseMdlNameForStartAnim : 1; + // 2d + bool m_isCopyVisibility : 1; + bool m_isValid : 1; + bool m_noUpdateAnim : 1; + bool m_isPauseAnim : 1; + bool m_isUpdateG3dCalcWorld : 1; + bool m_isGr2 : 1; + bool m_isEnableBlendColor : 1; + bool m_isSetup : 1; + // 2e + char _spacer[2]; + // 30 + HeapType m_heapType; + // 34 + char _spacer5[40]; + + Ground(const char* taskName); + virtual void processAnim(); + virtual void processUpdate(); + virtual void processGameProc(); + virtual void renderPre(); + virtual void renderDebug(); + virtual ~Ground(); + + virtual void update(float deltaFrame); + virtual void loadGroundData(nw4r::g3d::ResFile, u32 unk2, gfSceneRoot::LayerType unk3); + virtual void bindData(gfArchive* data); + virtual void setupMelee(); + virtual void setVisibility(u32 unk1); + virtual void setVisibilityByClipping(u32 unk1); + virtual void setVisibilityAttachedEffect(u32 unk1); + virtual void receiveCollMsg(int direction, grCollStatus* collStatus, grCollisionJoint* collisionJoint); + virtual void receiveCollMsg_Landing(grCollStatus* collStatus, grCollisionJoint* collisionJoint, bool isFirstContact); + virtual void receiveCollMsg_Heading(grCollStatus* collStatus, grCollisionJoint* collisionJoint, bool isFirstContact); + virtual void receiveCollMsg_Wall(grCollStatus* collStatus, grCollisionJoint* collisionJoint, bool isFirstContact); + virtual void receiveCollMsg_Attack(grCollStatus* collStatus, grCollisionJoint* collisionJoint); + virtual void unloadData(); + virtual int getModelCount() { + if (m_resFile.ptr()) { + return m_resFile.GetResMdlNumEntries(); + } + return 0; + }; + virtual void startup(gfArchive* data, u32 unk1, gfSceneRoot::LayerType layerType); + virtual bool setNode(); + virtual void setStageData(void* stageData) { m_stageData = stageData; } + virtual void* getStageData() { return m_stageData; } + virtual void initStageData() { } + virtual void setMdlIndex(int mdlIndex) { m_mdlIndex = mdlIndex; } + virtual short getMdlIndex() { return m_mdlIndex; } + virtual bool isEnableCalcCollision() { return m_isEnableCalcCollision; } + virtual void enableCalcCollision() { m_isEnableCalcCollision = 1; } + virtual void disableCalcCollision() { m_isEnableCalcCollision = 0; } + virtual u32 getNodeIndex(u32 sceneModelIndex, const char* nodeName); + virtual bool getNodePosition(Vec3f* nodePos, u32 sceneModelIndex, u32 nodeIndex); + virtual bool getNodePosition(Vec3f* nodePos, u32 sceneModelIndex, const char* nodeName); + virtual bool getNodeMatrix(Matrix* nodeMtx, u32 sceneModelIndex, u32 nodeIndex); + virtual bool getNodeMatrix(Matrix* nodeMtx, u32 sceneModelIndex, const char* nodeName); + virtual bool setNodeVisibility(bool setVisibility, u32 sceneModelIndex, u32 nodeIndex, bool recursive, bool recursive_); + virtual bool setNodeVisibility(bool setVisibility, u32 sceneModelIndex, const char* nodeName, bool recursive, bool recursive_); + virtual bool setNodeVisibilityAll(bool unk1, u32 sceneModelIndex); + virtual bool isNodeVisible(u32 sceneModelIndex, u32 nodeIndex); + virtual bool setNodeCollision(bool setCollision, u32 sceneModelIndex, u32 nodeIndex, bool recursive); + virtual bool setNodeCollision(bool setCollision, u32 sceneModelIndex, const char* nodeName, bool recursive); + virtual bool getNodeScale(Vec3f* nodeScale, u32 sceneModelIndex, u32 nodeIndex); + virtual bool getNodeScale(Vec3f* nodeScale, u32 sceneModelIndex, const char* nodeName); + virtual void setValid(u32 unk1); + virtual void setValidAttachedEffect(u32 unk1); + virtual void setInitializeFlag() { } + virtual void setInitializeInfo(int initializeInfo) { } + virtual bool getInitializeInfo(int initializeInfo) { return false; } + virtual void setMotionRatio(float ratio); + virtual void setMotionFrame(float frame, u32 animIndex); + virtual float getMotionFrame(u32 anim); + virtual void setMotionLoop(bool shouldLoop, u32 animIndex); + virtual void setMatAlphaMul(u32 unk1, u32 sceneModelIndex); // TODO + virtual void setMatAlpha(u32 unk1, u32 sceneModelIndex); // TODO + virtual void updateG3dProcCalcWorld(); + virtual void preExit(); + virtual bool adventureEventGetItem(int genParamId, stTriggerData* triggerData) { return false; } + virtual void invalidatedByCameraClipping(); + virtual void setTransparencyFlag(char flag); + + bool getNodeIndex(u32* nodeIndex, u32 sceneModelIndex, const char* nodeName); + void addSceneRoot(nw4r::g3d::ScnMdl* sceneModel, int unk2); + bool isCollisionStatusOwnerTask(grCollStatus* collStatus, CollCategoryFlag*); + bool searchNode(const char* unk1, const char* nodeName, int* unk3, u32* nodeIndex); + void setBlendColorDisable(); + void setBlendColorEnable(); + void setDontMoveGround(); + void setEnableCollisionStatus(bool enableColl); + void setEnableCollisionStatusByClipping(bool enableColl); + void setVisibilityByClipping(int unk1, u32 sceneModelIndex); + void updateG3dProcCalcWorldForce(); +}; +static_assert(sizeof(Ground) == 0x9C, "Class is wrong size!"); + +// Size: 196 diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_mngr.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_mngr.h new file mode 100644 index 0000000000..8e82ae8f02 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_mngr.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +class IfAdvMngr { +public: + s32 main(); + void renderPre(); +}; +// TODO size assertion + +extern IfAdvMngr* g_IfAdvMngr; diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_task.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_task.h new file mode 100644 index 0000000000..8d8cabcd68 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_adv_task.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +class ifAdvTask : public gfTask { + u32 m_state; +public: + ifAdvTask() : gfTask(TaskName, Category_Info, 14, 6, true), m_state(0) { } + virtual void processDefault(); + virtual void renderPre(); + virtual ~ifAdvTask(); + + static ifAdvTask* create(); + static char TaskName[]; +}; +static_assert(sizeof(ifAdvTask) == 0x44, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_mngr.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_mngr.h new file mode 100644 index 0000000000..ae3ca1d1b3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_mngr.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include + +class IfMngr; +extern IfMngr* g_IfMngr; +class IfMngr { +public: + char _0x0[0x44]; + void* m_ifCenter; + char _0x48[4]; + IfPlayer* m_ifPlayers[MAX_PLAYERS]; + char _0x64[8]; + void* m_ifPhoto; + void* m_ifMinigameHomerun; + void* m_ifMinigameTraining; + char _0x7C[16]; + void* m_ifWifiIntrMenu; + char _0x90[4]; + void* m_ifAdvBoss; + char _0x98[17]; + bool m_isPauseMenuActive; + char _spacer2[30]; + + inline static IfMngr* getInstance() { return g_IfMngr; } +}; +static_assert(sizeof(IfMngr) == 200, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_player.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_player.h new file mode 100644 index 0000000000..6f750a3278 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_player.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include + +class IfPlayer { +public: + bool m_0x0_0 : 1; + bool m_scoreDisplay : 1; + char _2[10]; + GameRule m_gameRule; + char _10[318]; + u8 teamNo; + char _2b0[1154]; + void updateStockCoin(u8 amount); + void updateCoinScoreSub(u8 amount); + void disappear(); + virtual ~IfPlayer(); +}; +static_assert(sizeof(IfPlayer) == 1496, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_smash_appear.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_smash_appear.h new file mode 100644 index 0000000000..303efa845e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_smash_appear.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include + +// TODO: determine class size +class IfSmashAppearTask : public gfTask { +public: + virtual void processDefault(); + virtual ~IfSmashAppearTask(); + virtual void start(s32 p1); + virtual void dead(); + virtual void stop(s32 p1); + virtual void removeInfo(); + virtual bool isPlaying(); + virtual float getRate(); + virtual void onOpen(); + virtual void onClose(); + virtual void onLoop(); + virtual bool onBeginMessage(); + virtual bool onEndMessage(); + virtual void onDead(); + virtual void onChangeFace(); +}; + +class IfFoxSmashAppearTask : public IfSmashAppearTask { +public: + virtual void processDefault(); + virtual ~IfFoxSmashAppearTask(); + virtual void start(s32 p1); + virtual void onClose(); + virtual void onChangeFace(); + static IfFoxSmashAppearTask* create(gfArchive *); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_stgedit.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_stgedit.h new file mode 100644 index 0000000000..c82f369134 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_stgedit.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class IfStgedit { + nw4r::g3d::ScnGroup* m_scnGroup; + MuObject* m_modelNodes[1]; + bool m_visible; + u32 m_helpPadNun; + + static const u8 Frames[4]; +public: + IfStgedit(); + virtual ~IfStgedit(); + + void createModel(nw4r::g3d::ResFile* mdlSrc); + void createObjResFile(const void* nodeInfo, s32 nodeCount, + nw4r::g3d::ResFile* mdlSrc, s32 prio); + void startMelee(nw4r::g3d::ScnGroup* grp); + void main(); + void setVisible(bool vis); + void setHelpControllerNo(u32 num); + void setVisibleZoomHelp(bool p1); +}; +static_assert(sizeof(IfStgedit) == 0x14, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_utility.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_utility.h new file mode 100644 index 0000000000..bd97d15ab3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_utility.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +namespace utility { + +class StandardTask : public gfTask { +public: + virtual void processDefault(); + virtual ~StandardTask(); + + virtual bool preLoad(); + virtual void loadResource() = 0; + virtual bool checkLoadFinish() const; + virtual void setupScene(); + virtual void createModel() = 0; + virtual void update() = 0; +}; + +class StandardMenu : public StandardTask { +public: + virtual void processDefault(); + virtual ~StandardMenu(); +}; + +} diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_mngr.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_mngr.h new file mode 100644 index 0000000000..9cd688f111 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_mngr.h @@ -0,0 +1,9 @@ +#pragma once + +class IfWifiprMngr { +public: + void main(); +}; +// TODO size assertion + +extern IfWifiprMngr* g_IfWifiprMngr; diff --git a/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_task.h b/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_task.h new file mode 100644 index 0000000000..7f898e6a01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/if/if_wifipr_task.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +class ifWifiprTask : public gfTask { +public: + ifWifiprTask() : gfTask(TaskName, Category_Info, 14, 6, true) { } + virtual void processDefault(); + virtual ~ifWifiprTask(); + + static ifWifiprTask* create(); + static char TaskName[]; +}; +static_assert(sizeof(ifWifiprTask) == 0x40, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/input.h b/include/lib/BrawlHeaders/Brawl/Include/ip/input.h new file mode 100644 index 0000000000..38c3c37eae --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/input.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include +\ +struct ipPadButton { + + typedef u32 Mask; + static const Mask MASK_ATTACK = 1 << 0; + static const Mask MASK_SPECIAL = 1 << 1; + static const Mask MASK_JUMP = 1 << 2; + static const Mask MASK_GUARD = 1 << 3; + static const Mask MASK_STOCK_SHARE = 1 << 4; + static const Mask MASK_SMASH = 1 << 5; + static const Mask MASK_DIR_L = 1 << 6; + static const Mask MASK_DIR_Hi = 1 << 7; + static const Mask MASK_DIR_R = MASK_DIR_L | MASK_DIR_Hi; + static const Mask MASK_CSTICK = 1 << 8; + static const Mask MASK_APPEAL_HI = 1 << 10; + static const Mask MASK_APPEAL_S = 1 << 11; + static const Mask MASK_APPEAL_LW = 1 << 12; + static const Mask MASK_APPEAL_S_L = 1 << 13; + static const Mask MASK_APPEAL_S_R = 1 << 14; + static const Mask MASK_FLICK_JUMP = 1 << 15; + + enum Dir { + Dir_Lw = 0x0, + Dir_L = 0x1, // left dpad + Dir_Hi = 0x2, // up dpad or jump + Dir_R = 0x3, // right dpad + }; + + union { + struct { + Mask m_mask; + }; + struct { + unsigned short : 16; + bool m_flickJump : 1; + bool m_appealSR : 1; + bool m_appealSL : 1; + bool m_appealLw : 1; + bool m_appealS : 1; + bool m_appealHi : 1; + bool _6 : 1; + bool m_cStick : 1; + Dir m_dir : 2; + bool m_smash : 1; + bool m_stockShare : 1; + bool m_guard : 1; + bool m_jump : 1; + bool m_special : 1; + bool m_attack : 1; + }; + }; + + inline ipPadButton() { }; + inline ipPadButton(Mask mask) : m_mask(mask) {}; +}; +static_assert(sizeof(ipPadButton) == 4, "Class is wrong size!"); + +struct ipPadTrigger { + float m_l; + float m_r; +}; +static_assert(sizeof(ipPadTrigger) == 8, "Class is wrong size!"); + +class Input { + bool unk0; +public: + Input() : unk0(false) { } + virtual ~Input() { } + virtual void update(); + virtual Vec2f getStickMain() const; + virtual Vec2f getStickSub() const; + virtual ipPadButton getButton() const; + virtual ipPadTrigger getTrigger() const; + virtual s32 getContNo() const; + virtual void setRumble(u32, u32, s32, u8); // TODO:: Verify parameters + virtual void stopRumble(); + virtual void removeRumble(); + virtual void removeRumbleId(s32, s32); // TODO:: Verify parameters + virtual void removeRumbleMask(u32); +}; +static_assert(sizeof(Input) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/ip_human.h b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_human.h new file mode 100644 index 0000000000..a646cc0b9d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_human.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include + +class IpHuman : public Input { + s32 m_contNo; + ipPadButton m_button; + Vec2f m_stickMain; + Vec2f m_stickSub; + ipPadTrigger m_trigger; + bool m_rumbleEnabled; + + bool rumbleCheck(); +public: + IpHuman(u32 contNo); + virtual ~IpHuman(); + virtual void update(); + virtual Vec2f getStickMain() const; + virtual Vec2f getStickSub() const; + virtual ipPadButton getButton() const; + virtual ipPadTrigger getTrigger() const; + virtual s32 getContNo() const; + virtual void setRumble(u32, u32, s32, u8); + virtual void stopRumble(); + virtual void removeRumble(); + virtual void removeRumbleId(s32, s32); + virtual void removeRumbleMask(u32); + + bool isWinPoseIndicate() const; + u32 getWinPose() const; + void setEnableRumble(bool enable); +}; +static_assert(sizeof(IpHuman) == 0x2C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/ip_network_producer.h b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_network_producer.h new file mode 100644 index 0000000000..5602dd1513 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_network_producer.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include + +// TODO +struct UnkIpNetworkMsg { + u16 unk0[8]; +}; + +// This class has a 2-byte header followed by some record, likely encoding +// controller inputs +// byte 0: size +// byte 1: "front" index +// TODO: relationship to ipPadStatus and/or ipPadButton? +class ipNetworkProducer { + u8 unk0; + u8 unk1; + UnkIpNetworkMsg unk2; + +public: + // Note: The 2nd constructor is a hack to satisfy 3 requirements for a + // full match: + // 1. getInstance does not inline ntSetConsumedDataCallback + // 2. ntSetConsumedDataCallback is emitted after getInstance + // 3. networkInCallback inlines ntSetConsumedDataCallback + ipNetworkProducer() { + void (*f)(NtShared::ntConsumedDataCallback_t) = NtShared::ntSetConsumedDataCallback; + f(networkInCallback); + clear(); + } + + ipNetworkProducer(bool hack) { + NtShared::ntSetConsumedDataCallback(networkInCallback); + clear(); + } + + static ipNetworkProducer* getInstance(); + static void networkInCallback(const u16*); + UnkIpNetworkMsg* front(); + void pop(); + void clear(); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padconfig.h b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padconfig.h new file mode 100644 index 0000000000..ba1c8c9c01 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padconfig.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +struct ipPadConfig { + static ipPadConfig* getInstance(); + s32 getPlayerNo(s32 p1); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padrec.h b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padrec.h new file mode 100644 index 0000000000..2ae0257d21 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_padrec.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class ipKeyRecorder { +public: + char _0[60]; + int m_pauseStatus; + char _64[64]; +}; +static_assert(sizeof(ipKeyRecorder) == 0x80, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ip/ip_switch.h b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_switch.h new file mode 100644 index 0000000000..697ee43a3a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ip/ip_switch.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include + +// TODO: related to ipPadButton? +struct ipPadStatus { + u16 m_button; + s8 m_stickX; + s8 m_stickY; +}; + +class ipSwitch { +public: + char _0[24]; + ipKeyRecorder* m_keyRecorder; + char _28[12]; + + static ipSwitch* getInstance(); + bool getPadStatus(s32 p1, ipPadStatus& p2); +}; +static_assert(sizeof(ipSwitch) == 0x28, "Class is wrong size!"); + +extern ipSwitch* g_ipSwitch; diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_archive.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_archive.h new file mode 100644 index 0000000000..96a3bfc54c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_archive.h @@ -0,0 +1,293 @@ +#pragma once + +#include +#include +#include + +struct itParam { + typedef u32 KineticMask; + static const KineticMask KINETIC_MASK_SANDBAG = 1 << 1; + static const KineticMask KINETIC_MASK_NO_WIND = 1 << 3; + static const KineticMask KINETIC_MASK_NO_OUTSIDE_ATTACK = 1 << 4; + struct KineticFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_noOutsideAttack : 1; + bool m_noWind : 1; + bool : 1; + bool m_sandbag : 1; + bool : 1; + }; + u32 m_mask; + }; + inline KineticFlag() {} + inline KineticFlag(KineticMask bits) : m_mask(bits) {} + }; + + typedef u32 TraitMask; + static const TraitMask TRAIT_MASK_NONE = 0x0; + static const TraitMask TRAIT_MASK_ENEMY_ATTACK = 1 << 25; + static const TraitMask TRAIT_MASK_NO_INHALED = 1 << 24; + static const TraitMask TRAIT_MASK_NO_BOUND_REMOVE = 1 << 23; + static const TraitMask TRAIT_MASK_NO_THROW = 1 << 22; + static const TraitMask TRAIT_MASK_NO_COUNT = 1 << 21; + static const TraitMask TRAIT_MASK_HAMMER = 1 << 20; + static const TraitMask TRAIT_MASK_NO_EAT = 1 << 19; + static const TraitMask TRAIT_MASK_EQUIP2 = 1 << 18; + static const TraitMask TRAIT_MASK_STAGE = 1 << 17; + static const TraitMask TRAIT_MASK_ENEMY = 1 << 16; + static const TraitMask TRAIT_MASK_BOMB = 1 << 15; + static const TraitMask TRAIT_MASK_WEAPON = 1 << 14; + static const TraitMask TRAIT_MASK_FOOD = 1 << 13; + static const TraitMask TRAIT_MASK_FIGHTER = 1 << 12; + static const TraitMask TRAIT_MASK_POKEMON = 1 << 11; + static const TraitMask TRAIT_MASK_ASSIST = 1 << 10; + static const TraitMask TRAIT_MASK_SPECIAL = 1 << 9; + static const TraitMask TRAIT_MASK_BALL = 1 << 8; + static const TraitMask TRAIT_MASK_RECOVER = 1 << 7; + static const TraitMask TRAIT_MASK_EQUIP = 1 << 6; + static const TraitMask TRAIT_MASK_QUICK = 1 << 5; + static const TraitMask TRAIT_MASK_TOUCH = 1 << 4; + static const TraitMask TRAIT_MASK_THROW = 1 << 3; + static const TraitMask TRAIT_MASK_SWING = 1 << 2; + static const TraitMask TRAIT_MASK_SHOOT = 1 << 1; + static const TraitMask TRAIT_MASK_CARRIER = 1 << 0; + struct TraitFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_enemyAttack : 1; + bool m_noInhaled : 1; + bool m_noBoundRemove : 1; + bool m_noThrow : 1; + bool m_noCount : 1; // TODO: verify, spawned by character? + bool m_hammer : 1; + bool m_noEat : 1; + bool m_equip2 : 1; + bool m_stage : 1; + bool m_enemy : 1; + bool m_bomb : 1; + bool m_weapon : 1; + bool m_food : 1; + bool m_fighter : 1; + bool m_pokemon : 1; + bool m_assist : 1; + bool m_special : 1; + bool m_ball : 1; + bool m_recover : 1; + bool m_equip : 1; + bool m_quick : 1; + bool m_touch : 1; + bool m_throw : 1; + bool m_swing : 1; + bool m_shoot : 1; + bool m_carrier : 1; + }; + TraitMask m_mask; + }; + inline TraitFlag() {} + inline TraitFlag(TraitMask bits) : m_mask(bits) {} + }; + + typedef u32 BoundMask; + static const BoundMask BOUND_MASK_NONE = 0x0; + static const BoundMask BOUND_MASK_THROW = 1 << 4; + static const BoundMask BOUND_MASK_CEILING = 1 << 3; + static const BoundMask BOUND_MASK_WALL = 1 << 2; + static const BoundMask BOUND_MASK_DUMMY = 1 << 1; + static const BoundMask BOUND_MASK_FLOOR = 1 << 0; + struct BoundFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_throw : 1; + bool m_ceiling : 1; + bool m_wall : 1; + bool m_dummy : 1; + bool m_floor : 1; + }; + BoundMask m_mask; + }; + inline BoundFlag() {} + inline BoundFlag(BoundMask bits) : m_mask(bits) {} + }; + + enum AttachGroup { + Attach_Group_Badge = 0x0, + Attach_Group_Hat = 0x1, + Attach_Group_Body = 0x2, + Attach_Group_None = 0xFE, + Attach_Group_All = 0xFF, + }; + + enum SizeKind { + Size_Small = 0x0, + Size_Light = 0x0, + Size_Large = 0x1, + Size_Heavy = 0x1, + Size_Invalid = 0x2, + }; + + enum HaveKind { + Have_None = 0x0, + Have_Get = 0x1, + Have_Motion = 0x2, + Have_Normal = 0x3, + Have_Pickup = 0x4, + Have_Grip = 0x5, + Have_Plate = 0x6 + }; + + enum ScaleType { + Scale_Normal = 0x0, + Scale_Fighter = 0x1 + }; + + enum SlopeType { + Slope_None = 0x0, + Slope_Slant = 0x1, + Slope_Slant_Keep_Y_Rot = 0x2, + Slope_Keep_Angle = 0x3, + Slope_Up = 0x4, + Slope_Slant_Smooth = 0x5, + }; + + enum FlashKind { + Flash_None = 0x0, + Flash_Normal = 0x1, + }; + + enum CameraKind { + Camera_None = 0x0, + Camera_Normal = 0x1, + Camera_Center = 0x2, + Camera_3 = 0x3, + Camera_4 = 0x4, + }; + + enum HitKind { + Hit_None = 0x0, + Hit_Stop = 0x1, + Hit_Fly = 0x2, + Hit_Lr = 0x3 + }; + + enum ReflectKind { + Reflect_None = 0x0, + Reflect_Normal = 0x1, + Reflect_Born = 0x2, + }; + + enum ShieldKind { + Shield_None = 0x0, + Shield_Lost = 0x1, + Shield_Born = 0x2, + Shield_Hop = 0x3 + }; + + enum DeadAreaKind { + Dead_Area_None = 0x0, + Dead_Area_Remove = 0x1, + Dead_Area_Remove_Not_Xlu = 0x2, + Dead_Area_All = 0x3 + }; + + enum AttackHitStopKind { + Attack_Hit_Stop_None = 0x0, + Attack_Hit_Stop_Normal = 0x1, + Attack_Hit_Stop_Parent = 0x2 + }; +}; + +class itArchive { +public: + enum Type { + Temp = 0x0, + Assist = 0x1, + Common = 0x2, + D = 0x3, + Stage = 0x4, + F = 0x5 + }; + + Type m_type; + u8 m_4; + char _5[3]; + union { + struct { + ItemKind m_itemKind; + }; + struct { + itKind m_itKind; + u32 m_itVariation; + }; + }; + int m_commonParamId; + int m_brresId; + int m_paramId; + int m_soundGroup; + int m_32; + int m_numItemsActive; + int m_40; + + virtual ~itArchive(); +}; +static_assert(sizeof(itArchive) == 48, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_create.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_create.h new file mode 100644 index 0000000000..6791cb3980 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_create.h @@ -0,0 +1,326 @@ +#pragma once + +#include +#include +#include +#include + +#define NUM_IT_KINDS 178 + +enum itKind { + Item_Common = -0x3, + Item_AssistTrophy = 0x00, + Item_Assist = 0x00, + Item_FranklinBadge = 0x01, + Item_Badge = 0x01, + Item_BananaPeel = 0x02, + Item_Banana = 0x02, + Item_Barrel = 0x03, + Item_BeamSword = 0x04, + Item_Bill = 0x05, + Item_BobOmb = 0x06, + Item_Bombhei = 0x06, + Item_Crate = 0x07, + Item_Box = 0x07, + Item_Bumper = 0x08, + Item_Capsule = 0x09, + Item_RollingCrate = 0x0A, + Item_CarrierBox = 0x0A, + Item_CD = 0x0B, + Item_GooeyBomb = 0x0C, + Item_Chewing = 0x0C, + Item_CrackerLauncher = 0x0D, + Item_Clacker = 0x0D, + Item_CrackerLauncher_Shot = 0x0E, + Item_Clacker_Shot = 0x0E, + Item_Coin = 0x0F, + Item_SuperspicyCurry = 0x10, + Item_Curry = 0x10, + Item_SuperspicyCurry_Shot = 0x11, + Item_Curry_Shot = 0x11, + Item_DekuNut = 0x12, + Item_Deku = 0x12, + Item_MrSaturn = 0x13, + Item_Doseisan = 0x13, + Item_Dragoon_Part = 0x14, + Item_Dragoon = 0x14, + Item_Dragoon_Set = 0x15, + Item_Dragoon_Sight = 0x16, + Item_Trophy = 0x17, + Item_Figure = 0x17, + Item_FireFlower = 0x18, + Item_FireFlower_Shot = 0x19, + Item_Freezie = 0x1A, + Item_Freezer = 0x1A, + Item_GoldenHammer = 0x1B, + Item_GreenShell = 0x1C, + Item_Hammer = 0x1D, + Item_Hammer_Head = 0x1E, + Item_Fan = 0x1F, + Item_Harisen = 0x1F, + Item_HeartContainer = 0x20, + Item_Heart = 0x20, + Item_HomeRunBat = 0x21, + Item_PartyBall = 0x22, + Item_Kusudama = 0x22, + Item_Manaphy_Heart = 0x23, + Item_MaximTomato = 0x24, + Item_PoisonMushroom = 0x25, + Item_MushD = 0x25, + Item_SuperMushroom = 0x26, + Item_Mushroom = 0x26, + Item_MetalBox = 0x27, + Item_Hothead = 0x28, + Item_Pasaran = 0x28, + Item_Pitfall = 0x29, + Item_PokeBall = 0x2A, + Item_BlastBox = 0x2B, + Item_PowderBox = 0x2B, + Item_RayGun = 0x2C, + Item_RayGun_Shot = 0x2D, + Item_LipStick = 0x2E, + Item_RipStick = 0x2E, + Item_LipStick_Flower = 0x2F, + Item_RipStick_Flower = 0x2f, + Item_LipStick_Shot = 0x30, + Item_RipStick_Shot = 0x30, + Item_Sandbag = 0x31, + Item_ScrewAttack = 0x32, + Item_Screw = 0x32, + Item_Sticker = 0x33, + Item_Seal = 0x33, + Item_MotionSensorBomb = 0x34, + Item_SensorBomb = 0x34, + Item_Timer = 0x35, + Item_Slow = 0x35, + Item_SmartBomb = 0x36, + Item_SmashBall = 0x37, + Item_SmokeBall = 0x38, + Item_SmokeScreen = 0x38, + Item_Spring = 0x39, + Item_StarRod = 0x3A, + Item_StarRod_Shot = 0x3B, + Item_SoccerBall = 0x3C, + Item_SuperScope = 0x3D, + Item_SuperScope_Shot = 0x3E, + Item_Star = 0x3F, + Item_Starman = 0x3f, + Item_Food = 0x40, + Item_Tabemono = 0x40, + Item_TeamHealer = 0x41, + Item_TeamHealing = 0x41, + Item_Lightning = 0x42, + Item_Thunder = 0x42, + Item_Unira = 0x43, + Item_BunnyHood = 0x44, + Item_UsagiHat = 0x44, + Item_WarpStar = 0x45, + Item_Warpstar = 0x45, + Item_Subspace_Trophy = 0x46, + Item_Adventure_Figure = 0x46, + Item_Subspace_Key = 0x47, + Item_Adventure_Key = 0x47, + Item_Subspace_TrophyStand = 0x48, + Item_Adventure_SmashPlate = 0x48, + Item_Subspace_StockBall = 0x49, + Item_Adventure_Stock = 0x49, + Item_Stage_Apple = 0x4A, + Item_Stage_Sidestepper = 0x4B, + Item_Stage_Crab = 0x4b, + Item_Stage_Shellcreeper = 0x4C, + Item_Stage_Shell = 0x4c, + Item_Stage_Pellet = 0x4D, + Item_Stage_Vegetable = 0x4E, + Item_Stage_Yasai = 0x4E, + Item_HomeRun_Sandbag = 0x4F, + Item_Enemy_Auroros = 0x50, + Item_Enemy_Aroaros = 0x50, + Item_Enemy_Koopa1 = 0x51, + Item_Enemy_Patapata = 0x51, + Item_Enemy_Koopa2 = 0x52, + Item_Enemy_PatapataG = 0x52, + Item_Snake_CardboardBox = 0x53, + Item_Snake_CBox = 0x53, + Item_DiddyKong_Peanut = 0x54, + Item_Diddy_Peanuts = 0x54, + Item_Link_Bomb = 0x55, + Item_Peach_Turnip = 0x56, + Item_Peach_Daikon = 0x56, + Item_ROB_Gyro = 0x57, + Item_Robot_Gyro = 0x57, + Item_DiddyKong_Peanut_Seed = 0x58, + Item_Diddy_Peanuts_Seed = 0x58, + Item_Snake_Grenade = 0x59, + Item_ZeroSuitSamus_ArmorPiece = 0x5A, + Item_SZeroSuit_Armor = 0x5A, + Item_ToonLink_Bomb = 0x5B, + Item_Wario_Bike = 0x5C, + Item_Wario_Bike_A = 0x5D, + Item_Wario_Bike_B = 0x5E, + Item_Wario_Bike_C = 0x5F, + Item_Wario_Bike_D = 0x60, + Item_Wario_Bike_E = 0x61, + Item_Pokemon_Torchic = 0x62, + Item_Pokemon_Achamo = 0x62, + Item_Pokemon_Celebi = 0x63, + Item_Pokemon_Cerebi = 0x63, + Item_Pokemon_Chikorita = 0x64, + Item_Pokemon_Chicorita = 0x64, + Item_Pokemon_Chikorita_Shot = 0x65, + Item_Pokemon_Chicorita_Shot = 0x65, + Item_Pokemon_Entei = 0x66, + Item_Pokemon_Moltres = 0x67, + Item_Pokemon_Fire = 0x67, + Item_Pokemon_Munchlax = 0x68, + Item_Pokemon_Gonbe = 0x68, + Item_Pokemon_Deoxys = 0x69, + Item_Pokemon_Groudon = 0x6A, + Item_Pokemon_Gulpin = 0x6B, + Item_Pokemon_Gokulin = 0x6B, + Item_Pokemon_Staryu = 0x6C, + Item_Pokemon_Hitodeman = 0x6C, + Item_Pokemon_Staryu_Shot = 0x6D, + Item_Pokemon_Hitodeman_Shot = 0x6D, + Item_Pokemon_HoOh = 0x6E, + Item_Pokemon_Houou = 0x6E, + Item_Pokemon_HoOh_Shot = 0x6F, + Item_Pokemon_Houou_Shot = 0x6F, + Item_Pokemon_Jirachi = 0x70, + Item_Pokemon_Snorlax = 0x71, + Item_Pokemon_Kabigon = 0x71, + Item_Pokemon_Bellossom = 0x72, + Item_Pokemon_Kireihana = 0x72, + Item_Pokemon_Kyogre = 0x73, + Item_Pokemon_Kyogre_Shot = 0x74, + Item_Pokemon_LatiasLatios = 0x75, + Item_Pokemon_Lugia = 0x76, + Item_Pokemon_Lugia_Shot = 0x77, + Item_Pokemon_Manaphy = 0x78, + Item_Pokemon_Weavile = 0x79, + Item_Pokemon_Manyula = 0x79, + Item_Pokemon_Electrode = 0x7A, + Item_Pokemon_Marumine = 0x7A, + Item_Pokemon_Metagross = 0x7B, + Item_Pokemon_Mew = 0x7C, + Item_Pokemon_Meowth = 0x7D, + Item_Pokemon_Nyarth = 0x7D, + Item_Pokemon_Meowth_Shot = 0x7E, + Item_Pokemon_Nyarth_Shot = 0x7E, + Item_Pokemon_Piplup = 0x7F, + Item_Pokemon_Pochama = 0x7F, + Item_Pokemon_Togepi = 0x80, + Item_Pokemon_Togepy = 0x80, + Item_Pokemon_Goldeen = 0x81, + Item_Pokemon_Tosakinto = 0x81, + Item_Pokemon_Gardevoir = 0x82, + Item_Pokemon_Sirnight = 0x82, + Item_Pokemon_Wobbuffet = 0x83, + Item_Pokemon_Sonans = 0x83, + Item_Pokemon_Suicune = 0x84, + Item_Pokemon_Bonsly = 0x85, + Item_Pokemon_Usohachi = 0x85, + Item_Assist_Andross = 0x86, + Item_Assist_Andross_Shot = 0x87, + Item_Assist_Barbara = 0x88, + Item_Assist_GrayFox = 0x89, + Item_Assist_Cyborg = 0x89, + Item_Assist_RayMKII = 0x8A, + Item_Assist_CustomRobo = 0x8A, + Item_Assist_RayMKII_Bomb = 0x8B, + Item_Assist_CustomRobo_Bomb = 0x8B, + Item_Assist_RayMKII_Gun = 0x8C, + Item_Assist_CustomRobo_Gun = 0x8C, + Item_Assist_SamuraiGoroh = 0x8D, + Item_Assist_Goroh = 0x8D, + Item_Assist_Devil = 0x8E, + Item_Assist_Excitebike = 0x8F, + Item_Assist_Jeff = 0x90, + Item_Assist_Jeff_PencilBullet = 0x91, + Item_Assist_Jeff_PencilRocket = 0x92, + Item_Assist_Lakitu = 0x93, + Item_Assist_Jugem = 0x93, + Item_Assist_KnuckleJoe = 0x94, + Item_Assist_Joe = 0x94, + Item_Assist_KnuckleJoe_Shot = 0x95, + Item_Assist_Joe_Shot = 0x95, + Item_Assist_HammerBro = 0x96, + Item_Assist_HammerBros = 0x96, + Item_Assist_HammerBro_Hammer = 0x97, + Item_Assist_HammerBros_Hammer = 0x97, + Item_Assist_Helirin = 0x98, + Item_Assist_Heririn = 0x98, + Item_Assist_KatAna = 0x99, + Item_Assist_KatAna_Ana = 0x9A, + Item_Assist_JillDozer = 0x9B, + Item_Assist_Kururi = 0x9B, + Item_Assist_Lyn = 0x9C, + Item_Assist_Lin = 0x9C, + Item_Assist_LittleMac = 0x9D, + Item_Assist_Metroid = 0x9E, + Item_Assist_Nintendog = 0x9F, + Item_Assist_Nintendogs = 0x9F, + Item_Assist_Nintendog_Full = 0xA0, + Item_Assist_Nintendogs_Hi = 0xA0, + Item_Assist_MrResetti = 0xA1, + Item_Assist_Resetsan = 0xA1, + Item_Assist_Isaac = 0xA2, + Item_Assist_Robin = 0xA2, + Item_Assist_Isaac_Shot = 0xA3, + Item_Assist_Robin_Shot = 0xA3, + Item_Assist_Saki = 0xA4, + Item_Assist_Saki_Shot1 = 0xA5, + Item_Assist_Saki_Shot2 = 0xA6, + Item_Assist_Shadow = 0xA7, + Item_Assist_War_Infantry = 0xA8, + Item_Assist_War_Soldier = 0xA8, + Item_Assist_War_Infantry_Shot = 0xA9, + Item_Assist_War_Soldier_Shot = 0xA9, + Item_Assist_Starfy = 0xAA, + Item_Assist_Stafy = 0xAA, + Item_Assist_War_Tank = 0xAB, + Item_Assist_War_Tank_Shot = 0xAC, + Item_Assist_Tingle = 0xAD, + Item_Assist_Lakitu_Spiny = 0xAE, + Item_Assist_Jugem_Togezo = 0xAE, + Item_Assist_Waluigi = 0xAF, + Item_Assist_DrWright = 0xB0, + Item_Assist_Wright = 0xB0, + Item_Assist_DrWright_Building = 0xB1, + Item_Assist_Wright_Buil = 0xB1, + Item_Lot_Food = 0x7D1, + Item_Lot_Basic = 0x7D2, + Item_Lot_Unk3 = 0x7D3, + Item_Lot_Bomb = 0x7D4, + Item_Lot_Empty = 0x7D5 +}; + +struct ItemKind { + itKind m_kind; + u32 m_variation; +}; + +struct itCreate { + int m_index; + int m_createOwnerTaskId; + int m_teamOwnerTaskId; + union { + struct { + ItemKind m_itemKind; + }; + struct { + itKind m_kind; + u32 m_variation; + }; + }; + Vec3f* m_safePos; + Vec3f* m_pos; + float m_lr; + int m_teamNo; + soResourceModule* m_resourceModule; + u8 m_groupNo; + char _41[3]; + int m_brresId; + int m_texResIndex; + int m_texResId; +}; +static_assert(sizeof(itCreate) == 56, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_customizer.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_customizer.h new file mode 100644 index 0000000000..59f22cca74 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_customizer.h @@ -0,0 +1,550 @@ +#pragma once + +#include +#include +#include + +class itBadgeCustomizer : public itCustomizer { +public: + enum Action { + Action_Infinity = 0x0, + Action_Set_Have_Counter = 0x1, + }; + + virtual ~itBadgeCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itBadgeCustomizer) == 12, "Class is wrong size!"); + +class itBananaCustomizer : public itCustomizer { + virtual ~itBananaCustomizer(); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); +}; +static_assert(sizeof(itBananaCustomizer) == 12, "Class is wrong size!"); + +class itBeamSwordCustomizer : public itCustomizer { +public: + enum Action { + Action_Begin = 0x64, + Action_End = 0x65, + Action_Effect = 0x66, + Action_Begin2 = 0x67, + }; + + virtual ~itBeamSwordCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itBeamSwordCustomizer) == 12, "Class is wrong size!"); + +class itMoneyCustomizer : public itCustomizer { +public: + enum Action { + + }; + + virtual ~itMoneyCustomizer(); + virtual void onReset(BaseItem* item); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual void onAction(BaseItem* item, u32, float rate); + virtual bool isSafe(BaseItem* item); +}; +static_assert(sizeof(itMoneyCustomizer) == 12, "Class is wrong size!"); + +class itBombheiCustomizer : public itCustomizer { + virtual ~itBombheiCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); +}; +static_assert(sizeof(itBombheiCustomizer) == 12, "Class is wrong size!"); + +class itChewingCustomizer : public itCustomizer { + virtual ~itChewingCustomizer(); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual bool onHave(BaseItem* item, int); + virtual bool onReflect(BaseItem* item); + virtual bool isReferenceControlerHave(BaseItem* item); +}; +static_assert(sizeof(itChewingCustomizer) == 12, "Class is wrong size!"); + +class itClackerCustomizer : public itCustomizer { + virtual ~itClackerCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); +}; +static_assert(sizeof(itClackerCustomizer) == 12, "Class is wrong size!"); + +class itCurryShotCustomizer : public itCustomizer { + virtual ~itCurryShotCustomizer(); + virtual void onReset(BaseItem* item); + virtual void onUpdateKinetic(BaseItem* item); + virtual void onThrowAttack(BaseItem* item, float, float* lr, Vec3f*, Vec3f*, float* powerMulStatus, bool*); +}; +static_assert(sizeof(itCurryShotCustomizer) == 12, "Class is wrong size!"); + +class itDoseisanCustomizer : public itCustomizer { + virtual ~itDoseisanCustomizer(); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); + virtual bool isUseSpeedDamage(BaseItem* item); +}; +static_assert(sizeof(itDoseisanCustomizer) == 12, "Class is wrong size!"); + +class itDragoonSetCustomizer : public itCustomizer { + virtual ~itDragoonSetCustomizer(); + virtual void onDestruct(BaseItem* item); + virtual void onReset(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onProcessHit(BaseItem* item); + virtual void onRenderDebug(BaseItem* item); + virtual bool isUseScaleZ(BaseItem* item); + virtual bool isConstraintHave(BaseItem* item); + virtual bool isReferenceControlerHave(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itDragoonSetCustomizer) == 12, "Class is wrong size!"); + +class itDragoonSightCustomizer : public itCustomizer { + virtual ~itDragoonSightCustomizer(); + virtual void onConstruct(BaseItem* item); + virtual void onDestruct(BaseItem* item); + virtual void onReset(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual int onGetLayerType(BaseItem* item); +}; +static_assert(sizeof(itDragoonSightCustomizer) == 12, "Class is wrong size!"); + +class itFigureCustomizer : public itCustomizer { +public: + enum Action { + Action_Touch_Get = 0x0, + Action_Sleep = 0x1, + }; + + virtual ~itFigureCustomizer(); + virtual void onConstruct(BaseItem* item); + virtual void onDestruct(BaseItem* item); + virtual void onReset(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onRenderPre(BaseItem* item); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itFigureCustomizer) == 12, "Class is wrong size!"); + +class itFireFlowerCustomizer : public itCustomizer { +public: + enum Action { + Action_Open = 0x0, + Action_Close = 0x1, + }; + + virtual ~itFireFlowerCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itFireFlowerCustomizer) == 12, "Class is wrong size!"); + +class itGoldenHammerCustomizer : public itCustomizer { +public: + enum Action { + Action_Attack_On = 0x1, + Action_Attack_Off = 0x2, + Action_Flashing_On = 0x3, + }; + + virtual ~itGoldenHammerCustomizer(); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); + virtual void onAction(BaseItem* item, u32, float rate); + virtual bool onHave(BaseItem* item, int); +}; +static_assert(sizeof(itGoldenHammerCustomizer) == 12, "Class is wrong size!"); + +class itGreenShellCustomizer : public itCustomizer { + virtual ~itGreenShellCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual bool onReflect(BaseItem* item); + virtual bool isTreadPassive(BaseItem* item); + virtual bool isUseShake(BaseItem* item); +}; +static_assert(sizeof(itGreenShellCustomizer) == 12, "Class is wrong size!"); + +class itHammerCustomizer : public itCustomizer { +public: + enum Action { + Action_Drop_Head = 0x0, + Action_Attack_On = 0x1, + Action_Attack_Off = 0x2, + Action_Flashing_On = 0x3, + }; + virtual ~itHammerCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itHammerCustomizer) == 12, "Class is wrong size!"); + +class itHarisenCustomizer : public itCustomizer { +public: + enum Action { + + }; + + virtual ~itHarisenCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itHarisenCustomizer) == 12, "Class is wrong size!"); + +class itKusudamaCustomizer : public itCustomizer { + virtual ~itKusudamaCustomizer(); + virtual bool isUsePhysics(BaseItem* item); +}; +static_assert(sizeof(itKusudamaCustomizer) == 12, "Class is wrong size!"); + +class itTuchCustomizer : public itCustomizer { + virtual ~itTuchCustomizer(); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); +}; +static_assert(sizeof(itTuchCustomizer) == 12, "Class is wrong size!"); + +class itMetalBlockCustomizer : public itCustomizer { + virtual ~itMetalBlockCustomizer(); + virtual bool onDamage(BaseItem* item, int, soDamageLog*); +}; +static_assert(sizeof(itMetalBlockCustomizer) == 12, "Class is wrong size!"); + +class itPasaranCustomizer : public itCustomizer { + virtual ~itPasaranCustomizer(); + virtual void onReset(BaseItem* item); + virtual bool onReflect(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itPasaranCustomizer) == 12, "Class is wrong size!"); + +class itRayGunCustomizer : public itCustomizer { + virtual ~itRayGunCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); +}; +static_assert(sizeof(itRayGunCustomizer) == 12, "Class is wrong size!"); + +class itRayGunShotCustomizer : public itCustomizer { + virtual ~itRayGunShotCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); +}; +static_assert(sizeof(itRayGunShotCustomizer) == 12, "Class is wrong size!"); + +class itRipStickCustomizer : public itCustomizer { + virtual ~itRipStickCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); +}; +static_assert(sizeof(itRipStickCustomizer) == 12, "Class is wrong size!"); + +class itRipStickFlowerCustomizer : public itCustomizer { + virtual ~itRipStickFlowerCustomizer(); + virtual bool isUsePhysics(BaseItem* item); +}; +static_assert(sizeof(itRipStickFlowerCustomizer) == 12, "Class is wrong size!"); + +class itSandbagCustomizer : public itCustomizer { + virtual ~itSandbagCustomizer(); + virtual void onReset(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual bool onNotifyEventCaptureStatus(BaseItem* item); // TODO + virtual bool onDamage(BaseItem* item, int, soDamageLog*); + virtual void onPreBound(BaseItem* item, float*, BaseItem::BoundMask); + virtual bool isUseTurnDamage(BaseItem* item); + virtual bool isUseSpeedDamage(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itSandbagCustomizer) == 12, "Class is wrong size!"); + +class itSlowCustomizer : public itCustomizer { + virtual ~itSlowCustomizer(); + virtual int onResult(BaseItem* item); +}; +static_assert(sizeof(itSlowCustomizer) == 12, "Class is wrong size!"); + +class itSmartBombCustomizer : public itCustomizer { + virtual ~itSmartBombCustomizer(); + virtual void onReset(BaseItem* item); +}; +static_assert(sizeof(itSmartBombCustomizer) == 12, "Class is wrong size!"); + +class itSmashBallCustomizer : public itCustomizer { + virtual ~itSmashBallCustomizer(); + virtual void onNotifyEventAnimCmd(BaseItem* item, acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void onUpdateAiDir(BaseItem* item, Vec2f*, Vec2f*, Vec2f*, Vec2f*); + virtual void onUpdateAiMove(BaseItem* item, Vec2f*, Vec2f*, Vec2f*); + virtual bool onPreDamageCheck(BaseItem* item, int, soDamageLog*); + virtual bool isUseSpeedDamage(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itSmashBallCustomizer) == 12, "Class is wrong size!"); + +class itSmokeScreenCustomizer : public itCustomizer { + virtual ~itSmokeScreenCustomizer(); + virtual void onReset(BaseItem* item); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual bool onReflect(BaseItem* item); + virtual bool isReferenceControlerHave(BaseItem* item); +}; +static_assert(sizeof(itSmokeScreenCustomizer) == 12, "Class is wrong size!"); + +class itSpringCustomizer : public itCustomizer { + virtual ~itSpringCustomizer(); + virtual void onDestruct(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual void onNotifyEventGimmick(BaseItem* item, soGimmickEventArgs* eventInfo, int* taskId); + virtual bool onHave(BaseItem* item, int); +}; +static_assert(sizeof(itSpringCustomizer) == 12, "Class is wrong size!"); + +class itStarRodCustomizer : public itCustomizer { + enum Action { + Action_Begin = 0x64, + Action_End = 0x65, + Action_Effect = 0x66, + Action_Begin2 = 0x67, + }; + + virtual ~itStarRodCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); + virtual void onAction(BaseItem* item, u32, float rate); +}; +static_assert(sizeof(itStarRodCustomizer) == 12, "Class is wrong size!"); + +class itStarRodShotCustomizer : public itCustomizer { + virtual ~itStarRodShotCustomizer(); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itStarRodShotCustomizer) == 12, "Class is wrong size!"); + +class itSuperScopeCustomizer : public itCustomizer { + virtual ~itSuperScopeCustomizer(); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); +}; +static_assert(sizeof(itSuperScopeCustomizer) == 12, "Class is wrong size!"); + +class itTeamHealingCustomizer : public itCustomizer { + virtual ~itTeamHealingCustomizer(); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); +}; +static_assert(sizeof(itTeamHealingCustomizer) == 12, "Class is wrong size!"); + +class itThunderCustomizer : public itCustomizer { + virtual ~itThunderCustomizer(); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual int onResult(BaseItem* item); +}; +static_assert(sizeof(itThunderCustomizer) == 12, "Class is wrong size!"); + +class itUsagiHatCustomizer : public itCustomizer { +public: + enum Action { + Action_Infinity = 0x0, + Action_Set_Have_Counter = 0x1, + }; + + virtual ~itUsagiHatCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); + virtual bool isUsePhysics(BaseItem* item); +}; +static_assert(sizeof(itUsagiHatCustomizer) == 12, "Class is wrong size!"); + +class itWarpstarCustomizer : public itCustomizer { + virtual ~itWarpstarCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual bool isConstraintHave(BaseItem* item); + virtual bool isReferenceControlerHave(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itWarpstarCustomizer) == 12, "Class is wrong size!"); + +class itAroarosCustomizer : public itCustomizer { + virtual ~itAroarosCustomizer(); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itAroarosCustomizer) == 12, "Class is wrong size!"); + +class itCBoxCustomizer : public itCustomizer { +public: + enum Action { + Action_Result = 0x0, + Action_Enable_PickUp = 0x1, + }; + + virtual ~itCBoxCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); + virtual bool onHave(BaseItem* item, int); + virtual bool onRemoveModelConstraint(BaseItem* item, int); + virtual bool isUseScaleZ(BaseItem* item); + virtual bool isUseThrowRotParam(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itCBoxCustomizer) == 12, "Class is wrong size!"); + +class itDiddyPeanutsCustomizer : public itCustomizer { +public: + enum Action { + Action_Final = 0x0, + }; + + virtual ~itDiddyPeanutsCustomizer(); + virtual void onAction(BaseItem* item, u32, float rate); + virtual bool isUseSpeedDamage(BaseItem* item); +}; +static_assert(sizeof(itDiddyPeanutsCustomizer) == 12, "Class is wrong size!"); + +class itLinkBombCustomizer : public itCustomizer { + virtual ~itLinkBombCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); +}; +static_assert(sizeof(itLinkBombCustomizer) == 12, "Class is wrong size!"); + +class itRobotGyroCustomizer : public itCustomizer { +public: + enum Action { + Action_Set_Charge_Frame = 0x0, + }; + + virtual ~itRobotGyroCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onAction(BaseItem* item, u32, float rate); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itRobotGyroCustomizer) == 12, "Class is wrong size!"); + +class itWarioBikeCustomizer : public itCustomizer { + virtual ~itWarioBikeCustomizer(); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual bool onRemoveModelConstraint(BaseItem* item, int); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itWarioBikeCustomizer) == 12, "Class is wrong size!"); + +class itGokulinCustomizer : public itCustomizer { + virtual ~itGokulinCustomizer(); + virtual void onDestruct(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual bool onEnumFighter(BaseItem* item, Fighter* fighter); +}; +static_assert(sizeof(itGokulinCustomizer) == 12, "Class is wrong size!"); + +class itManaphyCustomizer : public itCustomizer { + virtual ~itManaphyCustomizer(); + virtual void onDestruct(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); +}; +static_assert(sizeof(itManaphyCustomizer) == 12, "Class is wrong size!"); + +class itSonansCustomizer : public itCustomizer { + virtual ~itSonansCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); + virtual bool onDamage(BaseItem* item, int, soDamageLog*); + virtual bool isUseSpeedDamage(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); +}; +static_assert(sizeof(itSonansCustomizer) == 12, "Class is wrong size!"); + +class itDevilCustomizer : public itCustomizer { + virtual ~itDevilCustomizer(); + virtual void onConstruct(BaseItem* item); + virtual void onDestruct(BaseItem* item); + virtual void onProcessGameProc(BaseItem* item); + virtual void onNotifyEventAnimCmd(BaseItem* item, acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(itDevilCustomizer) == 12, "Class is wrong size!"); + +class itJeffCustomizer : public itCustomizer { + virtual ~itJeffCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); +}; +static_assert(sizeof(itJeffCustomizer) == 12, "Class is wrong size!"); + +class itJeffPencilCustomizer : public itCustomizer { + virtual ~itJeffPencilCustomizer(); + virtual bool onReflect(BaseItem* item); +}; +static_assert(sizeof(itJeffPencilCustomizer) == 12, "Class is wrong size!"); + +class itHeririnCustomizer : public itCustomizer { + virtual ~itHeririnCustomizer(); + virtual void onProcessUpdate(BaseItem* item); +}; +static_assert(sizeof(itHeririnCustomizer) == 12, "Class is wrong size!"); + +class itKatanaAnaCustomizer : public itCustomizer { + virtual ~itKatanaAnaCustomizer(); + virtual bool onSearchTarget(BaseItem* item, int* taskId, Vec3f pos, int); +}; +static_assert(sizeof(itKatanaAnaCustomizer) == 12, "Class is wrong size!"); + +class itLittlemacCustomizer : public itCustomizer { + virtual ~itLittlemacCustomizer(); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); +}; +static_assert(sizeof(itLittlemacCustomizer) == 12, "Class is wrong size!"); + +class itMetroidCustomizer : public itCustomizer { + virtual ~itMetroidCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); +}; +static_assert(sizeof(itMetroidCustomizer) == 12, "Class is wrong size!"); + +class itNintendogsHiCustomizer : public itCustomizer { + virtual ~itNintendogsHiCustomizer(); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual bool onHave(BaseItem* item, int); + virtual bool isReferenceControlerHave(BaseItem* item); +}; +static_assert(sizeof(itNintendogsHiCustomizer) == 12, "Class is wrong size!"); + +class itResetsanCustomizer : public itCustomizer { + virtual ~itResetsanCustomizer(); + virtual void onConstruct(BaseItem* item); + virtual void onReset(BaseItem* item); + virtual void onNotifyEventAnimCmd(BaseItem* item, acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); + virtual void getFighterKind(ftKind* fighterKind, char** fighterName, int*, ftKind* fighterKind2, char** fighterName2, int*); +}; +static_assert(sizeof(itResetsanCustomizer) == 12, "Class is wrong size!"); + +class itShadowCustomizer : public itCustomizer { + virtual ~itShadowCustomizer(); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void onNotifyEventAnimCmd(BaseItem* item, acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(itShadowCustomizer) == 12, "Class is wrong size!"); + +class itTingleCustomizer : public itCustomizer { + virtual ~itTingleCustomizer(); + virtual void onDestruct(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual bool onEnumFighter(BaseItem* item, Fighter* fighter); +}; +static_assert(sizeof(itTingleCustomizer) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_gen_archive.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_gen_archive.h new file mode 100644 index 0000000000..a9555b9e8b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_gen_archive.h @@ -0,0 +1,99 @@ +#pragma once + +#include +#include +#include +#include + +enum itGenId { + Item_Gen_Assist = 0, + Item_Gen_AssistTrophy = 0, + Item_Gen_Barrel = 3, + Item_Gen_Crate = 7, + Item_Gen_Box = 7, + Item_Gen_Capsule = 9, + Item_Gen_RollingCrate = 10, + Item_Gen_CarrierBox = 10, + Item_Gen_PartyBall = 34, + Item_Gen_Kusudama = 34, + Item_Gen_Pokemon = 42, + Item_Gen_PokeBall = 42, + Item_Gen_Sandbag = 49, + Item_Gen_Peanut = 84, + Item_Gen_Basic = 10000, + + // Custom + Item_Gen_Rain = 10001, + Item_Gen_Barrel_Enemy = -3, + Item_Gen_Crate_Enemy = -7, + Item_Gen_Box_Enemy = -7, + Item_Gen_Capsule_Enemy = -9, + Item_Gen_RollingCrate_Enemy = -10, + Item_Gen_CarrierBox_Enemy = -10, + Item_Gen_PartyBall_Enemy = -34, + Item_Gen_Kusudama_Enemy = -34, +}; + +struct itGenSheetKind { + Stages::srStageKind m_stageKind; + int m_levelId; +}; + +struct itGenParam { + enum Level { + Level_VeryEasy = 0x0, + Level_Easy = 0x1, + Level_Normal = 0x2, + Level_Hard = 0x3, + Level_VeryHard = 0x4 + }; + + enum LifeType { + Life_Normal = 0x0, + Life_Infinity = 0x1, + }; + + enum AppearKind { + Appear_None = 0x0, + Appear_Up = 0x1, + Appear_Down = 0x2, + Appear_Fall = 0x3 + }; + + struct Entry { + union { + struct { + ItemKind m_itemKind; + }; + struct { + itKind m_kind; + u32 m_variation; + }; + }; + float m_rate; + u16 m_minSpawn; + u16 m_maxSpawn; + }; + + itGenId m_id; + LifeType m_lifeType; + AppearKind m_appearKind; + Entry* m_entries; + u32 m_numEntries; + +}; +static_assert(sizeof(itGenParam) == 0x14, "Class is wrong size!"); + + +class itGenArchive { +public: + itArchive::Type m_itArchiveType; + itGenSheetKind m_sheetKind; + int m_archiveId; + u8 m_16; + u8 m_17; + u8 m_18; + char m_19[1]; + + virtual ~itGenArchive(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_manager.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_manager.h new file mode 100644 index 0000000000..2767046e1f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_manager.h @@ -0,0 +1,96 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class itManager : public gfTask, public soDisposeInstanceEventObserver { +public: + struct ItemSwitch { + std::bitset m_itemSwitch; + + ItemSwitch() : m_itemSwitch(0) { } + ItemSwitch(bool val) : m_itemSwitch(val) { } + }; + + struct ItemInfo { + u16 m_variation; + itKind m_kind : 16; + }; + + char _76[116]; + u32 m_frameCount; + int m_numItems; + soArrayList m_itArchiveArrayList; + bool m_drawDone; + char _1749[3]; + soArrayList m_itemArrayList; + soArrayList m_itemArrayList2; + soArrayList m_itemArrayList3; + char _4080[25]; + u8 m_itemNums[NUM_IT_KINDS]; + char _4283[1]; + ItemInfo m_nextAssistInfo; // Note: Just uses itKind in vanilla + int m_numAssists; + int m_preloadAssistTimer; + soArrayList m_pokemonInfoArrayList; // Note: Just uses itKind in vanilla + u32 m_nextPokemonIndex; + int m_numPokemon; + int m_numPokeballs; + int m_preloadPokemonTimer; + soArrayList m_genArchiveArrayList; + ItemSwitch m_itemSwitch; + float m_itemLotRates[NUM_IT_KINDS]; + int m_crateVariation; + int m_smashBallDropTimer; + char _5252[8]; + int m_smashBallDropFrame1; + int m_smashBallDropFrame2; + char _5268[28]; + itGenParam::Level m_genLevel; + bool m_needsToProcess; + char _5301[3]; + void* m_figureManager; + char _5308[4]; + + virtual void processDefault(); + virtual void processBegin(); + virtual void processUpdate(); + virtual void processFixPosition(); + virtual void processDebug(); + virtual void renderDebug(); + virtual ~itManager(); + + virtual void notifyDisposeInstance(bool, int, int taskId); + virtual void notifyDrawDone(); + + bool isCompItemKindArchive(itKind kind, u32 variation, bool); + itArchive* preloadItemKindArchive(itKind kind, u32 variation, itArchive::Type archiveType, bool); + itGenSheetKind getRandBasicItemSheet(itGenId genKind = Item_Gen_Basic); // custom parameter + ItemKind getLotOneItemKind(itGenSheetKind* sheetKind, itGenId genKind, ItemSwitch* itemSwitch = NULL, bool unk = false); + BaseItem* createItem(Vec3f* safePos, Vec3f* pos, float lr, itKind kind, u32 variation = 0, int createOwnerTaskId = -1, + soResourceModule* resourceModule = NULL, u8 groupNo = 0, int brresId = 0xffff, + int texResIndex = 0, int texResId = 0xffff); + BaseItem* createItem(Vec3f* pos, float lr, itKind kind, u32 variation = 0, int createOwnerTaskId = -1, + soResourceModule* resourceModule = NULL, u8 groupNo = 0, int brresId = 0xffff, + int texResIndex = 0, int texResId = 0xffff); + BaseItem* createItem(itKind kind, u32 variation = 0, int createOwnerTaskId = -1, soResourceModule* resourceModule = NULL, + u8 groupNo = 0, int brresId = 0xffff, int texResIndex = 0, int texResId = 0xffff); + BaseItem* createBaseItem(Vec3f* safePos, Vec3f pos, float lr, itKind kind, u32 variation, int createOwnerTaskId, int ownerTaskId, soResourceModule*, u8 groupNo, int brresId, int texResIndex, int texResId, int teamNo); + BaseItem* createItemInstance(itCreate* create); + int createMoney(char* unk1, Vec3f *pos, Vec2f *unk2, u32 amount, u32 unk4, u32 unk5); + u32 getItemNum(itKind kind); + u32 getItemNum(itKind kind, int variation, int taskId, int); + BaseItem* getItemFromInstanceId(int instanceId); + void removeItem(BaseItem*); + bool preloadAssist(itKind, int variation = 0); // custom parameter + + + static itManager* getInstance(); +}; +static_assert(sizeof(itManager) == 0x14c0, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_resource_id_accesser_impl.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_resource_id_accesser_impl.h new file mode 100644 index 0000000000..f28b1fad2c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_resource_id_accesser_impl.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class itResourceIdAccesserImpl : public soResourceIdAccesserImpl { + soModuleAccesser* m_moduleAccsr; + u32 m_archiveId; +public: + itResourceIdAccesserImpl(); + virtual ~itResourceIdAccesserImpl() { } + virtual u32 getArchiveId(); + + itKind getItKind(); +}; +static_assert(sizeof(itResourceIdAccesserImpl) == 0x20, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/it_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/it/it_value_accesser.h new file mode 100644 index 0000000000..5810ac65d4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/it_value_accesser.h @@ -0,0 +1,182 @@ +#pragma once + +#include +#include +#include +#include + +class itValueAccesser : public soValueAccesser { +public: + enum ParamFloat { + Specialized_Param_Float_HitSize = 3401, + Specialized_Param_Float_Throw_Speed_Mul = 3402, + Specialized_Param_Float_2 = 3403, + Specialized_Param_Float_Rot_Coef_X = 3404, + Specialized_Param_Float_Rot_Coef_Y = 3405, + Specialized_Param_Float_Rot_Coef_Z = 3406, + Specialized_Param_Float_Rot_Appear_Mul = 3407, + Specialized_Param_Float_Gravity_Accel = 3408, + Specialized_Param_Float_Gravity_Accel_Max = 3409, + Specialized_Param_Float_Appear_Up_Speed_Y = 3410, + Specialized_Param_Float_Nururi_Size_Up = 3411, + Specialized_Param_Float_Nururi_Size_Down = 3412, + Specialized_Param_Float_Nururi_Size_Left = 3413, + Specialized_Param_Float_Nururi_Size_Right = 3414, + Specialized_Param_Float_Pickup_Range_Offset_X = 3415, + Specialized_Param_Float_Pickup_Range_Offset_Y = 3416, + Specialized_Param_Float_Pickup_Range_Size_W = 3417, + Specialized_Param_Float_Pickup_Range_Size_H = 3418, + Specialized_Param_Float_MapColl_Size_Up = 3419, + Specialized_Param_Float_MapColl_Size_Down = 3420, + Specialized_Param_Float_MapColl_Size_HalfWidth = 3421, + Specialized_Param_Float_Clip_Sphere_R = 3422, + Specialized_Param_Float_Clip_Sphere_OffY = 3423, + Specialized_Param_Float_Rot_Accel = 3424, + Specialized_Param_Float_Rot_Brake = 3425, + Specialized_Param_Float_Bound_RefSpeed_Mul_X = 3426, + Specialized_Param_Float_Bound_RefSpeed_Mul_Y = 3427, + Specialized_Param_Float_Bound_MinSpeed = 3428, + Specialized_Param_Float_Bound_RefSpeed_Wall_Mul_X = 3429, + Specialized_Param_Float_Bound_RefSpeed_Wall_Mul_Y = 3430, + Specialized_Param_Float_Bound_RefSpeed_Ceiling_Mul_X = 3431, + Specialized_Param_Float_Bound_RefSpeed_Ceiling_Mul_Y = 3432, + Specialized_Param_Float_Bound_RefSpeed_Character_Mul = 3433, + Specialized_Param_Float_Bound_RefSpeed_Character_Add_Y = 3434, + Specialized_Param_Float_Air_Brake_X = 3435, + Specialized_Param_Float_Ground_Brake_X = 3436, + Specialized_Param_Float_Outer_Limit_Speed_X = 3437, + Specialized_Param_Float_Outer_Limit_Speed_Y = 3438, + Specialized_Param_Float_Stop_Limit_Speed_X = 3437, + Specialized_Param_Float_Stop_Limit_Speed_Y = 3438, + Specialized_Param_Float_Rot_Limit_Speed_X = 3437, + Specialized_Param_Float_Rot_Limit_Speed_Y = 3438, + Specialized_Param_Float_Throw_Power_Speed_Add = 3439, + Specialized_Param_Float_Throw_Power_Speed_Mul = 3440, + Specialized_Param_Float_Scale = 3441, + Specialized_Param_Float_Hp = 3442, + }; + + enum ParamInt { + Game_Param_Int_Remove_Flash_Frame = 23001, + Game_Param_Int_Remove_Bound_Count = 23002, + Game_Param_Int_Remove_Bound_Per = 23003, + Game_Param_Int_Appear_No_Damage_Frame = 23004, + Game_Param_Int_Appear_No_Pickup_Frame = 23005, + + Specialized_Param_Int_AI_Pri = 23400, + Specialized_Param_Int_Size_Kind = 23401, + Specialized_Param_Int_Have_Kind = 23402, + Specialized_Param_Int_Trait_Original = 23403, + Specialized_Param_Int_Bound_Flag = 23404, + Specialized_Param_Int_Scale_Type = 23405, + Specialized_Param_Int_Slope_Type = 23406, + Specialized_Param_Int_Flash_Kind = 23407, + Specialized_Param_Int_Camera_Kind = 23408, + Specialized_Param_Int_Hit_Kind = 23409, + Specialized_Param_Int_Reflect_Kind = 23410, + Specialized_Param_Int_Shield_Kind = 23411, + Specialized_Param_Int_DeadArea_Kind = 23412, + Specialized_Param_Int_Attack_HitStop_Kind = 23413, + + Anim_Param_Int_Motion_Num = 23415, + Anim_Param_Int_Status_Num = 23416, + + Sub_Param_Int_Rotate_Node_Index = 23418, + Anim_Param_Int_Model_Flag = 23419, + + Work_Param_Int_Have_Node_Index = 23501, + Work_Param_Int_Trait = 23502, + + }; + + enum ParamIndefinite { + Common_Param_Indefinite_Effect_Anim_Cmd = 43000, + Anim_Param_Indefinite_Motion_Data = 43001, + Anim_Param_Indefinite_Status_Data = 43002, + Anim_Param_Indefinite_Collision_Hit_Data = 43003, + Anim_Param_Indefinite_Collision_Shield_Data = 43004, + Anim_Param_Indefinite_Ground_Shape_Data = 43005, + Anim_Param_Indefinite_Visibility_Data = 43006, + Anim_Param_Indefinite_Physics_IK_Data = 43007, + Anim_Param_Indefinite_Effect_Node_Data = 43008, + Anim_Param_Indefinite_Motion_Anim_Cmd_Game = 43009, + Anim_Param_Indefinite_Motion_Anim_Cmd_Effect = 43010, + Anim_Param_Indefinite_Motion_Anim_Cmd_Sound = 43011, + Anim_Param_Indefinite_Status_Anim_Cmd = 43012, + Anim_Param_Indefinite_Event_Anim_Cmd = 43013, + Sub_Param_Indefinite = 43014, + + }; + + enum VariableFloat { + Var_Float_Damage_Log_Speed_Lr = 1000, + Var_Float_Damage_Log_Reaction = 1001, + Var_Float_Damage_Log_Angle = 1002, + Var_Float_Damage_Log_Frame = 1003, + Var_Float_Damage_Log_Speed_X = 1004, + Var_Float_Damage_Log_Speed_Y = 1005, + Var_Float_Kinetic_Sum_Speed = 1006, + Var_Float_Kinetic_Sum_Speed_X = 1007, + Var_Float_Kinetic_Sum_Speed_Y = 1008, + Var_Float_Kinetic_Energy_AI_Move_Speed_X = 1009, + Var_Float_Kinetic_Energy_AI_Move_Speed_Y = 1010, + Var_Float_Kinetic_Energy_AI_Rot_X = 1011, + Var_Float_Kinetic_Energy_AI_Rot_Y = 1012, + Var_Float_Kinetic_Energy_AI_Rot_Z = 1013, + Var_Float_Motion_Trans_Move_Speed_X = 1014, + Var_Float_Motion_Trans_Move_Speed_Y = 1015, + Var_Float_Target_Dist = 1016, + Var_Float_Target_Dist_X_Abs = 1017, + Var_Float_Target_Dist_Y_Abs = 1018, + Var_Float_Target_Dist_X = 1019, + Var_Float_Target_Dist_Y = 1020, + Var_Float_Target_Dist_X_Norm = 1021, + Var_Float_Target_Dist_Y_Norm = 1022, + Var_Float_Target_Dist_Z_Norm = 1023, + Var_Float_Kinetic_Slope_Angle = 1024, + Var_Float_Damage_Log_Damage_Add = 1025, + Var_Float_Damage_Log_Lr = 1026, + Var_Float_World_Scale_Pos_Z = 1027, + + // alternate names + Var_Float_Kinetic_Energy_Control_Speed_X = 1009, + Var_Float_Kinetic_Energy_Control_Speed_Y = 1010, + Var_Float_Kinetic_Energy_Control_Rot_X = 1011, + Var_Float_Kinetic_Energy_Control_Rot_Y = 1012, + Var_Float_Kinetic_Energy_Control_Rot_Z = 1013, + }; + + enum VariableInt { + Var_Int_Damage_Log_Level = 21000, + Var_Int_Damage_Log_Height = 21001, + + Var_Int_Damage_Log_Hit_Stop_Frame = 21003, + Var_Int_Damage_Log_Attribute = 21004, + Var_Int_Damage_Log_Attacker_Task_Id = 21005, + Var_Int_Damage_Log_Attacker_Team_No = 21006, + Var_Int_Create_Owner_Item_Kind = 21007, + Var_Int_Create_Owner_Message = 21008, + Var_Int_Child_Message = 21009, + Var_Int_Target_Situation_Kind = 21010, + Var_Int_Item_Variation = 21011, + Var_Int_Link_Have_Parent_Task_Id = 21012, + Var_Int_Item_Kind = 21013, + Var_Int_Damage_Log_Attacker_Task_Category = 21014, + Var_Int_Damage_Log_Is_Attack_Direct = 21015, + Var_Int_Create_Owner_Task_Id = 21016, + Var_Int_Link_Have_Parent_Hit_Target_High_No = 21017, + Var_Int_Link_Have_Parent_Hit_Target_Medium_No = 21018, + Var_Int_Link_Have_Parent_Hit_Target_Low_No = 21019, + Var_Int_Damage_Log_Attacker_Team_Owner_Task_Id = 21020, + }; + + virtual soParamAccesser* getExtendParamAccesser(); + virtual ~itValueAccesser(); + virtual float getConstantFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getConstantIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getConstantIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + + virtual float getVariableFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getVariableIntCore(soModuleAccesser* moduleAccesser, u32, u32); + +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/item.h b/include/lib/BrawlHeaders/Brawl/Include/it/item.h new file mode 100644 index 0000000000..6479844df8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/item.h @@ -0,0 +1,452 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class itCustomizerInterface; + +class BaseItem : public StageObject, public soStatusEventObserver, public soSituationEventObserver, public soCollisionAttackEventObserver, public soCollisionShieldEventObserver, public soCollisionReflectorEventObserver, public soCollisionSearchEventObserver, public soGimmickEventObserver, public soArticle { +protected: + soModuleAccesser moduleAccesser; + char _428[1808]; + +public: + struct Status { + enum Kind { + Standby = 0x0, + Initialize = 0x1, + Have = 0x2, + Fall = 0x3, + Landing = 0x4, + Throw = 0x5, + Lost = 0x6, + Born = 0x7, + }; + struct Work { + enum Int { + Int_Value_1 = 0x20000000, + Int_Value_2 = 0x20000001, + Int_Value_3 = 0x20000002, + Int_Value_4 = 0x20000003, + Int_Value_5 = 0x20000004, + }; + enum Float { + Float_Value_1 = 0x21000000, + Float_Value_2 = 0x21000001, + Float_Value_3 = 0x21000002, + Float_Value_4 = 0x21000003, + Float_Value_5 = 0x21000004, + Float_Value_6 = 0x21000005, + }; + enum Flag { + Flag_Use_Speed_Power = 0x22000000, + Flag_Damage = 0x22000001, + Flag_Dead = 0x22000002, + Flag_Hit = 0x22000003, + Flag_Near_Target = 0x22000004, + Flag_Found = 0x22000005, + Flag_Lot_Create_Bomb = 0x22000006, + }; + }; + }; + + struct Motion { + enum Kind { + Appear = 0x0, + Have = 0x1, + Fall = 0x2, + Throw = 0x3, + Born = 0x4, + Lost = 0x5, + }; + }; + + struct Area { + enum Kind { + Body = 0x0, + Wind = 0x1, + Pickup = 0x2, + }; + }; + + struct Kinetic { + struct Energy { + enum Id { + Id_Rot = 0x0, + Id_Outer = 0x1, + Id_Gravity = 0x2, + Id_Ground = 0x3, + Id_AI_Move = 0x4, + Id_AI_Rot = 0x5, + Id_Motion = 0x6, + Id_Stop = 0x7, + Id_Jostle = 0x8, + Id_Ground_Movement = 0x9, + Id_Wind = 0xA, + + Id_Control = 0x4, + Id_Control_Rot = 0x5, + }; + }; + }; + + struct Link : StageObject::Link { + enum No { + No_Have = 0x3, + No_Target = 0x4, + No_TeamOwner = 0x6, + No_CreateOwner = 0x7, + }; + }; + + struct AnimCmd { + enum Type { + Type_Remove = 0x0, + Type_Lot_Create = 0x1, + + Type_Set_Rot = 0x3, + Type_Set_Life_Time = 0x4, + Type_Set_Counter = 0x5, + Type_Set_Scale_Anim = 0x6, + Type_Search_Target = 0x7, + Type_Set_Notify_Article_Event_Eject = 0x8, + Type_Create_Item = 0x9, + Type_Warp_Pos_Target = 0xA, + Type_Subtract_Hp = 0xB, + Type_Set_Scale = 0xC, + Type_Create_Item_Angle = 0xD, + Type_Get_Node_Global_Pos = 0xE, + Type_Get_Dist_Vector = 0xF, + Type_Shoot = 0x10, + + Type_Get_Target_Pos = 0x14, + Type_Remove_Eatable_Target_Item = 0x15, + + Type_Get_Node_Global_Rot = 0x1A, + Type_Request_Slow = 0x1B, + Type_Remove_Slow = 0x1C, + Type_Set_Team = 0x1D, + Type_Enable_Area = 0x1E, + Type_Disable_Area = 0x1F, + Type_Disable_Eatable_Target_Item_Pickup = 0x20, + Type_Set_Pos_Target = 0x21, + }; + + enum EventKind { + Event_Damage = 0x0, + Event_Info_Window = 0x1, + Event_Counter = 0x2, + Event_Bound = 0x3, + }; + }; + + struct Instance { + struct Work { + enum Int { + Int_Value_1 = 0x10000000, + Int_Value_2 = 0x10000001, + Int_Value_3 = 0x10000002, + Int_Value_4 = 0x10000003, + Int_Bound_Flag = 0x10000004, // writes 0x10 in itKineticModuleImpl::characterBound, writes on soKineticModuleImpl::updateNormal/updateRolling depending on bounce type, writes 0x1/0x2 depending on which counter is finished + Int_Value_6 = 0x10000005, + Int_Life_Time_Max = 0x10000006, + Int_Have_Node_Index = 0x10000007, + Int_Trait_Flag = 0x10000008, + Int_Life_Time = 0x10000009, + Int_No_Damage_Frame = 0x1000000A, + Int_Counter = 0x1000000B, + Int_Counter_2 = 0x1000000C, + Int_Message = 0x1000000D, + Int_Message_Enemy = 0x1000000E, // used in SmashPlate and getCommunicationItemPortData + Int_Scale_Anim_Type = 0x1000000F, + Int_Scale_Anim_Counter = 0x10000010, + Int_Scale_Anim_Node_Index = 0x10000011, + Int_Scale_Anim_Counter_Limit = 0x10000012, + Int_Target_Task_Id = 0x10000013, + Int_Child_Task_Id = 0x10000014, + Int_Rotate_Node_Index = 0x10000015, + Int_Hit_Kind = 0x10000016, + Int_Bound_Count = 0x10000017, + Int_SE_Bound_Id = 0x10000018, + Int_SE_Water_Id = 0x10000019, + Int_SE_Reflect_Id = 0x1000001A, + Int_SE_Lost_Id = 0x1000001B, + Int_Throw_Frame = 0x1000001C, + Int_Attack_Serial_Id = 0x1000001d, + Int_Attack_Kind = 0x1000001e, + }; + enum Float { + Float_Value_1 = 0x11000000, + Float_Value_2 = 0x11000001, + Float_Value_3 = 0x11000002, + Float_Value_4 = 0x11000003, + Float_Value_5 = 0x11000004, + Float_Value_6 = 0x11000005, + Float_Hp = 0x11000006, + Float_Target_Pos_X = 0x11000007, + Float_Target_Pos_Y = 0x11000008, + Float_Scale_Anim_Min = 0x11000009, + Float_Scale_Anim_Max = 0x1100000a, + Float_Scale_Anim_Now = 0x1100000b, + Float_Base_Scale = 0x1100000c, + Float_Inhaled_Count = 0x1100000d, + }; + enum Flag { + Flag_Value_1 = 0x12000000, + Flag_Value_2 = 0x12000001, + Flag_Value_3 = 0x12000002, + Flag_Value_4 = 0x12000003, + Flag_Reaction = 0x12000004, + Flag_Reflect_Ground = 0x12000005, + Flag_Vanish = 0x12000006, + Flag_Target_Found = 0x12000007, + Flag_Disable_Jostle = 0x12000008, + Flag_unk = 0x12000009, + Flag_Auto_Play_Lost_Effect = 0x1200000A, + Flag_Ground_Lost = 0x1200000c, + Flag_Water = 0x1200000d, + Flag_Apply_World_Move = 0x1200000E, + Flag_Eatable = 0x1200000f, + }; + }; + }; + + struct Lot { + enum State { + State_Error = 0x0, + State_Miss = 0x1, + State_Bomb = 0x2, + State_Hit = 0x3, + }; + }; + + struct Target { + enum Type { + Current_Target = 0x0, + Myself = 0x1, + Near_Fighter = 0x2, + Random_Fighter = 0x3, + Random_Out_Of_Camera = 0x4, + Camera_Target = 0x5, + Create_Owner = 0x6, + Create_Owner_Target = 0x7, + Target_Infield = 0x9, + Many_Side = 0xA, + Under_Ground = 0xB, + Under_Ground_2 = 0xC, // TODO: Figure out difference + Near_Food = 0xD, + Random_Out_Of_Camera_Lr = 0xE, + None = 0xF, + Ike_Final = 0x10, + Random_Item_Drop_Pos = 0x11, + Near_Fighter_All = 0x12, + Many_Side_Fix = 0x13, + }; + }; + + struct Scale { + enum AnimType { + Anim_None = -0x1, + Anim_Normal = 0x0, + Anim_Loop = 0x1, + Anim_Small_To_Normal = 0x2, + Anim_Interpolate = 0x3, + Anim_Keep = 0x4, + }; + }; + + typedef itParam::BoundFlag BoundFlag; + typedef itParam::BoundMask BoundMask; + + int m_instanceId; + union { + struct { + ItemKind m_itemKind; + }; + struct { + itKind m_kind; + u32 m_variation; + }; + }; + int m_createOwnerTaskId; + itKind m_lotCreateKind; + itCustomizerInterface* m_customizer; + u8 m_2260; + char _2261[7]; + itArchive* m_itArchive; + float m_strongestAttackPower; + int m_hitStopFrames; + char _2280[13368]; + int m_articleId; + char _15652[4]; + itGenId m_genId; + char _15660[4]; + int m_attackHitTaskId; + int m_searchHitTaskId; + int m_15672; + int m_15676; + u8 searchHitCollisionIndex; + u8 m_15681; + char _15682[2]; + Vec3f m_searchHitPos; + Vec3f m_startInhaledPos; + char _15708[4]; + + BaseItem(itCreate* create); + virtual void processUpdate(); + virtual void processMapCorrection(); + virtual void processFixPosition(); + virtual void processHit(); + virtual void processFixCamera(); + virtual void processGameProc(); + virtual void renderPre(); + virtual void renderDebug(); + virtual ~BaseItem(); + + virtual void updatePosture(bool); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual void updateNodeSRT(); + virtual bool isTreadPassive(); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + + // TODO: Verify parameters + virtual void reset(Vec3f* pos, float lr, float); + virtual void remove(); + virtual int getArticleId(); + virtual int getArticleEventManageId(); + virtual int getTaskId(); + virtual void linkOwner(int, int); + virtual void unlinkOwner(int); + virtual bool isActiveArticle(); + virtual void deactivateArticle(); + virtual void changeMotion(int motionKind, bool); + virtual void changeStatus(int statusKind); + virtual void setVisibilityWhole(u8); + virtual void setVisibilityWholeForce(u8); + virtual u8 getVisibilityWhole(); + virtual void setSituationKind(SituationKind); + virtual bool isConstraint(); + virtual void setConstraintTargetNode(int); + virtual bool isSyncOwnerStatus(); + virtual void setSyncOwnerStatus(bool); + virtual void setAttackPowerMulPattern(float); + virtual void setArticleId(int articleId); + virtual void setLogAttackInfo(soLogAttackInfo* logAttackInfo); + virtual soLogAttackInfo getLogAttackInfo(); + virtual void updateLogAttackInfo(); + virtual void deactivate(); + virtual void have(int taskId, int, int); + virtual void action(u32, float); + virtual void setGlowAttack(int glowAttack); + virtual int getGlowAttack(); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackCheck(u32 flags); + virtual void notifyEventCollisionShield(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionShieldSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionShieldCheck(); + virtual void notifyEventCollisionReflector(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionReflectorSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionReflectorCheck(); + virtual void notifyEventCollisionSearch(soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionSearchCheck(); + virtual void notifyEventInfoWindow(int); + virtual void notifyEventGimmick(soGimmickEventArgs* eventInfo, int* taskId); + virtual void presentEventGimmick(soGimmickEventArgs* eventInfo, int sendID); + virtual void onDamage(int damageStatusKind, soDamageLog*); + virtual bool isUseTurnDamage(); + virtual bool isUseSpeedDamage(); + virtual bool isUseShake(); + + float getParam(itValueAccesser::ParamFloat param); + int getParam(itValueAccesser::ParamInt param); + float getParamFloat(u32 param); + bool isHaved(); + int getTeamOwnerTaskId(); + void setTeamOwnerTaskId(int taskId); + + void setSafePos(Vec2f* pos); + void warp(Vec3f* pos); + void setVanishMode(bool); + bool sendTouchMessage(int taskId, Vec3f* pos, float); +}; +static_assert(sizeof(BaseItem) == 0x3d60, "Class is wrong size!"); + +class itCustomizerInterface : public utUnCopyable, public soNullable { +public: + virtual ~itCustomizerInterface() {} + virtual void onConstruct(BaseItem* item); + virtual void onDestruct(BaseItem* item); + virtual void onReset(BaseItem* item); + virtual void onProcessUpdate(BaseItem* item); + virtual void onProcessFixPosition(BaseItem* item); + virtual void onProcessHit(BaseItem* item); + virtual void onProcessFixCamera(BaseItem* item); + virtual void onProcessGameProc(BaseItem* item); + virtual void onRenderPre(BaseItem* item); + virtual void onRenderDebug(BaseItem* item); + virtual void onNotifyEventChangeStatus(BaseItem* item, int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void onNotifyEventAnimCmd(BaseItem* item, acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void onNotifyEventCollisionAttackCheck(BaseItem* item, int hitTaskId); + virtual bool onNotifyEventCollisionSearch(BaseItem* item, soCollisionLog* collisionLog); + virtual bool onNotifyEventCollisionSearchCheck(BaseItem* item, int searchHitTaskId, u8 searchHitCollisionIndex, Vec3f* searchHitPos); + virtual void onNotifyEventLink(BaseItem* item, void* unk1, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + virtual bool onNotifyEventCaptureStatus(BaseItem* item); // TODO + virtual void onNotifyEventGimmick(BaseItem* item, soGimmickEventArgs* eventInfo, int* taskId); + virtual void onUpdateKinetic(BaseItem* item); + virtual void onUpdateAiDir(BaseItem* item, Vec2f*, Vec2f*, Vec2f*, Vec2f*); + virtual void onUpdateAiMove(BaseItem* item, Vec2f*, Vec2f*, Vec2f*); + virtual bool onSearchTarget(BaseItem* item, int* taskId, Vec3f pos, int); + virtual u32 onShoot(BaseItem* item, u32, float lr, float); + virtual u32 onShootBlanks(BaseItem* item, u32); + virtual int onGetBullet(BaseItem* item); + virtual void onThrowAttack(BaseItem* item, float, float* lr, Vec3f*, Vec3f*, float* powerMulStatus, bool*); + virtual void onAction(BaseItem* item, u32, float rate); + virtual int onResult(BaseItem* item); + virtual bool onHave(BaseItem* item, int); + virtual bool onPreDamageCheck(BaseItem* item, int damageStatusKind, soDamageLog*); + virtual bool onDamage(BaseItem* item, int damageStatusKind, soDamageLog*); + virtual bool onReflect(BaseItem* item); + virtual void onPreBound(BaseItem* item, Vec2f*, BaseItem::BoundMask); + virtual bool onRemoveModelConstraint(BaseItem* item, int); + virtual bool onEnumFighter(BaseItem* item, Fighter* fighter); + virtual int onGetLayerType(BaseItem* item); + virtual bool isTreadPassive(BaseItem* item); + virtual bool isUseTurnDamage(BaseItem* item); + virtual bool isUseSpeedDamage(BaseItem* item); + virtual bool isUseShake(BaseItem* item); + virtual bool isUseScaleZ(BaseItem* item); + virtual bool isUseThrowRotParam(BaseItem* item); + virtual bool isSafe(BaseItem* item); + virtual bool isConstraintHave(BaseItem* item); + virtual bool isReferenceControlerHave(BaseItem* item); + virtual itParam::KineticFlag getKineticFlags(BaseItem* item); + virtual bool isUsePhysics(BaseItem* item); +}; +static_assert(sizeof(itCustomizerInterface) == 12, "Class is wrong size!"); + +template +class itCustomizer : public itCustomizerInterface { +public: + virtual ~itCustomizer() {} +}; + +class itNullCustomizer : public itCustomizer { +public: + virtual ~itNullCustomizer(); + + static itNullCustomizer* getInstance(); +}; +static_assert(sizeof(itNullCustomizer) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/it/kinetic/it_kinetic_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/it/kinetic/it_kinetic_module_impl.h new file mode 100644 index 0000000000..8a26d092a2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/it/kinetic/it_kinetic_module_impl.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class itKineticModuleImpl : public soKineticModuleImpl, public soStatusEventObserver, public soAnimCmdEventObserver { + char _0x38[4]; + itParam::KineticFlag m_kineticFlag; + char _0x40[0x2EC]; + +public: + virtual void activate(); + virtual void updateEnergy(soModuleAccesser* moduleAccesser, soKineticEnergy::AttributeFlag); + virtual Vec2f getSumSpeed(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumSpeed3f(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumRotation(soKineticEnergy::AttributeFlag); + virtual void mulSpeed(Vec3f* speed, soKineticEnergy::AttributeFlag); + virtual void changeKinetic(int kineticType, soModuleAccesser* moduleAccesser); + virtual void addSpeed(soKineticEnergy::AttributeFlag attr, soModuleAccesser* moduleAccesser); + virtual void addSpeedOutside(soKineticEnergy::OutsideType, Vec3f* speed); + + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual bool isObserv(char unk1); + + virtual void onDebugRender(Vec2f*, Vec2f*); + virtual void onProcessMapCorrection(soModuleAccesser* moduleAccesser); + virtual void addRotation(Vec3f* rot, soModuleAccesser* moduleAccesser); + virtual void clearRotation(); + virtual void addSpeed(Vec3f* speed, bool, soModuleAccesser* moduleAccesser); + virtual void clearSpeed(bool); + virtual void addSpeedDamage(Vec3f*, soModuleAccesser* moduleAccesser); + virtual void setThrowParam(Vec3f* speed, Vec3f* rot, soModuleAccesser* moduleAccesser, bool); + virtual void characterBound(soModuleAccesser* moduleAccesser, bool); + virtual void setSlopeType(itParam::SlopeType); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/memory.h b/include/lib/BrawlHeaders/Brawl/Include/memory.h new file mode 100644 index 0000000000..aa6227ffe3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/memory.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define MEMINIT( p) __memfill( p, 0, sizeof( *p ) ) + +void* free(void* ptr); + + + diff --git a/include/lib/BrawlHeaders/Brawl/Include/modding.h b/include/lib/BrawlHeaders/Brawl/Include/modding.h new file mode 100644 index 0000000000..d2cc51d244 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/modding.h @@ -0,0 +1,7 @@ +#pragma once + +/** + * @brief The modding patch directory. + * @note example: /Project+/ + */ +extern char MOD_PATCH_DIR[]; diff --git a/include/lib/BrawlHeaders/Brawl/Include/modules.h b/include/lib/BrawlHeaders/Brawl/Include/modules.h new file mode 100644 index 0000000000..92a869c109 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/modules.h @@ -0,0 +1,132 @@ +#pragma once + +namespace Modules { + enum _modules { + SORA_SCENE = 1, + SORA_MENU_MAIN = 2, + SORA_MENU_TOUR = 3, + SORA_MENU_QM = 4, + SORA_MENU_EDIT = 5, + SORA_MENU_COLLECT_VIEWER = 6, + SORA_MENU_REPLAY = 7, + SORA_MENU_SNAP_SHOT = 8, + SORA_MENU_EVENT = 9, + SORA_MENU_SEL_CHAR = 10, + SORA_MENU_SEL_STAGE = 11, + SORA_MENU_GAME_OVER = 12, + SORA_MENU_INTRO = 13, + SORA_MENU_FRIEND_LIST = 14, + SORA_MENU_WATCH = 15, + SORA_MENU_NAME = 16, + SORA_MENU_SEL_CHAR_ACCESS = 17, + SORA_MENU_RULE = 18, + SORA_MENU_SIMPLE_ENDING = 19, + SORA_MINIGAME = 20, + SORA_MENU_TIME_RESULT = 21, + SORA_MENU_BOOT = 22, + SORA_MENU_CHALLENGER = 23, + SORA_MENU_TITLE = 24, + SORA_MENU_TITLE_SUNSET = 25, + SORA_MENU_FIG_GET_DEMO = 26, + SORA_MELEE = 27, + SORA_ADV_MENU_NAME = 28, + SORA_ADV_MENU_VISUAL = 29, + SORA_ADV_MENU_SEL_CHAR = 30, + SORA_ADV_MENU_SEL_MAP = 31, + SORA_ADV_MENU_DIFFICULTY = 32, + SORA_ADV_MENU_GAME_OVER = 33, + SORA_ADV_MENU_RESULT = 34, + SORA_ADV_MENU_SAVE_LOAD = 35, + SORA_ADV_MENU_SEAL = 36, + SORA_ADV_MENU_ENDING = 37, + SORA_ADV_MENU_TELOP = 38, + SORA_ADV_MENU_SAVE_POINT = 39, + SORA_ADV_STAGE = 40, + SORA_ENEMY = 41, + ST_BATTLES = 42, + ST_BATTLE = 43, + ST_CONFIG = 44, + ST_FINAL = 45, + ST_DOLPIC = 46, + ST_MANSION = 47, + ST_MARIOPAST = 48, + ST_KART = 49, + ST_DONKEY = 50, + ST_JUNGLE = 51, + ST_PIRATES = 52, + ST_OLDIN = 53, + ST_NORFAIR = 54, + ST_ORPHEON = 55, + ST_CRAYON = 56, + ST_HALBERD = 57, + ST_STARFOX = 58, + ST_STADIUM = 59, + ST_TENGAN = 60, + ST_FZERO = 61, + ST_ICE = 62, + ST_GW = 63, + ST_EMBLEM = 64, + ST_MADEIN = 65, + ST_EARTH = 66, + ST_PALUTENA = 67, + ST_FAMICOM = 68, + ST_NEWPORK = 69, + ST_VILLAGE = 70, + ST_METALGEAR = 71, + ST_GREENHILL = 72, + ST_PICTCHAT = 73, + ST_PLANKTON = 74, + ST_DXSHRINE = 75, + ST_DXYORSTER = 76, + ST_DXGARDEN = 77, + ST_DXONETT = 78, + ST_DXGREENS = 79, + ST_DXRCRUISE = 80, + ST_DXBIGBLUE = 81, + ST_DXCORNERIA = 82, + ST_DXPSTADIUM = 83, + ST_DXZEBES = 84, + ST_STAGEEDIT = 85, + ST_OTRAIN = 86, + ST_HEAL = 87, + ST_HOMERUN = 88, + ST_TBREAK = 89, + ST_CROLL = 90, + FT_MARIO = 91, + FT_DONKEY = 92, + FT_LINK = 93, + FT_SAMUS = 94, + FT_YOSHI = 95, + FT_KIRBY = 96, + FT_FOX = 97, + FT_PIKACHU = 98, + FT_LUIGI = 99, + FT_CAPTAIN = 100, + FT_NESS = 101, + FT_KOOPA = 102, + FT_PEACH = 103, + FT_ZELDA = 104, + FT_ICECLIMBER = 105, + FT_MARTH = 106, + FT_GAMEWATCH = 107, + FT_FALCO = 108, + FT_GANON = 109, + FT_WARIO = 110, + FT_METAKNIGHT = 111, + FT_PIT = 112, + FT_PIKMIN = 113, + FT_LUCAS = 114, + FT_DIDDY = 115, + FT_POKE = 116, + FT_DEDEDE = 117, + FT_LUCARIO = 118, + FT_IKE = 119, + FT_ROBOT = 120, + FT_TOONLINK = 121, + FT_SNAKE = 122, + FT_SONIC = 123, + FT_PURIN = 124, + FT_WOLF = 125, + FT_ZAKO = 126, + }; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/ms/ms_char_writer.h b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_char_writer.h new file mode 100644 index 0000000000..cc0888029b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_char_writer.h @@ -0,0 +1,121 @@ +#pragma once + +#include +#include +#include +#include + +namespace ms { + class CharWriter { + public: + // These get set by SetColorMapping + nw4r::ut::Color m_colorMapping1; // 0 + nw4r::ut::Color m_colorMapping2; // 4 + struct { + nw4r::ut::Color m_topLeft; // 8 + nw4r::ut::Color m_topRight; // 12, 0xC + nw4r::ut::Color m_bottomLeft; // 16, 0x10 + nw4r::ut::Color m_bottomRight; // 20, 0x14 + } m_colorRect; + nw4r::ut::Color m_textColor; // 24, 0x18 + nw4r::ut::Color m_unkColor; // 28, 0x1C some other color, used by setAlpha if offset 0x20 is 1 + // 0x20, flag used in setalpha + // seems to toggle between m_textColor(0) and m_unkColor(1) for the active color. + char m_32; + char m_33[3]; // 0x21, unknown, might be padding or other flags. + float m_fontScaleX; // 36, 0x24 + float m_fontScaleY; // 40, 0x28 + float m_xPos; // 44, 0x2C + float m_yPos; // 48, 0x30 + float m_zPos; // 52, 0x34 + int m_56; // Always = 1?, 0x38 + int m_60; // Always = 1?, 0x3C + char _64[2]; // Always 0xCCCC? Might be padding. + u8 m_alpha; // 66, 0x42 + // offset 67 + bool m_isFixedWidth; + // offset 68 + float m_fixedWidth; // Seems to be -1 if unset. + // This is the pointer to a font resource. + // More investigation should be used to determine which class specifically. + // The melee font which is always loaded seems to be at 0x80497e44 + // offset 72 + void* m_font; + char _76[4]; // 0x4C, set to 0 in constructor + // offset 80 + float m_scale; // 80, 0x50 World scaler, so it affects positioning too. Set to 1 in ctor. + u8 _84; // 84, 0x54 // unk flag, set to 0 + u8 _85; // 85, 0x55 // unk flag, set to 0 + char _86[2]; // 86, 0x56 Looks like padding? + float m_unknownFontWidthModifier; // 88, 0x58 Usually close to 1, seems to affect width. Set to 1 in ctor + float m_edgeWidth; // 92, 0x5C Text outline in units / 6, set to 0 in ctor + nw4r::ut::Color m_edgeColor; // 96, 0x60, set to 0xFF in the constructor, aka black. + // offset 100 + int m_100; // 100, 0x64, set to 1 in ctor + float m_104; // 104, 0x68, set to 1.0 in ctor + u8 m_108; // 108, 0x6C, set to 0 in ctor + char _109[3]; + + CharWriter(); + ~CharWriter(); + + /* Setters */ + void SetFont(const nw4r::ut::ResFont& font); + void SetCursor(float x, float y); // + void SetCursor(float x, float y, float z); + void SetCursorX(float x); + void SetCursorY(float y); + void SetCursorZ(float z); + void SetScale(float x, float y); + void SetScale(float scale); + // Text outline color. + void SetEdge(float width, nw4r::ut::Color color); // 8006ab20 + // Not sure what this does yet. + void SetColorMapping(nw4r::ut::Color a, nw4r::ut::Color b); + void SetTextColor(nw4r::ut::Color textColor); + /* + * I reverse engineered SetAlpha a little bit. The way that it works + * seems to be that it takes the m_alpha field and the active textColor field + * (either m_textColor or m_unknownColor based on whether). It applies the alpha + * to the alpha of the base color and assigns that to all four corners of the color + * rect structure to form a solid color. This function doesn't seem to affect the + * outline color at all, and practically speaking this means that it stays solid + * as transparency drops, so with a black outline the text goes black instead of + * transparent. This is avoidable by manually setting the edge color to the appropriate + * alpha value. + */ + void SetAlpha(unsigned char alpha); + void SetFixedWidth(float fixedWidth); + void EnableFixedWidth(bool enabled); + + /* Getters */ + float getAdjustFontScale() const; + float GetCursorX() const; + float GetCursorY() const; + float GetCursorZ() const; + float GetFixedWidth() const; + void* GetFont() const; + float GetFontAscent() const; + float GetFontDescent() const; + float GetFontHeight() const; + float GetFontWidth() const; + float GetScaleH() const; + float GetScaleV() const; + void GetTextColor() const; + + /* GFX Stuff */ + void SetupGX(); + // Called by SetupGX(), presumably with the values in the charwriter already. + void SetupGXWithColorMapping(nw4r::ut::Color color1, nw4r::ut::Color color2); + + /* The magic function. */ + void Print(u16 character); + + // glyphTexture here seems to be a `FontData` pointer, but it's clearly + // not the root fontdata, it's the fontData for a specific UTF16 char. + // This function in general seems like internal API... the print() function + // sets up its args and calls it. + void PrintGlyph(double x, double y, double z, const void* glyphTexture); // 0x8007001c + }; + static_assert(sizeof(CharWriter) == 0x70, "Class is the wrong size!"); +} diff --git a/include/lib/BrawlHeaders/Brawl/Include/ms/ms_message.h b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_message.h new file mode 100644 index 0000000000..72dd8d84da --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_message.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class Message : public ms::TextWriterBase { +public: + + Message(u32, HeapType heapType); + virtual ~Message(); + + char _164[316]; + + bool allocMsgBuf(u32 msgSizes, u32 numMsgs, HeapType heapType); + bool attachMsgBuf(u32 index, nw4r::g3d::ScnMdlSimple* sceneModel, const char* nodeName, u8, int, float); + bool changeMsgBuf(int index); + void clearMsgBuf(); + void printMsgBuf(FontData::FONT_RESOURCE fontId); + void setWindow(float, float, float, float); + void setCallProjection(u8 p1); + void setDrawFlag(u32 p1, u32 p2); + void setFace(u8); + void setFixedWidth(float); + void setColor(int); + void setScale(float); + void setScale(float, float); + void setCursorX(float); + void setCursorY(float); + void printf(const char* format, ...); + + static u32 utf8to16(wchar_t* dst, const char* src); + static u32 utf16to8(char* dst, const wchar_t* src); + static void getPrintIndexData(void* msgbin, u32 index, char** outStr, u32* outLen); + static void drawBoxLine(s32 p1, s32 p2, s32 p3, float f1, float f2, float f3, float f4, float f5); + + +}; +static_assert(sizeof(Message) == 480, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ms/ms_resfont.h b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_resfont.h new file mode 100644 index 0000000000..588cef6cc3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_resfont.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +struct FontData { + enum FONT_RESOURCE { + FONT_SYSTEM = 0, + FONT_NORMAL = 1, + FONT_HIRAGANA = 2, + FONT_ENDING = 3, + FONT_MELEE = 4, + FONT_RESETSAN = 5, + FONT_FOX = 6, + FONT_ALERT = 7, + FONT_NORMAL2 = 8, + }; + + static nw4r::ut::Font* getFontResource(int id); + static void loadAlertFont(void* p1); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ms/ms_text_writer_base.h b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_text_writer_base.h new file mode 100644 index 0000000000..b5b0ad55af --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ms/ms_text_writer_base.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include + +namespace ms { + template + class TextWriterBase : public CharWriter { + public: + enum DrawFlag { + DRAWFLAG_ALIGN_TEXT_BASELINE = 0, + DRAWFLAG_ALIGN_TEXT_CENTER = (1 << 0), + DRAWFLAG_ALIGN_TEXT_RIGHT = (1 << 1), + + DRAWFLAG_ALIGN_H_BASELINE = 0, + DRAWFLAG_ALIGN_H_CENTER = (1 << 4), + DRAWFLAG_ALIGN_H_RIGHT = (1 << 5), + + DRAWFLAG_ALIGN_V_BASELINE = 0, + DRAWFLAG_ALIGN_V_CENTER = (1 << 8), + DRAWFLAG_ALIGN_V_TOP = (1 << 9), + }; + + TextWriterBase(); + ~TextWriterBase(); + + /* Layout / spacing */ + void SetLineHeight(float height); + float GetLineHeight() const; + void SetLineSpace(float space); + void SetCharSpace(float space); + float GetCharSpace() const; + int GetTabWidth() const; + void SetDrawFlag(u32 flags); // arg width matches nw4r; unverified for ms + u32 GetDrawFlag() const; + + /* Measurement */ + float CalcLineWidth(const T* str, int len); + float CalcStringWidth(const T* str, int len) const; + void CalcStringRect(nw4r::ut::Rect* out, const T* str, int len) const; + + /* Drawing */ + float Print(const T* str, int len); + + private: + // Fields past ms::CharWriter; left as the spacer the stub already carried. + char _112[48]; + }; +} // namespace ms diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_coll2d.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_coll2d.h new file mode 100644 index 0000000000..c2df99951d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_coll2d.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include + +class clAABBox2D { +public: + float m_unk1; + float m_unk2; + float m_unk3; + float m_unk4; +}; + +class clCircle2D { +public: + Vec2f m_centerPos; + float m_radius; + + void getAABBox(clAABBox2D& aabBox) const; +}; + +class clRhombus2D { +public: + Vec2f m_centerPos; + Vec2f m_upPos; + Vec2f m_downPos; + Vec2f m_leftPos; + Vec2f m_rightPos; + clAABBox2D m_aabBox; + + void move(const Vec2f& displacement); +}; + +class clSegment2D { +public: + Vec2f m_p0Pos; + Vec2f m_p1Pos; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_common.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_common.h new file mode 100644 index 0000000000..bfbd86c802 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_common.h @@ -0,0 +1,7 @@ +#pragma once + +#include +#include + +float mtSqrtf(float); +float rsqrtf(float); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_matrix.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_matrix.h new file mode 100644 index 0000000000..83f7c155b1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_matrix.h @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include +#include + +class Matrix : public nw4r::math::MTX34 { +public: + inline float& operator()(int row, int col) { + return m[row][col]; + } + inline float operator()(int row, int col) const { // for const objects + return m[row][col]; + } + + void setIdentity(); + void setSRT(const Vec3f& p1, const Vec3f& p2, const Vec3f& p3); + void rotY(float angle); + inline void rotY(float angle, Matrix* outMatrix) { + *outMatrix = *this; + outMatrix->rotY(angle); + + } + void mul(const Matrix* mulMatrix, Matrix* outMatrix) const; + void mulPos(const Vec3f* pos, Vec3f* outVec); + void inverse(Matrix* outMatrix) const; + void getRotate(Vec3f* outRot); + + inline void getPosition(Vec3f* outPos) { + outPos->m_x = this->m[0][3]; + outPos->m_y = this->m[1][3]; + outPos->m_z = this->m[2][3]; + } + inline Vec3f getPosition() { + Vec3f outPos; + this->getPosition(&outPos); + return outPos; + } + + inline Matrix operator*(Matrix& A) { + Matrix outMatrix; + this->mul(&A, &outMatrix); + return outMatrix; + } + + inline Matrix(bool noInit = false) { + if (!noInit) { + this->setIdentity(); + } + } + inline Matrix(Matrix* matrix) { + *this = *matrix; + } + inline Matrix(float f00, float f01, float f02, float f03, + float f10, float f11, float f12, float f13, + float f20, float f21, float f22, float f23) : + MTX34(f00, f01, f02, f03, f10, f11, f12, f13, f20, f21, f22, f23) { } +}; +static_assert(sizeof(Matrix) == 48, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_prng.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_prng.h new file mode 100644 index 0000000000..08bc777216 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_prng.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include + +s32 randi(s32 max); +float randf(); +void srandi(s32 seed); +s32 randseed(void); +float randaf(void); + +class mtRand { +public: + virtual void init(s32 p1); + virtual s32 generate(); + virtual float randf(); + virtual s32 getMax(); + virtual s32 randi(); + s32 getSeed() { return m_seed; } + void setSeed(s32 seed) { m_seed = seed; } + + mtRand(s32 v) : m_seed(v) { } + +private: + s32 m_seed; + static const s32 MultVal = 0x41C64E6D; + static const s32 AddVal = 0x3039; +}; +static_assert(sizeof(mtRand) == 0x8, "Class is the wrong size!"); + +struct mtPrngLog { + static const u32 BacktraceLength = 2; + + u32 m_randVal; + void* m_backtrace[BacktraceLength]; + float m_gameFrame; + + mtPrngLog(u32 val, void* sp); +}; +static_assert(sizeof(mtPrngLog) == 0x10, "Class is the wrong size!"); + +struct mtPrngLogManager { + u32 m_maxLen; + u32 m_len; + mtPrngLog* m_logs; + + mtPrngLogManager() : m_maxLen(0), m_len(0), m_logs(nullptr) { } + ~mtPrngLogManager(); + bool addLog(const mtPrngLog* log); +}; +static_assert(sizeof(mtPrngLogManager) == 0xC, "Class is the wrong size!"); + +extern mtPrngLogManager g_mtPrngLogManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_spline.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_spline.h new file mode 100644 index 0000000000..6922d6618a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_spline.h @@ -0,0 +1,7 @@ +#pragma once + +#include +#include +#include + +void mtBezierCurve(float t, Vec3f points[4], Vec3f* outPoint); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_trig.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_trig.h new file mode 100644 index 0000000000..2555286bde --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_trig.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +float mtSinf(float angle); +float mtCosf(float angle); +void mtSinCosf(float rad, float* sinOut, float* cosOut); + +template +T mtConvRadToDeg(T rad) { + return rad*(180 / M_PI); +}; + +template +T mtConvDegToRad(T deg) { + return deg*(M_PI / 180); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector.h new file mode 100644 index 0000000000..85d7448c27 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector.h @@ -0,0 +1,192 @@ +#pragma once + +#include +#include +#include +#include + +class Vec2f { +public: + float m_x; + float m_y; + + Vec2f() { } + Vec2f(float x, float y) : m_x(x), m_y(y) { } + + friend Vec2f operator+(const Vec2f& lhs, const Vec2f& rhs) { + Vec2f res; + res.m_x = lhs.m_x + rhs.m_x; + res.m_y = lhs.m_y + rhs.m_y; + return res; + } + + friend Vec2f operator-(const Vec2f& lhs, const Vec2f& rhs) { + Vec2f res; + res.m_x = lhs.m_x - rhs.m_x; + res.m_y = lhs.m_y - rhs.m_y; + return res; + } + + friend Vec2f operator*(const Vec2f& lhs, const float c) { + Vec2f res; + res.m_x = lhs.m_x * c; + res.m_y = lhs.m_y * c; + return res; + } + + friend Vec2f operator/(const Vec2f& lhs, float c) { + return lhs * (1 / c); + } + + Vec2f& operator+=(const Vec2f& v) { + *this = *this + v; + return *this; + } + + Vec2f& operator-=(const Vec2f& v) { + *this = *this - v; + return *this; + } + + Vec2f& operator*=(const float c) { + *this = *this * c; + return *this; + } + + float lengthSq() { + float xSq = m_x * m_x; + float ySq = m_y * m_y; + return xSq + ySq; + } + + float length() { + float lengthSquared = this->lengthSq(); + if (1.17549e-38 < fabsf(lengthSquared)) { + return rsqrtf(lengthSquared)*lengthSquared; + } + else { + return 0.0; + } + + } + + float distance(Vec2f* v) { + Vec2f disp = *this - *v; + return disp.length(); + } + + void normalize(); + void normalize(Vec2f* input); + + void rot(Vec2f *out, float rot); + + static void copy(Vec2f& dest, const Vec2f& src) { +#ifdef MATCHING + __memcpy(&dest, &src, sizeof(Vec2f)); +#else + dest.m_x = src.m_x; + dest.m_y = src.m_y; +#endif + } +}; +static_assert(sizeof(Vec2f) == 8, "Class is wrong size!"); + +class Vec3f { +public: + union { + struct { + float m_x; + float m_y; + float m_z; + }; + struct { + float m_roll; + float m_pitch; + float m_yaw; + }; + }; + + Vec3f() { } + Vec3f(float x, float y, float z) : m_x(x), m_y(y), m_z(z) { } + + Vec3f& operator=(const Vec3f& orig) { + m_x = orig.m_x; + m_y = orig.m_y; + m_z = orig.m_z; + return *this; + } + + Vec2f* xy() const { + return (Vec2f*)this; + } + + Vec3f operator+(const Vec3f& v); + Vec3f operator-(const Vec3f& v); + +#ifdef MATCHING + friend void Vec3fSub(register Vec3f* pOut, register const Vec3f* lhs, + register const Vec3f* rhs) { + register f32 fr3, fr2, fr1, fr0; + + // clang-format off + asm { + psq_l fr0, Vec3f.m_x(lhs), 0, 0 + psq_l fr1, Vec3f.m_x(rhs), 0, 0 + psq_l fr2, Vec3f.m_z(lhs), 1, 0 + psq_l fr3, Vec3f.m_z(rhs), 1, 0 + ps_sub fr0, fr0, fr1 + ps_sub fr1, fr2, fr3 + psq_st fr0, Vec3f.m_x(pOut), 0, 0 + psq_st fr1, Vec3f.m_z(pOut), 1, 0 + } + // clang-format on + } +#else + friend void Vec3fSub(Vec3f* pOut, const Vec3f* lhs, const Vec3f* rhs) { + pOut->m_x = lhs->m_x - rhs->m_x; + pOut->m_y = lhs->m_y - rhs->m_y; + pOut->m_z = lhs->m_z - rhs->m_z; + } +#endif + + Vec3f operator*(const float c); + + Vec3f operator/(const float c) { + return *this * (1 / c); + } + + Vec3f& operator+=(const Vec3f& v) { + *this = *this + v; + return *this; + } + + Vec3f& operator-=(const Vec3f& v) { + *this = *this - v; + return *this; + } + + Vec3f& operator*=(const float c) { + *this = *this * c; + return *this; + } + + float lengthSq(); + float length(); + float distance(Vec3f* v) { + Vec3f disp = *this - *v; + return disp.length(); + } + void normalize(); + void normalize(Vec3f* input); +}; +static_assert(sizeof(Vec3f) == 12, "Class is wrong size!"); + +class Rect2D { +public: + float m_left; + float m_right; + float m_up; + float m_down; +}; + +Vec3f operator*(const float c, const Vec3f& v); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector_old.h b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector_old.h new file mode 100644 index 0000000000..f5623032a3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mt/mt_vector_old.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +namespace vlRotateAxis { + enum Enum { + X = 1, + Y = 2, + Z = 4 + }; +} + +Vec3f* vlRotateFix(Vec3f* v, vlRotateAxis::Enum axis, float theta); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_difficulty.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_difficulty.h new file mode 100644 index 0000000000..2f19b3acd4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_difficulty.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +struct muAdvDifficultyTaskParam { + u32 unk0; + u32 unk4; + u32 unk8; +}; +static_assert(sizeof(muAdvDifficultyTaskParam) == 0xC, "Class is the wrong size!"); + +class muAdvDifficultyTask : public gfTask { +public: + u32 m_option; + u8 unk44[0x8]; + u32 m_difficulty; + + static muAdvDifficultyTask* create(const muAdvDifficultyTaskParam* p1); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_game_over.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_game_over.h new file mode 100644 index 0000000000..caba3bb383 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_game_over.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct muAdvGameOverTaskParam { + bool unk0; + u32 unk4; + adList* unk8; + adList* unkC; + adList* unk10; + adList* unk14; + adList* unk18; + adList* unk1C; +}; +static_assert(sizeof(muAdvGameOverTaskParam) == 0x20, "Size is the wrong size!"); + +struct muAdvGameOverTask : public utility::StandardMenu { + u8 unk40[0x16C]; + s32 unk1AC; + + virtual ~muAdvGameOverTask(); + virtual bool preLoad(); + virtual void loadResource(); + virtual bool checkLoadFinish() const; + virtual void createModel(); + virtual void update(); + + s32 getSelection() const; + + static muAdvGameOverTask* create(const muAdvGameOverTaskParam* param); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_name.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_name.h new file mode 100644 index 0000000000..69b81006cb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_name.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +struct muAdvNameTaskParam { + u32 unk0; + u32 unk4; + u32 unk8; + u32 unkC; +}; +static_assert(sizeof(muAdvNameTaskParam) == 0x10, "Class is the wrong size!"); + +class muAdvNameTask : public gfTask { +public: + static muAdvNameTask* create(const muAdvNameTaskParam* p1); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_result.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_result.h new file mode 100644 index 0000000000..827a1d456d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_result.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct muAdvResultTaskParam { + u32 m_mainPlayerPort; + u32 m_earnedCoinsForClear; + u32 m_scoreInCurrentStage; + u32 m_totalScore; + adList* unk10; + adList* unk14; + adList* unk18; +}; +static_assert(sizeof(muAdvResultTaskParam) == 0x1C, "Size is the wrong size!"); + +struct muAdvResultTask : public gfTask { + u32 unk40; + u8 unk44[0x560]; + bool unk5A4; + + static muAdvResultTask* create(const muAdvResultTaskParam* param); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_saveload.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_saveload.h new file mode 100644 index 0000000000..d90ba4b6af --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_saveload.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct muAdvSaveTaskParam { + u8 unk0; + u32 unk4; +}; +static_assert(sizeof(muAdvSaveTaskParam) == 0x8, "Size is the wrong size!"); + +struct muAdvSaveTask : public gfTask { + u32 unk40; + u8 unk44[0x174]; + s32 unk1B8; + u8 unk1BC[0x3E8]; + bool unk5A4; + + // TODO: type of p3 + static muAdvSaveTask* create(const muAdvSaveTaskParam* param, Heaps::HeapType p2, u32 p3); +}; +// TODO size + +struct muAdvLoadTaskParam { + u8 unk0; + u32 unk4; +}; +static_assert(sizeof(muAdvLoadTaskParam) == 0x8, "Size is the wrong size!"); + +struct muAdvLoadTask : public gfTask { + u32 unk40; + u8 unk44[0x174]; + s32 unk1B8; + u8 unk1BC[0x3E8]; + bool unk5A4; + + s32 isLoaded() const; + static muAdvLoadTask* create(const muAdvLoadTaskParam* param); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_seal.h b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_seal.h new file mode 100644 index 0000000000..4b83eeb97d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/adv/mu_adv_seal.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include + +struct muAdvSealTaskParam { + u32 unk0; + u32 unk4; +}; +static_assert(sizeof(muAdvSealTaskParam) == 0x8, "Size is the wrong size!"); + +struct muAdvSealTask : public gfTask { + u32 unk40; + + static void getResourcePackData(const char** ppath, u32* psize); + static muAdvSealTask* create(const muAdvSealTaskParam* param, gfArchive* arc); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/menu.h b/include/lib/BrawlHeaders/Brawl/Include/mu/menu.h new file mode 100644 index 0000000000..e0bf2b7352 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/menu.h @@ -0,0 +1,240 @@ +#pragma once + +#include +#include +#include +#include + +enum MuSelchkind { /* CSS */ + Selch_Mario=0, + Selch_Donkey=1, + Selch_Link=2, + Selch_Samus=3, + Selch_SZeroSuit=4, + Selch_Yoshi=5, + Selch_Kirby=6, + Selch_Fox=7, + Selch_Pikachu=8, + Selch_Luigi=9, + Selch_Captain=10, + Selch_Ness=11, + Selch_Koopa=12, + Selch_Peach=13, + Selch_Zelda=14, + Selch_Sheik=15, + Selch_Popo=16, + Selch_Marth=17, + Selch_GameWatch=18, + Selch_Falco=19, + Selch_Ganon=20, + Selch_Wario=21, + Selch_MetaKnight=22, + Selch_Pit=23, + Selch_Pikmin=24, + Selch_Lucas=25, + Selch_Diddy=26, + Selch_PokeTrainer=27, + Selch_PokeLizardon=28, + Selch_PokeZenigame=29, + Selch_PokeFushigisou=30, + Selch_Dedede=31, + Selch_Lucario=32, + Selch_Ike=33, + Selch_Robot=34, + Selch_Purin=35, + Selch_ToonLink=36, + Selch_Wolf=37, + Selch_Snake=38, + Selch_Sonic=39, + Selch_SelectNone=40, + Selch_Random=41, + Selch_Boss_BossPackun=45, + Selch_Boss_Rayquaza=46, + Selch_Boss_PorkyStatue=47, + Selch_Boss_Porky=48, + Selch_Boss_Galleom=49, + Selch_Boss_Ridley=50, + Selch_Boss_Duon=51, + Selch_Boss_MetaRidley=52, + Selch_Boss_Taboo=53, + Selch_Boss_MasterHand=54, + Selch_Boss_CrazyHand=55, + Selch_Zako_Boy=56, + Selch_Zako_Girl=57, + Selch_Zako_Child=58, + Selch_Zako_Ball=59 +}; + +enum MuStockchkind { /* Cosmetic */ + Stockch_Mario=0, + Stockch_Donkey=1, + Stockch_Link=2, + Stockch_Samus=3, + Stockch_Yoshi=4, + Stockch_Kirby=5, + Stockch_Fox=6, + Stockch_Pikachu=7, + Stockch_Luigi=8, + Stockch_Captain=9, + Stockch_Ness=10, + Stockch_Koopa=11, + Stockch_Peach=12, + Stockch_Zelda=13, + Stockch_Sheik=14, + Stockch_Popo=15, + Stockch_Marth=16, + Stockch_GameWatch=17, + Stockch_Falco=18, + Stockch_Ganon=19, + Stockch_Wario=20, + Stockch_MetaKnight=21, + Stockch_Pit=22, + Stockch_SZeroSuit=23, + Stockch_Pikmin=24, + Stockch_Lucas=25, + Stockch_Diddy=26, + Stockch_PokeTrainer=27, + Stockch_PokeLizardon=28, + Stockch_PokeZenigame=29, + Stockch_PokeFushigisou=30, + Stockch_Dedede=31, + Stockch_Lucario=32, + Stockch_Ike=33, + Stockch_Robot=34, + Stockch_Purin=35, + Stockch_ToonLink=37, + Stockch_ZeldaSheik=38, + Stockch_Wolf=39, + Stockch_Snake=40, + Stockch_Sonic=41, + Stockch_Random=42, + Stockch_Sandbag=43, + Stockch_Target=44, + Stockch_Boss_BossPackun=45, + Stockch_Boss_Rayquaza=46, + Stockch_Boss_PorkyStatue=47, + Stockch_Boss_Porky=48, + Stockch_Boss_Galleom=49, + Stockch_Boss_Ridley=50, + Stockch_Boss_Duon=51, + Stockch_Boss_MetaRidley=52, + Stockch_Boss_Taboo=53, + Stockch_Boss_MasterHand=54, + Stockch_Boss_CrazyHand=55, + Stockch_Zako_Boy=56, + Stockch_Zako_Girl=57, + Stockch_Zako_Child=58, + Stockch_Zako_Ball=59, + Stockch_Smash=60, + Stockch_SelectNone=61 +}; + +enum MuCharKind { /* Record Bank */ + Menu_Char_Mario=0, + Menu_Char_Donkey=1, + Menu_Char_Link=2, + Menu_Char_Samus=3, + Menu_Char_Yoshi=4, + Menu_Char_Kirby=5, + Menu_Char_Fox=6, + Menu_Char_Pikachu=7, + Menu_Char_Luigi=8, + Menu_Char_Captain=9, + Menu_Char_Ness=10, + Menu_Char_Koopa=11, + Menu_Char_Peach=12, + Menu_Char_Zelda=13, + Menu_Char_Popo=14, + Menu_Char_Falco=15, + Menu_Char_Ganon=16, + Menu_Char_Wario=17, + Menu_Char_MetaKnight=18, + Menu_Char_Pit=19, + Menu_Char_Pikmin=20, + Menu_Char_Lucas=21, + Menu_Char_Diddy=22, + Menu_Char_Dedede=23, + Menu_Char_Ike=24, + Menu_Char_Robot=25, + Menu_Char_Snake=26, + Menu_Char_PokeTrainer=27, + Menu_Char_Lucario=28, + Menu_Char_Marth=29, + Menu_Char_GameWatch=30, + Menu_Char_Purin=31, + Menu_Char_ToonLink=32, + Menu_Char_Wolf=33, + Menu_Char_Sonic=34 +}; + +enum MuStageKind { + Menu_Stage_Battle = 0, + Menu_Stage_Final = 1, + Menu_Stage_Dolpic = 2, + Menu_Stage_Mansion = 3, + Menu_Stage_MarioPast = 4, + Menu_Stage_Kart = 5, + Menu_Stage_Donkey = 6, + Menu_Stage_Jungle = 7, + Menu_Stage_Pirates = 8, + Menu_Stage_Oldin = 9, + Menu_Stage_Norfair = 10, + Menu_Stage_Orpheon = 11, + Menu_Stage_Crayon = 12, + Menu_Stage_Halberd = 13, + Menu_Stage_StarFox = 14, + Menu_Stage_Stadium = 15, + Menu_Stage_Tengan = 16, + Menu_Stage_FZero = 17, + Menu_Stage_Ice = 18, + Menu_Stage_GW = 19, + Menu_Stage_Emblem = 20, + Menu_Stage_Madein = 21, + Menu_Stage_Earth = 22, + Menu_Stage_Palutena = 23, + Menu_Stage_Famicom = 24, + Menu_Stage_NewPork = 25, + Menu_Stage_Village = 26, + Menu_Stage_MetalGear = 27, + Menu_Stage_GreenHill = 28, + Menu_Stage_PictChat = 29, + Menu_Stage_Plankton = 30, + Menu_Stage_DxShrine = 31, + Menu_Stage_DxYorster = 32, + Menu_Stage_DxGarden = 33, + Menu_Stage_DxOnett = 34, + Menu_Stage_DxGreens = 35, + Menu_Stage_DxCruise = 36, + Menu_Stage_DxCorneria = 37, + Menu_Stage_DxBigBlue = 38, + Menu_Stage_DxZebes = 39, + Menu_Stage_DxPStadium = 40, + Menu_Stage_Edit = 41 +}; + +class muMenu : public gfScene { + // int activeRumbleController; + // int globalRumbleSetting; + muMenuController m_menuControllers[5]; +public: + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void init(); + + static void loadMenuSound(); + static bool isLoadFinishMenuSound(); + static int exchangeSelchkind2SelCharVoice(int id); + static int exchangeSelCharVoice2SelCharVoiceLengthE(int id); + static int exchangeSelCharVoice2SelCharVoiceLengthJ(int id); + static int exchangeGmCharacterKind2MuStockchkind(int id); + static int exchangeGmCharacterKind2Something(int id); + static void startRumbleController(int controller, int rumbleStrength, int rumbleSetting); + static int exchangeMuSelchkind2MuStockchkind(int id); + static const char* exchangeMuStockchkind2MuCharName(int id); + static int getStockFrameID(int id); + static int getFighterColorFileNo(int charKind, int costumeID); + static int findCharTeamColorNo(int charKind, int teamColor, int teamSet); + + muMenu(const char* name) : gfScene(name) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menu_controller.h b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menu_controller.h new file mode 100644 index 0000000000..da13f32d1e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menu_controller.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +class muMenuController { +public: + char _unk[0xA8]; + + muMenuController(); + ~muMenuController(); +}; +static_assert(sizeof(muMenuController) == 0xA8, "Wrong size for class!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menuroot.h b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menuroot.h new file mode 100644 index 0000000000..75c7e2e311 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_menuroot.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include +#include +class MenuRoot : public gfTask { +public: + char spacer[0x08]; + nw4r::g3d::ScnGroup* scene; + + static MenuRoot* create(const char* name, int, const char* cameraPath); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/mu_msg.h b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_msg.h new file mode 100644 index 0000000000..fc867cb261 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_msg.h @@ -0,0 +1,75 @@ +#pragma once + +#include +#include +#include + +class MuMsg { +public: + enum AlignMode { + Align_Center = 0x0, + Align_Left = 0x1, + Align_Right = 0x2, + }; + +private: + class WindowSetting { + char _0[0x48]; + }; + static_assert(sizeof(WindowSetting) == 0x48, "Class is wrong size!"); + + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_isMsgDataSet : 1; + bool : 1; + bool : 1; + bool : 1; + s8 m_fontId; + char _2[2]; + void* m_msgData; + Message* m_message; + char _12[4]; + u32 m_numMsgs; + HeapType m_heapType; + int m_24; + +public: + bool allocMsgBuf(u32 msgSizes, u32 numMsgs); + void setMsgData(void* msgBinData); + const char* getMsgData(u32 msgIndex, int* msgLength); + void initWindowSetting(WindowSetting* windowSetting); + void attachScnMdlSimple(u32 msgIndex, nw4r::g3d::ScnMdlSimple* sceneModel, u32 boneTextIndex, float fontSize); + void attachMuObject(u32 lineIndex, MuObject* muObject, const char* format, float f1, float f2, float f3, float f4, float f5); + void detachMuObject(MuObject* muObject); + void setFontWidthModeAuto(u32 msgIndex); + void setFontWidthModeProportional(u32 msgIndex); + void setFontWidthModeFixed(u32 msgIndex); + void setAlignMode(u32 msgIndex, AlignMode alignMode); + void setVerticalMode(u32 msgIndex, bool isVertical); + void setFontColor(u32 msgIndex, u8 r, u8 g, u8 b, u8 a); + void setHSpace(u32 msgIndex, float); + void setWScale(u32 msgIndex, float); + void getWScale(u32 msgIndex, float); + void setHScale(u32 msgIndex, float); + void getHScale(u32 msgIndex, float); + void setDelayPrint(u32 msgIndex, float, float, float, float); + bool isEndDelayPrint(u32 index); + void setEdgeEnable(u32 msgIndex, bool edgeEnable); + void setEdge(u32 msgIndex, u8 r, u8 g, u8 b, float); + void setFontType(u32 msgIndex, u32 fontType); + // void FUN_800b9448(u32 msgIndex, bool); + // void FUN_800b9460(u32 msgIndex, u8, u8, u8, float); + void beginPrint(u32 msgIndex); + void printf(u32 msgIndex, const char* format, ...); + bool printIndex(u32 msgIndex, u32 lineIndex, void* msgBinData = NULL); + void setWindowRectVisible(u32 msgIndex, bool isVisible); + + static MuMsg* create(u32 fontSetting, HeapType heapType, HeapType heapType2); + // CSS: HeapType 1 = 42, HeapType 2 = 43. + // Game: both 40 + // Photo: both 42 + ~MuMsg(); +}; +static_assert(sizeof(MuMsg) == 0x1c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/mu_object.h b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_object.h new file mode 100644 index 0000000000..673e6dc3a7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/mu_object.h @@ -0,0 +1,105 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class MuObject { + +public: + char unk[0x4]; + nw4r::g3d::ResFile m_resFile; + nw4r::g3d::ResMdl m_resMdl; + nw4r::g3d::ScnMdl* m_scnMdl; + nw4r::g3d::ScnMdl* m_sceneModel; + gfModelAnimation* m_modelAnim; + char unk2[0x44]; + + static MuObject* create(nw4r::g3d::ResFile* modelSource, const char* modelNode, int drawPriority, nw4r::g3d::ResFile* textureSource, HeapType type); + static MuObject* create(nw4r::g3d::ResFile* modelSource, int modelNode, nw4r::g3d::ResFile* textureSource, int animNode, HeapType type); + MuObject* copy(int modelNode, int animNode, HeapType type); + + void enableSkipMatrix(bool enableSkip); + void enableSkipMaterial(bool enableSkip); + void calcMatrix(); + + void changeAnimN(const char* animName); + void changeNodeAnimN(const char* animName); + void changeClrAnimN(const char* animName); + void changeVisAnimN(const char* animName); + void changeTexPatAnimN(const char* animName); + void changeTexSrtAnimN(const char* animName); + + void changeAnimNIf(const char* animName); + void changeNodeAnimNIf(const char* animName); + void changeClrAnimNIf(const char* animName); + void changeVisAnimNIf(const char* animName); + void changeTexPatAnimNIf(const char* animName); + void changeTexSrtAnimNIf(const char* animName); + + void setFrame(float frame); + void setFrameVisible(float frame); + void setFrameMatCol(float frame); + void setFrameTex(float frame); + void setFrameTexSrt(float frame); + void setFrameFlg(float frame, u8 flagFilter); // 1 CHR, 2 VIS, 4 PAT, 8 SRT, 10 CLR. SHP not supported + void setFrameNode(float frame); + void setUpdateRateFlg(float updateRate, u8 flagFilter); + + void changeMaterialTex(int matNode, int texNode, nw4r::g3d::ResFile* textureSource = nullptr); + void changeMaterialTex(int matNode, const char* textureName, nw4r::g3d::ResFile* textureSource = nullptr); + // void anmPlayPolicyOneTime(float, float, float); + + void getNode(int objNode); + void getNodeID(const char* nodeName); + void getRect3D(Rect2D* rectangle, int nodeA, int nodeB); + void getRect3D(Rect2D* rectangle, const char* nodeNameA, const char* nodeNameB); + + void getPos(Vec3f* pos); + void getPos(Vec3f* pos, const char* nodeName); + void setPos(Vec3f* pos); + void setPos(Vec3f* pos, const char* nodeName); + void setTrans(Vec3f* trans); + + // Vec3f getGlobalPostiion(int resNode); //Ambiguous with below? + Vec3f getGlobalPosition(int resNode); + Vec3f getGlobalPosition(); + + void getAnimScale(Vec3f* scl, const char* name); + void setScale(Vec3f* scl); + void setScale(const char* name, Vec3f* scl); + void getScale(Vec3f* scl, const char* name); + void setObjScale(Vec3f* scl); + Vec3f getObjScale(); + + void setObjRotate(Vec3f* rot); + void getRotate(Vec3f* rot, const char* name); + void setRotate(Vec3f* rot, const char* name); + + const char* getNodeAnimName(); + const char* getVisAnimName(); + const char* getTexPatAnimName(); + const char* getTexSrtAnimName(); + const char* getClrAnimName(); + + int isNodeAnimFinished(); + int isVisAnimFinished(); + int isClrAnimFinished(); + int isAnimFinished(); + bool isNodeAnimLoop(); + + virtual ~MuObject(); +}; +static_assert(sizeof(MuObject) == 0x60, "Class is wrong size!"); + +class muObjProcessTask { +public: + char unk[0x44]; + + static muObjProcessTask* create(HeapType type); + virtual ~muObjProcessTask(); +}; +static_assert(sizeof(muObjProcessTask) == 0x48, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar.h new file mode 100644 index 0000000000..35a10d9f80 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include + +class muSelCharPlayerArea; + +enum TeamBattleType { // custom + Team_Battle_None = 0, + Team_Battle_Normal = 1, + Team_Battle_Glow = 2, + Team_Battle_Random = 3 +}; + +class muSelCharCBCalcWorld { +public: + virtual ~muSelCharCBCalcWorld(); + virtual void ExecCallback_CALC_WORLD(u32, u32); + virtual void ExecCallback_CALC_MAT(u32); + virtual void ExecCallback_CALC_VIEW(u32); + virtual void ExecCallback_DRAW_OPA(u32); + virtual void ExecCallback_DRAW_XLU(u32); + + char _0[0x8]; +}; + +class muSelCharTask : public gfTask { +public: + const static u8 num_player_areas = 4; + + char _0x40[4]; + muSelCharPlayerArea* m_selCharPlayerAreas[num_player_areas]; + char _0x54[0x577]; + TeamBattleType m_teamBattleType : 8; // custom + char _0x5CF[0x88]; + + virtual void processDefault(); + virtual ~muSelCharTask(); + + void dispHighScore(int, int, int); +}; + +static_assert(sizeof(muSelCharTask) == 0x654, "Wrong size for class!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_coin.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_coin.h new file mode 100644 index 0000000000..7327d72ff6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_coin.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +class muSelCharPlayerArea; +class muSelCharHand; + +class muSelCharCoin { +public: + char _0x0[0x10]; + muSelCharHand* m_selCharHand; + muSelCharPlayerArea* m_selCharPlayerArea; + char _0x18[0x8]; +}; +static_assert(sizeof(muSelCharCoin) == 0x20, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_hand.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_hand.h new file mode 100644 index 0000000000..93f072570f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_hand.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include +#include + +class muSelCharPlayerArea; + +class muSelCharHand : public gfTask { +public: + char _0x40[0x5C]; + muSelCharPlayerArea* m_selCharPlayerArea; + muSelCharCoin* m_selCharCoin; + int m_mode; + char _0xa0[0x4]; + int m_collKind; + char _0xb0[0x18]; + int m_bButtonCnt; + float _0xcc; + char _0xd0[0x10]; + + virtual void processDefault(); + virtual ~muSelCharHand(); +}; +static_assert(sizeof(muSelCharHand) == 0xe0, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_player_area.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_player_area.h new file mode 100644 index 0000000000..b59c68d645 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_selchar_player_area.h @@ -0,0 +1,72 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class muSelCharCBCalcWorld; + +class muSelCharPlayerArea { +protected: +public: + u32 _0; + muMenuController m_menuController; + char _0xAC[0x4]; + MuObject* m_muBackplate; + MuObject* m_muPlayerNum; + MuObject* m_muFranchiseIcon; + MuObject* m_muFrag; + MuObject* m_muCharPic; + MuObject* m_muUnk; + MuObject* m_muCharName; + MuObject* m_muTagBtn; + MuObject* m_muNameplate; + MuObject* m_muHandicap; + MuObject* m_muComputerLvl; + char _0xDC[0x74]; + void* m_objProcTask; + muSelCharCBCalcWorld m_calcWorldCBs[MAX_PLAYERS]; + muSelCharHand* m_selCharHand; + muSelCharCoin* m_selCharCoin; + int m_areaIdx; + int m_playerKind; + MuSelchkind m_charKind; + int m_charColorNo; + int m_teamColor; + u8 m_teamSet; + char _0x1C5[3]; + int m_nameId; + char _0x1CC[0x10]; + int m_controllerNo; + gfPadType::PadType m_controllerKind; + char _0x1E4[0x4]; + int m_selectedZelda; + int m_selectedSamus; + int m_selectedPoke; + muSelCharTask* m_selCharTask; + char _0x1F8[0x4]; + MuSelctChrList m_chrList; + char _0x35C[0x14]; + MuSelctChrNameEntry m_nameEntry; + char _0x404[0x34]; + nw4r::g3d::ResFileData* m_charPicData; + nw4r::g3d::ResFile m_charPicRes; + char _0x440[0x8]; + + void setCharPic(int charKind, int playerKind, int curCostume, bool isTeamBattle, int teamColor, int unk); + nw4r::g3d::ResFile* getCharPicTexResFile(int charKind); + bool isTeamBattle(); + u8 exchangeCharKindDetail(MuSelchkind selCharKind); + void dispMarkKind(MuSelchkind charKind); + void setCharKind(MuSelchkind charKind); +}; +static_assert(sizeof(muSelCharPlayerArea) == 0x448, "Wrong size for class!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_list.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_list.h new file mode 100644 index 0000000000..a476491499 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_list.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class MuSelctChrList { +public: + char _0[0x160]; +}; + +static_assert(sizeof(MuSelctChrList) == 0x160, "Wrong size for class!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_name_entry.h b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_name_entry.h new file mode 100644 index 0000000000..cf11fa215f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/selchar/mu_select_character_name_entry.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class MuSelctChrNameEntry { +public: + char _0[0x94]; +}; + +static_assert(sizeof(MuSelctChrNameEntry) == 0x94, "Wrong size for class!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_interface.h b/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_interface.h new file mode 100644 index 0000000000..4e9ccd31ee --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_interface.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +class muWifiInterfaceTask : public gfTask { + char _0x40[0x1018]; + +public: + virtual void processDefault(); + virtual ~muWifiInterfaceTask(); + virtual void exit(); + + void connect(bool); + static muWifiInterfaceTask* create(); + +}; +static_assert(sizeof(muWifiInterfaceTask) == 0x1058, "Class is wrong size!"); + +void netReport(const char* fmt, ...); +void netReport0(const char* fmt, ...); + +extern muWifiInterfaceTask* g_muWifiInterfaceTask; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_time_result.h b/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_time_result.h new file mode 100644 index 0000000000..226d0ea7e1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mu/wifi/mu_wifi_time_result.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +struct muWifiTimeResultTaskParam { + u32 unk0; + u32 unk4; + u32 unk8; + u32 unkC; + u32 unk10; + u32 unk14; + u32 unk18; + + muWifiTimeResultTaskParam() { + unk0 = 0; + unk4 = 0; + unk8 = 0; + unkC = 0; + unk10 = 0; + unk14 = 0; + unk18 = 0; + } +}; +static_assert(sizeof(muWifiTimeResultTaskParam) == 0x1C, "Class is the wrong size!"); + +class muWifiTimeResultTask : public gfTask { +public: + static muWifiTimeResultTask* create(const muWifiTimeResultTaskParam* p1); +}; +// TODO size diff --git a/include/lib/BrawlHeaders/Brawl/Include/mv/THPAudio.h b/include/lib/BrawlHeaders/Brawl/Include/mv/THPAudio.h new file mode 100644 index 0000000000..2b2be088ff --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mv/THPAudio.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +u32 THPAudioDecode(void* p1, void* p2, u32 p3); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPAudioDecode.h b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPAudioDecode.h new file mode 100644 index 0000000000..4126b2f3b3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPAudioDecode.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include + +// TODO type +struct AudioDecMessage { + void* unk0; + u32 unk4; + u32 unk8; + u8 unkC[0xC]; +}; +// TODO size assertion + +struct THPReadBuffer { + static void AudioDecode(AudioDecMessage*); +}; + +// TODO type +struct THPAudioDecWork { + static const u32 StackSize = 0x1000; + static const u32 BufferCap = 6; + BOOL m_threadActive; + OSThread m_thread; + char m_stack[StackSize]; // 0x320 + OSMessageQueue m_freeAudioQueue; + OSMessageQueue m_decodedAudioQueue; + OSMessage m_freeAudioBuf[BufferCap]; + OSMessage m_decodedAudioBuf[BufferCap]; +}; +// TODO size assertion + +u32 GetSizeTHPAudioDecWork(); +void SetTHPAudioDecWork(THPAudioDecWork* work); +void FreeTHPAudioDecWork(); +bool CreateAudioDecodeThread(s32 prio, void* funcArg); +void AudioDecodeThreadStart(); +void AudioDecodeThreadCancel(); +void* AudioDecoder(void* p1); +void* AudioDecoderForOnMemory(void* p1); +void PushFreeAudioBuffer(OSMessage p1); +OSMessage PopDecodedAudioBuffer(u32 flags); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPPlayer.h b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPPlayer.h new file mode 100644 index 0000000000..b37107c415 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPPlayer.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include + +// TODO: THPPlayer? Likely has more members +struct UnkTHPClass { + struct UnkClass { + u32 length; + s8 buf[0x10]; + }; + DVDFileInfo m_fInfo; + char unk3C[4]; + u32 unk40; + u32 unk44; + u32 unk48; + float unk4C; + u32 unk50; + u32 unk54; + u32 unk58; + u32 unk5C; + s32 unk60; + s32 unk64; + s32 unk68; + UnkClass unk6C; + u8 unk80[0x26]; + u8 unkA6; + u8 unkA7[0x1]; + s32 unkA8; // read error indicator + u8 unkAC[0x8]; + u32* unkB4; + u32 unkB8; // initial read offset + u32 unkBC; // initial read size + u32 unkC0; + u8 unkC4[0x18]; + u32 unkDC; +}; +// TODO: size assertion + +void PrepareReady(bool p1); + +extern UnkTHPClass g_thpObject; diff --git a/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPRead.h b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPRead.h new file mode 100644 index 0000000000..fac367ed0c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_THPRead.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include + +struct THPReadBlock { + s32 m_nextBlockSize; + // data... +}; +// TODO size + +struct THPReadMessage { + THPReadBlock* m_block; + s32 m_blockNum; +}; +// TODO size + +struct THPReadWork { + static const u32 StackSize = 0x1000; + static const u32 BufferCap = 6; + BOOL m_threadActive; + OSMessageQueue m_freeReadQueue; + OSMessageQueue m_pastReadQueue; + OSMessageQueue m_pastRead2Queue; + OSMessage m_freeReadBuf[BufferCap]; + OSMessage m_pastReadBuf[BufferCap]; + OSMessage m_pastRead2Buf[BufferCap]; + OSThread m_thread; + char m_stack[StackSize]; +}; +static_assert(sizeof(THPReadWork) == 0x13C8, "Class is the wrong size!"); + +u32 GetSizeTHPReadWork(); +void SetTHPReadWork(THPReadWork* work); +void FreeTHPReadWork(); +bool CreateReadThread(s32 prio, void* funcArg); +void ReadThreadStart(); +void ReadThreadCancel(); +OSMessage PopReadedBuffer(); +void PushReadedBuffer(OSMessage msg); +OSMessage PopFreeReadBuffer(); +void PushFreeReadBuffer(OSMessage msg); +OSMessage PopReadedBuffer2(); +void PushReadedBuffer2(OSMessage msg); diff --git a/include/lib/BrawlHeaders/Brawl/Include/mv/mv_movie_player.h b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_movie_player.h new file mode 100644 index 0000000000..d8bbf9e7cd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/mv/mv_movie_player.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +class mvMoviePlayer { +public: + static mvMoviePlayer* getInstance(); + bool isPause() const; + void setPause(); + void resetPause(); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/d_net_connect.h b/include/lib/BrawlHeaders/Brawl/Include/nt/d_net_connect.h new file mode 100644 index 0000000000..5d71ef4c68 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/d_net_connect.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include + +#define AF_INET 0x2 + +#define SOCK_STREAM 0x1 +#define SOCK_DGRAM 0x2 + +#define INADDR_ANY 0x0 + +#define MSG_PEEK 0x2 +#define MSG_DONTWAIT 0x40 +#define MSG_WAITALL 0x100 + +struct in_addr { + unsigned long s_addr; // load with inet_aton() +}; + +struct sockaddr_in { + short sin_family; // e.g. AF_INET + unsigned short sin_port; // e.g. htons(3490) + struct in_addr sin_addr; // see struct in_addr, below +}; + +s32 dNetConnect_Start(); +void dNetConnect_Finish(); diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_dwc.h b/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_dwc.h new file mode 100644 index 0000000000..fcca653efa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_dwc.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include +#include +#include + +class nteDWC : public gfTask, public nteSODone { + // TODO: ID this class + struct Unk60Class { + virtual void func0(s32 p1); + }; + + OSMutex m_mutex; + u32 m_loggedIn; + Unk60Class* unk60; + nteSODone* unk64; // TODO: confirm type + bool m_initialized; + u32 unk6C; // TODO: it's an index into a URL table + nteSO m_socketHandler; + const char* m_name; + u32 m_appCode; + +public: + nteDWC(); + virtual void processDefault(); + virtual ~nteDWC(); + virtual void notifyDoneSOProc(nteSODone::NotifType nType, s32 code); + + bool startupDWC(); + bool finishDWC(); + bool login(s32 p1, s32 p2, s32 p3, s32 p4); + bool logout(); + bool isOnline() const; + s64 getTime() const; + + static void* AllocEx(int heap, size_t size, int align); + static void FreeEx(int heap, void*, int unused = 0); + static void callbackLogin(s32 p1, s32 p2, void* p3); +}; +static_assert(sizeof(nteDWC) == 0x3C8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_so.h b/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_so.h new file mode 100644 index 0000000000..89b104fe62 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/etc/nt_etc_so.h @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include + +class nteSODone { +public: + enum NotifType { + Startup, + Finish + }; + + virtual void notifyDoneSOProc(NotifType notifType, s32 errCode); +}; + +class nteSO : public gfThread { + enum Action { + NoAction, + DoStartup, + DoFinish + }; + + Action m_action; + bool m_isAlive; + nteSODone* m_actionDoneNotifier; + u32 m_startupParam; +public: + nteSO(); + ~nteSO(); + virtual void run(); + bool startup(nteSODone* doneNotifier, u32 startupParam); + bool finish(nteSODone* doneNotifier); + static void* SOAlloc(int _unused, u32 size); + static void SOFree(int _unused, void* ptr); + static void showError(s32 code); +}; +static_assert(sizeof(nteSO) == 0x350, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/network.h b/include/lib/BrawlHeaders/Brawl/Include/nt/network.h new file mode 100644 index 0000000000..c0867ad02e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/network.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class NtShared { +public: + typedef void (*ntConsumedDataCallback_t)(const u16*); + static void ntSetConsumedDataCallback(ntConsumedDataCallback_t cb) { + NtConsumedDataCallback = cb; + } +private: + static ntConsumedDataCallback_t NtConsumedDataCallback; +}; +// TODO size + +class ntResetCallback { + virtual void userProc(); + virtual ~ntResetCallback(); +}; + +class ntReturnStatusCallback { + virtual bool returnStatus(); +}; + +class ntShutdown : public ntReturnStatusCallback { +public: + virtual bool returnStatus(); +}; + +class Network { +public: + virtual ~Network(); + void create(bool); + +private: + char _0x4[0x3C]; +}; +static_assert(sizeof(Network) == 0x40, "Class is wrong size!"); + +extern Network g_Network; diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/nt_match.h b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_match.h new file mode 100644 index 0000000000..dcae217621 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_match.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class DWCAllocType { +public: + static void* ntAlloc(int, u32, u32); + static void ntFree(int, void*); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/nt_offline.h b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_offline.h new file mode 100644 index 0000000000..9e6f0fba40 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_offline.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include + +// TODO: ntFriendInfoSave? +class UnkFriendInfo { + struct UnkClass1 { + u8 unk0; + u8 unk1; + u8 unk2[0x2]; + }; + + // TODO: First 8 bytes likely hold the 16-digit Wii Number + struct UnkClass2 { + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5; + u8 unk6; + u8 unk7; + u8 unk8[0x81]; + }; +public: + static const u32 FriendRosterLimit = 64; + + u8 unk0[0x350]; + UnkClass1 unk350[FriendRosterLimit]; + u8 unk450[0x163]; + UnkClass2 unk5B3[FriendRosterLimit]; +}; +// TODO size assertion + +class ntFriendInfo { + +public: + UnkFriendInfo* getFriendInfo(); + static ntFriendInfo* getInstance(); +}; +// TODO size assertion + +class NtOffline { +public: + NtOffline(); + virtual ~NtOffline(); + u32 getFriendIndexHaveWiiID(u64 id); + + u32 unk4; +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/nt_report.h b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_report.h new file mode 100644 index 0000000000..75db9df17c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_report.h @@ -0,0 +1,120 @@ +#pragma once + +#include +#include +#include +#include +#include + +// TODO: determine the header these belong to +extern s32 gUnk805a03d8; // TODO: network status code? +extern s32 g_NtMatchingStatus; + +struct NtBlock { + float unk0; + float unk4; + + NtBlock() : unk0(0.0f), unk4(0.0f) { } +}; +static_assert(sizeof(NtBlock) == 0x8, "Class is the wrong size!"); + +struct NtBuffer { + NtBuffer() : m_size(0), unk8(0), unkC(false), m_buf(nullptr) { } + + virtual ~NtBuffer() { + freeBuffer(); + } + + virtual void allocBuffer(u32 size, Heaps::HeapType heapType) { + m_buf = gfHeapManager::alloc(heapType, size); + m_size = size; + unk8 = 0; + } + + virtual void freeBuffer() { + if (!unkC && m_buf) + gfHeapManager::free(m_buf); + m_buf = nullptr; + m_size = 0; + unk8 = 0; + } + + u32 m_size; + s32 unk8; + bool unkC; + void* m_buf; +}; +static_assert(sizeof(NtBuffer) == 0x14, "Class is the wrong size!"); + +struct NtBase { + NtBase() : unk4(0) { } + virtual ~NtBase() { } + static bool isMatchStatusOnline(); + + s32 unk4; +}; + +class NtReport : public NtBase { + struct UnkArr1 { + u8 unk0[0xD]; + }; + + struct UnkArr2 { + u8 unk0[0xB]; + }; + + struct UnkArr3 { + u8 unk0[0x29]; + }; + + struct UnkArrContainer { + UnkArr1 unk1C; + s32 unk2C; + UnkArr2 unk30; + s32 unk3C; + UnkArr3 unk40; + s32 unk6C; + + UnkArrContainer() : unk2C(0), unk3C(0), unk6C(0) { + memset(&unk1C, 0x30, sizeof(unk1C)); + unk1C.unk0[sizeof(unk1C) - 1] = 0; + + memset(&unk30, 0x20, sizeof(unk30)); + unk30.unk0[sizeof(unk30) - 1] = 0; + + memset(&unk40, 0x20, sizeof(unk40)); + unk40.unk0[24] = 0; + } + }; + + u8 unk8[0xC]; + s32 unk14; + s32 unk18; + UnkArrContainer unk1C; + u8 unk70[0x40]; + s32 unkB0; + u8 unkB4[0x8]; + s32 unkBC; + bool unkC0; + s16 unkC2; + s16 unkC4; + NtBuffer unkC8; + NtBuffer unkDC; + NtBuffer unkF0; + u8 unk104[0x4]; + bool unk108; + s32 unk10C; +public: + // NONMATCHING regswaps and slight instruction ordering issue + // in nt_report.cpp's static initializer + NtReport() : unkB0(0), unkC0(false), unkC4(0), unk108(false) { } + virtual ~NtReport() { } + void report(const char* fmt, ...); + void createWork(); + void destroyWork(); + + static OSMutex s_ReportMutex; +}; +static_assert(sizeof(NtReport) == 0x110, "Class is the wrong size!"); + +void flushLogToSDCard(); diff --git a/include/lib/BrawlHeaders/Brawl/Include/nt/nt_send.h b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_send.h new file mode 100644 index 0000000000..36a3e5af72 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/nt/nt_send.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include + +struct NtPacketData { + static const s32 MaxPacketSize = 0x37E; + static const s32 TickFieldSize = 0x4; + static const s32 PadAlign = 0x2; + u8 data[MaxPacketSize + TickFieldSize + PadAlign]; +}; +static_assert(sizeof(NtPacketData) == 0x384, "Class is the wrong size!"); + +struct NtPacket { + u8 aid; + u32 size; + NtPacketData* rawData; +}; +static_assert(sizeof(NtPacket) == 0xC, "Class is the wrong size!"); + +class NtSend { + static const u32 Capacity = 0x40; + typedef NtPacket (*NtPacketArrPtr)[Capacity]; + + OSMutex m_mutex; + OSCond m_cond; + NtPacketArrPtr m_pktBuffer; // Circular queue of packets to be sent + NtBuffer m_pktMemory; // Backing memory for m_pktBuffer + s32 m_startIdx; + s32 m_endIdx; + NtBuffer m_pktMemory2; // NOTE: unused? +public: + void create(); + void destroy(); + void clearSendBuffer(); + s32 pushback(u8 aid, const void* packetData, s32 packetSize); + void task() volatile; +}; +static_assert(sizeof(NtSend) == 0x54, "Class is the wrong size!"); + +extern NtSend* g_NtSend; + +// TODO move +extern u32 g_NtAIDBitmap; diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_diff.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_diff.h new file mode 100644 index 0000000000..39a501e5fc --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_diff.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include +#include + +class scAdvDiff : public gfScene { + muAdvDifficultyTask* m_task; +public: + static scAdvDiff* create(); + scAdvDiff(const char* name) : gfScene(name), m_task(nullptr) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvDiff) == 0xC, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_gameover.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_gameover.h new file mode 100644 index 0000000000..76eecd53f8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_gameover.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class scAdvGameover : public gfScene { + muAdvGameOverTask* m_task; + bool unkC; + adList unk10; + adList unk24; + adList unk38; + adList unk4C; + adList unk60; + adList unk74; +public: + static scAdvGameover* create(); + scAdvGameover(const char* name) : gfScene(name), m_task(nullptr), unkC(true) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvGameover) == 0x88, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_name.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_name.h new file mode 100644 index 0000000000..626b531c66 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_name.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include +#include +#include + +class scAdvName : public gfScene { + muAdvNameTask* unk8; + u32 unkC; + u32 unk10; + gfFileIOHandle unk14; + u32 unk18; + s32 unk1C; +public: + static scAdvName* create(); + scAdvName(const char* name) : gfScene(name), unk8(nullptr), unkC(0), + unk10(0), unk18(0) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvName) == 0x1C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_result.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_result.h new file mode 100644 index 0000000000..86211c1496 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_result.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class scAdvResult : public gfScene { + muAdvResultTask* m_task; + u32 m_mainPlayerPort; + u32 m_earnedCoinsForClear; + u32 m_scoreInCurrentStage; + u32 m_totalScore; + u32 unk1C; + adList unk20; + adList unk34; + adList unk48; +public: + static scAdvResult* create(); + scAdvResult(const char* name) : gfScene(name), m_task(nullptr), + m_mainPlayerPort(0), m_earnedCoinsForClear(0), + m_scoreInCurrentStage(0), m_totalScore(0), unk1C(0) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvResult) == 0x5C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_saveload.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_saveload.h new file mode 100644 index 0000000000..2aa2ab8cc6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_saveload.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include +#include +#include + +class scAdvSave : public muMenu { + u8 unk350[0xC]; + muAdvSaveTask* m_task; + adAutoSave* m_autosave; +public: + static scAdvSave* create(); + scAdvSave(const char* name) : muMenu(name), m_task(nullptr) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvSave) == 0x364, "Class is the wrong size!"); + +class scAdvLoad : public muMenu { + u8 unk350[0xC]; + muAdvLoadTask* m_task; +public: + static scAdvLoad* create(); + scAdvLoad(const char* name) : muMenu(name), m_task(nullptr) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scAdvLoad) == 0x360, "Class is the wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_selchar.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_selchar.h new file mode 100644 index 0000000000..9aab80ff25 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_adv_selchar.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class scAdvSelChar : public gfScene { +public: + static scAdvSelChar* create(); + scAdvSelChar(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); +}; +static_assert(sizeof(scAdvSelChar) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_demo.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_demo.h new file mode 100644 index 0000000000..610e102788 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_demo.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class scDemo : public gfScene { +public: + static scDemo* create(); + scDemo(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); +}; +static_assert(sizeof(scDemo) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_melee.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_melee.h new file mode 100644 index 0000000000..b8f3e9be64 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_melee.h @@ -0,0 +1,53 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include + +class scMelee : public gfScene { +public: + void* m_loaderPlayers[MAX_PLAYERS]; + void* m_loaderStage; + char _40[12]; + void* m_loaderStageStarFox; + char _56[8]; + void* m_operatorBgm; + void* m_operatorAppearanceFighter; + void* m_operatorReadyGo; + void* m_operatorReadyGoSuddenDeath; + stOperatorDropItemMelee* m_operatorDropItem; + stOperatorRule* m_operatorRuleGameMode; + stOperatorRuleMelee* m_operatorRuleMelee; + void* m_operatorNoContest; + void* m_operatorNetwork; + void* m_operatorController; + stOperatorInfo* m_operatorInfo; + void* m_operatorFighterRebirths[MAX_PLAYERS]; + void* m_operatorFighterChange; + void* m_operatorDefeatBoss; + void* m_operatorEndProduction; + void* m_operatorAppearanceHelper; + char _152[4]; + void* m_operatorDebugIntrusions[2]; + void* m_operatorDebugFighterReset; + void* m_operatorDebugStagePause; + void* m_eventRule; + char _176[36]; + int m_endNum; + char _216[12]; + GameRule m_gameRule; + char _232[24]; + + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual ~scMelee(); + virtual int getEndNum(); +}; +static_assert(sizeof(scMelee) == 256, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_net_time_result.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_net_time_result.h new file mode 100644 index 0000000000..8b0ee4780b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_net_time_result.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include +#include + +class scNetTimeResult : public gfScene { + muWifiTimeResultTask* m_task; + muWifiTimeResultTaskParam m_taskParam; +public: + static scNetTimeResult* create(); + scNetTimeResult(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scNetTimeResult) == 0x28, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_scene_init.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_scene_init.h new file mode 100644 index 0000000000..b9fbcf5257 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_scene_init.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +void scSystemRegisterScene(); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_disp.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_disp.h new file mode 100644 index 0000000000..9216eba568 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_disp.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class scSealDisp : public gfScene { + muAdvSealTask* m_task; + s32 m_state; + gfArchive* m_archive; + gfResourceLoader* m_loader; +public: + static scSealDisp* create(); + scSealDisp(const char* name) : gfScene(name), m_task(nullptr), m_state(-1), + m_archive(nullptr), m_loader(nullptr) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scSealDisp) == 0x18, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_list.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_list.h new file mode 100644 index 0000000000..1951d11945 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_seal_list.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include + +class scSealList : public gfScene { + tySealListTask* m_task; +public: + static scSealList* create(); + scSealList(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); +}; +static_assert(sizeof(scSealList) == 0xC, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_sel_char.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_sel_char.h new file mode 100644 index 0000000000..12b548953d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_sel_char.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include +#include + +class scSelChar : public gfScene { +public: + muMenuController m_menuControllers[5]; + char _0x350[0xB0]; + muSelCharTask* m_selCharMenu; + char _0x404[0x18]; + + virtual void start(); + virtual s32 process(); + virtual s32 exit(); + virtual void setModule(); + virtual ~scSelChar(); +}; +static_assert(sizeof(scSelChar) == 0x41c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_staffroll.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_staffroll.h new file mode 100644 index 0000000000..fdcfd277cb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_staffroll.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class scStaffRoll : public gfScene { +public: + static scStaffRoll* create(); + scStaffRoll(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); +}; +static_assert(sizeof(scStaffRoll) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sc/sc_tutorial.h b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_tutorial.h new file mode 100644 index 0000000000..4b24004a57 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sc/sc_tutorial.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class scTutorial : public gfScene { +public: + static scTutorial* create(); + scTutorial(const char* name) : gfScene(name) { } + virtual void start(); + virtual s32 process(); + virtual s32 exit(); +}; +static_assert(sizeof(scTutorial) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/snd/snd_3d_generator.h b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_3d_generator.h new file mode 100644 index 0000000000..257ddded83 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_3d_generator.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include + +class snd3DGenerator { + nw4r::snd::Sound3DActor* m_sndActor; + +public: + snd3DGenerator(); + virtual ~snd3DGenerator(); + + s32 playSE(SndID sndID, int unk, int unk2, int unk4); + s32 prepareSE(SndID p1, s32 p2); + void startSE(s32 p1, s32 p2); + void setPos(Vec3f* pos); + void stopSE(s32 p1, s32 p2); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/snd/snd_id.h b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_id.h new file mode 100644 index 0000000000..0eaf3db337 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_id.h @@ -0,0 +1,10680 @@ +#pragma once + +#include +#include + +enum SndID { + snd_se_invalid = -0x1, + snd_se_system_cursor = 0x0, + snd_se_system_fixed = 0x1, + snd_se_system_cancel = 0x2, + snd_se_system_Beep = 0x3, + snd_se_system_SnapShot = 0x4, + snd_se_system_InfoWindow_Open = 0x5, + snd_se_system_InfoWindow_Close = 0x6, + snd_se_system_ScrollBar = 0x7, + snd_se_system_Plate_Catch = 0x8, + snd_se_system_Plate_Off = 0x9, + snd_se_common_Countdown = 0xA, + snd_se_common_JustDefense = 0xB, + snd_se_common_ShieldReflect = 0xC, + snd_se_common_JustImpact = 0xD, + snd_se_common_Step_Metal = 0xE, + snd_se_common_Hit_Muteki = 0xF, + snd_se_common_Sousatu = 0x10, + snd_se_common_Waring_Out = 0x11, + snd_se_common_LifeUp = 0x12, + SND_SE_SYSTEM_FIXED_L = 0x13, + SND_SE_SYSTEM_CURSOR_L = 0x14, + snd_se_system_019 = 0x15, + snd_se_audience_suddendeath = 0x16, + snd_se_Audience_Doyomeki_l = 0x17, + snd_se_Audience_Doyomeki_m = 0x18, + snd_se_Audience_Doyomeki_s = 0x19, + snd_se_Audience_Kansei_l = 0x1A, + snd_se_Audience_Kansei_m = 0x1B, + snd_se_Audience_Kansei_s = 0x1C, + snd_se_Audience_Hakusyu_l = 0x1D, + snd_se_Audience_Hakusyu_m = 0x1E, + snd_se_Audience_Hakusyu_s = 0x1F, + snd_se_Audience_Zannen = 0x20, + snd_se_AllStar_Heal_Warp = 0x21, + snd_se_system_Pause = 0x22, + snd_se_system_Page_Change = 0x23, + snd_se_system_Switch = 0x24, + snd_se_system_Counter = 0x25, + snd_se_system_2P_into = 0x26, + snd_se_system_collection_save = 0x27, + snd_se_system_collection_delete = 0x28, + snd_se_system_zoom_in = 0x29, + snd_se_system_zoom_out = 0x2A, + snd_se_system_041 = 0x2B, + snd_se_system_042 = 0x2C, + snd_se_system_043 = 0x2D, + snd_se_system_044 = 0x2E, + snd_se_system_045 = 0x2F, + snd_se_system_046 = 0x30, + snd_se_system_047 = 0x31, + snd_se_system_048 = 0x32, + snd_se_system_049 = 0x33, + snd_se_system_050 = 0x34, + snd_se_common_punch_kick_swing_s = 0x35, + snd_se_common_punch_kick_swing_m = 0x36, + snd_se_common_punch_kick_swing_l = 0x37, + snd_se_common_sword_swing_s = 0x38, + snd_se_common_sword_swing_m = 0x39, + snd_se_common_sword_swing_l = 0x3A, + snd_se_common_punch_hit_s = 0x3B, + snd_se_common_punch_hit_m = 0x3C, + snd_se_common_punch_hit_l = 0x3D, + snd_se_common_kick_hit_s = 0x3E, + snd_se_common_kick_hit_m = 0x3F, + snd_se_common_kick_hit_l = 0x40, + snd_se_common_sword_hit_s = 0x41, + snd_se_common_sword_hit_m = 0x42, + snd_se_common_sword_hit_l = 0x43, + snd_se_common_futtobi_s = 0x44, + snd_se_common_futtobi_m = 0x45, + snd_se_common_futtobi_l = 0x46, + snd_se_common_stage_fall = 0x47, + snd_se_common_jump_s = 0x48, + snd_se_common_jump_l = 0x49, + snd_se_common_fireball_hit = 0x4A, + snd_se_common_fire_s = 0x4B, + snd_se_common_fire_m = 0x4C, + snd_se_common_fire_l = 0x4D, + snd_se_common_fire_ll = 0x4E, + snd_se_common_bomb_s = 0x4F, + snd_se_common_bomb_m = 0x50, + snd_se_common_bomb_l = 0x51, + snd_se_common_bomb_ll = 0x52, + snd_se_common_cliff_catch = 0x53, + snd_se_common_cliff_up = 0x54, + snd_se_common_cyakuchi_l = 0x55, + snd_se_common_cyakuchi_m = 0x56, + snd_se_common_cyakuchi_s = 0x57, + snd_se_common_Damage_hoshikie = 0x58, + snd_se_common_DamageElec = 0x59, + snd_se_common_dash_start = 0x5A, + snd_se_common_dash_stop = 0x5B, + snd_se_common_down_Soil_l = 0x5C, + snd_se_common_down_Soil_m = 0x5D, + snd_se_common_down_Soil_s = 0x5E, + snd_se_common_down_Soil_ss = 0x5F, + snd_se_common_eat = 0x60, + snd_se_common_furafura = 0x61, + snd_se_common_GuardBreak = 0x62, + snd_se_common_GuardOff = 0x63, + snd_se_common_GuardOn = 0x64, + snd_se_common_item_Get_Tabemono = 0x65, + snd_se_common_item_Get_Drink = 0x66, + snd_se_common_item_Get_Peanuts = 0x67, + snd_se_common_slide_s = 0x68, + snd_se_common_smash_start = 0x69, + snd_se_common_001 = 0x6A, + snd_se_common_002 = 0x6B, + snd_se_common_003 = 0x6C, + snd_se_common_004 = 0x6D, + snd_se_common_005 = 0x6E, + snd_se_common_006 = 0x6F, + snd_se_common_007 = 0x70, + snd_se_common_008 = 0x71, + snd_se_common_009 = 0x72, + snd_se_common_010 = 0x73, + snd_se_common_011 = 0x74, + snd_se_common_Magic_hit_s = 0x75, + snd_se_common_Magic_hit_m = 0x76, + snd_se_common_Magic_hit_l = 0x77, + snd_se_common_Magic_hit_ll = 0x78, + snd_se_common_Electric_hit_s = 0x79, + snd_se_common_Electric_hit_m = 0x7A, + snd_se_common_Electric_hit_l = 0x7B, + snd_se_common_Electric_hit_ll = 0x7C, + snd_se_common_Step_Rock = 0x7D, + snd_se_common_Step_Grass = 0x7E, + snd_se_common_Step_Soil = 0x7F, + snd_se_common_Step_Wood = 0x80, + snd_se_common_Step_Iron = 0x81, + snd_se_common_Step_NibuIron = 0x82, + snd_se_common_Step_Carpet = 0x83, + snd_se_common_Step_NumeNume = 0x84, + snd_se_common_Step_Creature = 0x85, + snd_se_common_Step_Asase = 0x86, + snd_se_common_Step_Soft = 0x87, + snd_se_common_Step_TuruTuru = 0x88, + snd_se_common_Step_Snow = 0x89, + snd_se_common_Step_Ice = 0x8A, + snd_se_common_Step_GameWatch = 0x8B, + snd_se_common_Step_Oil = 0x8C, + snd_se_common_Step_Danbouru = 0x8D, + snd_se_common_Landing_Rock = 0x8E, + snd_se_common_Landing_Grass = 0x8F, + snd_se_common_Landing_Soil = 0x90, + snd_se_common_Landing_Wood = 0x91, + snd_se_common_Landing_Iron = 0x92, + snd_se_common_Landing_NibuIron = 0x93, + snd_se_common_Landing_Carpet = 0x94, + snd_se_common_Landing_NumeNume = 0x95, + snd_se_common_Landing_Creature = 0x96, + snd_se_common_Landing_Asase = 0x97, + snd_se_common_Landing_Soft = 0x98, + snd_se_common_Landing_TuruTuru = 0x99, + snd_se_common_Landing_Snow = 0x9A, + snd_se_common_Landing_Ice = 0x9B, + snd_se_common_Landing_GameWatch = 0x9C, + snd_se_common_Landing_Oil = 0x9D, + snd_se_common_Landing_Danbouru = 0x9E, + snd_se_common_054 = 0x9F, + snd_se_common_055 = 0xA0, + snd_se_common_056 = 0xA1, + snd_se_common_057 = 0xA2, + snd_se_common_058 = 0xA3, + snd_se_common_059 = 0xA4, + snd_se_common_060 = 0xA5, + snd_se_common_061 = 0xA6, + snd_se_common_062 = 0xA7, + snd_se_common_063 = 0xA8, + snd_se_common_064 = 0xA9, + snd_se_common_Water_hit_s = 0xAA, + snd_se_common_Water_hit_m = 0xAB, + snd_se_common_Water_hit_l = 0xAC, + snd_se_common_Water_hit_ll = 0xAD, + snd_se_common_069 = 0xAE, + snd_se_common_070 = 0xAF, + snd_se_common_071 = 0xB0, + snd_se_common_072 = 0xB1, + snd_se_common_073 = 0xB2, + snd_se_common_074 = 0xB3, + snd_se_common_075 = 0xB4, + snd_se_common_076 = 0xB5, + snd_se_common_077 = 0xB6, + snd_se_common_078 = 0xB7, + snd_se_common_079 = 0xB8, + snd_se_common_080 = 0xB9, + snd_se_common_Landing_Water_s = 0xBA, + snd_se_common_Landing_Water_m = 0xBB, + snd_se_common_Landing_Water_l = 0xBC, + snd_se_common_084 = 0xBD, + snd_se_common_085 = 0xBE, + snd_se_common_086 = 0xBF, + snd_se_common_087 = 0xC0, + snd_se_common_088 = 0xC1, + snd_se_common_089 = 0xC2, + snd_se_common_Frieze = 0xC3, + snd_se_common_091 = 0xC4, + snd_se_common_092 = 0xC5, + snd_se_common_bomb_damage_s = 0xC6, + snd_se_common_bomb_damage_m = 0xC7, + snd_se_common_bomb_damage_l = 0xC8, + snd_se_common_bomb_damage_ll = 0xC9, + snd_se_common_Step_ElectroP = 0xCA, + snd_se_common_Landing_ElectroP = 0xCB, + snd_se_common_Frieze_s = 0xCC, + snd_se_common_Frieze_m = 0xCD, + snd_se_common_Frieze_l = 0xCE, + snd_se_common_Frieze_ll = 0xCF, + snd_se_common_Metal_Step_S = 0xD0, + snd_se_common_Metal_Step_M = 0xD1, + snd_se_common_Metal_Step_L = 0xD2, + snd_se_common_Metal_Landing_S = 0xD3, + snd_se_common_Metal_Landing_M = 0xD4, + snd_se_common_Metal_Landing_L = 0xD5, + snd_se_common_Get_Sesl = 0xD6, + snd_se_common_Get_Figure = 0xD7, + snd_se_common_Get_CD = 0xD8, + snd_se_common_JustShield = 0xD9, + snd_se_common_113 = 0xDA, + snd_se_common_Final_Quake = 0xDB, + snd_se_common_Step_Cloud = 0xDC, + snd_se_common_Step_Akuukan = 0xDD, + snd_se_common_Step_Brick = 0xDE, + snd_se_common_Landing_Cloud = 0xDF, + snd_se_common_Landing_Akuukan = 0xE0, + snd_se_common_Landing_Brick = 0xE1, + snd_se_common_Step_Famicom = 0xE2, + snd_se_common_Step_Fence = 0xE3, + snd_se_common_Step_Sand = 0xE4, + snd_se_common_Landing_Famicom = 0xE5, + snd_se_common_Landing_Fence = 0xE6, + snd_se_common_Landing_Sand = 0xE7, + snd_se_common_coin = 0xE8, + snd_se_common_128 = 0xE9, + snd_se_common_129 = 0xEA, + snd_se_common_130 = 0xEB, + snd_se_common_131 = 0xEC, + snd_se_common_132 = 0xED, + snd_se_common_133 = 0xEE, + snd_se_common_134 = 0xEF, + snd_se_common_135 = 0xF0, + snd_se_common_136 = 0xF1, + snd_se_common_137 = 0xF2, + snd_se_common_138 = 0xF3, + snd_se_common_139 = 0xF4, + snd_se_common_140 = 0xF5, + snd_se_common_141 = 0xF6, + snd_se_common_142 = 0xF7, + snd_se_common_143 = 0xF8, + snd_se_common_144 = 0xF9, + snd_se_common_145 = 0xFA, + snd_se_common_146 = 0xFB, + snd_se_common_147 = 0xFC, + snd_se_common_148 = 0xFD, + snd_se_common_149 = 0xFE, + snd_se_common_150 = 0xFF, + snd_se_common_151 = 0x100, + snd_se_common_152 = 0x101, + snd_se_common_153 = 0x102, + snd_se_common_154 = 0x103, + snd_se_common_155 = 0x104, + snd_se_common_156 = 0x105, + snd_se_common_157 = 0x106, + snd_se_common_158 = 0x107, + snd_se_common_159 = 0x108, + snd_se_common_160 = 0x109, + snd_se_mario_ouen = 0x10A, + snd_se_mario_big = 0x10B, + snd_se_mario_dokan = 0x10C, + snd_se_mario_fire_nage = 0x10D, + snd_se_mario_fire_hane = 0x10E, + snd_se_mario_coin = 0x10F, + snd_se_mario_jump = 0x110, + snd_se_mario_spin = 0x111, + snd_se_mario_mant = 0x112, + snd_se_mario_giant_swing = 0x113, + snd_se_mario_D_SpecialN03 = 0x114, + snd_se_mario_Attack_l = 0x115, + snd_se_mario_Attack_ll = 0x116, + snd_se_mario_Attack_m = 0x117, + snd_se_mario_Attack_s = 0x118, + snd_se_mario_Attack100 = 0x119, + snd_se_mario_BodyPress01 = 0x11A, + snd_se_mario_BodyPress02 = 0x11B, + snd_se_mario_dash_start = 0x11C, + snd_se_mario_dash_stop = 0x11D, + snd_se_mario_Final01 = 0x11E, + snd_se_mario_Final02 = 0x11F, + snd_se_mario_Final03 = 0x120, + snd_se_mario_Final04 = 0x121, + snd_se_mario_Final05 = 0x122, + snd_se_mario_jump01 = 0x123, + snd_se_mario_jump02 = 0x124, + snd_se_mario_Landing01 = 0x125, + snd_se_mario_Landing02 = 0x126, + snd_se_mario_smash_H01 = 0x127, + snd_se_mario_smash_H02 = 0x128, + snd_se_mario_smash_H03 = 0x129, + snd_se_mario_smash_H04 = 0x12A, + snd_se_mario_smash_H05 = 0x12B, + snd_se_mario_smash_L01 = 0x12C, + snd_se_mario_smash_L02 = 0x12D, + snd_se_mario_smash_L03 = 0x12E, + snd_se_mario_smash_L04 = 0x12F, + snd_se_mario_smash_L05 = 0x130, + snd_se_mario_smash_S01 = 0x131, + snd_se_mario_smash_S02 = 0x132, + snd_se_mario_smash_S03 = 0x133, + snd_se_mario_smash_S04 = 0x134, + snd_se_mario_smash_S05 = 0x135, + snd_se_mario_Special_H01 = 0x136, + snd_se_mario_Special_H02 = 0x137, + snd_se_mario_Special_H03 = 0x138, + snd_se_mario_Special_H04 = 0x139, + snd_se_mario_Special_H05 = 0x13A, + snd_se_mario_Special_L01 = 0x13B, + snd_se_mario_Special_L02 = 0x13C, + snd_se_mario_Special_L03 = 0x13D, + snd_se_mario_Special_L04 = 0x13E, + snd_se_mario_Special_L05 = 0x13F, + snd_se_mario_Special_N01 = 0x140, + snd_se_mario_Special_N02 = 0x141, + snd_se_mario_Special_N03 = 0x142, + snd_se_mario_Special_N04 = 0x143, + snd_se_mario_Special_N05 = 0x144, + snd_se_mario_Special_S01 = 0x145, + snd_se_mario_Special_S02 = 0x146, + snd_se_mario_Special_S03 = 0x147, + snd_se_mario_Special_S04 = 0x148, + snd_se_mario_Special_S05 = 0x149, + snd_se_mario_squat = 0x14A, + snd_se_mario_step_hidari_m = 0x14B, + snd_se_mario_step_hidari_s = 0x14C, + snd_se_mario_step_migi_m = 0x14D, + snd_se_mario_step_migi_s = 0x14E, + snd_se_mario_swing_l = 0x14F, + snd_se_mario_swing_ll = 0x150, + snd_se_mario_swing_m = 0x151, + snd_se_mario_swing_s = 0x152, + snd_se_mario_turn = 0x153, + snd_se_mario_turn_run = 0x154, + snd_se_mario_ukemi = 0x155, + snd_se_mario_Wait1 = 0x156, + snd_se_mario_Wait2 = 0x157, + snd_se_mario_Wait3 = 0x158, + snd_se_mario_wear = 0x159, + snd_se_mario_001 = 0x15A, + snd_se_mario_002 = 0x15B, + snd_se_mario_003 = 0x15C, + snd_se_mario_004 = 0x15D, + snd_se_mario_005 = 0x15E, + snd_se_mario_006 = 0x15F, + snd_se_mario_007 = 0x160, + snd_se_mario_008 = 0x161, + snd_se_mario_009 = 0x162, + snd_se_mario_010 = 0x163, + snd_se_mario_011 = 0x164, + snd_se_mario_012 = 0x165, + snd_se_mario_013 = 0x166, + snd_se_mario_014 = 0x167, + snd_se_mario_015 = 0x168, + snd_se_mario_016 = 0x169, + snd_se_mario_017 = 0x16A, + snd_se_mario_018 = 0x16B, + snd_se_mario_019 = 0x16C, + snd_se_mario_020 = 0x16D, + snd_se_mario_021 = 0x16E, + snd_se_mario_022 = 0x16F, + snd_se_mario_023 = 0x170, + snd_se_mario_024 = 0x171, + snd_se_mario_025 = 0x172, + snd_se_mario_026 = 0x173, + snd_se_mario_046 = 0x174, + snd_se_mario_047 = 0x175, + snd_se_mario_048 = 0x176, + snd_se_mario_049 = 0x177, + snd_se_mario_050 = 0x178, + snd_vc_mario_Appeal01 = 0x179, + snd_vc_mario_Appeal02 = 0x17A, + snd_vc_mario_Appeal03 = 0x17B, + snd_vc_mario_Attack01 = 0x17C, + snd_vc_mario_Attack02 = 0x17D, + snd_vc_mario_Attack03 = 0x17E, + snd_vc_mario_Attack04 = 0x17F, + snd_vc_mario_Attack05 = 0x180, + snd_vc_mario_Attack06 = 0x181, + snd_vc_mario_Attack07 = 0x182, + snd_vc_mario_CliffCatch = 0x183, + snd_vc_mario_Damage_hoshikie = 0x184, + snd_vc_mario_Damage02 = 0x185, + snd_vc_mario_DamageFly01 = 0x186, + snd_vc_mario_DamageFly02 = 0x187, + snd_vc_mario_FuraFura = 0x188, + snd_vc_mario_FuraSleep = 0x189, + snd_vc_mario_HeavyGet = 0x18A, + snd_vc_mario_MissFoot01 = 0x18B, + snd_vc_mario_MissFoot02 = 0x18C, + snd_vc_mario_Ottotto = 0x18D, + snd_vc_mario_Passive = 0x18E, + snd_vc_mario_SwimUp = 0x18F, + snd_vc_mario_Win01 = 0x190, + snd_vc_mario_Win02 = 0x191, + snd_vc_mario_Win03 = 0x192, + snd_vc_mario_001 = 0x193, + snd_vc_mario_002 = 0x194, + snd_vc_mario_003 = 0x195, + snd_vc_mario_004 = 0x196, + snd_vc_mario_005 = 0x197, + snd_vc_mario_006 = 0x198, + snd_vc_mario_007 = 0x199, + snd_vc_mario_008 = 0x19A, + snd_vc_mario_009 = 0x19B, + snd_vc_mario_010 = 0x19C, + snd_vc_mario_011 = 0x19D, + snd_vc_mario_012 = 0x19E, + snd_vc_mario_013 = 0x19F, + snd_vc_mario_014 = 0x1A0, + snd_vc_mario_015 = 0x1A1, + snd_vc_mario_016 = 0x1A2, + snd_vc_mario_017 = 0x1A3, + snd_vc_mario_018 = 0x1A4, + snd_vc_mario_019 = 0x1A5, + snd_vc_mario_020 = 0x1A6, + snd_vc_mario_046 = 0x1A7, + snd_vc_mario_047 = 0x1A8, + snd_vc_mario_048 = 0x1A9, + snd_vc_mario_049 = 0x1AA, + snd_vc_ouen_Mario = 0x1AB, + snd_se_link_DSpecialNStart = 0x1AC, + snd_se_link_DSpecialNEnd = 0x1AD, + snd_se_link_DSpecialHi = 0x1AE, + snd_se_link_DSpecialAirHi = 0x1AF, + snd_se_link_DSpecialS1 = 0x1B0, + snd_se_link_DSpecialS2 = 0x1B1, + snd_se_link_DSpecialLw1 = 0x1B2, + snd_se_link_DSpecialLw2 = 0x1B3, + snd_se_link_Attack_l = 0x1B4, + snd_se_link_Attack_ll = 0x1B5, + snd_se_link_Attack_m = 0x1B6, + snd_se_link_Attack_s = 0x1B7, + snd_se_link_Attack100 = 0x1B8, + snd_se_link_BodyPress01 = 0x1B9, + snd_se_link_BodyPress02 = 0x1BA, + snd_se_link_dash_start = 0x1BB, + snd_se_link_dash_stop = 0x1BC, + snd_se_link_Final01 = 0x1BD, + snd_se_link_Final02 = 0x1BE, + snd_se_link_Final03 = 0x1BF, + snd_se_link_Final04 = 0x1C0, + snd_se_link_Final05 = 0x1C1, + snd_se_link_jump01 = 0x1C2, + snd_se_link_jump02 = 0x1C3, + snd_se_link_Landing01 = 0x1C4, + snd_se_link_Landing02 = 0x1C5, + snd_se_link_smash_H01 = 0x1C6, + snd_se_link_smash_H02 = 0x1C7, + snd_se_link_smash_H03 = 0x1C8, + snd_se_link_smash_H04 = 0x1C9, + snd_se_link_smash_H05 = 0x1CA, + snd_se_link_smash_L01 = 0x1CB, + snd_se_link_smash_L02 = 0x1CC, + snd_se_link_smash_L03 = 0x1CD, + snd_se_link_smash_L04 = 0x1CE, + snd_se_link_smash_L05 = 0x1CF, + snd_se_link_smash_S01 = 0x1D0, + snd_se_link_smash_S02 = 0x1D1, + snd_se_link_smash_S03 = 0x1D2, + snd_se_link_smash_S04 = 0x1D3, + snd_se_link_smash_S05 = 0x1D4, + snd_se_link_Special_H01 = 0x1D5, + snd_se_link_Special_H02 = 0x1D6, + snd_se_link_Special_H03 = 0x1D7, + snd_se_link_Special_H04 = 0x1D8, + snd_se_link_Special_H05 = 0x1D9, + snd_se_link_Special_L01 = 0x1DA, + snd_se_link_Special_L02 = 0x1DB, + snd_se_link_Special_L03 = 0x1DC, + snd_se_link_Special_L04 = 0x1DD, + snd_se_link_Special_L05 = 0x1DE, + snd_se_link_Special_N01 = 0x1DF, + snd_se_link_Special_N02 = 0x1E0, + snd_se_link_Special_N03 = 0x1E1, + snd_se_link_Special_N04 = 0x1E2, + snd_se_link_Special_N05 = 0x1E3, + snd_se_link_Special_S01 = 0x1E4, + snd_se_link_Special_S02 = 0x1E5, + snd_se_link_Special_S03 = 0x1E6, + snd_se_link_Special_S04 = 0x1E7, + snd_se_link_Special_S05 = 0x1E8, + snd_se_link_squat = 0x1E9, + snd_se_link_step_hidari_m = 0x1EA, + snd_se_link_step_hidari_s = 0x1EB, + snd_se_link_step_migi_m = 0x1EC, + snd_se_link_step_migi_s = 0x1ED, + snd_se_link_swing_l = 0x1EE, + snd_se_link_swing_ll = 0x1EF, + snd_se_link_swing_m = 0x1F0, + snd_se_link_swing_s = 0x1F1, + snd_se_link_turn = 0x1F2, + snd_se_link_turn_run = 0x1F3, + snd_se_link_ukemi = 0x1F4, + snd_se_link_Wait1 = 0x1F5, + snd_se_link_Wait2 = 0x1F6, + snd_se_link_Wait3 = 0x1F7, + snd_se_link_wear = 0x1F8, + snd_se_link_001 = 0x1F9, + snd_se_link_002 = 0x1FA, + snd_se_link_003 = 0x1FB, + snd_se_link_004 = 0x1FC, + snd_se_link_005 = 0x1FD, + snd_se_link_006 = 0x1FE, + snd_se_link_007 = 0x1FF, + snd_se_link_008 = 0x200, + snd_se_link_009 = 0x201, + snd_se_link_010 = 0x202, + snd_se_link_011 = 0x203, + snd_se_link_012 = 0x204, + snd_se_link_013 = 0x205, + snd_se_link_014 = 0x206, + snd_se_link_015 = 0x207, + snd_se_link_016 = 0x208, + snd_se_link_017 = 0x209, + snd_se_link_018 = 0x20A, + snd_se_link_019 = 0x20B, + snd_se_link_020 = 0x20C, + snd_se_link_021 = 0x20D, + snd_se_link_022 = 0x20E, + snd_se_link_023 = 0x20F, + snd_se_link_024 = 0x210, + snd_se_link_025 = 0x211, + snd_se_link_026 = 0x212, + snd_se_link_027 = 0x213, + snd_se_link_028 = 0x214, + snd_se_link_029 = 0x215, + snd_se_link_030 = 0x216, + snd_se_link_031 = 0x217, + snd_se_link_032 = 0x218, + snd_se_link_033 = 0x219, + snd_se_link_034 = 0x21A, + snd_se_link_035 = 0x21B, + snd_se_link_036 = 0x21C, + snd_se_link_037 = 0x21D, + snd_se_link_038 = 0x21E, + snd_se_link_039 = 0x21F, + snd_se_link_040 = 0x220, + snd_se_link_041 = 0x221, + snd_se_link_042 = 0x222, + snd_se_link_043 = 0x223, + snd_se_link_046 = 0x224, + snd_se_link_047 = 0x225, + snd_se_link_048 = 0x226, + snd_se_link_049 = 0x227, + snd_se_link_050 = 0x228, + snd_vc_link_Appeal01 = 0x229, + snd_vc_link_Appeal02 = 0x22A, + snd_vc_link_Appeal03 = 0x22B, + snd_vc_link_Attack01 = 0x22C, + snd_vc_link_Attack02 = 0x22D, + snd_vc_link_Attack03 = 0x22E, + snd_vc_link_Attack04 = 0x22F, + snd_vc_link_Attack05 = 0x230, + snd_vc_link_Attack06 = 0x231, + snd_vc_link_Attack07 = 0x232, + snd_vc_link_CliffCatch = 0x233, + snd_vc_link_Damage_hoshikie = 0x234, + snd_vc_link_Damage01 = 0x235, + snd_vc_link_Damage02 = 0x236, + snd_vc_link_DamageFly01 = 0x237, + snd_vc_link_DamageFly02 = 0x238, + snd_vc_link_FuraFura = 0x239, + snd_vc_link_FuraSleep = 0x23A, + snd_vc_link_HeavyGet = 0x23B, + snd_vc_link_Jump01 = 0x23C, + snd_vc_link_Jump02 = 0x23D, + snd_vc_link_MissFoot01 = 0x23E, + snd_vc_link_MissFoot02 = 0x23F, + snd_vc_link_Ottotto = 0x240, + snd_vc_link_Passive = 0x241, + snd_vc_link_SwimUp = 0x242, + snd_vc_link_Win01 = 0x243, + snd_vc_link_Win02 = 0x244, + snd_vc_link_Win03 = 0x245, + snd_vc_link_001 = 0x246, + snd_vc_link_002 = 0x247, + snd_vc_link_003 = 0x248, + snd_vc_link_004 = 0x249, + snd_vc_link_005 = 0x24A, + snd_vc_link_006 = 0x24B, + snd_vc_link_007 = 0x24C, + snd_vc_link_008 = 0x24D, + snd_vc_link_046 = 0x24E, + snd_vc_link_047 = 0x24F, + snd_vc_link_048 = 0x250, + snd_vc_link_049 = 0x251, + snd_vc_ouen_Link = 0x252, + snd_se_pit_Attack_l = 0x253, + snd_se_pit_Attack_ll = 0x254, + snd_se_pit_Attack_m = 0x255, + snd_se_pit_Attack_s = 0x256, + snd_se_pit_Attack100 = 0x257, + snd_se_pit_BodyPress01 = 0x258, + snd_se_pit_BodyPress02 = 0x259, + snd_se_pit_dash_start = 0x25A, + snd_se_pit_dash_stop = 0x25B, + snd_se_pit_Final01 = 0x25C, + snd_se_pit_Final02 = 0x25D, + snd_se_pit_Final03 = 0x25E, + snd_se_pit_Final04 = 0x25F, + snd_se_pit_Final05 = 0x260, + snd_se_pit_jump01 = 0x261, + snd_se_pit_jump02 = 0x262, + snd_se_pit_Landing01 = 0x263, + snd_se_pit_Landing02 = 0x264, + snd_se_pit_smash_H01 = 0x265, + snd_se_pit_smash_H02 = 0x266, + snd_se_pit_smash_H03 = 0x267, + snd_se_pit_smash_H04 = 0x268, + snd_se_pit_smash_H05 = 0x269, + snd_se_pit_smash_L01 = 0x26A, + snd_se_pit_smash_L02 = 0x26B, + snd_se_pit_smash_L03 = 0x26C, + snd_se_pit_smash_L04 = 0x26D, + snd_se_pit_smash_L05 = 0x26E, + snd_se_pit_smash_S01 = 0x26F, + snd_se_pit_smash_S02 = 0x270, + snd_se_pit_smash_S03 = 0x271, + snd_se_pit_smash_S04 = 0x272, + snd_se_pit_smash_S05 = 0x273, + snd_se_pit_Special_H01 = 0x274, + snd_se_pit_Special_H02 = 0x275, + snd_se_pit_Special_H03 = 0x276, + snd_se_pit_Special_H04 = 0x277, + snd_se_pit_Special_H05 = 0x278, + snd_se_pit_Special_L01 = 0x279, + snd_se_pit_Special_L02 = 0x27A, + snd_se_pit_Special_L03 = 0x27B, + snd_se_pit_Special_L04 = 0x27C, + snd_se_pit_Special_L05 = 0x27D, + snd_se_pit_Special_N01 = 0x27E, + snd_se_pit_Special_N02 = 0x27F, + snd_se_pit_Special_N03 = 0x280, + snd_se_pit_Special_N04 = 0x281, + snd_se_pit_Special_N05 = 0x282, + snd_se_pit_Special_S01 = 0x283, + snd_se_pit_Special_S02 = 0x284, + snd_se_pit_Special_S03 = 0x285, + snd_se_pit_Special_S04 = 0x286, + snd_se_pit_Special_S05 = 0x287, + snd_se_pit_step_hidari_m = 0x288, + snd_se_pit_step_hidari_s = 0x289, + snd_se_pit_step_migi_m = 0x28A, + snd_se_pit_step_migi_s = 0x28B, + snd_se_pit_swing_l = 0x28C, + snd_se_pit_swing_ll = 0x28D, + snd_se_pit_swing_m = 0x28E, + snd_se_pit_swing_s = 0x28F, + snd_se_pit_turn = 0x290, + snd_se_pit_turn_run = 0x291, + snd_se_pit_Wait1 = 0x292, + snd_se_pit_Wait2 = 0x293, + snd_se_pit_Wait3 = 0x294, + snd_se_pit_wear = 0x295, + snd_se_pit_squat = 0x296, + snd_se_pit_ukemi = 0x297, + snd_se_pit_001 = 0x298, + snd_se_pit_002 = 0x299, + snd_se_pit_003 = 0x29A, + snd_se_pit_004 = 0x29B, + snd_se_pit_005 = 0x29C, + snd_se_pit_006 = 0x29D, + snd_se_pit_007 = 0x29E, + snd_se_pit_008 = 0x29F, + snd_se_pit_009 = 0x2A0, + snd_se_pit_010 = 0x2A1, + snd_se_pit_011 = 0x2A2, + snd_se_pit_012 = 0x2A3, + snd_se_pit_013 = 0x2A4, + snd_se_pit_046 = 0x2A5, + snd_se_pit_047 = 0x2A6, + snd_se_pit_048 = 0x2A7, + snd_se_pit_049 = 0x2A8, + snd_se_pit_050 = 0x2A9, + snd_vc_pit_atk01 = 0x2AA, + snd_vc_pit_atk02 = 0x2AB, + snd_vc_pit_atk03 = 0x2AC, + snd_vc_pit_atk04 = 0x2AD, + snd_vc_pit_atk05 = 0x2AE, + snd_vc_pit_atk06 = 0x2AF, + snd_vc_pit_atk07 = 0x2B0, + snd_vc_pit_fura = 0x2B1, + snd_vc_pit_otto = 0x2B2, + snd_vc_pit_jump01 = 0x2B3, + snd_vc_pit_damage_s = 0x2B4, + snd_vc_pit_damage_l = 0x2B5, + snd_vc_pit_futtobi_l01 = 0x2B6, + snd_vc_pit_futtobi_l02 = 0x2B7, + snd_vc_pit_mizu_tobidashi = 0x2B8, + snd_vc_pit_miss01 = 0x2B9, + snd_vc_pit_miss02 = 0x2BA, + snd_vc_pit_hoshikie = 0x2BB, + snd_vc_pit_nemuru = 0x2BC, + snd_vc_pit_mochiage = 0x2BD, + snd_vc_pit_ukemi = 0x2BE, + snd_vc_pit_gake = 0x2BF, + snd_vc_pit_appeal01 = 0x2C0, + snd_vc_pit_appeal02 = 0x2C1, + snd_vc_pit_appeal03 = 0x2C2, + snd_vc_pit_win01 = 0x2C3, + snd_vc_pit_win02 = 0x2C4, + snd_vc_pit_win03 = 0x2C5, + snd_vc_pit_hissatu_n = 0x2C6, + snd_vc_pit_hissatu_yoko = 0x2C7, + snd_vc_pit_hissatu_shita01 = 0x2C8, + snd_vc_pit_hissatu_shita02 = 0x2C9, + snd_vc_pit_hissatu_cyo01 = 0x2CA, + snd_vc_pit_hissatu_cyo02 = 0x2CB, + snd_vc_pit_001 = 0x2CC, + snd_vc_pit_002 = 0x2CD, + snd_vc_pit_003 = 0x2CE, + snd_vc_pit_004 = 0x2CF, + snd_vc_pit_005 = 0x2D0, + snd_vc_pit_006 = 0x2D1, + snd_vc_pit_046 = 0x2D2, + snd_vc_pit_047 = 0x2D3, + snd_vc_pit_048 = 0x2D4, + snd_vc_pit_049 = 0x2D5, + snd_vc_ouen_Pit = 0x2D6, + snd_se_metaknight_Attack_l = 0x2D7, + snd_se_metaknight_Attack_ll = 0x2D8, + snd_se_metaknight_Attack_m = 0x2D9, + snd_se_metaknight_Attack_s = 0x2DA, + snd_se_metaknight_Attack100 = 0x2DB, + snd_se_metaknight_BodyPress01 = 0x2DC, + snd_se_metaknight_BodyPress02 = 0x2DD, + snd_se_metaknight_dash_start = 0x2DE, + snd_se_metaknight_dash_stop = 0x2DF, + snd_se_metaknight_Final01 = 0x2E0, + snd_se_metaknight_Final02 = 0x2E1, + snd_se_metaknight_Final03 = 0x2E2, + snd_se_metaknight_Final04 = 0x2E3, + snd_se_metaknight_Final05 = 0x2E4, + snd_se_metaknight_jump01 = 0x2E5, + snd_se_metaknight_jump02 = 0x2E6, + snd_se_metaknight_Landing01 = 0x2E7, + snd_se_metaknight_Landing02 = 0x2E8, + snd_se_metaknight_smash_H01 = 0x2E9, + snd_se_metaknight_smash_H02 = 0x2EA, + snd_se_metaknight_smash_H03 = 0x2EB, + snd_se_metaknight_smash_H04 = 0x2EC, + snd_se_metaknight_smash_H05 = 0x2ED, + snd_se_metaknight_smash_L01 = 0x2EE, + snd_se_metaknight_smash_L02 = 0x2EF, + snd_se_metaknight_smash_L03 = 0x2F0, + snd_se_metaknight_smash_L04 = 0x2F1, + snd_se_metaknight_smash_L05 = 0x2F2, + snd_se_metaknight_smash_S01 = 0x2F3, + snd_se_metaknight_smash_S02 = 0x2F4, + snd_se_metaknight_smash_S03 = 0x2F5, + snd_se_metaknight_smash_S04 = 0x2F6, + snd_se_metaknight_smash_S05 = 0x2F7, + snd_se_metaknight_Special_H01 = 0x2F8, + snd_se_metaknight_Special_H02 = 0x2F9, + snd_se_metaknight_Special_H03 = 0x2FA, + snd_se_metaknight_Special_H04 = 0x2FB, + snd_se_metaknight_Special_H05 = 0x2FC, + snd_se_metaknight_Special_L01 = 0x2FD, + snd_se_metaknight_Special_L02 = 0x2FE, + snd_se_metaknight_Special_L03 = 0x2FF, + snd_se_metaknight_Special_L04 = 0x300, + snd_se_metaknight_Special_L05 = 0x301, + snd_se_metaknight_Special_N01 = 0x302, + snd_se_metaknight_Special_N02 = 0x303, + snd_se_metaknight_Special_N03 = 0x304, + snd_se_metaknight_Special_N04 = 0x305, + snd_se_metaknight_Special_N05 = 0x306, + snd_se_metaknight_Special_S01 = 0x307, + snd_se_metaknight_Special_S02 = 0x308, + snd_se_metaknight_Special_S03 = 0x309, + snd_se_metaknight_Special_S04 = 0x30A, + snd_se_metaknight_Special_S05 = 0x30B, + snd_se_metaknight_step_hidari_m = 0x30C, + snd_se_metaknight_step_hidari_s = 0x30D, + snd_se_metaknight_step_migi_m = 0x30E, + snd_se_metaknight_step_migi_s = 0x30F, + snd_se_metaknight_swing_l = 0x310, + snd_se_metaknight_swing_ll = 0x311, + snd_se_metaknight_swing_m = 0x312, + snd_se_metaknight_swing_s = 0x313, + snd_se_metaknight_turn = 0x314, + snd_se_metaknight_turn_run = 0x315, + snd_se_metaknight_Wait1 = 0x316, + snd_se_metaknight_Wait2 = 0x317, + snd_se_metaknight_Wait3 = 0x318, + snd_se_metaknight_wear = 0x319, + snd_se_metaknight_squat = 0x31A, + snd_se_metaknight_ukemi = 0x31B, + snd_se_metaknight_001 = 0x31C, + snd_se_metaknight_002 = 0x31D, + snd_se_metaknight_003 = 0x31E, + snd_se_metaknight_004 = 0x31F, + snd_se_metaknight_005 = 0x320, + snd_se_metaknight_006 = 0x321, + snd_se_metaknight_007 = 0x322, + snd_se_metaknight_008 = 0x323, + snd_se_metaknight_009 = 0x324, + snd_se_metaknight_010 = 0x325, + snd_se_metaknight_011 = 0x326, + snd_se_metaknight_012 = 0x327, + snd_se_metaknight_013 = 0x328, + snd_se_metaknight_014 = 0x329, + snd_se_metaknight_015 = 0x32A, + snd_se_metaknight_016 = 0x32B, + snd_se_metaknight_017 = 0x32C, + snd_se_metaknight_018 = 0x32D, + snd_se_metaknight_019 = 0x32E, + snd_se_metaknight_020 = 0x32F, + snd_se_metaknight_021 = 0x330, + snd_se_metaknight_022 = 0x331, + snd_se_metaknight_023 = 0x332, + snd_se_metaknight_024 = 0x333, + snd_se_metaknight_025 = 0x334, + snd_se_metaknight_026 = 0x335, + snd_se_metaknight_027 = 0x336, + snd_se_metaknight_028 = 0x337, + snd_se_metaknight_029 = 0x338, + snd_se_metaknight_030 = 0x339, + snd_se_metaknight_031 = 0x33A, + snd_se_metaknight_032 = 0x33B, + snd_se_metaknight_033 = 0x33C, + snd_se_metaknight_034 = 0x33D, + snd_se_metaknight_035 = 0x33E, + snd_se_metaknight_046 = 0x33F, + snd_se_metaknight_047 = 0x340, + snd_se_metaknight_048 = 0x341, + snd_se_metaknight_049 = 0x342, + snd_se_metaknight_050 = 0x343, + snd_vc_metaknight_atk01 = 0x344, + snd_vc_metaknight_atk02 = 0x345, + snd_vc_metaknight_atk03 = 0x346, + snd_vc_metaknight_atk04 = 0x347, + snd_vc_metaknight_atk05 = 0x348, + snd_vc_metaknight_atk06 = 0x349, + snd_vc_metaknight_atk07 = 0x34A, + snd_vc_metaknight_atk_hyaku = 0x34B, + snd_vc_metaknight_fura = 0x34C, + snd_vc_metaknight_otto = 0x34D, + snd_vc_metaknight_jump01 = 0x34E, + snd_vc_metaknight_damage_s = 0x34F, + snd_vc_metaknight_damage_l = 0x350, + snd_vc_metaknight_futtobi_l01 = 0x351, + snd_vc_metaknight_futtobi_l02 = 0x352, + snd_vc_metaknight_mizu_tobidashi = 0x353, + snd_vc_metaknight_miss01 = 0x354, + snd_vc_metaknight_miss02 = 0x355, + snd_vc_metaknight_hoshikie = 0x356, + snd_vc_metaknight_nemuru = 0x357, + snd_vc_metaknight_mochiage = 0x358, + snd_vc_metaknight_ukemi = 0x359, + snd_vc_metaknight_gake = 0x35A, + snd_vc_metaknight_appeal01 = 0x35B, + snd_vc_metaknight_appeal02 = 0x35C, + snd_vc_metaknight_appeal03 = 0x35D, + snd_vc_metaknight_win01 = 0x35E, + snd_vc_metaknight_win02 = 0x35F, + snd_vc_metaknight_win03 = 0x360, + snd_vc_metaknight_win04 = 0x361, + snd_vc_metaknight_hissatu_yoko = 0x362, + snd_vc_metaknight_hissatu_ue = 0x363, + snd_vc_metaknight_hissatu_shita = 0x364, + snd_vc_metaknight_kakkuu = 0x365, + snd_vc_metaknight_hissatu_cyo01 = 0x366, + snd_vc_metaknight_hissatu_cyo02 = 0x367, + snd_vc_metaknight_hissatu_cyo03 = 0x368, + snd_vc_metaknight_001 = 0x369, + snd_vc_metaknight_002 = 0x36A, + snd_vc_metaknight_003 = 0x36B, + snd_vc_metaknight_004 = 0x36C, + snd_vc_metaknight_005 = 0x36D, + snd_vc_metaknight_046 = 0x36E, + snd_vc_metaknight_047 = 0x36F, + snd_vc_metaknight_048 = 0x370, + snd_vc_metaknight_049 = 0x371, + snd_vc_ouen_Metaknight = 0x372, + snd_vc_dedede_appeal01 = 0x373, + snd_vc_dedede_appeal02 = 0x374, + snd_vc_dedede_appeal03 = 0x375, + snd_vc_dedede_atk01 = 0x376, + snd_vc_dedede_atk02 = 0x377, + snd_vc_dedede_atk03 = 0x378, + snd_vc_dedede_atk04 = 0x379, + snd_vc_dedede_atk05 = 0x37A, + snd_vc_dedede_atk06 = 0x37B, + snd_vc_dedede_atk07 = 0x37C, + snd_vc_dedede_damage_l = 0x37D, + snd_vc_dedede_damage_s = 0x37E, + snd_vc_dedede_fura = 0x37F, + snd_vc_dedede_futtobi_l01 = 0x380, + snd_vc_dedede_futtobi_l02 = 0x381, + snd_vc_dedede_gake = 0x382, + snd_vc_dedede_hoshikie = 0x383, + snd_vc_dedede_jump01 = 0x384, + snd_vc_dedede_miss01 = 0x385, + snd_vc_dedede_miss02 = 0x386, + snd_vc_dedede_mizu_tobidashi = 0x387, + snd_vc_dedede_mochiage = 0x388, + snd_vc_dedede_nemuru = 0x389, + snd_vc_dedede_otto = 0x38A, + snd_vc_dedede_ukemi = 0x38B, + snd_vc_dedede_win01 = 0x38C, + snd_vc_dedede_win02 = 0x38D, + snd_vc_dedede_win03 = 0x38E, + snd_vc_dedede_001 = 0x38F, + snd_vc_dedede_002 = 0x390, + snd_vc_dedede_003 = 0x391, + snd_vc_dedede_004 = 0x392, + snd_vc_dedede_005 = 0x393, + snd_vc_dedede_006 = 0x394, + snd_vc_dedede_007 = 0x395, + snd_vc_dedede_008 = 0x396, + snd_vc_dedede_009 = 0x397, + snd_vc_dedede_010 = 0x398, + snd_vc_dedede_011 = 0x399, + snd_vc_dedede_012 = 0x39A, + snd_vc_dedede_013 = 0x39B, + snd_vc_dedede_014 = 0x39C, + snd_vc_dedede_015 = 0x39D, + snd_vc_dedede_016 = 0x39E, + snd_vc_dedede_017 = 0x39F, + snd_vc_dedede_018 = 0x3A0, + snd_vc_dedede_019 = 0x3A1, + snd_vc_dedede_020 = 0x3A2, + snd_vc_dedede_046 = 0x3A3, + snd_vc_dedede_047 = 0x3A4, + snd_vc_dedede_048 = 0x3A5, + snd_vc_dedede_049 = 0x3A6, + snd_vc_ouen_Dedede = 0x3A7, + snd_se_dedede_BodyPress01 = 0x3A8, + snd_se_dedede_BodyPress02 = 0x3A9, + snd_se_dedede_dash_start = 0x3AA, + snd_se_dedede_dash_stop = 0x3AB, + snd_se_dedede_Final01 = 0x3AC, + snd_se_dedede_Final02 = 0x3AD, + snd_se_dedede_Final03 = 0x3AE, + snd_se_dedede_Final04 = 0x3AF, + snd_se_dedede_Final05 = 0x3B0, + snd_se_dedede_hammer_Attack_earth = 0x3B1, + snd_se_dedede_hammer_Attack_l = 0x3B2, + snd_se_dedede_hammer_Attack_ll = 0x3B3, + snd_se_dedede_hammer_Attack_m = 0x3B4, + snd_se_dedede_hammer_Attack_s = 0x3B5, + snd_se_dedede_hammer_Attack100 = 0x3B6, + snd_se_dedede_hammer_spin_body = 0x3B7, + snd_se_dedede_hammer_spin_head = 0x3B8, + snd_se_dedede_hammer_swing_l = 0x3B9, + snd_se_dedede_hammer_swing_ll = 0x3BA, + snd_se_dedede_hammer_swing_m = 0x3BB, + snd_se_dedede_hammer_swing_s = 0x3BC, + snd_se_dedede_jump01 = 0x3BD, + snd_se_dedede_jump02 = 0x3BE, + snd_se_dedede_Landing01 = 0x3BF, + snd_se_dedede_Landing02 = 0x3C0, + snd_se_dedede_smash_H01 = 0x3C1, + snd_se_dedede_smash_H02 = 0x3C2, + snd_se_dedede_smash_H03 = 0x3C3, + snd_se_dedede_smash_H04 = 0x3C4, + snd_se_dedede_smash_H05 = 0x3C5, + snd_se_dedede_smash_L01 = 0x3C6, + snd_se_dedede_smash_L02 = 0x3C7, + snd_se_dedede_smash_L03 = 0x3C8, + snd_se_dedede_smash_L04 = 0x3C9, + snd_se_dedede_smash_L05 = 0x3CA, + snd_se_dedede_smash_S01 = 0x3CB, + snd_se_dedede_smash_S02 = 0x3CC, + snd_se_dedede_smash_S03 = 0x3CD, + snd_se_dedede_smash_S04 = 0x3CE, + snd_se_dedede_smash_S05 = 0x3CF, + snd_se_dedede_Special_H01 = 0x3D0, + snd_se_dedede_Special_H02 = 0x3D1, + snd_se_dedede_Special_H03 = 0x3D2, + snd_se_dedede_Special_H04 = 0x3D3, + snd_se_dedede_Special_H05 = 0x3D4, + snd_se_dedede_Special_L01 = 0x3D5, + snd_se_dedede_Special_L02 = 0x3D6, + snd_se_dedede_Special_L03 = 0x3D7, + snd_se_dedede_Special_L04 = 0x3D8, + snd_se_dedede_Special_L05 = 0x3D9, + snd_se_dedede_Special_N01 = 0x3DA, + snd_se_dedede_Special_N02 = 0x3DB, + snd_se_dedede_Special_N03 = 0x3DC, + snd_se_dedede_Special_N04 = 0x3DD, + snd_se_dedede_Special_N05 = 0x3DE, + snd_se_dedede_Special_S01 = 0x3DF, + snd_se_dedede_Special_S02 = 0x3E0, + snd_se_dedede_Special_S03 = 0x3E1, + snd_se_dedede_Special_S04 = 0x3E2, + snd_se_dedede_Special_S05 = 0x3E3, + snd_se_dedede_squat = 0x3E4, + snd_se_dedede_step_hidari_m = 0x3E5, + snd_se_dedede_step_hidari_s = 0x3E6, + snd_se_dedede_step_migi_m = 0x3E7, + snd_se_dedede_step_migi_s = 0x3E8, + snd_se_dedede_turn = 0x3E9, + snd_se_dedede_turn_run = 0x3EA, + snd_se_dedede_ukemi = 0x3EB, + snd_se_dedede_Wait1 = 0x3EC, + snd_se_dedede_Wait2 = 0x3ED, + snd_se_dedede_Wait3 = 0x3EE, + snd_se_dedede_wear = 0x3EF, + snd_se_dedede_001 = 0x3F0, + snd_se_dedede_002 = 0x3F1, + snd_se_dedede_003 = 0x3F2, + snd_se_dedede_004 = 0x3F3, + snd_se_dedede_005 = 0x3F4, + snd_se_dedede_006 = 0x3F5, + snd_se_dedede_007 = 0x3F6, + snd_se_dedede_008 = 0x3F7, + snd_se_dedede_009 = 0x3F8, + snd_se_dedede_010 = 0x3F9, + snd_se_dedede_011 = 0x3FA, + snd_se_dedede_012 = 0x3FB, + snd_se_dedede_013 = 0x3FC, + snd_se_dedede_014 = 0x3FD, + snd_se_dedede_015 = 0x3FE, + snd_se_dedede_016 = 0x3FF, + snd_se_dedede_017 = 0x400, + snd_se_dedede_018 = 0x401, + snd_se_dedede_019 = 0x402, + snd_se_dedede_020 = 0x403, + snd_se_dedede_021 = 0x404, + snd_se_dedede_022 = 0x405, + snd_se_dedede_023 = 0x406, + snd_se_dedede_024 = 0x407, + snd_se_dedede_025 = 0x408, + snd_se_dedede_026 = 0x409, + snd_se_dedede_046 = 0x40A, + snd_se_dedede_047 = 0x40B, + snd_se_dedede_048 = 0x40C, + snd_se_dedede_049 = 0x40D, + snd_se_dedede_050 = 0x40E, + snd_vc_DonkeyKong_001 = 0x40F, + snd_vc_DonkeyKong_002 = 0x410, + snd_vc_DonkeyKong_003 = 0x411, + snd_vc_DonkeyKong_004 = 0x412, + snd_vc_DonkeyKong_005 = 0x413, + snd_vc_DonkeyKong_006 = 0x414, + snd_vc_DonkeyKong_007 = 0x415, + snd_vc_DonkeyKong_008 = 0x416, + snd_vc_DonkeyKong_009 = 0x417, + snd_vc_DonkeyKong_010 = 0x418, + snd_vc_DonkeyKong_011 = 0x419, + snd_vc_DonkeyKong_012 = 0x41A, + snd_vc_DonkeyKong_013 = 0x41B, + snd_vc_DonkeyKong_014 = 0x41C, + snd_vc_DonkeyKong_015 = 0x41D, + snd_vc_DonkeyKong_016 = 0x41E, + snd_vc_DonkeyKong_017 = 0x41F, + snd_vc_DonkeyKong_018 = 0x420, + snd_vc_DonkeyKong_019 = 0x421, + snd_vc_DonkeyKong_020 = 0x422, + snd_vc_DonkeyKong_021 = 0x423, + snd_vc_DonkeyKong_022 = 0x424, + snd_vc_DonkeyKong_023 = 0x425, + snd_vc_DonkeyKong_024 = 0x426, + snd_vc_DonkeyKong_025 = 0x427, + snd_vc_DonkeyKong_026 = 0x428, + snd_vc_DonkeyKong_046 = 0x429, + snd_vc_DonkeyKong_047 = 0x42A, + snd_vc_DonkeyKong_048 = 0x42B, + snd_vc_DonkeyKong_049 = 0x42C, + snd_vc_ouen_Donkey = 0x42D, + snd_vc_DonkeyKong_Appeal01 = 0x42E, + snd_vc_DonkeyKong_Appeal02 = 0x42F, + snd_vc_DonkeyKong_Appeal03 = 0x430, + snd_vc_DonkeyKong_Attack01 = 0x431, + snd_vc_DonkeyKong_Attack02 = 0x432, + snd_vc_DonkeyKong_Attack03 = 0x433, + snd_vc_DonkeyKong_Attack04 = 0x434, + snd_vc_DonkeyKong_Attack05 = 0x435, + snd_vc_DonkeyKong_Attack06 = 0x436, + snd_vc_DonkeyKong_Attack07 = 0x437, + snd_vc_DonkeyKong_CliffCatch = 0x438, + snd_vc_DonkeyKong_Damage_hoshikie = 0x439, + snd_vc_DonkeyKong_Damage01 = 0x43A, + snd_vc_DonkeyKong_Damage02 = 0x43B, + snd_vc_DonkeyKong_DamageFly01 = 0x43C, + snd_vc_DonkeyKong_DamageFly02 = 0x43D, + snd_vc_DonkeyKong_FuraFura = 0x43E, + snd_vc_DonkeyKong_FuraSleep = 0x43F, + snd_vc_DonkeyKong_HeavyGet = 0x440, + snd_vc_DonkeyKong_Jump01 = 0x441, + snd_vc_DonkeyKong_Jump02 = 0x442, + snd_vc_DonkeyKong_MissFoot01 = 0x443, + snd_vc_DonkeyKong_MissFoot02 = 0x444, + snd_vc_DonkeyKong_Ottotto = 0x445, + snd_vc_DonkeyKong_Passive = 0x446, + snd_vc_DonkeyKong_SwimUp = 0x447, + snd_vc_DonkeyKong_Win01 = 0x448, + snd_vc_DonkeyKong_Win02 = 0x449, + snd_vc_DonkeyKong_Win03 = 0x44A, + snd_vc_Samus_046 = 0x44B, + snd_vc_Samus_047 = 0x44C, + snd_vc_Samus_048 = 0x44D, + snd_vc_Samus_049 = 0x44E, + snd_vc_ouen_Samus = 0x44F, + snd_vc_Samus_Appeal01 = 0x450, + snd_vc_Samus_Appeal02 = 0x451, + snd_vc_Samus_Appeal03 = 0x452, + snd_vc_Samus_Attack01 = 0x453, + snd_vc_Samus_Attack02 = 0x454, + snd_vc_Samus_Attack03 = 0x455, + snd_vc_Samus_Attack04 = 0x456, + snd_vc_Samus_Attack05 = 0x457, + snd_vc_Samus_Attack06 = 0x458, + snd_vc_Samus_Attack07 = 0x459, + snd_vc_Samus_CliffCatch = 0x45A, + snd_vc_Samus_Damage_hoshikie = 0x45B, + snd_vc_Samus_Damage01 = 0x45C, + snd_vc_Samus_Damage02 = 0x45D, + snd_vc_Samus_DamageFly01 = 0x45E, + snd_vc_Samus_DamageFly02 = 0x45F, + snd_vc_Samus_FuraFura = 0x460, + snd_vc_Samus_FuraSleep = 0x461, + snd_vc_Samus_HeavyGet = 0x462, + snd_vc_Samus_Jump01 = 0x463, + snd_vc_Samus_Jump02 = 0x464, + snd_vc_Samus_MissFoot01 = 0x465, + snd_vc_Samus_MissFoot02 = 0x466, + snd_vc_Samus_Ottotto = 0x467, + snd_vc_Samus_Passive = 0x468, + snd_vc_Samus_SwimUp = 0x469, + snd_vc_Samus_Win01 = 0x46A, + snd_vc_Samus_Win02 = 0x46B, + snd_vc_Samus_Win03 = 0x46C, + snd_vc_Yoshi_001 = 0x46D, + snd_vc_Yoshi_002 = 0x46E, + snd_vc_Yoshi_003 = 0x46F, + snd_vc_Yoshi_004 = 0x470, + snd_vc_Yoshi_005 = 0x471, + snd_vc_Yoshi_006 = 0x472, + snd_vc_Yoshi_007 = 0x473, + snd_vc_Yoshi_008 = 0x474, + snd_vc_Yoshi_009 = 0x475, + snd_vc_Yoshi_010 = 0x476, + snd_vc_Yoshi_011 = 0x477, + snd_vc_Yoshi_046 = 0x478, + snd_vc_Yoshi_047 = 0x479, + snd_vc_Yoshi_048 = 0x47A, + snd_vc_Yoshi_049 = 0x47B, + snd_vc_ouen_Yoshi = 0x47C, + snd_vc_Yoshi_Appeal01 = 0x47D, + snd_vc_Yoshi_Appeal02 = 0x47E, + snd_vc_Yoshi_Appeal03 = 0x47F, + snd_vc_Yoshi_Attack01 = 0x480, + snd_vc_Yoshi_Attack02 = 0x481, + snd_vc_Yoshi_Attack03 = 0x482, + snd_vc_Yoshi_Attack04 = 0x483, + snd_vc_Yoshi_Attack05 = 0x484, + snd_vc_Yoshi_Attack06 = 0x485, + snd_vc_Yoshi_Attack07 = 0x486, + snd_vc_Yoshi_CliffCatch = 0x487, + snd_vc_Yoshi_Damage_hoshikie = 0x488, + snd_vc_Yoshi_Damage01 = 0x489, + snd_vc_Yoshi_Damage02 = 0x48A, + snd_vc_Yoshi_DamageFly01 = 0x48B, + snd_vc_Yoshi_DamageFly02 = 0x48C, + snd_vc_Yoshi_FuraFura = 0x48D, + snd_vc_Yoshi_FuraSleep = 0x48E, + snd_vc_Yoshi_HeavyGet = 0x48F, + snd_vc_Yoshi_Jump01 = 0x490, + snd_vc_Yoshi_Jump02 = 0x491, + snd_vc_Yoshi_MissFoot01 = 0x492, + snd_vc_Yoshi_MissFoot02 = 0x493, + snd_vc_Yoshi_Ottotto = 0x494, + snd_vc_Yoshi_Passive = 0x495, + snd_vc_Yoshi_SwimUp = 0x496, + snd_vc_Yoshi_Win01 = 0x497, + snd_vc_Yoshi_Win02 = 0x498, + snd_vc_Yoshi_Win03 = 0x499, + snd_vc_kirby_001 = 0x49A, + snd_vc_kirby_002 = 0x49B, + snd_vc_kirby_003 = 0x49C, + snd_vc_kirby_004 = 0x49D, + snd_vc_kirby_005 = 0x49E, + snd_vc_kirby_006 = 0x49F, + snd_vc_kirby_007 = 0x4A0, + snd_vc_kirby_008 = 0x4A1, + snd_vc_kirby_009 = 0x4A2, + snd_vc_kirby_010 = 0x4A3, + snd_vc_kirby_046 = 0x4A4, + snd_vc_kirby_047 = 0x4A5, + snd_vc_kirby_048 = 0x4A6, + snd_vc_kirby_049 = 0x4A7, + snd_vc_ouen_Kirby = 0x4A8, + snd_vc_kirby_Appeal01 = 0x4A9, + snd_vc_kirby_Appeal02 = 0x4AA, + snd_vc_kirby_Appeal03 = 0x4AB, + snd_vc_kirby_Attack01 = 0x4AC, + snd_vc_kirby_Attack02 = 0x4AD, + snd_vc_kirby_Attack03 = 0x4AE, + snd_vc_kirby_Attack04 = 0x4AF, + snd_vc_kirby_Attack05 = 0x4B0, + snd_vc_kirby_Attack06 = 0x4B1, + snd_vc_kirby_Attack07 = 0x4B2, + snd_vc_kirby_CliffCatch = 0x4B3, + snd_vc_kirby_Damage_hoshikie = 0x4B4, + snd_vc_kirby_Damage01 = 0x4B5, + snd_vc_kirby_Damage02 = 0x4B6, + snd_vc_kirby_DamageFly01 = 0x4B7, + snd_vc_kirby_DamageFly02 = 0x4B8, + snd_vc_kirby_FuraFura = 0x4B9, + snd_vc_kirby_FuraSleep = 0x4BA, + snd_vc_kirby_HeavyGet = 0x4BB, + snd_vc_kirby_Jump01 = 0x4BC, + snd_vc_kirby_Jump02 = 0x4BD, + snd_vc_kirby_MissFoot01 = 0x4BE, + snd_vc_kirby_MissFoot02 = 0x4BF, + snd_vc_kirby_Ottotto = 0x4C0, + snd_vc_kirby_Passive = 0x4C1, + snd_vc_kirby_SwimUp = 0x4C2, + snd_vc_kirby_Win01 = 0x4C3, + snd_vc_kirby_Win02 = 0x4C4, + snd_vc_kirby_Win03 = 0x4C5, + snd_vc_fox_001 = 0x4C6, + snd_vc_fox_002 = 0x4C7, + snd_vc_fox_003 = 0x4C8, + snd_vc_fox_004 = 0x4C9, + snd_vc_fox_Win_Falco = 0x4CA, + snd_vc_fox_006 = 0x4CB, + snd_vc_fox_007 = 0x4CC, + snd_vc_fox_008 = 0x4CD, + snd_vc_fox_009 = 0x4CE, + snd_vc_fox_010 = 0x4CF, + snd_vc_fox_046 = 0x4D0, + snd_vc_fox_047 = 0x4D1, + snd_vc_fox_048 = 0x4D2, + snd_vc_fox_049 = 0x4D3, + snd_vc_ouen_Fox = 0x4D4, + snd_vc_fox_Appeal01 = 0x4D5, + snd_vc_fox_Appeal02 = 0x4D6, + snd_vc_fox_Appeal03 = 0x4D7, + snd_vc_fox_Attack01 = 0x4D8, + snd_vc_fox_Attack02 = 0x4D9, + snd_vc_fox_Attack03 = 0x4DA, + snd_vc_fox_Attack04 = 0x4DB, + snd_vc_fox_Attack05 = 0x4DC, + snd_vc_fox_Attack06 = 0x4DD, + snd_vc_fox_Attack07 = 0x4DE, + snd_vc_fox_CliffCatch = 0x4DF, + snd_vc_fox_Damage_hoshikie = 0x4E0, + snd_vc_fox_Damage01 = 0x4E1, + snd_vc_fox_Damage02 = 0x4E2, + snd_vc_fox_DamageFly01 = 0x4E3, + snd_vc_fox_DamageFly02 = 0x4E4, + snd_vc_fox_FuraFura = 0x4E5, + snd_vc_fox_FuraSleep = 0x4E6, + snd_vc_fox_HeavyGet = 0x4E7, + snd_vc_fox_Jump01 = 0x4E8, + snd_vc_fox_Jump02 = 0x4E9, + snd_vc_fox_MissFoot01 = 0x4EA, + snd_vc_fox_MissFoot02 = 0x4EB, + snd_vc_fox_Ottotto = 0x4EC, + snd_vc_fox_Passive = 0x4ED, + snd_vc_fox_SwimUp = 0x4EE, + snd_vc_fox_Win01 = 0x4EF, + snd_vc_fox_Win02 = 0x4F0, + snd_vc_fox_Win03 = 0x4F1, + snd_vc_Luigi_001 = 0x4F2, + snd_vc_Luigi_002 = 0x4F3, + snd_vc_Luigi_003 = 0x4F4, + snd_vc_Luigi_004 = 0x4F5, + snd_vc_Luigi_005 = 0x4F6, + snd_vc_Luigi_006 = 0x4F7, + snd_vc_Luigi_007 = 0x4F8, + snd_vc_Luigi_008 = 0x4F9, + snd_vc_Luigi_009 = 0x4FA, + snd_vc_Luigi_010 = 0x4FB, + snd_vc_Luigi_011 = 0x4FC, + snd_vc_Luigi_012 = 0x4FD, + snd_vc_Luigi_013 = 0x4FE, + snd_vc_Luigi_014 = 0x4FF, + snd_vc_Luigi_046 = 0x500, + snd_vc_Luigi_047 = 0x501, + snd_vc_Luigi_048 = 0x502, + snd_vc_Luigi_049 = 0x503, + snd_vc_ouen_Luigi = 0x504, + snd_vc_Luigi_Appeal01 = 0x505, + snd_vc_Luigi_Appeal02 = 0x506, + snd_vc_Luigi_Appeal03 = 0x507, + snd_vc_Luigi_Attack01 = 0x508, + snd_vc_Luigi_Attack02 = 0x509, + snd_vc_Luigi_Attack03 = 0x50A, + snd_vc_Luigi_Attack04 = 0x50B, + snd_vc_Luigi_Attack05 = 0x50C, + snd_vc_Luigi_Attack06 = 0x50D, + snd_vc_Luigi_Attack07 = 0x50E, + snd_vc_Luigi_CliffCatch = 0x50F, + snd_vc_Luigi_Damage_hoshikie = 0x510, + snd_vc_Luigi_Damage01 = 0x511, + snd_vc_Luigi_Damage02 = 0x512, + snd_vc_Luigi_DamageFly01 = 0x513, + snd_vc_Luigi_DamageFly02 = 0x514, + snd_vc_Luigi_FuraFura = 0x515, + snd_vc_Luigi_FuraSleep = 0x516, + snd_vc_Luigi_HeavyGet = 0x517, + snd_vc_Luigi_Jump01 = 0x518, + snd_vc_Luigi_Jump02 = 0x519, + snd_vc_Luigi_MissFoot01 = 0x51A, + snd_vc_Luigi_MissFoot02 = 0x51B, + snd_vc_Luigi_Ottotto = 0x51C, + snd_vc_Luigi_Passive = 0x51D, + snd_vc_Luigi_SwimUp = 0x51E, + snd_vc_Luigi_Win01 = 0x51F, + snd_vc_Luigi_Win02 = 0x520, + snd_vc_Luigi_Win03 = 0x521, + snd_vc_captain_001 = 0x522, + snd_vc_captain_002 = 0x523, + snd_vc_captain_003 = 0x524, + snd_vc_captain_004 = 0x525, + snd_vc_captain_005 = 0x526, + snd_vc_captain_006 = 0x527, + snd_vc_captain_007 = 0x528, + snd_vc_captain_008 = 0x529, + snd_vc_captain_009 = 0x52A, + snd_vc_captain_010 = 0x52B, + snd_vc_captain_011 = 0x52C, + snd_vc_captain_012 = 0x52D, + snd_vc_captain_013 = 0x52E, + snd_vc_captain_014 = 0x52F, + snd_vc_captain_015 = 0x530, + snd_vc_captain_016 = 0x531, + snd_vc_captain_017 = 0x532, + snd_vc_captain_018 = 0x533, + snd_vc_captain_019 = 0x534, + snd_vc_captain_020 = 0x535, + snd_vc_captain_021 = 0x536, + snd_vc_captain_022 = 0x537, + snd_vc_captain_023 = 0x538, + snd_vc_captain_024 = 0x539, + snd_vc_captain_025 = 0x53A, + snd_vc_captain_026 = 0x53B, + snd_vc_captain_027 = 0x53C, + snd_vc_captain_028 = 0x53D, + snd_vc_captain_029 = 0x53E, + snd_vc_captain_030 = 0x53F, + snd_vc_captain_031 = 0x540, + snd_vc_captain_032 = 0x541, + snd_vc_captain_033 = 0x542, + snd_vc_captain_034 = 0x543, + snd_vc_captain_035 = 0x544, + snd_vc_captain_036 = 0x545, + snd_vc_captain_037 = 0x546, + snd_vc_captain_038 = 0x547, + snd_vc_captain_039 = 0x548, + snd_vc_captain_040 = 0x549, + snd_vc_captain_041 = 0x54A, + snd_vc_captain_042 = 0x54B, + snd_vc_captain_043 = 0x54C, + snd_vc_captain_044 = 0x54D, + snd_vc_captain_045 = 0x54E, + snd_vc_captain_046 = 0x54F, + snd_vc_captain_047 = 0x550, + snd_vc_captain_048 = 0x551, + snd_vc_captain_049 = 0x552, + snd_vc_ouen_Captain = 0x553, + snd_vc_captain_Appeal01 = 0x554, + snd_vc_captain_Appeal02 = 0x555, + snd_vc_captain_Appeal03 = 0x556, + snd_vc_captain_Attack01 = 0x557, + snd_vc_captain_Attack02 = 0x558, + snd_vc_captain_Attack03 = 0x559, + snd_vc_captain_Attack04 = 0x55A, + snd_vc_captain_Attack05 = 0x55B, + snd_vc_captain_Attack06 = 0x55C, + snd_vc_captain_Attack07 = 0x55D, + snd_vc_captain_CliffCatch = 0x55E, + snd_vc_captain_Damage_hoshikie = 0x55F, + snd_vc_captain_Damage01 = 0x560, + snd_vc_captain_Damage02 = 0x561, + snd_vc_captain_DamageFly01 = 0x562, + snd_vc_captain_DamageFly02 = 0x563, + snd_vc_captain_FuraFura = 0x564, + snd_vc_captain_FuraSleep = 0x565, + snd_vc_captain_HeavyGet = 0x566, + snd_vc_captain_Jump01 = 0x567, + snd_vc_captain_Jump02 = 0x568, + snd_vc_captain_MissFoot01 = 0x569, + snd_vc_captain_MissFoot02 = 0x56A, + snd_vc_captain_Ottotto = 0x56B, + snd_vc_captain_Passive = 0x56C, + snd_vc_captain_SwimUp = 0x56D, + snd_vc_captain_Win01 = 0x56E, + snd_vc_captain_Win02 = 0x56F, + snd_vc_captain_Win03 = 0x570, + snd_vc_koopa_001 = 0x571, + snd_vc_koopa_002 = 0x572, + snd_vc_koopa_003 = 0x573, + snd_vc_koopa_004 = 0x574, + snd_vc_koopa_005 = 0x575, + snd_vc_koopa_006 = 0x576, + snd_vc_koopa_007 = 0x577, + snd_vc_koopa_008 = 0x578, + snd_vc_koopa_009 = 0x579, + snd_vc_koopa_010 = 0x57A, + snd_vc_koopa_011 = 0x57B, + snd_vc_koopa_012 = 0x57C, + snd_vc_koopa_013 = 0x57D, + snd_vc_koopa_014 = 0x57E, + snd_vc_koopa_015 = 0x57F, + snd_vc_koopa_016 = 0x580, + snd_vc_koopa_017 = 0x581, + snd_vc_koopa_018 = 0x582, + snd_vc_koopa_019 = 0x583, + snd_vc_koopa_020 = 0x584, + snd_vc_koopa_021 = 0x585, + snd_vc_koopa_022 = 0x586, + snd_vc_koopa_023 = 0x587, + snd_vc_koopa_024 = 0x588, + snd_vc_koopa_025 = 0x589, + snd_vc_koopa_026 = 0x58A, + snd_vc_koopa_027 = 0x58B, + snd_vc_koopa_028 = 0x58C, + snd_vc_koopa_029 = 0x58D, + snd_vc_koopa_030 = 0x58E, + snd_vc_koopa_031 = 0x58F, + snd_vc_koopa_032 = 0x590, + snd_vc_koopa_033 = 0x591, + snd_vc_koopa_034 = 0x592, + snd_vc_koopa_035 = 0x593, + snd_vc_koopa_036 = 0x594, + snd_vc_koopa_037 = 0x595, + snd_vc_koopa_038 = 0x596, + snd_vc_koopa_039 = 0x597, + snd_vc_koopa_040 = 0x598, + snd_vc_koopa_041 = 0x599, + snd_vc_koopa_042 = 0x59A, + snd_vc_koopa_043 = 0x59B, + snd_vc_koopa_044 = 0x59C, + snd_vc_koopa_045 = 0x59D, + snd_vc_koopa_046 = 0x59E, + snd_vc_koopa_047 = 0x59F, + snd_vc_koopa_048 = 0x5A0, + snd_vc_koopa_049 = 0x5A1, + snd_vc_ouen_Koopa = 0x5A2, + snd_vc_koopa_Appeal01 = 0x5A3, + snd_vc_koopa_Appeal02 = 0x5A4, + snd_vc_koopa_Appeal03 = 0x5A5, + snd_vc_koopa_Attack01 = 0x5A6, + snd_vc_koopa_Attack02 = 0x5A7, + snd_vc_koopa_Attack03 = 0x5A8, + snd_vc_koopa_Attack04 = 0x5A9, + snd_vc_koopa_Attack05 = 0x5AA, + snd_vc_koopa_Attack06 = 0x5AB, + snd_vc_koopa_Attack07 = 0x5AC, + snd_vc_koopa_CliffCatch = 0x5AD, + snd_vc_koopa_Damage_hoshikie = 0x5AE, + snd_vc_koopa_Damage01 = 0x5AF, + snd_vc_koopa_Damage02 = 0x5B0, + snd_vc_koopa_DamageFly01 = 0x5B1, + snd_vc_koopa_DamageFly02 = 0x5B2, + snd_vc_koopa_FuraFura = 0x5B3, + snd_vc_koopa_FuraSleep = 0x5B4, + snd_vc_koopa_HeavyGet = 0x5B5, + snd_vc_koopa_Jump01 = 0x5B6, + snd_vc_koopa_Jump02 = 0x5B7, + snd_vc_koopa_MissFoot01 = 0x5B8, + snd_vc_koopa_MissFoot02 = 0x5B9, + snd_vc_koopa_Ottotto = 0x5BA, + snd_vc_koopa_Passive = 0x5BB, + snd_vc_koopa_SwimUp = 0x5BC, + snd_vc_koopa_Win01 = 0x5BD, + snd_vc_koopa_Win02 = 0x5BE, + snd_vc_koopa_Win03 = 0x5BF, + snd_vc_peach_001 = 0x5C0, + snd_vc_peach_002 = 0x5C1, + snd_vc_peach_003 = 0x5C2, + snd_vc_peach_004 = 0x5C3, + snd_vc_peach_005 = 0x5C4, + snd_vc_peach_006 = 0x5C5, + snd_vc_peach_007 = 0x5C6, + snd_vc_peach_008 = 0x5C7, + snd_vc_peach_009 = 0x5C8, + snd_vc_peach_010 = 0x5C9, + snd_vc_peach_011 = 0x5CA, + snd_vc_peach_012 = 0x5CB, + snd_vc_peach_013 = 0x5CC, + snd_vc_peach_014 = 0x5CD, + snd_vc_peach_046 = 0x5CE, + snd_vc_peach_047 = 0x5CF, + snd_vc_peach_048 = 0x5D0, + snd_vc_peach_049 = 0x5D1, + snd_vc_ouen_Peach = 0x5D2, + snd_vc_peach_Appeal01 = 0x5D3, + snd_vc_peach_Appeal02 = 0x5D4, + snd_vc_peach_Appeal03 = 0x5D5, + snd_vc_peach_Attack01 = 0x5D6, + snd_vc_peach_Attack02 = 0x5D7, + snd_vc_peach_Attack03 = 0x5D8, + snd_vc_peach_Attack04 = 0x5D9, + snd_vc_peach_Attack05 = 0x5DA, + snd_vc_peach_Attack06 = 0x5DB, + snd_vc_peach_Attack07 = 0x5DC, + snd_vc_peach_CliffCatch = 0x5DD, + snd_vc_peach_Damage_hoshikie = 0x5DE, + snd_vc_peach_Damage01 = 0x5DF, + snd_vc_peach_Damage02 = 0x5E0, + snd_vc_peach_DamageFly01 = 0x5E1, + snd_vc_peach_DamageFly02 = 0x5E2, + snd_vc_peach_FuraFura = 0x5E3, + snd_vc_peach_FuraSleep = 0x5E4, + snd_vc_peach_HeavyGet = 0x5E5, + snd_vc_peach_Jump01 = 0x5E6, + snd_vc_peach_Jump02 = 0x5E7, + snd_vc_peach_MissFoot01 = 0x5E8, + snd_vc_peach_MissFoot02 = 0x5E9, + snd_vc_peach_Ottotto = 0x5EA, + snd_vc_peach_Passive = 0x5EB, + snd_vc_peach_SwimUp = 0x5EC, + snd_vc_peach_Win01 = 0x5ED, + snd_vc_peach_Win02 = 0x5EE, + snd_vc_peach_Win03 = 0x5EF, + snd_vc_Zelda_001 = 0x5F0, + snd_vc_Zelda_002 = 0x5F1, + snd_vc_Zelda_003 = 0x5F2, + snd_vc_Zelda_004 = 0x5F3, + snd_vc_Zelda_005 = 0x5F4, + snd_vc_Zelda_006 = 0x5F5, + snd_vc_Zelda_046 = 0x5F6, + snd_vc_Zelda_047 = 0x5F7, + snd_vc_Zelda_048 = 0x5F8, + snd_vc_Zelda_049 = 0x5F9, + snd_vc_ouen_Zelda = 0x5FA, + snd_vc_Zelda_Appeal01 = 0x5FB, + snd_vc_Zelda_Appeal02 = 0x5FC, + snd_vc_Zelda_Appeal03 = 0x5FD, + snd_vc_Zelda_Attack01 = 0x5FE, + snd_vc_Zelda_Attack02 = 0x5FF, + snd_vc_Zelda_Attack03 = 0x600, + snd_vc_Zelda_Attack04 = 0x601, + snd_vc_Zelda_Attack05 = 0x602, + snd_vc_Zelda_Attack06 = 0x603, + snd_vc_Zelda_Attack07 = 0x604, + snd_vc_Zelda_CliffCatch = 0x605, + snd_vc_Zelda_Damage_hoshikie = 0x606, + snd_vc_Zelda_Damage01 = 0x607, + snd_vc_Zelda_Damage02 = 0x608, + snd_vc_Zelda_DamageFly01 = 0x609, + snd_vc_Zelda_DamageFly02 = 0x60A, + snd_vc_Zelda_FuraFura = 0x60B, + snd_vc_Zelda_FuraSleep = 0x60C, + snd_vc_Zelda_HeavyGet = 0x60D, + snd_vc_Zelda_Jump01 = 0x60E, + snd_vc_Zelda_Jump02 = 0x60F, + snd_vc_Zelda_MissFoot01 = 0x610, + snd_vc_Zelda_MissFoot02 = 0x611, + snd_vc_Zelda_Ottotto = 0x612, + snd_vc_Zelda_Passive = 0x613, + snd_vc_Zelda_SwimUp = 0x614, + snd_vc_Zelda_Win01 = 0x615, + snd_vc_Zelda_Win02 = 0x616, + snd_vc_Zelda_Win03 = 0x617, + snd_vc_Sheik_001 = 0x618, + snd_vc_Sheik_002 = 0x619, + snd_vc_Sheik_003 = 0x61A, + snd_vc_Sheik_004 = 0x61B, + snd_vc_Sheik_005 = 0x61C, + snd_vc_Sheik_006 = 0x61D, + snd_vc_Sheik_046 = 0x61E, + snd_vc_Sheik_047 = 0x61F, + snd_vc_Sheik_048 = 0x620, + snd_vc_Sheik_049 = 0x621, + snd_vc_ouen_Sheik = 0x622, + snd_vc_Sheik_Appeal01 = 0x623, + snd_vc_Sheik_Appeal02 = 0x624, + snd_vc_Sheik_Appeal03 = 0x625, + snd_vc_Sheik_Attack01 = 0x626, + snd_vc_Sheik_Attack02 = 0x627, + snd_vc_Sheik_Attack03 = 0x628, + snd_vc_Sheik_Attack04 = 0x629, + snd_vc_Sheik_Attack05 = 0x62A, + snd_vc_Sheik_Attack06 = 0x62B, + snd_vc_Sheik_Attack07 = 0x62C, + snd_vc_Sheik_CliffCatch = 0x62D, + snd_vc_Sheik_Damage_hoshikie = 0x62E, + snd_vc_Sheik_Damage01 = 0x62F, + snd_vc_Sheik_Damage02 = 0x630, + snd_vc_Sheik_DamageFly01 = 0x631, + snd_vc_Sheik_DamageFly02 = 0x632, + snd_vc_Sheik_FuraFura = 0x633, + snd_vc_Sheik_FuraSleep = 0x634, + snd_vc_Sheik_HeavyGet = 0x635, + snd_vc_Sheik_Jump01 = 0x636, + snd_vc_Sheik_Jump02 = 0x637, + snd_vc_Sheik_MissFoot01 = 0x638, + snd_vc_Sheik_MissFoot02 = 0x639, + snd_vc_Sheik_Ottotto = 0x63A, + snd_vc_Sheik_Passive = 0x63B, + snd_vc_Sheik_SwimUp = 0x63C, + snd_vc_Sheik_Win01 = 0x63D, + snd_vc_Sheik_Win02 = 0x63E, + snd_vc_Sheik_Win03 = 0x63F, + snd_vc_popo_001 = 0x640, + snd_vc_popo_002 = 0x641, + snd_vc_popo_003 = 0x642, + snd_vc_popo_004 = 0x643, + snd_vc_popo_005 = 0x644, + snd_vc_popo_006 = 0x645, + snd_vc_popo_007 = 0x646, + snd_vc_popo_008 = 0x647, + snd_vc_popo_009 = 0x648, + snd_vc_popo_046 = 0x649, + snd_vc_popo_047 = 0x64A, + snd_vc_popo_048 = 0x64B, + snd_vc_popo_049 = 0x64C, + snd_vc_ouen_Iceclimber = 0x64D, + snd_vc_popo_Appeal01 = 0x64E, + snd_vc_popo_Appeal02 = 0x64F, + snd_vc_popo_Appeal03 = 0x650, + snd_vc_popo_Attack01 = 0x651, + snd_vc_popo_Attack02 = 0x652, + snd_vc_popo_Attack03 = 0x653, + snd_vc_popo_Attack04 = 0x654, + snd_vc_popo_Attack05 = 0x655, + snd_vc_popo_Attack06 = 0x656, + snd_vc_popo_Attack07 = 0x657, + snd_vc_popo_CliffCatch = 0x658, + snd_vc_popo_Damage_hoshikie = 0x659, + snd_vc_popo_Damage01 = 0x65A, + snd_vc_popo_Damage02 = 0x65B, + snd_vc_popo_DamageFly01 = 0x65C, + snd_vc_popo_DamageFly02 = 0x65D, + snd_vc_popo_FuraFura = 0x65E, + snd_vc_popo_FuraSleep = 0x65F, + snd_vc_popo_HeavyGet = 0x660, + snd_vc_popo_Jump01 = 0x661, + snd_vc_popo_Jump02 = 0x662, + snd_vc_popo_MissFoot01 = 0x663, + snd_vc_popo_MissFoot02 = 0x664, + snd_vc_popo_Ottotto = 0x665, + snd_vc_popo_Passive = 0x666, + snd_vc_popo_SwimUp = 0x667, + snd_vc_popo_Win01 = 0x668, + snd_vc_popo_Win02 = 0x669, + snd_vc_popo_Win03 = 0x66A, + snd_vc_nana_001 = 0x66B, + snd_vc_nana_002 = 0x66C, + snd_vc_nana_003 = 0x66D, + snd_vc_nana_004 = 0x66E, + snd_vc_nana_005 = 0x66F, + snd_vc_nana_006 = 0x670, + snd_vc_nana_007 = 0x671, + snd_vc_nana_008 = 0x672, + snd_vc_nana_009 = 0x673, + snd_vc_nana_046 = 0x674, + snd_vc_nana_047 = 0x675, + snd_vc_nana_048 = 0x676, + snd_vc_nana_049 = 0x677, + snd_vc_nana_050 = 0x678, + snd_vc_nana_Appeal01 = 0x679, + snd_vc_nana_Appeal02 = 0x67A, + snd_vc_nana_Appeal03 = 0x67B, + snd_vc_nana_Attack01 = 0x67C, + snd_vc_nana_Attack02 = 0x67D, + snd_vc_nana_Attack03 = 0x67E, + snd_vc_nana_Attack04 = 0x67F, + snd_vc_nana_Attack05 = 0x680, + snd_vc_nana_Attack06 = 0x681, + snd_vc_nana_Attack07 = 0x682, + snd_vc_nana_CliffCatch = 0x683, + snd_vc_nana_Damage_hoshikie = 0x684, + snd_vc_nana_Damage01 = 0x685, + snd_vc_nana_Damage02 = 0x686, + snd_vc_nana_DamageFly01 = 0x687, + snd_vc_nana_DamageFly02 = 0x688, + snd_vc_nana_FuraFura = 0x689, + snd_vc_nana_FuraSleep = 0x68A, + snd_vc_nana_HeavyGet = 0x68B, + snd_vc_nana_Jump01 = 0x68C, + snd_vc_nana_Jump02 = 0x68D, + snd_vc_nana_MissFoot01 = 0x68E, + snd_vc_nana_MissFoot02 = 0x68F, + snd_vc_nana_Ottotto = 0x690, + snd_vc_nana_Passive = 0x691, + snd_vc_nana_SwimUp = 0x692, + snd_vc_nana_Win01 = 0x693, + snd_vc_nana_Win02 = 0x694, + snd_vc_nana_Win03 = 0x695, + snd_vc_Marth_001 = 0x696, + snd_vc_Marth_002 = 0x697, + snd_vc_Marth_003 = 0x698, + snd_vc_Marth_004 = 0x699, + snd_vc_Marth_005 = 0x69A, + snd_vc_Marth_046 = 0x69B, + snd_vc_Marth_047 = 0x69C, + snd_vc_Marth_048 = 0x69D, + snd_vc_Marth_049 = 0x69E, + snd_vc_ouen_Marth = 0x69F, + snd_vc_Marth_Appeal01 = 0x6A0, + snd_vc_Marth_Appeal02 = 0x6A1, + snd_vc_Marth_Appeal03 = 0x6A2, + snd_vc_Marth_Attack01 = 0x6A3, + snd_vc_Marth_Attack02 = 0x6A4, + snd_vc_Marth_Attack03 = 0x6A5, + snd_vc_Marth_Attack04 = 0x6A6, + snd_vc_Marth_Attack05 = 0x6A7, + snd_vc_Marth_Attack06 = 0x6A8, + snd_vc_Marth_Attack07 = 0x6A9, + snd_vc_Marth_CliffCatch = 0x6AA, + snd_vc_Marth_Damage_hoshikie = 0x6AB, + snd_vc_Marth_Damage01 = 0x6AC, + snd_vc_Marth_Damage02 = 0x6AD, + snd_vc_Marth_DamageFly01 = 0x6AE, + snd_vc_Marth_DamageFly02 = 0x6AF, + snd_vc_Marth_FuraFura = 0x6B0, + snd_vc_Marth_FuraSleep = 0x6B1, + snd_vc_Marth_HeavyGet = 0x6B2, + snd_vc_Marth_Jump01 = 0x6B3, + snd_vc_Marth_Jump02 = 0x6B4, + snd_vc_Marth_MissFoot01 = 0x6B5, + snd_vc_Marth_MissFoot02 = 0x6B6, + snd_vc_Marth_Ottotto = 0x6B7, + snd_vc_Marth_Passive = 0x6B8, + snd_vc_Marth_SwimUp = 0x6B9, + snd_vc_Marth_Win01 = 0x6BA, + snd_vc_Marth_Win02 = 0x6BB, + snd_vc_Marth_Win03 = 0x6BC, + snd_vc_GW_046 = 0x6BD, + snd_vc_GW_047 = 0x6BE, + snd_vc_GW_048 = 0x6BF, + snd_vc_GW_049 = 0x6C0, + snd_vc_ouen_GameWatch = 0x6C1, + snd_vc_GW_Appeal01 = 0x6C2, + snd_vc_GW_Appeal02 = 0x6C3, + snd_vc_GW_Appeal03 = 0x6C4, + snd_vc_GW_Attack01 = 0x6C5, + snd_vc_GW_Attack02 = 0x6C6, + snd_vc_GW_Attack03 = 0x6C7, + snd_vc_GW_Attack04 = 0x6C8, + snd_vc_GW_Attack05 = 0x6C9, + snd_vc_GW_Attack06 = 0x6CA, + snd_vc_GW_Attack07 = 0x6CB, + snd_vc_GW_CliffCatch = 0x6CC, + snd_vc_GW_Damage_hoshikie = 0x6CD, + snd_vc_GW_Damage01 = 0x6CE, + snd_vc_GW_Damage02 = 0x6CF, + snd_vc_GW_DamageFly01 = 0x6D0, + snd_vc_GW_DamageFly02 = 0x6D1, + snd_vc_GW_FuraFura = 0x6D2, + snd_vc_GW_FuraSleep = 0x6D3, + snd_vc_GW_HeavyGet = 0x6D4, + snd_vc_GW_Jump01 = 0x6D5, + snd_vc_GW_Jump02 = 0x6D6, + snd_vc_GW_MissFoot01 = 0x6D7, + snd_vc_GW_MissFoot02 = 0x6D8, + snd_vc_GW_Ottotto = 0x6D9, + snd_vc_GW_Passive = 0x6DA, + snd_vc_GW_SwimUp = 0x6DB, + snd_vc_GW_Win01 = 0x6DC, + snd_vc_GW_Win02 = 0x6DD, + snd_vc_GW_Win03 = 0x6DE, + snd_vc_Falco_001 = 0x6DF, + snd_vc_Falco_002 = 0x6E0, + snd_vc_Falco_003 = 0x6E1, + snd_vc_Falco_004 = 0x6E2, + snd_vc_Falco_005 = 0x6E3, + snd_vc_Falco_006 = 0x6E4, + snd_vc_Falco_007 = 0x6E5, + snd_vc_Falco_Win_Fox = 0x6E6, + snd_vc_Falco_009 = 0x6E7, + snd_vc_Falco_010 = 0x6E8, + snd_vc_Falco_011 = 0x6E9, + snd_vc_Falco_012 = 0x6EA, + snd_vc_Falco_013 = 0x6EB, + snd_vc_Falco_014 = 0x6EC, + snd_vc_Falco_015 = 0x6ED, + snd_vc_Falco_016 = 0x6EE, + snd_vc_Falco_017 = 0x6EF, + snd_vc_Falco_018 = 0x6F0, + snd_vc_Falco_019 = 0x6F1, + snd_vc_Falco_020 = 0x6F2, + snd_vc_Falco_021 = 0x6F3, + snd_vc_Falco_022 = 0x6F4, + snd_vc_Falco_023 = 0x6F5, + snd_vc_Falco_024 = 0x6F6, + snd_vc_Falco_025 = 0x6F7, + snd_vc_Falco_026 = 0x6F8, + snd_vc_Falco_027 = 0x6F9, + snd_vc_Falco_028 = 0x6FA, + snd_vc_Falco_029 = 0x6FB, + snd_vc_Falco_030 = 0x6FC, + snd_vc_Falco_031 = 0x6FD, + snd_vc_Falco_032 = 0x6FE, + snd_vc_Falco_033 = 0x6FF, + snd_vc_Falco_034 = 0x700, + snd_vc_Falco_035 = 0x701, + snd_vc_Falco_036 = 0x702, + snd_vc_Falco_037 = 0x703, + snd_vc_Falco_038 = 0x704, + snd_vc_Falco_039 = 0x705, + snd_vc_Falco_040 = 0x706, + snd_vc_Falco_041 = 0x707, + snd_vc_Falco_042 = 0x708, + snd_vc_Falco_043 = 0x709, + snd_vc_Falco_044 = 0x70A, + snd_vc_Falco_045 = 0x70B, + snd_vc_Falco_046 = 0x70C, + snd_vc_Falco_047 = 0x70D, + snd_vc_Falco_048 = 0x70E, + snd_vc_Falco_049 = 0x70F, + snd_vc_ouen_Falco = 0x710, + snd_vc_Falco_Appeal01 = 0x711, + snd_vc_Falco_Appeal02 = 0x712, + snd_vc_Falco_Appeal03 = 0x713, + snd_vc_Falco_Attack01 = 0x714, + snd_vc_Falco_Attack02 = 0x715, + snd_vc_Falco_Attack03 = 0x716, + snd_vc_Falco_Attack04 = 0x717, + snd_vc_Falco_Attack05 = 0x718, + snd_vc_Falco_Attack06 = 0x719, + snd_vc_Falco_Attack07 = 0x71A, + snd_vc_Falco_CliffCatch = 0x71B, + snd_vc_Falco_Damage_hoshikie = 0x71C, + snd_vc_Falco_Damage01 = 0x71D, + snd_vc_Falco_Damage02 = 0x71E, + snd_vc_Falco_DamageFly01 = 0x71F, + snd_vc_Falco_DamageFly02 = 0x720, + snd_vc_Falco_FuraFura = 0x721, + snd_vc_Falco_FuraSleep = 0x722, + snd_vc_Falco_HeavyGet = 0x723, + snd_vc_Falco_Jump01 = 0x724, + snd_vc_Falco_Jump02 = 0x725, + snd_vc_Falco_MissFoot01 = 0x726, + snd_vc_Falco_MissFoot02 = 0x727, + snd_vc_Falco_Ottotto = 0x728, + snd_vc_Falco_Passive = 0x729, + snd_vc_Falco_SwimUp = 0x72A, + snd_vc_Falco_Win01 = 0x72B, + snd_vc_Falco_Win02 = 0x72C, + snd_vc_Falco_Win03 = 0x72D, + snd_vc_Ganondorf_001 = 0x72E, + snd_vc_Ganondorf_002 = 0x72F, + snd_vc_Ganondorf_003 = 0x730, + snd_vc_Ganondorf_004 = 0x731, + snd_vc_Ganondorf_005 = 0x732, + snd_vc_Ganondorf_006 = 0x733, + snd_vc_Ganondorf_007 = 0x734, + snd_vc_Ganondorf_008 = 0x735, + snd_vc_Ganondorf_009 = 0x736, + snd_vc_Ganondorf_010 = 0x737, + snd_vc_Ganondorf_011 = 0x738, + snd_vc_Ganondorf_012 = 0x739, + snd_vc_Ganondorf_013 = 0x73A, + snd_vc_Ganondorf_014 = 0x73B, + snd_vc_Ganondorf_046 = 0x73C, + snd_vc_Ganondorf_047 = 0x73D, + snd_vc_Ganondorf_048 = 0x73E, + snd_vc_Ganondorf_049 = 0x73F, + snd_vc_ouen_Ganon = 0x740, + snd_vc_Ganondorf_Appeal01 = 0x741, + snd_vc_Ganondorf_Appeal02 = 0x742, + snd_vc_Ganondorf_Appeal03 = 0x743, + snd_vc_Ganondorf_Attack01 = 0x744, + snd_vc_Ganondorf_Attack02 = 0x745, + snd_vc_Ganondorf_Attack03 = 0x746, + snd_vc_Ganondorf_Attack04 = 0x747, + snd_vc_Ganondorf_Attack05 = 0x748, + snd_vc_Ganondorf_Attack06 = 0x749, + snd_vc_Ganondorf_Attack07 = 0x74A, + snd_vc_Ganondorf_CliffCatch = 0x74B, + snd_vc_Ganondorf_Damage_hoshikie = 0x74C, + snd_vc_Ganondorf_Damage01 = 0x74D, + snd_vc_Ganondorf_Damage02 = 0x74E, + snd_vc_Ganondorf_DamageFly01 = 0x74F, + snd_vc_Ganondorf_DamageFly02 = 0x750, + snd_vc_Ganondorf_FuraFura = 0x751, + snd_vc_Ganondorf_FuraSleep = 0x752, + snd_vc_Ganondorf_HeavyGet = 0x753, + snd_vc_Ganondorf_Jump01 = 0x754, + snd_vc_Ganondorf_Jump02 = 0x755, + snd_vc_Ganondorf_MissFoot01 = 0x756, + snd_vc_Ganondorf_MissFoot02 = 0x757, + snd_vc_Ganondorf_Ottotto = 0x758, + snd_vc_Ganondorf_Passive = 0x759, + snd_vc_Ganondorf_SwimUp = 0x75A, + snd_vc_Ganondorf_Win01 = 0x75B, + snd_vc_Ganondorf_Win02 = 0x75C, + snd_vc_Ganondorf_Win03 = 0x75D, + snd_vc_Wario_001 = 0x75E, + snd_vc_Wario_002 = 0x75F, + snd_vc_Wario_003 = 0x760, + snd_vc_Wario_004 = 0x761, + snd_vc_Wario_005 = 0x762, + snd_vc_Wario_006 = 0x763, + snd_vc_Wario_007 = 0x764, + snd_vc_Wario_008 = 0x765, + snd_vc_Wario_009 = 0x766, + snd_vc_Wario_010 = 0x767, + snd_vc_Wario_011 = 0x768, + snd_vc_Wario_012 = 0x769, + snd_vc_Wario_013 = 0x76A, + snd_vc_Wario_014 = 0x76B, + snd_vc_Wario_015 = 0x76C, + snd_vc_Wario_016 = 0x76D, + snd_vc_Wario_017 = 0x76E, + snd_vc_Wario_018 = 0x76F, + snd_vc_Wario_019 = 0x770, + snd_vc_Wario_020 = 0x771, + snd_vc_Wario_021 = 0x772, + snd_vc_Wario_022 = 0x773, + snd_vc_Wario_046 = 0x774, + snd_vc_Wario_047 = 0x775, + snd_vc_Wario_048 = 0x776, + snd_vc_Wario_049 = 0x777, + snd_vc_ouen_Wario = 0x778, + snd_vc_Wario_Appeal01 = 0x779, + snd_vc_Wario_Appeal02 = 0x77A, + snd_vc_Wario_Appeal03 = 0x77B, + snd_vc_Wario_Attack01 = 0x77C, + snd_vc_Wario_Attack02 = 0x77D, + snd_vc_Wario_Attack03 = 0x77E, + snd_vc_Wario_Attack04 = 0x77F, + snd_vc_Wario_Attack05 = 0x780, + snd_vc_Wario_Attack06 = 0x781, + snd_vc_Wario_Attack07 = 0x782, + snd_vc_Wario_CliffCatch = 0x783, + snd_vc_Wario_Damage_hoshikie = 0x784, + snd_vc_Wario_Damage01 = 0x785, + snd_vc_Wario_Damage02 = 0x786, + snd_vc_Wario_DamageFly01 = 0x787, + snd_vc_Wario_DamageFly02 = 0x788, + snd_vc_Wario_FuraFura = 0x789, + snd_vc_Wario_FuraSleep = 0x78A, + snd_vc_Wario_HeavyGet = 0x78B, + snd_vc_Wario_Jump01 = 0x78C, + snd_vc_Wario_Jump02 = 0x78D, + snd_vc_Wario_MissFoot01 = 0x78E, + snd_vc_Wario_MissFoot02 = 0x78F, + snd_vc_Wario_Ottotto = 0x790, + snd_vc_Wario_Passive = 0x791, + snd_vc_Wario_SwimUp = 0x792, + snd_vc_Wario_Win01 = 0x793, + snd_vc_Wario_Win02 = 0x794, + snd_vc_Wario_Win03 = 0x795, + snd_vc_szerosuit_001 = 0x796, + snd_vc_szerosuit_002 = 0x797, + snd_vc_szerosuit_003 = 0x798, + snd_vc_szerosuit_004 = 0x799, + snd_vc_szerosuit_005 = 0x79A, + snd_vc_szerosuit_006 = 0x79B, + snd_vc_szerosuit_007 = 0x79C, + snd_vc_szerosuit_008 = 0x79D, + snd_vc_szerosuit_009 = 0x79E, + snd_vc_szerosuit_010 = 0x79F, + snd_vc_szerosuit_046 = 0x7A0, + snd_vc_szerosuit_047 = 0x7A1, + snd_vc_szerosuit_048 = 0x7A2, + snd_vc_szerosuit_049 = 0x7A3, + snd_vc_ouen_SZerosuit = 0x7A4, + snd_vc_szerosuit_Appeal01 = 0x7A5, + snd_vc_szerosuit_Appeal02 = 0x7A6, + snd_vc_szerosuit_Appeal03 = 0x7A7, + snd_vc_szerosuit_Attack01 = 0x7A8, + snd_vc_szerosuit_Attack02 = 0x7A9, + snd_vc_szerosuit_Attack03 = 0x7AA, + snd_vc_szerosuit_Attack04 = 0x7AB, + snd_vc_szerosuit_Attack05 = 0x7AC, + snd_vc_szerosuit_Attack06 = 0x7AD, + snd_vc_szerosuit_Attack07 = 0x7AE, + snd_vc_szerosuit_CliffCatch = 0x7AF, + snd_vc_szerosuit_Damage_hoshikie = 0x7B0, + snd_vc_szerosuit_Damage01 = 0x7B1, + snd_vc_szerosuit_Damage02 = 0x7B2, + snd_vc_szerosuit_DamageFly01 = 0x7B3, + snd_vc_szerosuit_DamageFly02 = 0x7B4, + snd_vc_szerosuit_FuraFura = 0x7B5, + snd_vc_szerosuit_FuraSleep = 0x7B6, + snd_vc_szerosuit_HeavyGet = 0x7B7, + snd_vc_szerosuit_Jump01 = 0x7B8, + snd_vc_szerosuit_Jump02 = 0x7B9, + snd_vc_szerosuit_MissFoot01 = 0x7BA, + snd_vc_szerosuit_MissFoot02 = 0x7BB, + snd_vc_szerosuit_Ottotto = 0x7BC, + snd_vc_szerosuit_Passive = 0x7BD, + snd_vc_szerosuit_SwimUp = 0x7BE, + snd_vc_szerosuit_Win01 = 0x7BF, + snd_vc_szerosuit_Win02 = 0x7C0, + snd_vc_szerosuit_Win03 = 0x7C1, + snd_vc_pikmin_001 = 0x7C2, + snd_vc_pikmin_002 = 0x7C3, + snd_vc_pikmin_003 = 0x7C4, + snd_vc_pikmin_004 = 0x7C5, + snd_vc_pikmin_005 = 0x7C6, + snd_vc_pikmin_006 = 0x7C7, + snd_vc_pikmin_007 = 0x7C8, + snd_vc_pikmin_008 = 0x7C9, + snd_vc_pikmin_009 = 0x7CA, + snd_vc_pikmin_010 = 0x7CB, + snd_vc_pikmin_011 = 0x7CC, + snd_vc_pikmin_012 = 0x7CD, + snd_vc_pikmin_013 = 0x7CE, + snd_vc_pikmin_014 = 0x7CF, + snd_vc_pikmin_015 = 0x7D0, + snd_vc_pikmin_016 = 0x7D1, + snd_vc_pikmin_017 = 0x7D2, + snd_vc_pikmin_018 = 0x7D3, + snd_vc_pikmin_019 = 0x7D4, + snd_vc_pikmin_020 = 0x7D5, + snd_vc_pikmin_021 = 0x7D6, + snd_vc_pikmin_022 = 0x7D7, + snd_vc_pikmin_023 = 0x7D8, + snd_vc_pikmin_024 = 0x7D9, + snd_vc_pikmin_025 = 0x7DA, + snd_vc_pikmin_026 = 0x7DB, + snd_vc_pikmin_027 = 0x7DC, + snd_vc_pikmin_028 = 0x7DD, + snd_vc_pikmin_029 = 0x7DE, + snd_vc_pikmin_030 = 0x7DF, + snd_vc_pikmin_031 = 0x7E0, + snd_vc_pikmin_032 = 0x7E1, + snd_vc_pikmin_033 = 0x7E2, + snd_vc_pikmin_034 = 0x7E3, + snd_vc_pikmin_035 = 0x7E4, + snd_vc_pikmin_036 = 0x7E5, + snd_vc_pikmin_037 = 0x7E6, + snd_vc_pikmin_038 = 0x7E7, + snd_vc_pikmin_039 = 0x7E8, + snd_vc_pikmin_040 = 0x7E9, + snd_vc_pikmin_041 = 0x7EA, + snd_vc_pikmin_042 = 0x7EB, + snd_vc_pikmin_043 = 0x7EC, + snd_vc_pikmin_044 = 0x7ED, + snd_vc_pikmin_045 = 0x7EE, + snd_vc_pikmin_046 = 0x7EF, + snd_vc_pikmin_047 = 0x7F0, + snd_vc_pikmin_048 = 0x7F1, + snd_vc_pikmin_049 = 0x7F2, + snd_vc_ouen_Pikmin = 0x7F3, + snd_vc_pikmin_Appeal01 = 0x7F4, + snd_vc_pikmin_Appeal02 = 0x7F5, + snd_vc_pikmin_Appeal03 = 0x7F6, + snd_vc_pikmin_Attack01 = 0x7F7, + snd_vc_pikmin_Attack02 = 0x7F8, + snd_vc_pikmin_Attack03 = 0x7F9, + snd_vc_pikmin_Attack04 = 0x7FA, + snd_vc_pikmin_Attack05 = 0x7FB, + snd_vc_pikmin_Attack06 = 0x7FC, + snd_vc_pikmin_Attack07 = 0x7FD, + snd_vc_pikmin_CliffCatch = 0x7FE, + snd_vc_pikmin_Damage_hoshikie = 0x7FF, + snd_vc_pikmin_Damage01 = 0x800, + snd_vc_pikmin_Damage02 = 0x801, + snd_vc_pikmin_DamageFly01 = 0x802, + snd_vc_pikmin_DamageFly02 = 0x803, + snd_vc_pikmin_FuraFura = 0x804, + snd_vc_pikmin_FuraSleep = 0x805, + snd_vc_pikmin_HeavyGet = 0x806, + snd_vc_pikmin_Jump01 = 0x807, + snd_vc_pikmin_Jump02 = 0x808, + snd_vc_pikmin_MissFoot01 = 0x809, + snd_vc_pikmin_MissFoot02 = 0x80A, + snd_vc_pikmin_Ottotto = 0x80B, + snd_vc_pikmin_Passive = 0x80C, + snd_vc_pikmin_SwimUp = 0x80D, + snd_vc_pikmin_Win01 = 0x80E, + snd_vc_pikmin_Win02 = 0x80F, + snd_vc_pikmin_Win03 = 0x810, + snd_vc_lucas_001 = 0x811, + snd_vc_lucas_002 = 0x812, + snd_vc_lucas_003 = 0x813, + snd_vc_lucas_004 = 0x814, + snd_vc_lucas_005 = 0x815, + snd_vc_lucas_006 = 0x816, + snd_vc_lucas_007 = 0x817, + snd_vc_lucas_008 = 0x818, + snd_vc_lucas_009 = 0x819, + snd_vc_lucas_010 = 0x81A, + snd_vc_lucas_011 = 0x81B, + snd_vc_lucas_012 = 0x81C, + snd_vc_lucas_046 = 0x81D, + snd_vc_lucas_047 = 0x81E, + snd_vc_lucas_048 = 0x81F, + snd_vc_lucas_049 = 0x820, + snd_vc_ouen_Lucas = 0x821, + snd_vc_lucas_Appeal01 = 0x822, + snd_vc_lucas_Appeal02 = 0x823, + snd_vc_lucas_Appeal03 = 0x824, + snd_vc_lucas_Attack01 = 0x825, + snd_vc_lucas_Attack02 = 0x826, + snd_vc_lucas_Attack03 = 0x827, + snd_vc_lucas_Attack04 = 0x828, + snd_vc_lucas_Attack05 = 0x829, + snd_vc_lucas_Attack06 = 0x82A, + snd_vc_lucas_Attack07 = 0x82B, + snd_vc_lucas_CliffCatch = 0x82C, + snd_vc_lucas_Damage_hoshikie = 0x82D, + snd_vc_lucas_Damage01 = 0x82E, + snd_vc_lucas_Damage02 = 0x82F, + snd_vc_lucas_DamageFly01 = 0x830, + snd_vc_lucas_DamageFly02 = 0x831, + snd_vc_lucas_FuraFura = 0x832, + snd_vc_lucas_FuraSleep = 0x833, + snd_vc_lucas_HeavyGet = 0x834, + snd_vc_lucas_Jump01 = 0x835, + snd_vc_lucas_Jump02 = 0x836, + snd_vc_lucas_MissFoot01 = 0x837, + snd_vc_lucas_MissFoot02 = 0x838, + snd_vc_lucas_Ottotto = 0x839, + snd_vc_lucas_Passive = 0x83A, + snd_vc_lucas_SwimUp = 0x83B, + snd_vc_lucas_Win01 = 0x83C, + snd_vc_lucas_Win02 = 0x83D, + snd_vc_lucas_Win03 = 0x83E, + snd_vc_Diddy_001 = 0x83F, + snd_vc_Diddy_002 = 0x840, + snd_vc_Diddy_003 = 0x841, + snd_vc_Diddy_004 = 0x842, + snd_vc_Diddy_005 = 0x843, + snd_vc_Diddy_046 = 0x844, + snd_vc_Diddy_047 = 0x845, + snd_vc_Diddy_048 = 0x846, + snd_vc_Diddy_049 = 0x847, + snd_vc_ouen_Diddy = 0x848, + snd_vc_Diddy_Appeal01 = 0x849, + snd_vc_Diddy_Appeal02 = 0x84A, + snd_vc_Diddy_Appeal03 = 0x84B, + snd_vc_Diddy_Attack01 = 0x84C, + snd_vc_Diddy_Attack02 = 0x84D, + snd_vc_Diddy_Attack03 = 0x84E, + snd_vc_Diddy_Attack04 = 0x84F, + snd_vc_Diddy_Attack05 = 0x850, + snd_vc_Diddy_Attack06 = 0x851, + snd_vc_Diddy_Attack07 = 0x852, + snd_vc_Diddy_CliffCatch = 0x853, + snd_vc_Diddy_Damage_hoshikie = 0x854, + snd_vc_Diddy_Damage01 = 0x855, + snd_vc_Diddy_Damage02 = 0x856, + snd_vc_Diddy_DamageFly01 = 0x857, + snd_vc_Diddy_DamageFly02 = 0x858, + snd_vc_Diddy_FuraFura = 0x859, + snd_vc_Diddy_FuraSleep = 0x85A, + snd_vc_Diddy_HeavyGet = 0x85B, + snd_vc_Diddy_Jump01 = 0x85C, + snd_vc_Diddy_Jump02 = 0x85D, + snd_vc_Diddy_MissFoot01 = 0x85E, + snd_vc_Diddy_MissFoot02 = 0x85F, + snd_vc_Diddy_Ottotto = 0x860, + snd_vc_Diddy_Passive = 0x861, + snd_vc_Diddy_SwimUp = 0x862, + snd_vc_Diddy_Win01 = 0x863, + snd_vc_Diddy_Win02 = 0x864, + snd_vc_Diddy_Win03 = 0x865, + snd_vc_PokeTrainer_Pokelizardon_Go_01 = 0x866, + snd_vc_PokeTrainer_Pokelizardon_Go_02 = 0x867, + snd_vc_PokeTrainer_Pokelizardon_Go_03 = 0x868, + snd_vc_PokeTrainer_Pokelizardon_Win = 0x869, + snd_vc_PokeTrainer_Pokezenigame_Go_01 = 0x86A, + snd_vc_PokeTrainer_Pokezenigame_Go_02 = 0x86B, + snd_vc_PokeTrainer_Pokezenigame_Go_03 = 0x86C, + snd_vc_PokeTrainer_Pokezenigame_Win = 0x86D, + snd_vc_PokeTrainer_Pokefushigisou_Go_01 = 0x86E, + snd_vc_PokeTrainer_Pokefushigisou_Go_02 = 0x86F, + snd_vc_PokeTrainer_Pokefushigisou_Go_03 = 0x870, + snd_vc_PokeTrainer_Pokefushigisou_Win = 0x871, + snd_vc_PokeTrainer_Pokemon_Back_01 = 0x872, + snd_vc_PokeTrainer_Pokemon_Back_02 = 0x873, + snd_vc_PokeTrainer_Pokemon_Back_03 = 0x874, + snd_vc_PokeTrainer_016 = 0x875, + snd_vc_Lizardon_002 = 0x876, + snd_vc_Zenigame_002 = 0x877, + snd_vc_Fushigisou_003 = 0x878, + snd_vc_PokeTrainer_020 = 0x879, + snd_vc_Lizardon_001 = 0x87A, + snd_vc_Lizardon_002_dummy = 0x87B, + snd_vc_Lizardon_003 = 0x87C, + snd_vc_Lizardon_004 = 0x87D, + snd_vc_Lizardon_005 = 0x87E, + snd_vc_Lizardon_006 = 0x87F, + snd_vc_Lizardon_007 = 0x880, + snd_vc_Lizardon_008 = 0x881, + snd_vc_Lizardon_009 = 0x882, + snd_vc_Lizardon_010 = 0x883, + snd_vc_Lizardon_011 = 0x884, + snd_vc_Lizardon_012 = 0x885, + snd_vc_Lizardon_013 = 0x886, + snd_vc_Lizardon_014 = 0x887, + snd_vc_Lizardon_046 = 0x888, + snd_vc_Lizardon_047 = 0x889, + snd_vc_Lizardon_048 = 0x88A, + snd_vc_Lizardon_049 = 0x88B, + snd_vc_ouen_PokeLizardon = 0x88C, + snd_vc_Lizardon_Appeal01 = 0x88D, + snd_vc_Lizardon_Appeal02 = 0x88E, + snd_vc_Lizardon_Appeal03 = 0x88F, + snd_vc_Lizardon_Attack01 = 0x890, + snd_vc_Lizardon_Attack02 = 0x891, + snd_vc_Lizardon_Attack03 = 0x892, + snd_vc_Lizardon_Attack04 = 0x893, + snd_vc_Lizardon_Attack05 = 0x894, + snd_vc_Lizardon_Attack06 = 0x895, + snd_vc_Lizardon_Attack07 = 0x896, + snd_vc_Lizardon_CliffCatch = 0x897, + snd_vc_Lizardon_Damage_hoshikie = 0x898, + snd_vc_Lizardon_Damage01 = 0x899, + snd_vc_Lizardon_Damage02 = 0x89A, + snd_vc_Lizardon_DamageFly01 = 0x89B, + snd_vc_Lizardon_DamageFly02 = 0x89C, + snd_vc_Lizardon_FuraFura = 0x89D, + snd_vc_Lizardon_FuraSleep = 0x89E, + snd_vc_Lizardon_HeavyGet = 0x89F, + snd_vc_Lizardon_Jump01 = 0x8A0, + snd_vc_Lizardon_Jump02 = 0x8A1, + snd_vc_Lizardon_MissFoot01_Dummy = 0x8A2, + snd_vc_Lizardon_MissFoot02_Dummy = 0x8A3, + snd_vc_Lizardon_Ottotto = 0x8A4, + snd_vc_Lizardon_Passive = 0x8A5, + snd_vc_Lizardon_SwimUp = 0x8A6, + snd_vc_Lizardon_Win01 = 0x8A7, + snd_vc_Lizardon_Win02 = 0x8A8, + snd_vc_Lizardon_Win03 = 0x8A9, + snd_vc_Zenigame_001 = 0x8AA, + snd_vc_Zenigame_002_dummy = 0x8AB, + snd_vc_Zenigame_003 = 0x8AC, + snd_vc_Zenigame_004 = 0x8AD, + snd_vc_Zenigame_005 = 0x8AE, + snd_vc_Zenigame_006 = 0x8AF, + snd_vc_Zenigame_007 = 0x8B0, + snd_vc_Zenigame_008 = 0x8B1, + snd_vc_Zenigame_009 = 0x8B2, + snd_vc_Zenigame_046 = 0x8B3, + snd_vc_Zenigame_047 = 0x8B4, + snd_vc_Zenigame_048 = 0x8B5, + snd_vc_Zenigame_049 = 0x8B6, + snd_vc_ouen_PokeZenigame = 0x8B7, + snd_vc_Zenigame_Appeal01 = 0x8B8, + snd_vc_Zenigame_Appeal02 = 0x8B9, + snd_vc_Zenigame_Appeal03 = 0x8BA, + snd_vc_Zenigame_Attack01 = 0x8BB, + snd_vc_Zenigame_Attack02 = 0x8BC, + snd_vc_Zenigame_Attack03 = 0x8BD, + snd_vc_Zenigame_Attack04 = 0x8BE, + snd_vc_Zenigame_Attack05 = 0x8BF, + snd_vc_Zenigame_Attack06 = 0x8C0, + snd_vc_Zenigame_Attack07 = 0x8C1, + snd_vc_Zenigame_CliffCatch = 0x8C2, + snd_vc_Zenigame_Damage_hoshikie = 0x8C3, + snd_vc_Zenigame_Damage01 = 0x8C4, + snd_vc_Zenigame_Damage02 = 0x8C5, + snd_vc_Zenigame_DamageFly01 = 0x8C6, + snd_vc_Zenigame_DamageFly02 = 0x8C7, + snd_vc_Zenigame_FuraFura = 0x8C8, + snd_vc_Zenigame_FuraSleep = 0x8C9, + snd_vc_Zenigame_HeavyGet = 0x8CA, + snd_vc_Zenigame_Jump01 = 0x8CB, + snd_vc_Zenigame_Jump02 = 0x8CC, + snd_vc_Zenigame_MissFoot01_Dummy = 0x8CD, + snd_vc_Zenigame_MissFoot02_Dummy = 0x8CE, + snd_vc_Zenigame_Ottotto = 0x8CF, + snd_vc_Zenigame_Passive = 0x8D0, + snd_vc_Zenigame_SwimUp = 0x8D1, + snd_vc_Zenigame_Win01 = 0x8D2, + snd_vc_Zenigame_Win02 = 0x8D3, + snd_vc_Zenigame_Win03 = 0x8D4, + snd_vc_Fushigisou_001 = 0x8D5, + snd_vc_Fushigisou_002 = 0x8D6, + snd_vc_Fushigisou_003_dummy = 0x8D7, + snd_vc_Fushigisou_004 = 0x8D8, + snd_vc_Fushigisou_005 = 0x8D9, + snd_vc_Fushigisou_006 = 0x8DA, + snd_vc_Fushigisou_007 = 0x8DB, + snd_vc_Fushigisou_008 = 0x8DC, + snd_vc_Fushigisou_009 = 0x8DD, + snd_vc_Fushigisou_010 = 0x8DE, + snd_vc_Fushigisou_011 = 0x8DF, + snd_vc_Fushigisou_012 = 0x8E0, + snd_vc_Fushigisou_013 = 0x8E1, + snd_vc_Fushigisou_014 = 0x8E2, + snd_vc_Fushigisou_015 = 0x8E3, + snd_vc_Fushigisou_016 = 0x8E4, + snd_vc_Fushigisou_046 = 0x8E5, + snd_vc_Fushigisou_047 = 0x8E6, + snd_vc_Fushigisou_048 = 0x8E7, + snd_vc_Fushigisou_049 = 0x8E8, + snd_vc_ouen_PokeFushigisou = 0x8E9, + snd_vc_Fushigisou_Appeal01 = 0x8EA, + snd_vc_Fushigisou_Appeal02 = 0x8EB, + snd_vc_Fushigisou_Appeal03 = 0x8EC, + snd_vc_Fushigisou_Attack01 = 0x8ED, + snd_vc_Fushigisou_Attack02 = 0x8EE, + snd_vc_Fushigisou_Attack03 = 0x8EF, + snd_vc_Fushigisou_Attack04 = 0x8F0, + snd_vc_Fushigisou_Attack05 = 0x8F1, + snd_vc_Fushigisou_Attack06 = 0x8F2, + snd_vc_Fushigisou_Attack07 = 0x8F3, + snd_vc_Fushigisou_CliffCatch = 0x8F4, + snd_vc_Fushigisou_Damage_hoshikie = 0x8F5, + snd_vc_Fushigisou_Damage01 = 0x8F6, + snd_vc_Fushigisou_Damage02 = 0x8F7, + snd_vc_Fushigisou_DamageFly01 = 0x8F8, + snd_vc_Fushigisou_DamageFly02 = 0x8F9, + snd_vc_Fushigisou_FuraFura = 0x8FA, + snd_vc_Fushigisou_FuraSleep = 0x8FB, + snd_vc_Fushigisou_HeavyGet = 0x8FC, + snd_vc_Fushigisou_Jump01 = 0x8FD, + snd_vc_Fushigisou_Jump02 = 0x8FE, + snd_vc_Fushigisou_MissFoot01_Dummy = 0x8FF, + snd_vc_Fushigisou_MissFoot02_Dummy = 0x900, + snd_vc_Fushigisou_Ottotto = 0x901, + snd_vc_Fushigisou_Passive = 0x902, + snd_vc_Fushigisou_SwimUp = 0x903, + snd_vc_Fushigisou_Win01 = 0x904, + snd_vc_Fushigisou_Win02 = 0x905, + snd_vc_Fushigisou_Win03 = 0x906, + snd_vc_Lucario_001 = 0x907, + snd_vc_Lucario_002 = 0x908, + snd_vc_Lucario_003 = 0x909, + snd_vc_Lucario_004 = 0x90A, + snd_vc_Lucario_005 = 0x90B, + snd_vc_Lucario_006 = 0x90C, + snd_vc_Lucario_007 = 0x90D, + snd_vc_Lucario_008 = 0x90E, + snd_vc_Lucario_009 = 0x90F, + snd_vc_Lucario_010 = 0x910, + snd_vc_Lucario_011 = 0x911, + snd_vc_Lucario_012 = 0x912, + snd_vc_Lucario_013 = 0x913, + snd_vc_Lucario_014 = 0x914, + snd_vc_Lucario_015 = 0x915, + snd_vc_Lucario_016 = 0x916, + snd_vc_Lucario_017 = 0x917, + snd_vc_Lucario_018 = 0x918, + snd_vc_Lucario_019 = 0x919, + snd_vc_Lucario_020 = 0x91A, + snd_vc_Lucario_021 = 0x91B, + snd_vc_Lucario_022 = 0x91C, + snd_vc_Lucario_023 = 0x91D, + snd_vc_Lucario_024 = 0x91E, + snd_vc_Lucario_025 = 0x91F, + snd_vc_Lucario_026 = 0x920, + snd_vc_Lucario_027 = 0x921, + snd_vc_Lucario_028 = 0x922, + snd_vc_Lucario_029 = 0x923, + snd_vc_Lucario_030 = 0x924, + snd_vc_Lucario_031 = 0x925, + snd_vc_Lucario_032 = 0x926, + snd_vc_Lucario_033 = 0x927, + snd_vc_Lucario_034 = 0x928, + snd_vc_Lucario_035 = 0x929, + snd_vc_Lucario_036 = 0x92A, + snd_vc_Lucario_037 = 0x92B, + snd_vc_Lucario_038 = 0x92C, + snd_vc_Lucario_039 = 0x92D, + snd_vc_Lucario_040 = 0x92E, + snd_vc_Lucario_041 = 0x92F, + snd_vc_Lucario_042 = 0x930, + snd_vc_Lucario_043 = 0x931, + snd_vc_Lucario_044 = 0x932, + snd_vc_Lucario_045 = 0x933, + snd_vc_Lucario_046 = 0x934, + snd_vc_Lucario_047 = 0x935, + snd_vc_Lucario_048 = 0x936, + snd_vc_Lucario_049 = 0x937, + snd_vc_ouen_Lucario = 0x938, + snd_vc_Lucario_Appeal01 = 0x939, + snd_vc_Lucario_Appeal02 = 0x93A, + snd_vc_Lucario_Appeal03 = 0x93B, + snd_vc_Lucario_Attack01 = 0x93C, + snd_vc_Lucario_Attack02 = 0x93D, + snd_vc_Lucario_Attack03 = 0x93E, + snd_vc_Lucario_Attack04 = 0x93F, + snd_vc_Lucario_Attack05 = 0x940, + snd_vc_Lucario_Attack06 = 0x941, + snd_vc_Lucario_Attack07 = 0x942, + snd_vc_Lucario_CliffCatch = 0x943, + snd_vc_Lucario_Damage_hoshikie = 0x944, + snd_vc_Lucario_Damage01 = 0x945, + snd_vc_Lucario_Damage02 = 0x946, + snd_vc_Lucario_DamageFly01 = 0x947, + snd_vc_Lucario_DamageFly02 = 0x948, + snd_vc_Lucario_FuraFura = 0x949, + snd_vc_Lucario_FuraSleep = 0x94A, + snd_vc_Lucario_HeavyGet = 0x94B, + snd_vc_Lucario_Jump01 = 0x94C, + snd_vc_Lucario_Jump02 = 0x94D, + snd_vc_Lucario_MissFoot01 = 0x94E, + snd_vc_Lucario_MissFoot02 = 0x94F, + snd_vc_Lucario_Ottotto = 0x950, + snd_vc_Lucario_Passive = 0x951, + snd_vc_Lucario_SwimUp = 0x952, + snd_vc_Lucario_Win01 = 0x953, + snd_vc_Lucario_Win02 = 0x954, + snd_vc_Lucario_Win03 = 0x955, + snd_vc_Ike_001 = 0x956, + snd_vc_Ike_002 = 0x957, + snd_vc_Ike_003 = 0x958, + snd_vc_Ike_004 = 0x959, + snd_vc_Ike_005 = 0x95A, + snd_vc_Ike_006 = 0x95B, + snd_vc_Ike_007 = 0x95C, + snd_vc_Ike_008 = 0x95D, + snd_vc_Ike_009 = 0x95E, + snd_vc_Ike_010 = 0x95F, + snd_vc_Ike_011 = 0x960, + snd_vc_Ike_012 = 0x961, + snd_vc_Ike_013 = 0x962, + snd_vc_Ike_014 = 0x963, + snd_vc_Ike_015 = 0x964, + snd_vc_Ike_016 = 0x965, + snd_vc_Ike_017 = 0x966, + snd_vc_Ike_046 = 0x967, + snd_vc_Ike_047 = 0x968, + snd_vc_Ike_048 = 0x969, + snd_vc_Ike_049 = 0x96A, + snd_vc_ouen_Ike = 0x96B, + snd_vc_Ike_Appeal01 = 0x96C, + snd_vc_Ike_Appeal02 = 0x96D, + snd_vc_Ike_Appeal03 = 0x96E, + snd_vc_Ike_Attack01 = 0x96F, + snd_vc_Ike_Attack02 = 0x970, + snd_vc_Ike_Attack03 = 0x971, + snd_vc_Ike_Attack04 = 0x972, + snd_vc_Ike_Attack05 = 0x973, + snd_vc_Ike_Attack06 = 0x974, + snd_vc_Ike_Attack07 = 0x975, + snd_vc_Ike_CliffCatch = 0x976, + snd_vc_Ike_Damage_hoshikie = 0x977, + snd_vc_Ike_Damage01 = 0x978, + snd_vc_Ike_Damage02 = 0x979, + snd_vc_Ike_DamageFly01 = 0x97A, + snd_vc_Ike_DamageFly02 = 0x97B, + snd_vc_Ike_FuraFura = 0x97C, + snd_vc_Ike_FuraSleep = 0x97D, + snd_vc_Ike_HeavyGet = 0x97E, + snd_vc_Ike_Jump01 = 0x97F, + snd_vc_Ike_Jump02 = 0x980, + snd_vc_Ike_MissFoot01 = 0x981, + snd_vc_Ike_MissFoot02 = 0x982, + snd_vc_Ike_Ottotto = 0x983, + snd_vc_Ike_Passive = 0x984, + snd_vc_Ike_SwimUp = 0x985, + snd_vc_Ike_Win01 = 0x986, + snd_vc_Ike_Win02 = 0x987, + snd_vc_Ike_Win03 = 0x988, + snd_vc_Robot_001 = 0x989, + snd_vc_Robot_002 = 0x98A, + snd_vc_Robot_003 = 0x98B, + snd_vc_Robot_004 = 0x98C, + snd_vc_Robot_005 = 0x98D, + snd_vc_Robot_046 = 0x98E, + snd_vc_Robot_047 = 0x98F, + snd_vc_Robot_048 = 0x990, + snd_vc_Robot_049 = 0x991, + snd_vc_ouen_Robot = 0x992, + snd_vc_Robot_Appeal01 = 0x993, + snd_vc_Robot_Appeal02 = 0x994, + snd_vc_Robot_Appeal03 = 0x995, + snd_vc_Robot_Attack01 = 0x996, + snd_vc_Robot_Attack02 = 0x997, + snd_vc_Robot_Attack03 = 0x998, + snd_vc_Robot_Attack04 = 0x999, + snd_vc_Robot_Attack05 = 0x99A, + snd_vc_Robot_Attack06 = 0x99B, + snd_vc_Robot_Attack07 = 0x99C, + snd_vc_Robot_CliffCatch = 0x99D, + snd_vc_Robot_Damage_hoshikie = 0x99E, + snd_vc_Robot_Damage01 = 0x99F, + snd_vc_Robot_Damage02 = 0x9A0, + snd_vc_Robot_DamageFly01 = 0x9A1, + snd_vc_Robot_DamageFly02 = 0x9A2, + snd_vc_Robot_FuraFura = 0x9A3, + snd_vc_Robot_FuraSleep = 0x9A4, + snd_vc_Robot_HeavyGet = 0x9A5, + snd_vc_Robot_Jump01 = 0x9A6, + snd_vc_Robot_Jump02 = 0x9A7, + snd_vc_Robot_MissFoot01 = 0x9A8, + snd_vc_Robot_MissFoot02 = 0x9A9, + snd_vc_Robot_Ottotto = 0x9AA, + snd_vc_Robot_Passive = 0x9AB, + snd_vc_Robot_SwimUp = 0x9AC, + snd_vc_Robot_Win01 = 0x9AD, + snd_vc_Robot_Win02 = 0x9AE, + snd_vc_Robot_Win03 = 0x9AF, + snd_vc_Purin_001 = 0x9B0, + snd_vc_Purin_002 = 0x9B1, + snd_vc_Purin_003 = 0x9B2, + snd_vc_Purin_004 = 0x9B3, + snd_vc_Purin_005 = 0x9B4, + snd_vc_Purin_006 = 0x9B5, + snd_vc_Purin_007 = 0x9B6, + snd_vc_Purin_009 = 0x9B7, + snd_vc_Purin_010 = 0x9B8, + snd_vc_Purin_011 = 0x9B9, + snd_vc_Purin_012 = 0x9BA, + snd_vc_Purin_046 = 0x9BB, + snd_vc_Purin_047 = 0x9BC, + snd_vc_Purin_048 = 0x9BD, + snd_vc_Purin_049 = 0x9BE, + snd_vc_ouen_Purin = 0x9BF, + snd_vc_Purin_Appeal01 = 0x9C0, + snd_vc_Purin_Appeal02 = 0x9C1, + snd_vc_Purin_Appeal03 = 0x9C2, + snd_vc_Purin_Attack01 = 0x9C3, + snd_vc_Purin_Attack02 = 0x9C4, + snd_vc_Purin_Attack03 = 0x9C5, + snd_vc_Purin_Attack04 = 0x9C6, + snd_vc_Purin_Attack05 = 0x9C7, + snd_vc_Purin_Attack06 = 0x9C8, + snd_vc_Purin_Attack07 = 0x9C9, + snd_vc_Purin_CliffCatch = 0x9CA, + snd_vc_Purin_Damage_hoshikie = 0x9CB, + snd_vc_Purin_Damage01 = 0x9CC, + snd_vc_Purin_Damage02 = 0x9CD, + snd_vc_Purin_DamageFly01 = 0x9CE, + snd_vc_Purin_DamageFly02 = 0x9CF, + snd_vc_Purin_FuraFura = 0x9D0, + snd_vc_Purin_FuraSleep = 0x9D1, + snd_vc_Purin_HeavyGet = 0x9D2, + snd_vc_Purin_Jump01 = 0x9D3, + snd_vc_Purin_Jump02 = 0x9D4, + snd_vc_Purin_MissFoot01 = 0x9D5, + snd_vc_Purin_MissFoot02 = 0x9D6, + snd_vc_Purin_Ottotto = 0x9D7, + snd_vc_Purin_Passive = 0x9D8, + snd_vc_Purin_SwimUp = 0x9D9, + snd_vc_Purin_Win01 = 0x9DA, + snd_vc_Purin_Win02 = 0x9DB, + snd_vc_Purin_Win03 = 0x9DC, + snd_vc_Purin_008 = 0x9DD, + snd_vc_ToonLink_001 = 0x9DE, + snd_vc_ToonLink_002 = 0x9DF, + snd_vc_ToonLink_003 = 0x9E0, + snd_vc_ToonLink_004 = 0x9E1, + snd_vc_ToonLink_005 = 0x9E2, + snd_vc_ToonLink_006 = 0x9E3, + snd_vc_ToonLink_046 = 0x9E4, + snd_vc_ToonLink_047 = 0x9E5, + snd_vc_ToonLink_048 = 0x9E6, + snd_vc_ToonLink_049 = 0x9E7, + snd_vc_ouen_ToonLink = 0x9E8, + snd_vc_ToonLink_Appeal01 = 0x9E9, + snd_vc_ToonLink_Appeal02 = 0x9EA, + snd_vc_ToonLink_Appeal03 = 0x9EB, + snd_vc_ToonLink_Attack01 = 0x9EC, + snd_vc_ToonLink_Attack02 = 0x9ED, + snd_vc_ToonLink_Attack03 = 0x9EE, + snd_vc_ToonLink_Attack04 = 0x9EF, + snd_vc_ToonLink_Attack05 = 0x9F0, + snd_vc_ToonLink_Attack06 = 0x9F1, + snd_vc_ToonLink_Attack07 = 0x9F2, + snd_vc_ToonLink_CliffCatch = 0x9F3, + snd_vc_ToonLink_Damage_hoshikie = 0x9F4, + snd_vc_ToonLink_Damage01 = 0x9F5, + snd_vc_ToonLink_Damage02 = 0x9F6, + snd_vc_ToonLink_DamageFly01 = 0x9F7, + snd_vc_ToonLink_DamageFly02 = 0x9F8, + snd_vc_ToonLink_FuraFura = 0x9F9, + snd_vc_ToonLink_FuraSleep = 0x9FA, + snd_vc_ToonLink_HeavyGet = 0x9FB, + snd_vc_ToonLink_Jump01 = 0x9FC, + snd_vc_ToonLink_Jump02 = 0x9FD, + snd_vc_ToonLink_MissFoot01 = 0x9FE, + snd_vc_ToonLink_MissFoot02 = 0x9FF, + snd_vc_ToonLink_Ottotto = 0xA00, + snd_vc_ToonLink_Passive = 0xA01, + snd_vc_ToonLink_SwimUp = 0xA02, + snd_vc_ToonLink_Win01 = 0xA03, + snd_vc_ToonLink_Win02 = 0xA04, + snd_vc_ToonLink_Win03 = 0xA05, + snd_vc_Wolf_001 = 0xA06, + snd_vc_Wolf_002 = 0xA07, + snd_vc_Wolf_003 = 0xA08, + snd_vc_Wolf_004 = 0xA09, + snd_vc_Wolf_005 = 0xA0A, + snd_vc_Wolf_006 = 0xA0B, + snd_vc_Wolf_Win_Fox = 0xA0C, + snd_vc_Wolf_008 = 0xA0D, + snd_vc_Wolf_009 = 0xA0E, + snd_vc_Wolf_010 = 0xA0F, + snd_vc_Wolf_011 = 0xA10, + snd_vc_Wolf_012 = 0xA11, + snd_vc_Wolf_046 = 0xA12, + snd_vc_Wolf_047 = 0xA13, + snd_vc_Wolf_048 = 0xA14, + snd_vc_Wolf_049 = 0xA15, + snd_vc_ouen_Wolf = 0xA16, + snd_vc_Wolf_Appeal01 = 0xA17, + snd_vc_Wolf_Appeal02 = 0xA18, + snd_vc_Wolf_Appeal03 = 0xA19, + snd_vc_Wolf_Attack01 = 0xA1A, + snd_vc_Wolf_Attack02 = 0xA1B, + snd_vc_Wolf_Attack03 = 0xA1C, + snd_vc_Wolf_Attack04 = 0xA1D, + snd_vc_Wolf_Attack05 = 0xA1E, + snd_vc_Wolf_Attack06 = 0xA1F, + snd_vc_Wolf_Attack07 = 0xA20, + snd_vc_Wolf_CliffCatch = 0xA21, + snd_vc_Wolf_Damage_hoshikie = 0xA22, + snd_vc_Wolf_Damage01 = 0xA23, + snd_vc_Wolf_Damage02 = 0xA24, + snd_vc_Wolf_DamageFly01 = 0xA25, + snd_vc_Wolf_DamageFly02 = 0xA26, + snd_vc_Wolf_FuraFura = 0xA27, + snd_vc_Wolf_FuraSleep = 0xA28, + snd_vc_Wolf_HeavyGet = 0xA29, + snd_vc_Wolf_Jump01 = 0xA2A, + snd_vc_Wolf_Jump02 = 0xA2B, + snd_vc_Wolf_MissFoot01 = 0xA2C, + snd_vc_Wolf_MissFoot02 = 0xA2D, + snd_vc_Wolf_Ottotto = 0xA2E, + snd_vc_Wolf_Passive = 0xA2F, + snd_vc_Wolf_SwimUp = 0xA30, + snd_vc_Wolf_Win01 = 0xA31, + snd_vc_Wolf_Win02 = 0xA32, + snd_vc_Wolf_Win03 = 0xA33, + snd_vc_snake_001 = 0xA34, + snd_vc_snake_002 = 0xA35, + snd_vc_snake_003 = 0xA36, + snd_vc_snake_004 = 0xA37, + snd_vc_snake_005 = 0xA38, + snd_vc_snake_006 = 0xA39, + snd_vc_snake_007 = 0xA3A, + snd_vc_snake_008 = 0xA3B, + snd_vc_snake_009 = 0xA3C, + snd_vc_snake_010 = 0xA3D, + snd_vc_snake_011 = 0xA3E, + snd_vc_snake_012 = 0xA3F, + snd_vc_snake_013 = 0xA40, + snd_vc_snake_046 = 0xA41, + snd_vc_snake_047 = 0xA42, + snd_vc_snake_048 = 0xA43, + snd_vc_snake_049 = 0xA44, + snd_vc_ouen_Snake = 0xA45, + snd_vc_snake_Appeal01 = 0xA46, + snd_vc_snake_Appeal02 = 0xA47, + snd_vc_snake_Appeal03 = 0xA48, + snd_vc_snake_Attack01 = 0xA49, + snd_vc_snake_Attack02 = 0xA4A, + snd_vc_snake_Attack03 = 0xA4B, + snd_vc_snake_Attack04 = 0xA4C, + snd_vc_snake_Attack05 = 0xA4D, + snd_vc_snake_Attack06 = 0xA4E, + snd_vc_snake_Attack07 = 0xA4F, + snd_vc_snake_CliffCatch = 0xA50, + snd_vc_snake_Damage_hoshikie = 0xA51, + snd_vc_snake_Damage01 = 0xA52, + snd_vc_snake_Damage02 = 0xA53, + snd_vc_snake_DamageFly01 = 0xA54, + snd_vc_snake_DamageFly02 = 0xA55, + snd_vc_snake_FuraFura = 0xA56, + snd_vc_snake_FuraSleep = 0xA57, + snd_vc_snake_HeavyGet = 0xA58, + snd_vc_snake_Jump01 = 0xA59, + snd_vc_snake_Jump02 = 0xA5A, + snd_vc_snake_MissFoot01 = 0xA5B, + snd_vc_snake_MissFoot02 = 0xA5C, + snd_vc_snake_Ottotto = 0xA5D, + snd_vc_snake_Passive = 0xA5E, + snd_vc_snake_SwimUp = 0xA5F, + snd_vc_snake_Win01 = 0xA60, + snd_vc_snake_Win02 = 0xA61, + snd_vc_snake_Win03 = 0xA62, + snd_vc_Sonic_001 = 0xA63, + snd_vc_Sonic_002 = 0xA64, + snd_vc_Sonic_003 = 0xA65, + snd_vc_Sonic_004 = 0xA66, + snd_vc_Sonic_005 = 0xA67, + snd_vc_Sonic_006 = 0xA68, + snd_vc_Sonic_007 = 0xA69, + snd_vc_Sonic_008 = 0xA6A, + snd_vc_Sonic_009 = 0xA6B, + snd_vc_Sonic_046 = 0xA6C, + snd_vc_Sonic_047 = 0xA6D, + snd_vc_Sonic_048 = 0xA6E, + snd_vc_Sonic_049 = 0xA6F, + snd_vc_ouen_Sonic = 0xA70, + snd_vc_Sonic_Appeal01 = 0xA71, + snd_vc_Sonic_Appeal02 = 0xA72, + snd_vc_Sonic_Appeal03 = 0xA73, + snd_vc_Sonic_Attack01 = 0xA74, + snd_vc_Sonic_Attack02 = 0xA75, + snd_vc_Sonic_Attack03 = 0xA76, + snd_vc_Sonic_Attack04 = 0xA77, + snd_vc_Sonic_Attack05 = 0xA78, + snd_vc_Sonic_Attack06 = 0xA79, + snd_vc_Sonic_Attack07 = 0xA7A, + snd_vc_Sonic_CliffCatch = 0xA7B, + snd_vc_Sonic_Damage_hoshikie = 0xA7C, + snd_vc_Sonic_Damage01 = 0xA7D, + snd_vc_Sonic_Damage02 = 0xA7E, + snd_vc_Sonic_DamageFly01 = 0xA7F, + snd_vc_Sonic_DamageFly02 = 0xA80, + snd_vc_Sonic_FuraFura = 0xA81, + snd_vc_Sonic_FuraSleep = 0xA82, + snd_vc_Sonic_HeavyGet = 0xA83, + snd_vc_Sonic_Jump01 = 0xA84, + snd_vc_Sonic_Jump02 = 0xA85, + snd_vc_Sonic_MissFoot01 = 0xA86, + snd_vc_Sonic_MissFoot02 = 0xA87, + snd_vc_Sonic_Ottotto = 0xA88, + snd_vc_Sonic_Passive = 0xA89, + snd_vc_Sonic_SwimUp = 0xA8A, + snd_vc_Sonic_Win01 = 0xA8B, + snd_vc_Sonic_Win02 = 0xA8C, + snd_vc_Sonic_Win03 = 0xA8D, + snd_se_DonkeyKong_001 = 0xA8E, + snd_se_DonkeyKong_002 = 0xA8F, + snd_se_DonkeyKong_003 = 0xA90, + snd_se_DonkeyKong_004 = 0xA91, + snd_se_DonkeyKong_005 = 0xA92, + snd_se_DonkeyKong_006 = 0xA93, + snd_se_DonkeyKong_007 = 0xA94, + snd_se_DonkeyKong_008 = 0xA95, + snd_se_DonkeyKong_009 = 0xA96, + snd_se_DonkeyKong_010 = 0xA97, + snd_se_DonkeyKong_011 = 0xA98, + snd_se_DonkeyKong_012 = 0xA99, + snd_se_DonkeyKong_013 = 0xA9A, + snd_se_DonkeyKong_014 = 0xA9B, + snd_se_DonkeyKong_015 = 0xA9C, + snd_se_DonkeyKong_016 = 0xA9D, + snd_se_DonkeyKong_017 = 0xA9E, + snd_se_DonkeyKong_018 = 0xA9F, + snd_se_DonkeyKong_019 = 0xAA0, + snd_se_DonkeyKong_020 = 0xAA1, + snd_se_DonkeyKong_021 = 0xAA2, + snd_se_DonkeyKong_022 = 0xAA3, + snd_se_DonkeyKong_023 = 0xAA4, + snd_se_DonkeyKong_024 = 0xAA5, + snd_se_DonkeyKong_TCB_perfect = 0xAA6, + snd_se_DonkeyKong_026 = 0xAA7, + snd_se_DonkeyKong_027 = 0xAA8, + snd_se_DonkeyKong_046 = 0xAA9, + snd_se_DonkeyKong_047 = 0xAAA, + snd_se_DonkeyKong_048 = 0xAAB, + snd_se_DonkeyKong_049 = 0xAAC, + snd_se_DonkeyKong_050 = 0xAAD, + snd_se_DonkeyKong_Attack_l = 0xAAE, + snd_se_DonkeyKong_Attack_ll = 0xAAF, + snd_se_DonkeyKong_Attack_m = 0xAB0, + snd_se_DonkeyKong_Attack_s = 0xAB1, + snd_se_DonkeyKong_Attack100 = 0xAB2, + snd_se_DonkeyKong_BodyPress01 = 0xAB3, + snd_se_DonkeyKong_BodyPress02 = 0xAB4, + snd_se_DonkeyKong_dash_start = 0xAB5, + snd_se_DonkeyKong_dash_stop = 0xAB6, + snd_se_DonkeyKong_down01 = 0xAB7, + snd_se_DonkeyKong_down02 = 0xAB8, + snd_se_DonkeyKong_Final_Conga_l = 0xAB9, + snd_se_DonkeyKong_Final_Conga_r = 0xABA, + snd_se_DonkeyKong_Final_Claps = 0xABB, + snd_se_DonkeyKong_Final04 = 0xABC, + snd_se_DonkeyKong_Final05 = 0xABD, + snd_se_DonkeyKong_jump01 = 0xABE, + snd_se_DonkeyKong_jump02 = 0xABF, + snd_se_DonkeyKong_Landing01 = 0xAC0, + snd_se_DonkeyKong_Landing02 = 0xAC1, + snd_se_DonkeyKong_smash_H01 = 0xAC2, + snd_se_DonkeyKong_smash_H02 = 0xAC3, + snd_se_DonkeyKong_smash_H03 = 0xAC4, + snd_se_DonkeyKong_smash_H04 = 0xAC5, + snd_se_DonkeyKong_smash_H05 = 0xAC6, + snd_se_DonkeyKong_smash_L01 = 0xAC7, + snd_se_DonkeyKong_smash_L02 = 0xAC8, + snd_se_DonkeyKong_smash_L03 = 0xAC9, + snd_se_DonkeyKong_smash_L04 = 0xACA, + snd_se_DonkeyKong_smash_L05 = 0xACB, + snd_se_DonkeyKong_smash_S01 = 0xACC, + snd_se_DonkeyKong_smash_S02 = 0xACD, + snd_se_DonkeyKong_smash_S03 = 0xACE, + snd_se_DonkeyKong_smash_S04 = 0xACF, + snd_se_DonkeyKong_smash_S05 = 0xAD0, + snd_se_DonkeyKong_Special_H01 = 0xAD1, + snd_se_DonkeyKong_Special_H02 = 0xAD2, + snd_se_DonkeyKong_Special_H03 = 0xAD3, + snd_se_DonkeyKong_Special_H04 = 0xAD4, + snd_se_DonkeyKong_Special_H05 = 0xAD5, + snd_se_DonkeyKong_Special_L01 = 0xAD6, + snd_se_DonkeyKong_Special_L02 = 0xAD7, + snd_se_DonkeyKong_Special_L03 = 0xAD8, + snd_se_DonkeyKong_Special_L04 = 0xAD9, + snd_se_DonkeyKong_Special_L05 = 0xADA, + snd_se_DonkeyKong_Special_N01 = 0xADB, + snd_se_DonkeyKong_Special_N02 = 0xADC, + snd_se_DonkeyKong_Special_N03 = 0xADD, + snd_se_DonkeyKong_Special_N04 = 0xADE, + snd_se_DonkeyKong_Special_N05 = 0xADF, + snd_se_DonkeyKong_Special_S01 = 0xAE0, + snd_se_DonkeyKong_Special_S02 = 0xAE1, + snd_se_DonkeyKong_Special_S03 = 0xAE2, + snd_se_DonkeyKong_Special_S04 = 0xAE3, + snd_se_DonkeyKong_Special_S05 = 0xAE4, + snd_se_DonkeyKong_squat = 0xAE5, + snd_se_DonkeyKong_step_hidari_m = 0xAE6, + snd_se_DonkeyKong_step_hidari_s = 0xAE7, + snd_se_DonkeyKong_step_migi_m = 0xAE8, + snd_se_DonkeyKong_step_migi_s = 0xAE9, + snd_se_DonkeyKong_swing_l = 0xAEA, + snd_se_DonkeyKong_swing_ll = 0xAEB, + snd_se_DonkeyKong_swing_m = 0xAEC, + snd_se_DonkeyKong_swing_s = 0xAED, + snd_se_DonkeyKong_turn = 0xAEE, + snd_se_DonkeyKong_turn_run = 0xAEF, + snd_se_DonkeyKong_ukemi = 0xAF0, + snd_se_DonkeyKong_Wait1 = 0xAF1, + snd_se_DonkeyKong_Wait2 = 0xAF2, + snd_se_DonkeyKong_Wait3 = 0xAF3, + snd_se_DonkeyKong_wear = 0xAF4, + snd_se_Samus_001 = 0xAF5, + snd_se_Samus_002 = 0xAF6, + snd_se_Samus_003 = 0xAF7, + snd_se_Samus_004 = 0xAF8, + snd_se_Samus_005 = 0xAF9, + snd_se_Samus_006 = 0xAFA, + snd_se_Samus_007 = 0xAFB, + snd_se_Samus_008 = 0xAFC, + snd_se_Samus_009 = 0xAFD, + snd_se_Samus_010 = 0xAFE, + snd_se_Samus_011 = 0xAFF, + snd_se_Samus_012 = 0xB00, + snd_se_Samus_013 = 0xB01, + snd_se_Samus_014 = 0xB02, + snd_se_Samus_015 = 0xB03, + snd_se_Samus_016 = 0xB04, + snd_se_Samus_017 = 0xB05, + snd_se_Samus_018 = 0xB06, + snd_se_Samus_019 = 0xB07, + snd_se_Samus_020 = 0xB08, + snd_se_Samus_021 = 0xB09, + snd_se_Samus_022 = 0xB0A, + snd_se_Samus_023 = 0xB0B, + snd_se_Samus_024 = 0xB0C, + snd_se_Samus_025 = 0xB0D, + snd_se_Samus_026 = 0xB0E, + snd_se_Samus_027 = 0xB0F, + snd_se_Samus_028 = 0xB10, + snd_se_Samus_029 = 0xB11, + snd_se_Samus_030 = 0xB12, + snd_se_Samus_031 = 0xB13, + snd_se_Samus_032 = 0xB14, + snd_se_Samus_033 = 0xB15, + snd_se_Samus_034 = 0xB16, + snd_se_Samus_035 = 0xB17, + snd_se_Samus_036 = 0xB18, + snd_se_Samus_037 = 0xB19, + snd_se_Samus_038 = 0xB1A, + snd_se_Samus_039 = 0xB1B, + snd_se_Samus_040 = 0xB1C, + snd_se_Samus_041 = 0xB1D, + snd_se_Samus_042 = 0xB1E, + snd_se_Samus_043 = 0xB1F, + snd_se_Samus_044 = 0xB20, + snd_se_Samus_045 = 0xB21, + snd_se_Samus_046 = 0xB22, + snd_se_Samus_047 = 0xB23, + snd_se_Samus_048 = 0xB24, + snd_se_Samus_049 = 0xB25, + snd_se_Samus_050 = 0xB26, + snd_se_Samus_Attack_l = 0xB27, + snd_se_Samus_Attack_ll = 0xB28, + snd_se_Samus_Attack_m = 0xB29, + snd_se_Samus_Attack_s = 0xB2A, + snd_se_Samus_Attack100 = 0xB2B, + snd_se_Samus_BodyPress01 = 0xB2C, + snd_se_Samus_BodyPress02 = 0xB2D, + snd_se_Samus_dash_start = 0xB2E, + snd_se_Samus_dash_stop = 0xB2F, + snd_se_Samus_down01 = 0xB30, + snd_se_Samus_down02 = 0xB31, + snd_se_Samus_Final01 = 0xB32, + snd_se_Samus_Final02 = 0xB33, + snd_se_Samus_Final03 = 0xB34, + snd_se_Samus_Final04 = 0xB35, + snd_se_Samus_Final05 = 0xB36, + snd_se_Samus_jump01 = 0xB37, + snd_se_Samus_jump02 = 0xB38, + snd_se_Samus_Landing01 = 0xB39, + snd_se_Samus_Landing02 = 0xB3A, + snd_se_Samus_smash_H01 = 0xB3B, + snd_se_Samus_smash_H02 = 0xB3C, + snd_se_Samus_smash_H03 = 0xB3D, + snd_se_Samus_smash_H04 = 0xB3E, + snd_se_Samus_smash_H05 = 0xB3F, + snd_se_Samus_smash_L01 = 0xB40, + snd_se_Samus_smash_L02 = 0xB41, + snd_se_Samus_smash_L03 = 0xB42, + snd_se_Samus_smash_L04 = 0xB43, + snd_se_Samus_smash_L05 = 0xB44, + snd_se_Samus_smash_S01 = 0xB45, + snd_se_Samus_smash_S02 = 0xB46, + snd_se_Samus_smash_S03 = 0xB47, + snd_se_Samus_smash_S04 = 0xB48, + snd_se_Samus_smash_S05 = 0xB49, + snd_se_Samus_Special_H01 = 0xB4A, + snd_se_Samus_Special_H02 = 0xB4B, + snd_se_Samus_Special_H03 = 0xB4C, + snd_se_Samus_Special_H04 = 0xB4D, + snd_se_Samus_Special_H05 = 0xB4E, + snd_se_Samus_Special_L01 = 0xB4F, + snd_se_Samus_Special_L02 = 0xB50, + snd_se_Samus_Special_L03 = 0xB51, + snd_se_Samus_Special_L04 = 0xB52, + snd_se_Samus_Special_L05 = 0xB53, + snd_se_Samus_Special_N01 = 0xB54, + snd_se_Samus_Special_N02 = 0xB55, + snd_se_Samus_Special_N03 = 0xB56, + snd_se_Samus_Special_N04 = 0xB57, + snd_se_Samus_Special_N05 = 0xB58, + snd_se_Samus_Special_S01 = 0xB59, + snd_se_Samus_Special_S02 = 0xB5A, + snd_se_Samus_Special_S03 = 0xB5B, + snd_se_Samus_Special_S04 = 0xB5C, + snd_se_Samus_Special_S05 = 0xB5D, + snd_se_Samus_squat = 0xB5E, + snd_se_Samus_step_hidari_m = 0xB5F, + snd_se_Samus_step_hidari_s = 0xB60, + snd_se_Samus_step_migi_m = 0xB61, + snd_se_Samus_step_migi_s = 0xB62, + snd_se_Samus_swing_l = 0xB63, + snd_se_Samus_swing_ll = 0xB64, + snd_se_Samus_swing_m = 0xB65, + snd_se_Samus_swing_s = 0xB66, + snd_se_Samus_turn = 0xB67, + snd_se_Samus_turn_run = 0xB68, + snd_se_Samus_ukemi = 0xB69, + snd_se_Samus_Wait1 = 0xB6A, + snd_se_Samus_Wait2 = 0xB6B, + snd_se_Samus_Wait3 = 0xB6C, + snd_se_Samus_wear = 0xB6D, + snd_se_Yoshi_001 = 0xB6E, + snd_se_Yoshi_002 = 0xB6F, + snd_se_Yoshi_003 = 0xB70, + snd_se_Yoshi_004 = 0xB71, + snd_se_Yoshi_005 = 0xB72, + snd_se_Yoshi_006 = 0xB73, + snd_se_Yoshi_007 = 0xB74, + snd_se_Yoshi_008 = 0xB75, + snd_se_Yoshi_009 = 0xB76, + snd_se_Yoshi_010 = 0xB77, + snd_se_Yoshi_011 = 0xB78, + snd_se_Yoshi_012 = 0xB79, + snd_se_Yoshi_013 = 0xB7A, + snd_se_Yoshi_014 = 0xB7B, + snd_se_Yoshi_015 = 0xB7C, + snd_se_Yoshi_016 = 0xB7D, + snd_se_Yoshi_017 = 0xB7E, + snd_se_Yoshi_018 = 0xB7F, + snd_se_Yoshi_046 = 0xB80, + snd_se_Yoshi_047 = 0xB81, + snd_se_Yoshi_048 = 0xB82, + snd_se_Yoshi_049 = 0xB83, + snd_se_Yoshi_050 = 0xB84, + snd_se_Yoshi_Attack_l = 0xB85, + snd_se_Yoshi_Attack_ll = 0xB86, + snd_se_Yoshi_Attack_m = 0xB87, + snd_se_Yoshi_Attack_s = 0xB88, + snd_se_Yoshi_Attack100 = 0xB89, + snd_se_Yoshi_BodyPress01 = 0xB8A, + snd_se_Yoshi_BodyPress02 = 0xB8B, + snd_se_Yoshi_dash_start = 0xB8C, + snd_se_Yoshi_dash_stop = 0xB8D, + snd_se_Yoshi_down01 = 0xB8E, + snd_se_Yoshi_down02 = 0xB8F, + snd_se_Yoshi_Final01 = 0xB90, + snd_se_Yoshi_Final02 = 0xB91, + snd_se_Yoshi_Final03 = 0xB92, + snd_se_Yoshi_Final04 = 0xB93, + snd_se_Yoshi_Final05 = 0xB94, + snd_se_Yoshi_jump01 = 0xB95, + snd_se_Yoshi_jump02 = 0xB96, + snd_se_Yoshi_Landing01 = 0xB97, + snd_se_Yoshi_Landing02 = 0xB98, + snd_se_Yoshi_smash_H01 = 0xB99, + snd_se_Yoshi_smash_H02 = 0xB9A, + snd_se_Yoshi_smash_H03 = 0xB9B, + snd_se_Yoshi_smash_H04 = 0xB9C, + snd_se_Yoshi_smash_H05 = 0xB9D, + snd_se_Yoshi_smash_L01 = 0xB9E, + snd_se_Yoshi_smash_L02 = 0xB9F, + snd_se_Yoshi_smash_L03 = 0xBA0, + snd_se_Yoshi_smash_L04 = 0xBA1, + snd_se_Yoshi_smash_L05 = 0xBA2, + snd_se_Yoshi_smash_S01 = 0xBA3, + snd_se_Yoshi_smash_S02 = 0xBA4, + snd_se_Yoshi_smash_S03 = 0xBA5, + snd_se_Yoshi_smash_S04 = 0xBA6, + snd_se_Yoshi_smash_S05 = 0xBA7, + snd_se_Yoshi_Special_H01 = 0xBA8, + snd_se_Yoshi_Special_H02 = 0xBA9, + snd_se_Yoshi_Special_H03 = 0xBAA, + snd_se_Yoshi_Special_H04 = 0xBAB, + snd_se_Yoshi_Special_H05 = 0xBAC, + snd_se_Yoshi_Special_L01 = 0xBAD, + snd_se_Yoshi_Special_L02 = 0xBAE, + snd_se_Yoshi_Special_L03 = 0xBAF, + snd_se_Yoshi_Special_L04 = 0xBB0, + snd_se_Yoshi_Special_L05 = 0xBB1, + snd_se_Yoshi_Special_N01 = 0xBB2, + snd_se_Yoshi_Special_N02 = 0xBB3, + snd_se_Yoshi_Special_N03 = 0xBB4, + snd_se_Yoshi_Special_N04 = 0xBB5, + snd_se_Yoshi_Special_N05 = 0xBB6, + snd_se_Yoshi_Special_S01 = 0xBB7, + snd_se_Yoshi_Special_S02 = 0xBB8, + snd_se_Yoshi_Special_S03 = 0xBB9, + snd_se_Yoshi_Special_S04 = 0xBBA, + snd_se_Yoshi_Special_S05 = 0xBBB, + snd_se_Yoshi_squat = 0xBBC, + snd_se_Yoshi_step_hidari_m = 0xBBD, + snd_se_Yoshi_step_hidari_s = 0xBBE, + snd_se_Yoshi_step_migi_m = 0xBBF, + snd_se_Yoshi_step_migi_s = 0xBC0, + snd_se_Yoshi_swing_l = 0xBC1, + snd_se_Yoshi_swing_ll = 0xBC2, + snd_se_Yoshi_swing_m = 0xBC3, + snd_se_Yoshi_swing_s = 0xBC4, + snd_se_Yoshi_turn = 0xBC5, + snd_se_Yoshi_turn_run = 0xBC6, + snd_se_Yoshi_ukemi = 0xBC7, + snd_se_Yoshi_Wait1 = 0xBC8, + snd_se_Yoshi_Wait2 = 0xBC9, + snd_se_Yoshi_Wait3 = 0xBCA, + snd_se_Yoshi_wear = 0xBCB, + snd_se_kirby_001 = 0xBCC, + snd_se_kirby_002 = 0xBCD, + snd_se_kirby_003 = 0xBCE, + snd_se_kirby_004 = 0xBCF, + snd_se_kirby_005 = 0xBD0, + snd_se_kirby_006 = 0xBD1, + snd_se_kirby_007 = 0xBD2, + snd_se_kirby_008 = 0xBD3, + snd_se_kirby_009 = 0xBD4, + snd_se_kirby_010 = 0xBD5, + snd_se_kirby_011 = 0xBD6, + snd_se_kirby_012 = 0xBD7, + snd_se_kirby_013 = 0xBD8, + snd_se_kirby_014 = 0xBD9, + snd_se_kirby_015 = 0xBDA, + snd_se_kirby_016 = 0xBDB, + snd_se_kirby_017 = 0xBDC, + snd_se_kirby_018 = 0xBDD, + snd_se_kirby_019 = 0xBDE, + snd_se_kirby_020 = 0xBDF, + snd_se_kirby_021 = 0xBE0, + snd_se_kirby_022 = 0xBE1, + snd_se_kirby_023 = 0xBE2, + snd_se_kirby_024 = 0xBE3, + snd_se_kirby_025 = 0xBE4, + snd_se_kirby_026 = 0xBE5, + snd_se_kirby_027 = 0xBE6, + snd_se_kirby_028 = 0xBE7, + snd_se_kirby_029 = 0xBE8, + snd_se_kirby_030 = 0xBE9, + snd_se_kirby_031 = 0xBEA, + snd_se_kirby_032 = 0xBEB, + snd_se_kirby_033 = 0xBEC, + snd_se_kirby_034 = 0xBED, + snd_se_kirby_035 = 0xBEE, + snd_se_kirby_036 = 0xBEF, + snd_se_kirby_037 = 0xBF0, + snd_se_kirby_038 = 0xBF1, + snd_se_kirby_039 = 0xBF2, + snd_se_kirby_040 = 0xBF3, + snd_se_kirby_041 = 0xBF4, + snd_se_kirby_042 = 0xBF5, + snd_se_kirby_043 = 0xBF6, + snd_se_kirby_044 = 0xBF7, + snd_se_kirby_045 = 0xBF8, + snd_se_kirby_046 = 0xBF9, + snd_se_kirby_047 = 0xBFA, + snd_se_kirby_048 = 0xBFB, + snd_se_kirby_049 = 0xBFC, + snd_se_kirby_050 = 0xBFD, + snd_se_kirby_Attack_l = 0xBFE, + snd_se_kirby_Attack_ll = 0xBFF, + snd_se_kirby_Attack_m = 0xC00, + snd_se_kirby_Attack_s = 0xC01, + snd_se_kirby_Attack100 = 0xC02, + snd_se_kirby_BodyPress01 = 0xC03, + snd_se_kirby_BodyPress02 = 0xC04, + snd_se_kirby_dash_start = 0xC05, + snd_se_kirby_dash_stop = 0xC06, + snd_se_kirby_down01 = 0xC07, + snd_se_kirby_down02 = 0xC08, + snd_se_kirby_Final01 = 0xC09, + snd_se_kirby_Final02 = 0xC0A, + snd_se_kirby_Final03 = 0xC0B, + snd_se_kirby_Final04 = 0xC0C, + snd_se_kirby_Final05 = 0xC0D, + snd_se_kirby_jump01 = 0xC0E, + snd_se_kirby_jump02 = 0xC0F, + snd_se_kirby_Landing01 = 0xC10, + snd_se_kirby_Landing02 = 0xC11, + snd_se_kirby_smash_H01 = 0xC12, + snd_se_kirby_smash_H02 = 0xC13, + snd_se_kirby_smash_H03 = 0xC14, + snd_se_kirby_smash_H04 = 0xC15, + snd_se_kirby_smash_H05 = 0xC16, + snd_se_kirby_smash_L01 = 0xC17, + snd_se_kirby_smash_L02 = 0xC18, + snd_se_kirby_smash_L03 = 0xC19, + snd_se_kirby_smash_L04 = 0xC1A, + snd_se_kirby_smash_L05 = 0xC1B, + snd_se_kirby_smash_S01 = 0xC1C, + snd_se_kirby_smash_S02 = 0xC1D, + snd_se_kirby_smash_S03 = 0xC1E, + snd_se_kirby_smash_S04 = 0xC1F, + snd_se_kirby_smash_S05 = 0xC20, + snd_se_kirby_Special_H01 = 0xC21, + snd_se_kirby_Special_H02 = 0xC22, + snd_se_kirby_Special_H03 = 0xC23, + snd_se_kirby_Special_H04 = 0xC24, + snd_se_kirby_Special_H05 = 0xC25, + snd_se_kirby_Special_L01 = 0xC26, + snd_se_kirby_Special_L02 = 0xC27, + snd_se_kirby_Special_L03 = 0xC28, + snd_se_kirby_Special_L04 = 0xC29, + snd_se_kirby_Special_L05 = 0xC2A, + snd_se_kirby_Special_N01 = 0xC2B, + snd_se_kirby_Special_N02 = 0xC2C, + snd_se_kirby_Special_N03 = 0xC2D, + snd_se_kirby_Special_N04 = 0xC2E, + snd_se_kirby_Special_N05 = 0xC2F, + snd_se_kirby_Special_S01 = 0xC30, + snd_se_kirby_Special_S02 = 0xC31, + snd_se_kirby_Special_S03 = 0xC32, + snd_se_kirby_Special_N06 = 0xC33, + snd_se_kirby_Special_S05 = 0xC34, + snd_se_kirby_squat = 0xC35, + snd_se_kirby_step_hidari_m = 0xC36, + snd_se_kirby_step_hidari_s = 0xC37, + snd_se_kirby_step_migi_m = 0xC38, + snd_se_kirby_step_migi_s = 0xC39, + snd_se_kirby_swing_l = 0xC3A, + snd_se_kirby_swing_ll = 0xC3B, + snd_se_kirby_swing_m = 0xC3C, + snd_se_kirby_swing_s = 0xC3D, + snd_se_kirby_turn = 0xC3E, + snd_se_kirby_turn_run = 0xC3F, + snd_se_kirby_ukemi = 0xC40, + snd_se_kirby_Wait1 = 0xC41, + snd_se_kirby_Wait2 = 0xC42, + snd_se_kirby_Wait3 = 0xC43, + snd_se_kirby_wear = 0xC44, + snd_se_fox_001 = 0xC45, + snd_se_fox_002 = 0xC46, + snd_se_fox_003 = 0xC47, + snd_se_fox_004 = 0xC48, + snd_se_fox_005 = 0xC49, + snd_se_fox_006 = 0xC4A, + snd_se_fox_007 = 0xC4B, + snd_se_fox_008 = 0xC4C, + snd_se_fox_009 = 0xC4D, + snd_se_fox_010 = 0xC4E, + snd_se_fox_011 = 0xC4F, + snd_se_fox_012 = 0xC50, + snd_se_fox_013 = 0xC51, + snd_se_fox_014 = 0xC52, + snd_se_fox_015 = 0xC53, + snd_se_fox_016 = 0xC54, + snd_se_fox_017 = 0xC55, + snd_se_fox_018 = 0xC56, + snd_se_fox_019 = 0xC57, + snd_se_fox_020 = 0xC58, + snd_se_fox_021 = 0xC59, + snd_se_fox_022 = 0xC5A, + snd_se_fox_023 = 0xC5B, + snd_se_fox_024 = 0xC5C, + snd_se_fox_046 = 0xC5D, + snd_se_fox_047 = 0xC5E, + snd_se_fox_048 = 0xC5F, + snd_se_fox_049 = 0xC60, + snd_se_fox_050 = 0xC61, + snd_se_fox_Attack_l = 0xC62, + snd_se_fox_Attack_ll = 0xC63, + snd_se_fox_Attack_m = 0xC64, + snd_se_fox_Attack_s = 0xC65, + snd_se_fox_Attack100 = 0xC66, + snd_se_fox_BodyPress01 = 0xC67, + snd_se_fox_BodyPress02 = 0xC68, + snd_se_fox_dash_start = 0xC69, + snd_se_fox_dash_stop = 0xC6A, + snd_se_fox_down01 = 0xC6B, + snd_se_fox_down02 = 0xC6C, + snd_se_fox_Final01 = 0xC6D, + snd_se_fox_Final02 = 0xC6E, + snd_se_fox_Final03 = 0xC6F, + snd_se_fox_Final04 = 0xC70, + snd_se_fox_Final05 = 0xC71, + snd_se_fox_jump01 = 0xC72, + snd_se_fox_jump02 = 0xC73, + snd_se_fox_Landing01 = 0xC74, + snd_se_fox_Landing02 = 0xC75, + snd_se_fox_smash_H01 = 0xC76, + snd_se_fox_smash_H02 = 0xC77, + snd_se_fox_smash_H03 = 0xC78, + snd_se_fox_smash_H04 = 0xC79, + snd_se_fox_smash_H05 = 0xC7A, + snd_se_fox_smash_L01 = 0xC7B, + snd_se_fox_smash_L02 = 0xC7C, + snd_se_fox_smash_L03 = 0xC7D, + snd_se_fox_smash_L04 = 0xC7E, + snd_se_fox_smash_L05 = 0xC7F, + snd_se_fox_smash_S01 = 0xC80, + snd_se_fox_smash_S02 = 0xC81, + snd_se_fox_smash_S03 = 0xC82, + snd_se_fox_smash_S04 = 0xC83, + snd_se_fox_smash_S05 = 0xC84, + snd_se_fox_Special_H01 = 0xC85, + snd_se_fox_Special_H02 = 0xC86, + snd_se_fox_Special_H03 = 0xC87, + snd_se_fox_Special_H04 = 0xC88, + snd_se_fox_Special_H05 = 0xC89, + snd_se_fox_Special_L01 = 0xC8A, + snd_se_fox_Special_L02 = 0xC8B, + snd_se_fox_Special_L03 = 0xC8C, + snd_se_fox_Special_L04 = 0xC8D, + snd_se_fox_Special_L05 = 0xC8E, + snd_se_fox_Special_N01 = 0xC8F, + snd_se_fox_Special_N02 = 0xC90, + snd_se_fox_Special_N03 = 0xC91, + snd_se_fox_Special_N04 = 0xC92, + snd_se_fox_Special_N05 = 0xC93, + snd_se_fox_Special_S01 = 0xC94, + snd_se_fox_Special_S02 = 0xC95, + snd_se_fox_Special_S03 = 0xC96, + snd_se_fox_Special_S04 = 0xC97, + snd_se_fox_Special_S05 = 0xC98, + snd_se_fox_squat = 0xC99, + snd_se_fox_step_hidari_m = 0xC9A, + snd_se_fox_step_hidari_s = 0xC9B, + snd_se_fox_step_migi_m = 0xC9C, + snd_se_fox_step_migi_s = 0xC9D, + snd_se_fox_swing_l = 0xC9E, + snd_se_fox_swing_ll = 0xC9F, + snd_se_fox_swing_m = 0xCA0, + snd_se_fox_swing_s = 0xCA1, + snd_se_fox_turn = 0xCA2, + snd_se_fox_turn_run = 0xCA3, + snd_se_fox_ukemi = 0xCA4, + snd_se_fox_Wait1 = 0xCA5, + snd_se_fox_Wait2 = 0xCA6, + snd_se_fox_Wait3 = 0xCA7, + snd_se_fox_wear = 0xCA8, + snd_vc_pikachu_001 = 0xCA9, + snd_vc_pikachu_002 = 0xCAA, + snd_vc_pikachu_003 = 0xCAB, + snd_vc_pikachu_004 = 0xCAC, + snd_vc_pikachu_005 = 0xCAD, + snd_vc_pikachu_006 = 0xCAE, + snd_vc_pikachu_007 = 0xCAF, + snd_vc_pikachu_008 = 0xCB0, + snd_vc_pikachu_009 = 0xCB1, + snd_vc_pikachu_010 = 0xCB2, + snd_vc_pikachu_011 = 0xCB3, + snd_vc_pikachu_012 = 0xCB4, + snd_vc_pikachu_046 = 0xCB5, + snd_vc_pikachu_047 = 0xCB6, + snd_vc_pikachu_048 = 0xCB7, + snd_vc_pikachu_049 = 0xCB8, + snd_vc_ouen_Pikachu = 0xCB9, + snd_vc_pikachu_Appeal01 = 0xCBA, + snd_vc_pikachu_Appeal02 = 0xCBB, + snd_vc_pikachu_Appeal03 = 0xCBC, + snd_vc_pikachu_Attack01 = 0xCBD, + snd_vc_pikachu_Attack02 = 0xCBE, + snd_vc_pikachu_Attack03 = 0xCBF, + snd_vc_pikachu_Attack04 = 0xCC0, + snd_vc_pikachu_Attack05 = 0xCC1, + snd_vc_pikachu_Attack06 = 0xCC2, + snd_vc_pikachu_Attack07 = 0xCC3, + snd_vc_pikachu_CliffCatch = 0xCC4, + snd_vc_pikachu_Damage_hoshikie = 0xCC5, + snd_vc_pikachu_Damage01 = 0xCC6, + snd_vc_pikachu_Damage02 = 0xCC7, + snd_vc_pikachu_DamageFly01 = 0xCC8, + snd_vc_pikachu_DamageFly02 = 0xCC9, + snd_vc_pikachu_FuraFura = 0xCCA, + snd_vc_pikachu_FuraSleep = 0xCCB, + snd_vc_pikachu_HeavyGet = 0xCCC, + snd_vc_pikachu_Jump01 = 0xCCD, + snd_vc_pikachu_Jump02 = 0xCCE, + snd_vc_pikachu_MissFoot01 = 0xCCF, + snd_vc_pikachu_MissFoot02 = 0xCD0, + snd_vc_pikachu_Ottotto = 0xCD1, + snd_vc_pikachu_Passive = 0xCD2, + snd_vc_pikachu_SwimUp = 0xCD3, + snd_vc_pikachu_Win01 = 0xCD4, + snd_vc_pikachu_Win02 = 0xCD5, + snd_vc_pikachu_Win03 = 0xCD6, + snd_se_pikachu_001 = 0xCD7, + snd_se_pikachu_002 = 0xCD8, + snd_se_pikachu_003 = 0xCD9, + snd_se_pikachu_004 = 0xCDA, + snd_se_pikachu_005 = 0xCDB, + snd_se_pikachu_006 = 0xCDC, + snd_se_pikachu_007 = 0xCDD, + snd_se_pikachu_008 = 0xCDE, + snd_se_pikachu_009 = 0xCDF, + snd_se_pikachu_010 = 0xCE0, + snd_se_pikachu_011 = 0xCE1, + snd_se_pikachu_012 = 0xCE2, + snd_se_pikachu_013 = 0xCE3, + snd_se_pikachu_014 = 0xCE4, + snd_se_pikachu_015 = 0xCE5, + snd_se_pikachu_016 = 0xCE6, + snd_se_pikachu_017 = 0xCE7, + snd_se_pikachu_018 = 0xCE8, + snd_se_pikachu_019 = 0xCE9, + snd_se_pikachu_020 = 0xCEA, + snd_se_pikachu_046 = 0xCEB, + snd_se_pikachu_047 = 0xCEC, + snd_se_pikachu_048 = 0xCED, + snd_se_pikachu_049 = 0xCEE, + snd_se_pikachu_050 = 0xCEF, + snd_se_pikachu_Attack_l = 0xCF0, + snd_se_pikachu_Attack_ll = 0xCF1, + snd_se_pikachu_Attack_m = 0xCF2, + snd_se_pikachu_Attack_s = 0xCF3, + snd_se_pikachu_Attack100 = 0xCF4, + snd_se_pikachu_BodyPress01 = 0xCF5, + snd_se_pikachu_BodyPress02 = 0xCF6, + snd_se_pikachu_dash_start = 0xCF7, + snd_se_pikachu_dash_stop = 0xCF8, + snd_se_pikachu_down01 = 0xCF9, + snd_se_pikachu_down02 = 0xCFA, + snd_se_pikachu_Final01 = 0xCFB, + snd_se_pikachu_Final02 = 0xCFC, + snd_se_pikachu_Final03 = 0xCFD, + snd_se_pikachu_Final04 = 0xCFE, + snd_se_pikachu_Final05 = 0xCFF, + snd_se_pikachu_jump01 = 0xD00, + snd_se_pikachu_jump02 = 0xD01, + snd_se_pikachu_Landing01 = 0xD02, + snd_se_pikachu_Landing02 = 0xD03, + snd_se_pikachu_smash_H01 = 0xD04, + snd_se_pikachu_smash_H02 = 0xD05, + snd_se_pikachu_smash_H03 = 0xD06, + snd_se_pikachu_smash_H04 = 0xD07, + snd_se_pikachu_smash_H05 = 0xD08, + snd_se_pikachu_smash_L01 = 0xD09, + snd_se_pikachu_smash_L02 = 0xD0A, + snd_se_pikachu_smash_L03 = 0xD0B, + snd_se_pikachu_smash_L04 = 0xD0C, + snd_se_pikachu_smash_L05 = 0xD0D, + snd_se_pikachu_smash_S01 = 0xD0E, + snd_se_pikachu_smash_S02 = 0xD0F, + snd_se_pikachu_smash_S03 = 0xD10, + snd_se_pikachu_smash_S04 = 0xD11, + snd_se_pikachu_smash_S05 = 0xD12, + snd_se_pikachu_Special_H01 = 0xD13, + snd_se_pikachu_Special_H02 = 0xD14, + snd_se_pikachu_Special_H03 = 0xD15, + snd_se_pikachu_Special_H04 = 0xD16, + snd_se_pikachu_Special_H05 = 0xD17, + snd_se_pikachu_Special_L01 = 0xD18, + snd_se_pikachu_Special_L02 = 0xD19, + snd_se_pikachu_Special_L03 = 0xD1A, + snd_se_pikachu_Special_L04 = 0xD1B, + snd_se_pikachu_Special_L05 = 0xD1C, + snd_se_pikachu_Special_N01 = 0xD1D, + snd_se_pikachu_Special_N02 = 0xD1E, + snd_se_pikachu_Special_N03 = 0xD1F, + snd_se_pikachu_Special_N04 = 0xD20, + snd_se_pikachu_Special_N05 = 0xD21, + snd_se_pikachu_Special_S01 = 0xD22, + snd_se_pikachu_Special_S02 = 0xD23, + snd_se_pikachu_Special_S03 = 0xD24, + snd_se_pikachu_Special_S04 = 0xD25, + snd_se_pikachu_Special_S05 = 0xD26, + snd_se_pikachu_squat = 0xD27, + snd_se_pikachu_step_hidari_m = 0xD28, + snd_se_pikachu_step_hidari_s = 0xD29, + snd_se_pikachu_step_migi_m = 0xD2A, + snd_se_pikachu_step_migi_s = 0xD2B, + snd_se_pikachu_swing_l = 0xD2C, + snd_se_pikachu_swing_ll = 0xD2D, + snd_se_pikachu_swing_m = 0xD2E, + snd_se_pikachu_swing_s = 0xD2F, + snd_se_pikachu_turn = 0xD30, + snd_se_pikachu_turn_run = 0xD31, + snd_se_pikachu_ukemi = 0xD32, + snd_se_pikachu_Wait1 = 0xD33, + snd_se_pikachu_Wait2 = 0xD34, + snd_se_pikachu_Wait3 = 0xD35, + snd_se_pikachu_wear = 0xD36, + snd_se_Luigi_001 = 0xD37, + snd_se_Luigi_002 = 0xD38, + snd_se_Luigi_003 = 0xD39, + snd_se_Luigi_004 = 0xD3A, + snd_se_Luigi_005 = 0xD3B, + snd_se_Luigi_006 = 0xD3C, + snd_se_Luigi_007 = 0xD3D, + snd_se_Luigi_008 = 0xD3E, + snd_se_Luigi_009 = 0xD3F, + snd_se_Luigi_010 = 0xD40, + snd_se_Luigi_011 = 0xD41, + snd_se_Luigi_012 = 0xD42, + snd_se_Luigi_013 = 0xD43, + snd_se_Luigi_014 = 0xD44, + snd_se_Luigi_015 = 0xD45, + snd_se_Luigi_016 = 0xD46, + snd_se_Luigi_017 = 0xD47, + snd_se_Luigi_018 = 0xD48, + snd_se_Luigi_019 = 0xD49, + snd_se_Luigi_020 = 0xD4A, + snd_se_Luigi_021 = 0xD4B, + snd_se_Luigi_022 = 0xD4C, + snd_se_Luigi_023 = 0xD4D, + snd_se_Luigi_024 = 0xD4E, + snd_se_Luigi_025 = 0xD4F, + snd_se_Luigi_026 = 0xD50, + snd_se_Luigi_046 = 0xD51, + snd_se_Luigi_047 = 0xD52, + snd_se_Luigi_048 = 0xD53, + snd_se_Luigi_049 = 0xD54, + snd_se_Luigi_050 = 0xD55, + snd_se_Luigi_Attack_l = 0xD56, + snd_se_Luigi_Attack_ll = 0xD57, + snd_se_Luigi_Attack_m = 0xD58, + snd_se_Luigi_Attack_s = 0xD59, + snd_se_Luigi_Attack100 = 0xD5A, + snd_se_Luigi_BodyPress01 = 0xD5B, + snd_se_Luigi_BodyPress02 = 0xD5C, + snd_se_Luigi_dash_start = 0xD5D, + snd_se_Luigi_dash_stop = 0xD5E, + snd_se_Luigi_down01 = 0xD5F, + snd_se_Luigi_down02 = 0xD60, + snd_se_Luigi_Final01 = 0xD61, + snd_se_Luigi_Final02 = 0xD62, + snd_se_Luigi_Final03 = 0xD63, + snd_se_Luigi_Final04 = 0xD64, + snd_se_Luigi_Final05 = 0xD65, + snd_se_Luigi_jump01 = 0xD66, + snd_se_Luigi_jump02 = 0xD67, + snd_se_Luigi_Landing01 = 0xD68, + snd_se_Luigi_Landing02 = 0xD69, + snd_se_Luigi_smash_H01 = 0xD6A, + snd_se_Luigi_smash_H02 = 0xD6B, + snd_se_Luigi_smash_H03 = 0xD6C, + snd_se_Luigi_smash_H04 = 0xD6D, + snd_se_Luigi_smash_H05 = 0xD6E, + snd_se_Luigi_smash_L01 = 0xD6F, + snd_se_Luigi_smash_L02 = 0xD70, + snd_se_Luigi_smash_L03 = 0xD71, + snd_se_Luigi_smash_L04 = 0xD72, + snd_se_Luigi_smash_L05 = 0xD73, + snd_se_Luigi_smash_S01 = 0xD74, + snd_se_Luigi_smash_S02 = 0xD75, + snd_se_Luigi_smash_S03 = 0xD76, + snd_se_Luigi_smash_S04 = 0xD77, + snd_se_Luigi_smash_S05 = 0xD78, + snd_se_Luigi_Special_H01 = 0xD79, + snd_se_Luigi_Special_H02 = 0xD7A, + snd_se_Luigi_Special_H03 = 0xD7B, + snd_se_Luigi_Special_H04 = 0xD7C, + snd_se_Luigi_Special_H05 = 0xD7D, + snd_se_Luigi_Special_L01 = 0xD7E, + snd_se_Luigi_Special_L02 = 0xD7F, + snd_se_Luigi_Special_L03 = 0xD80, + snd_se_Luigi_Special_L04 = 0xD81, + snd_se_Luigi_Special_L05 = 0xD82, + snd_se_Luigi_Special_N01 = 0xD83, + snd_se_Luigi_Special_N02 = 0xD84, + snd_se_Luigi_Special_N03 = 0xD85, + snd_se_Luigi_Special_N04 = 0xD86, + snd_se_Luigi_Special_N05 = 0xD87, + snd_se_Luigi_Special_S01 = 0xD88, + snd_se_Luigi_Special_S02 = 0xD89, + snd_se_Luigi_Special_S03 = 0xD8A, + snd_se_Luigi_Special_S04 = 0xD8B, + snd_se_Luigi_Special_S05 = 0xD8C, + snd_se_Luigi_squat = 0xD8D, + snd_se_Luigi_step_hidari_m = 0xD8E, + snd_se_Luigi_step_hidari_s = 0xD8F, + snd_se_Luigi_step_migi_m = 0xD90, + snd_se_Luigi_step_migi_s = 0xD91, + snd_se_Luigi_swing_l = 0xD92, + snd_se_Luigi_swing_ll = 0xD93, + snd_se_Luigi_swing_m = 0xD94, + snd_se_Luigi_swing_s = 0xD95, + snd_se_Luigi_turn = 0xD96, + snd_se_Luigi_turn_run = 0xD97, + snd_se_Luigi_ukemi = 0xD98, + snd_se_Luigi_Wait1 = 0xD99, + snd_se_Luigi_Wait2 = 0xD9A, + snd_se_Luigi_Wait3 = 0xD9B, + snd_se_Luigi_wear = 0xD9C, + snd_se_captain_001 = 0xD9D, + snd_se_captain_002 = 0xD9E, + snd_se_captain_003 = 0xD9F, + snd_se_captain_004 = 0xDA0, + snd_se_captain_005 = 0xDA1, + snd_se_captain_006 = 0xDA2, + snd_se_captain_007 = 0xDA3, + snd_se_captain_008 = 0xDA4, + snd_se_captain_009 = 0xDA5, + snd_se_captain_010 = 0xDA6, + snd_se_captain_011 = 0xDA7, + snd_se_captain_012 = 0xDA8, + snd_se_captain_013 = 0xDA9, + snd_se_captain_014 = 0xDAA, + snd_se_captain_015 = 0xDAB, + snd_se_captain_016 = 0xDAC, + snd_se_captain_017 = 0xDAD, + snd_se_captain_018 = 0xDAE, + snd_se_captain_019 = 0xDAF, + snd_se_captain_020 = 0xDB0, + snd_se_captain_021 = 0xDB1, + snd_se_captain_022 = 0xDB2, + snd_se_captain_023 = 0xDB3, + snd_se_captain_024 = 0xDB4, + snd_se_captain_025 = 0xDB5, + snd_se_captain_026 = 0xDB6, + snd_se_captain_027 = 0xDB7, + snd_se_captain_028 = 0xDB8, + snd_se_captain_029 = 0xDB9, + snd_se_captain_030 = 0xDBA, + snd_se_captain_031 = 0xDBB, + snd_se_captain_032 = 0xDBC, + snd_se_captain_033 = 0xDBD, + snd_se_captain_034 = 0xDBE, + snd_se_captain_035 = 0xDBF, + snd_se_captain_036 = 0xDC0, + snd_se_captain_037 = 0xDC1, + snd_se_captain_038 = 0xDC2, + snd_se_captain_039 = 0xDC3, + snd_se_captain_040 = 0xDC4, + snd_se_captain_041 = 0xDC5, + snd_se_captain_042 = 0xDC6, + snd_se_captain_043 = 0xDC7, + snd_se_captain_044 = 0xDC8, + snd_se_captain_045 = 0xDC9, + snd_se_captain_046 = 0xDCA, + snd_se_captain_047 = 0xDCB, + snd_se_captain_048 = 0xDCC, + snd_se_captain_049 = 0xDCD, + snd_se_captain_050 = 0xDCE, + snd_se_captain_Attack_l = 0xDCF, + snd_se_captain_Attack_ll = 0xDD0, + snd_se_captain_Attack_m = 0xDD1, + snd_se_captain_Attack_s = 0xDD2, + snd_se_captain_Attack100 = 0xDD3, + snd_se_captain_BodyPress01 = 0xDD4, + snd_se_captain_BodyPress02 = 0xDD5, + snd_se_captain_dash_start = 0xDD6, + snd_se_captain_dash_stop = 0xDD7, + snd_se_captain_down01 = 0xDD8, + snd_se_captain_down02 = 0xDD9, + snd_se_captain_Final01 = 0xDDA, + snd_se_captain_Final02 = 0xDDB, + snd_se_captain_Final03 = 0xDDC, + snd_se_captain_Final04 = 0xDDD, + snd_se_captain_Final05 = 0xDDE, + snd_se_captain_jump01 = 0xDDF, + snd_se_captain_jump02 = 0xDE0, + snd_se_captain_Landing01 = 0xDE1, + snd_se_captain_Landing02 = 0xDE2, + snd_se_captain_smash_H01 = 0xDE3, + snd_se_captain_smash_H02 = 0xDE4, + snd_se_captain_smash_H03 = 0xDE5, + snd_se_captain_smash_H04 = 0xDE6, + snd_se_captain_smash_H05 = 0xDE7, + snd_se_captain_smash_L01 = 0xDE8, + snd_se_captain_smash_L02 = 0xDE9, + snd_se_captain_smash_L03 = 0xDEA, + snd_se_captain_smash_L04 = 0xDEB, + snd_se_captain_smash_L05 = 0xDEC, + snd_se_captain_smash_S01 = 0xDED, + snd_se_captain_smash_S02 = 0xDEE, + snd_se_captain_smash_S03 = 0xDEF, + snd_se_captain_smash_S04 = 0xDF0, + snd_se_captain_smash_S05 = 0xDF1, + snd_se_captain_Special_H01 = 0xDF2, + snd_se_captain_Special_H02 = 0xDF3, + snd_se_captain_Special_H03 = 0xDF4, + snd_se_captain_Special_H04 = 0xDF5, + snd_se_captain_Special_H05 = 0xDF6, + snd_se_captain_Special_L01 = 0xDF7, + snd_se_captain_Special_L02 = 0xDF8, + snd_se_captain_Special_L03 = 0xDF9, + snd_se_captain_Special_L04 = 0xDFA, + snd_se_captain_Special_L05 = 0xDFB, + snd_se_captain_Special_N01 = 0xDFC, + snd_se_captain_Special_N02 = 0xDFD, + snd_se_captain_Special_N03 = 0xDFE, + snd_se_captain_Special_N04 = 0xDFF, + snd_se_captain_Special_N05 = 0xE00, + snd_se_captain_Special_S01 = 0xE01, + snd_se_captain_Special_S02 = 0xE02, + snd_se_captain_Special_S03 = 0xE03, + snd_se_captain_Special_S04 = 0xE04, + snd_se_captain_Special_S05 = 0xE05, + snd_se_captain_squat = 0xE06, + snd_se_captain_step_hidari_m = 0xE07, + snd_se_captain_step_hidari_s = 0xE08, + snd_se_captain_step_migi_m = 0xE09, + snd_se_captain_step_migi_s = 0xE0A, + snd_se_captain_swing_l = 0xE0B, + snd_se_captain_swing_ll = 0xE0C, + snd_se_captain_swing_m = 0xE0D, + snd_se_captain_swing_s = 0xE0E, + snd_se_captain_turn = 0xE0F, + snd_se_captain_turn_run = 0xE10, + snd_se_captain_ukemi = 0xE11, + snd_se_captain_Wait1 = 0xE12, + snd_se_captain_Wait2 = 0xE13, + snd_se_captain_Wait3 = 0xE14, + snd_se_captain_wear = 0xE15, + snd_vc_Ness_001 = 0xE16, + snd_vc_Ness_002 = 0xE17, + snd_vc_Ness_003 = 0xE18, + snd_vc_Ness_004 = 0xE19, + snd_vc_Ness_005 = 0xE1A, + snd_vc_Ness_006 = 0xE1B, + snd_vc_Ness_007 = 0xE1C, + snd_vc_Ness_008 = 0xE1D, + snd_vc_Ness_009 = 0xE1E, + snd_vc_Ness_010 = 0xE1F, + snd_vc_Ness_046 = 0xE20, + snd_vc_Ness_047 = 0xE21, + snd_vc_Ness_048 = 0xE22, + snd_vc_Ness_049 = 0xE23, + snd_vc_ouen_Ness = 0xE24, + snd_vc_Ness_Appeal01 = 0xE25, + snd_vc_Ness_Appeal02 = 0xE26, + snd_vc_Ness_Appeal03 = 0xE27, + snd_vc_Ness_Attack01 = 0xE28, + snd_vc_Ness_Attack02 = 0xE29, + snd_vc_Ness_Attack03 = 0xE2A, + snd_vc_Ness_Attack04 = 0xE2B, + snd_vc_Ness_Attack05 = 0xE2C, + snd_vc_Ness_Attack06 = 0xE2D, + snd_vc_Ness_Attack07 = 0xE2E, + snd_vc_Ness_CliffCatch = 0xE2F, + snd_vc_Ness_Damage_hoshikie = 0xE30, + snd_vc_Ness_Damage01 = 0xE31, + snd_vc_Ness_Damage02 = 0xE32, + snd_vc_Ness_DamageFly01 = 0xE33, + snd_vc_Ness_DamageFly02 = 0xE34, + snd_vc_Ness_FuraFura = 0xE35, + snd_vc_Ness_FuraSleep = 0xE36, + snd_vc_Ness_HeavyGet = 0xE37, + snd_vc_Ness_Jump01 = 0xE38, + snd_vc_Ness_Jump02 = 0xE39, + snd_vc_Ness_MissFoot01 = 0xE3A, + snd_vc_Ness_MissFoot02 = 0xE3B, + snd_vc_Ness_Ottotto = 0xE3C, + snd_vc_Ness_Passive = 0xE3D, + snd_vc_Ness_SwimUp = 0xE3E, + snd_vc_Ness_Win01 = 0xE3F, + snd_vc_Ness_Win02 = 0xE40, + snd_vc_Ness_Win03 = 0xE41, + snd_se_Ness_001 = 0xE42, + snd_se_Ness_002 = 0xE43, + snd_se_Ness_003 = 0xE44, + snd_se_Ness_004 = 0xE45, + snd_se_Ness_005 = 0xE46, + snd_se_Ness_006 = 0xE47, + snd_se_Ness_007 = 0xE48, + snd_se_Ness_008 = 0xE49, + snd_se_Ness_009 = 0xE4A, + snd_se_Ness_010 = 0xE4B, + snd_se_Ness_011 = 0xE4C, + snd_se_Ness_012 = 0xE4D, + snd_se_Ness_013 = 0xE4E, + snd_se_Ness_014 = 0xE4F, + snd_se_Ness_015 = 0xE50, + snd_se_Ness_016 = 0xE51, + snd_se_Ness_046 = 0xE52, + snd_se_Ness_047 = 0xE53, + snd_se_Ness_048 = 0xE54, + snd_se_Ness_049 = 0xE55, + snd_se_Ness_050 = 0xE56, + snd_se_Ness_Attack_l = 0xE57, + snd_se_Ness_Attack_ll = 0xE58, + snd_se_Ness_Attack_m = 0xE59, + snd_se_Ness_Attack_s = 0xE5A, + snd_se_Ness_Attack100 = 0xE5B, + snd_se_Ness_BodyPress01 = 0xE5C, + snd_se_Ness_BodyPress02 = 0xE5D, + snd_se_Ness_dash_start = 0xE5E, + snd_se_Ness_dash_stop = 0xE5F, + snd_se_Ness_down01 = 0xE60, + snd_se_Ness_down02 = 0xE61, + snd_se_Ness_Final01 = 0xE62, + snd_se_Ness_Final02 = 0xE63, + snd_se_Ness_Final03 = 0xE64, + snd_se_Ness_Final04 = 0xE65, + snd_se_Ness_Final05 = 0xE66, + snd_se_Ness_jump01 = 0xE67, + snd_se_Ness_jump02 = 0xE68, + snd_se_Ness_Landing01 = 0xE69, + snd_se_Ness_Landing02 = 0xE6A, + snd_se_Ness_smash_H01 = 0xE6B, + snd_se_Ness_smash_H02 = 0xE6C, + snd_se_Ness_smash_H03 = 0xE6D, + snd_se_Ness_smash_H04 = 0xE6E, + snd_se_Ness_smash_H05 = 0xE6F, + snd_se_Ness_smash_L01 = 0xE70, + snd_se_Ness_smash_L02 = 0xE71, + snd_se_Ness_smash_L03 = 0xE72, + snd_se_Ness_smash_L04 = 0xE73, + snd_se_Ness_smash_L05 = 0xE74, + snd_se_Ness_smash_S01 = 0xE75, + snd_se_Ness_smash_S02 = 0xE76, + snd_se_Ness_smash_S03 = 0xE77, + snd_se_Ness_smash_S04 = 0xE78, + snd_se_Ness_smash_S05 = 0xE79, + snd_se_Ness_Special_H01 = 0xE7A, + snd_se_Ness_Special_H02 = 0xE7B, + snd_se_Ness_Special_H03 = 0xE7C, + snd_se_Ness_Special_H04 = 0xE7D, + snd_se_Ness_Special_H05 = 0xE7E, + snd_se_Ness_Special_L01 = 0xE7F, + snd_se_Ness_Special_L02 = 0xE80, + snd_se_Ness_Special_L03 = 0xE81, + snd_se_Ness_Special_L04 = 0xE82, + snd_se_Ness_Special_L05 = 0xE83, + snd_se_Ness_Special_N01 = 0xE84, + snd_se_Ness_Special_N02 = 0xE85, + snd_se_Ness_Special_N03 = 0xE86, + snd_se_Ness_Special_N04 = 0xE87, + snd_se_Ness_Special_N05 = 0xE88, + snd_se_Ness_Special_S01 = 0xE89, + snd_se_Ness_Special_S02 = 0xE8A, + snd_se_Ness_Special_S03 = 0xE8B, + snd_se_Ness_Special_S04 = 0xE8C, + snd_se_Ness_Special_S05 = 0xE8D, + snd_se_Ness_squat = 0xE8E, + snd_se_Ness_step_hidari_m = 0xE8F, + snd_se_Ness_step_hidari_s = 0xE90, + snd_se_Ness_step_migi_m = 0xE91, + snd_se_Ness_step_migi_s = 0xE92, + snd_se_Ness_swing_l = 0xE93, + snd_se_Ness_swing_ll = 0xE94, + snd_se_Ness_swing_m = 0xE95, + snd_se_Ness_swing_s = 0xE96, + snd_se_Ness_turn = 0xE97, + snd_se_Ness_turn_run = 0xE98, + snd_se_Ness_ukemi = 0xE99, + snd_se_Ness_Wait1 = 0xE9A, + snd_se_Ness_Wait2 = 0xE9B, + snd_se_Ness_Wait3 = 0xE9C, + snd_se_Ness_wear = 0xE9D, + snd_se_koopa_001 = 0xE9E, + snd_se_koopa_002 = 0xE9F, + snd_se_koopa_003 = 0xEA0, + snd_se_koopa_004 = 0xEA1, + snd_se_koopa_005 = 0xEA2, + snd_se_koopa_006 = 0xEA3, + snd_se_koopa_007 = 0xEA4, + snd_se_koopa_008 = 0xEA5, + snd_se_koopa_009 = 0xEA6, + snd_se_koopa_010 = 0xEA7, + snd_se_koopa_011 = 0xEA8, + snd_se_koopa_012 = 0xEA9, + snd_se_koopa_013 = 0xEAA, + snd_se_koopa_014 = 0xEAB, + snd_se_koopa_015 = 0xEAC, + snd_se_koopa_016 = 0xEAD, + snd_se_koopa_017 = 0xEAE, + snd_se_koopa_018 = 0xEAF, + snd_se_koopa_019 = 0xEB0, + snd_se_koopa_020 = 0xEB1, + snd_se_koopa_021 = 0xEB2, + snd_se_koopa_022 = 0xEB3, + snd_se_koopa_023 = 0xEB4, + snd_se_koopa_024 = 0xEB5, + snd_se_koopa_025 = 0xEB6, + snd_se_koopa_026 = 0xEB7, + snd_se_koopa_027 = 0xEB8, + snd_se_koopa_028 = 0xEB9, + snd_se_koopa_029 = 0xEBA, + snd_se_koopa_030 = 0xEBB, + snd_se_koopa_031 = 0xEBC, + snd_se_koopa_032 = 0xEBD, + snd_se_koopa_033 = 0xEBE, + snd_se_koopa_034 = 0xEBF, + snd_se_koopa_035 = 0xEC0, + snd_se_koopa_036 = 0xEC1, + snd_se_koopa_037 = 0xEC2, + snd_se_koopa_038 = 0xEC3, + snd_se_koopa_039 = 0xEC4, + snd_se_koopa_040 = 0xEC5, + snd_se_koopa_041 = 0xEC6, + snd_se_koopa_042 = 0xEC7, + snd_se_koopa_043 = 0xEC8, + snd_se_koopa_044 = 0xEC9, + snd_se_koopa_045 = 0xECA, + snd_se_koopa_046 = 0xECB, + snd_se_koopa_047 = 0xECC, + snd_se_koopa_048 = 0xECD, + snd_se_koopa_049 = 0xECE, + snd_se_koopa_050 = 0xECF, + snd_se_koopa_Attack_l = 0xED0, + snd_se_koopa_Attack_ll = 0xED1, + snd_se_koopa_Attack_m = 0xED2, + snd_se_koopa_Attack_s = 0xED3, + snd_se_koopa_Attack100 = 0xED4, + snd_se_koopa_BodyPress01 = 0xED5, + snd_se_koopa_BodyPress02 = 0xED6, + snd_se_koopa_dash_start = 0xED7, + snd_se_koopa_dash_stop = 0xED8, + snd_se_koopa_down01 = 0xED9, + snd_se_koopa_down02 = 0xEDA, + snd_se_koopa_Final01 = 0xEDB, + snd_se_koopa_Final02 = 0xEDC, + snd_se_koopa_Final03 = 0xEDD, + snd_se_koopa_Final04 = 0xEDE, + snd_se_koopa_Final05 = 0xEDF, + snd_se_koopa_jump01 = 0xEE0, + snd_se_koopa_jump02 = 0xEE1, + snd_se_koopa_Landing01 = 0xEE2, + snd_se_koopa_Landing02 = 0xEE3, + snd_se_koopa_smash_H01 = 0xEE4, + snd_se_koopa_smash_H02 = 0xEE5, + snd_se_koopa_smash_H03 = 0xEE6, + snd_se_koopa_smash_H04 = 0xEE7, + snd_se_koopa_smash_H05 = 0xEE8, + snd_se_koopa_smash_L01 = 0xEE9, + snd_se_koopa_smash_L02 = 0xEEA, + snd_se_koopa_smash_L03 = 0xEEB, + snd_se_koopa_smash_L04 = 0xEEC, + snd_se_koopa_smash_L05 = 0xEED, + snd_se_koopa_smash_S01 = 0xEEE, + snd_se_koopa_smash_S02 = 0xEEF, + snd_se_koopa_smash_S03 = 0xEF0, + snd_se_koopa_smash_S04 = 0xEF1, + snd_se_koopa_smash_S05 = 0xEF2, + snd_se_koopa_Special_H01 = 0xEF3, + snd_se_koopa_Special_H02 = 0xEF4, + snd_se_koopa_Special_H03 = 0xEF5, + snd_se_koopa_Special_H04 = 0xEF6, + snd_se_koopa_Special_H05 = 0xEF7, + snd_se_koopa_Special_L01 = 0xEF8, + snd_se_koopa_Special_L02 = 0xEF9, + snd_se_koopa_Special_L03 = 0xEFA, + snd_se_koopa_Special_L04 = 0xEFB, + snd_se_koopa_Special_L05 = 0xEFC, + snd_se_koopa_Special_N01 = 0xEFD, + snd_se_koopa_Special_N02 = 0xEFE, + snd_se_koopa_Special_N03 = 0xEFF, + snd_se_koopa_Special_N04 = 0xF00, + snd_se_koopa_Special_N05 = 0xF01, + snd_se_koopa_Special_S01 = 0xF02, + snd_se_koopa_Special_S02 = 0xF03, + snd_se_koopa_Special_S03 = 0xF04, + snd_se_koopa_Special_S04 = 0xF05, + snd_se_koopa_Special_S05 = 0xF06, + snd_se_koopa_squat = 0xF07, + snd_se_koopa_step_hidari_m = 0xF08, + snd_se_koopa_step_hidari_s = 0xF09, + snd_se_koopa_step_migi_m = 0xF0A, + snd_se_koopa_step_migi_s = 0xF0B, + snd_se_koopa_swing_l = 0xF0C, + snd_se_koopa_swing_ll = 0xF0D, + snd_se_koopa_swing_m = 0xF0E, + snd_se_koopa_swing_s = 0xF0F, + snd_se_koopa_turn = 0xF10, + snd_se_koopa_turn_run = 0xF11, + snd_se_koopa_ukemi = 0xF12, + snd_se_koopa_Wait1 = 0xF13, + snd_se_koopa_Wait2 = 0xF14, + snd_se_koopa_Wait3 = 0xF15, + snd_se_koopa_wear = 0xF16, + snd_se_peach_001 = 0xF17, + snd_se_peach_002 = 0xF18, + snd_se_peach_003 = 0xF19, + snd_se_peach_004 = 0xF1A, + snd_se_peach_Attack_Binta = 0xF1B, + snd_se_peach_Attack_Smash01_Fryingpan = 0xF1C, + snd_se_peach_Attack_Smash02_Golfclub = 0xF1D, + snd_se_peach_Attack_Smash03_Tennisracket = 0xF1E, + snd_se_peach_009 = 0xF1F, + snd_se_peach_010 = 0xF20, + snd_se_peach_011 = 0xF21, + snd_se_peach_012 = 0xF22, + snd_se_peach_013 = 0xF23, + snd_se_peach_014 = 0xF24, + snd_se_peach_015 = 0xF25, + snd_se_peach_016 = 0xF26, + snd_se_peach_017 = 0xF27, + snd_se_peach_046 = 0xF28, + snd_se_peach_047 = 0xF29, + snd_se_peach_048 = 0xF2A, + snd_se_peach_049 = 0xF2B, + snd_se_peach_050 = 0xF2C, + snd_se_peach_Attack_l = 0xF2D, + snd_se_peach_Attack_ll = 0xF2E, + snd_se_peach_Attack_m = 0xF2F, + snd_se_peach_Attack_s = 0xF30, + snd_se_peach_Attack100 = 0xF31, + snd_se_peach_BodyPress01 = 0xF32, + snd_se_peach_BodyPress02 = 0xF33, + snd_se_peach_dash_start = 0xF34, + snd_se_peach_dash_stop = 0xF35, + snd_se_peach_down01 = 0xF36, + snd_se_peach_down02 = 0xF37, + snd_se_peach_Final01 = 0xF38, + snd_se_peach_Final02 = 0xF39, + snd_se_peach_Final03 = 0xF3A, + snd_se_peach_Final04 = 0xF3B, + snd_se_peach_Final05 = 0xF3C, + snd_se_peach_jump01 = 0xF3D, + snd_se_peach_jump02 = 0xF3E, + snd_se_peach_Landing01 = 0xF3F, + snd_se_peach_Landing02 = 0xF40, + snd_se_peach_smash_H01 = 0xF41, + snd_se_peach_smash_H02 = 0xF42, + snd_se_peach_smash_H03 = 0xF43, + snd_se_peach_smash_H04 = 0xF44, + snd_se_peach_smash_H05 = 0xF45, + snd_se_peach_smash_L01 = 0xF46, + snd_se_peach_smash_L02 = 0xF47, + snd_se_peach_smash_L03 = 0xF48, + snd_se_peach_smash_L04 = 0xF49, + snd_se_peach_smash_L05 = 0xF4A, + snd_se_peach_smash_S01 = 0xF4B, + snd_se_peach_smash_S02 = 0xF4C, + snd_se_peach_smash_S03 = 0xF4D, + snd_se_peach_smash_S04 = 0xF4E, + snd_se_peach_smash_S05 = 0xF4F, + snd_se_peach_Special_H01 = 0xF50, + snd_se_peach_Special_H02 = 0xF51, + snd_se_peach_Special_H03 = 0xF52, + snd_se_peach_Special_H04 = 0xF53, + snd_se_peach_Special_H05 = 0xF54, + snd_se_peach_Special_L01 = 0xF55, + snd_se_peach_Special_L02 = 0xF56, + snd_se_peach_Special_L03 = 0xF57, + snd_se_peach_Special_L04 = 0xF58, + snd_se_peach_Special_L05 = 0xF59, + snd_se_peach_Special_N01 = 0xF5A, + snd_se_peach_Special_N02 = 0xF5B, + snd_se_peach_Special_N03 = 0xF5C, + snd_se_peach_Special_N04 = 0xF5D, + snd_se_peach_Special_N05 = 0xF5E, + snd_se_peach_Special_S01 = 0xF5F, + snd_se_peach_Special_S02 = 0xF60, + snd_se_peach_Special_S03 = 0xF61, + snd_se_peach_Special_S04 = 0xF62, + snd_se_peach_Special_S05 = 0xF63, + snd_se_peach_squat = 0xF64, + snd_se_peach_step_hidari_m = 0xF65, + snd_se_peach_step_hidari_s = 0xF66, + snd_se_peach_step_migi_m = 0xF67, + snd_se_peach_step_migi_s = 0xF68, + snd_se_peach_swing_l = 0xF69, + snd_se_peach_swing_ll = 0xF6A, + snd_se_peach_swing_m = 0xF6B, + snd_se_peach_swing_s = 0xF6C, + snd_se_peach_turn = 0xF6D, + snd_se_peach_turn_run = 0xF6E, + snd_se_peach_ukemi = 0xF6F, + snd_se_peach_Wait1 = 0xF70, + snd_se_peach_Wait2 = 0xF71, + snd_se_peach_Wait3 = 0xF72, + snd_se_peach_wear = 0xF73, + snd_se_Zelda_001 = 0xF74, + snd_se_Zelda_002 = 0xF75, + snd_se_Zelda_003 = 0xF76, + snd_se_Zelda_004 = 0xF77, + snd_se_Zelda_005 = 0xF78, + snd_se_Zelda_006 = 0xF79, + snd_se_Zelda_007 = 0xF7A, + snd_se_Zelda_008 = 0xF7B, + snd_se_Zelda_009 = 0xF7C, + snd_se_Zelda_010 = 0xF7D, + snd_se_Zelda_011 = 0xF7E, + snd_se_Zelda_012 = 0xF7F, + snd_se_Zelda_013 = 0xF80, + snd_se_Zelda_014 = 0xF81, + snd_se_Zelda_015 = 0xF82, + snd_se_Zelda_016 = 0xF83, + snd_se_Zelda_017 = 0xF84, + snd_se_Zelda_018 = 0xF85, + snd_se_Zelda_019 = 0xF86, + snd_se_Zelda_020 = 0xF87, + snd_se_Zelda_021 = 0xF88, + snd_se_Zelda_022 = 0xF89, + snd_se_Zelda_023 = 0xF8A, + snd_se_Zelda_024 = 0xF8B, + snd_se_Zelda_025 = 0xF8C, + snd_se_Zelda_026 = 0xF8D, + snd_se_Zelda_027 = 0xF8E, + snd_se_Zelda_028 = 0xF8F, + snd_se_Zelda_029 = 0xF90, + snd_se_Zelda_030 = 0xF91, + snd_se_Zelda_031 = 0xF92, + snd_se_Zelda_032 = 0xF93, + snd_se_Zelda_033 = 0xF94, + snd_se_Zelda_034 = 0xF95, + snd_se_Zelda_035 = 0xF96, + snd_se_Zelda_036 = 0xF97, + snd_se_Zelda_037 = 0xF98, + snd_se_Zelda_038 = 0xF99, + snd_se_Zelda_039 = 0xF9A, + snd_se_Zelda_040 = 0xF9B, + snd_se_Zelda_041 = 0xF9C, + snd_se_Zelda_046 = 0xF9D, + snd_se_Zelda_047 = 0xF9E, + snd_se_Zelda_048 = 0xF9F, + snd_se_Zelda_049 = 0xFA0, + snd_se_Zelda_050 = 0xFA1, + snd_se_Zelda_Attack_l = 0xFA2, + snd_se_Zelda_Attack_ll = 0xFA3, + snd_se_Zelda_Attack_m = 0xFA4, + snd_se_Zelda_Attack_s = 0xFA5, + snd_se_Zelda_Attack100 = 0xFA6, + snd_se_Zelda_BodyPress01 = 0xFA7, + snd_se_Zelda_BodyPress02 = 0xFA8, + snd_se_Zelda_dash_start = 0xFA9, + snd_se_Zelda_dash_stop = 0xFAA, + snd_se_Zelda_down01 = 0xFAB, + snd_se_Zelda_down02 = 0xFAC, + snd_se_Zelda_Final01 = 0xFAD, + snd_se_Zelda_Final02 = 0xFAE, + snd_se_Zelda_Final03 = 0xFAF, + snd_se_Zelda_Final04 = 0xFB0, + snd_se_Zelda_Final05 = 0xFB1, + snd_se_Zelda_jump01 = 0xFB2, + snd_se_Zelda_jump02 = 0xFB3, + snd_se_Zelda_Landing01 = 0xFB4, + snd_se_Zelda_Landing02 = 0xFB5, + snd_se_Zelda_smash_H01 = 0xFB6, + snd_se_Zelda_smash_H02 = 0xFB7, + snd_se_Zelda_smash_H03 = 0xFB8, + snd_se_Zelda_smash_H04 = 0xFB9, + snd_se_Zelda_smash_H05 = 0xFBA, + snd_se_Zelda_smash_L01 = 0xFBB, + snd_se_Zelda_smash_L02 = 0xFBC, + snd_se_Zelda_smash_L03 = 0xFBD, + snd_se_Zelda_smash_L04 = 0xFBE, + snd_se_Zelda_smash_L05 = 0xFBF, + snd_se_Zelda_smash_S01 = 0xFC0, + snd_se_Zelda_smash_S02 = 0xFC1, + snd_se_Zelda_smash_S03 = 0xFC2, + snd_se_Zelda_smash_S04 = 0xFC3, + snd_se_Zelda_smash_S05 = 0xFC4, + snd_se_Zelda_Special_H01 = 0xFC5, + snd_se_Zelda_Special_H02 = 0xFC6, + snd_se_Zelda_Special_H03 = 0xFC7, + snd_se_Zelda_Special_H04 = 0xFC8, + snd_se_Zelda_Special_H05 = 0xFC9, + snd_se_Zelda_Special_L01 = 0xFCA, + snd_se_Zelda_Special_L02 = 0xFCB, + snd_se_Zelda_Special_L03 = 0xFCC, + snd_se_Zelda_Special_L04 = 0xFCD, + snd_se_Zelda_Special_L05 = 0xFCE, + snd_se_Zelda_Special_N01 = 0xFCF, + snd_se_Zelda_Special_N02 = 0xFD0, + snd_se_Zelda_Special_N03 = 0xFD1, + snd_se_Zelda_Special_N04 = 0xFD2, + snd_se_Zelda_Special_N05 = 0xFD3, + snd_se_Zelda_Special_S01 = 0xFD4, + snd_se_Zelda_Special_S02 = 0xFD5, + snd_se_Zelda_Special_S03 = 0xFD6, + snd_se_Zelda_Special_S04 = 0xFD7, + snd_se_Zelda_Special_S05 = 0xFD8, + snd_se_Zelda_squat = 0xFD9, + snd_se_Zelda_step_hidari_m = 0xFDA, + snd_se_Zelda_step_hidari_s = 0xFDB, + snd_se_Zelda_step_migi_m = 0xFDC, + snd_se_Zelda_step_migi_s = 0xFDD, + snd_se_Zelda_swing_l = 0xFDE, + snd_se_Zelda_swing_ll = 0xFDF, + snd_se_Zelda_swing_m = 0xFE0, + snd_se_Zelda_swing_s = 0xFE1, + snd_se_Zelda_turn = 0xFE2, + snd_se_Zelda_turn_run = 0xFE3, + snd_se_Zelda_ukemi = 0xFE4, + snd_se_Zelda_Wait1 = 0xFE5, + snd_se_Zelda_Wait2 = 0xFE6, + snd_se_Zelda_Wait3 = 0xFE7, + snd_se_Zelda_wear = 0xFE8, + snd_se_Sheik_001 = 0xFE9, + snd_se_Sheik_002 = 0xFEA, + snd_se_Sheik_003 = 0xFEB, + snd_se_Sheik_004 = 0xFEC, + snd_se_Sheik_005 = 0xFED, + snd_se_Sheik_006 = 0xFEE, + snd_se_Sheik_007 = 0xFEF, + snd_se_Sheik_008 = 0xFF0, + snd_se_Sheik_009 = 0xFF1, + snd_se_Sheik_010 = 0xFF2, + snd_se_Sheik_011 = 0xFF3, + snd_se_Sheik_012 = 0xFF4, + snd_se_Sheik_013 = 0xFF5, + snd_se_Sheik_014 = 0xFF6, + snd_se_Sheik_015 = 0xFF7, + snd_se_Sheik_016 = 0xFF8, + snd_se_Sheik_017 = 0xFF9, + snd_se_Sheik_018 = 0xFFA, + snd_se_Sheik_019 = 0xFFB, + snd_se_Sheik_020 = 0xFFC, + snd_se_Sheik_046 = 0xFFD, + snd_se_Sheik_047 = 0xFFE, + snd_se_Sheik_048 = 0xFFF, + snd_se_Sheik_049 = 0x1000, + snd_se_Sheik_050 = 0x1001, + snd_se_Sheik_Attack_l = 0x1002, + snd_se_Sheik_Attack_ll = 0x1003, + snd_se_Sheik_Attack_m = 0x1004, + snd_se_Sheik_Attack_s = 0x1005, + snd_se_Sheik_Attack100 = 0x1006, + snd_se_Sheik_BodyPress01 = 0x1007, + snd_se_Sheik_BodyPress02 = 0x1008, + snd_se_Sheik_dash_start = 0x1009, + snd_se_Sheik_dash_stop = 0x100A, + snd_se_Sheik_down01 = 0x100B, + snd_se_Sheik_down02 = 0x100C, + snd_se_Sheik_Final01 = 0x100D, + snd_se_Sheik_Final02 = 0x100E, + snd_se_Sheik_Final03 = 0x100F, + snd_se_Sheik_Final04 = 0x1010, + snd_se_Sheik_Final05 = 0x1011, + snd_se_Sheik_jump01 = 0x1012, + snd_se_Sheik_jump02 = 0x1013, + snd_se_Sheik_Landing01 = 0x1014, + snd_se_Sheik_Landing02 = 0x1015, + snd_se_Sheik_smash_H01 = 0x1016, + snd_se_Sheik_smash_H02 = 0x1017, + snd_se_Sheik_smash_H03 = 0x1018, + snd_se_Sheik_smash_H04 = 0x1019, + snd_se_Sheik_smash_H05 = 0x101A, + snd_se_Sheik_smash_L01 = 0x101B, + snd_se_Sheik_smash_L02 = 0x101C, + snd_se_Sheik_smash_L03 = 0x101D, + snd_se_Sheik_smash_L04 = 0x101E, + snd_se_Sheik_smash_L05 = 0x101F, + snd_se_Sheik_smash_S01 = 0x1020, + snd_se_Sheik_smash_S02 = 0x1021, + snd_se_Sheik_smash_S03 = 0x1022, + snd_se_Sheik_smash_S04 = 0x1023, + snd_se_Sheik_smash_S05 = 0x1024, + snd_se_Sheik_Special_H01 = 0x1025, + snd_se_Sheik_Special_H02 = 0x1026, + snd_se_Sheik_Special_H03 = 0x1027, + snd_se_Sheik_Special_H04 = 0x1028, + snd_se_Sheik_Special_H05 = 0x1029, + snd_se_Sheik_Special_L01 = 0x102A, + snd_se_Sheik_Special_L02 = 0x102B, + snd_se_Sheik_Special_L03 = 0x102C, + snd_se_Sheik_Special_L04 = 0x102D, + snd_se_Sheik_Special_L05 = 0x102E, + snd_se_Sheik_Special_N01 = 0x102F, + snd_se_Sheik_Special_N02 = 0x1030, + snd_se_Sheik_Special_N03 = 0x1031, + snd_se_Sheik_Special_N04 = 0x1032, + snd_se_Sheik_Special_N05 = 0x1033, + snd_se_Sheik_Special_S01 = 0x1034, + snd_se_Sheik_Special_S02 = 0x1035, + snd_se_Sheik_Special_S03 = 0x1036, + snd_se_Sheik_Special_S04 = 0x1037, + snd_se_Sheik_Special_S05 = 0x1038, + snd_se_Sheik_squat = 0x1039, + snd_se_Sheik_step_hidari_m = 0x103A, + snd_se_Sheik_step_hidari_s = 0x103B, + snd_se_Sheik_step_migi_m = 0x103C, + snd_se_Sheik_step_migi_s = 0x103D, + snd_se_Sheik_swing_l = 0x103E, + snd_se_Sheik_swing_ll = 0x103F, + snd_se_Sheik_swing_m = 0x1040, + snd_se_Sheik_swing_s = 0x1041, + snd_se_Sheik_turn = 0x1042, + snd_se_Sheik_turn_run = 0x1043, + snd_se_Sheik_ukemi = 0x1044, + snd_se_Sheik_Wait1 = 0x1045, + snd_se_Sheik_Wait2 = 0x1046, + snd_se_Sheik_Wait3 = 0x1047, + snd_se_Sheik_wear = 0x1048, + snd_se_popo_001 = 0x1049, + snd_se_popo_002 = 0x104A, + snd_se_popo_003 = 0x104B, + snd_se_popo_004 = 0x104C, + snd_se_popo_005 = 0x104D, + snd_se_popo_006 = 0x104E, + snd_se_popo_007 = 0x104F, + snd_se_popo_008 = 0x1050, + snd_se_popo_009 = 0x1051, + snd_se_popo_010 = 0x1052, + snd_se_popo_011 = 0x1053, + snd_se_popo_012 = 0x1054, + snd_se_popo_013 = 0x1055, + snd_se_popo_014 = 0x1056, + snd_se_popo_015 = 0x1057, + snd_se_popo_016 = 0x1058, + snd_se_popo_017 = 0x1059, + snd_se_popo_018 = 0x105A, + snd_se_popo_019 = 0x105B, + snd_se_popo_020 = 0x105C, + snd_se_popo_021 = 0x105D, + snd_se_popo_046 = 0x105E, + snd_se_popo_047 = 0x105F, + snd_se_popo_048 = 0x1060, + snd_se_popo_049 = 0x1061, + snd_se_popo_050 = 0x1062, + snd_se_popo_Attack_l = 0x1063, + snd_se_popo_Attack_ll = 0x1064, + snd_se_popo_Attack_m = 0x1065, + snd_se_popo_Attack_s = 0x1066, + snd_se_popo_Attack100 = 0x1067, + snd_se_popo_BodyPress01 = 0x1068, + snd_se_popo_BodyPress02 = 0x1069, + snd_se_popo_dash_start = 0x106A, + snd_se_popo_dash_stop = 0x106B, + snd_se_popo_down01 = 0x106C, + snd_se_popo_down02 = 0x106D, + snd_se_popo_Final01 = 0x106E, + snd_se_popo_Final02 = 0x106F, + snd_se_popo_Final03 = 0x1070, + snd_se_popo_Final04 = 0x1071, + snd_se_popo_Final05 = 0x1072, + snd_se_popo_jump01 = 0x1073, + snd_se_popo_jump02 = 0x1074, + snd_se_popo_Landing01 = 0x1075, + snd_se_popo_Landing02 = 0x1076, + snd_se_popo_smash_H01 = 0x1077, + snd_se_popo_smash_H02 = 0x1078, + snd_se_popo_smash_H03 = 0x1079, + snd_se_popo_smash_H04 = 0x107A, + snd_se_popo_smash_H05 = 0x107B, + snd_se_popo_smash_L01 = 0x107C, + snd_se_popo_smash_L02 = 0x107D, + snd_se_popo_smash_L03 = 0x107E, + snd_se_popo_smash_L04 = 0x107F, + snd_se_popo_smash_L05 = 0x1080, + snd_se_popo_smash_S01 = 0x1081, + snd_se_popo_smash_S02 = 0x1082, + snd_se_popo_smash_S03 = 0x1083, + snd_se_popo_smash_S04 = 0x1084, + snd_se_popo_smash_S05 = 0x1085, + snd_se_popo_Special_H01 = 0x1086, + snd_se_popo_Special_H02 = 0x1087, + snd_se_popo_Special_H03 = 0x1088, + snd_se_popo_Special_H04 = 0x1089, + snd_se_popo_Special_H05 = 0x108A, + snd_se_popo_Special_L01 = 0x108B, + snd_se_popo_Special_L02 = 0x108C, + snd_se_popo_Special_L03 = 0x108D, + snd_se_popo_Special_L04 = 0x108E, + snd_se_popo_Special_L05 = 0x108F, + snd_se_popo_Special_N01 = 0x1090, + snd_se_popo_Special_N02 = 0x1091, + snd_se_popo_Special_N03 = 0x1092, + snd_se_popo_Special_N04 = 0x1093, + snd_se_popo_Special_N05 = 0x1094, + snd_se_popo_Special_S01 = 0x1095, + snd_se_popo_Special_S02 = 0x1096, + snd_se_popo_Special_S03 = 0x1097, + snd_se_popo_Special_S04 = 0x1098, + snd_se_popo_Special_S05 = 0x1099, + snd_se_popo_squat = 0x109A, + snd_se_popo_step_hidari_m = 0x109B, + snd_se_popo_step_hidari_s = 0x109C, + snd_se_popo_step_migi_m = 0x109D, + snd_se_popo_step_migi_s = 0x109E, + snd_se_popo_swing_l = 0x109F, + snd_se_popo_swing_ll = 0x10A0, + snd_se_popo_swing_m = 0x10A1, + snd_se_popo_swing_s = 0x10A2, + snd_se_popo_turn = 0x10A3, + snd_se_popo_turn_run = 0x10A4, + snd_se_popo_ukemi = 0x10A5, + snd_se_popo_Wait1 = 0x10A6, + snd_se_popo_Wait2 = 0x10A7, + snd_se_popo_Wait3 = 0x10A8, + snd_se_popo_wear = 0x10A9, + snd_se_nana_001 = 0x10AA, + snd_se_nana_002 = 0x10AB, + snd_se_nana_003 = 0x10AC, + snd_se_nana_004 = 0x10AD, + snd_se_nana_005 = 0x10AE, + snd_se_nana_006 = 0x10AF, + snd_se_nana_007 = 0x10B0, + snd_se_nana_008 = 0x10B1, + snd_se_nana_009 = 0x10B2, + snd_se_nana_010 = 0x10B3, + snd_se_nana_011 = 0x10B4, + snd_se_nana_012 = 0x10B5, + snd_se_nana_013 = 0x10B6, + snd_se_nana_014 = 0x10B7, + snd_se_nana_015 = 0x10B8, + snd_se_nana_016 = 0x10B9, + snd_se_nana_017 = 0x10BA, + snd_se_nana_018 = 0x10BB, + snd_se_nana_019 = 0x10BC, + snd_se_nana_020 = 0x10BD, + snd_se_nana_021 = 0x10BE, + snd_se_nana_022 = 0x10BF, + snd_se_nana_046 = 0x10C0, + snd_se_nana_047 = 0x10C1, + snd_se_nana_048 = 0x10C2, + snd_se_nana_049 = 0x10C3, + snd_se_nana_050 = 0x10C4, + snd_se_nana_Attack_l = 0x10C5, + snd_se_nana_Attack_ll = 0x10C6, + snd_se_nana_Attack_m = 0x10C7, + snd_se_nana_Attack_s = 0x10C8, + snd_se_nana_Attack100 = 0x10C9, + snd_se_nana_BodyPress01 = 0x10CA, + snd_se_nana_BodyPress02 = 0x10CB, + snd_se_nana_dash_start = 0x10CC, + snd_se_nana_dash_stop = 0x10CD, + snd_se_nana_down01 = 0x10CE, + snd_se_nana_down02 = 0x10CF, + snd_se_nana_Final01 = 0x10D0, + snd_se_nana_Final02 = 0x10D1, + snd_se_nana_Final03 = 0x10D2, + snd_se_nana_Final04 = 0x10D3, + snd_se_nana_Final05 = 0x10D4, + snd_se_nana_jump01 = 0x10D5, + snd_se_nana_jump02 = 0x10D6, + snd_se_nana_Landing01 = 0x10D7, + snd_se_nana_Landing02 = 0x10D8, + snd_se_nana_smash_H01 = 0x10D9, + snd_se_nana_smash_H02 = 0x10DA, + snd_se_nana_smash_H03 = 0x10DB, + snd_se_nana_smash_H04 = 0x10DC, + snd_se_nana_smash_H05 = 0x10DD, + snd_se_nana_smash_L01 = 0x10DE, + snd_se_nana_smash_L02 = 0x10DF, + snd_se_nana_smash_L03 = 0x10E0, + snd_se_nana_smash_L04 = 0x10E1, + snd_se_nana_smash_L05 = 0x10E2, + snd_se_nana_smash_S01 = 0x10E3, + snd_se_nana_smash_S02 = 0x10E4, + snd_se_nana_smash_S03 = 0x10E5, + snd_se_nana_smash_S04 = 0x10E6, + snd_se_nana_smash_S05 = 0x10E7, + snd_se_nana_Special_H01 = 0x10E8, + snd_se_nana_Special_H02 = 0x10E9, + snd_se_nana_Special_H03 = 0x10EA, + snd_se_nana_Special_H04 = 0x10EB, + snd_se_nana_Special_H05 = 0x10EC, + snd_se_nana_Special_L01 = 0x10ED, + snd_se_nana_Special_L02 = 0x10EE, + snd_se_nana_Special_L03 = 0x10EF, + snd_se_nana_Special_L04 = 0x10F0, + snd_se_nana_Special_L05 = 0x10F1, + snd_se_nana_Special_N01 = 0x10F2, + snd_se_nana_Special_N02 = 0x10F3, + snd_se_nana_Special_N03 = 0x10F4, + snd_se_nana_Special_N04 = 0x10F5, + snd_se_nana_Special_N05 = 0x10F6, + snd_se_nana_Special_S01 = 0x10F7, + snd_se_nana_Special_S02 = 0x10F8, + snd_se_nana_Special_S03 = 0x10F9, + snd_se_nana_Special_S04 = 0x10FA, + snd_se_nana_Special_S05 = 0x10FB, + snd_se_nana_squat = 0x10FC, + snd_se_nana_step_hidari_m = 0x10FD, + snd_se_nana_step_hidari_s = 0x10FE, + snd_se_nana_step_migi_m = 0x10FF, + snd_se_nana_step_migi_s = 0x1100, + snd_se_nana_swing_l = 0x1101, + snd_se_nana_swing_ll = 0x1102, + snd_se_nana_swing_m = 0x1103, + snd_se_nana_swing_s = 0x1104, + snd_se_nana_turn = 0x1105, + snd_se_nana_turn_run = 0x1106, + snd_se_nana_ukemi = 0x1107, + snd_se_nana_Wait1 = 0x1108, + snd_se_nana_Wait2 = 0x1109, + snd_se_nana_Wait3 = 0x110A, + snd_se_nana_wear = 0x110B, + snd_se_Marth_001 = 0x110C, + snd_se_Marth_002 = 0x110D, + snd_se_Marth_003 = 0x110E, + snd_se_Marth_004 = 0x110F, + snd_se_Marth_005 = 0x1110, + snd_se_Marth_006 = 0x1111, + snd_se_Marth_007 = 0x1112, + snd_se_Marth_008 = 0x1113, + snd_se_Marth_009 = 0x1114, + snd_se_Marth_010 = 0x1115, + snd_se_Marth_011 = 0x1116, + snd_se_Marth_012 = 0x1117, + snd_se_Marth_046 = 0x1118, + snd_se_Marth_047 = 0x1119, + snd_se_Marth_048 = 0x111A, + snd_se_Marth_049 = 0x111B, + snd_se_Marth_050 = 0x111C, + snd_se_Marth_Attack_l = 0x111D, + snd_se_Marth_Attack_ll = 0x111E, + snd_se_Marth_Attack_m = 0x111F, + snd_se_Marth_Attack_s = 0x1120, + snd_se_Marth_Attack100 = 0x1121, + snd_se_Marth_BodyPress01 = 0x1122, + snd_se_Marth_BodyPress02 = 0x1123, + snd_se_Marth_dash_start = 0x1124, + snd_se_Marth_dash_stop = 0x1125, + snd_se_Marth_down01 = 0x1126, + snd_se_Marth_down02 = 0x1127, + snd_se_Marth_Final01 = 0x1128, + snd_se_Marth_Final02 = 0x1129, + snd_se_Marth_Final03 = 0x112A, + snd_se_Marth_Final04 = 0x112B, + snd_se_Marth_Final05 = 0x112C, + snd_se_Marth_jump01 = 0x112D, + snd_se_Marth_jump02 = 0x112E, + snd_se_Marth_Landing01 = 0x112F, + snd_se_Marth_Landing02 = 0x1130, + snd_se_Marth_smash_H01 = 0x1131, + snd_se_Marth_smash_H02 = 0x1132, + snd_se_Marth_smash_H03 = 0x1133, + snd_se_Marth_smash_H04 = 0x1134, + snd_se_Marth_smash_H05 = 0x1135, + snd_se_Marth_smash_L01 = 0x1136, + snd_se_Marth_smash_L02 = 0x1137, + snd_se_Marth_smash_L03 = 0x1138, + snd_se_Marth_smash_L04 = 0x1139, + snd_se_Marth_smash_L05 = 0x113A, + snd_se_Marth_smash_S01 = 0x113B, + snd_se_Marth_smash_S02 = 0x113C, + snd_se_Marth_smash_S03 = 0x113D, + snd_se_Marth_smash_S04 = 0x113E, + snd_se_Marth_smash_S05 = 0x113F, + snd_se_Marth_Special_H01 = 0x1140, + snd_se_Marth_Special_H02 = 0x1141, + snd_se_Marth_Special_H03 = 0x1142, + snd_se_Marth_Special_H04 = 0x1143, + snd_se_Marth_Special_H05 = 0x1144, + snd_se_Marth_Special_L01 = 0x1145, + snd_se_Marth_Special_L02 = 0x1146, + snd_se_Marth_Special_L03 = 0x1147, + snd_se_Marth_Special_L04 = 0x1148, + snd_se_Marth_Special_L05 = 0x1149, + snd_se_Marth_Special_N01 = 0x114A, + snd_se_Marth_Special_N02 = 0x114B, + snd_se_Marth_Special_N03 = 0x114C, + snd_se_Marth_Special_N04 = 0x114D, + snd_se_Marth_Special_N05 = 0x114E, + snd_se_Marth_Special_S01 = 0x114F, + snd_se_Marth_Special_S02 = 0x1150, + snd_se_Marth_Special_S03 = 0x1151, + snd_se_Marth_Special_S04 = 0x1152, + snd_se_Marth_Special_S05 = 0x1153, + snd_se_Marth_squat = 0x1154, + snd_se_Marth_step_hidari_m = 0x1155, + snd_se_Marth_step_hidari_s = 0x1156, + snd_se_Marth_step_migi_m = 0x1157, + snd_se_Marth_step_migi_s = 0x1158, + snd_se_Marth_swing_l = 0x1159, + snd_se_Marth_swing_ll = 0x115A, + snd_se_Marth_swing_m = 0x115B, + snd_se_Marth_swing_s = 0x115C, + snd_se_Marth_turn = 0x115D, + snd_se_Marth_turn_run = 0x115E, + snd_se_Marth_ukemi = 0x115F, + snd_se_Marth_Wait1 = 0x1160, + snd_se_Marth_Wait2 = 0x1161, + snd_se_Marth_Wait3 = 0x1162, + snd_se_Marth_wear = 0x1163, + snd_se_GW_001 = 0x1164, + snd_se_GW_002 = 0x1165, + snd_se_GW_003 = 0x1166, + snd_se_GW_004 = 0x1167, + snd_se_GW_005 = 0x1168, + snd_se_GW_006 = 0x1169, + snd_se_GW_007 = 0x116A, + snd_se_GW_008 = 0x116B, + snd_se_GW_009 = 0x116C, + snd_se_GW_010 = 0x116D, + snd_se_GW_011 = 0x116E, + snd_se_GW_012 = 0x116F, + snd_se_GW_013 = 0x1170, + snd_se_GW_014 = 0x1171, + snd_se_GW_015 = 0x1172, + snd_se_GW_016 = 0x1173, + snd_se_GW_017 = 0x1174, + snd_se_GW_018 = 0x1175, + snd_se_GW_019 = 0x1176, + snd_se_GW_020 = 0x1177, + snd_se_GW_021 = 0x1178, + snd_se_GW_022 = 0x1179, + snd_se_GW_023 = 0x117A, + snd_se_GW_024 = 0x117B, + snd_se_GW_025 = 0x117C, + snd_se_GW_026 = 0x117D, + snd_se_GW_027 = 0x117E, + snd_se_GW_028 = 0x117F, + snd_se_GW_029 = 0x1180, + snd_se_GW_030 = 0x1181, + snd_se_GW_031 = 0x1182, + snd_se_GW_032 = 0x1183, + snd_se_GW_033 = 0x1184, + snd_se_GW_034 = 0x1185, + snd_se_GW_035 = 0x1186, + snd_se_GW_036 = 0x1187, + snd_se_GW_037 = 0x1188, + snd_se_GW_038 = 0x1189, + snd_se_GW_039 = 0x118A, + snd_se_GW_040 = 0x118B, + snd_se_GW_041 = 0x118C, + snd_se_GW_042 = 0x118D, + snd_se_GW_043 = 0x118E, + snd_se_GW_044 = 0x118F, + snd_se_GW_045 = 0x1190, + snd_se_GW_046 = 0x1191, + snd_se_GW_047 = 0x1192, + snd_se_GW_048 = 0x1193, + snd_se_GW_049 = 0x1194, + snd_se_GW_050 = 0x1195, + snd_se_GW_Attack_l = 0x1196, + snd_se_GW_Attack_ll = 0x1197, + snd_se_GW_Attack_m = 0x1198, + snd_se_GW_Attack_s = 0x1199, + snd_se_GW_Attack100 = 0x119A, + snd_se_GW_BodyPress01 = 0x119B, + snd_se_GW_BodyPress02 = 0x119C, + snd_se_GW_dash_start = 0x119D, + snd_se_GW_dash_stop = 0x119E, + snd_se_GW_down01 = 0x119F, + snd_se_GW_down02 = 0x11A0, + snd_se_GW_Final01 = 0x11A1, + snd_se_GW_Final02 = 0x11A2, + snd_se_GW_Final03 = 0x11A3, + snd_se_GW_Final04 = 0x11A4, + snd_se_GW_Final05 = 0x11A5, + snd_se_GW_jump01 = 0x11A6, + snd_se_GW_jump02 = 0x11A7, + snd_se_GW_Landing01 = 0x11A8, + snd_se_GW_Landing02 = 0x11A9, + snd_se_GW_smash_H01 = 0x11AA, + snd_se_GW_smash_H02 = 0x11AB, + snd_se_GW_smash_H03 = 0x11AC, + snd_se_GW_smash_H04 = 0x11AD, + snd_se_GW_smash_H05 = 0x11AE, + snd_se_GW_smash_L01 = 0x11AF, + snd_se_GW_smash_L02 = 0x11B0, + snd_se_GW_smash_L03 = 0x11B1, + snd_se_GW_smash_L04 = 0x11B2, + snd_se_GW_smash_L05 = 0x11B3, + snd_se_GW_smash_S01 = 0x11B4, + snd_se_GW_smash_S02 = 0x11B5, + snd_se_GW_smash_S03 = 0x11B6, + snd_se_GW_smash_S04 = 0x11B7, + snd_se_GW_smash_S05 = 0x11B8, + snd_se_GW_Special_H01 = 0x11B9, + snd_se_GW_Special_H02 = 0x11BA, + snd_se_GW_Special_H03 = 0x11BB, + snd_se_GW_Special_H04 = 0x11BC, + snd_se_GW_Special_H05 = 0x11BD, + snd_se_GW_Special_L01 = 0x11BE, + snd_se_GW_Special_L02 = 0x11BF, + snd_se_GW_Special_L03 = 0x11C0, + snd_se_GW_Special_L04 = 0x11C1, + snd_se_GW_Special_L05 = 0x11C2, + snd_se_GW_Special_N01 = 0x11C3, + snd_se_GW_Special_N02 = 0x11C4, + snd_se_GW_Special_N03 = 0x11C5, + snd_se_GW_Special_N04 = 0x11C6, + snd_se_GW_Special_N05 = 0x11C7, + snd_se_GW_Special_S01 = 0x11C8, + snd_se_GW_Special_S02 = 0x11C9, + snd_se_GW_Special_S03 = 0x11CA, + snd_se_GW_Special_S04 = 0x11CB, + snd_se_GW_Special_S05 = 0x11CC, + snd_se_GW_squat = 0x11CD, + snd_se_GW_step_hidari_m = 0x11CE, + snd_se_GW_step_hidari_s = 0x11CF, + snd_se_GW_step_migi_m = 0x11D0, + snd_se_GW_step_migi_s = 0x11D1, + snd_se_GW_swing_l = 0x11D2, + snd_se_GW_swing_ll = 0x11D3, + snd_se_GW_swing_m = 0x11D4, + snd_se_GW_swing_s = 0x11D5, + snd_se_GW_turn = 0x11D6, + snd_se_GW_turn_run = 0x11D7, + snd_se_GW_ukemi = 0x11D8, + snd_se_GW_Wait1 = 0x11D9, + snd_se_GW_Wait2 = 0x11DA, + snd_se_GW_Wait3 = 0x11DB, + snd_se_GW_wear = 0x11DC, + snd_se_Falco_001 = 0x11DD, + snd_se_Falco_002 = 0x11DE, + snd_se_Falco_003 = 0x11DF, + snd_se_Falco_004 = 0x11E0, + snd_se_Falco_005 = 0x11E1, + snd_se_Falco_006 = 0x11E2, + snd_se_Falco_007 = 0x11E3, + snd_se_Falco_008 = 0x11E4, + snd_se_Falco_009 = 0x11E5, + snd_se_Falco_010 = 0x11E6, + snd_se_Falco_011 = 0x11E7, + snd_se_Falco_012 = 0x11E8, + snd_se_Falco_013 = 0x11E9, + snd_se_Falco_014 = 0x11EA, + snd_se_Falco_015 = 0x11EB, + snd_se_Falco_016 = 0x11EC, + snd_se_Falco_017 = 0x11ED, + snd_se_Falco_018 = 0x11EE, + snd_se_Falco_019 = 0x11EF, + snd_se_Falco_020 = 0x11F0, + snd_se_Falco_021 = 0x11F1, + snd_se_Falco_022 = 0x11F2, + snd_se_Falco_023 = 0x11F3, + snd_se_Falco_024 = 0x11F4, + snd_se_Falco_025 = 0x11F5, + snd_se_Falco_026 = 0x11F6, + snd_se_Falco_027 = 0x11F7, + snd_se_Falco_028 = 0x11F8, + snd_se_Falco_029 = 0x11F9, + snd_se_Falco_030 = 0x11FA, + snd_se_Falco_031 = 0x11FB, + snd_se_Falco_032 = 0x11FC, + snd_se_Falco_033 = 0x11FD, + snd_se_Falco_034 = 0x11FE, + snd_se_Falco_035 = 0x11FF, + snd_se_Falco_036 = 0x1200, + snd_se_Falco_037 = 0x1201, + snd_se_Falco_038 = 0x1202, + snd_se_Falco_039 = 0x1203, + snd_se_Falco_040 = 0x1204, + snd_se_Falco_041 = 0x1205, + snd_se_Falco_042 = 0x1206, + snd_se_Falco_043 = 0x1207, + snd_se_Falco_044 = 0x1208, + snd_se_Falco_045 = 0x1209, + snd_se_Falco_046 = 0x120A, + snd_se_Falco_047 = 0x120B, + snd_se_Falco_048 = 0x120C, + snd_se_Falco_049 = 0x120D, + snd_se_Falco_050 = 0x120E, + snd_se_Falco_Attack_l = 0x120F, + snd_se_Falco_Attack_ll = 0x1210, + snd_se_Falco_Attack_m = 0x1211, + snd_se_Falco_Attack_s = 0x1212, + snd_se_Falco_Attack100 = 0x1213, + snd_se_Falco_BodyPress01 = 0x1214, + snd_se_Falco_BodyPress02 = 0x1215, + snd_se_Falco_dash_start = 0x1216, + snd_se_Falco_dash_stop = 0x1217, + snd_se_Falco_down01 = 0x1218, + snd_se_Falco_down02 = 0x1219, + snd_se_Falco_Final01 = 0x121A, + snd_se_Falco_Final02 = 0x121B, + snd_se_Falco_Final03 = 0x121C, + snd_se_Falco_Final04 = 0x121D, + snd_se_Falco_Final05 = 0x121E, + snd_se_Falco_jump01 = 0x121F, + snd_se_Falco_jump02 = 0x1220, + snd_se_Falco_Landing01 = 0x1221, + snd_se_Falco_Landing02 = 0x1222, + snd_se_Falco_smash_H01 = 0x1223, + snd_se_Falco_smash_H02 = 0x1224, + snd_se_Falco_smash_H03 = 0x1225, + snd_se_Falco_smash_H04 = 0x1226, + snd_se_Falco_smash_H05 = 0x1227, + snd_se_Falco_smash_L01 = 0x1228, + snd_se_Falco_smash_L02 = 0x1229, + snd_se_Falco_smash_L03 = 0x122A, + snd_se_Falco_smash_L04 = 0x122B, + snd_se_Falco_smash_L05 = 0x122C, + snd_se_Falco_smash_S01 = 0x122D, + snd_se_Falco_smash_S02 = 0x122E, + snd_se_Falco_smash_S03 = 0x122F, + snd_se_Falco_smash_S04 = 0x1230, + snd_se_Falco_smash_S05 = 0x1231, + snd_se_Falco_Special_H01 = 0x1232, + snd_se_Falco_Special_H02 = 0x1233, + snd_se_Falco_Special_H03 = 0x1234, + snd_se_Falco_Special_H04 = 0x1235, + snd_se_Falco_Special_H05 = 0x1236, + snd_se_Falco_Special_L01 = 0x1237, + snd_se_Falco_Special_L02 = 0x1238, + snd_se_Falco_Special_L03 = 0x1239, + snd_se_Falco_Special_L04 = 0x123A, + snd_se_Falco_Special_L05 = 0x123B, + snd_se_Falco_Special_N01 = 0x123C, + snd_se_Falco_Special_N02 = 0x123D, + snd_se_Falco_Special_N03 = 0x123E, + snd_se_Falco_Special_N04 = 0x123F, + snd_se_Falco_Special_N05 = 0x1240, + snd_se_Falco_Special_S01 = 0x1241, + snd_se_Falco_Special_S02 = 0x1242, + snd_se_Falco_Special_S03 = 0x1243, + snd_se_Falco_Special_S04 = 0x1244, + snd_se_Falco_Special_S05 = 0x1245, + snd_se_Falco_squat = 0x1246, + snd_se_Falco_step_hidari_m = 0x1247, + snd_se_Falco_step_hidari_s = 0x1248, + snd_se_Falco_step_migi_m = 0x1249, + snd_se_Falco_step_migi_s = 0x124A, + snd_se_Falco_swing_l = 0x124B, + snd_se_Falco_swing_ll = 0x124C, + snd_se_Falco_swing_m = 0x124D, + snd_se_Falco_swing_s = 0x124E, + snd_se_Falco_turn = 0x124F, + snd_se_Falco_turn_run = 0x1250, + snd_se_Falco_ukemi = 0x1251, + snd_se_Falco_Wait1 = 0x1252, + snd_se_Falco_Wait2 = 0x1253, + snd_se_Falco_Wait3 = 0x1254, + snd_se_Falco_wear = 0x1255, + snd_se_Ganondorf_001 = 0x1256, + snd_se_Ganondorf_002 = 0x1257, + snd_se_Ganondorf_003 = 0x1258, + snd_se_Ganondorf_004 = 0x1259, + snd_se_Ganondorf_005 = 0x125A, + snd_se_Ganondorf_006 = 0x125B, + snd_se_Ganondorf_007 = 0x125C, + snd_se_Ganondorf_008 = 0x125D, + snd_se_Ganondorf_009 = 0x125E, + snd_se_Ganondorf_010 = 0x125F, + snd_se_Ganondorf_011 = 0x1260, + snd_se_Ganondorf_012 = 0x1261, + snd_se_Ganondorf_046 = 0x1262, + snd_se_Ganondorf_047 = 0x1263, + snd_se_Ganondorf_048 = 0x1264, + snd_se_Ganondorf_049 = 0x1265, + snd_se_Ganondorf_050 = 0x1266, + snd_se_Ganondorf_Attack_l = 0x1267, + snd_se_Ganondorf_Attack_ll = 0x1268, + snd_se_Ganondorf_Attack_m = 0x1269, + snd_se_Ganondorf_Attack_s = 0x126A, + snd_se_Ganondorf_Attack100 = 0x126B, + snd_se_Ganondorf_BodyPress01 = 0x126C, + snd_se_Ganondorf_BodyPress02 = 0x126D, + snd_se_Ganondorf_dash_start = 0x126E, + snd_se_Ganondorf_dash_stop = 0x126F, + snd_se_Ganondorf_down01 = 0x1270, + snd_se_Ganondorf_down02 = 0x1271, + snd_se_Ganondorf_Final01 = 0x1272, + snd_se_Ganondorf_Final02 = 0x1273, + snd_se_Ganondorf_Final03 = 0x1274, + snd_se_Ganondorf_Final04 = 0x1275, + snd_se_Ganondorf_Final05 = 0x1276, + snd_se_Ganondorf_jump01 = 0x1277, + snd_se_Ganondorf_jump02 = 0x1278, + snd_se_Ganondorf_Landing01 = 0x1279, + snd_se_Ganondorf_Landing02 = 0x127A, + snd_se_Ganondorf_smash_H01 = 0x127B, + snd_se_Ganondorf_smash_H02 = 0x127C, + snd_se_Ganondorf_smash_H03 = 0x127D, + snd_se_Ganondorf_smash_H04 = 0x127E, + snd_se_Ganondorf_smash_H05 = 0x127F, + snd_se_Ganondorf_smash_L01 = 0x1280, + snd_se_Ganondorf_smash_L02 = 0x1281, + snd_se_Ganondorf_smash_L03 = 0x1282, + snd_se_Ganondorf_smash_L04 = 0x1283, + snd_se_Ganondorf_smash_L05 = 0x1284, + snd_se_Ganondorf_smash_S01 = 0x1285, + snd_se_Ganondorf_smash_S02 = 0x1286, + snd_se_Ganondorf_smash_S03 = 0x1287, + snd_se_Ganondorf_smash_S04 = 0x1288, + snd_se_Ganondorf_smash_S05 = 0x1289, + snd_se_Ganondorf_Special_H01 = 0x128A, + snd_se_Ganondorf_Special_H02 = 0x128B, + snd_se_Ganondorf_Special_H03 = 0x128C, + snd_se_Ganondorf_Special_H04 = 0x128D, + snd_se_Ganondorf_Special_H05 = 0x128E, + snd_se_Ganondorf_Special_L01 = 0x128F, + snd_se_Ganondorf_Special_L02 = 0x1290, + snd_se_Ganondorf_Special_L03 = 0x1291, + snd_se_Ganondorf_Special_L04 = 0x1292, + snd_se_Ganondorf_Special_L05 = 0x1293, + snd_se_Ganondorf_Special_N01 = 0x1294, + snd_se_Ganondorf_Special_N02 = 0x1295, + snd_se_Ganondorf_Special_N03 = 0x1296, + snd_se_Ganondorf_Special_N04 = 0x1297, + snd_se_Ganondorf_Special_N05 = 0x1298, + snd_se_Ganondorf_Special_S01 = 0x1299, + snd_se_Ganondorf_Special_S02 = 0x129A, + snd_se_Ganondorf_Special_S03 = 0x129B, + snd_se_Ganondorf_Special_S04 = 0x129C, + snd_se_Ganondorf_Special_S05 = 0x129D, + snd_se_Ganondorf_squat = 0x129E, + snd_se_Ganondorf_step_hidari_m = 0x129F, + snd_se_Ganondorf_step_hidari_s = 0x12A0, + snd_se_Ganondorf_step_migi_m = 0x12A1, + snd_se_Ganondorf_step_migi_s = 0x12A2, + snd_se_Ganondorf_swing_l = 0x12A3, + snd_se_Ganondorf_swing_ll = 0x12A4, + snd_se_Ganondorf_swing_m = 0x12A5, + snd_se_Ganondorf_swing_s = 0x12A6, + snd_se_Ganondorf_turn = 0x12A7, + snd_se_Ganondorf_turn_run = 0x12A8, + snd_se_Ganondorf_ukemi = 0x12A9, + snd_se_Ganondorf_Wait1 = 0x12AA, + snd_se_Ganondorf_Wait2 = 0x12AB, + snd_se_Ganondorf_Wait3 = 0x12AC, + snd_se_Ganondorf_wear = 0x12AD, + snd_se_Wario_001 = 0x12AE, + snd_se_Wario_002 = 0x12AF, + snd_se_Wario_003 = 0x12B0, + snd_se_Wario_004 = 0x12B1, + snd_se_Wario_005 = 0x12B2, + snd_se_Wario_006 = 0x12B3, + snd_se_Wario_007 = 0x12B4, + snd_se_Wario_008 = 0x12B5, + snd_se_Wario_009 = 0x12B6, + snd_se_Wario_010 = 0x12B7, + snd_se_Wario_011 = 0x12B8, + snd_se_Wario_012 = 0x12B9, + snd_se_Wario_013 = 0x12BA, + snd_se_Wario_014 = 0x12BB, + snd_se_Wario_015 = 0x12BC, + snd_se_Wario_016 = 0x12BD, + snd_se_Wario_017 = 0x12BE, + snd_se_Wario_018 = 0x12BF, + snd_se_Wario_019 = 0x12C0, + snd_se_Wario_020 = 0x12C1, + snd_se_Wario_021 = 0x12C2, + snd_se_Wario_022 = 0x12C3, + snd_se_Wario_023 = 0x12C4, + snd_se_Wario_024 = 0x12C5, + snd_se_Wario_025 = 0x12C6, + snd_se_Wario_026 = 0x12C7, + snd_se_Wario_027 = 0x12C8, + snd_se_Wario_028 = 0x12C9, + snd_se_Wario_029 = 0x12CA, + snd_se_Wario_030 = 0x12CB, + snd_se_Wario_031 = 0x12CC, + snd_se_Wario_032 = 0x12CD, + snd_se_Wario_033 = 0x12CE, + snd_se_Wario_034 = 0x12CF, + snd_se_Wario_035 = 0x12D0, + snd_se_Wario_036 = 0x12D1, + snd_se_Wario_037 = 0x12D2, + snd_se_Wario_038 = 0x12D3, + snd_se_Wario_039 = 0x12D4, + snd_se_Wario_040 = 0x12D5, + snd_se_Wario_041 = 0x12D6, + snd_se_Wario_042 = 0x12D7, + snd_se_Wario_043 = 0x12D8, + snd_se_Wario_044 = 0x12D9, + snd_se_Wario_045 = 0x12DA, + snd_se_Wario_046 = 0x12DB, + snd_se_Wario_047 = 0x12DC, + snd_se_Wario_048 = 0x12DD, + snd_se_Wario_049 = 0x12DE, + snd_se_Wario_050 = 0x12DF, + snd_se_Wario_Attack_l = 0x12E0, + snd_se_Wario_Attack_ll = 0x12E1, + snd_se_Wario_Attack_m = 0x12E2, + snd_se_Wario_Attack_s = 0x12E3, + snd_se_Wario_Attack100 = 0x12E4, + snd_se_Wario_BodyPress01 = 0x12E5, + snd_se_Wario_BodyPress02 = 0x12E6, + snd_se_Wario_dash_start = 0x12E7, + snd_se_Wario_dash_stop = 0x12E8, + snd_se_Wario_down01 = 0x12E9, + snd_se_Wario_down02 = 0x12EA, + snd_se_Wario_Final01 = 0x12EB, + snd_se_Wario_Final02 = 0x12EC, + snd_se_Wario_Final03 = 0x12ED, + snd_se_Wario_Final04 = 0x12EE, + snd_se_Wario_Final05 = 0x12EF, + snd_se_Wario_jump01 = 0x12F0, + snd_se_Wario_jump02 = 0x12F1, + snd_se_Wario_Landing01 = 0x12F2, + snd_se_Wario_Landing02 = 0x12F3, + snd_se_Wario_smash_H01 = 0x12F4, + snd_se_Wario_smash_H02 = 0x12F5, + snd_se_Wario_smash_H03 = 0x12F6, + snd_se_Wario_smash_H04 = 0x12F7, + snd_se_Wario_smash_H05 = 0x12F8, + snd_se_Wario_smash_L01 = 0x12F9, + snd_se_Wario_smash_L02 = 0x12FA, + snd_se_Wario_smash_L03 = 0x12FB, + snd_se_Wario_smash_L04 = 0x12FC, + snd_se_Wario_smash_L05 = 0x12FD, + snd_se_Wario_smash_S01 = 0x12FE, + snd_se_Wario_smash_S02 = 0x12FF, + snd_se_Wario_smash_S03 = 0x1300, + snd_se_Wario_smash_S04 = 0x1301, + snd_se_Wario_smash_S05 = 0x1302, + snd_se_Wario_Special_H01 = 0x1303, + snd_se_Wario_Special_H02 = 0x1304, + snd_se_Wario_Special_H03 = 0x1305, + snd_se_Wario_Special_H04 = 0x1306, + snd_se_Wario_Special_H05 = 0x1307, + snd_se_Wario_Special_L01 = 0x1308, + snd_se_Wario_Special_L02 = 0x1309, + snd_se_Wario_Special_L03 = 0x130A, + snd_se_Wario_Special_L04 = 0x130B, + snd_se_Wario_Special_L05 = 0x130C, + snd_se_Wario_Special_N01 = 0x130D, + snd_se_Wario_Special_N02 = 0x130E, + snd_se_Wario_Special_N03 = 0x130F, + snd_se_Wario_Special_N04 = 0x1310, + snd_se_Wario_Special_N05 = 0x1311, + snd_se_Wario_Special_S01 = 0x1312, + snd_se_Wario_Special_S02 = 0x1313, + snd_se_Wario_Special_S03 = 0x1314, + snd_se_Wario_Special_S04 = 0x1315, + snd_se_Wario_Special_S05 = 0x1316, + snd_se_Wario_squat = 0x1317, + snd_se_Wario_step_hidari_m = 0x1318, + snd_se_Wario_step_hidari_s = 0x1319, + snd_se_Wario_step_migi_m = 0x131A, + snd_se_Wario_step_migi_s = 0x131B, + snd_se_Wario_swing_l = 0x131C, + snd_se_Wario_swing_ll = 0x131D, + snd_se_Wario_swing_m = 0x131E, + snd_se_Wario_swing_s = 0x131F, + snd_se_Wario_turn = 0x1320, + snd_se_Wario_turn_run = 0x1321, + snd_se_Wario_ukemi = 0x1322, + snd_se_Wario_Wait1 = 0x1323, + snd_se_Wario_Wait2 = 0x1324, + snd_se_Wario_Wait3 = 0x1325, + snd_se_Wario_wear = 0x1326, + snd_se_szerosuit_001 = 0x1327, + snd_se_szerosuit_002 = 0x1328, + snd_se_szerosuit_003 = 0x1329, + snd_se_szerosuit_004 = 0x132A, + snd_se_szerosuit_005 = 0x132B, + snd_se_szerosuit_006 = 0x132C, + snd_se_szerosuit_007 = 0x132D, + snd_se_szerosuit_008 = 0x132E, + snd_se_szerosuit_009 = 0x132F, + snd_se_szerosuit_010 = 0x1330, + snd_se_szerosuit_011 = 0x1331, + snd_se_szerosuit_012 = 0x1332, + snd_se_szerosuit_013 = 0x1333, + snd_se_szerosuit_014 = 0x1334, + snd_se_szerosuit_015 = 0x1335, + snd_se_szerosuit_016 = 0x1336, + snd_se_szerosuit_017 = 0x1337, + snd_se_szerosuit_018 = 0x1338, + snd_se_szerosuit_019 = 0x1339, + snd_se_szerosuit_020 = 0x133A, + snd_se_szerosuit_021 = 0x133B, + snd_se_szerosuit_022 = 0x133C, + snd_se_szerosuit_023 = 0x133D, + snd_se_szerosuit_024 = 0x133E, + snd_se_szerosuit_025 = 0x133F, + snd_se_szerosuit_026 = 0x1340, + snd_se_szerosuit_027 = 0x1341, + snd_se_szerosuit_028 = 0x1342, + snd_se_szerosuit_046 = 0x1343, + snd_se_szerosuit_047 = 0x1344, + snd_se_szerosuit_048 = 0x1345, + snd_se_szerosuit_049 = 0x1346, + snd_se_szerosuit_050 = 0x1347, + snd_se_szerosuit_Attack_l = 0x1348, + snd_se_szerosuit_Attack_ll = 0x1349, + snd_se_szerosuit_Attack_m = 0x134A, + snd_se_szerosuit_Attack_s = 0x134B, + snd_se_szerosuit_Attack100 = 0x134C, + snd_se_szerosuit_BodyPress01 = 0x134D, + snd_se_szerosuit_BodyPress02 = 0x134E, + snd_se_szerosuit_dash_start = 0x134F, + snd_se_szerosuit_dash_stop = 0x1350, + snd_se_szerosuit_down01 = 0x1351, + snd_se_szerosuit_down02 = 0x1352, + snd_se_szerosuit_Final01 = 0x1353, + snd_se_szerosuit_Final02 = 0x1354, + snd_se_szerosuit_Final03 = 0x1355, + snd_se_szerosuit_Final04 = 0x1356, + snd_se_szerosuit_Final05 = 0x1357, + snd_se_szerosuit_jump01 = 0x1358, + snd_se_szerosuit_jump02 = 0x1359, + snd_se_szerosuit_Landing01 = 0x135A, + snd_se_szerosuit_Landing02 = 0x135B, + snd_se_szerosuit_smash_H01 = 0x135C, + snd_se_szerosuit_smash_H02 = 0x135D, + snd_se_szerosuit_smash_H03 = 0x135E, + snd_se_szerosuit_smash_H04 = 0x135F, + snd_se_szerosuit_smash_H05 = 0x1360, + snd_se_szerosuit_smash_L01 = 0x1361, + snd_se_szerosuit_smash_L02 = 0x1362, + snd_se_szerosuit_smash_L03 = 0x1363, + snd_se_szerosuit_smash_L04 = 0x1364, + snd_se_szerosuit_smash_L05 = 0x1365, + snd_se_szerosuit_smash_S01 = 0x1366, + snd_se_szerosuit_smash_S02 = 0x1367, + snd_se_szerosuit_smash_S03 = 0x1368, + snd_se_szerosuit_smash_S04 = 0x1369, + snd_se_szerosuit_smash_S05 = 0x136A, + snd_se_szerosuit_Special_H01 = 0x136B, + snd_se_szerosuit_Special_H02 = 0x136C, + snd_se_szerosuit_Special_H03 = 0x136D, + snd_se_szerosuit_Special_H04 = 0x136E, + snd_se_szerosuit_Special_H05 = 0x136F, + snd_se_szerosuit_Special_L01 = 0x1370, + snd_se_szerosuit_Special_L02 = 0x1371, + snd_se_szerosuit_Special_L03 = 0x1372, + snd_se_szerosuit_Special_L04 = 0x1373, + snd_se_szerosuit_Special_L05 = 0x1374, + snd_se_szerosuit_Special_N01 = 0x1375, + snd_se_szerosuit_Special_N02 = 0x1376, + snd_se_szerosuit_Special_N03 = 0x1377, + snd_se_szerosuit_Special_N04 = 0x1378, + snd_se_szerosuit_Special_N05 = 0x1379, + snd_se_szerosuit_Special_S01 = 0x137A, + snd_se_szerosuit_Special_S02 = 0x137B, + snd_se_szerosuit_Special_S03 = 0x137C, + snd_se_szerosuit_Special_S04 = 0x137D, + snd_se_szerosuit_Special_S05 = 0x137E, + snd_se_szerosuit_squat = 0x137F, + snd_se_szerosuit_step_hidari_m = 0x1380, + snd_se_szerosuit_step_hidari_s = 0x1381, + snd_se_szerosuit_step_migi_m = 0x1382, + snd_se_szerosuit_step_migi_s = 0x1383, + snd_se_szerosuit_swing_l = 0x1384, + snd_se_szerosuit_swing_ll = 0x1385, + snd_se_szerosuit_swing_m = 0x1386, + snd_se_szerosuit_swing_s = 0x1387, + snd_se_szerosuit_turn = 0x1388, + snd_se_szerosuit_turn_run = 0x1389, + snd_se_szerosuit_ukemi = 0x138A, + snd_se_szerosuit_Wait1 = 0x138B, + snd_se_szerosuit_Wait2 = 0x138C, + snd_se_szerosuit_Wait3 = 0x138D, + snd_se_szerosuit_wear = 0x138E, + snd_se_szerosuit_A_Wait2_01 = 0x138F, + snd_se_szerosuit_A_Wait2_02 = 0x1390, + snd_se_szerosuit_A_Wait2_03 = 0x1391, + snd_se_pikmin_001 = 0x1392, + snd_se_pikmin_002 = 0x1393, + snd_se_pikmin_003 = 0x1394, + snd_se_pikmin_004 = 0x1395, + snd_se_pikmin_005 = 0x1396, + snd_se_pikmin_006 = 0x1397, + snd_se_pikmin_007 = 0x1398, + snd_se_pikmin_008 = 0x1399, + snd_se_pikmin_009 = 0x139A, + snd_se_pikmin_010 = 0x139B, + snd_se_pikmin_011 = 0x139C, + snd_se_pikmin_012 = 0x139D, + snd_se_pikmin_013 = 0x139E, + snd_se_pikmin_014 = 0x139F, + snd_se_pikmin_015 = 0x13A0, + snd_se_pikmin_016 = 0x13A1, + snd_se_pikmin_017 = 0x13A2, + snd_se_pikmin_018 = 0x13A3, + snd_se_pikmin_019 = 0x13A4, + snd_se_pikmin_020 = 0x13A5, + snd_se_pikmin_021 = 0x13A6, + snd_se_pikmin_022 = 0x13A7, + snd_se_pikmin_023 = 0x13A8, + snd_se_pikmin_024 = 0x13A9, + snd_se_pikmin_025 = 0x13AA, + snd_se_pikmin_026 = 0x13AB, + snd_se_pikmin_027 = 0x13AC, + snd_se_pikmin_028 = 0x13AD, + snd_se_pikmin_029 = 0x13AE, + snd_se_pikmin_030 = 0x13AF, + snd_se_pikmin_031 = 0x13B0, + snd_se_pikmin_032 = 0x13B1, + snd_se_pikmin_033 = 0x13B2, + snd_se_pikmin_034 = 0x13B3, + snd_se_pikmin_035 = 0x13B4, + snd_se_pikmin_036 = 0x13B5, + snd_se_pikmin_037 = 0x13B6, + snd_se_pikmin_038 = 0x13B7, + snd_se_pikmin_039 = 0x13B8, + snd_se_pikmin_040 = 0x13B9, + snd_se_pikmin_041 = 0x13BA, + snd_se_pikmin_042 = 0x13BB, + snd_se_pikmin_043 = 0x13BC, + snd_se_pikmin_044 = 0x13BD, + snd_se_pikmin_045 = 0x13BE, + snd_se_pikmin_046 = 0x13BF, + snd_se_pikmin_047 = 0x13C0, + snd_se_pikmin_048 = 0x13C1, + snd_se_pikmin_049 = 0x13C2, + snd_se_pikmin_050 = 0x13C3, + snd_se_pikmin_Attack_l = 0x13C4, + snd_se_pikmin_Attack_ll = 0x13C5, + snd_se_pikmin_Attack_m = 0x13C6, + snd_se_pikmin_Attack_s = 0x13C7, + snd_se_pikmin_Attack100 = 0x13C8, + snd_se_pikmin_BodyPress01 = 0x13C9, + snd_se_pikmin_BodyPress02 = 0x13CA, + snd_se_pikmin_dash_start = 0x13CB, + snd_se_pikmin_dash_stop = 0x13CC, + snd_se_pikmin_down01 = 0x13CD, + snd_se_pikmin_down02 = 0x13CE, + snd_se_pikmin_Final01 = 0x13CF, + snd_se_pikmin_Final02 = 0x13D0, + snd_se_pikmin_Final03 = 0x13D1, + snd_se_pikmin_Final04 = 0x13D2, + snd_se_pikmin_Final05 = 0x13D3, + snd_se_pikmin_jump01 = 0x13D4, + snd_se_pikmin_jump02 = 0x13D5, + snd_se_pikmin_Landing01 = 0x13D6, + snd_se_pikmin_Landing02 = 0x13D7, + snd_se_pikmin_smash_H01 = 0x13D8, + snd_se_pikmin_smash_H02 = 0x13D9, + snd_se_pikmin_smash_H03 = 0x13DA, + snd_se_pikmin_smash_H04 = 0x13DB, + snd_se_pikmin_smash_H05 = 0x13DC, + snd_se_pikmin_smash_L01 = 0x13DD, + snd_se_pikmin_smash_L02 = 0x13DE, + snd_se_pikmin_smash_L03 = 0x13DF, + snd_se_pikmin_smash_L04 = 0x13E0, + snd_se_pikmin_smash_L05 = 0x13E1, + snd_se_pikmin_smash_S01 = 0x13E2, + snd_se_pikmin_smash_S02 = 0x13E3, + snd_se_pikmin_smash_S03 = 0x13E4, + snd_se_pikmin_smash_S04 = 0x13E5, + snd_se_pikmin_smash_S05 = 0x13E6, + snd_se_pikmin_Special_H01 = 0x13E7, + snd_se_pikmin_Special_H02 = 0x13E8, + snd_se_pikmin_Special_H03 = 0x13E9, + snd_se_pikmin_Special_H04 = 0x13EA, + snd_se_pikmin_Special_H05 = 0x13EB, + snd_se_pikmin_Special_L01 = 0x13EC, + snd_se_pikmin_Special_L02 = 0x13ED, + snd_se_pikmin_Special_L03 = 0x13EE, + snd_se_pikmin_Special_L04 = 0x13EF, + snd_se_pikmin_Special_L05 = 0x13F0, + snd_se_pikmin_Special_N01 = 0x13F1, + snd_se_pikmin_Special_N02 = 0x13F2, + snd_se_pikmin_Special_N03 = 0x13F3, + snd_se_pikmin_Special_N04 = 0x13F4, + snd_se_pikmin_Special_N05 = 0x13F5, + snd_se_pikmin_Special_S01 = 0x13F6, + snd_se_pikmin_Special_S02 = 0x13F7, + snd_se_pikmin_Special_S03 = 0x13F8, + snd_se_pikmin_Special_S04 = 0x13F9, + snd_se_pikmin_Special_S05 = 0x13FA, + snd_se_pikmin_squat = 0x13FB, + snd_se_pikmin_step_hidari_m = 0x13FC, + snd_se_pikmin_step_hidari_s = 0x13FD, + snd_se_pikmin_step_migi_m = 0x13FE, + snd_se_pikmin_step_migi_s = 0x13FF, + snd_se_pikmin_swing_l = 0x1400, + snd_se_pikmin_swing_ll = 0x1401, + snd_se_pikmin_swing_m = 0x1402, + snd_se_pikmin_swing_s = 0x1403, + snd_se_pikmin_turn = 0x1404, + snd_se_pikmin_turn_run = 0x1405, + snd_se_pikmin_ukemi = 0x1406, + snd_se_pikmin_Wait1 = 0x1407, + snd_se_pikmin_Wait2 = 0x1408, + snd_se_pikmin_Wait3 = 0x1409, + snd_se_pikmin_wear = 0x140A, + snd_se_lucas_001 = 0x140B, + snd_se_lucas_002 = 0x140C, + snd_se_lucas_003 = 0x140D, + snd_se_lucas_004 = 0x140E, + snd_se_lucas_005 = 0x140F, + snd_se_lucas_006 = 0x1410, + snd_se_lucas_007 = 0x1411, + snd_se_lucas_008 = 0x1412, + snd_se_lucas_009 = 0x1413, + snd_se_lucas_010 = 0x1414, + snd_se_lucas_011 = 0x1415, + snd_se_lucas_012 = 0x1416, + snd_se_lucas_013 = 0x1417, + snd_se_lucas_014 = 0x1418, + snd_se_lucas_015 = 0x1419, + snd_se_lucas_016 = 0x141A, + snd_se_lucas_017 = 0x141B, + snd_se_lucas_018 = 0x141C, + snd_se_lucas_019 = 0x141D, + snd_se_lucas_020 = 0x141E, + snd_se_lucas_021 = 0x141F, + snd_se_lucas_022 = 0x1420, + snd_se_lucas_023 = 0x1421, + snd_se_lucas_024 = 0x1422, + snd_se_lucas_046 = 0x1423, + snd_se_lucas_047 = 0x1424, + snd_se_lucas_048 = 0x1425, + snd_se_lucas_049 = 0x1426, + snd_se_lucas_050 = 0x1427, + snd_se_lucas_Attack_l = 0x1428, + snd_se_lucas_Attack_ll = 0x1429, + snd_se_lucas_Attack_m = 0x142A, + snd_se_lucas_Attack_s = 0x142B, + snd_se_lucas_Attack100 = 0x142C, + snd_se_lucas_BodyPress01 = 0x142D, + snd_se_lucas_BodyPress02 = 0x142E, + snd_se_lucas_dash_start = 0x142F, + snd_se_lucas_dash_stop = 0x1430, + snd_se_lucas_down01 = 0x1431, + snd_se_lucas_down02 = 0x1432, + snd_se_lucas_Final01 = 0x1433, + snd_se_lucas_Final02 = 0x1434, + snd_se_lucas_Final03 = 0x1435, + snd_se_lucas_Final04 = 0x1436, + snd_se_lucas_Final05 = 0x1437, + snd_se_lucas_jump01 = 0x1438, + snd_se_lucas_jump02 = 0x1439, + snd_se_lucas_Landing01 = 0x143A, + snd_se_lucas_Landing02 = 0x143B, + snd_se_lucas_smash_H01 = 0x143C, + snd_se_lucas_smash_H02 = 0x143D, + snd_se_lucas_smash_H03 = 0x143E, + snd_se_lucas_smash_H04 = 0x143F, + snd_se_lucas_smash_H05 = 0x1440, + snd_se_lucas_smash_L01 = 0x1441, + snd_se_lucas_smash_L02 = 0x1442, + snd_se_lucas_smash_L03 = 0x1443, + snd_se_lucas_smash_L04 = 0x1444, + snd_se_lucas_smash_L05 = 0x1445, + snd_se_lucas_smash_S01 = 0x1446, + snd_se_lucas_smash_S02 = 0x1447, + snd_se_lucas_smash_S03 = 0x1448, + snd_se_lucas_smash_S04 = 0x1449, + snd_se_lucas_smash_S05 = 0x144A, + snd_se_lucas_Special_H01 = 0x144B, + snd_se_lucas_Special_H02 = 0x144C, + snd_se_lucas_Special_H03 = 0x144D, + snd_se_lucas_Special_H04 = 0x144E, + snd_se_lucas_Special_H05 = 0x144F, + snd_se_lucas_Special_L01 = 0x1450, + snd_se_lucas_Special_L02 = 0x1451, + snd_se_lucas_Special_L03 = 0x1452, + snd_se_lucas_Special_L04 = 0x1453, + snd_se_lucas_Special_L05 = 0x1454, + snd_se_lucas_Special_N01 = 0x1455, + snd_se_lucas_Special_N02 = 0x1456, + snd_se_lucas_Special_N03 = 0x1457, + snd_se_lucas_Special_N04 = 0x1458, + snd_se_lucas_Special_N05 = 0x1459, + snd_se_lucas_Special_S01 = 0x145A, + snd_se_lucas_Special_S02 = 0x145B, + snd_se_lucas_Special_S03 = 0x145C, + snd_se_lucas_Special_S04 = 0x145D, + snd_se_lucas_Special_S05 = 0x145E, + snd_se_lucas_squat = 0x145F, + snd_se_lucas_step_hidari_m = 0x1460, + snd_se_lucas_step_hidari_s = 0x1461, + snd_se_lucas_step_migi_m = 0x1462, + snd_se_lucas_step_migi_s = 0x1463, + snd_se_lucas_swing_l = 0x1464, + snd_se_lucas_swing_ll = 0x1465, + snd_se_lucas_swing_m = 0x1466, + snd_se_lucas_swing_s = 0x1467, + snd_se_lucas_turn = 0x1468, + snd_se_lucas_turn_run = 0x1469, + snd_se_lucas_ukemi = 0x146A, + snd_se_lucas_Wait1 = 0x146B, + snd_se_lucas_Wait2 = 0x146C, + snd_se_lucas_Wait3 = 0x146D, + snd_se_lucas_wear = 0x146E, + snd_se_Diddy_001 = 0x146F, + snd_se_Diddy_002 = 0x1470, + snd_se_Diddy_003 = 0x1471, + snd_se_Diddy_004 = 0x1472, + snd_se_Diddy_005 = 0x1473, + snd_se_Diddy_006 = 0x1474, + snd_se_Diddy_007 = 0x1475, + snd_se_Diddy_008 = 0x1476, + snd_se_Diddy_009 = 0x1477, + snd_se_Diddy_010 = 0x1478, + snd_se_Diddy_011 = 0x1479, + snd_se_Diddy_012 = 0x147A, + snd_se_Diddy_013 = 0x147B, + snd_se_Diddy_014 = 0x147C, + snd_se_Diddy_015 = 0x147D, + snd_se_Diddy_016 = 0x147E, + snd_se_Diddy_017 = 0x147F, + snd_se_Diddy_046 = 0x1480, + snd_se_Diddy_047 = 0x1481, + snd_se_Diddy_048 = 0x1482, + snd_se_Diddy_049 = 0x1483, + snd_se_Diddy_050 = 0x1484, + snd_se_Diddy_Attack_l = 0x1485, + snd_se_Diddy_Attack_ll = 0x1486, + snd_se_Diddy_Attack_m = 0x1487, + snd_se_Diddy_Attack_s = 0x1488, + snd_se_Diddy_Attack100 = 0x1489, + snd_se_Diddy_BodyPress01 = 0x148A, + snd_se_Diddy_BodyPress02 = 0x148B, + snd_se_Diddy_dash_start = 0x148C, + snd_se_Diddy_dash_stop = 0x148D, + snd_se_Diddy_down01 = 0x148E, + snd_se_Diddy_down02 = 0x148F, + snd_se_Diddy_Final01 = 0x1490, + snd_se_Diddy_Final02 = 0x1491, + snd_se_Diddy_Final03 = 0x1492, + snd_se_Diddy_Final04 = 0x1493, + snd_se_Diddy_Final05 = 0x1494, + snd_se_Diddy_jump01 = 0x1495, + snd_se_Diddy_jump02 = 0x1496, + snd_se_Diddy_Landing01 = 0x1497, + snd_se_Diddy_Landing02 = 0x1498, + snd_se_Diddy_smash_H01 = 0x1499, + snd_se_Diddy_smash_H02 = 0x149A, + snd_se_Diddy_smash_H03 = 0x149B, + snd_se_Diddy_smash_H04 = 0x149C, + snd_se_Diddy_smash_H05 = 0x149D, + snd_se_Diddy_smash_L01 = 0x149E, + snd_se_Diddy_smash_L02 = 0x149F, + snd_se_Diddy_smash_L03 = 0x14A0, + snd_se_Diddy_smash_L04 = 0x14A1, + snd_se_Diddy_smash_L05 = 0x14A2, + snd_se_Diddy_smash_S01 = 0x14A3, + snd_se_Diddy_smash_S02 = 0x14A4, + snd_se_Diddy_smash_S03 = 0x14A5, + snd_se_Diddy_smash_S04 = 0x14A6, + snd_se_Diddy_smash_S05 = 0x14A7, + snd_se_Diddy_Special_H01 = 0x14A8, + snd_se_Diddy_Special_H02 = 0x14A9, + snd_se_Diddy_Special_H03 = 0x14AA, + snd_se_Diddy_Special_H04 = 0x14AB, + snd_se_Diddy_Special_H05 = 0x14AC, + snd_se_Diddy_Special_L01 = 0x14AD, + snd_se_Diddy_Special_L02 = 0x14AE, + snd_se_Diddy_Special_L03 = 0x14AF, + snd_se_Diddy_Special_L04 = 0x14B0, + snd_se_Diddy_Special_L05 = 0x14B1, + snd_se_Diddy_Special_N01 = 0x14B2, + snd_se_Diddy_Special_N02 = 0x14B3, + snd_se_Diddy_Special_N03 = 0x14B4, + snd_se_Diddy_Special_N04 = 0x14B5, + snd_se_Diddy_Special_N05 = 0x14B6, + snd_se_Diddy_Special_S01 = 0x14B7, + snd_se_Diddy_Special_S02 = 0x14B8, + snd_se_Diddy_Special_S03 = 0x14B9, + snd_se_Diddy_Special_S04 = 0x14BA, + snd_se_Diddy_Special_S05 = 0x14BB, + snd_se_Diddy_squat = 0x14BC, + snd_se_Diddy_step_hidari_m = 0x14BD, + snd_se_Diddy_step_hidari_s = 0x14BE, + snd_se_Diddy_step_migi_m = 0x14BF, + snd_se_Diddy_step_migi_s = 0x14C0, + snd_se_Diddy_swing_l = 0x14C1, + snd_se_Diddy_swing_ll = 0x14C2, + snd_se_Diddy_swing_m = 0x14C3, + snd_se_Diddy_swing_s = 0x14C4, + snd_se_Diddy_turn = 0x14C5, + snd_se_Diddy_turn_run = 0x14C6, + snd_se_Diddy_ukemi = 0x14C7, + snd_se_Diddy_Wait1 = 0x14C8, + snd_se_Diddy_Wait2 = 0x14C9, + snd_se_Diddy_Wait3 = 0x14CA, + snd_se_Diddy_wear = 0x14CB, + snd_se_PokeTrainer_001 = 0x14CC, + snd_se_PokeTrainer_002 = 0x14CD, + snd_se_PokeTrainer_003 = 0x14CE, + snd_se_PokeTrainer_004 = 0x14CF, + snd_se_PokeTrainer_005 = 0x14D0, + snd_se_PokeTrainer_006 = 0x14D1, + snd_vc_Lizardon_MissFoot01 = 0x14D2, + snd_vc_Lizardon_MissFoot02 = 0x14D3, + snd_vc_Zenigame_MissFoot01 = 0x14D4, + snd_vc_Zenigame_MissFoot02 = 0x14D5, + snd_vc_Fushigisou_MissFoot01 = 0x14D6, + snd_vc_Fushigisou_MissFoot02 = 0x14D7, + snd_se_PokeTrainer_047 = 0x14D8, + snd_se_PokeTrainer_048 = 0x14D9, + snd_se_PokeTrainer_049 = 0x14DA, + snd_se_PokeTrainer_050 = 0x14DB, + snd_se_PokeTrainer_Attack_l = 0x14DC, + snd_se_PokeTrainer_Attack_ll = 0x14DD, + snd_se_PokeTrainer_Attack_m = 0x14DE, + snd_se_PokeTrainer_Attack_s = 0x14DF, + snd_se_PokeTrainer_Attack100 = 0x14E0, + snd_se_PokeTrainer_BodyPress01 = 0x14E1, + snd_se_PokeTrainer_BodyPress02 = 0x14E2, + snd_se_PokeTrainer_dash_start = 0x14E3, + snd_se_PokeTrainer_dash_stop = 0x14E4, + snd_se_PokeTrainer_down01 = 0x14E5, + snd_se_PokeTrainer_down02 = 0x14E6, + snd_se_PokeTrainer_Final01 = 0x14E7, + snd_se_PokeTrainer_Final02 = 0x14E8, + snd_se_PokeTrainer_Final03 = 0x14E9, + snd_se_PokeTrainer_Final04 = 0x14EA, + snd_se_PokeTrainer_Final05 = 0x14EB, + snd_se_PokeTrainer_jump01 = 0x14EC, + snd_se_PokeTrainer_jump02 = 0x14ED, + snd_se_PokeTrainer_Landing01 = 0x14EE, + snd_se_PokeTrainer_Landing02 = 0x14EF, + snd_se_PokeTrainer_smash_H01 = 0x14F0, + snd_se_PokeTrainer_smash_H02 = 0x14F1, + snd_se_PokeTrainer_smash_H03 = 0x14F2, + snd_se_PokeTrainer_smash_H04 = 0x14F3, + snd_se_PokeTrainer_smash_H05 = 0x14F4, + snd_se_PokeTrainer_smash_L01 = 0x14F5, + snd_se_PokeTrainer_smash_L02 = 0x14F6, + snd_se_PokeTrainer_smash_L03 = 0x14F7, + snd_se_PokeTrainer_smash_L04 = 0x14F8, + snd_se_PokeTrainer_smash_L05 = 0x14F9, + snd_se_PokeTrainer_smash_S01 = 0x14FA, + snd_se_PokeTrainer_smash_S02 = 0x14FB, + snd_se_PokeTrainer_smash_S03 = 0x14FC, + snd_se_PokeTrainer_smash_S04 = 0x14FD, + snd_se_PokeTrainer_smash_S05 = 0x14FE, + snd_se_PokeTrainer_Special_H01 = 0x14FF, + snd_se_PokeTrainer_Special_H02 = 0x1500, + snd_se_PokeTrainer_Special_H03 = 0x1501, + snd_se_PokeTrainer_Special_H04 = 0x1502, + snd_se_PokeTrainer_Special_H05 = 0x1503, + snd_se_PokeTrainer_Special_L01 = 0x1504, + snd_se_PokeTrainer_Special_L02 = 0x1505, + snd_se_PokeTrainer_Special_L03 = 0x1506, + snd_se_PokeTrainer_Special_L04 = 0x1507, + snd_se_PokeTrainer_Special_L05 = 0x1508, + snd_se_PokeTrainer_Special_N01 = 0x1509, + snd_se_PokeTrainer_Special_N02 = 0x150A, + snd_se_PokeTrainer_Special_N03 = 0x150B, + snd_se_PokeTrainer_Special_N04 = 0x150C, + snd_se_PokeTrainer_Special_N05 = 0x150D, + snd_se_PokeTrainer_Special_S01 = 0x150E, + snd_se_PokeTrainer_Special_S02 = 0x150F, + snd_se_PokeTrainer_Special_S03 = 0x1510, + snd_se_PokeTrainer_Special_S04 = 0x1511, + snd_se_PokeTrainer_Special_S05 = 0x1512, + snd_se_PokeTrainer_squat = 0x1513, + snd_se_PokeTrainer_step_hidari_m = 0x1514, + snd_se_PokeTrainer_step_hidari_s = 0x1515, + snd_se_PokeTrainer_step_migi_m = 0x1516, + snd_se_PokeTrainer_step_migi_s = 0x1517, + snd_se_PokeTrainer_swing_l = 0x1518, + snd_se_PokeTrainer_swing_ll = 0x1519, + snd_se_PokeTrainer_swing_m = 0x151A, + snd_se_PokeTrainer_swing_s = 0x151B, + snd_se_PokeTrainer_turn = 0x151C, + snd_se_PokeTrainer_turn_run = 0x151D, + snd_se_PokeTrainer_ukemi = 0x151E, + snd_se_PokeTrainer_Wait1 = 0x151F, + snd_se_PokeTrainer_Wait2 = 0x1520, + snd_se_PokeTrainer_Wait3 = 0x1521, + snd_se_PokeTrainer_wear = 0x1522, + snd_se_Lizardon_001 = 0x1523, + snd_se_Lizardon_002 = 0x1524, + snd_se_Lizardon_003 = 0x1525, + snd_se_Lizardon_004 = 0x1526, + snd_se_Lizardon_005 = 0x1527, + snd_se_Lizardon_006 = 0x1528, + snd_se_Lizardon_007 = 0x1529, + snd_se_Lizardon_008 = 0x152A, + snd_se_Lizardon_009 = 0x152B, + snd_se_Lizardon_010 = 0x152C, + snd_se_Lizardon_011 = 0x152D, + snd_se_Lizardon_012 = 0x152E, + snd_se_Lizardon_013 = 0x152F, + snd_se_Lizardon_014 = 0x1530, + snd_se_Lizardon_046 = 0x1531, + snd_se_Lizardon_047 = 0x1532, + snd_se_Lizardon_048 = 0x1533, + snd_se_Lizardon_049 = 0x1534, + snd_se_Lizardon_050 = 0x1535, + snd_se_Lizardon_Attack_l = 0x1536, + snd_se_Lizardon_Attack_ll = 0x1537, + snd_se_Lizardon_Attack_m = 0x1538, + snd_se_Lizardon_Attack_s = 0x1539, + snd_se_Lizardon_Attack100 = 0x153A, + snd_se_Lizardon_BodyPress01 = 0x153B, + snd_se_Lizardon_BodyPress02 = 0x153C, + snd_se_Lizardon_dash_start = 0x153D, + snd_se_Lizardon_dash_stop = 0x153E, + snd_se_Lizardon_down01 = 0x153F, + snd_se_Lizardon_down02 = 0x1540, + snd_se_Lizardon_Final01 = 0x1541, + snd_se_Lizardon_Final02 = 0x1542, + snd_se_Lizardon_Final03 = 0x1543, + snd_se_Lizardon_Final04 = 0x1544, + snd_se_Lizardon_Final05 = 0x1545, + snd_se_Lizardon_jump01 = 0x1546, + snd_se_Lizardon_jump02 = 0x1547, + snd_se_Lizardon_Landing01 = 0x1548, + snd_se_Lizardon_Landing02 = 0x1549, + snd_se_Lizardon_smash_H01 = 0x154A, + snd_se_Lizardon_smash_H02 = 0x154B, + snd_se_Lizardon_smash_H03 = 0x154C, + snd_se_Lizardon_smash_H04 = 0x154D, + snd_se_Lizardon_smash_H05 = 0x154E, + snd_se_Lizardon_smash_L01 = 0x154F, + snd_se_Lizardon_smash_L02 = 0x1550, + snd_se_Lizardon_smash_L03 = 0x1551, + snd_se_Lizardon_smash_L04 = 0x1552, + snd_se_Lizardon_smash_L05 = 0x1553, + snd_se_Lizardon_smash_S01 = 0x1554, + snd_se_Lizardon_smash_S02 = 0x1555, + snd_se_Lizardon_smash_S03 = 0x1556, + snd_se_Lizardon_smash_S04 = 0x1557, + snd_se_Lizardon_smash_S05 = 0x1558, + snd_se_Lizardon_Special_H01 = 0x1559, + snd_se_Lizardon_Special_H02 = 0x155A, + snd_se_Lizardon_Special_H03 = 0x155B, + snd_se_Lizardon_Special_H04 = 0x155C, + snd_se_Lizardon_Special_H05 = 0x155D, + snd_se_Lizardon_Special_L01 = 0x155E, + snd_se_Lizardon_Special_L02 = 0x155F, + snd_se_Lizardon_Special_L03 = 0x1560, + snd_se_Lizardon_Special_L04 = 0x1561, + snd_se_Lizardon_Special_L05 = 0x1562, + snd_se_Lizardon_Special_N01 = 0x1563, + snd_se_Lizardon_Special_N02 = 0x1564, + snd_se_Lizardon_Special_N03 = 0x1565, + snd_se_Lizardon_Special_N04 = 0x1566, + snd_se_Lizardon_Special_N05 = 0x1567, + snd_se_Lizardon_Special_S01 = 0x1568, + snd_se_Lizardon_Special_S02 = 0x1569, + snd_se_Lizardon_Special_S03 = 0x156A, + snd_se_Lizardon_Special_S04 = 0x156B, + snd_se_Lizardon_Special_S05 = 0x156C, + snd_se_Lizardon_squat = 0x156D, + snd_se_Lizardon_step_hidari_m = 0x156E, + snd_se_Lizardon_step_hidari_s = 0x156F, + snd_se_Lizardon_step_migi_m = 0x1570, + snd_se_Lizardon_step_migi_s = 0x1571, + snd_se_Lizardon_swing_l = 0x1572, + snd_se_Lizardon_swing_ll = 0x1573, + snd_se_Lizardon_swing_m = 0x1574, + snd_se_Lizardon_swing_s = 0x1575, + snd_se_Lizardon_turn = 0x1576, + snd_se_Lizardon_turn_run = 0x1577, + snd_se_Lizardon_ukemi = 0x1578, + snd_se_Lizardon_Wait1 = 0x1579, + snd_se_Lizardon_Wait2 = 0x157A, + snd_se_Lizardon_Wait3 = 0x157B, + snd_se_Lizardon_wear = 0x157C, + snd_se_Zenigame_001 = 0x157D, + snd_se_Zenigame_002 = 0x157E, + snd_se_Zenigame_003 = 0x157F, + snd_se_Zenigame_004 = 0x1580, + snd_se_Zenigame_005 = 0x1581, + snd_se_Zenigame_006 = 0x1582, + snd_se_Zenigame_007 = 0x1583, + snd_se_Zenigame_008 = 0x1584, + snd_se_Zenigame_009 = 0x1585, + snd_se_Zenigame_010 = 0x1586, + snd_se_Zenigame_011 = 0x1587, + snd_se_Zenigame_012 = 0x1588, + snd_se_Zenigame_013 = 0x1589, + snd_se_Zenigame_014 = 0x158A, + snd_se_Zenigame_015 = 0x158B, + snd_se_Zenigame_016 = 0x158C, + snd_se_Zenigame_017 = 0x158D, + snd_se_Zenigame_020 = 0x158E, + snd_se_Zenigame_021 = 0x158F, + snd_se_Zenigame_022 = 0x1590, + snd_se_Zenigame_023 = 0x1591, + snd_se_Zenigame_024 = 0x1592, + snd_se_Zenigame_046 = 0x1593, + snd_se_Zenigame_047 = 0x1594, + snd_se_Zenigame_048 = 0x1595, + snd_se_Zenigame_049 = 0x1596, + snd_se_Zenigame_050 = 0x1597, + snd_se_Zenigame_Attack_l = 0x1598, + snd_se_Zenigame_Attack_ll = 0x1599, + snd_se_Zenigame_Attack_m = 0x159A, + snd_se_Zenigame_Attack_s = 0x159B, + snd_se_Zenigame_Attack100 = 0x159C, + snd_se_Zenigame_BodyPress01 = 0x159D, + snd_se_Zenigame_BodyPress02 = 0x159E, + snd_se_Zenigame_dash_start = 0x159F, + snd_se_Zenigame_dash_stop = 0x15A0, + snd_se_Zenigame_down01 = 0x15A1, + snd_se_Zenigame_down02 = 0x15A2, + snd_se_Zenigame_Final01 = 0x15A3, + snd_se_Zenigame_Final02 = 0x15A4, + snd_se_Zenigame_Final03 = 0x15A5, + snd_se_Zenigame_Final04 = 0x15A6, + snd_se_Zenigame_Final05 = 0x15A7, + snd_se_Zenigame_jump01 = 0x15A8, + snd_se_Zenigame_jump02 = 0x15A9, + snd_se_Zenigame_Landing01 = 0x15AA, + snd_se_Zenigame_Landing02 = 0x15AB, + snd_se_Zenigame_smash_H01 = 0x15AC, + snd_se_Zenigame_smash_H02 = 0x15AD, + snd_se_Zenigame_smash_H03 = 0x15AE, + snd_se_Zenigame_smash_H04 = 0x15AF, + snd_se_Zenigame_smash_H05 = 0x15B0, + snd_se_Zenigame_smash_L01 = 0x15B1, + snd_se_Zenigame_smash_L02 = 0x15B2, + snd_se_Zenigame_smash_L03 = 0x15B3, + snd_se_Zenigame_smash_L04 = 0x15B4, + snd_se_Zenigame_smash_L05 = 0x15B5, + snd_se_Zenigame_smash_S01 = 0x15B6, + snd_se_Zenigame_smash_S02 = 0x15B7, + snd_se_Zenigame_smash_S03 = 0x15B8, + snd_se_Zenigame_smash_S04 = 0x15B9, + snd_se_Zenigame_smash_S05 = 0x15BA, + snd_se_Zenigame_Special_H01 = 0x15BB, + snd_se_Zenigame_Special_H02 = 0x15BC, + snd_se_Zenigame_Special_H03 = 0x15BD, + snd_se_Zenigame_Special_H04 = 0x15BE, + snd_se_Zenigame_Special_H05 = 0x15BF, + snd_se_Zenigame_Special_L01 = 0x15C0, + snd_se_Zenigame_Special_L02 = 0x15C1, + snd_se_Zenigame_Special_L03 = 0x15C2, + snd_se_Zenigame_Special_L04 = 0x15C3, + snd_se_Zenigame_Special_L05 = 0x15C4, + snd_se_Zenigame_Special_N01 = 0x15C5, + snd_se_Zenigame_Special_N02 = 0x15C6, + snd_se_Zenigame_Special_N03 = 0x15C7, + snd_se_Zenigame_Special_N04 = 0x15C8, + snd_se_Zenigame_Special_N05 = 0x15C9, + snd_se_Zenigame_Special_S01 = 0x15CA, + snd_se_Zenigame_Special_S02 = 0x15CB, + snd_se_Zenigame_Special_S03 = 0x15CC, + snd_se_Zenigame_Special_S04 = 0x15CD, + snd_se_Zenigame_Special_S05 = 0x15CE, + snd_se_Zenigame_squat = 0x15CF, + snd_se_Zenigame_step_hidari_m = 0x15D0, + snd_se_Zenigame_step_hidari_s = 0x15D1, + snd_se_Zenigame_step_migi_m = 0x15D2, + snd_se_Zenigame_step_migi_s = 0x15D3, + snd_se_Zenigame_swing_l = 0x15D4, + snd_se_Zenigame_swing_ll = 0x15D5, + snd_se_Zenigame_swing_m = 0x15D6, + snd_se_Zenigame_swing_s = 0x15D7, + snd_se_Zenigame_turn = 0x15D8, + snd_se_Zenigame_turn_run = 0x15D9, + snd_se_Zenigame_ukemi = 0x15DA, + snd_se_Zenigame_Wait1 = 0x15DB, + snd_se_Zenigame_Wait2 = 0x15DC, + snd_se_Zenigame_Wait3 = 0x15DD, + snd_se_Zenigame_wear = 0x15DE, + snd_se_Fushigisou_001 = 0x15DF, + snd_se_Fushigisou_002 = 0x15E0, + snd_se_Fushigisou_003 = 0x15E1, + snd_se_Fushigisou_004 = 0x15E2, + snd_se_Fushigisou_005 = 0x15E3, + snd_se_Fushigisou_006 = 0x15E4, + snd_se_Fushigisou_007 = 0x15E5, + snd_se_Fushigisou_008 = 0x15E6, + snd_se_Fushigisou_009 = 0x15E7, + snd_se_Fushigisou_010 = 0x15E8, + snd_se_Fushigisou_011 = 0x15E9, + snd_se_Fushigisou_012 = 0x15EA, + snd_se_Fushigisou_013 = 0x15EB, + snd_se_Fushigisou_014 = 0x15EC, + snd_se_Fushigisou_015 = 0x15ED, + snd_se_Fushigisou_016 = 0x15EE, + snd_se_Fushigisou_017 = 0x15EF, + snd_se_Fushigisou_018 = 0x15F0, + snd_se_Fushigisou_019 = 0x15F1, + snd_se_Fushigisou_020 = 0x15F2, + snd_se_Fushigisou_021 = 0x15F3, + snd_se_Fushigisou_022 = 0x15F4, + snd_se_Fushigisou_023 = 0x15F5, + snd_se_Fushigisou_024 = 0x15F6, + snd_se_Fushigisou_025 = 0x15F7, + snd_se_Fushigisou_026 = 0x15F8, + snd_se_Fushigisou_027 = 0x15F9, + snd_se_Fushigisou_028 = 0x15FA, + snd_se_Fushigisou_029 = 0x15FB, + snd_se_Fushigisou_030 = 0x15FC, + snd_se_Fushigisou_031 = 0x15FD, + snd_se_Fushigisou_032 = 0x15FE, + snd_se_Fushigisou_033 = 0x15FF, + snd_se_Fushigisou_034 = 0x1600, + snd_se_Fushigisou_035 = 0x1601, + snd_se_Fushigisou_036 = 0x1602, + snd_se_Fushigisou_037 = 0x1603, + snd_se_Fushigisou_038 = 0x1604, + snd_se_Fushigisou_039 = 0x1605, + snd_se_Fushigisou_040 = 0x1606, + snd_se_Fushigisou_041 = 0x1607, + snd_se_Fushigisou_042 = 0x1608, + snd_se_Fushigisou_043 = 0x1609, + snd_se_Fushigisou_044 = 0x160A, + snd_se_Fushigisou_045 = 0x160B, + snd_se_Fushigisou_046 = 0x160C, + snd_se_Fushigisou_047 = 0x160D, + snd_se_Fushigisou_048 = 0x160E, + snd_se_Fushigisou_049 = 0x160F, + snd_se_Fushigisou_050 = 0x1610, + snd_se_Fushigisou_Attack_l = 0x1611, + snd_se_Fushigisou_Attack_ll = 0x1612, + snd_se_Fushigisou_Attack_m = 0x1613, + snd_se_Fushigisou_Attack_s = 0x1614, + snd_se_Fushigisou_Attack100 = 0x1615, + snd_se_Fushigisou_BodyPress01 = 0x1616, + snd_se_Fushigisou_BodyPress02 = 0x1617, + snd_se_Fushigisou_dash_start = 0x1618, + snd_se_Fushigisou_dash_stop = 0x1619, + snd_se_Fushigisou_down01 = 0x161A, + snd_se_Fushigisou_down02 = 0x161B, + snd_se_Fushigisou_Final01 = 0x161C, + snd_se_Fushigisou_Final02 = 0x161D, + snd_se_Fushigisou_Final03 = 0x161E, + snd_se_Fushigisou_Final04 = 0x161F, + snd_se_Fushigisou_Final05 = 0x1620, + snd_se_Fushigisou_jump01 = 0x1621, + snd_se_Fushigisou_jump02 = 0x1622, + snd_se_Fushigisou_Landing01 = 0x1623, + snd_se_Fushigisou_Landing02 = 0x1624, + snd_se_Fushigisou_smash_H01 = 0x1625, + snd_se_Fushigisou_smash_H02 = 0x1626, + snd_se_Fushigisou_smash_H03 = 0x1627, + snd_se_Fushigisou_smash_H04 = 0x1628, + snd_se_Fushigisou_smash_H05 = 0x1629, + snd_se_Fushigisou_smash_L01 = 0x162A, + snd_se_Fushigisou_smash_L02 = 0x162B, + snd_se_Fushigisou_smash_L03 = 0x162C, + snd_se_Fushigisou_smash_L04 = 0x162D, + snd_se_Fushigisou_smash_L05 = 0x162E, + snd_se_Fushigisou_smash_S01 = 0x162F, + snd_se_Fushigisou_smash_S02 = 0x1630, + snd_se_Fushigisou_smash_S03 = 0x1631, + snd_se_Fushigisou_smash_S04 = 0x1632, + snd_se_Fushigisou_smash_S05 = 0x1633, + snd_se_Fushigisou_Special_H01 = 0x1634, + snd_se_Fushigisou_Special_H02 = 0x1635, + snd_se_Fushigisou_Special_H03 = 0x1636, + snd_se_Fushigisou_Special_H04 = 0x1637, + snd_se_Fushigisou_Special_H05 = 0x1638, + snd_se_Fushigisou_Special_L01 = 0x1639, + snd_se_Fushigisou_Special_L02 = 0x163A, + snd_se_Fushigisou_Special_L03 = 0x163B, + snd_se_Fushigisou_Special_L04 = 0x163C, + snd_se_Fushigisou_Special_L05 = 0x163D, + snd_se_Fushigisou_Special_N01 = 0x163E, + snd_se_Fushigisou_Special_N02 = 0x163F, + snd_se_Fushigisou_Special_N03 = 0x1640, + snd_se_Fushigisou_Special_N04 = 0x1641, + snd_se_Fushigisou_Special_N05 = 0x1642, + snd_se_Fushigisou_Special_S01 = 0x1643, + snd_se_Fushigisou_Special_S02 = 0x1644, + snd_se_Fushigisou_Special_S03 = 0x1645, + snd_se_Fushigisou_Special_S04 = 0x1646, + snd_se_Fushigisou_Special_S05 = 0x1647, + snd_se_Fushigisou_squat = 0x1648, + snd_se_Fushigisou_step_hidari_m = 0x1649, + snd_se_Fushigisou_step_hidari_s = 0x164A, + snd_se_Fushigisou_step_migi_m = 0x164B, + snd_se_Fushigisou_step_migi_s = 0x164C, + snd_se_Fushigisou_swing_l = 0x164D, + snd_se_Fushigisou_swing_ll = 0x164E, + snd_se_Fushigisou_swing_m = 0x164F, + snd_se_Fushigisou_swing_s = 0x1650, + snd_se_Fushigisou_turn = 0x1651, + snd_se_Fushigisou_turn_run = 0x1652, + snd_se_Fushigisou_ukemi = 0x1653, + snd_se_Fushigisou_Wait1 = 0x1654, + snd_se_Fushigisou_Wait2 = 0x1655, + snd_se_Fushigisou_Wait3 = 0x1656, + snd_se_Fushigisou_wear = 0x1657, + snd_se_Lucario_001 = 0x1658, + snd_se_Lucario_002 = 0x1659, + snd_se_Lucario_003 = 0x165A, + snd_se_Lucario_004 = 0x165B, + snd_se_Lucario_005 = 0x165C, + snd_se_Lucario_006 = 0x165D, + snd_se_Lucario_007 = 0x165E, + snd_se_Lucario_008 = 0x165F, + snd_se_Lucario_009 = 0x1660, + snd_se_Lucario_010 = 0x1661, + snd_se_Lucario_011 = 0x1662, + snd_se_Lucario_012 = 0x1663, + snd_se_Lucario_013 = 0x1664, + snd_se_Lucario_014 = 0x1665, + snd_se_Lucario_015 = 0x1666, + snd_se_Lucario_016 = 0x1667, + snd_se_Lucario_017 = 0x1668, + snd_se_Lucario_018 = 0x1669, + snd_se_Lucario_019 = 0x166A, + snd_se_Lucario_020 = 0x166B, + snd_se_Lucario_021 = 0x166C, + snd_se_Lucario_022 = 0x166D, + snd_se_Lucario_023 = 0x166E, + snd_se_Lucario_024 = 0x166F, + snd_se_Lucario_025 = 0x1670, + snd_se_Lucario_026 = 0x1671, + snd_se_Lucario_027 = 0x1672, + snd_se_Lucario_028 = 0x1673, + snd_se_Lucario_029 = 0x1674, + snd_se_Lucario_030 = 0x1675, + snd_se_Lucario_031 = 0x1676, + snd_se_Lucario_032 = 0x1677, + snd_se_Lucario_033 = 0x1678, + snd_se_Lucario_034 = 0x1679, + snd_se_Lucario_035 = 0x167A, + snd_se_Lucario_036 = 0x167B, + snd_se_Lucario_037 = 0x167C, + snd_se_Lucario_038 = 0x167D, + snd_se_Lucario_039 = 0x167E, + snd_se_Lucario_040 = 0x167F, + snd_se_Lucario_041 = 0x1680, + snd_se_Lucario_042 = 0x1681, + snd_se_Lucario_043 = 0x1682, + snd_se_Lucario_044 = 0x1683, + snd_se_Lucario_045 = 0x1684, + snd_se_Lucario_046 = 0x1685, + snd_se_Lucario_047 = 0x1686, + snd_se_Lucario_048 = 0x1687, + snd_se_Lucario_049 = 0x1688, + snd_se_Lucario_050 = 0x1689, + snd_se_Lucario_Attack_l = 0x168A, + snd_se_Lucario_Attack_ll = 0x168B, + snd_se_Lucario_Attack_m = 0x168C, + snd_se_Lucario_Attack_s = 0x168D, + snd_se_Lucario_Attack100 = 0x168E, + snd_se_Lucario_BodyPress01 = 0x168F, + snd_se_Lucario_BodyPress02 = 0x1690, + snd_se_Lucario_dash_start = 0x1691, + snd_se_Lucario_dash_stop = 0x1692, + snd_se_Lucario_down01 = 0x1693, + snd_se_Lucario_down02 = 0x1694, + snd_se_Lucario_Final01 = 0x1695, + snd_se_Lucario_Final02 = 0x1696, + snd_se_Lucario_Final03 = 0x1697, + snd_se_Lucario_Final04 = 0x1698, + snd_se_Lucario_Final05 = 0x1699, + snd_se_Lucario_jump01 = 0x169A, + snd_se_Lucario_jump02 = 0x169B, + snd_se_Lucario_Landing01 = 0x169C, + snd_se_Lucario_Landing02 = 0x169D, + snd_se_Lucario_smash_H01 = 0x169E, + snd_se_Lucario_smash_H02 = 0x169F, + snd_se_Lucario_smash_H03 = 0x16A0, + snd_se_Lucario_smash_H04 = 0x16A1, + snd_se_Lucario_smash_H05 = 0x16A2, + snd_se_Lucario_smash_L01 = 0x16A3, + snd_se_Lucario_smash_L02 = 0x16A4, + snd_se_Lucario_smash_L03 = 0x16A5, + snd_se_Lucario_smash_L04 = 0x16A6, + snd_se_Lucario_smash_L05 = 0x16A7, + snd_se_Lucario_smash_S01 = 0x16A8, + snd_se_Lucario_smash_S02 = 0x16A9, + snd_se_Lucario_smash_S03 = 0x16AA, + snd_se_Lucario_smash_S04 = 0x16AB, + snd_se_Lucario_smash_S05 = 0x16AC, + snd_se_Lucario_Special_H01 = 0x16AD, + snd_se_Lucario_Special_H02 = 0x16AE, + snd_se_Lucario_Special_H03 = 0x16AF, + snd_se_Lucario_Special_H04 = 0x16B0, + snd_se_Lucario_Special_H05 = 0x16B1, + snd_se_Lucario_Special_L01 = 0x16B2, + snd_se_Lucario_Special_L02 = 0x16B3, + snd_se_Lucario_Special_L03 = 0x16B4, + snd_se_Lucario_Special_L04 = 0x16B5, + snd_se_Lucario_Special_L05 = 0x16B6, + snd_se_Lucario_Special_N01 = 0x16B7, + snd_se_Lucario_Special_N02 = 0x16B8, + snd_se_Lucario_Special_N03 = 0x16B9, + snd_se_Lucario_Special_N04 = 0x16BA, + snd_se_Lucario_Special_N05 = 0x16BB, + snd_se_Lucario_Special_S01 = 0x16BC, + snd_se_Lucario_Special_S02 = 0x16BD, + snd_se_Lucario_Special_S03 = 0x16BE, + snd_se_Lucario_Special_S04 = 0x16BF, + snd_se_Lucario_Special_S05 = 0x16C0, + snd_se_Lucario_squat = 0x16C1, + snd_se_Lucario_step_hidari_m = 0x16C2, + snd_se_Lucario_step_hidari_s = 0x16C3, + snd_se_Lucario_step_migi_m = 0x16C4, + snd_se_Lucario_step_migi_s = 0x16C5, + snd_se_Lucario_swing_l = 0x16C6, + snd_se_Lucario_swing_ll = 0x16C7, + snd_se_Lucario_swing_m = 0x16C8, + snd_se_Lucario_swing_s = 0x16C9, + snd_se_Lucario_turn = 0x16CA, + snd_se_Lucario_turn_run = 0x16CB, + snd_se_Lucario_ukemi = 0x16CC, + snd_se_Lucario_Wait1 = 0x16CD, + snd_se_Lucario_Wait2 = 0x16CE, + snd_se_Lucario_Wait3 = 0x16CF, + snd_se_Lucario_wear = 0x16D0, + snd_se_Ike_001 = 0x16D1, + snd_se_Ike_002 = 0x16D2, + snd_se_Ike_003 = 0x16D3, + snd_se_Ike_004 = 0x16D4, + snd_se_Ike_005 = 0x16D5, + snd_se_Ike_006 = 0x16D6, + snd_se_Ike_007 = 0x16D7, + snd_se_Ike_008 = 0x16D8, + snd_se_Ike_009 = 0x16D9, + snd_se_Ike_010 = 0x16DA, + snd_se_Ike_011 = 0x16DB, + snd_se_Ike_012 = 0x16DC, + snd_se_Ike_013 = 0x16DD, + snd_se_Ike_014 = 0x16DE, + snd_se_Ike_015 = 0x16DF, + snd_se_Ike_046 = 0x16E0, + snd_se_Ike_047 = 0x16E1, + snd_se_Ike_048 = 0x16E2, + snd_se_Ike_049 = 0x16E3, + snd_se_Ike_050 = 0x16E4, + snd_se_Ike_Attack_l = 0x16E5, + snd_se_Ike_Attack_ll = 0x16E6, + snd_se_Ike_Attack_m = 0x16E7, + snd_se_Ike_Attack_s = 0x16E8, + snd_se_Ike_Attack100 = 0x16E9, + snd_se_Ike_BodyPress01 = 0x16EA, + snd_se_Ike_BodyPress02 = 0x16EB, + snd_se_Ike_dash_start = 0x16EC, + snd_se_Ike_dash_stop = 0x16ED, + snd_se_Ike_down01 = 0x16EE, + snd_se_Ike_down02 = 0x16EF, + snd_se_Ike_Final01 = 0x16F0, + snd_se_Ike_Final02 = 0x16F1, + snd_se_Ike_Final03 = 0x16F2, + snd_se_Ike_Final04 = 0x16F3, + snd_se_Ike_Final05 = 0x16F4, + snd_se_Ike_jump01 = 0x16F5, + snd_se_Ike_jump02 = 0x16F6, + snd_se_Ike_Landing01 = 0x16F7, + snd_se_Ike_Landing02 = 0x16F8, + snd_se_Ike_smash_H01 = 0x16F9, + snd_se_Ike_smash_H02 = 0x16FA, + snd_se_Ike_smash_H03 = 0x16FB, + snd_se_Ike_smash_H04 = 0x16FC, + snd_se_Ike_smash_H05 = 0x16FD, + snd_se_Ike_smash_L01 = 0x16FE, + snd_se_Ike_smash_L02 = 0x16FF, + snd_se_Ike_smash_L03 = 0x1700, + snd_se_Ike_smash_L04 = 0x1701, + snd_se_Ike_smash_L05 = 0x1702, + snd_se_Ike_smash_S01 = 0x1703, + snd_se_Ike_smash_S02 = 0x1704, + snd_se_Ike_smash_S03 = 0x1705, + snd_se_Ike_smash_S04 = 0x1706, + snd_se_Ike_smash_S05 = 0x1707, + snd_se_Ike_Special_H01 = 0x1708, + snd_se_Ike_Special_H02 = 0x1709, + snd_se_Ike_Special_H03 = 0x170A, + snd_se_Ike_Special_H04 = 0x170B, + snd_se_Ike_Special_H05 = 0x170C, + snd_se_Ike_Special_L01 = 0x170D, + snd_se_Ike_Special_L02 = 0x170E, + snd_se_Ike_Special_L03 = 0x170F, + snd_se_Ike_Special_L04 = 0x1710, + snd_se_Ike_Special_L05 = 0x1711, + snd_se_Ike_Special_N01 = 0x1712, + snd_se_Ike_Special_N02 = 0x1713, + snd_se_Ike_Special_N03 = 0x1714, + snd_se_Ike_Special_N04 = 0x1715, + snd_se_Ike_Special_N05 = 0x1716, + snd_se_Ike_Special_S01 = 0x1717, + snd_se_Ike_Special_S02 = 0x1718, + snd_se_Ike_Special_S03 = 0x1719, + snd_se_Ike_Special_S04 = 0x171A, + snd_se_Ike_Special_S05 = 0x171B, + snd_se_Ike_squat = 0x171C, + snd_se_Ike_step_hidari_m = 0x171D, + snd_se_Ike_step_hidari_s = 0x171E, + snd_se_Ike_step_migi_m = 0x171F, + snd_se_Ike_step_migi_s = 0x1720, + snd_se_Ike_swing_l = 0x1721, + snd_se_Ike_swing_ll = 0x1722, + snd_se_Ike_swing_m = 0x1723, + snd_se_Ike_swing_s = 0x1724, + snd_se_Ike_turn = 0x1725, + snd_se_Ike_turn_run = 0x1726, + snd_se_Ike_ukemi = 0x1727, + snd_se_Ike_Wait1 = 0x1728, + snd_se_Ike_Wait2 = 0x1729, + snd_se_Ike_Wait3 = 0x172A, + snd_se_Ike_wear = 0x172B, + snd_se_Robot_001 = 0x172C, + snd_se_Robot_002 = 0x172D, + snd_se_Robot_003 = 0x172E, + snd_se_Robot_004 = 0x172F, + snd_se_Robot_005 = 0x1730, + snd_se_Robot_006 = 0x1731, + snd_se_Robot_007 = 0x1732, + snd_se_Robot_008 = 0x1733, + snd_se_Robot_009 = 0x1734, + snd_se_Robot_010 = 0x1735, + snd_se_Robot_011 = 0x1736, + snd_se_Robot_012 = 0x1737, + snd_se_Robot_013 = 0x1738, + snd_se_Robot_014 = 0x1739, + snd_se_Robot_015 = 0x173A, + snd_se_Robot_016 = 0x173B, + snd_se_Robot_017 = 0x173C, + snd_se_Robot_018 = 0x173D, + snd_se_Robot_019 = 0x173E, + snd_se_Robot_020 = 0x173F, + snd_se_Robot_021 = 0x1740, + snd_se_Robot_022 = 0x1741, + snd_se_Robot_023 = 0x1742, + snd_se_Robot_024 = 0x1743, + snd_se_Robot_025 = 0x1744, + snd_se_Robot_026 = 0x1745, + snd_se_Robot_027 = 0x1746, + snd_se_Robot_028 = 0x1747, + snd_se_Robot_029 = 0x1748, + snd_se_Robot_030 = 0x1749, + snd_se_Robot_031 = 0x174A, + snd_se_Robot_032 = 0x174B, + snd_se_Robot_046 = 0x174C, + snd_se_Robot_047 = 0x174D, + snd_se_Robot_048 = 0x174E, + snd_se_Robot_049 = 0x174F, + snd_se_Robot_050 = 0x1750, + snd_se_Robot_Attack_l = 0x1751, + snd_se_Robot_Attack_ll = 0x1752, + snd_se_Robot_Attack_m = 0x1753, + snd_se_Robot_Attack_s = 0x1754, + snd_se_Robot_Attack100 = 0x1755, + snd_se_Robot_BodyPress01 = 0x1756, + snd_se_Robot_BodyPress02 = 0x1757, + snd_se_Robot_dash_start = 0x1758, + snd_se_Robot_dash_stop = 0x1759, + snd_se_Robot_down01 = 0x175A, + snd_se_Robot_down02 = 0x175B, + snd_se_Robot_Final01 = 0x175C, + snd_se_Robot_Final02 = 0x175D, + snd_se_Robot_Final03 = 0x175E, + snd_se_Robot_Final04 = 0x175F, + snd_se_Robot_Final05 = 0x1760, + snd_se_Robot_jump01 = 0x1761, + snd_se_Robot_jump02 = 0x1762, + snd_se_Robot_Landing01 = 0x1763, + snd_se_Robot_Landing02 = 0x1764, + snd_se_Robot_smash_H01 = 0x1765, + snd_se_Robot_smash_H02 = 0x1766, + snd_se_Robot_smash_H03 = 0x1767, + snd_se_Robot_smash_H04 = 0x1768, + snd_se_Robot_smash_H05 = 0x1769, + snd_se_Robot_smash_L01 = 0x176A, + snd_se_Robot_smash_L02 = 0x176B, + snd_se_Robot_smash_L03 = 0x176C, + snd_se_Robot_smash_L04 = 0x176D, + snd_se_Robot_smash_L05 = 0x176E, + snd_se_Robot_smash_S01 = 0x176F, + snd_se_Robot_smash_S02 = 0x1770, + snd_se_Robot_smash_S03 = 0x1771, + snd_se_Robot_smash_S04 = 0x1772, + snd_se_Robot_smash_S05 = 0x1773, + snd_se_Robot_Special_H01 = 0x1774, + snd_se_Robot_Special_H02 = 0x1775, + snd_se_Robot_Special_H03 = 0x1776, + snd_se_Robot_Special_H04 = 0x1777, + snd_se_Robot_Special_H05 = 0x1778, + snd_se_Robot_Special_L01 = 0x1779, + snd_se_Robot_Special_L02 = 0x177A, + snd_se_Robot_Special_L03 = 0x177B, + snd_se_Robot_Special_L04 = 0x177C, + snd_se_Robot_Special_L05 = 0x177D, + snd_se_Robot_Special_N01 = 0x177E, + snd_se_Robot_Special_N02 = 0x177F, + snd_se_Robot_Special_N03 = 0x1780, + snd_se_Robot_Special_N04 = 0x1781, + snd_se_Robot_Special_N05 = 0x1782, + snd_se_Robot_Special_S01 = 0x1783, + snd_se_Robot_Special_S02 = 0x1784, + snd_se_Robot_Special_S03 = 0x1785, + snd_se_Robot_Special_S04 = 0x1786, + snd_se_Robot_Special_S05 = 0x1787, + snd_se_Robot_squat = 0x1788, + snd_se_Robot_step_hidari_m = 0x1789, + snd_se_Robot_step_hidari_s = 0x178A, + snd_se_Robot_step_migi_m = 0x178B, + snd_se_Robot_step_migi_s = 0x178C, + snd_se_Robot_swing_l = 0x178D, + snd_se_Robot_swing_ll = 0x178E, + snd_se_Robot_swing_m = 0x178F, + snd_se_Robot_swing_s = 0x1790, + snd_se_Robot_turn = 0x1791, + snd_se_Robot_turn_run = 0x1792, + snd_se_Robot_ukemi = 0x1793, + snd_se_Robot_Wait1 = 0x1794, + snd_se_Robot_Wait2 = 0x1795, + snd_se_Robot_Wait3 = 0x1796, + snd_se_Robot_wear = 0x1797, + snd_se_Purin_001 = 0x1798, + snd_se_Purin_002 = 0x1799, + snd_se_Purin_003 = 0x179A, + snd_se_Purin_004 = 0x179B, + snd_se_Purin_005 = 0x179C, + snd_se_Purin_006 = 0x179D, + snd_se_Purin_007 = 0x179E, + snd_se_Purin_008 = 0x179F, + snd_se_Purin_009 = 0x17A0, + snd_se_Purin_010 = 0x17A1, + snd_se_Purin_011 = 0x17A2, + snd_se_Purin_012 = 0x17A3, + snd_se_Purin_013 = 0x17A4, + snd_se_Purin_014 = 0x17A5, + snd_se_Purin_015 = 0x17A6, + snd_se_Purin_016 = 0x17A7, + snd_se_Purin_017 = 0x17A8, + snd_se_Purin_018 = 0x17A9, + snd_se_Purin_019 = 0x17AA, + snd_se_Purin_020 = 0x17AB, + snd_se_Purin_021 = 0x17AC, + snd_se_Purin_022 = 0x17AD, + snd_se_Purin_023 = 0x17AE, + snd_se_Purin_024 = 0x17AF, + snd_se_Purin_025 = 0x17B0, + snd_se_Purin_026 = 0x17B1, + snd_se_Purin_027 = 0x17B2, + snd_se_Purin_028 = 0x17B3, + snd_se_Purin_029 = 0x17B4, + snd_se_Purin_046 = 0x17B5, + snd_se_Purin_047 = 0x17B6, + snd_se_Purin_048 = 0x17B7, + snd_se_Purin_049 = 0x17B8, + snd_se_Purin_050 = 0x17B9, + snd_se_Purin_Attack_l = 0x17BA, + snd_se_Purin_Attack_ll = 0x17BB, + snd_se_Purin_Attack_m = 0x17BC, + snd_se_Purin_Attack_s = 0x17BD, + snd_se_Purin_Attack100 = 0x17BE, + snd_se_Purin_BodyPress01 = 0x17BF, + snd_se_Purin_BodyPress02 = 0x17C0, + snd_se_Purin_dash_start = 0x17C1, + snd_se_Purin_dash_stop = 0x17C2, + snd_se_Purin_down01 = 0x17C3, + snd_se_Purin_down02 = 0x17C4, + snd_se_Purin_Final01 = 0x17C5, + snd_se_Purin_Final02 = 0x17C6, + snd_se_Purin_Final03 = 0x17C7, + snd_se_Purin_Final04 = 0x17C8, + snd_se_Purin_Final05 = 0x17C9, + snd_se_Purin_jump01 = 0x17CA, + snd_se_Purin_jump02 = 0x17CB, + snd_se_Purin_Landing01 = 0x17CC, + snd_se_Purin_Landing02 = 0x17CD, + snd_se_Purin_smash_H01 = 0x17CE, + snd_se_Purin_smash_H02 = 0x17CF, + snd_se_Purin_smash_H03 = 0x17D0, + snd_se_Purin_smash_H04 = 0x17D1, + snd_se_Purin_smash_H05 = 0x17D2, + snd_se_Purin_smash_L01 = 0x17D3, + snd_se_Purin_smash_L02 = 0x17D4, + snd_se_Purin_smash_L03 = 0x17D5, + snd_se_Purin_smash_L04 = 0x17D6, + snd_se_Purin_smash_L05 = 0x17D7, + snd_se_Purin_smash_S01 = 0x17D8, + snd_se_Purin_smash_S02 = 0x17D9, + snd_se_Purin_smash_S03 = 0x17DA, + snd_se_Purin_smash_S04 = 0x17DB, + snd_se_Purin_smash_S05 = 0x17DC, + snd_se_Purin_Special_H01 = 0x17DD, + snd_se_Purin_Special_H02 = 0x17DE, + snd_se_Purin_Special_H03 = 0x17DF, + snd_se_Purin_Special_H04 = 0x17E0, + snd_se_Purin_Special_H05 = 0x17E1, + snd_se_Purin_Special_L01 = 0x17E2, + snd_se_Purin_Special_L02 = 0x17E3, + snd_se_Purin_Special_L03 = 0x17E4, + snd_se_Purin_Special_L04 = 0x17E5, + snd_se_Purin_Special_L05 = 0x17E6, + snd_se_Purin_Special_N01 = 0x17E7, + snd_se_Purin_Special_N02 = 0x17E8, + snd_se_Purin_Special_N03 = 0x17E9, + snd_se_Purin_Special_N04 = 0x17EA, + snd_se_Purin_Special_N05 = 0x17EB, + snd_se_Purin_Special_S01 = 0x17EC, + snd_se_Purin_Special_S02 = 0x17ED, + snd_se_Purin_Special_S03 = 0x17EE, + snd_se_Purin_Special_S04 = 0x17EF, + snd_se_Purin_Special_S05 = 0x17F0, + snd_se_Purin_squat = 0x17F1, + snd_se_Purin_step_hidari_m = 0x17F2, + snd_se_Purin_step_hidari_s = 0x17F3, + snd_se_Purin_step_migi_m = 0x17F4, + snd_se_Purin_step_migi_s = 0x17F5, + snd_se_Purin_swing_l = 0x17F6, + snd_se_Purin_swing_ll = 0x17F7, + snd_se_Purin_swing_m = 0x17F8, + snd_se_Purin_swing_s = 0x17F9, + snd_se_Purin_turn = 0x17FA, + snd_se_Purin_turn_run = 0x17FB, + snd_se_Purin_ukemi = 0x17FC, + snd_se_Purin_Wait1 = 0x17FD, + snd_se_Purin_Wait2 = 0x17FE, + snd_se_Purin_Wait3 = 0x17FF, + snd_se_Purin_wear = 0x1800, + snd_se_ToonLink_001 = 0x1801, + snd_se_ToonLink_002 = 0x1802, + snd_se_ToonLink_003 = 0x1803, + snd_se_ToonLink_004 = 0x1804, + snd_se_ToonLink_005 = 0x1805, + snd_se_ToonLink_006 = 0x1806, + snd_se_ToonLink_007 = 0x1807, + snd_se_ToonLink_008 = 0x1808, + snd_se_ToonLink_009 = 0x1809, + snd_se_ToonLink_010 = 0x180A, + snd_se_ToonLink_011 = 0x180B, + snd_se_ToonLink_012 = 0x180C, + snd_se_ToonLink_013 = 0x180D, + snd_se_ToonLink_014 = 0x180E, + snd_se_ToonLink_015 = 0x180F, + snd_se_ToonLink_016 = 0x1810, + snd_se_ToonLink_017 = 0x1811, + snd_se_ToonLink_018 = 0x1812, + snd_se_ToonLink_019 = 0x1813, + snd_se_ToonLink_020 = 0x1814, + snd_se_ToonLink_021 = 0x1815, + snd_se_toonlink_022 = 0x1816, + snd_se_toonlink_023 = 0x1817, + snd_se_toonlink_024 = 0x1818, + snd_se_toonlink_025 = 0x1819, + snd_se_toonlink_026 = 0x181A, + snd_se_toonlink_027 = 0x181B, + snd_se_toonlink_028 = 0x181C, + snd_se_toonlink_029 = 0x181D, + snd_se_toonlink_030 = 0x181E, + snd_se_toonlink_031 = 0x181F, + snd_se_toonlink_032 = 0x1820, + snd_se_ToonLink_033 = 0x1821, + snd_se_ToonLink_034 = 0x1822, + snd_se_ToonLink_035 = 0x1823, + snd_se_ToonLink_036 = 0x1824, + snd_se_ToonLink_037 = 0x1825, + snd_se_ToonLink_038 = 0x1826, + snd_se_ToonLink_039 = 0x1827, + snd_se_ToonLink_040 = 0x1828, + snd_se_ToonLink_041 = 0x1829, + snd_se_ToonLink_046 = 0x182A, + snd_se_ToonLink_047 = 0x182B, + snd_se_ToonLink_048 = 0x182C, + snd_se_ToonLink_049 = 0x182D, + snd_se_ToonLink_050 = 0x182E, + snd_se_ToonLink_Attack_l = 0x182F, + snd_se_ToonLink_Attack_ll = 0x1830, + snd_se_ToonLink_Attack_m = 0x1831, + snd_se_ToonLink_Attack_s = 0x1832, + snd_se_ToonLink_Attack100 = 0x1833, + snd_se_ToonLink_BodyPress01 = 0x1834, + snd_se_ToonLink_BodyPress02 = 0x1835, + snd_se_ToonLink_dash_start = 0x1836, + snd_se_ToonLink_dash_stop = 0x1837, + snd_se_ToonLink_down01 = 0x1838, + snd_se_ToonLink_down02 = 0x1839, + snd_se_toonlink_Final01 = 0x183A, + snd_se_toonlink_Final02 = 0x183B, + snd_se_ToonLink_Final03 = 0x183C, + snd_se_ToonLink_Final04 = 0x183D, + snd_se_ToonLink_Final05 = 0x183E, + snd_se_ToonLink_jump01 = 0x183F, + snd_se_ToonLink_jump02 = 0x1840, + snd_se_ToonLink_Landing01 = 0x1841, + snd_se_ToonLink_Landing02 = 0x1842, + snd_se_ToonLink_smash_H01 = 0x1843, + snd_se_ToonLink_smash_H02 = 0x1844, + snd_se_ToonLink_smash_H03 = 0x1845, + snd_se_ToonLink_smash_H04 = 0x1846, + snd_se_ToonLink_smash_H05 = 0x1847, + snd_se_ToonLink_smash_L01 = 0x1848, + snd_se_ToonLink_smash_L02 = 0x1849, + snd_se_ToonLink_smash_L03 = 0x184A, + snd_se_ToonLink_smash_L04 = 0x184B, + snd_se_ToonLink_smash_L05 = 0x184C, + snd_se_ToonLink_smash_S01 = 0x184D, + snd_se_ToonLink_smash_S02 = 0x184E, + snd_se_ToonLink_smash_S03 = 0x184F, + snd_se_ToonLink_smash_S04 = 0x1850, + snd_se_ToonLink_smash_S05 = 0x1851, + snd_se_ToonLink_Special_H01 = 0x1852, + snd_se_ToonLink_Special_H02 = 0x1853, + snd_se_ToonLink_Special_H03 = 0x1854, + snd_se_ToonLink_Special_H04 = 0x1855, + snd_se_ToonLink_Special_H05 = 0x1856, + snd_se_toonlink_Special_L01 = 0x1857, + snd_se_ToonLink_Special_L02 = 0x1858, + snd_se_ToonLink_Special_L03 = 0x1859, + snd_se_ToonLink_Special_L04 = 0x185A, + snd_se_ToonLink_Special_L05 = 0x185B, + snd_se_ToonLink_Special_N01 = 0x185C, + snd_se_ToonLink_Special_N02 = 0x185D, + snd_se_ToonLink_Special_N03 = 0x185E, + snd_se_ToonLink_Special_N04 = 0x185F, + snd_se_ToonLink_Special_N05 = 0x1860, + snd_se_ToonLink_Special_S01 = 0x1861, + snd_se_ToonLink_Special_S02 = 0x1862, + snd_se_ToonLink_Special_S03 = 0x1863, + snd_se_ToonLink_Special_S04 = 0x1864, + snd_se_ToonLink_Special_S05 = 0x1865, + snd_se_ToonLink_squat = 0x1866, + snd_se_ToonLink_step_hidari_m = 0x1867, + snd_se_ToonLink_step_hidari_s = 0x1868, + snd_se_ToonLink_step_migi_m = 0x1869, + snd_se_ToonLink_step_migi_s = 0x186A, + snd_se_ToonLink_swing_l = 0x186B, + snd_se_ToonLink_swing_ll = 0x186C, + snd_se_ToonLink_swing_m = 0x186D, + snd_se_ToonLink_swing_s = 0x186E, + snd_se_ToonLink_turn = 0x186F, + snd_se_ToonLink_turn_run = 0x1870, + snd_se_ToonLink_ukemi = 0x1871, + snd_se_ToonLink_Wait1 = 0x1872, + snd_se_ToonLink_Wait2 = 0x1873, + snd_se_ToonLink_Wait3 = 0x1874, + snd_se_ToonLink_wear = 0x1875, + snd_se_Wolf_001 = 0x1876, + snd_se_Wolf_002 = 0x1877, + snd_se_Wolf_003 = 0x1878, + snd_se_Wolf_004 = 0x1879, + snd_se_Wolf_005 = 0x187A, + snd_se_Wolf_006 = 0x187B, + snd_se_Wolf_007 = 0x187C, + snd_se_Wolf_008 = 0x187D, + snd_se_Wolf_009 = 0x187E, + snd_se_Wolf_010 = 0x187F, + snd_se_Wolf_011 = 0x1880, + snd_se_Wolf_012 = 0x1881, + snd_se_Wolf_013 = 0x1882, + snd_se_Wolf_014 = 0x1883, + snd_se_Wolf_015 = 0x1884, + snd_se_Wolf_016 = 0x1885, + snd_se_Wolf_017 = 0x1886, + snd_se_Wolf_018 = 0x1887, + snd_se_Wolf_019 = 0x1888, + snd_se_Wolf_020 = 0x1889, + snd_se_Wolf_021 = 0x188A, + snd_se_Wolf_022 = 0x188B, + snd_se_Wolf_046 = 0x188C, + snd_se_Wolf_047 = 0x188D, + snd_se_Wolf_048 = 0x188E, + snd_se_Wolf_049 = 0x188F, + snd_se_Wolf_050 = 0x1890, + snd_se_Wolf_Attack_l = 0x1891, + snd_se_Wolf_Attack_ll = 0x1892, + snd_se_Wolf_Attack_m = 0x1893, + snd_se_Wolf_Attack_s = 0x1894, + snd_se_Wolf_Attack100 = 0x1895, + snd_se_Wolf_BodyPress01 = 0x1896, + snd_se_Wolf_BodyPress02 = 0x1897, + snd_se_Wolf_dash_start = 0x1898, + snd_se_Wolf_dash_stop = 0x1899, + snd_se_Wolf_down01 = 0x189A, + snd_se_Wolf_down02 = 0x189B, + snd_se_Wolf_Final01 = 0x189C, + snd_se_Wolf_Final02 = 0x189D, + snd_se_Wolf_Final03 = 0x189E, + snd_se_Wolf_Final04 = 0x189F, + snd_se_Wolf_Final05 = 0x18A0, + snd_se_Wolf_jump01 = 0x18A1, + snd_se_Wolf_jump02 = 0x18A2, + snd_se_Wolf_Landing01 = 0x18A3, + snd_se_Wolf_Landing02 = 0x18A4, + snd_se_Wolf_smash_H01 = 0x18A5, + snd_se_Wolf_smash_H02 = 0x18A6, + snd_se_Wolf_smash_H03 = 0x18A7, + snd_se_Wolf_smash_H04 = 0x18A8, + snd_se_Wolf_smash_H05 = 0x18A9, + snd_se_Wolf_smash_L01 = 0x18AA, + snd_se_Wolf_smash_L02 = 0x18AB, + snd_se_Wolf_smash_L03 = 0x18AC, + snd_se_Wolf_smash_L04 = 0x18AD, + snd_se_Wolf_smash_L05 = 0x18AE, + snd_se_Wolf_smash_S01 = 0x18AF, + snd_se_Wolf_smash_S02 = 0x18B0, + snd_se_Wolf_smash_S03 = 0x18B1, + snd_se_Wolf_smash_S04 = 0x18B2, + snd_se_Wolf_smash_S05 = 0x18B3, + snd_se_Wolf_Special_H01 = 0x18B4, + snd_se_Wolf_Special_H02 = 0x18B5, + snd_se_Wolf_Special_H03 = 0x18B6, + snd_se_Wolf_Special_H04 = 0x18B7, + snd_se_Wolf_Special_H05 = 0x18B8, + snd_se_Wolf_Special_L01 = 0x18B9, + snd_se_Wolf_Special_L02 = 0x18BA, + snd_se_Wolf_Special_L03 = 0x18BB, + snd_se_Wolf_Special_L04 = 0x18BC, + snd_se_Wolf_Special_L05 = 0x18BD, + snd_se_Wolf_Special_N01 = 0x18BE, + snd_se_Wolf_Special_N02 = 0x18BF, + snd_se_Wolf_Special_N03 = 0x18C0, + snd_se_Wolf_Special_N04 = 0x18C1, + snd_se_Wolf_Special_N05 = 0x18C2, + snd_se_Wolf_Special_S01 = 0x18C3, + snd_se_Wolf_Special_S02 = 0x18C4, + snd_se_Wolf_Special_S03 = 0x18C5, + snd_se_Wolf_Special_S04 = 0x18C6, + snd_se_Wolf_Special_S05 = 0x18C7, + snd_se_Wolf_squat = 0x18C8, + snd_se_Wolf_step_hidari_m = 0x18C9, + snd_se_Wolf_step_hidari_s = 0x18CA, + snd_se_Wolf_step_migi_m = 0x18CB, + snd_se_Wolf_step_migi_s = 0x18CC, + snd_se_Wolf_swing_l = 0x18CD, + snd_se_Wolf_swing_ll = 0x18CE, + snd_se_Wolf_swing_m = 0x18CF, + snd_se_Wolf_swing_s = 0x18D0, + snd_se_Wolf_turn = 0x18D1, + snd_se_Wolf_turn_run = 0x18D2, + snd_se_Wolf_ukemi = 0x18D3, + snd_se_Wolf_Wait1 = 0x18D4, + snd_se_Wolf_Wait2 = 0x18D5, + snd_se_Wolf_Wait3 = 0x18D6, + snd_se_Wolf_wear = 0x18D7, + snd_se_snake_001 = 0x18D8, + snd_se_snake_002 = 0x18D9, + snd_se_snake_003 = 0x18DA, + snd_se_snake_004 = 0x18DB, + snd_se_snake_005 = 0x18DC, + snd_se_snake_006 = 0x18DD, + snd_se_snake_007 = 0x18DE, + snd_se_snake_008 = 0x18DF, + snd_se_snake_009 = 0x18E0, + snd_se_snake_010 = 0x18E1, + snd_se_snake_011 = 0x18E2, + snd_se_snake_012 = 0x18E3, + snd_se_snake_013 = 0x18E4, + snd_se_snake_014 = 0x18E5, + snd_se_snake_015 = 0x18E6, + snd_se_snake_016 = 0x18E7, + snd_se_snake_017 = 0x18E8, + snd_se_snake_018 = 0x18E9, + snd_se_snake_019 = 0x18EA, + snd_se_snake_020 = 0x18EB, + snd_se_snake_021 = 0x18EC, + snd_se_snake_022 = 0x18ED, + snd_se_snake_023 = 0x18EE, + snd_se_snake_024 = 0x18EF, + snd_se_snake_025 = 0x18F0, + snd_se_snake_026 = 0x18F1, + snd_se_snake_027 = 0x18F2, + snd_se_snake_028 = 0x18F3, + snd_se_snake_029 = 0x18F4, + snd_se_snake_030 = 0x18F5, + snd_se_snake_031 = 0x18F6, + snd_se_snake_032 = 0x18F7, + snd_se_snake_033 = 0x18F8, + snd_se_snake_034 = 0x18F9, + snd_se_snake_035 = 0x18FA, + snd_se_snake_036 = 0x18FB, + snd_se_snake_037 = 0x18FC, + snd_se_snake_038 = 0x18FD, + snd_se_snake_039 = 0x18FE, + snd_se_snake_040 = 0x18FF, + snd_se_snake_041 = 0x1900, + snd_se_snake_042 = 0x1901, + snd_se_snake_046 = 0x1902, + snd_se_snake_047 = 0x1903, + snd_se_snake_048 = 0x1904, + snd_se_snake_049 = 0x1905, + snd_se_snake_050 = 0x1906, + snd_se_snake_Attack_l = 0x1907, + snd_se_snake_Attack_ll = 0x1908, + snd_se_snake_Attack_m = 0x1909, + snd_se_snake_Attack_s = 0x190A, + snd_se_snake_Attack100 = 0x190B, + snd_se_snake_BodyPress01 = 0x190C, + snd_se_snake_BodyPress02 = 0x190D, + snd_se_snake_dash_start = 0x190E, + snd_se_snake_dash_stop = 0x190F, + snd_se_snake_down01 = 0x1910, + snd_se_snake_down02 = 0x1911, + snd_se_snake_Final01 = 0x1912, + snd_se_snake_Final02 = 0x1913, + snd_se_snake_Final03 = 0x1914, + snd_se_snake_Final04 = 0x1915, + snd_se_snake_Final05 = 0x1916, + snd_se_snake_jump01 = 0x1917, + snd_se_snake_jump02 = 0x1918, + snd_se_snake_Landing01 = 0x1919, + snd_se_snake_Landing02 = 0x191A, + snd_se_snake_smash_H01 = 0x191B, + snd_se_snake_smash_H02 = 0x191C, + snd_se_snake_smash_H03 = 0x191D, + snd_se_snake_smash_H04 = 0x191E, + snd_se_snake_smash_H05 = 0x191F, + snd_se_snake_smash_L01 = 0x1920, + snd_se_snake_smash_L02 = 0x1921, + snd_se_snake_smash_L03 = 0x1922, + snd_se_snake_smash_L04 = 0x1923, + snd_se_snake_smash_L05 = 0x1924, + snd_se_snake_smash_S01 = 0x1925, + snd_se_snake_smash_S02 = 0x1926, + snd_se_snake_smash_S03 = 0x1927, + snd_se_snake_smash_S04 = 0x1928, + snd_se_snake_smash_S05 = 0x1929, + snd_se_snake_Special_H01 = 0x192A, + snd_se_snake_Special_H02 = 0x192B, + snd_se_snake_Special_H03 = 0x192C, + snd_se_snake_Special_H04 = 0x192D, + snd_se_snake_Special_H05 = 0x192E, + snd_se_snake_Special_L01 = 0x192F, + snd_se_snake_Special_L02 = 0x1930, + snd_se_snake_Special_L03 = 0x1931, + snd_se_snake_Special_L04 = 0x1932, + snd_se_snake_Special_L05 = 0x1933, + snd_se_snake_Special_N01 = 0x1934, + snd_se_snake_Special_N02 = 0x1935, + snd_se_snake_Special_N03 = 0x1936, + snd_se_snake_Special_N04 = 0x1937, + snd_se_snake_Special_N05 = 0x1938, + snd_se_snake_Special_S01 = 0x1939, + snd_se_snake_Special_S02 = 0x193A, + snd_se_snake_Special_S03 = 0x193B, + snd_se_snake_Special_S04 = 0x193C, + snd_se_snake_Special_S05 = 0x193D, + snd_se_snake_squat = 0x193E, + snd_se_snake_step_hidari_m = 0x193F, + snd_se_snake_step_hidari_s = 0x1940, + snd_se_snake_step_migi_m = 0x1941, + snd_se_snake_step_migi_s = 0x1942, + snd_se_snake_swing_l = 0x1943, + snd_se_snake_swing_ll = 0x1944, + snd_se_snake_swing_m = 0x1945, + snd_se_snake_swing_s = 0x1946, + snd_se_snake_turn = 0x1947, + snd_se_snake_turn_run = 0x1948, + snd_se_snake_ukemi = 0x1949, + snd_se_snake_Wait1 = 0x194A, + snd_se_snake_Wait2 = 0x194B, + snd_se_snake_Wait3 = 0x194C, + snd_se_snake_wear = 0x194D, + snd_se_Sonic_001 = 0x194E, + snd_se_Sonic_002 = 0x194F, + snd_se_Sonic_003 = 0x1950, + snd_se_Sonic_004 = 0x1951, + snd_se_Sonic_005 = 0x1952, + snd_se_Sonic_006 = 0x1953, + snd_se_Sonic_007 = 0x1954, + snd_se_Sonic_008 = 0x1955, + snd_se_Sonic_009 = 0x1956, + snd_se_Sonic_010 = 0x1957, + snd_se_Sonic_011 = 0x1958, + snd_se_Sonic_012 = 0x1959, + snd_se_Sonic_013 = 0x195A, + snd_se_Sonic_014 = 0x195B, + snd_se_Sonic_015 = 0x195C, + snd_se_Sonic_016 = 0x195D, + snd_se_Sonic_017 = 0x195E, + snd_se_Sonic_018 = 0x195F, + snd_se_Sonic_019 = 0x1960, + snd_se_Sonic_046 = 0x1961, + snd_se_Sonic_047 = 0x1962, + snd_se_Sonic_048 = 0x1963, + snd_se_Sonic_049 = 0x1964, + snd_se_Sonic_050 = 0x1965, + snd_se_Sonic_Attack_l = 0x1966, + snd_se_Sonic_Attack_ll = 0x1967, + snd_se_Sonic_Attack_m = 0x1968, + snd_se_Sonic_Attack_s = 0x1969, + snd_se_Sonic_Attack100 = 0x196A, + snd_se_Sonic_BodyPress01 = 0x196B, + snd_se_Sonic_BodyPress02 = 0x196C, + snd_se_Sonic_dash_start = 0x196D, + snd_se_Sonic_dash_stop = 0x196E, + snd_se_Sonic_down01 = 0x196F, + snd_se_Sonic_down02 = 0x1970, + snd_se_Sonic_Final01 = 0x1971, + snd_se_Sonic_Final02 = 0x1972, + snd_se_Sonic_Final03 = 0x1973, + snd_se_Sonic_Final04 = 0x1974, + snd_se_Sonic_Final05 = 0x1975, + snd_se_Sonic_jump01 = 0x1976, + snd_se_Sonic_jump02 = 0x1977, + snd_se_Sonic_Landing01 = 0x1978, + snd_se_Sonic_Landing02 = 0x1979, + snd_se_Sonic_smash_H01 = 0x197A, + snd_se_Sonic_smash_H02 = 0x197B, + snd_se_Sonic_smash_H03 = 0x197C, + snd_se_Sonic_smash_H04 = 0x197D, + snd_se_Sonic_smash_H05 = 0x197E, + snd_se_Sonic_smash_L01 = 0x197F, + snd_se_Sonic_smash_L02 = 0x1980, + snd_se_Sonic_smash_L03 = 0x1981, + snd_se_Sonic_smash_L04 = 0x1982, + snd_se_Sonic_smash_L05 = 0x1983, + snd_se_Sonic_smash_S01 = 0x1984, + snd_se_Sonic_smash_S02 = 0x1985, + snd_se_Sonic_smash_S03 = 0x1986, + snd_se_Sonic_smash_S04 = 0x1987, + snd_se_Sonic_smash_S05 = 0x1988, + snd_se_Sonic_Special_H01 = 0x1989, + snd_se_Sonic_Special_H02 = 0x198A, + snd_se_Sonic_Special_H03 = 0x198B, + snd_se_Sonic_Special_H04 = 0x198C, + snd_se_Sonic_Special_H05 = 0x198D, + snd_se_Sonic_Special_L01 = 0x198E, + snd_se_Sonic_Special_L02 = 0x198F, + snd_se_Sonic_Special_L03 = 0x1990, + snd_se_Sonic_Special_L04 = 0x1991, + snd_se_Sonic_Special_L05 = 0x1992, + snd_se_Sonic_Special_N01 = 0x1993, + snd_se_Sonic_Special_N02 = 0x1994, + snd_se_Sonic_Special_N03 = 0x1995, + snd_se_Sonic_Special_N04 = 0x1996, + snd_se_Sonic_Special_N05 = 0x1997, + snd_se_Sonic_Special_S01 = 0x1998, + snd_se_Sonic_Special_S02 = 0x1999, + snd_se_Sonic_Special_S03 = 0x199A, + snd_se_Sonic_Special_S04 = 0x199B, + snd_se_Sonic_Special_S05 = 0x199C, + snd_se_Sonic_squat = 0x199D, + snd_se_Sonic_step_hidari_m = 0x199E, + snd_se_Sonic_step_hidari_s = 0x199F, + snd_se_Sonic_step_migi_m = 0x19A0, + snd_se_Sonic_step_migi_s = 0x19A1, + snd_se_Sonic_swing_l = 0x19A2, + snd_se_Sonic_swing_ll = 0x19A3, + snd_se_Sonic_swing_m = 0x19A4, + snd_se_Sonic_swing_s = 0x19A5, + snd_se_Sonic_turn = 0x19A6, + snd_se_Sonic_turn_run = 0x19A7, + snd_se_Sonic_ukemi = 0x19A8, + snd_se_Sonic_Wait1 = 0x19A9, + snd_se_Sonic_Wait2 = 0x19AA, + snd_se_Sonic_Wait3 = 0x19AB, + snd_se_Sonic_wear = 0x19AC, + snd_vc_select_captain = 0x19AD, + snd_vc_select_dedede = 0x19AE, + snd_vc_select_diddy = 0x19AF, + snd_vc_select_donkey = 0x19B0, + snd_vc_select_falco = 0x19B1, + snd_vc_select_fox = 0x19B2, + snd_vc_select_gamewatch = 0x19B3, + snd_vc_select_ganon = 0x19B4, + snd_vc_select_iceclimber = 0x19B5, + snd_vc_select_ike = 0x19B6, + snd_vc_select_kirby = 0x19B7, + snd_vc_select_koopa = 0x19B8, + snd_vc_select_link = 0x19B9, + snd_vc_select_lucario = 0x19BA, + snd_vc_select_lucas = 0x19BB, + snd_vc_select_luigi = 0x19BC, + snd_vc_select_mario = 0x19BD, + snd_vc_select_marth = 0x19BE, + snd_vc_select_metaknight = 0x19BF, + snd_vc_select_mewtwo = 0x19C0, + snd_vc_select_ness = 0x19C1, + snd_vc_select_peach = 0x19C2, + snd_vc_select_pikachu = 0x19C3, + snd_vc_select_pikmin = 0x19C4, + snd_vc_select_pit = 0x19C5, + snd_vc_select_pokefushigisou = 0x19C6, + snd_vc_select_pokelizardon = 0x19C7, + snd_vc_select_poketrainer = 0x19C8, + snd_vc_select_pokezenigame = 0x19C9, + snd_vc_select_purin = 0x19CA, + snd_vc_select_robot = 0x19CB, + snd_vc_select_samus = 0x19CC, + snd_vc_select_sheik = 0x19CD, + snd_vc_select_snake = 0x19CE, + snd_vc_select_sonic = 0x19CF, + snd_vc_select_szerosuit = 0x19D0, + snd_vc_select_toonlink = 0x19D1, + snd_vc_select_wario = 0x19D2, + snd_vc_select_wolf = 0x19D3, + snd_vc_select_yoshi = 0x19D4, + snd_vc_select_zelda = 0x19D5, + snd_se_Gkoopa_001 = 0x19D6, + snd_se_Gkoopa_002 = 0x19D7, + snd_se_Gkoopa_003 = 0x19D8, + snd_se_Gkoopa_004 = 0x19D9, + snd_se_Gkoopa_005 = 0x19DA, + snd_se_Gkoopa_006 = 0x19DB, + snd_se_Gkoopa_007 = 0x19DC, + snd_se_Gkoopa_008 = 0x19DD, + snd_se_Gkoopa_009 = 0x19DE, + snd_se_Gkoopa_010 = 0x19DF, + snd_se_Gkoopa_011 = 0x19E0, + snd_se_Gkoopa_012 = 0x19E1, + snd_se_Gkoopa_013 = 0x19E2, + snd_se_Gkoopa_014 = 0x19E3, + snd_se_Gkoopa_015 = 0x19E4, + snd_se_Gkoopa_016 = 0x19E5, + snd_se_Gkoopa_017 = 0x19E6, + snd_se_Gkoopa_018 = 0x19E7, + snd_se_Gkoopa_019 = 0x19E8, + snd_se_Gkoopa_020 = 0x19E9, + snd_se_Gkoopa_021 = 0x19EA, + snd_se_Gkoopa_022 = 0x19EB, + snd_se_Gkoopa_023 = 0x19EC, + snd_se_Gkoopa_024 = 0x19ED, + snd_se_Gkoopa_046 = 0x19EE, + snd_se_Gkoopa_047 = 0x19EF, + snd_se_Gkoopa_048 = 0x19F0, + snd_se_Gkoopa_049 = 0x19F1, + snd_se_Gkoopa_050 = 0x19F2, + snd_se_Gkoopa_Attack_l = 0x19F3, + snd_se_Gkoopa_Attack_ll = 0x19F4, + snd_se_Gkoopa_Attack_m = 0x19F5, + snd_se_Gkoopa_Attack_s = 0x19F6, + snd_se_Gkoopa_Attack100 = 0x19F7, + snd_se_Gkoopa_BodyPress01 = 0x19F8, + snd_se_Gkoopa_BodyPress02 = 0x19F9, + snd_se_Gkoopa_dash_start = 0x19FA, + snd_se_Gkoopa_dash_stop = 0x19FB, + snd_se_Gkoopa_down01 = 0x19FC, + snd_se_Gkoopa_down02 = 0x19FD, + snd_se_Gkoopa_Final01 = 0x19FE, + snd_se_Gkoopa_Final02 = 0x19FF, + snd_se_Gkoopa_Final03 = 0x1A00, + snd_se_Gkoopa_Final04 = 0x1A01, + snd_se_Gkoopa_Final05 = 0x1A02, + snd_se_Gkoopa_jump01 = 0x1A03, + snd_se_Gkoopa_jump02 = 0x1A04, + snd_se_Gkoopa_Landing01 = 0x1A05, + snd_se_Gkoopa_Landing02 = 0x1A06, + snd_se_Gkoopa_smash_H01 = 0x1A07, + snd_se_Gkoopa_smash_H02 = 0x1A08, + snd_se_Gkoopa_smash_H03 = 0x1A09, + snd_se_Gkoopa_smash_H04 = 0x1A0A, + snd_se_Gkoopa_smash_H05 = 0x1A0B, + snd_se_Gkoopa_smash_L01 = 0x1A0C, + snd_se_Gkoopa_smash_L02 = 0x1A0D, + snd_se_Gkoopa_smash_L03 = 0x1A0E, + snd_se_Gkoopa_smash_L04 = 0x1A0F, + snd_se_Gkoopa_smash_L05 = 0x1A10, + snd_se_Gkoopa_smash_S01 = 0x1A11, + snd_se_Gkoopa_smash_S02 = 0x1A12, + snd_se_Gkoopa_smash_S03 = 0x1A13, + snd_se_Gkoopa_smash_S04 = 0x1A14, + snd_se_Gkoopa_smash_S05 = 0x1A15, + snd_se_Gkoopa_Special_H01 = 0x1A16, + snd_se_Gkoopa_Special_H02 = 0x1A17, + snd_se_Gkoopa_Special_H03 = 0x1A18, + snd_se_Gkoopa_Special_H04 = 0x1A19, + snd_se_Gkoopa_Special_H05 = 0x1A1A, + snd_se_Gkoopa_Special_L01 = 0x1A1B, + snd_se_Gkoopa_Special_L02 = 0x1A1C, + snd_se_Gkoopa_Special_L03 = 0x1A1D, + snd_se_Gkoopa_Special_L04 = 0x1A1E, + snd_se_Gkoopa_Special_L05 = 0x1A1F, + snd_se_Gkoopa_Special_N01 = 0x1A20, + snd_se_Gkoopa_Special_N02 = 0x1A21, + snd_se_Gkoopa_Special_N03 = 0x1A22, + snd_se_Gkoopa_Special_N04 = 0x1A23, + snd_se_Gkoopa_Special_N05 = 0x1A24, + snd_se_Gkoopa_Special_S01 = 0x1A25, + snd_se_Gkoopa_Special_S02 = 0x1A26, + snd_se_Gkoopa_Special_S03 = 0x1A27, + snd_se_Gkoopa_Special_S04 = 0x1A28, + snd_se_Gkoopa_Special_S05 = 0x1A29, + snd_se_Gkoopa_squat = 0x1A2A, + snd_se_Gkoopa_step_hidari_m = 0x1A2B, + snd_se_Gkoopa_step_hidari_s = 0x1A2C, + snd_se_Gkoopa_step_migi_m = 0x1A2D, + snd_se_Gkoopa_step_migi_s = 0x1A2E, + snd_se_Gkoopa_swing_l = 0x1A2F, + snd_se_Gkoopa_swing_ll = 0x1A30, + snd_se_Gkoopa_swing_m = 0x1A31, + snd_se_Gkoopa_swing_s = 0x1A32, + snd_se_Gkoopa_turn = 0x1A33, + snd_se_Gkoopa_turn_run = 0x1A34, + snd_se_Gkoopa_ukemi = 0x1A35, + snd_se_Gkoopa_Wait1 = 0x1A36, + snd_se_Gkoopa_Wait2 = 0x1A37, + snd_se_Gkoopa_Wait3 = 0x1A38, + snd_se_Gkoopa_wear = 0x1A39, + snd_vc_Gkoopa_001 = 0x1A3A, + snd_vc_Gkoopa_002 = 0x1A3B, + snd_vc_Gkoopa_003 = 0x1A3C, + snd_vc_Gkoopa_004 = 0x1A3D, + snd_vc_Gkoopa_005 = 0x1A3E, + snd_vc_Gkoopa_046 = 0x1A3F, + snd_vc_Gkoopa_047 = 0x1A40, + snd_vc_Gkoopa_048 = 0x1A41, + snd_vc_Gkoopa_049 = 0x1A42, + snd_vc_Gkoopa_050 = 0x1A43, + snd_vc_Gkoopa_Appeal01 = 0x1A44, + snd_vc_Gkoopa_Appeal02 = 0x1A45, + snd_vc_Gkoopa_Appeal03 = 0x1A46, + snd_vc_Gkoopa_Attack01 = 0x1A47, + snd_vc_Gkoopa_Attack02 = 0x1A48, + snd_vc_Gkoopa_Attack03 = 0x1A49, + snd_vc_Gkoopa_Attack04 = 0x1A4A, + snd_vc_Gkoopa_Attack05 = 0x1A4B, + snd_vc_Gkoopa_Attack06 = 0x1A4C, + snd_vc_Gkoopa_Attack07 = 0x1A4D, + snd_vc_Gkoopa_CliffCatch = 0x1A4E, + snd_vc_Gkoopa_Damage_hoshikie = 0x1A4F, + snd_vc_Gkoopa_Damage01 = 0x1A50, + snd_vc_Gkoopa_Damage02 = 0x1A51, + snd_vc_Gkoopa_DamageFly01 = 0x1A52, + snd_vc_Gkoopa_DamageFly02 = 0x1A53, + snd_vc_Gkoopa_FuraFura = 0x1A54, + snd_vc_Gkoopa_FuraSleep = 0x1A55, + snd_vc_Gkoopa_HeavyGet = 0x1A56, + snd_vc_Gkoopa_Jump01 = 0x1A57, + snd_vc_Gkoopa_Jump02 = 0x1A58, + snd_vc_Gkoopa_MissFoot01 = 0x1A59, + snd_vc_Gkoopa_MissFoot02 = 0x1A5A, + snd_vc_Gkoopa_Ottotto = 0x1A5B, + snd_vc_Gkoopa_Passive = 0x1A5C, + snd_vc_Gkoopa_SwimUp = 0x1A5D, + snd_vc_Gkoopa_Win01 = 0x1A5E, + snd_vc_Gkoopa_Win02 = 0x1A5F, + snd_vc_Gkoopa_Win03 = 0x1A60, + snd_se_ZakoBlue_001 = 0x1A61, + snd_se_ZakoBlue_002 = 0x1A62, + snd_se_ZakoBlue_003 = 0x1A63, + snd_se_ZakoBlue_004 = 0x1A64, + snd_se_ZakoBlue_005 = 0x1A65, + snd_se_ZakoBlue_dash_start = 0x1A66, + snd_se_ZakoBlue_dush_stop = 0x1A67, + snd_se_ZakoBlue_jump01 = 0x1A68, + snd_se_ZakoBlue_jump02 = 0x1A69, + snd_se_ZakoBlue_Landing01 = 0x1A6A, + snd_se_ZakoBlue_Landing02 = 0x1A6B, + snd_se_ZakoBlue_squat01 = 0x1A6C, + snd_se_ZakoBlue_squat02 = 0x1A6D, + snd_se_ZakoBlue_Step_hidari = 0x1A6E, + snd_se_ZakoBlue_Step_migi = 0x1A6F, + snd_se_ZakoBlue_swing_l = 0x1A70, + snd_se_ZakoBlue_swing_m = 0x1A71, + snd_se_ZakoBlue_swing_s = 0x1A72, + snd_se_ZakoGreen_001 = 0x1A73, + snd_se_ZakoGreen_002 = 0x1A74, + snd_se_ZakoGreen_003 = 0x1A75, + snd_se_ZakoGreen_004 = 0x1A76, + snd_se_ZakoGreen_005 = 0x1A77, + snd_se_ZakoGreen_dash_start = 0x1A78, + snd_se_ZakoGreen_dush_stop = 0x1A79, + snd_se_ZakoGreen_jump01 = 0x1A7A, + snd_se_ZakoGreen_jump02 = 0x1A7B, + snd_se_ZakoGreen_Landing01 = 0x1A7C, + snd_se_ZakoGreen_Landing02 = 0x1A7D, + snd_se_ZakoGreen_squat01 = 0x1A7E, + snd_se_ZakoGreen_squat02 = 0x1A7F, + snd_se_ZakoGreen_Step_hidari = 0x1A80, + snd_se_ZakoGreen_Step_migi = 0x1A81, + snd_se_ZakoGreen_swing_l = 0x1A82, + snd_se_ZakoGreen_swing_m = 0x1A83, + snd_se_ZakoGreen_swing_s = 0x1A84, + snd_se_ZakoRed_001 = 0x1A85, + snd_se_ZakoRed_002 = 0x1A86, + snd_se_ZakoRed_003 = 0x1A87, + snd_se_ZakoRed_004 = 0x1A88, + snd_se_ZakoRed_005 = 0x1A89, + snd_se_ZakoRed_dash_start = 0x1A8A, + snd_se_ZakoRed_dush_stop = 0x1A8B, + snd_se_ZakoRed_jump01 = 0x1A8C, + snd_se_ZakoRed_jump02 = 0x1A8D, + snd_se_ZakoRed_Landing01 = 0x1A8E, + snd_se_ZakoRed_Landing02 = 0x1A8F, + snd_se_ZakoRed_squat01 = 0x1A90, + snd_se_ZakoRed_squat02 = 0x1A91, + snd_se_ZakoRed_Step_hidari = 0x1A92, + snd_se_ZakoRed_Step_migi = 0x1A93, + snd_se_ZakoRed_swing_l = 0x1A94, + snd_se_ZakoRed_swing_m = 0x1A95, + snd_se_ZakoRed_swing_s = 0x1A96, + snd_se_ZakoYellow_001 = 0x1A97, + snd_se_ZakoYellow_002 = 0x1A98, + snd_se_ZakoYellow_003 = 0x1A99, + snd_se_ZakoYellow_004 = 0x1A9A, + snd_se_ZakoYellow_005 = 0x1A9B, + snd_se_ZakoYellow_dash_start = 0x1A9C, + snd_se_ZakoYellow_dush_stop = 0x1A9D, + snd_se_ZakoYellow_jump01 = 0x1A9E, + snd_se_ZakoYellow_jump02 = 0x1A9F, + snd_se_ZakoYellow_Landing01 = 0x1AA0, + snd_se_ZakoYellow_Landing02 = 0x1AA1, + snd_se_ZakoYellow_squat01 = 0x1AA2, + snd_se_ZakoYellow_squat02 = 0x1AA3, + snd_se_ZakoYellow_Step_hidari = 0x1AA4, + snd_se_ZakoYellow_Step_migi = 0x1AA5, + snd_se_ZakoYellow_swing_l = 0x1AA6, + snd_se_ZakoYellow_swing_m = 0x1AA7, + snd_se_ZakoYellow_swing_s = 0x1AA8, + snd_vc_kirby_copy_Captain_01 = 0x1AA9, + snd_vc_kirby_copy_Captain_02 = 0x1AAA, + snd_se_kirby_copy_Captain_01 = 0x1AAB, + snd_se_kirby_copy_Captain_02 = 0x1AAC, + snd_vc_kirby_copy_Dedede_01 = 0x1AAD, + snd_vc_kirby_copy_Dedede_02 = 0x1AAE, + snd_se_kirby_copy_Dedede_01 = 0x1AAF, + snd_se_kirby_copy_Dedede_02 = 0x1AB0, + snd_vc_kirby_copy_Diddy_01 = 0x1AB1, + snd_vc_kirby_copy_Diddy_02 = 0x1AB2, + snd_se_kirby_copy_Diddy_01 = 0x1AB3, + snd_se_kirby_copy_Diddy_02 = 0x1AB4, + snd_vc_kirby_copy_Donkey_01 = 0x1AB5, + snd_vc_kirby_copy_Donkey_02 = 0x1AB6, + snd_se_kirby_copy_Donkey_01 = 0x1AB7, + snd_se_kirby_copy_Donkey_02 = 0x1AB8, + snd_vc_kirby_copy_Falco_02 = 0x1AB9, + snd_se_kirby_copy_Falco_02 = 0x1ABA, + snd_vc_kirby_copy_Falco_01 = 0x1ABB, + snd_se_kirby_copy_Falco_01 = 0x1ABC, + snd_vc_kirby_copy_Fox_01 = 0x1ABD, + snd_vc_kirby_copy_Fox_02 = 0x1ABE, + snd_se_kirby_copy_Fox_01 = 0x1ABF, + snd_se_kirby_copy_Fox_02 = 0x1AC0, + snd_vc_kirby_copy_GameWatch_01 = 0x1AC1, + snd_vc_kirby_copy_GameWatch_02 = 0x1AC2, + snd_se_kirby_copy_GameWatch_01 = 0x1AC3, + snd_se_kirby_copy_GameWatch_02 = 0x1AC4, + snd_vc_kirby_copy_Ganon_01 = 0x1AC5, + snd_vc_kirby_copy_Ganon_02 = 0x1AC6, + snd_se_kirby_copy_Ganon_01 = 0x1AC7, + snd_se_kirby_copy_Ganon_02 = 0x1AC8, + snd_vc_kirby_copy_GKoopa_01 = 0x1AC9, + snd_vc_kirby_copy_GKoopa_02 = 0x1ACA, + snd_se_kirby_copy_GKoopa_01 = 0x1ACB, + snd_se_kirby_copy_GKoopa_02 = 0x1ACC, + snd_vc_kirby_copy_Iceclimber_01 = 0x1ACD, + snd_vc_kirby_copy_Iceclimber_02 = 0x1ACE, + snd_se_kirby_copy_Iceclimber_01 = 0x1ACF, + snd_se_kirby_copy_Iceclimber_02 = 0x1AD0, + snd_vc_kirby_copy_Ike_01 = 0x1AD1, + snd_vc_kirby_copy_Ike_02 = 0x1AD2, + snd_se_kirby_copy_Ike_01 = 0x1AD3, + snd_se_kirby_copy_Ike_02 = 0x1AD4, + snd_vc_kirby_copy_Koopa_01 = 0x1AD5, + snd_vc_kirby_copy_Koopa_02 = 0x1AD6, + snd_se_kirby_copy_Koopa_01 = 0x1AD7, + snd_se_kirby_copy_Koopa_02 = 0x1AD8, + snd_vc_kirby_copy_Link_01 = 0x1AD9, + snd_vc_kirby_copy_Link_02 = 0x1ADA, + snd_se_kirby_copy_Link_01 = 0x1ADB, + snd_se_kirby_copy_Link_02 = 0x1ADC, + snd_vc_kirby_copy_Lucario_01 = 0x1ADD, + snd_vc_kirby_copy_Lucario_02 = 0x1ADE, + snd_se_kirby_copy_Lucario_01 = 0x1ADF, + snd_se_kirby_copy_Lucario_02 = 0x1AE0, + snd_vc_kirby_copy_Lucas_01 = 0x1AE1, + snd_vc_kirby_copy_Lucas_02 = 0x1AE2, + snd_se_kirby_copy_Lucas_01 = 0x1AE3, + snd_se_kirby_copy_Lucas_02 = 0x1AE4, + snd_vc_kirby_copy_Luigi_01 = 0x1AE5, + snd_vc_kirby_copy_Luigi_02 = 0x1AE6, + snd_se_kirby_copy_Luigi_01 = 0x1AE7, + snd_se_kirby_copy_Luigi_02 = 0x1AE8, + snd_vc_kirby_copy_Mario_01 = 0x1AE9, + snd_vc_kirby_copy_Mario_02 = 0x1AEA, + snd_se_kirby_copy_Mario_01 = 0x1AEB, + snd_se_kirby_copy_Mario_02 = 0x1AEC, + snd_vc_kirby_copy_Marth_01 = 0x1AED, + snd_vc_kirby_copy_Marth_02 = 0x1AEE, + snd_se_kirby_copy_Marth_01 = 0x1AEF, + snd_se_kirby_copy_Marth_02 = 0x1AF0, + snd_vc_kirby_copy_Metaknight_01 = 0x1AF1, + snd_vc_kirby_copy_Metaknight_02 = 0x1AF2, + snd_se_kirby_copy_Metaknight_01 = 0x1AF3, + snd_se_kirby_copy_Metaknight_02 = 0x1AF4, + snd_vc_kirby_copy_Ness_01 = 0x1AF5, + snd_vc_kirby_copy_Ness_02 = 0x1AF6, + snd_se_kirby_copy_Ness_01 = 0x1AF7, + snd_se_kirby_copy_Ness_02 = 0x1AF8, + snd_vc_kirby_copy_Peach_01 = 0x1AF9, + snd_vc_kirby_copy_Peach_02 = 0x1AFA, + snd_se_kirby_copy_Peach_01 = 0x1AFB, + snd_se_kirby_copy_Peach_02 = 0x1AFC, + snd_vc_kirby_copy_Pikachu_01 = 0x1AFD, + snd_vc_kirby_copy_Pikachu_02 = 0x1AFE, + snd_se_kirby_copy_Pikachu_01 = 0x1AFF, + snd_se_kirby_copy_Pikachu_02 = 0x1B00, + snd_vc_kirby_copy_Pikmin_01 = 0x1B01, + snd_vc_kirby_copy_Pikmin_02 = 0x1B02, + snd_se_kirby_copy_Pikmin_01 = 0x1B03, + snd_se_kirby_copy_Pikmin_02 = 0x1B04, + snd_vc_kirby_copy_Pit_01 = 0x1B05, + snd_vc_kirby_copy_Pit_02 = 0x1B06, + snd_se_kirby_copy_Pit_01 = 0x1B07, + snd_se_kirby_copy_Pit_02 = 0x1B08, + snd_vc_kirby_copy_PokeFushigisou_01 = 0x1B09, + snd_vc_kirby_copy_PokeFushigisou_02 = 0x1B0A, + snd_se_kirby_copy_PokeFushigisou_01 = 0x1B0B, + snd_se_kirby_copy_PokeFushigisou_02 = 0x1B0C, + snd_vc_kirby_copy_PokeLizardon_01 = 0x1B0D, + snd_vc_kirby_copy_PokeLizardon_02 = 0x1B0E, + snd_se_kirby_copy_PokeLizardon_01 = 0x1B0F, + snd_se_kirby_copy_PokeLizardon_02 = 0x1B10, + snd_vc_kirby_copy_PokeZenigame_01 = 0x1B11, + snd_vc_kirby_copy_PokeZenigame_02 = 0x1B12, + snd_se_kirby_copy_PokeZenigame_01 = 0x1B13, + snd_se_kirby_copy_PokeZenigame_02 = 0x1B14, + snd_vc_kirby_copy_Purin_01 = 0x1B15, + snd_vc_kirby_copy_Purin_02 = 0x1B16, + snd_se_kirby_copy_Purin_01 = 0x1B17, + snd_se_kirby_copy_Purin_02 = 0x1B18, + snd_vc_kirby_copy_Robot_01 = 0x1B19, + snd_vc_kirby_copy_Robot_02 = 0x1B1A, + snd_se_kirby_copy_Robot_01 = 0x1B1B, + snd_se_kirby_copy_Robot_02 = 0x1B1C, + snd_vc_kirby_copy_Samus_01 = 0x1B1D, + snd_vc_kirby_copy_Samus_02 = 0x1B1E, + snd_se_kirby_copy_Samus_01 = 0x1B1F, + snd_se_kirby_copy_Samus_02 = 0x1B20, + snd_vc_kirby_copy_Sheik_01 = 0x1B21, + snd_vc_kirby_copy_Sheik_02 = 0x1B22, + snd_se_kirby_copy_Sheik_01 = 0x1B23, + snd_se_kirby_copy_Sheik_02 = 0x1B24, + snd_vc_kirby_copy_Snake_01 = 0x1B25, + snd_vc_kirby_copy_Snake_02 = 0x1B26, + snd_se_kirby_copy_Snake_01 = 0x1B27, + snd_se_kirby_copy_Snake_02 = 0x1B28, + snd_vc_kirby_copy_Sonic_01 = 0x1B29, + snd_vc_kirby_copy_Sonic_02 = 0x1B2A, + snd_se_kirby_copy_Sonic_01 = 0x1B2B, + snd_se_kirby_copy_Sonic_02 = 0x1B2C, + snd_vc_kirby_copy_SZerosuit_01 = 0x1B2D, + snd_vc_kirby_copy_SZerosuit_02 = 0x1B2E, + snd_se_kirby_copy_SZerosuit_01 = 0x1B2F, + snd_se_kirby_copy_SZerosuit_02 = 0x1B30, + snd_vc_kirby_copy_ToonLink_01 = 0x1B31, + snd_vc_kirby_copy_ToonLink_02 = 0x1B32, + snd_se_kirby_copy_ToonLink_01 = 0x1B33, + snd_se_kirby_copy_ToonLink_02 = 0x1B34, + snd_vc_kirby_copy_Wario_01 = 0x1B35, + snd_vc_kirby_copy_Wario_02 = 0x1B36, + snd_se_kirby_copy_Wario_01 = 0x1B37, + snd_se_kirby_copy_Wario_02 = 0x1B38, + snd_vc_kirby_copy_WarioMan_01 = 0x1B39, + snd_vc_kirby_copy_WarioMan_02 = 0x1B3A, + snd_se_kirby_copy_WarioMan_01 = 0x1B3B, + snd_se_kirby_copy_WarioMan_02 = 0x1B3C, + snd_vc_kirby_copy_Wolf_01 = 0x1B3D, + snd_vc_kirby_copy_Wolf_02 = 0x1B3E, + snd_se_kirby_copy_Wolf_01 = 0x1B3F, + snd_se_kirby_copy_Wolf_02 = 0x1B40, + snd_vc_kirby_copy_Yoshi_01 = 0x1B41, + snd_vc_kirby_copy_Yoshi_02 = 0x1B42, + snd_se_kirby_copy_Yoshi_01 = 0x1B43, + snd_se_kirby_copy_Yoshi_02 = 0x1B44, + snd_vc_kirby_copy_Zelda_01 = 0x1B45, + snd_vc_kirby_copy_Zelda_02 = 0x1B46, + snd_se_kirby_copy_Zelda_01 = 0x1B47, + snd_se_kirby_copy_Zelda_02 = 0x1B48, + snd_bgm_seq_dedede = 0x1B49, + snd_bgm_seq_peach = 0x1B4A, + snd_bgm_seq_donkey = 0x1B4B, + snd_bgm_seq_luigi = 0x1B4C, + snd_se_stage_Dolpic_01 = 0x1B4D, + snd_se_stage_Dolpic_02 = 0x1B4E, + snd_se_stage_Dolpic_03 = 0x1B4F, + snd_se_stage_Dolpic_04 = 0x1B50, + snd_se_stage_Dolpic_05 = 0x1B51, + snd_se_stage_Dolpic_08 = 0x1B52, + snd_se_stage_Dolpic_19 = 0x1B53, + snd_se_stage_Dolpic_09 = 0x1B54, + snd_se_stage_Dolpic_10 = 0x1B55, + snd_se_stage_Dolpic_11 = 0x1B56, + snd_se_stage_Dolpic_12 = 0x1B57, + snd_se_stage_Dolpic_06 = 0x1B58, + snd_se_stage_Dolpic_13 = 0x1B59, + snd_se_stage_Dolpic_14 = 0x1B5A, + snd_se_stage_Dolpic_15 = 0x1B5B, + snd_se_stage_Dolpic_07 = 0x1B5C, + snd_se_stage_Dolpic_16 = 0x1B5D, + snd_se_stage_Dolpic_17 = 0x1B5E, + snd_se_stage_Dolpic_18 = 0x1B5F, + snd_se_stage_Mansion_post_dmg_a = 0x1B60, + snd_se_stage_Mansion_post_dmg_b = 0x1B61, + snd_se_stage_Mansion_post_dmg_c = 0x1B62, + snd_se_stage_Mansion_post_dmg_d = 0x1B63, + snd_se_stage_Mansion_08 = 0x1B64, + snd_se_stage_Mansion_09 = 0x1B65, + snd_se_stage_Mansion_10 = 0x1B66, + snd_se_stage_Mansion_11 = 0x1B67, + snd_se_stage_Mansion_01 = 0x1B68, + snd_se_stage_Mansion_02 = 0x1B69, + snd_se_stage_Mansion_03 = 0x1B6A, + snd_se_stage_Mansion_04 = 0x1B6B, + snd_se_stage_Mansion_05 = 0x1B6C, + snd_se_stage_Mansion_06 = 0x1B6D, + snd_se_stage_Mansion_break_finish = 0x1B6E, + snd_se_stage_Mansion_07 = 0x1B6F, + snd_se_stage_MarioPast_01 = 0x1B70, + snd_se_stage_MarioPast_02 = 0x1B71, + snd_se_stage_MarioPast_03 = 0x1B72, + snd_se_stage_MarioPast_04 = 0x1B73, + snd_se_stage_MarioPast_05 = 0x1B74, + snd_se_stage_MarioPast_06 = 0x1B75, + snd_se_stage_MarioPast_07 = 0x1B76, + snd_se_stage_MarioPast_08 = 0x1B77, + snd_se_stage_Kart_02 = 0x1B78, + snd_se_stage_Kart_03 = 0x1B79, + snd_se_stage_Kart_04 = 0x1B7A, + snd_se_stage_Kart_05 = 0x1B7B, + snd_se_stage_Kart_06 = 0x1B7C, + snd_se_stage_Kart_07 = 0x1B7D, + snd_se_stage_Kart_doppler_01 = 0x1B7E, + snd_se_stage_Kart_doppler_02 = 0x1B7F, + snd_se_stage_Kart_damage = 0x1B80, + snd_se_stage_Kart_spin = 0x1B81, + snd_se_stage_Kart_jump_01 = 0x1B82, + snd_se_stage_Kart_jump_02 = 0x1B83, + snd_se_stage_Kart_info = 0x1B84, + snd_se_stage_Donkey_01 = 0x1B85, + snd_se_stage_Donkey_02 = 0x1B86, + snd_se_stage_Donkey_03 = 0x1B87, + snd_se_stage_Donkey_04 = 0x1B88, + snd_se_stage_Donkey_05 = 0x1B89, + snd_se_stage_Jungle_01 = 0x1B8A, + snd_se_stage_Jungle_02 = 0x1B8B, + snd_se_stage_Jungle_03 = 0x1B8C, + snd_se_stage_Jungle_04 = 0x1B8D, + snd_se_stage_Jungle_05 = 0x1B8E, + snd_se_stage_Jungle_06 = 0x1B8F, + snd_se_stage_Jungle_air_floor = 0x1B90, + snd_se_stage_Jungle_08 = 0x1B91, + snd_se_stage_Jungle_Return = 0x1B92, + snd_se_stage_Jungle_woodbox_damage = 0x1B93, + snd_se_stage_Jungle_09 = 0x1B94, + snd_se_stage_Jungle_wall_Damage = 0x1B95, + snd_se_stage_Jungle_10 = 0x1B96, + snd_se_stage_Pirates_01 = 0x1B97, + snd_se_stage_Pirates_16 = 0x1B98, + snd_se_stage_Pirates_17 = 0x1B99, + snd_se_stage_Pirates_18 = 0x1B9A, + snd_se_stage_Pirates_19 = 0x1B9B, + snd_se_stage_Pirates_20 = 0x1B9C, + snd_se_stage_Pirates_02 = 0x1B9D, + snd_se_stage_Pirates_03 = 0x1B9E, + snd_se_stage_Pirates_04 = 0x1B9F, + snd_se_stage_Pirates_05 = 0x1BA0, + snd_se_stage_Pirates_06 = 0x1BA1, + snd_se_stage_Pirates_07 = 0x1BA2, + snd_se_stage_Pirates_08 = 0x1BA3, + snd_se_stage_Pirates_09 = 0x1BA4, + snd_se_stage_Pirates_10 = 0x1BA5, + snd_se_stage_Pirates_11 = 0x1BA6, + snd_se_stage_Pirates_12 = 0x1BA7, + snd_se_stage_Pirates_13 = 0x1BA8, + snd_se_stage_Pirates_14 = 0x1BA9, + snd_se_stage_Pirates_15 = 0x1BAA, + snd_se_stage_Pirates_warning = 0x1BAB, + snd_se_stage_Pirates_21 = 0x1BAC, + snd_se_stage_Pirates_22 = 0x1BAD, + snd_se_stage_Pirates_23 = 0x1BAE, + snd_se_stage_Pirates_24 = 0x1BAF, + snd_se_stage_Oldin_horn = 0x1BB0, + snd_se_stage_Oldin_rumble = 0x1BB1, + snd_se_stage_Oldin_step_01 = 0x1BB2, + snd_se_stage_Oldin_step_02 = 0x1BB3, + snd_se_stage_Oldin_step_03 = 0x1BB4, + snd_se_stage_Oldin_step_04 = 0x1BB5, + snd_se_stage_Oldin_bruboo_01 = 0x1BB6, + snd_se_stage_Oldin_bruboo_02 = 0x1BB7, + snd_se_stage_Oldin_bruboo_03 = 0x1BB8, + snd_se_stage_Oldin_king_01 = 0x1BB9, + snd_se_stage_Oldin_king_02 = 0x1BBA, + snd_se_stage_Oldin_bomb_throw = 0x1BBB, + snd_se_stage_Oldin_bomb_drop = 0x1BBC, + snd_se_stage_Oldin_bomb_exp = 0x1BBD, + snd_se_stage_Oldin_bridge_crash = 0x1BBE, + snd_se_stage_Oldin_bridge_revival = 0x1BBF, + snd_se_stage_Oldin_bridge_slide = 0x1BC0, + snd_se_stage_Oldin_bridge_fit = 0x1BC1, + snd_se_stage_Oldin_brublin_damage = 0x1BC2, + snd_se_stage_Norfair_01 = 0x1BC3, + snd_se_stage_Norfair_02 = 0x1BC4, + snd_se_stage_Norfair_03 = 0x1BC5, + snd_se_stage_Norfair_04 = 0x1BC6, + snd_se_stage_Norfair_prominence = 0x1BC7, + snd_se_stage_Norfair_05 = 0x1BC8, + snd_se_stage_Norfair_06 = 0x1BC9, + snd_se_stage_Norfair_07 = 0x1BCA, + snd_se_stage_Norfair_08 = 0x1BCB, + snd_se_stage_Norfair_09 = 0x1BCC, + snd_se_stage_Norfair_10 = 0x1BCD, + snd_se_stage_Orpheon_Queen_vc = 0x1BCE, + snd_se_stage_Orpheon_05 = 0x1BCF, + snd_se_stage_Orpheon_Queen_stop = 0x1BD0, + snd_se_stage_Orpheon_06 = 0x1BD1, + snd_se_stage_Orpheon_01 = 0x1BD2, + snd_se_stage_Orpheon_02 = 0x1BD3, + snd_se_stage_Orpheon_03 = 0x1BD4, + snd_se_stage_Orpheon_09 = 0x1BD5, + snd_se_stage_Orpheon_04 = 0x1BD6, + snd_se_stage_Orpheon_07 = 0x1BD7, + snd_se_stage_Orpheon_08 = 0x1BD8, + snd_se_stage_Crayon_season01 = 0x1BD9, + snd_se_stage_Crayon_season02 = 0x1BDA, + snd_se_stage_Crayon_season03 = 0x1BDB, + snd_se_stage_Crayon_season04 = 0x1BDC, + snd_se_stage_Cryon_Heiho_Fly = 0x1BDD, + snd_se_stage_Cryon_Heiho_Down = 0x1BDE, + snd_se_stage_Cryon_Heiho_Fly2 = 0x1BDF, + snd_se_stage_Crayon_LiftUp = 0x1BE0, + snd_se_stage_Halberd_Doc = 0x1BE1, + snd_se_stage_Halberd_Doc_open = 0x1BE2, + snd_se_stage_Halberd_Doc_finish = 0x1BE3, + snd_se_stage_Halberd_Warning_open = 0x1BE4, + snd_se_stage_Halberd_Warning_siren = 0x1BE5, + snd_se_stage_Halberd_01 = 0x1BE6, + snd_se_stage_Halberd_wing = 0x1BE7, + snd_se_stage_Halberd_03 = 0x1BE8, + snd_se_stage_Halberd_04 = 0x1BE9, + snd_se_stage_Halberd_05 = 0x1BEA, + snd_se_stage_Halberd_02 = 0x1BEB, + snd_se_stage_Halberd_Shutter_open = 0x1BEC, + snd_se_stage_Halberd_Shutter_stop = 0x1BED, + snd_se_stage_Halberd_Float_start = 0x1BEE, + snd_se_stage_Halberd_Float_stop = 0x1BEF, + snd_se_stage_Halberd_10 = 0x1BF0, + snd_se_stage_Halberd_06 = 0x1BF1, + snd_se_stage_Halberd_07 = 0x1BF2, + snd_se_stage_Halberd_08 = 0x1BF3, + snd_se_stage_Halberd_09 = 0x1BF4, + snd_se_stage_Halberd_Arm_start = 0x1BF5, + snd_se_stage_Halberd_Arm_stop = 0x1BF6, + snd_se_stage_Halberd_Arm_attack = 0x1BF7, + snd_se_stage_Halberd_Laser_eng = 0x1BF8, + snd_se_stage_Halberd_Laser_cover_open = 0x1BF9, + snd_se_stage_Halberd_Laser_cover_stop = 0x1BFA, + snd_se_stage_Halberd_Laser_charge = 0x1BFB, + snd_se_stage_Halberd_Laser_shot = 0x1BFC, + snd_se_stage_Halberd_finish = 0x1BFD, + snd_se_stage_Halberd_Target_01 = 0x1BFE, + snd_se_stage_Halberd_Target_02 = 0x1BFF, + snd_se_stage_Halberd_Target_close = 0x1C00, + snd_se_stage_Halberd_Hero_Up_01 = 0x1C01, + snd_se_stage_Halberd_Hero_Up_02 = 0x1C02, + snd_se_stage_Halberd_Hero_Down = 0x1C03, + snd_se_stage_Halberd_Hero_set = 0x1C04, + snd_se_stage_Halberd_Hero_fire = 0x1C05, + snd_se_stage_Halberd_Hero_shot = 0x1C06, + snd_se_stage_Halberd_Hero_exp = 0x1C07, + snd_se_stage_Starfox_warp_in = 0x1C08, + snd_se_stage_Starfox_warp_out = 0x1C09, + snd_se_stage_Starfox_pleiadians_eng = 0x1C0A, + snd_se_stage_Starfox_arwin_shot = 0x1C0B, + snd_se_stage_Starfox_arwin_shot_2 = 0x1C0C, + snd_se_stage_Starfox_arwin_eng = 0x1C0D, + snd_se_stage_Starfox_arwin_pass_01 = 0x1C0E, + snd_se_stage_Starfox_arwin_pass_02 = 0x1C0F, + snd_se_stage_Starfox_arwin_pass_03 = 0x1C10, + snd_se_stage_Starfox_arwin_pass_04 = 0x1C11, + snd_se_stage_Starfox_arwin_roll = 0x1C12, + snd_se_stage_Starfox_wolfen_shot = 0x1C13, + snd_se_stage_Starfox_wolfen_shot_2 = 0x1C14, + snd_se_stage_Starfox_wolfen_pass_01 = 0x1C15, + snd_se_stage_Starfox_wolfen_pass_02 = 0x1C16, + snd_se_stage_Starfox_wolfen_pass_03 = 0x1C17, + snd_se_stage_Starfox_wolfen_pass_04 = 0x1C18, + snd_se_stage_Starfox_greatfox_eng = 0x1C19, + snd_se_stage_Starfox_atomos_in = 0x1C1A, + snd_se_stage_Starfox_atoms_out = 0x1C1B, + snd_se_stage_Starfox_sky_amb = 0x1C1C, + snd_se_stage_Starfox_space_amb = 0x1C1D, + snd_se_stage_Starfox_asteroid_pass_01 = 0x1C1E, + snd_se_stage_Starfox_asteroid_pass_02 = 0x1C1F, + snd_se_stage_Starfox_asteroid_pass_03 = 0x1C20, + snd_se_stage_Starfox_asteroid_pass_04 = 0x1C21, + snd_se_stage_Starfox_asteroid_pass_05 = 0x1C22, + snd_se_stage_Starfox_asteroid_pass_06 = 0x1C23, + snd_se_stage_Starfox_asteroid_crash = 0x1C24, + snd_se_stage_Starfox_friendship_fire = 0x1C25, + snd_se_stage_Starfox_friendship_fire_2 = 0x1C26, + snd_se_stage_Starfox_friendship_eng = 0x1C27, + snd_se_stage_Starfox_enemyship_fire = 0x1C28, + snd_se_stage_Starfox_enemyship_fire_2 = 0x1C29, + snd_se_stage_Starfox_enemyship_eng = 0x1C2A, + snd_se_stage_Starfox_friendship_damage = 0x1C2B, + snd_se_stage_Starfox_friendship_exp = 0x1C2C, + snd_se_stage_Starfox_through = 0x1C2D, + snd_se_stage_Stadium_01 = 0x1C2E, + snd_se_stage_Stadium_02 = 0x1C2F, + snd_se_stage_Stadium_03 = 0x1C30, + snd_se_stage_Stadium_ground_finish = 0x1C31, + snd_se_stage_Stadium_04 = 0x1C32, + snd_se_stage_Stadium_ice_finish = 0x1C33, + snd_se_stage_Stadium_05 = 0x1C34, + snd_se_stage_Stadium_electro_finish = 0x1C35, + snd_se_stage_Stadium_06 = 0x1C36, + snd_se_stage_Stadium_07 = 0x1C37, + snd_se_stage_Stadium_08 = 0x1C38, + snd_se_stage_Stadium_09 = 0x1C39, + snd_se_stage_Stadium_10 = 0x1C3A, + snd_se_stage_Tengan_Entry_01 = 0x1C3B, + snd_se_stage_Tengan_Entry_02 = 0x1C3C, + snd_se_stage_Tengan_step_01 = 0x1C3D, + snd_se_stage_Tengan_step_02 = 0x1C3E, + snd_se_stage_Tengan_Leave_01 = 0x1C3F, + snd_se_stage_Tengan_Leave_02 = 0x1C40, + snd_se_stage_Tengan_06 = 0x1C41, + snd_se_stage_Tengan_01 = 0x1C42, + snd_se_stage_Tengan_02 = 0x1C43, + snd_se_stage_Tengan_43 = 0x1C44, + snd_se_stage_Tengan_04 = 0x1C45, + snd_se_stage_Tengan_11 = 0x1C46, + snd_se_stage_Tengan_12 = 0x1C47, + snd_se_stage_Tengan_13 = 0x1C48, + snd_se_stage_Tengan_09 = 0x1C49, + snd_se_stage_Tengan_roll_finish = 0x1C4A, + snd_se_stage_Tengan_Dialga_enter_vc = 0x1C4B, + snd_se_stage_Tengan_03 = 0x1C4C, + snd_se_stage_Tengan_Dialga_Roar2_vc = 0x1C4D, + snd_se_stage_Tengan_DialgaFadeout_vc = 0x1C4E, + snd_se_stage_Tengan_Aura_01 = 0x1C4F, + snd_se_stage_Tengan_Aura_02 = 0x1C50, + snd_se_stage_Tengan_07 = 0x1C51, + snd_se_stage_Tengan_08 = 0x1C52, + snd_se_stage_Tengan_Palkia_Enter_vc = 0x1C53, + snd_se_stage_Tengan_05 = 0x1C54, + snd_se_stage_Tengan_14 = 0x1C55, + snd_se_stage_Tengan_Palkia_Roar2_vc = 0x1C56, + snd_se_stage_Tengan_Palkia_Fadeout_vc = 0x1C57, + snd_se_stage_Tengan_LR_change_01 = 0x1C58, + snd_se_stage_Tengan_LR_change_02 = 0x1C59, + snd_se_stage_Tengan_gravity_01 = 0x1C5A, + snd_se_stage_Tengan_gravity_02 = 0x1C5B, + snd_se_stage_Tengan_10 = 0x1C5C, + snd_se_stage_Tengan_15 = 0x1C5D, + snd_se_stage_Tengan_Crecelia_Enter_vc = 0x1C5E, + snd_se_stage_Tengan_cres_vc = 0x1C5F, + snd_se_stage_Tengan_Crecelia_Roar2_vc = 0x1C60, + snd_se_stage_Tengan_Crecelia_Fadeout_vc = 0x1C61, + snd_se_stage_Tengan_cres_wing = 0x1C62, + snd_se_stage_Tengan_cres_sonic = 0x1C63, + snd_se_stage_Tengan_cres_boomerang = 0x1C64, + snd_se_stage_Tengan_cres_up = 0x1C65, + snd_se_stage_Fzero_eng_a_loop = 0x1C66, + snd_se_stage_Fzero_eng_b_loop = 0x1C67, + snd_se_stage_Fzero_eng_cloop = 0x1C68, + snd_se_stage_Fzero_eng_d_loop = 0x1C69, + snd_se_stage_Fzero_machine_pass_a = 0x1C6A, + snd_se_stage_Fzero_machine_pass_b = 0x1C6B, + snd_se_stage_Fzero_machine_pass_c = 0x1C6C, + snd_se_stage_Fzero_machine_pass_d = 0x1C6D, + snd_se_stage_Fzero_Floor_move_start = 0x1C6E, + snd_se_stage_Fzero_Floor_move_stop = 0x1C6F, + snd_se_stage_Fzero_info_open = 0x1C70, + snd_se_stage_Fzero_info_mark = 0x1C71, + snd_se_stage_Fzero_info_close = 0x1C72, + snd_se_stage_Fzero_14 = 0x1C73, + snd_se_stage_Fzero_course_pass_01 = 0x1C74, + snd_se_stage_Fzero_course_pass_02 = 0x1C75, + snd_se_stage_Fzero_course_pass_03 = 0x1C76, + snd_se_stage_Fzero_course_pass_04 = 0x1C77, + snd_se_stage_Fzero_mark_pass_01 = 0x1C78, + snd_se_stage_Fzero_mark_pass_02 = 0x1C79, + snd_se_stage_Fzero_mark_pass_03 = 0x1C7A, + snd_se_stage_Fzero_mark_pass_04 = 0x1C7B, + snd_se_stage_Ice_01 = 0x1C7C, + snd_se_stage_Ice_Split_Impact = 0x1C7D, + snd_se_stage_Ice_02 = 0x1C7E, + snd_se_stage_Ice_03 = 0x1C7F, + snd_se_stage_Ice_IceFloor_01 = 0x1C80, + snd_se_stage_Ice_IceFloor_02 = 0x1C81, + snd_se_stage_Ice_06 = 0x1C82, + snd_se_stage_Ice_07 = 0x1C83, + snd_se_stage_Ice_04 = 0x1C84, + snd_se_stage_Ice_float_down = 0x1C85, + snd_se_stage_Ice_float_crash = 0x1C86, + snd_se_stage_Ice_08 = 0x1C87, + snd_se_stage_Ice_09 = 0x1C88, + snd_se_stage_Ice_tsurara_01 = 0x1C89, + snd_se_stage_Ice_tsurara_02 = 0x1C8A, + snd_se_stage_Ice_fish_Up = 0x1C8B, + snd_se_stage_Ice_info = 0x1C8C, + snd_se_stage_Ice_05 = 0x1C8D, + snd_se_stage_Ice_vegetable = 0x1C8E, + snd_se_stage_GW_01 = 0x1C8F, + snd_se_stage_GW_02 = 0x1C90, + snd_se_stage_GW_03 = 0x1C91, + snd_se_stage_GW_04 = 0x1C92, + snd_se_stage_GW_05 = 0x1C93, + snd_se_stage_GW_06 = 0x1C94, + snd_se_stage_Emblem_low_rumble = 0x1C95, + snd_se_stage_Emblem_sequence_move = 0x1C96, + snd_se_stage_Emblem_out_amb = 0x1C97, + snd_se_stage_Emblem_touseki_01 = 0x1C98, + snd_se_stage_Emblem_touseki_02 = 0x1C99, + snd_se_stage_Emblem_touseki_03 = 0x1C9A, + snd_se_stage_Emblem_touseki_04 = 0x1C9B, + snd_se_stage_Emblem_touseki_05 = 0x1C9C, + snd_se_stage_Emblem_statue_hit = 0x1C9D, + snd_se_stage_Emblem_sutatue_break = 0x1C9E, + snd_se_stage_Emblem_floor_break = 0x1C9F, + snd_se_stage_Emblem_under_amb = 0x1CA0, + snd_se_stage_Emblem_quake = 0x1CA1, + snd_se_stage_Madein_01 = 0x1CA2, + snd_se_stage_Madein_04 = 0x1CA3, + snd_se_stage_Madein_02 = 0x1CA4, + snd_se_stage_Madein_03 = 0x1CA5, + snd_se_stage_Madein_05 = 0x1CA6, + snd_se_stage_Madein_06 = 0x1CA7, + snd_se_stage_Madein_Caution = 0x1CA8, + snd_se_stage_Madein_07 = 0x1CA9, + snd_se_stage_Madein_Arrow = 0x1CAA, + snd_se_stage_Madein_08 = 0x1CAB, + snd_se_stage_Madein_09 = 0x1CAC, + snd_se_stage_Madein_photo = 0x1CAD, + snd_se_stage_Madein_10 = 0x1CAE, + snd_se_stage_Madein_11 = 0x1CAF, + snd_se_stage_Madein_12 = 0x1CB0, + snd_se_stage_Madein_13 = 0x1CB1, + snd_se_stage_Madein_14 = 0x1CB2, + snd_se_stage_Madein_15 = 0x1CB3, + snd_se_stage_Madein_16 = 0x1CB4, + snd_se_stage_Madein_17 = 0x1CB5, + snd_se_stage_Madein_good_01 = 0x1CB6, + snd_se_stage_Madein_good_02 = 0x1CB7, + snd_se_stage_Madein_good_03 = 0x1CB8, + snd_se_stage_Madein_good_04 = 0x1CB9, + snd_se_stage_Madein_good_05 = 0x1CBA, + snd_se_stage_Madein_good_06 = 0x1CBB, + snd_se_stage_Madein_good_07 = 0x1CBC, + snd_se_stage_Madein_bad_01 = 0x1CBD, + snd_se_stage_Madein_bad_02 = 0x1CBE, + snd_se_stage_Madein_bad_03 = 0x1CBF, + snd_se_stage_Madein_bad_04 = 0x1CC0, + snd_se_stage_Madein_bad_05 = 0x1CC1, + snd_se_stage_Madein_bad_06 = 0x1CC2, + snd_se_stage_Madein_bad_07 = 0x1CC3, + snd_se_stage_Pikmin_pellet01 = 0x1CC4, + snd_se_stage_Pikmin_pellet02 = 0x1CC5, + snd_se_stage_Pikmin_pellet03 = 0x1CC6, + snd_se_stage_Pikmin_pellet04 = 0x1CC7, + snd_se_stage_Pikmin_pellet05 = 0x1CC8, + snd_se_stage_Pikmin_pellet06 = 0x1CC9, + snd_se_stage_Pikmin_onion01 = 0x1CCA, + snd_se_stage_Pikmin_onion02 = 0x1CCB, + snd_se_stage_Pikmin_onion03 = 0x1CCC, + snd_se_stage_Pikmin_onion04 = 0x1CCD, + snd_se_stage_Pikmin_onion05 = 0x1CCE, + snd_se_stage_Pikmin_onion06 = 0x1CCF, + snd_se_stage_Pikmin_cyappi01 = 0x1CD0, + snd_se_stage_Pikmin_cyappi02 = 0x1CD1, + snd_se_stage_Pikmin_cyappi03 = 0x1CD2, + snd_se_stage_Pikmin_cyappi04 = 0x1CD3, + snd_se_stage_Pikmin_leaf01 = 0x1CD4, + snd_se_stage_Pikmin_leaf02 = 0x1CD5, + snd_se_stage_Pikmin_leaf03 = 0x1CD6, + snd_se_stage_Pikmin_rain01 = 0x1CD7, + snd_se_stage_Pikmin_rain02_loop = 0x1CD8, + snd_se_stage_Pikmin_rain03 = 0x1CD9, + snd_se_stage_Pikmin_water01 = 0x1CDA, + snd_se_stage_Pikmin_water02_loop = 0x1CDB, + snd_se_stage_Pikmin_water03 = 0x1CDC, + snd_se_stage_Palutena_rock_break01 = 0x1CDD, + snd_se_stage_Palutena_rock_dmg = 0x1CDE, + snd_se_stage_Palutena_rock_break02 = 0x1CDF, + snd_se_stage_Palutena_chain = 0x1CE0, + snd_se_stage_Palutena_cloud_through = 0x1CE1, + snd_se_stage_Famicom_01 = 0x1CE2, + snd_se_stage_Famicom_02 = 0x1CE3, + snd_se_stage_Famicom_03 = 0x1CE4, + snd_se_stage_Famicom_04 = 0x1CE5, + snd_se_stage_Famicom_05 = 0x1CE6, + snd_se_stage_Famicom_06 = 0x1CE7, + snd_se_stage_Famicom_07 = 0x1CE8, + snd_se_stage_Newpork_enter = 0x1CE9, + snd_se_stage_Newpork_chimera_step_01 = 0x1CEA, + snd_se_stage_Newpork_chimera_step_02 = 0x1CEB, + snd_se_stage_Newpork_chimera_attack = 0x1CEC, + snd_se_stage_Newpork_vanish = 0x1CED, + snd_se_stage_Newpork_chimera_screem = 0x1CEE, + snd_se_stage_Newpork_chimera_piki = 0x1CEF, + snd_se_stage_Newpork_boad_hit_01 = 0x1CF0, + snd_se_stage_Newpork_boad_hit_02 = 0x1CF1, + snd_se_stage_Newpork_boad_sand = 0x1CF2, + snd_se_stage_Newpork_boad_break = 0x1CF3, + snd_se_stage_Newpork_limousin = 0x1CF4, + snd_se_stage_Village_morning = 0x1CF5, + snd_se_stage_Village_night = 0x1CF6, + snd_se_stage_Village_midnight = 0x1CF7, + snd_se_stage_Village_baloon = 0x1CF8, + snd_se_stage_Village_UFO_fly = 0x1CF9, + snd_se_stage_Metalgear_blizzard_01 = 0x1CFA, + snd_se_stage_Metalgear_blizzard_02 = 0x1CFB, + snd_se_stage_Metalgear_wall_dmg = 0x1CFC, + snd_se_stage_Metalgear_wall_clack = 0x1CFD, + snd_se_stage_Metalgear_01 = 0x1CFE, + snd_se_stage_Metalgear_wall_all = 0x1CFF, + snd_se_stage_Metalgear_02 = 0x1D00, + snd_se_stage_Metalgear_wall_build = 0x1D01, + snd_se_stage_Metalgear_03 = 0x1D02, + snd_se_stage_Metalgear_04 = 0x1D03, + snd_se_stage_Metalgear_07 = 0x1D04, + snd_se_stage_Metalgear_rex_step_01 = 0x1D05, + snd_se_stage_Metalgear_rex_step_02 = 0x1D06, + snd_se_stage_Metalgear_rex_railgun_01 = 0x1D07, + snd_se_stage_Metalgear_rex_railgun_02 = 0x1D08, + snd_se_stage_Metalgear_rex_face = 0x1D09, + snd_se_stage_Metalgear_rex_radar_01 = 0x1D0A, + snd_se_stage_Metalgear_rex_radar_02 = 0x1D0B, + snd_se_stage_Metalgear_rex_radar_loop = 0x1D0C, + snd_se_stage_Metalgear_08 = 0x1D0D, + snd_se_stage_Metalgear_ray_amb = 0x1D0E, + snd_se_stage_Metalgear_Ray_Scream = 0x1D0F, + snd_se_stage_Metalgear_09 = 0x1D10, + snd_se_stage_Metalgear_10 = 0x1D11, + snd_se_stage_Metalgear_gek_step_01 = 0x1D12, + snd_se_stage_Metalgear_gek_step_02 = 0x1D13, + snd_se_stage_Metalgear_gek_jump = 0x1D14, + snd_se_stage_Metalgear_gek_landing = 0x1D15, + snd_se_stage_Greenhill_checkpoint = 0x1D16, + snd_se_stage_Greenhill_checkpoint_up = 0x1D17, + snd_se_stage_Greenhill_checkpoint_down = 0x1D18, + snd_se_stage_Greenhill_landslide = 0x1D19, + snd_se_stage_Greenhill_tails_dash = 0x1D1A, + snd_se_stage_Greenhill_knuckles_dash = 0x1D1B, + snd_se_stage_Greenhill_silver_dash = 0x1D1C, + snd_se_stage_Pictchat_in = 0x1D1D, + snd_se_stage_Pictchat_out = 0x1D1E, + snd_se_stage_Pictchat_delet = 0x1D1F, + snd_se_stage_Pictchat_spring = 0x1D20, + snd_se_stage_Pictchat_clock = 0x1D21, + snd_se_stage_Pictchat_wheel = 0x1D22, + snd_se_stage_Pictchat_coaster = 0x1D23, + snd_se_stage_Pictchat_missile_fire = 0x1D24, + snd_se_stage_Pictchat_missile_eng = 0x1D25, + snd_se_stage_Pictchat_missile_exp = 0x1D26, + snd_se_stage_Pictchat_wind = 0x1D27, + snd_se_stage_Pictchat_flower_01 = 0x1D28, + snd_se_stage_Pictchat_flower_02 = 0x1D29, + snd_se_stage_Pictchat_fire = 0x1D2A, + snd_se_stage_plankton_start = 0x1D2B, + snd_se_stage_plankton_ready = 0x1D2C, + snd_se_stage_Plankton_09 = 0x1D2D, + snd_se_stage_Plankton_01 = 0x1D2E, + snd_se_stage_Plankton_02 = 0x1D2F, + snd_se_stage_Plankton_03 = 0x1D30, + snd_se_stage_Plankton_04 = 0x1D31, + snd_se_stage_Plankton_05 = 0x1D32, + snd_se_stage_Plankton_06 = 0x1D33, + snd_se_stage_Plankton_07 = 0x1D34, + snd_se_stage_Plankton_08 = 0x1D35, + snd_se_stage_Plankton_10 = 0x1D36, + snd_se_stage_Plankton_11 = 0x1D37, + snd_se_stage_Plankton_12 = 0x1D38, + snd_se_stage_Plankton_13 = 0x1D39, + snd_se_stage_Plankton_14 = 0x1D3A, + snd_se_stage_Plankton_15 = 0x1D3B, + snd_se_stage_Plankton_16 = 0x1D3C, + snd_se_stage_Plankton_17 = 0x1D3D, + snd_se_stage_Plankton_18 = 0x1D3E, + snd_se_stage_Plankton_19 = 0x1D3F, + snd_se_stage_Plankton_20 = 0x1D40, + snd_se_stage_Plankton_21 = 0x1D41, + snd_se_stage_Plankton_22 = 0x1D42, + snd_se_stage_Plankton_23 = 0x1D43, + snd_se_stage_Plankton_24 = 0x1D44, + snd_se_stage_Plankton_25 = 0x1D45, + snd_se_stage_Plankton_26 = 0x1D46, + snd_se_stage_Plankton_27 = 0x1D47, + snd_se_stage_Plankton_28 = 0x1D48, + snd_se_stage_Plankton_29 = 0x1D49, + snd_se_stage_Plankton_30 = 0x1D4A, + snd_se_stage_Plankton_31 = 0x1D4B, + snd_se_stage_Plankton_32 = 0x1D4C, + snd_se_stage_Plankton_33 = 0x1D4D, + snd_se_stage_Plankton_34 = 0x1D4E, + snd_se_stage_Plankton_35 = 0x1D4F, + snd_se_stage_Plankton_36 = 0x1D50, + snd_se_stage_Plankton_37 = 0x1D51, + snd_se_stage_Plankton_38 = 0x1D52, + snd_se_stage_Plankton_39 = 0x1D53, + snd_se_stage_Plankton_40 = 0x1D54, + snd_se_stage_Plankton_41 = 0x1D55, + snd_se_stage_Plankton_42 = 0x1D56, + snd_se_stage_Plankton_43 = 0x1D57, + snd_se_stage_Plankton_44 = 0x1D58, + snd_se_stage_Plankton_45 = 0x1D59, + snd_se_stage_Plankton_46 = 0x1D5A, + snd_se_stage_Plankton_47 = 0x1D5B, + snd_se_stage_Plankton_48 = 0x1D5C, + snd_se_stage_Plankton_49 = 0x1D5D, + snd_se_stage_Plankton_50 = 0x1D5E, + snd_se_stage_Plankton_51 = 0x1D5F, + snd_se_stage_Plankton_52 = 0x1D60, + snd_se_stage_Plankton_53 = 0x1D61, + snd_se_stage_Plankton_54 = 0x1D62, + snd_se_stage_Plankton_55 = 0x1D63, + snd_se_stage_Plankton_56 = 0x1D64, + snd_se_stage_Plankton_57 = 0x1D65, + snd_se_stage_Plankton_58 = 0x1D66, + snd_se_stage_Plankton_59 = 0x1D67, + snd_se_stage_Plankton_60 = 0x1D68, + snd_se_stage_Plankton_61 = 0x1D69, + snd_se_stage_Plankton_62 = 0x1D6A, + snd_se_stage_Plankton_63 = 0x1D6B, + snd_se_stage_Plankton_64 = 0x1D6C, + snd_se_stage_Plankton_65 = 0x1D6D, + snd_se_stage_Plankton_66 = 0x1D6E, + snd_se_stage_Plankton_67 = 0x1D6F, + snd_se_stage_Plankton_68 = 0x1D70, + snd_se_stage_Plankton_69 = 0x1D71, + snd_se_stage_Plankton_70 = 0x1D72, + snd_se_stage_Plankton_71 = 0x1D73, + snd_se_stage_Plankton_72 = 0x1D74, + snd_se_stage_Plankton_73 = 0x1D75, + snd_se_stage_Plankton_74 = 0x1D76, + snd_se_stage_Plankton_75 = 0x1D77, + snd_se_stage_Plankton_76 = 0x1D78, + snd_se_stage_Plankton_77 = 0x1D79, + snd_se_stage_Plankton_78 = 0x1D7A, + snd_se_stage_Plankton_79 = 0x1D7B, + snd_se_stage_Plankton_80 = 0x1D7C, + snd_se_stage_Plankton_81 = 0x1D7D, + snd_se_stage_Plankton_82 = 0x1D7E, + snd_se_stage_Plankton_83 = 0x1D7F, + snd_se_stage_Plankton_84 = 0x1D80, + snd_se_stage_Plankton_85 = 0x1D81, + snd_se_stage_Plankton_86 = 0x1D82, + snd_se_stage_Plankton_87 = 0x1D83, + snd_se_stage_Plankton_88 = 0x1D84, + snd_se_stage_Plankton_90 = 0x1D85, + snd_se_stage_Plankton_91 = 0x1D86, + snd_se_stage_Plankton_92 = 0x1D87, + snd_se_stage_Plankton_93 = 0x1D88, + snd_se_stage_Plankton_94 = 0x1D89, + snd_se_stage_plankton_ringeffect_01 = 0x1D8A, + snd_se_stage_plankton_ringeffect_02 = 0x1D8B, + snd_se_stage_plankton_ringeffect_03 = 0x1D8C, + snd_se_stage_plankton_ringeffect_04 = 0x1D8D, + snd_se_stage_plankton_ringeffect_05 = 0x1D8E, + snd_se_stage_plankton_ringeffect_06 = 0x1D8F, + snd_se_stage_plankton_ringeffect_07 = 0x1D90, + snd_se_stage_plankton_ringeffect_08 = 0x1D91, + snd_se_stage_StageEdit_get = 0x1D92, + snd_se_stage_StageEdit_put = 0x1D93, + snd_se_stage_StageEdit_zoomin = 0x1D94, + snd_se_stage_StageEdit_zoomout = 0x1D95, + snd_se_stage_StageEdit_magnify = 0x1D96, + snd_se_stage_StageEdit_turn = 0x1D97, + snd_se_stage_StageEdit_shelf = 0x1D98, + snd_se_stage_StageEdit_test = 0x1D99, + snd_se_stage_StageEdit_spring = 0x1D9A, + snd_se_stage_StageEdit_conveyer = 0x1D9B, + snd_se_stage_StageEdit_fall = 0x1D9C, + snd_se_stage_StageEdit_wheel = 0x1D9D, + snd_se_stage_StageEdit_13 = 0x1D9E, + snd_se_stage_StageEdit_14 = 0x1D9F, + snd_se_stage_StageEdit_15 = 0x1DA0, + snd_se_stage_StageEdit_16 = 0x1DA1, + snd_se_stage_Garden_junglese = 0x1DA2, + snd_se_stage_Garden_river_ambient = 0x1DA3, + snd_se_stage_Garden_swim1 = 0x1DA4, + snd_se_stage_Garden_swim2 = 0x1DA5, + snd_se_stage_Zebes_asidsea_up = 0x1DA6, + snd_se_stage_Zebes_asdsea_down = 0x1DA7, + snd_se_stage_Zebes_asidsea_hit = 0x1DA8, + snd_se_stage_Zebes_cellbirth = 0x1DA9, + snd_se_stage_Zebes_cellbreak = 0x1DAA, + snd_se_stage_Zebes_coremove = 0x1DAB, + snd_se_stage_Zebes_pole_break = 0x1DAC, + snd_se_stage_Zebes_pole_hit = 0x1DAD, + snd_se_stage_Zebes_siren = 0x1DAE, + snd_se_stage_Zebes_amb1 = 0x1DAF, + snd_se_stage_Zebes_jisin = 0x1DB0, + snd_se_stage_Zebes_exp = 0x1DB1, + snd_se_stage_Greens_breath = 0x1DB2, + snd_se_stage_Greens_wind1 = 0x1DB3, + snd_se_stage_Greens_wind2 = 0x1DB4, + snd_se_stage_Greens_zawa = 0x1DB5, + snd_se_stage_Greens_apple_dasi = 0x1DB6, + snd_se_stage_Greens_apple_tyak1 = 0x1DB7, + snd_se_stage_Greens_apple_tyak2 = 0x1DB8, + snd_se_stage_Greens_apple_tyak3 = 0x1DB9, + snd_se_stage_Greens_block_break = 0x1DBA, + snd_se_stage_Corneria_arwincome = 0x1DBB, + snd_se_stage_Corneria_arwincome2 = 0x1DBC, + snd_se_stage_Corneria_arwinbye = 0x1DBD, + snd_se_stage_Corneria_arwin_shot = 0x1DBE, + snd_se_stage_Corneria_arwin_shot2 = 0x1DBF, + snd_se_stage_Corneria_shot1 = 0x1DC0, + snd_se_stage_Corneria_shot2 = 0x1DC1, + snd_se_stage_Corneria_hikouon = 0x1DC2, + snd_se_stage_Corneria_hikouon2 = 0x1DC3, + snd_se_stage_Corneria_gfox_tame_s = 0x1DC4, + snd_se_stage_Corneria_gfox_tame_l = 0x1DC5, + snd_se_stage_Corneria_arwin_shot_swish = 0x1DC6, + snd_se_stage_Pstadium_jisin = 0x1DC7, + snd_se_stage_Pstadium_change = 0x1DC8, + snd_se_stage_Bigblue_car_run1 = 0x1DC9, + snd_se_stage_Bigblue_car_run2 = 0x1DCA, + snd_se_stage_Bigblue_car_run3 = 0x1DCB, + snd_se_stage_Bigblue_car_run4 = 0x1DCC, + snd_se_stage_Onett_horn1 = 0x1DCD, + snd_se_stage_Onett_horn2 = 0x1DCE, + snd_se_stage_Onett_horn3 = 0x1DCF, + snd_se_stage_Onett_kanban1 = 0x1DD0, + snd_se_stage_Onett_lanban2 = 0x1DD1, + snd_se_stage_Onett_tree1 = 0x1DD2, + snd_se_stage_Onett_car_a = 0x1DD3, + snd_se_stage_Onett_car_b = 0x1DD4, + snd_se_stage_Onett_car_c = 0x1DD5, + snd_se_stage_Onett_car_d = 0x1DD6, + snd_se_stage_Onett_car_e = 0x1DD7, + snd_se_stage_Onett_car_f = 0x1DD8, + snd_se_stage_Onett_carcrash1 = 0x1DD9, + snd_se_stage_Onett_carcrash2 = 0x1DDA, + snd_se_assist_Jugem_Down = 0x1DDB, + snd_se_assist_Jugem_Pipo = 0x1DDC, + snd_se_assist_Goroh_Battou = 0x1DDD, + snd_se_assist_Goroh_Jump = 0x1DDE, + snd_se_assist_Goroh_Attack01 = 0x1DDF, + snd_se_assist_Goroh_Attack02 = 0x1DE0, + snd_se_assist_Goroh_Step01 = 0x1DE1, + snd_se_assist_Goroh_Step02 = 0x1DE2, + snd_se_assist_Goroh_enter_vc = 0x1DE3, + snd_se_assist_Goroh_attack_vc_a = 0x1DE4, + snd_se_assist_Goroh_attack_vc_b = 0x1DE5, + snd_se_assist_Goroh_vanish_vc = 0x1DE6, + snd_se_assist_Joe_jump = 0x1DE7, + snd_se_assist_Joe_landing = 0x1DE8, + snd_se_assist_Joe_jab = 0x1DE9, + snd_se_assist_Joe_valcanjab = 0x1DEA, + snd_se_assist_Joe_risingbreak = 0x1DEB, + snd_se_assist_Joe_smshpunch = 0x1DEC, + snd_se_assist_Joe_finish = 0x1DED, + snd_se_assist_Joe_vc_pop01 = 0x1DEE, + snd_se_assist_Joe_vc_pop02 = 0x1DEF, + snd_se_assist_Joe_vc_jab01 = 0x1DF0, + snd_se_assist_Joe_vc_jab_02 = 0x1DF1, + snd_se_assist_Joe_vc_rising01 = 0x1DF2, + snd_se_assist_Joe_vc_rising02 = 0x1DF3, + snd_se_assist_Joe_vc_smash01 = 0x1DF4, + snd_se_assist_Joe_vc_smash02 = 0x1DF5, + snd_se_assist_Waluigi_Jump = 0x1DF6, + snd_se_assist_Waluigi_Step01 = 0x1DF7, + snd_se_assist_Waluigi_Step02 = 0x1DF8, + snd_se_assist_Waluigi_Turn = 0x1DF9, + snd_se_assist_Waluigi_FootAttack = 0x1DFA, + snd_se_assist_Waluigi_Kick = 0x1DFB, + snd_se_assist_Waluigi_Racket = 0x1DFC, + snd_se_assist_Waluigi_enter_vc = 0x1DFD, + snd_se_assist_Waluigi_rush_vc_a = 0x1DFE, + snd_se_assist_Waluigi_rush_vc_b = 0x1DFF, + snd_se_assist_Waluigi_racket_vc = 0x1E00, + snd_se_assist_Waluigi_kick_vc = 0x1E01, + snd_se_assist_Resetsan_enter = 0x1E02, + snd_se_assist_Resetsan_angry_a = 0x1E03, + snd_se_assist_Resetsan_angry_b = 0x1E04, + snd_se_assist_Resetsan_exclamation = 0x1E05, + snd_se_assist_Resetsan_vibraslap = 0x1E06, + snd_se_assist_Resetsan_finish = 0x1E07, + snd_se_assist_Nintendogs_Enter = 0x1E08, + snd_se_assist_Nintendogs_App = 0x1E09, + snd_se_assist_Nintendogs_Up = 0x1E0A, + snd_se_assist_Nintendogs_Up2 = 0x1E0B, + snd_se_assist_Nintendogs_Up3 = 0x1E0C, + snd_se_assist_Nintendogs_Incline = 0x1E0D, + snd_se_assist_Nintendogs_Incline_2 = 0x1E0E, + snd_se_assist_Nintendogs_Incline_3 = 0x1E0F, + snd_se_assist_Nintendogs_Play = 0x1E10, + snd_se_assist_Nintendogs_Play_2 = 0x1E11, + snd_se_assist_Nintendogs_Play_3 = 0x1E12, + snd_se_assist_Nintendogs_Hand01 = 0x1E13, + snd_se_assist_Nintendogs_Hand02 = 0x1E14, + snd_se_assist_Nintendogs_Wait = 0x1E15, + snd_se_assist_Nintendogs_GoHome = 0x1E16, + snd_se_assist_Excitebike_Eng = 0x1E17, + snd_se_assist_Excitebike_Eng_B = 0x1E18, + snd_se_assist_Excitebike_turn = 0x1E19, + snd_se_assist_Excitebike_Turn_B = 0x1E1A, + snd_se_assist_Excitebike_jack = 0x1E1B, + snd_se_assist_Excitebike_Jack_B = 0x1E1C, + snd_se_assist_Excitebike_jump = 0x1E1D, + snd_se_assist_Excitebike_Jump_B = 0x1E1E, + snd_se_assist_Devil_Trans = 0x1E1F, + snd_se_assist_Devil_Fly = 0x1E20, + snd_se_assist_Devil_Start_A = 0x1E21, + snd_se_assist_Devil_Start_B = 0x1E22, + snd_se_assist_Devil_Start_C = 0x1E23, + snd_se_assist_Devil_Start_D = 0x1E24, + snd_se_assist_Devil_Scroll_LR = 0x1E25, + snd_se_assist_Devil_Scroll_UD = 0x1E26, + snd_se_assist_Hammerbros_Landing = 0x1E27, + snd_se_assist_Hammerbros_Throw = 0x1E28, + snd_se_assist_Hammerbros_Wait = 0x1E29, + snd_se_assist_Metroid_Enter = 0x1E2A, + snd_se_assist_Metroid_Wait = 0x1E2B, + snd_se_assist_Metroid_Absorb = 0x1E2C, + snd_se_assist_Wright_Landing = 0x1E2D, + snd_se_assist_Wright_Rstep = 0x1E2E, + snd_se_assist_Wright_Turn = 0x1E2F, + snd_se_assist_Wright_Point = 0x1E30, + snd_se_assist_Wright_Buil_01 = 0x1E31, + snd_se_assist_Wright_Buil_02 = 0x1E32, + snd_se_assist_Wright_enter_vc = 0x1E33, + snd_se_assist_Wright_attack_vc = 0x1E34, + snd_se_assist_Wright_after_vc = 0x1E35, + snd_se_assist_Stafy_06 = 0x1E36, + snd_se_assist_Stafy_Step_01 = 0x1E37, + snd_se_assist_Stafy_Step_02 = 0x1E38, + snd_se_assist_Stafy_Damage = 0x1E39, + snd_se_assist_Stafy_Jump = 0x1E3A, + snd_se_assist_Stafy_07 = 0x1E3B, + snd_se_assist_Stafy_Spin = 0x1E3C, + snd_se_assist_Tingle_Enter = 0x1E3D, + snd_se_assist_Tingle_Roll = 0x1E3E, + snd_se_assist_Tingle_Open = 0x1E3F, + snd_se_assist_Tingle_Effect = 0x1E40, + snd_se_assist_Tingle_Balloon = 0x1E41, + snd_se_assist_Tingle_Fly = 0x1E42, + snd_se_assist_Tingle_Geki = 0x1E43, + snd_se_assist_Tingle_Banana = 0x1E44, + snd_se_assist_Tingle_Hammer = 0x1E45, + snd_se_assist_Tingle_Zoom = 0x1E46, + snd_se_assist_Tingle_Finish = 0x1E47, + snd_se_assist_Katana_enter_roll = 0x1E48, + snd_se_assist_Katana_attack = 0x1E49, + snd_se_assist_Katana_up = 0x1E4A, + snd_se_assist_Katana_finish_roll = 0x1E4B, + snd_se_assist_Katana_hightouch = 0x1E4C, + snd_se_assist_Katana_enter_01 = 0x1E4D, + snd_se_assist_Katana_enter_02 = 0x1E4E, + snd_se_assist_Katana_enter_03 = 0x1E4F, + snd_se_assist_Katana_enter_04 = 0x1E50, + snd_se_assist_Lin_step_01 = 0x1E51, + snd_se_assist_Lin_step_02 = 0x1E52, + snd_se_assist_Lin_watou = 0x1E53, + snd_se_assist_Lin_swish = 0x1E54, + snd_se_assist_Lin_hit = 0x1E55, + snd_se_assist_Lin_watou_roll = 0x1E56, + snd_se_assist_Lin_osame_01 = 0x1E57, + snd_se_assist_Lin_osame_02 = 0x1E58, + snd_se_assist_Lin_enter_vc01 = 0x1E59, + snd_se_assist_Lin_enter_vc02 = 0x1E5A, + snd_se_assist_Lin_kame_vc01 = 0x1E5B, + snd_se_assist_Lin_kamae_vc02 = 0x1E5C, + snd_se_assist_Lin_attack_vc01 = 0x1E5D, + snd_se_assist_Lin_attack_vc02 = 0x1E5E, + snd_se_assist_Andross_enter = 0x1E5F, + snd_se_assist_Andross_charge = 0x1E60, + snd_se_assist_Andross_shot_a = 0x1E61, + snd_se_assist_Andross_shot_b = 0x1E62, + snd_se_assist_Andross_shot_c = 0x1E63, + snd_se_assist_Littlemac_step_01 = 0x1E64, + snd_se_assist_Littlemac_step_02 = 0x1E65, + snd_se_assist_Littlemac_gong = 0x1E66, + snd_se_assist_Littlemac_dash = 0x1E67, + snd_se_assist_Littlemac_jab = 0x1E68, + snd_se_assist_Littlemac_straight = 0x1E69, + snd_se_assist_Littlemac_upper = 0x1E6A, + snd_se_assist_Littlemac_enter_vc = 0x1E6B, + snd_se_assist_Littlemac_jab_vc = 0x1E6C, + snd_se_assist_Littlemac_straight_vc = 0x1E6D, + snd_se_assist_Littlemac_one_two_vc = 0x1E6E, + snd_se_assist_Littlemac_12 = 0x1E6F, + snd_se_assist_Littlemac_13 = 0x1E70, + snd_se_assist_Tank_siren_01 = 0x1E71, + snd_se_assist_Tank_siren_02 = 0x1E72, + snd_se_assist_Tank_tankshot_a = 0x1E73, + snd_se_assist_Tank_tankshot_b = 0x1E74, + snd_se_assist_Tank_hoheishot_a = 0x1E75, + snd_se_assist_Tank_hoheishot_b = 0x1E76, + snd_se_assist_Jeff_step = 0x1E77, + snd_se_assist_Jeff_landing = 0x1E78, + snd_se_assist_Jeff_set = 0x1E79, + snd_se_assist_Jeff_jump = 0x1E7A, + snd_se_assist_Jeff_firework = 0x1E7B, + snd_se_assist_Jeff_hataku = 0x1E7C, + snd_se_assist_Jeff_bullet = 0x1E7D, + snd_se_assist_Jeff_rocket = 0x1E7E, + snd_se_assist_Heririn_01 = 0x1E7F, + snd_se_assist_Cyborg_entry = 0x1E80, + snd_se_assist_Cyborg_dash = 0x1E81, + snd_se_assist_Cyborg_katana = 0x1E82, + snd_se_assist_Cyborg_ref = 0x1E83, + snd_se_assist_Cyborg_entry_vc_1 = 0x1E84, + snd_se_assist_Cyborg_entry_vc_s1 = 0x1E85, + snd_se_assist_Cyborg_entry_vc_s2 = 0x1E86, + snd_se_assist_Cyborg_entry_vc_2 = 0x1E87, + snd_se_assist_Cyborg_entry_vc_3 = 0x1E88, + snd_se_assist_Customrobo_enter = 0x1E89, + snd_se_assist_Customrobo_landing = 0x1E8A, + snd_se_assist_Customrobo_vernier = 0x1E8B, + snd_se_assist_Customrobo_gun_a = 0x1E8C, + snd_se_assist_Customrobo_gun_b = 0x1E8D, + snd_se_assist_Customrobo_bomb = 0x1E8E, + snd_se_assist_Robin_step = 0x1E8F, + snd_se_assist_Robin_move_start = 0x1E90, + snd_se_assist_Robin_move = 0x1E91, + snd_se_assist_Robin_enter_vc = 0x1E92, + snd_se_assist_Robin_move_vc_a = 0x1E93, + snd_se_assist_Robin_move_vc_b = 0x1E94, + snd_se_assist_Saki_step = 0x1E95, + snd_se_assist_Saki_dash_01 = 0x1E96, + snd_se_assist_Saki_dash_02 = 0x1E97, + snd_se_assist_Saki_jump = 0x1E98, + snd_se_assist_Saki_gun = 0x1E99, + snd_se_assist_Saki_sword_01 = 0x1E9A, + snd_se_assist_Saki_sword_02 = 0x1E9B, + snd_se_assist_Saki_enter_vc = 0x1E9C, + snd_se_assist_Saki_gun_vc_a = 0x1E9D, + snd_se_assist_Saki_gun_vc_b = 0x1E9E, + snd_se_assist_Saki_sword_vc_a = 0x1E9F, + snd_se_assist_Saki_sword_vc_b = 0x1EA0, + snd_se_assist_Saki_vanish_vc = 0x1EA1, + snd_se_assist_Kururi_enter_vc_a = 0x1EA2, + snd_se_assist_Kururi_enter_vc_b = 0x1EA3, + snd_se_assist_Kururi_doriup_g2_vc = 0x1EA4, + snd_se_assist_Kururi_doriup_g3_vc = 0x1EA5, + snd_se_assist_Kururi_wall_vc = 0x1EA6, + snd_se_assist_Kururi_landing = 0x1EA7, + snd_se_assist_Kururi_step = 0x1EA8, + snd_se_assist_Kururi_eyes = 0x1EA9, + snd_se_assist_Kururi_doril_g2 = 0x1EAA, + snd_se_assist_Kururi_doril_g3 = 0x1EAB, + snd_se_assist_Kururi_doriup = 0x1EAC, + snd_se_assist_Kururi_wall_stop = 0x1EAD, + snd_se_assist_Kururi_wall_restart = 0x1EAE, + snd_se_assist_Kururi_wall_out = 0x1EAF, + snd_se_assist_Shadow_cc_vc_01 = 0x1EB0, + snd_se_assist_Shadow_cc_vc_02 = 0x1EB1, + snd_se_assist_Shadow_cc_se_01 = 0x1EB2, + snd_se_assist_Shadow_cc_se_02 = 0x1EB3, + snd_se_assist_Shadow_finish_vc = 0x1EB4, + snd_se_Coinshooter_insert_coin = 0x1EB5, + snd_se_Coinshooter_shooter_l = 0x1EB6, + snd_se_Coinshooter_coin_fire = 0x1EB7, + snd_se_Coinshooter_hit_enemy = 0x1EB8, + snd_se_Coinshooter_hit_figure = 0x1EB9, + snd_se_Coinshooter_no_coin = 0x1EBA, + snd_se_Coinshooter_Coin_Touch = 0x1EBB, + snd_se_Coinshooter_pit = 0x1EBC, + snd_se_Coinshooter_Pit_Close = 0x1EBD, + snd_se_Coinshooter_figure_get_01 = 0x1EBE, + snd_se_Coinshooter_figure_get_02 = 0x1EBF, + snd_se_Coinshooter_enemy_kill = 0x1EC0, + snd_se_Coinshooter_hit_nodamage = 0x1EC1, + snd_se_Coinshooter_missile_fire = 0x1EC2, + snd_se_Coinshooter_missile_crash = 0x1EC3, + snd_se_Coinshooter_missile_strike = 0x1EC4, + snd_se_Coinshooter_rensha_mode = 0x1EC5, + snd_se_Coinshooter_formation_destroy = 0x1EC6, + snd_se_Coinshooter_Bonus_Point = 0x1EC7, + snd_se_Coinshooter_Seal_Get = 0x1EC8, + snd_se_Coinshooter_Figure_Land = 0x1EC9, + snd_se_Coinshooter_Gain_Coin = 0x1ECA, + snd_se_Coinshooter_Gain_Seal = 0x1ECB, + snd_se_Coinshooter_Coin_Get = 0x1ECC, + snd_se_Coinshooter_FALL_COIN = 0x1ECD, + snd_se_Coinshooter_FIGURE_IN = 0x1ECE, + snd_se_Coinshooter_Drop_Coin = 0x1ECF, + snd_se_Coinshooter_28 = 0x1ED0, + snd_se_Coinshooter_29 = 0x1ED1, + snd_se_Coinshooter_30 = 0x1ED2, + snd_se_Cleagetter_hammer_choice = 0x1ED3, + snd_se_Cleagetter_hammer_ready = 0x1ED4, + snd_se_Cleagetter_grass_crash = 0x1ED5, + snd_se_Cleagetter_miss = 0x1ED6, + snd_se_Cleagetter_get = 0x1ED7, + snd_se_Cleagetter_get_off = 0x1ED8, + snd_se_Cleagetter_hammer_get = 0x1ED9, + snd_se_Homerun_barrier = 0x1EDA, + snd_se_Homerun_barrier_crash = 0x1EDB, + snd_se_Homerun_figure_get = 0x1EDC, + snd_se_Homerun_meter = 0x1EDD, + snd_se_Homerun_barrier_off = 0x1EDE, + snd_se_Target_Break = 0x1EDF, + snd_se_Target_Spring = 0x1EE0, + snd_se_Target_Catapult_on = 0x1EE1, + snd_se_Target_Catapult_start = 0x1EE2, + snd_se_Target_Catapult_shoot = 0x1EE3, + snd_se_Target_06 = 0x1EE4, + snd_se_Display_figure_form = 0x1EE5, + snd_se_Dispay_figure_put = 0x1EE6, + snd_se_Dispay_figure_close = 0x1EE7, + snd_se_Dispay_seal_page = 0x1EE8, + snd_se_Dispay_seal_on = 0x1EE9, + snd_se_Dispay_seal_off = 0x1EEA, + snd_se_Dispay_challenger_siren = 0x1EEB, + snd_se_select_r2f = 0x1EEC, + snd_se_state_aurora_vision = 0x1EED, + snd_se_stage_speed_up = 0x1EEE, + snd_se_select_window_open = 0x1EEF, + snd_se_select_window_close = 0x1EF0, + snd_se_result_winner = 0x1EF1, + snd_se_Watch_dl_loop = 0x1EF2, + snd_se_Watch_dl_finish = 0x1EF3, + snd_se_Watch_bonus_jingle = 0x1EF4, + snd_se_Watch_coin_bet = 0x1EF5, + snd_se_Watch_coin_cansel = 0x1EF6, + snd_se_Watch_coin_get = 0x1EF7, + snd_se_Watch_coin_get_loop = 0x1EF8, + snd_se_Watch_coin_lost = 0x1EF9, + snd_se_Watch_coin_lost_loop = 0x1EFA, + snd_se_Watch_Bonus_get = 0x1EFB, + snd_se_Watch_lose = 0x1EFC, + snd_se_Watch_next = 0x1EFD, + snd_se_Simple_continue_countdown = 0x1EFE, + snd_se_Watch_Bet_coin_Up = 0x1EFF, + snd_se_Simple_03 = 0x1F00, + snd_se_CharaRoll_shot = 0x1F01, + snd_se_CharaRoll_hit = 0x1F02, + snd_se_CharaRoll_coin_get_s = 0x1F03, + snd_se_CharaRoll_coin_get_m = 0x1F04, + snd_se_CharaRoll_coin_get_l = 0x1F05, + snd_se_pokemon_pochama_enter = 0x1F06, + snd_se_pokemon_pochama_naminori = 0x1F07, + snd_se_pokemon_gonbe_enter = 0x1F08, + snd_se_pokemon_gonbe_monohiroi_01 = 0x1F09, + snd_se_pokemon_gonbe_monohiroi_02 = 0x1F0A, + snd_se_pokemon_usohachi_enter = 0x1F0B, + snd_se_pokemon_usohachi_step = 0x1F0C, + snd_se_pokemon_usohachi_landing = 0x1F0D, + snd_se_pokemon_manyula_enter = 0x1F0E, + snd_se_pokemon_manyula_dash = 0x1F0F, + snd_se_pokemon_manaphy_entry = 0x1F10, + snd_se_pokemon_manaphy_swap = 0x1F11, + snd_se_pokemon_achamo_enter = 0x1F12, + snd_se_pokemon_gokulin_enter = 0x1F13, + snd_se_pokemon_gokulin_nomikomu = 0x1F14, + snd_se_pokemon_gokulin_hakidasu = 0x1F15, + snd_se_pokemon_metagross_enter = 0x1F16, + snd_se_pokemon_metagross_quake = 0x1F17, + snd_se_pokemon_sirnight_enter = 0x1F18, + snd_se_pokemon_sirnight_ref = 0x1F19, + snd_se_pokemon_latias_vc_a = 0x1F1A, + snd_se_pokemon_latias_vc_b = 0x1F1B, + snd_se_pokemon_latios_vc_a = 0x1F1C, + snd_se_pokemon_latios_vc_b = 0x1F1D, + snd_se_pokemon_groudon_scream = 0x1F1E, + snd_se_pokemon_kyorge_enter = 0x1F1F, + snd_se_pokemon_deoxys_enter = 0x1F20, + snd_se_pokemon_deoxys_beam_01 = 0x1F21, + snd_se_pokemon_deoxys_beam_02 = 0x1F22, + snd_se_pokemon_jirachi_enter = 0x1F23, + snd_se_pokemon_mine_angry = 0x1F24, + snd_se_pokemon_mine_misfire = 0x1F25, + snd_se_pokemon_tosakinto_vc = 0x1F26, + snd_se_pokemon_hitodeman_vc = 0x1F27, + snd_se_pokemon_hitodeman_shot = 0x1F28, + snd_se_pokemon_kabigon_up = 0x1F29, + snd_se_pokemon_kabugon_down = 0x1F2A, + snd_se_pokemon_chiko_shot = 0x1F2B, + snd_se_pokemon_chiko_vc = 0x1F2C, + snd_se_pokemon_togepy_vc = 0x1F2D, + snd_se_pokemon_togepy_flash = 0x1F2E, + snd_se_pokemon_kireihana_vc = 0x1F2F, + snd_se_pokemon_kireihana_gas1 = 0x1F30, + snd_se_pokemon_kireihana_gas2 = 0x1F31, + snd_se_pokemon_sonans_vc = 0x1F32, + snd_se_pokemon_entei_fire1 = 0x1F33, + snd_se_pokemon_entei_fire2a = 0x1F34, + snd_se_pokemon_entei_fire2b = 0x1F35, + snd_se_pokemon_entei_fire2c = 0x1F36, + snd_se_pokemon_houou = 0x1F37, + snd_se_pokemon_lugia_breath1 = 0x1F38, + snd_se_pokemon_lugia_breath2 = 0x1F39, + snd_se_pokemon_lugia_breath3 = 0x1F3A, + snd_se_pokemon_mew_vc = 0x1F3B, + snd_se_pokemon_bird_flup = 0x1F3C, + snd_se_pokemon_vanish = 0x1F3D, + snd_se_timer_slow = 0x1F3E, + snd_se_timer_slow_all = 0x1F3F, + snd_se_metagros_landing = 0x1F40, + snd_se_Thunder_get_01 = 0x1F41, + snd_se_Thunder_get_02 = 0x1F42, + snd_se_dragoon_combine = 0x1F43, + snd_se_dragoonparts_on = 0x1F44, + snd_se_dragoon_enter = 0x1F45, + snd_se_dragoon_target = 0x1F46, + snd_se_dragoon_attack = 0x1F47, + snd_se_item_sandbag_dmg_s = 0x1F48, + snd_se_item_sandbag_dmg_l = 0x1F49, + snd_se_item_sandbag_drop = 0x1F4A, + snd_se_item_sandbag_landing = 0x1F4B, + snd_se_item_carrierbox_slide = 0x1F4C, + snd_se_item_curry_fire = 0x1F4D, + snd_se_item_curry_shot = 0x1F4E, + snd_se_item_curry_shot_b = 0x1F4F, + snd_se_item_curry_shot_c = 0x1F50, + snd_se_item_Goldenhammer_enter = 0x1F51, + snd_se_item_Goldenhammer_piko = 0x1F52, + snd_se_item_Clacker_shot = 0x1F53, + snd_se_item_Clacker_lastshot = 0x1F54, + snd_se_item_Clacker_exp = 0x1F55, + snd_se_item_clacker_empty = 0x1F56, + snd_se_item_banana_slip = 0x1F57, + snd_se_item_chewing_01 = 0x1F58, + snd_se_item_chewing_02 = 0x1F59, + snd_se_item_smartbomb_exp = 0x1F5A, + snd_se_item_smartbomb_blink = 0x1F5B, + snd_se_item_Smokescreen = 0x1F5C, + snd_se_item_pasaran_spark = 0x1F5D, + snd_se_item_pasaran_growth = 0x1F5E, + snd_se_item_pasaran_landing = 0x1F5F, + snd_se_item_bumper_set = 0x1F60, + snd_se_item_bumper_repel = 0x1F61, + snd_se_item_spring_01 = 0x1F62, + snd_se_item_spring_02 = 0x1F63, + snd_se_item_pitfall_vanish = 0x1F64, + snd_se_item_key_landing = 0x1F65, + snd_se_item_badge_equip = 0x1F66, + snd_se_item_badge_reflection = 0x1F67, + snd_se_item_screw_equip = 0x1F68, + snd_se_item_Screw_01 = 0x1F69, + snd_se_item_Screw_02 = 0x1F6A, + snd_se_item_unira_needle = 0x1F6B, + snd_se_item_unira_stick = 0x1F6C, + snd_se_item_soccerball_bound_l = 0x1F6D, + snd_se_item_soccerball_shoot = 0x1F6E, + snd_se_item_powderbox_exp = 0x1F6F, + snd_se_item_Smashball_dmg = 0x1F70, + snd_se_item_Smashball = 0x1F71, + snd_se_item_Assist_open = 0x1F72, + snd_se_item_Pokeball_open = 0x1F73, + snd_se_item_box_break = 0x1F74, + snd_se_item_boxfuture_break = 0x1F75, + snd_se_item_boxpersent_break = 0x1F76, + snd_se_item_Barrel_break = 0x1F77, + snd_se_item_barrelfuture_break = 0x1F78, + snd_se_item_barrelpresent_break = 0x1F79, + snd_se_item_Capsule_break = 0x1F7A, + snd_se_item_Kusudama_Landing = 0x1F7B, + snd_se_item_Kusudama_break = 0x1F7C, + snd_se_item_Superstar_get = 0x1F7D, + snd_se_item_Superstar_bownd = 0x1F7E, + snd_se_item_BeamSword_l = 0x1F7F, + snd_se_item_BeamSword_m = 0x1F80, + snd_se_item_BeamSword_s = 0x1F81, + snd_se_item_HomeRunBat_l = 0x1F82, + snd_se_item_HomeRunBat_m = 0x1F83, + snd_se_item_HomeRunBat_s = 0x1F84, + snd_se_item_RipStick_swing = 0x1F85, + snd_se_item_RipStick_flower = 0x1F86, + snd_se_item_RipStick_empty = 0x1F87, + snd_se_item_Ice_Crash = 0x1F88, + snd_se_item_Harisen_l = 0x1F89, + snd_se_item_Metalbox = 0x1F8A, + snd_se_item_Harisen_m = 0x1F8B, + snd_se_item_Harisen_s = 0x1F8C, + snd_se_item_StarRod_l = 0x1F8D, + snd_se_item_StarRod_m = 0x1F8E, + snd_se_item_StarRod_s = 0x1F8F, + snd_se_item_StarRod_empty = 0x1F90, + snd_se_item_SuperScope_ready = 0x1F91, + snd_se_item_SuperScope_shot = 0x1F92, + snd_se_item_SuperScope_charge = 0x1F93, + snd_se_item_SuperScope_chargeshot_s = 0x1F94, + snd_se_item_SuperScope_Chargeshot_2 = 0x1F95, + snd_se_item_SuperScope_Chargeshot_3 = 0x1F96, + snd_se_item_SuperScope_Chargeshot_4 = 0x1F97, + snd_se_item_SuperScope_Chargeshot_5 = 0x1F98, + snd_se_item_SuperScope_Chargeshot_6 = 0x1F99, + snd_se_item_SuperScope_Chargeshot_7 = 0x1F9A, + snd_se_item_SuperScope_Chargeshot_8 = 0x1F9B, + snd_se_item_SuperScope_Chargeshot_l = 0x1F9C, + snd_se_item_SuperScope_empty = 0x1F9D, + snd_se_item_Raygun_shot = 0x1F9E, + snd_se_item_Raygun_empty = 0x1F9F, + snd_se_item_Fireflower_shot_b = 0x1FA0, + snd_se_item_Fireflower_shot_a = 0x1FA1, + snd_se_item_Fireflower_empty = 0x1FA2, + snd_se_item_SensorBomb_Set = 0x1FA3, + snd_se_item_SensorBobm_search = 0x1FA4, + snd_se_item_Bombhei_walk = 0x1FA5, + snd_se_item_Greenshell_hit = 0x1FA6, + snd_se_item_Dragoon_Landing = 0x1FA7, + snd_se_item_UsagiHat_get = 0x1FA8, + snd_se_item_UsagiHat_dash = 0x1FA9, + snd_se_item_UsagiHat_turn = 0x1FAA, + snd_se_item_UsagiHat_Jump_01 = 0x1FAB, + snd_se_item_UsagiHat_Jump_02 = 0x1FAC, + snd_se_item_Item_Get = 0x1FAD, + snd_se_item_Item_desert = 0x1FAE, + snd_se_item_Item_vanish = 0x1FAF, + snd_se_item_Item_throw = 0x1FB0, + snd_se_item_tabemono_Get = 0x1FB1, + snd_se_item_Item_landing = 0x1FB2, + snd_se_item_box_landing = 0x1FB3, + snd_se_item_Barrel_Landing = 0x1FB4, + snd_se_item_Bat_Landing = 0x1FB5, + snd_se_item_Weapon_Landing = 0x1FB6, + snd_se_item_Food_Landing = 0x1FB7, + snd_se_item_Stick_Landing = 0x1FB8, + snd_se_item_Capsule_Landing = 0x1FB9, + snd_se_item_Futurebox_Landing = 0x1FBA, + snd_se_item_Presentbox_landing = 0x1FBB, + snd_se_item_Futurebarrel_landing = 0x1FBC, + snd_se_item_Presentbarrel_landing = 0x1FBD, + snd_se_item_Metal_landing = 0x1FBE, + snd_se_item_Carrierbox_landing = 0x1FBF, + snd_se_item_Doseisan_landing = 0x1FC0, + snd_se_item_Banana_landing = 0x1FC1, + snd_se_item_Freezer_landing = 0x1FC2, + snd_se_item_Coin_landing = 0x1FC3, + snd_se_item_CD_Landing = 0x1FC4, + snd_se_item_Coin_get = 0x1FC5, + snd_se_item_Bill_Get = 0x1FC6, + snd_se_item_Water_s = 0x1FC7, + snd_se_item_Water_l = 0x1FC8, + snd_se_pokemon_manaphy_heart_01 = 0x1FC9, + snd_se_item_fireflower_landing = 0x1FCA, + snd_se_pokemon_latios_enter = 0x1FCB, + snd_se_pokemon_nyarth_koban = 0x1FCC, + snd_se_pokemon_suicune_beam = 0x1FCD, + snd_se_pokemon_heavy_step = 0x1FCE, + snd_se_item_assist_vanish = 0x1FCF, + snd_se_item_dragoon_get = 0x1FD0, + snd_se_narration_Remove = 0x1FD1, + snd_se_narration_NewRec = 0x1FD2, + snd_se_narration_Congratulation = 0x1FD3, + snd_se_narration_Incledible = 0x1FD4, + snd_se_narration_StageClear = 0x1FD5, + snd_se_narration_Success = 0x1FD6, + snd_se_narration_Complete = 0x1FD7, + snd_se_narration_Failure = 0x1FD8, + snd_se_narration_Gameset = 0x1FD9, + snd_se_narration_Ready = 0x1FDA, + snd_se_narration_Go = 0x1FDB, + snd_se_narration_Timeup = 0x1FDC, + snd_se_narration_SuddenDeath = 0x1FDD, + snd_se_narration_ten = 0x1FDE, + snd_se_narration_nine = 0x1FDF, + snd_se_narration_eight = 0x1FE0, + snd_se_narration_seven = 0x1FE1, + snd_se_narration_six = 0x1FE2, + snd_se_narration_five = 0x1FE3, + snd_se_narration_four = 0x1FE4, + snd_se_narration_three = 0x1FE5, + snd_se_narration_two = 0x1FE6, + snd_se_narration_one = 0x1FE7, + snd_se_narration_Player_01 = 0x1FE8, + snd_se_narration_Player_02 = 0x1FE9, + snd_se_narration_Player_03 = 0x1FEA, + snd_se_narration_Player_04 = 0x1FEB, + snd_se_narration_Player_com = 0x1FEC, + snd_se_narration_Defeated = 0x1FED, + snd_se_Narration_Title_01 = 0x1FEE, + snd_se_Narration_Title_02 = 0x1FEF, + snd_se_Narration_Tournament = 0x1FF0, + snd_se_Narration_Adventure = 0x1FF1, + snd_se_Narration_Event = 0x1FF2, + snd_se_Narration_Figure_Gallery = 0x1FF3, + snd_se_Narration_Figure_Collection = 0x1FF4, + snd_se_Narration_Seal_Gallery = 0x1FF5, + snd_se_Narration_Seal_Collection = 0x1FF6, + snd_se_Narration_CoinShooter = 0x1FF7, + snd_se_Narration_Chronicle = 0x1FF8, + snd_se_Narration_Album = 0x1FF9, + snd_se_Narration_Replays = 0x1FFA, + snd_se_Narration_Builder = 0x1FFB, + snd_se_Narration_Traial = 0x1FFC, + snd_se_Narration_Watch = 0x1FFD, + snd_se_Narration_How2Play = 0x1FFE, + snd_se_Narration_Continue = 0x1FFF, + snd_se_Narration_Gameover = 0x2000, + snd_se_Narration_Ooatari = 0x2001, + snd_se_narration_characall_mario = 0x2002, + snd_se_narration_characall_Donkey = 0x2003, + snd_se_narration_characall_Link = 0x2004, + snd_se_narration_characall_Samus = 0x2005, + snd_se_narration_characall_Yoshi = 0x2006, + snd_se_narration_characall_Kirby = 0x2007, + snd_se_narration_characall_Fox = 0x2008, + snd_se_narration_characall_Pikachu = 0x2009, + snd_se_narration_characall_Luigi = 0x200A, + snd_se_narration_characall_Captain = 0x200B, + snd_se_narration_characall_Ness = 0x200C, + snd_se_narration_characall_Koopa = 0x200D, + snd_se_narration_characall_Peach = 0x200E, + snd_se_narration_characall_Zelda = 0x200F, + snd_se_narration_characall_Shiek = 0x2010, + snd_se_narration_characall_Iceclimber = 0x2011, + snd_se_narration_characall_Marth = 0x2012, + snd_se_narration_characall_GameWatch = 0x2013, + snd_se_narration_characall_Falco = 0x2014, + snd_se_narration_characall_Ganon = 0x2015, + snd_se_narration_characall_Wario = 0x2016, + snd_se_narration_characall_Metaknight = 0x2017, + snd_se_narration_characall_Pit = 0x2018, + snd_se_narration_characall_SZerosuit = 0x2019, + snd_se_narration_characall_Pikmin = 0x201A, + snd_se_narration_characall_Lucas = 0x201B, + snd_se_narration_characall_Diddy = 0x201C, + snd_se_narration_characall_PokeTrainer = 0x201D, + snd_se_narration_characall_PokeLizardon = 0x201E, + snd_se_narration_characall_PokeZenigame = 0x201F, + snd_se_narration_characall_PokeFushigisou = 0x2020, + snd_se_narration_characall_Dedede = 0x2021, + snd_se_narration_characall_Lucario = 0x2022, + snd_se_narration_characall_Ike = 0x2023, + snd_se_narration_characall_Robot = 0x2024, + snd_se_narration_characall_Purin = 0x2025, + snd_se_narration_characall_Toonlink = 0x2026, + snd_se_narration_characall_Wolf = 0x2027, + snd_se_narration_characall_Snake = 0x2028, + snd_se_narration_characall_Sonic = 0x2029, + snd_se_narration_characall_Zako = 0x202A, + snd_se_menu_Narration_BattleRoyal = 0x202B, + snd_se_menu_Narration_GetCoin = 0x202C, + snd_se_menu_Narration_Survive = 0x202D, + snd_se_menu_Narration_Special = 0x202E, + snd_se_menu_Narration_LoserOut = 0x202F, + snd_se_menu_Narration_Classic = 0x2030, + snd_se_menu_Narration_AllStar = 0x2031, + snd_se_menu_Narration_Multiman = 0x2032, + snd_se_menu_Narration_Bossbttles = 0x2033, + snd_se_menu_Narration_Training = 0x2034, + snd_se_menu_Narration_BreakTarget = 0x2035, + snd_se_menu_Narration_Homerun = 0x2036, + snd_se_menu_Narration_EasyBrawl = 0x2037, + snd_se_menu_Narration_TeamBattle = 0x2038, + snd_se_menu_Narration_Timein = 0x2039, + snd_se_menu_Narration_Champion = 0x203A, + snd_se_menu_Narration_BonusStage = 0x203B, + snd_se_menu_Narration_Team = 0x203C, + snd_se_menu_Narration_And = 0x203D, + snd_se_menu_Narration_Versus = 0x203E, + snd_se_menu_Narration_Giant = 0x203F, + snd_se_menu_Narration_Metal = 0x2040, + snd_se_menu_Narration_NoContest = 0x2041, + snd_se_menu_Narration_TeamBlue = 0x2042, + snd_se_menu_Narration_TeamGreen = 0x2043, + snd_se_menu_Narration_TeamRed = 0x2044, + snd_se_menu_Narration_WinnerIs = 0x2045, + snd_se_menu_Narration_ChoseChara = 0x2046, + snd_se_menu_Narration_Ready2Fight = 0x2047, + snd_se_menu_delete_attention_1 = 0x2048, + snd_se_menu_delete_attention_2 = 0x2049, + snd_se_menu_data_delete = 0x204A, + snd_se_menu_all_delete = 0x204B, + snd_se_menu_font_enter = 0x204C, + snd_se_menu_font_delete = 0x204D, + snd_se_menu_wifi_connect_loop = 0x204E, + snd_se_menu_wifi_connect_success = 0x204F, + snd_se_menu_wifi_connect_cut = 0x2050, + snd_se_menu_mach_in = 0x2051, + snd_se_menu_mach_out = 0x2052, + snd_se_menu_41 = 0x2053, + snd_se_menu_online_pause = 0x2054, + snd_se_menu_online_entry_info = 0x2055, + snd_se_menu_44 = 0x2056, + snd_seq_stage_Pictchat_01 = 0x2057, + snd_seq_stage_Pictchat_02 = 0x2058, + snd_seq_stage_Pictchat_03 = 0x2059, + snd_seq_stage_Pictchat_04 = 0x205A, + snd_seq_stage_Pictchat_05 = 0x205B, + snd_seq_stage_Pictchat_06 = 0x205C, + snd_seq_stage_Pictchat_07 = 0x205D, + snd_seq_stage_Pictchat_08 = 0x205E, + snd_seq_stage_Pictchat_09 = 0x205F, + snd_seq_stage_Pictchat_10 = 0x2060, + snd_seq_stage_Pictchat_11 = 0x2061, + snd_seq_stage_Pictchat_12 = 0x2062, + snd_seq_stage_Pictchat_13 = 0x2063, + snd_seq_stage_Pictchat_14 = 0x2064, + snd_seq_stage_Pictchat_15 = 0x2065, + snd_seq_stage_Pictchat_16 = 0x2066, + snd_seq_stage_Pictchat_17 = 0x2067, + snd_seq_stage_Pictchat_18 = 0x2068, + snd_seq_stage_Pictchat_19 = 0x2069, + snd_seq_stage_Pictchat_20 = 0x206A, + snd_seq_stage_Pictchat_21 = 0x206B, + snd_seq_stage_Pictchat_22 = 0x206C, + snd_seq_stage_Pictchat_23 = 0x206D, + snd_seq_stage_Pictchat_24 = 0x206E, + snd_seq_stage_Pictchat_25 = 0x206F, + snd_seq_stage_Pictchat_26 = 0x2070, + snd_seq_stage_Pictchat_27 = 0x2071, + snd_seq_item_Hammer = 0x2072, + snd_seq_item_Goldenhammer = 0x2073, + snd_seq_item_Superstar = 0x2074, + snd_seq_item_mushroom = 0x2075, + snd_seq_item_mushd = 0x2076, + snd_seq_item_kusudama_01 = 0x2077, + snd_seq_item_kusudama_02 = 0x2078, + snd_seq_assist_Barbara = 0x2079, + snd_seq_item_Warpstar_A = 0x207A, + snd_seq_item_Warpstar_B = 0x207B, + snd_seq_item_Warpstar_C = 0x207C, + snd_seq_item_Warpstar_D = 0x207D, + snd_seq_item_Warpstar_Rakka = 0x207E, + snd_seq_item_Warpstar_F = 0x207F, + snd_seq_doseisan_01 = 0x2080, + snd_seq_doseisan_02 = 0x2081, + snd_seq_doseisan_03 = 0x2082, + snd_seq_item_goldenhammer_enter = 0x2083, + snd_seq_legend_poke = 0x2084, + snd_seq_item_45 = 0x2085, + snd_seq_item_46 = 0x2086, + snd_seq_item_47 = 0x2087, + snd_seq_SA_Starfox_Fox_space_01 = 0x2088, + snd_seq_SA_Starfox_Fox_space_02 = 0x2089, + snd_seq_SA_Starfox_Fox_space_03 = 0x208A, + snd_seq_SA_Starfox_Fox_space_04 = 0x208B, + snd_seq_SA_Starfox_Fox_space_05 = 0x208C, + snd_seq_SA_Starfox_Fox_space_06 = 0x208D, + snd_seq_SA_Starfox_Fox_combat_01 = 0x208E, + snd_seq_SA_Starfox_Fox_combat_02 = 0x208F, + snd_seq_SA_Starfox_Fox_combat_03 = 0x2090, + snd_seq_SA_Starfox_Fox_combat_04 = 0x2091, + snd_seq_SA_Starfox_Fox_combat_05 = 0x2092, + snd_seq_SA_Starfox_Fox_combat_06 = 0x2093, + snd_seq_SA_Starfox_Fox_corneria_01 = 0x2094, + snd_seq_SA_Starfox_Fox_corneria_02 = 0x2095, + snd_seq_SA_Starfox_Fox_corneria_03 = 0x2096, + snd_seq_SA_Starfox_Fox_corneria_04 = 0x2097, + snd_seq_SA_Starfox_Fox_corneria_05 = 0x2098, + snd_seq_SA_Starfox_Fox_corneria_06 = 0x2099, + snd_seq_SA_Starfox_Fox_corneria_07 = 0x209A, + snd_seq_SA_Starfox_Fox_corneria_08 = 0x209B, + snd_seq_SA_Starfox_Fox_asteroid_01 = 0x209C, + snd_seq_SA_Starfox_Fox_asteroid_02 = 0x209D, + snd_seq_SA_Starfox_Fox_asteroid_03 = 0x209E, + snd_seq_SA_Starfox_Fox_asteroid_04 = 0x209F, + snd_seq_SA_Starfox_Fox_asteroid_05 = 0x20A0, + snd_seq_SA_Starfox_Fox_battleship_01 = 0x20A1, + snd_seq_SA_Starfox_Fox_battleship_02 = 0x20A2, + snd_seq_SA_Starfox_Fox_battleship_03 = 0x20A3, + snd_seq_SA_Starfox_Fox_battleship_04 = 0x20A4, + snd_seq_SA_Starfox_Fox_battleship_05 = 0x20A5, + snd_seq_SA_Starfox_Fox_battleship_06 = 0x20A6, + snd_seq_SA_Starfox_Falco_space_01 = 0x20A7, + snd_seq_SA_Starfox_Falco_space_02 = 0x20A8, + snd_seq_SA_Starfox_Falco_space_03 = 0x20A9, + snd_seq_SA_Starfox_Falco_space_04 = 0x20AA, + snd_seq_SA_Starfox_Falco_space_05 = 0x20AB, + snd_seq_SA_Starfox_Falco_space_06 = 0x20AC, + snd_seq_SA_Starfox_Falco_space_07 = 0x20AD, + snd_seq_SA_Starfox_Falco_combat_01 = 0x20AE, + snd_seq_SA_Starfox_Falco_combat_02 = 0x20AF, + snd_seq_SA_Starfox_Falco_combat_03 = 0x20B0, + snd_seq_SA_Starfox_Falco_combat_04 = 0x20B1, + snd_seq_SA_Starfox_Falco_combat_05 = 0x20B2, + snd_seq_SA_Starfox_Falco_combat_06 = 0x20B3, + snd_seq_SA_Starfox_Falco_combat_07 = 0x20B4, + snd_seq_SA_Starfox_Falco_corneria_01 = 0x20B5, + snd_seq_SA_Starfox_Falco_corneria_02 = 0x20B6, + snd_seq_SA_Starfox_Falco_corneria_03 = 0x20B7, + snd_seq_SA_Starfox_Falco_corneria_04 = 0x20B8, + snd_seq_SA_Starfox_Falco_corneria_05 = 0x20B9, + snd_seq_SA_Starfox_Falco_corneria_06 = 0x20BA, + snd_seq_SA_Starfox_Falco_asteroid_01 = 0x20BB, + snd_seq_SA_Starfox_Falco_asteroid_02 = 0x20BC, + snd_seq_SA_Starfox_Falco_asteroid_03 = 0x20BD, + snd_seq_SA_Starfox_Falco_asteroid_04 = 0x20BE, + snd_seq_SA_Starfox_Falco_asteroid_05 = 0x20BF, + snd_seq_SA_Starfox_Falco_asteroid_06 = 0x20C0, + snd_seq_SA_Starfox_Falco_battleship_01 = 0x20C1, + snd_seq_SA_Starfox_Falco_battleship_02 = 0x20C2, + snd_seq_SA_Starfox_Falco_battleship_03 = 0x20C3, + snd_seq_SA_Starfox_Falco_battleship_04 = 0x20C4, + snd_seq_SA_Starfox_Falco_battleship_05 = 0x20C5, + snd_seq_SA_Starfox_Falco_battleship_06 = 0x20C6, + snd_seq_SA_Starfox_Wolf_space_01 = 0x20C7, + snd_seq_SA_Starfox_Wolf_space_02 = 0x20C8, + snd_seq_SA_Starfox_Wolf_space_03 = 0x20C9, + snd_seq_SA_Starfox_Wolf_space_04 = 0x20CA, + snd_seq_SA_Starfox_Wolf_space_05 = 0x20CB, + snd_seq_SA_Starfox_Wolf_space_06 = 0x20CC, + snd_seq_SA_Starfox_Wolf_space_07 = 0x20CD, + snd_seq_SA_Starfox_Wolf_combat_01 = 0x20CE, + snd_seq_SA_Starfox_Wolf_combat_02 = 0x20CF, + snd_seq_SA_Starfox_Wolf_combat_03 = 0x20D0, + snd_seq_SA_Starfox_Wolf_combat_04 = 0x20D1, + snd_seq_SA_Starfox_Wolf_combat_05 = 0x20D2, + snd_seq_SA_Starfox_Wolf_combat_06 = 0x20D3, + snd_seq_SA_Starfox_Wolf_corneria_01 = 0x20D4, + snd_seq_SA_Starfox_Wolf_corneria_02 = 0x20D5, + snd_seq_SA_Starfox_Wolf_corneria_03 = 0x20D6, + snd_seq_SA_Starfox_Wolf_corneria_04 = 0x20D7, + snd_seq_SA_Starfox_Wolf_corneria_05 = 0x20D8, + snd_seq_SA_Starfox_Wolf_corneria_06 = 0x20D9, + snd_seq_SA_Starfox_Wolf_asteroid_01 = 0x20DA, + snd_seq_SA_Starfox_Wolf_asteroid_02 = 0x20DB, + snd_seq_SA_Starfox_Wolf_asteroid_03 = 0x20DC, + snd_seq_SA_Starfox_Wolf_asteroid_04 = 0x20DD, + snd_seq_SA_Starfox_Wolf_asteroid_05 = 0x20DE, + snd_seq_SA_Starfox_Wolf_asteroid_06 = 0x20DF, + snd_seq_SA_Starfox_Wolf_asteroid_07 = 0x20E0, + snd_seq_SA_Starfox_Wolf_asteroid_08 = 0x20E1, + snd_seq_SA_Starfox_Wolf_battleship_01 = 0x20E2, + snd_seq_SA_Starfox_Wolf_battleship_02 = 0x20E3, + snd_seq_SA_Starfox_Wolf_battleship_03 = 0x20E4, + snd_seq_SA_Starfox_Wolf_battleship_04 = 0x20E5, + snd_seq_SA_Starfox_Wolf_battleship_05 = 0x20E6, + snd_seq_SA_Starfox_Wolf_battleship_06 = 0x20E7, + snd_seq_SA_Starfox_Wolf_battleship_07 = 0x20E8, + snd_seq_SA_Starfox_Wolf_battleship_08 = 0x20E9, + snd_seq_SA_Starfox_Wolf_battleship_09 = 0x20EA, + snd_seq_SA_Corneria_Fox_e_01 = 0x20EB, + snd_seq_SA_Corneria_Fox_e_02 = 0x20EC, + snd_seq_SA_Corneria_Fox_e_03 = 0x20ED, + snd_seq_SA_Corneria_Fox_f_01 = 0x20EE, + snd_seq_SA_Corneria_Fox_f_02 = 0x20EF, + snd_seq_SA_Corneria_Fox_f_03 = 0x20F0, + snd_seq_SA_Corneria_Fox_f_04 = 0x20F1, + snd_seq_SA_Corneria_Fox_g_01 = 0x20F2, + snd_seq_SA_Corneria_Fox_g_02 = 0x20F3, + snd_seq_SA_Corneria_Fox_g_03 = 0x20F4, + snd_seq_SA_Corneria_Fox_g_04 = 0x20F5, + snd_seq_SA_Corneria_Fox_h_01 = 0x20F6, + snd_seq_SA_Corneria_Fox_h_02 = 0x20F7, + snd_seq_SA_Corneria_Fox_h_03 = 0x20F8, + snd_seq_SA_Corneria_Fox_i_01 = 0x20F9, + snd_seq_SA_Corneria_Fox_i_02 = 0x20FA, + snd_seq_SA_Corneria_Fox_i_03 = 0x20FB, + snd_seq_SA_Corneria_Falco_a_01 = 0x20FC, + snd_seq_SA_Corneria_Falco_a_02 = 0x20FD, + snd_seq_SA_Corneria_Falco_a_03 = 0x20FE, + snd_seq_SA_Corneria_Falco_a_04 = 0x20FF, + snd_seq_SA_Corneria_Falco_b_01 = 0x2100, + snd_seq_SA_Corneria_Falco_b_02 = 0x2101, + snd_seq_SA_Corneria_Falco_b_03 = 0x2102, + snd_seq_SA_Corneria_Falco_b_04 = 0x2103, + snd_seq_SA_Corneria_Falco_c_01 = 0x2104, + snd_seq_SA_Corneria_Falco_c_02 = 0x2105, + snd_seq_SA_Corneria_Falco_c_03 = 0x2106, + snd_seq_SA_Corneria_Falco_d_01 = 0x2107, + snd_seq_SA_Corneria_Falco_d_02 = 0x2108, + snd_seq_SA_Corneria_Falco_d_03 = 0x2109, + snd_seq_SA_Corneria_Falco_e_01 = 0x210A, + snd_seq_SA_Corneria_Falco_e_02 = 0x210B, + snd_seq_SA_Corneria_Falco_e_03 = 0x210C, + snd_seq_SA_Snake_Mario_01 = 0x210D, + snd_seq_SA_Snake_Mario_02 = 0x210E, + snd_seq_SA_Snake_Mario_03 = 0x210F, + snd_seq_SA_Snake_Mario_04 = 0x2110, + snd_seq_SA_Snake_Mario_05 = 0x2111, + snd_seq_SA_Snake_Mario_06 = 0x2112, + snd_seq_SA_Snake_Mario_07 = 0x2113, + snd_seq_SA_Snake_Donkey_01 = 0x2114, + snd_seq_SA_Snake_Donkey_02 = 0x2115, + snd_seq_SA_Snake_Donkey_03 = 0x2116, + snd_seq_SA_Snake_Donkey_04 = 0x2117, + snd_seq_SA_Snake_Donkey_05 = 0x2118, + snd_seq_SA_Snake_Donkey_06 = 0x2119, + snd_seq_SA_Snake_Donkey_07 = 0x211A, + snd_seq_SA_Snake_Link_01 = 0x211B, + snd_seq_SA_Snake_Link_02 = 0x211C, + snd_seq_SA_Snake_Link_03 = 0x211D, + snd_seq_SA_Snake_Link_04 = 0x211E, + snd_seq_SA_Snake_Link_05 = 0x211F, + snd_seq_SA_Snake_Link_06 = 0x2120, + snd_seq_SA_Snake_Link_07 = 0x2121, + snd_seq_SA_Snake_Link_08 = 0x2122, + snd_seq_SA_Snake_Link_09 = 0x2123, + snd_seq_SA_Snake_Samus_01 = 0x2124, + snd_seq_SA_Snake_Samus_02 = 0x2125, + snd_seq_SA_Snake_Samus_03 = 0x2126, + snd_seq_SA_Snake_Samus_04 = 0x2127, + snd_seq_SA_Snake_Samus_05 = 0x2128, + snd_seq_SA_Snake_Samus_06 = 0x2129, + snd_seq_SA_Snake_Samus_07 = 0x212A, + snd_seq_SA_Snake_Samus_08 = 0x212B, + snd_seq_SA_Snake_Samus_09 = 0x212C, + snd_seq_SA_Snake_Yoshi_01 = 0x212D, + snd_seq_SA_Snake_Yoshi_02 = 0x212E, + snd_seq_SA_Snake_Yoshi_03 = 0x212F, + snd_seq_SA_Snake_Yoshi_04 = 0x2130, + snd_seq_SA_Snake_Yoshi_05 = 0x2131, + snd_seq_SA_Snake_Yoshi_06 = 0x2132, + snd_seq_SA_Snake_Yoshi_07 = 0x2133, + snd_seq_SA_Snake_Yoshi_08 = 0x2134, + snd_seq_SA_Snake_Yoshi_09 = 0x2135, + snd_seq_SA_Snake_Kirby_01 = 0x2136, + snd_seq_SA_Snake_Kirby_02 = 0x2137, + snd_seq_SA_Snake_Kirby_03 = 0x2138, + snd_seq_SA_Snake_Kirby_04 = 0x2139, + snd_seq_SA_Snake_Kirby_05 = 0x213A, + snd_seq_SA_Snake_Kirby_06 = 0x213B, + snd_seq_SA_Snake_Kirby_07 = 0x213C, + snd_seq_SA_Snake_Kirby_08 = 0x213D, + snd_seq_SA_Snake_Fox_01 = 0x213E, + snd_seq_SA_Snake_Fox_02 = 0x213F, + snd_seq_SA_Snake_Fox_03 = 0x2140, + snd_seq_SA_Snake_Fox_04 = 0x2141, + snd_seq_SA_Snake_Fox_05 = 0x2142, + snd_seq_SA_Snake_Fox_06 = 0x2143, + snd_seq_SA_Snake_Fox_07 = 0x2144, + snd_seq_SA_Snake_Fox_08 = 0x2145, + snd_seq_SA_Snake_Pikachu_01 = 0x2146, + snd_seq_SA_Snake_Pikachu_02 = 0x2147, + snd_seq_SA_Snake_Pikachu_03 = 0x2148, + snd_seq_SA_Snake_Pikachu_04 = 0x2149, + snd_seq_SA_Snake_Pikachu_05 = 0x214A, + snd_seq_SA_Snake_Pikachu_06 = 0x214B, + snd_seq_SA_Snake_Pikachu_07 = 0x214C, + snd_seq_SA_Snake_Pikachu_08 = 0x214D, + snd_seq_SA_Snake_Pikachu_09 = 0x214E, + snd_seq_SA_Snake_Pikachu_10 = 0x214F, + snd_seq_SA_Snake_Pikachu_11 = 0x2150, + snd_seq_SA_Snake_Luigi_01 = 0x2151, + snd_seq_SA_Snake_Luigi_02 = 0x2152, + snd_seq_SA_Snake_Luigi_03 = 0x2153, + snd_seq_SA_Snake_Luigi_04 = 0x2154, + snd_seq_SA_Snake_Luigi_05 = 0x2155, + snd_seq_SA_Snake_Luigi_06 = 0x2156, + snd_seq_SA_Snake_Luigi_07 = 0x2157, + snd_seq_SA_Snake_Luigi_08 = 0x2158, + snd_seq_SA_Snake_Luigi_09 = 0x2159, + snd_seq_SA_Snake_Captainfalcon_01 = 0x215A, + snd_seq_SA_Snake_Captainfalcon_02 = 0x215B, + snd_seq_SA_Snake_Captainfalcon_03 = 0x215C, + snd_seq_SA_Snake_Captainfalcon_04 = 0x215D, + snd_seq_SA_Snake_Captainfalcon_05 = 0x215E, + snd_seq_SA_Snake_Captainfalcon_06 = 0x215F, + snd_seq_SA_Snake_Ness_01 = 0x2160, + snd_seq_SA_Snake_Ness_02 = 0x2161, + snd_seq_SA_Snake_Ness_03 = 0x2162, + snd_seq_SA_Snake_Ness_04 = 0x2163, + snd_seq_SA_Snake_Ness_05 = 0x2164, + snd_seq_SA_Snake_Ness_06 = 0x2165, + snd_seq_SA_Snake_Ness_07 = 0x2166, + snd_seq_SA_Snake_Ness_08 = 0x2167, + snd_seq_SA_Snake_Ness_09 = 0x2168, + snd_seq_SA_Snake_Ness_10 = 0x2169, + snd_seq_SA_Snake_Koopa_01 = 0x216A, + snd_seq_SA_Snake_Koopa_02 = 0x216B, + snd_seq_SA_Snake_Koopa_03 = 0x216C, + snd_seq_SA_Snake_Koopa_04 = 0x216D, + snd_seq_SA_Snake_Koopa_05 = 0x216E, + snd_seq_SA_Snake_Koopa_06 = 0x216F, + snd_seq_SA_Snake_Koopa_07 = 0x2170, + snd_seq_SA_Snake_Peach_01 = 0x2171, + snd_seq_SA_Snake_Peach_02 = 0x2172, + snd_seq_SA_Snake_Peach_03 = 0x2173, + snd_seq_SA_Snake_Peach_04 = 0x2174, + snd_seq_SA_Snake_Peach_05 = 0x2175, + snd_seq_SA_Snake_Peach_06 = 0x2176, + snd_seq_SA_Snake_Peach_07 = 0x2177, + snd_seq_SA_Snake_Peach_08 = 0x2178, + snd_seq_SA_Snake_Peach_09 = 0x2179, + snd_seq_SA_Snake_Zelda_01 = 0x217A, + snd_seq_SA_Snake_Zelda_02 = 0x217B, + snd_seq_SA_Snake_Zelda_03 = 0x217C, + snd_seq_SA_Snake_Zelda_04 = 0x217D, + snd_seq_SA_Snake_Zelda_05 = 0x217E, + snd_seq_SA_Snake_Zelda_06 = 0x217F, + snd_seq_SA_Snake_Zelda_07 = 0x2180, + snd_seq_SA_Snake_Zelda_08 = 0x2181, + snd_seq_SA_Snake_Shiek_01 = 0x2182, + snd_seq_SA_Snake_Shiek_02 = 0x2183, + snd_seq_SA_Snake_Shiek_03 = 0x2184, + snd_seq_SA_Snake_Shiek_04 = 0x2185, + snd_seq_SA_Snake_Shiek_05 = 0x2186, + snd_seq_SA_Snake_Shiek_06 = 0x2187, + snd_seq_SA_Snake_Shiek_07 = 0x2188, + snd_seq_SA_Snake_Shiek_08 = 0x2189, + snd_seq_SA_Snake_Shiek_09 = 0x218A, + snd_seq_SA_Snake_Iceclimber_01 = 0x218B, + snd_seq_SA_Snake_Iceclimber_02 = 0x218C, + snd_seq_SA_Snake_Iceclimber_03 = 0x218D, + snd_seq_SA_Snake_Iceclimber_04 = 0x218E, + snd_seq_SA_Snake_Iceclimber_05 = 0x218F, + snd_seq_SA_Snake_Iceclimber_06 = 0x2190, + snd_seq_SA_Snake_Iceclimber_07 = 0x2191, + snd_seq_SA_Snake_Iceclimber_08 = 0x2192, + snd_seq_SA_Snake_Iceclimber_09 = 0x2193, + snd_seq_SA_Snake_Iceclimber_10 = 0x2194, + snd_seq_SA_Snake_Marth_01 = 0x2195, + snd_seq_SA_Snake_Marth_02 = 0x2196, + snd_seq_SA_Snake_Marth_03 = 0x2197, + snd_seq_SA_Snake_Marth_04 = 0x2198, + snd_seq_SA_Snake_Marth_05 = 0x2199, + snd_seq_SA_Snake_Marth_06 = 0x219A, + snd_seq_SA_Snake_Marth_07 = 0x219B, + snd_seq_SA_Snake_Marth_08 = 0x219C, + snd_seq_SA_Snake_Marth_09 = 0x219D, + snd_seq_SA_Snake_GW_01 = 0x219E, + snd_seq_SA_Snake_GW_02 = 0x219F, + snd_seq_SA_Snake_GW_03 = 0x21A0, + snd_seq_SA_Snake_GW_04 = 0x21A1, + snd_seq_SA_Snake_GW_05 = 0x21A2, + snd_seq_SA_Snake_GW_06 = 0x21A3, + snd_seq_SA_Snake_GW_07 = 0x21A4, + snd_seq_SA_Snake_GW_08 = 0x21A5, + snd_seq_SA_Snake_Falco_01 = 0x21A6, + snd_seq_SA_Snake_Falco_02 = 0x21A7, + snd_seq_SA_Snake_Falco_03 = 0x21A8, + snd_seq_SA_Snake_Falco_04 = 0x21A9, + snd_seq_SA_Snake_Falco_05 = 0x21AA, + snd_seq_SA_Snake_Falco_06 = 0x21AB, + snd_seq_SA_Snake_Falco_07 = 0x21AC, + snd_seq_SA_Snake_Falco_08 = 0x21AD, + snd_seq_SA_Snake_Falco_09 = 0x21AE, + snd_seq_SA_Snake_Falco_10 = 0x21AF, + snd_seq_SA_Snake_Falco_11 = 0x21B0, + snd_seq_SA_Snake_Falco_12 = 0x21B1, + snd_seq_SA_Snake_Falco_13 = 0x21B2, + snd_seq_SA_Snake_Ganondorf_01 = 0x21B3, + snd_seq_SA_Snake_Ganondorf_02 = 0x21B4, + snd_seq_SA_Snake_Ganondorf_03 = 0x21B5, + snd_seq_SA_Snake_Ganondorf_04 = 0x21B6, + snd_seq_SA_Snake_Ganondorf_05 = 0x21B7, + snd_seq_SA_Snake_Ganondorf_06 = 0x21B8, + snd_seq_SA_Snake_Ganondorf_07 = 0x21B9, + snd_seq_SA_Snake_Ganondorf_08 = 0x21BA, + snd_seq_SA_Snake_Wario_01 = 0x21BB, + snd_seq_SA_Snake_Wario_02 = 0x21BC, + snd_seq_SA_Snake_Wario_03 = 0x21BD, + snd_seq_SA_Snake_Wario_04 = 0x21BE, + snd_seq_SA_Snake_Wario_05 = 0x21BF, + snd_seq_SA_Snake_Wario_06 = 0x21C0, + snd_seq_SA_Snake_Wario_07 = 0x21C1, + snd_seq_SA_Snake_Wario_08 = 0x21C2, + snd_seq_SA_Snake_Wario_09 = 0x21C3, + snd_seq_SA_Snake_Wario_10 = 0x21C4, + snd_seq_SA_Snake_Wario_11 = 0x21C5, + snd_seq_SA_Snake_Metanight_01 = 0x21C6, + snd_seq_SA_Snake_Metanight_02 = 0x21C7, + snd_seq_SA_Snake_Metanight_03 = 0x21C8, + snd_seq_SA_Snake_Metanight_04 = 0x21C9, + snd_seq_SA_Snake_Metanight_05 = 0x21CA, + snd_seq_SA_Snake_Metanight_06 = 0x21CB, + snd_seq_SA_Snake_Metanight_07 = 0x21CC, + snd_seq_SA_Snake_Metanight_08 = 0x21CD, + snd_seq_SA_Snake_Metanight_09 = 0x21CE, + snd_seq_SA_Snake_Pit_01 = 0x21CF, + snd_seq_SA_Snake_Pit_02 = 0x21D0, + snd_seq_SA_Snake_Pit_03 = 0x21D1, + snd_seq_SA_Snake_Pit_04 = 0x21D2, + snd_seq_SA_Snake_Pit_05 = 0x21D3, + snd_seq_SA_Snake_Pit_06 = 0x21D4, + snd_seq_SA_Snake_Pit_07 = 0x21D5, + snd_seq_SA_Snake_Pit_08 = 0x21D6, + snd_seq_SA_Snake_Pit_09 = 0x21D7, + snd_seq_SA_Snake_Szerosuit_01 = 0x21D8, + snd_seq_SA_Snake_Szerosuit_02 = 0x21D9, + snd_seq_SA_Snake_Szerosuit_03 = 0x21DA, + snd_seq_SA_Snake_Szerosuit_04 = 0x21DB, + snd_seq_SA_Snake_Szerosuit_05 = 0x21DC, + snd_seq_SA_Snake_Szerosuit_06 = 0x21DD, + snd_seq_SA_Snake_Szerosuit_07 = 0x21DE, + snd_seq_SA_Snake_Szerosuit_08 = 0x21DF, + snd_seq_SA_Snake_Pikmin_01 = 0x21E0, + snd_seq_SA_Snake_Pikmin_02 = 0x21E1, + snd_seq_SA_Snake_Pikmin_03 = 0x21E2, + snd_seq_SA_Snake_Pikmin_04 = 0x21E3, + snd_seq_SA_Snake_Pikmin_05 = 0x21E4, + snd_seq_SA_Snake_Pikmin_06 = 0x21E5, + snd_seq_SA_Snake_Pikmin_07 = 0x21E6, + snd_seq_SA_Snake_Pikmin_08 = 0x21E7, + snd_seq_SA_Snake_Pikmin_09 = 0x21E8, + snd_seq_SA_Snake_Pikmin_10 = 0x21E9, + snd_seq_SA_Snake_Lucas_01 = 0x21EA, + snd_seq_SA_Snake_Lucas_02 = 0x21EB, + snd_seq_SA_Snake_Lucas_03 = 0x21EC, + snd_seq_SA_Snake_Lucas_04 = 0x21ED, + snd_seq_SA_Snake_Lucas_05 = 0x21EE, + snd_seq_SA_Snake_Lucas_06 = 0x21EF, + snd_seq_SA_Snake_Lucas_07 = 0x21F0, + snd_seq_SA_Snake_Lucas_08 = 0x21F1, + snd_seq_SA_Snake_Lucas_09 = 0x21F2, + snd_seq_SA_Snake_Diddy_01 = 0x21F3, + snd_seq_SA_Snake_Diddy_02 = 0x21F4, + snd_seq_SA_Snake_Diddy_03 = 0x21F5, + snd_seq_SA_Snake_Diddy_04 = 0x21F6, + snd_seq_SA_Snake_Diddy_05 = 0x21F7, + snd_seq_SA_Snake_Diddy_06 = 0x21F8, + snd_seq_SA_Snake_Diddy_07 = 0x21F9, + snd_seq_SA_Snake_Diddy_08 = 0x21FA, + snd_seq_SA_Snake_PokeTrainer_01 = 0x21FB, + snd_seq_SA_Snake_PokeTrainer_02 = 0x21FC, + snd_seq_SA_Snake_PokeTrainer_03 = 0x21FD, + snd_seq_SA_Snake_PokeTrainer_04 = 0x21FE, + snd_seq_SA_Snake_PokeTrainer_05 = 0x21FF, + snd_seq_SA_Snake_PokeTrainer_06 = 0x2200, + snd_seq_SA_Snake_PokeTrainer_07 = 0x2201, + snd_seq_SA_Snake_PokeTrainer_08 = 0x2202, + snd_seq_SA_Snake_PokeTrainer_09 = 0x2203, + snd_seq_SA_Snake_Dedede_01 = 0x2204, + snd_seq_SA_Snake_Dedede_02 = 0x2205, + snd_seq_SA_Snake_Dedede_03 = 0x2206, + snd_seq_SA_Snake_Dedede_04 = 0x2207, + snd_seq_SA_Snake_Dedede_05 = 0x2208, + snd_seq_SA_Snake_Dedede_06 = 0x2209, + snd_seq_SA_Snake_Dedede_07 = 0x220A, + snd_seq_SA_Snake_Dedede_08 = 0x220B, + snd_seq_SA_Snake_Dedede_09 = 0x220C, + snd_seq_SA_Snake_Lucario_01 = 0x220D, + snd_seq_SA_Snake_Lucario_02 = 0x220E, + snd_seq_SA_Snake_Lucario_03 = 0x220F, + snd_seq_SA_Snake_Lucario_04 = 0x2210, + snd_seq_SA_Snake_Lucario_05 = 0x2211, + snd_seq_SA_Snake_Lucario_06 = 0x2212, + snd_seq_SA_Snake_Lucario_07 = 0x2213, + snd_seq_SA_Snake_Lucario_08 = 0x2214, + snd_seq_SA_Snake_Lucario_09 = 0x2215, + snd_seq_SA_Snake_Lucario_10 = 0x2216, + snd_seq_SA_Snake_Lucario_11 = 0x2217, + snd_seq_SA_Snake_Ike_01 = 0x2218, + snd_seq_SA_Snake_Ike_02 = 0x2219, + snd_seq_SA_Snake_Ike_03 = 0x221A, + snd_seq_SA_Snake_Ike_04 = 0x221B, + snd_seq_SA_Snake_Ike_05 = 0x221C, + snd_seq_SA_Snake_Ike_06 = 0x221D, + snd_seq_SA_Snake_Ike_07 = 0x221E, + snd_seq_SA_Snake_Ike_08 = 0x221F, + snd_seq_SA_Snake_Ike_09 = 0x2220, + snd_seq_SA_Snake_Robot_01 = 0x2221, + snd_seq_SA_Snake_Robot_02 = 0x2222, + snd_seq_SA_Snake_Robot_03 = 0x2223, + snd_seq_SA_Snake_Robot_04 = 0x2224, + snd_seq_SA_Snake_Robot_05 = 0x2225, + snd_seq_SA_Snake_Robot_06 = 0x2226, + snd_seq_SA_Snake_Robot_07 = 0x2227, + snd_seq_SA_Snake_Robot_08 = 0x2228, + snd_seq_SA_Snake_Purin_01 = 0x2229, + snd_seq_SA_Snake_Purin_02 = 0x222A, + snd_seq_SA_Snake_Purin_03 = 0x222B, + snd_seq_SA_Snake_Purin_04 = 0x222C, + snd_seq_SA_Snake_Purin_05 = 0x222D, + snd_seq_SA_Snake_Purin_06 = 0x222E, + snd_seq_SA_Snake_Purin_07 = 0x222F, + snd_seq_SA_Snake_Purin_08 = 0x2230, + snd_seq_SA_Snake_Purin_09 = 0x2231, + snd_seq_SA_Snake_Purin_10 = 0x2232, + snd_seq_SA_Snake_Toonlink_01 = 0x2233, + snd_seq_SA_Snake_Toonlink_02 = 0x2234, + snd_seq_SA_Snake_Toonlink_03 = 0x2235, + snd_seq_SA_Snake_Toonlink_04 = 0x2236, + snd_seq_SA_Snake_Toonlink_05 = 0x2237, + snd_seq_SA_Snake_Toonlink_06 = 0x2238, + snd_seq_SA_Snake_Toonlink_07 = 0x2239, + snd_seq_SA_Snake_Toonlink_08 = 0x223A, + snd_seq_SA_Snake_Toonlink_09 = 0x223B, + snd_seq_SA_Snake_Wolf_01 = 0x223C, + snd_seq_SA_Snake_Wolf_02 = 0x223D, + snd_seq_SA_Snake_Wolf_03 = 0x223E, + snd_seq_SA_Snake_Wolf_04 = 0x223F, + snd_seq_SA_Snake_Wolf_05 = 0x2240, + snd_seq_SA_Snake_Wolf_06 = 0x2241, + snd_seq_SA_Snake_Wolf_07 = 0x2242, + snd_seq_SA_Snake_Wolf_08 = 0x2243, + snd_seq_SA_Snake_Wolf_09 = 0x2244, + snd_seq_SA_Snake_Snake_01 = 0x2245, + snd_seq_SA_Snake_Snake_02 = 0x2246, + snd_seq_SA_Snake_Snake_03 = 0x2247, + snd_seq_SA_Snake_Snake_04 = 0x2248, + snd_seq_SA_Snake_Snake_05 = 0x2249, + snd_seq_SA_Snake_Snake_06 = 0x224A, + snd_seq_SA_Snake_Snake_07 = 0x224B, + snd_seq_SA_Snake_Snake_08 = 0x224C, + snd_seq_SA_Snake_Snake_09 = 0x224D, + snd_seq_SA_Snake_Sonic_01 = 0x224E, + snd_seq_SA_Snake_Sonic_02 = 0x224F, + snd_seq_SA_Snake_Sonic_03 = 0x2250, + snd_seq_SA_Snake_Sonic_04 = 0x2251, + snd_seq_SA_Snake_Sonic_05 = 0x2252, + snd_seq_SA_Snake_Sonic_06 = 0x2253, + snd_seq_SA_Snake_Sonic_07 = 0x2254, + snd_seq_SA_Snake_Sonic_08 = 0x2255, + snd_seq_SA_Snake_Sonic_09 = 0x2256, + snd_seq_SA_Snake_End_Campbell_01 = 0x2257, + snd_seq_SA_Snake_End_Otacon_01 = 0x2258, + snd_seq_SA_Snake_End_Mei_01 = 0x2259, + snd_seq_SA_Snake_End_Slippy_01 = 0x225A, + snd_se_ADVstage_common_01 = 0x225B, + snd_se_ADVstage_common_02 = 0x225C, + snd_se_ADVstage_common_03 = 0x225D, + snd_se_ADVstage_common_04 = 0x225E, + snd_se_ADVstage_common_05 = 0x225F, + snd_se_ADVstage_common_06 = 0x2260, + snd_se_ADVstage_common_08 = 0x2261, + snd_se_ADVstage_common_09 = 0x2262, + snd_se_ADVstage_common_11 = 0x2263, + snd_se_ADVstage_common_12 = 0x2264, + snd_se_ADVstage_common_13 = 0x2265, + snd_se_ADVstage_common_14 = 0x2266, + snd_se_ADVstage_common_15 = 0x2267, + snd_se_ADVstage_common_16 = 0x2268, + snd_se_ADVstage_common_17 = 0x2269, + snd_se_ADVstage_common_18 = 0x226A, + snd_se_ADVstage_common_19 = 0x226B, + snd_se_ADVstage_common_20 = 0x226C, + snd_se_ADVstage_common_21 = 0x226D, + snd_se_ADVstage_common_23 = 0x226E, + snd_se_ADVstage_common_TOROKKO_CLOSE = 0x226F, + snd_se_ADVstage_common_TOROKKO_MOVE = 0x2270, + snd_se_ADVstage_common_TOROKKO_JUMP = 0x2271, + snd_se_ADVstage_common_TOROKKO_CRASH = 0x2272, + snd_se_ADVstage_common_TOROKKO_FIRE = 0x2273, + snd_se_ADVstage_common_KIBAKU_BLOCK = 0x2274, + snd_se_ADVstage_common_YUBAKU_BLOCK = 0x2275, + snd_se_ADVstage_common_RAKKA_BLOCK = 0x2276, + snd_se_ADVstage_common_KEY = 0x2277, + snd_se_ADVstage_common_MINE_ON = 0x2278, + snd_se_ADVstage_common_MINE_BOMB = 0x2279, + snd_se_ADVstage_common_BULLET = 0x227A, + snd_se_ADVstage_common_SCREEN_LOCK = 0x227B, + snd_se_ADVstage_common_SCREEN_UNLOCK = 0x227C, + snd_se_ADVstage_common_38 = 0x227D, + snd_se_ADVstage_common_39 = 0x227E, + snd_se_ADVstage_common_ENEMY_GENERATE = 0x227F, + snd_se_ADVstage_common_41 = 0x2280, + snd_se_ADVstage_common_RESULT_LETTER = 0x2281, + snd_se_ADVstage_common_RESULT_DISP = 0x2282, + snd_se_ADVstage_common_METAL_DOOR = 0x2283, + snd_se_ADVstage_common_45 = 0x2284, + snd_se_ADVstage_common_46 = 0x2285, + snd_se_ADVstage_common_ITEMBOX_YELLOW = 0x2286, + snd_se_ADVstage_common_2P_IN = 0x2287, + snd_se_ADVstage_common_FIGHTER_IN = 0x2288, + snd_se_ADVstage_common_YELLOW_DOOR = 0x2289, + snd_se_ADVstage_common_URA_OMOTE_DOOR = 0x228A, + snd_se_ADVstage_common_MOYA_DOOR = 0x228B, + snd_se_ADVstage_common_SAVE_DOOR = 0x228C, + snd_se_ADVstage_common_METAL_GOAL = 0x228D, + snd_se_ADVstage_common_ENEMY_CREATE = 0x228E, + snd_se_ADVstage_common_FIGURE_DROP = 0x228F, + snd_se_ADVstage_common_LIFE_BALL_1 = 0x2290, + snd_se_ADVstage_common_LIFE_BALL_2 = 0x2291, + snd_se_ADVstage_common_55 = 0x2292, + snd_se_ADVstage_common_56 = 0x2293, + snd_se_ADVstage_common_57 = 0x2294, + snd_se_ADVstage_common_58 = 0x2295, + snd_se_ADVstage_common_59 = 0x2296, + snd_se_ADVstage_common_60 = 0x2297, + snd_se_ADVstage_common_61 = 0x2298, + snd_se_ADVstage_common_62 = 0x2299, + snd_se_ADVstage_common_63 = 0x229A, + snd_se_ADVstage_common_64 = 0x229B, + snd_se_ADVstage_01_0_KANSEI = 0x229C, + snd_se_ADVstage_03_0_KANSEI = 0x229D, + snd_se_ADVstage_03_1_KANSEI = 0x229E, + snd_se_ADVstage_04_0_CLOUD = 0x229F, + snd_se_ADVstage_04_1_01 = 0x22A0, + snd_se_ADVstage_04_1_SHOW_DOOR = 0x22A1, + snd_se_ADVstage_04_2_01 = 0x22A2, + snd_se_ADVstage_04_2_02 = 0x22A3, + snd_se_ADVstage_04_2_03 = 0x22A4, + snd_se_ADVstage_04_2_04 = 0x22A5, + snd_se_ADVstage_04_2_05 = 0x22A6, + snd_se_ADVstage_04_2_06 = 0x22A7, + snd_se_ADVstage_04_2_CLOUD = 0x22A8, + snd_se_ADVstage_04_2_CLOUD_LIFT = 0x22A9, + snd_se_ADVstage_04_2_KUMO_GAMEN = 0x22AA, + snd_se_ADVstage_04_2_KUMO_OOU = 0x22AB, + snd_se_ADVstage_04_2_KUMO_KIERU = 0x22AC, + snd_se_ADVstage_04_2_ITEM_BOX = 0x22AD, + snd_se_ADVstage_05_0_ENV_ENGINE = 0x22AE, + snd_se_ADVstage_05_0_ENV_WIND = 0x22AF, + snd_se_ADVstage_05_1_CLOUD = 0x22B0, + snd_se_ADVstage_05_1_FALL_ROCK_A = 0x22B1, + snd_se_ADVstage_05_1_FALL_ROCK_B = 0x22B2, + snd_se_ADVstage_05_1_FALL_ROKC_C = 0x22B3, + snd_se_ADVstage_05_1_CRASH_ROCK_A = 0x22B4, + snd_se_ADVstage_05_1_CRASH_ROCK_B = 0x22B5, + snd_se_ADVstage_05_1_CRASH_ROCK_C = 0x22B6, + snd_se_ADVstage_05_1_ROCK_DROP = 0x22B7, + snd_se_ADVstage_05_1_ROCK_ROLL = 0x22B8, + snd_se_ADVstage_06_0_14 = 0x22B9, + snd_se_ADVstage_06_0_15 = 0x22BA, + snd_se_ADVstage_06_0_16 = 0x22BB, + snd_se_ADVstage_06_0_WATERFALL_START = 0x22BC, + snd_se_ADVstage_06_0_WATERFALL_END = 0x22BD, + snd_se_ADVstage_06_0_SHOW_TARU = 0x22BE, + snd_se_ADVstage_06_0_SHOW_DOOR = 0x22BF, + snd_se_ADVstage_06_0_LIFT_UP = 0x22C0, + snd_se_ADVstage_07_0_KABE_DERU = 0x22C1, + snd_se_ADVstage_07_0_KABE_TOMARU = 0x22C2, + snd_se_ADVstage_07_0_KABE_UGOKU = 0x22C3, + snd_se_ADVstage_07_0_KABE_SHIZUMU = 0x22C4, + snd_se_ADVstage_07_0_ASHIBA_KAISHI = 0x22C5, + snd_se_ADVstage_07_0_ASHIBA_UGOKU = 0x22C6, + snd_se_ADVstage_07_0_ASHIBA_IDOU = 0x22C7, + snd_se_ADVstage_07_0_ASHIBA_TOMARU = 0x22C8, + snd_se_ADVstage_07_0_ASHIBA_OWARI = 0x22C9, + snd_se_ADVstage_07_0_SUIRO = 0x22CA, + snd_se_ADVstage_08_1_BLOCK_HIT = 0x22CB, + snd_se_ADVstage_08_1_BLOCK_BREAK = 0x22CC, + snd_se_ADVstage_08_1_FIRE_ROOM = 0x22CD, + snd_se_ADVstage_08_1_RIVER = 0x22CE, + snd_se_ADVstage_08_1_QUAKE = 0x22CF, + snd_se_ADVstage_08_1_SHOW_SWITCH = 0x22D0, + snd_se_ADVstage_08_1_SHOW_DOOR = 0x22D1, + snd_se_ADVstage_08_2_TARU_TAIHOU = 0x22D2, + snd_se_ADVstage_09_0_BOX_DAMAGE = 0x22D3, + snd_se_ADVstage_09_0_BOX_BREAK = 0x22D4, + snd_se_ADVstage_09_0_SHUTTER_OPEN = 0x22D5, + snd_se_ADVstage_09_0_STATUE_FOOT_1 = 0x22D6, + snd_se_ADVstage_09_0_STATUE_FOOT_2 = 0x22D7, + snd_se_ADVstage_09_0_STATUE_TENJYOU = 0x22D8, + snd_se_ADVstage_09_0_STATUE_SPLASH = 0x22D9, + snd_se_ADVstage_09_0_STATUE_FALL = 0x22DA, + snd_se_ADVstage_09_0_STATUE_BREAK = 0x22DB, + snd_se_ADVstage_09_2_BOX_DAMAGE = 0x22DC, + snd_se_ADVstage_09_2_BOX_BREAK = 0x22DD, + snd_se_ADVstage_09_2_SHUTTER_OPEN = 0x22DE, + snd_se_ADVstage_09_2_SWING_A = 0x22DF, + snd_se_ADVstage_09_2_SWING_B = 0x22E0, + snd_se_ADVstage_09_2_CYAKUSUI = 0x22E1, + snd_se_ADVstage_09_2_ICE_FLOOR_BREAK = 0x22E2, + snd_se_ADVstage_10_0_WALL_DAMAGE = 0x22E3, + snd_se_ADVstage_10_0_WALL_BREAK = 0x22E4, + snd_se_ADVstage_10_0_DOOR_OPEN = 0x22E5, + snd_se_ADVstage_10_0_GATE_OPEN = 0x22E6, + snd_se_ADVstage_10_1_01 = 0x22E7, + snd_se_ADVstage_10_1_WIND_1 = 0x22E8, + snd_se_ADVstage_10_1_WIND_2 = 0x22E9, + snd_se_ADVstage_10_1_WIND_3 = 0x22EA, + snd_se_ADVstage_10_2_SHUTTER_DOWN = 0x22EB, + snd_se_ADVstage_10_2_SHUTTER_STOP = 0x22EC, + snd_se_ADVstage_10_2_LARGE_BLOCK = 0x22ED, + snd_se_ADVstage_10_2_SENRO = 0x22EE, + snd_se_ADVstage_10_2_ITEM_BOX = 0x22EF, + snd_se_ADVstage_10_2_SHUTTER_MODORI = 0x22F0, + snd_se_ADVstage_12_0_RIVER = 0x22F1, + snd_se_ADVstage_14_0_BLOCK_HIT = 0x22F2, + snd_se_ADVstage_14_0_BLOCK_BREAK = 0x22F3, + snd_se_ADVstage_14_0_ELV_START = 0x22F4, + snd_se_ADVstage_14_0_ELV_MOVE = 0x22F5, + snd_se_ADVstage_14_0_ELV_STOP = 0x22F6, + snd_se_ADVstage_14_1_PURPLE_LIFT = 0x22F7, + snd_se_ADVstage_14_1_LOCK_GATE = 0x22F8, + snd_se_ADVstage_14_1_MOVE_LIFT = 0x22F9, + snd_se_ADVstage_14_1_LIFT_STOP = 0x22FA, + snd_se_ADVstage_14_1_LIFT_UP = 0x22FB, + snd_se_ADVstage_14_1_FALL_PILLAR = 0x22FC, + snd_se_ADVstage_14_1_PILLAR_STOP = 0x22FD, + snd_se_ADVstage_14_1_BLOCK_HIT = 0x22FE, + snd_se_ADVstage_14_1_BLOCK_BREAK = 0x22FF, + snd_se_ADVstage_14_1_ENV_FALL = 0x2300, + snd_se_ADVstage_14_1_ENV_FALL_BOTOM = 0x2301, + snd_se_ADVstage_14_1_SHOW_SWITCH = 0x2302, + snd_se_ADVstage_16_2_PLATE_FLOAT = 0x2303, + snd_se_ADVstage_16_2_ENV_WIND = 0x2304, + snd_se_ADVstage_16_2_PLATE_ERASE = 0x2305, + snd_se_ADVstage_16_2_PILLAR_UP = 0x2306, + snd_se_ADVstage_16_2_PILLAR_DOWN = 0x2307, + snd_se_ADVstage_16_2_WALL_MOVE = 0x2308, + snd_se_ADVstage_16_2_WALL_GROW = 0x2309, + snd_se_ADVstage_16_2_WALL_DEAD = 0x230A, + snd_se_ADVstage_16_3_HANABI_UCHIAGE = 0x230B, + snd_se_ADVstage_16_3_HANABI_BAKUHATSU = 0x230C, + snd_se_ADVstage_16_3_TOBIRA_HIRAKU = 0x230D, + snd_se_ADVstage_16_3_TOBIRA_TOMARU = 0x230E, + snd_se_ADVstage_16_3_YAKETA_DERU = 0x230F, + snd_se_ADVstage_16_3_YAKETA_MODORU = 0x2310, + snd_se_ADVstage_16_3_CHIKASUIMYAKU = 0x2311, + snd_se_ADVstage_16_3_DOUKUTSU = 0x2312, + snd_se_ADVstage_16_3_TRUCK_IN_WATER = 0x2313, + snd_se_ADVstage_16_3_SHOW_DOOR = 0x2314, + snd_se_ADVstage_18_0_ELV_START = 0x2315, + snd_se_ADVstage_18_0_ELV_MOVE = 0x2316, + snd_se_ADVstage_18_0_ELV_END = 0x2317, + snd_se_ADVstage_18_0_FIRE_BALL_A = 0x2318, + snd_se_ADVstage_18_0_FIRE_BALL_B = 0x2319, + snd_se_ADVstage_18_0_HIBASHIRA_A = 0x231A, + snd_se_ADVstage_18_0_HIBASHIRA_A_TOMARI = 0x231B, + snd_se_ADVstage_18_0_HIBASHIRA_B = 0x231C, + snd_se_ADVstage_18_0_TOBIRA_HIRAKU_FAST = 0x231D, + snd_se_ADVstage_18_0_TOBIRA_HIRAKU_SLOW = 0x231E, + snd_se_ADVstage_18_0_TOBIRA_TOMARU_FAST = 0x231F, + snd_se_ADVstage_18_0_TOBIRA_TOMARU_SLOW = 0x2320, + snd_se_ADVstage_18_0_FLOAT_STAGE = 0x2321, + snd_se_ADVstage_20_0_ROCK_DROP = 0x2322, + snd_se_ADVstage_20_0_ROCK_ROLL = 0x2323, + snd_se_ADVstage_20_0_HASHIRA_HAYAI = 0x2324, + snd_se_ADVstage_20_0_HASHIRA_OSOI = 0x2325, + snd_se_ADVstage_20_0_HASHIRA_TOMARU = 0x2326, + snd_se_ADVstage_20_0_CHIKEI_UMARERU = 0x2327, + snd_se_ADVstage_20_0_CHIKEI_UGOKU = 0x2328, + snd_se_ADVstage_20_0_CHIKEI_MOGURU = 0x2329, + snd_se_ADVstage_20_0_HIBASHIRA_A = 0x232A, + snd_se_ADVstage_20_0_HIBASHIRA_A_TOMARI = 0x232B, + snd_se_ADVstage_20_0_HIBASHIRA_B = 0x232C, + snd_se_ADVstage_20_0_HARIYAMA_OCHIRU = 0x232D, + snd_se_ADVstage_20_0_HARIYAMA_SASARU = 0x232E, + snd_se_ADVstage_20_0_TOBIRA = 0x232F, + snd_se_ADVstage_20_0_KIRI_HARERU = 0x2330, + snd_se_ADVstage_20_0_KIRI_MICHIRU = 0x2331, + snd_se_ADVstage_20_0_GONDOLA = 0x2332, + snd_se_ADVstage_22_0_ELV_START = 0x2333, + snd_se_ADVstage_22_0_ELV_MOVE = 0x2334, + snd_se_ADVstage_22_0_STOP = 0x2335, + snd_se_ADVstage_22_0_KABE_TOMARU = 0x2336, + snd_se_ADVstage_22_0_KABE_UGOKU = 0x2337, + snd_se_ADVstage_22_0_HARIYAMA = 0x2338, + snd_se_ADVstage_22_0_ROUND_ROOM = 0x2339, + snd_se_ADVstage_22_0_FALL_PILLAR = 0x233A, + snd_se_ADVstage_22_0_HIBASHIRA_A = 0x233B, + snd_se_ADVstage_22_0_HIBASHIRA_A_TOMARI = 0x233C, + snd_se_ADVstage_22_0_HIBASHIRA_B = 0x233D, + snd_se_ADVstage_22_0_ASHIBA_KAISHI = 0x233E, + snd_se_ADVstage_22_0_ASHIBA_UGOKU = 0x233F, + snd_se_ADVstage_22_0_ASHIBA_IDOU = 0x2340, + snd_se_ADVstage_22_0_ASHIBA_TOMARU = 0x2341, + snd_se_ADVstage_22_0_ASHIBA_OWARI = 0x2342, + snd_se_ADVstage_22_0_ASHIBA_NANAME = 0x2343, + snd_se_ADVstage_22_0_CRYSTAL_MOVE = 0x2344, + snd_se_ADVstage_22_0_CRYSTAL_STOP_IN = 0x2345, + snd_se_ADVstage_22_0_CRYSTAL_STOP_OUT = 0x2346, + snd_se_ADVstage_22_0_GATE_OPEN = 0x2347, + snd_se_ADVstage_22_0_GATE_FALL = 0x2348, + snd_se_ADVstage_22_0_GATE_STOP = 0x2349, + snd_se_ADVstage_22_0_ENV_LIFT_ROOM = 0x234A, + snd_se_ADVstage_22_0_AKAI_TOBIRA_UGOKU = 0x234B, + snd_se_ADVstage_22_0_AKAI_TOBIRA_TOMARU = 0x234C, + snd_se_ADVstage_22_0_SHOW_SWITCH = 0x234D, + snd_se_ADVstage_24_0_HEAVY_WIND = 0x234E, + snd_se_ADVstage_24_0_SHUTTER_MOVE = 0x234F, + snd_se_ADVstage_24_0_SHUTTER_STOP = 0x2350, + snd_se_ADVstage_24_0_CHIKEI_RYUUKI_A = 0x2351, + snd_se_ADVstage_24_0_CHIKEI_RYUUKI_B = 0x2352, + snd_se_ADVstage_24_0_RYUUKI_TOMARU_A = 0x2353, + snd_se_ADVstage_24_0_RYUUKI_TOMARU_B = 0x2354, + snd_se_ADVstage_24_0_FALL_ROCK_A = 0x2355, + snd_se_ADVstage_24_0_FALL_ROCK_B = 0x2356, + snd_se_ADVstage_24_0_FALL_ROKC_C = 0x2357, + snd_se_ADVstage_24_0_CRASH_ROCK_A = 0x2358, + snd_se_ADVstage_24_0_CRASH_ROCK_B = 0x2359, + snd_se_ADVstage_24_0_CRASH_ROCK_C = 0x235A, + snd_se_ADVstage_26_0_ELV_MOVE = 0x235B, + snd_se_ADVstage_26_0_ELV_STOP = 0x235C, + snd_se_ADVstage_26_0_LIFT_MOVE = 0x235D, + snd_se_ADVstage_26_0_LIFT_STOP = 0x235E, + snd_se_ADVstage_26_0_HEAVY_WIND = 0x235F, + snd_se_ADVstage_26_0_HARIYAMA_OCHIRU = 0x2360, + snd_se_ADVstage_26_0_HARIYAMA_SASARU = 0x2361, + snd_se_ADVstage_26_0_HASHIRA_HAYAI = 0x2362, + snd_se_ADVstage_26_0_HASHIRA_TOMARU = 0x2363, + snd_se_ADVstage_27_0_RIVER = 0x2364, + snd_se_ADVstage_27_0_FALL = 0x2365, + snd_se_ADVstage_27_0_LEAF = 0x2366, + snd_se_ADVstage_27_0_SWING = 0x2367, + snd_se_ADVstage_27_0_UP_WIND = 0x2368, + snd_se_ADVstage_27_0_DOWN_WIND = 0x2369, + snd_se_ADVstage_27_1_ENV_RIVER_1 = 0x236A, + snd_se_ADVstage_27_2_TSUTA_UP = 0x236B, + snd_se_ADVstage_27_2_TSUTA_DOWN = 0x236C, + snd_se_ADVstage_27_2_PLATE_START = 0x236D, + snd_se_ADVstage_27_2_PLATE_STOP = 0x236E, + snd_se_ADVstage_27_2_ENV_RIVER_1 = 0x236F, + snd_se_ADVstage_27_2_ENV_RIVER_2 = 0x2370, + snd_se_ADVstage_27_2_TRUCK_IN_WATER = 0x2371, + snd_se_ADVstage_28_0_LIGHT_ON = 0x2372, + snd_se_ADVstage_28_0_LIGHT_OFF = 0x2373, + snd_se_ADVstage_28_0_SHATTER_OPEN = 0x2374, + snd_se_ADVstage_28_0_SHATTER_CLOSE = 0x2375, + snd_se_ADVstage_28_0_BOX_HIT = 0x2376, + snd_se_ADVstage_28_0_BOX_BREAK = 0x2377, + snd_se_ADVstage_28_2_BOX_REVERSE = 0x2378, + snd_se_ADVstage_28_2_RING_LIFT_IN = 0x2379, + snd_se_ADVstage_28_2_RING_LIFT_MOVE = 0x237A, + snd_se_ADVstage_28_2_BOX_HIT = 0x237B, + snd_se_ADVstage_28_2_BOX_BREAK = 0x237C, + snd_se_ADVstage_28_2_WARP = 0x237D, + snd_se_ADVstage_28_2_SWITCH_SHATTER = 0x237E, + snd_se_ADVstage_28_2_LIFT = 0x237F, + snd_se_ADVstage_28_2_BLOCK_MOVE = 0x2380, + snd_se_ADVstage_30_0_WIND = 0x2381, + snd_se_ADVstage_30_0_PLATE_ENV = 0x2382, + snd_se_ADVstage_30_0_PLATE_ENGINE = 0x2383, + snd_se_ADVstage_31_0_TOGE_KABE_MOVE = 0x2384, + snd_se_ADVstage_31_0_TOGE_KABE_STOP = 0x2385, + snd_se_ADVstage_31_0_PLATE_START = 0x2386, + snd_se_ADVstage_31_0_PLATE_STOP = 0x2387, + snd_se_ADVstage_31_0_ICE_WALL_A = 0x2388, + snd_se_ADVstage_31_0_ICE_WALL_B = 0x2389, + snd_se_ADVstage_31_0_ICE_WALL_REVERSE = 0x238A, + snd_se_ADVstage_31_0_COLD_WIND = 0x238B, + snd_se_ADVstage_31_1_COLD_WIND = 0x238C, + snd_se_ADVstage_42_0_01_WARP = 0x238D, + snd_se_ADVstage_42_0_02_WARP = 0x238E, + snd_se_ADVstage_42_0_35_COLD_WIND = 0x238F, + snd_se_ADVstage_32_0_WIND = 0x2390, + snd_se_ADVstage_33_0_ENV_SHIP = 0x2391, + snd_se_ADVstage_33_0_SHOW_DOOR = 0x2392, + snd_se_ADVstage_33_1_SWITCH_SHATTER = 0x2393, + snd_se_ADVstage_33_1_LIGHT_ON = 0x2394, + snd_se_ADVstage_33_1_LIGHT_OFF = 0x2395, + snd_se_ADVstage_33_1_SLIM_SHATTER = 0x2396, + snd_se_ADVstage_33_1_ENV_SHIP = 0x2397, + snd_se_ADVstage_33_1_SHOW_SWITCH = 0x2398, + snd_se_ADVstage_33_1_SHOW_DOOR = 0x2399, + snd_se_ADVstage_34_0_OUT_DOOR_WIND = 0x239A, + snd_se_ADVstage_34_0_ENV_ENGINE = 0x239B, + snd_se_ADVstage_34_0_ENV_SHIP = 0x239C, + snd_se_ADVstage_34_0_BROKEN_ROOF = 0x239D, + snd_se_ADVstage_34_0_BURNER_ON = 0x239E, + snd_se_ADVstage_34_0_BURNER_OFF = 0x239F, + snd_se_ADVstage_34_0_BURNER_BLOCK = 0x23A0, + snd_se_ADVstage_34_0_GATE_CLOSE = 0x23A1, + snd_se_ADVstage_34_0_GATE_CLOSE_END = 0x23A2, + snd_se_ADVstage_34_0_GATE_OPNE = 0x23A3, + snd_se_ADVstage_34_0_SHATTER_MOVE = 0x23A4, + snd_se_ADVstage_34_0_SHATTER_STOP = 0x23A5, + snd_se_ADVstage_35_0_ENV_ENGINE = 0x23A6, + snd_se_ADVstage_35_0_ENV_WIND = 0x23A7, + snd_se_ADVstage_36_0_BLOCK_HIT = 0x23A8, + snd_se_ADVstage_36_0_BLOCK_BREAK = 0x23A9, + snd_se_ADVstage_36_0_ELV_START = 0x23AA, + snd_se_ADVstage_36_0_ELV_STOP = 0x23AB, + snd_se_ADVstage_36_0_GATE_CLOSE = 0x23AC, + snd_se_ADVstage_36_0_GATE_OPEN = 0x23AD, + snd_se_ADVstage_36_0_FLOOR_UP = 0x23AE, + snd_se_ADVstage_36_0_FLOOR_DOWN = 0x23AF, + snd_se_ADVstage_36_0_MOVE_WALL = 0x23B0, + snd_se_ADVstage_36_0_ITEM_BOX = 0x23B1, + snd_se_ADVstage_36_0_SHOW_DOOR = 0x23B2, + snd_se_ADVstage_37_0_ROUND_LIFT = 0x23B3, + snd_se_ADVstage_37_0_BELT = 0x23B4, + snd_se_ADVstage_37_0_HARI_OCHIRU = 0x23B5, + snd_se_ADVstage_37_0_HARI_AGARU = 0x23B6, + snd_se_ADVstage_37_0_TENJYOU_ORIRU = 0x23B7, + snd_se_ADVstage_37_0_TENJYOU_TOMARU = 0x23B8, + snd_se_ADVstage_37_0_SHATTER_CLOSE = 0x23B9, + snd_se_ADVstage_37_0_SHATTER_OPEN = 0x23BA, + snd_se_ADVstage_37_0_BURNER_ON = 0x23BB, + snd_se_ADVstage_37_0_BURNER_OFF = 0x23BC, + snd_se_ADVstage_37_0_ELV_MOVE = 0x23BD, + snd_se_ADVstage_37_0_ELV_STOP = 0x23BE, + snd_se_ADVstage_37_0_BLOCK_HIT = 0x23BF, + snd_se_ADVstage_37_0_BLOCK_BREAK = 0x23C0, + snd_se_ADVstage_37_0_COLOR_SWITCH_A = 0x23C1, + snd_se_ADVstage_37_0_COLOR_SWITCH_B = 0x23C2, + snd_se_ADVstage_37_0_COLOR_SWITCH_C = 0x23C3, + snd_se_ADVstage_37_2_BLOCK_HIT = 0x23C4, + snd_se_ADVstage_37_2_BLOCK_BREAK = 0x23C5, + snd_se_ADVstage_37_2_ELV_MOVE = 0x23C6, + snd_se_ADVstage_37_2_BURNER_ON = 0x23C7, + snd_se_ADVstage_37_2_BURNER_OFF = 0x23C8, + snd_se_ADVstage_37_2_CHIKEI_ZURERU = 0x23C9, + snd_se_ADVstage_37_2_CHIKEI_TOMARU = 0x23CA, + snd_se_ADVstage_37_2_YOKO_TOGE_DERU = 0x23CB, + snd_se_ADVstage_37_2_YOKO_TOGE_TOMARU = 0x23CC, + snd_se_ADVstage_37_3_FALCON_FLYER_ENGINE = 0x23CD, + snd_se_ADVstage_40_0_SWING_1 = 0x23CE, + snd_se_ADVstage_40_0_SWING_2 = 0x23CF, + snd_se_ADVstage_40_0_BLOCK_HIT = 0x23D0, + snd_se_ADVstage_40_0_BLOCK_BREAK = 0x23D1, + snd_se_ADVstage_40_0_PLATE_IN = 0x23D2, + snd_se_ADVstage_40_0_PLATE_SHINE = 0x23D3, + snd_se_ADVstage_40_0_CHARA_FIGURE = 0x23D4, + snd_se_ADVstage_41_0_BLOCK_HIT = 0x23D5, + snd_se_ADVstage_41_0_BLOCK_BREAK = 0x23D6, + snd_se_ADVstage_41_0_PLATE_IN = 0x23D7, + snd_se_ADVstage_41_0_PLATE_SHINE = 0x23D8, + snd_se_ADVstage_41_0_CHARA_FIGURE = 0x23D9, + snd_se_ADVstage_42_0_05_CLOUD_LIFT = 0x23DA, + snd_se_ADVstage_42_0_09_BOX_DAMAGE = 0x23DB, + snd_se_ADVstage_42_0_09_BOX_BREAK = 0x23DC, + snd_se_ADVstage_42_0_09_ICE_FLOOR_BROKEN = 0x23DD, + snd_se_ADVstage_42_0_09_SHUTTER_OPEN = 0x23DE, + snd_se_ADVstage_42_0_11_ENV_ENGINE = 0x23DF, + snd_se_ADVstage_42_0_11_ENV_WIND = 0x23E0, + snd_se_ADVstage_42_0_11_DOOR = 0x23E1, + snd_se_ADVstage_42_0_13_ENV_SHIP = 0x23E2, + snd_se_ADVstage_42_0_13_ELV_START = 0x23E3, + snd_se_ADVstage_42_0_13_ELV_STOP = 0x23E4, + snd_se_ADVstage_42_0_13_GATE_OPEN = 0x23E5, + snd_se_ADVstage_42_0_17_UP_WIND = 0x23E6, + snd_se_ADVstage_42_0_17_SWING = 0x23E7, + snd_se_ADVstage_42_0_17_LEAF = 0x23E8, + snd_se_ADVstage_42_0_17_WATERFALL = 0x23E9, + snd_se_ADVstage_42_0_19_WALL_DAMAGE = 0x23EA, + snd_se_ADVstage_42_0_19_WALL_BREAK = 0x23EB, + snd_se_ADVstage_42_0_19_HARI_DOWN = 0x23EC, + snd_se_ADVstage_42_0_19_HARI_STOP = 0x23ED, + snd_se_ADVstage_42_0_21_SHUTTER_DOOR = 0x23EE, + snd_se_ADVstage_42_0_21_ELV_START = 0x23EF, + snd_se_ADVstage_42_0_21_ELV_STOP = 0x23F0, + snd_se_ADVstage_42_0_21_SHUTTER = 0x23F1, + snd_se_ADVstage_42_0_21_BOX_HIT = 0x23F2, + snd_se_ADVstage_42_0_21_BOX_BREAK = 0x23F3, + snd_se_ADVstage_42_0_21_BURNER = 0x23F4, + snd_se_ADVstage_42_0_21_HASHIRA_AGARU = 0x23F5, + snd_se_ADVstage_42_0_21_HASHIRA_SAGARU = 0x23F6, + snd_se_ADVstage_42_0_21_BELT = 0x23F7, + snd_se_ADVstage_42_0_21_POOL = 0x23F8, + snd_se_ADVstage_42_0_21_COLOR_SWITCH_A = 0x23F9, + snd_se_ADVstage_42_0_21_COLOR_SWITCH_B = 0x23FA, + snd_se_ADVstage_42_0_21_COLOR_SWITCH_C = 0x23FB, + snd_se_ADVstage_42_0_23_DOKUKIRI_HARERU = 0x23FC, + snd_se_ADVstage_42_0_23_DOKUKIRI_DERU = 0x23FD, + snd_se_ADVstage_42_0_23_DORO_DORO = 0x23FE, + snd_se_ADVstage_42_0_23_FIRE_BALL_A = 0x23FF, + snd_se_ADVstage_42_0_23_FIRE_BALL_B = 0x2400, + snd_se_ADVstage_42_0_23_HIBASHIRA_A = 0x2401, + snd_se_ADVstage_42_0_23_HIBASHIRA_A_STOP = 0x2402, + snd_se_ADVstage_42_0_23_HIBASHIRA_B = 0x2403, + snd_se_ADVstage_42_0_23_SENRO = 0x2404, + snd_se_ADVstage_42_0_23_SHUTTER_DOWN = 0x2405, + snd_se_ADVstage_42_0_23_SHUTTER_STOP = 0x2406, + snd_se_ADVstage_42_0_23_SHUTTER_MODORI = 0x2407, + snd_se_ADVstage_42_0_25_RIVER = 0x2408, + snd_se_ADVstage_42_0_25_RIVER_STOPPER = 0x2409, + snd_se_ADVstage_42_0_25_POOL = 0x240A, + snd_se_ADVstage_42_0_25_TRUCK_IN_WATER = 0x240B, + snd_se_ADVstage_42_0_27_IDOU_CHIKEI_A = 0x240C, + snd_se_ADVstage_42_0_27_IDOU_CHIKEI_B = 0x240D, + snd_se_ADVstage_42_0_27_ROCK_FALL_A = 0x240E, + snd_se_ADVstage_42_0_27_ROCK_FALL_B = 0x240F, + snd_se_ADVstage_42_0_27_ROCK_FALL_C = 0x2410, + snd_se_ADVstage_42_0_27_ROCK_CRASH_A = 0x2411, + snd_se_ADVstage_42_0_27_ROCK_CRASH_B = 0x2412, + snd_se_ADVstage_42_0_27_ROCK_CRASH_C = 0x2413, + snd_se_ADVstage_42_0_27_SAND_STORM = 0x2414, + snd_se_ADVstage_42_0_27_HARI_OCHIRU = 0x2415, + snd_se_ADVstage_42_0_27_HARI_SASARU = 0x2416, + snd_se_ADVstage_42_0_29_PILLAR_OUT = 0x2417, + snd_se_ADVstage_42_0_29_PILLAR_IN = 0x2418, + snd_se_ADVstage_42_0_31_ELV_START = 0x2419, + snd_se_ADVstage_42_0_31_ELV_STOP = 0x241A, + snd_se_ADVstage_42_0_31_IDOU_CHIKEI_UGOKU = 0x241B, + snd_se_ADVstage_42_0_31_IDOU_CHIKEI_TOMARU = 0x241C, + snd_se_ADVstage_42_0_31_HIBASHIRA_DERU = 0x241D, + snd_se_ADVstage_42_0_31_HIBASHIRA_KIERU = 0x241E, + snd_se_ADVstage_42_0_31_HARIYAMA_OCHIRU = 0x241F, + snd_se_ADVstage_42_0_31_KAITEN_HEYA = 0x2420, + snd_se_ADVstage_42_0_31_AKAITOBIRA_UGOKU = 0x2421, + snd_se_ADVstage_42_0_31_AKAITOBIRA_TOMARU = 0x2422, + snd_se_ADVstage_42_0_31_SHOW_SWITCH = 0x2423, + snd_se_ADVstage_42_0_33_ELV_START = 0x2424, + snd_se_ADVstage_42_0_33_ELV_STOP = 0x2425, + snd_se_ADVstage_42_0_33_WIND = 0x2426, + snd_se_ADVstage_42_0_37_01 = 0x2427, + snd_se_ADVstage_42_0_37_02 = 0x2428, + snd_se_ADVstage_42_0_37_03 = 0x2429, + snd_se_ADVstage_42_0_37_04 = 0x242A, + snd_se_ADVstage_42_0_37_05 = 0x242B, + snd_se_ADVstage_42_0_37_06 = 0x242C, + snd_se_ADVstage_42_0_37_07 = 0x242D, + snd_se_ADVstage_42_0_37_08 = 0x242E, + snd_se_ADVstage_42_0_37_09 = 0x242F, + snd_se_ADVstage_42_0_37_10 = 0x2430, + snd_se_enemy_Kuribo_DASH_A = 0x2431, + snd_se_enemy_Kuribo_DASH_B = 0x2432, + snd_se_enemy_Kuribo_CRY = 0x2433, + snd_se_enemy_Kuribo_03 = 0x2434, + snd_se_enemy_Kuribo_HUMARERU = 0x2435, + snd_se_enemy_Patapata_BITE = 0x2436, + snd_se_enemy_Patapata_JMP_ATK = 0x2437, + snd_se_enemy_Patapata_LANDING = 0x2438, + snd_se_enemy_Patapata_WING_OFF = 0x2439, + snd_se_enemy_Patapata_04 = 0x243A, + snd_se_enemy_Hammerbros_WAIT = 0x243B, + snd_se_enemy_Hammerbros_THROW = 0x243C, + snd_se_enemy_Hammerbros_LANDING = 0x243D, + snd_se_enemy_Killer_SHOOT = 0x243E, + snd_se_enemy_Killer_EXPLOSION = 0x243F, + snd_se_enemy_Dekakuribo_WALK_A = 0x2440, + snd_se_enemy_Dekakuribo_WALK_B = 0x2441, + snd_se_enemy_Dekakuribo_RUN_A = 0x2442, + snd_se_enemy_Dekakuribo_RUN_B = 0x2443, + snd_se_enemy_Dekakuribo_STOP_A = 0x2444, + snd_se_enemy_Dekakuribo_STOP_B = 0x2445, + snd_se_enemy_Dekakuribo_TURN_A = 0x2446, + snd_se_enemy_Dekakuribo_TURN_B = 0x2447, + snd_se_enemy_Dekakuribo_BRAKE = 0x2448, + snd_se_enemy_Dekakuribo_LANDING = 0x2449, + snd_se_enemy_Dekakuribo_CRY = 0x244A, + snd_se_enemy_Dekakuribo_TUBURE = 0x244B, + snd_se_enemy_Dekakuribo_TUBUREKAKE = 0x244C, + snd_se_enemy_Dekakuribo_13 = 0x244D, + snd_se_enemy_GalFire_00 = 0x244E, + snd_se_enemy_GalFire_01 = 0x244F, + snd_se_enemy_GalFire_02 = 0x2450, + snd_se_enemy_GalFire_03 = 0x2451, + snd_se_enemy_GalFire_04 = 0x2452, + snd_se_enemy_GalFire_05 = 0x2453, + snd_se_enemy_GalFire_06 = 0x2454, + snd_se_enemy_Popperam_FOOT_A = 0x2455, + snd_se_enemy_Popperam_FOOT_B = 0x2456, + snd_se_enemy_Popperam_ITEM_1 = 0x2457, + snd_se_enemy_Popperam_ITEM_2 = 0x2458, + snd_se_enemy_Popperam_04 = 0x2459, + snd_se_enemy_Popperam_05 = 0x245A, + snd_se_enemy_Bitan_PARENT = 0x245B, + snd_se_enemy_Bitan_CHILD = 0x245C, + snd_se_enemy_Bitan_ATTACK = 0x245D, + snd_se_enemy_Bitan_JUMP = 0x245E, + snd_se_enemy_Roada_WHEEL_SPIN = 0x245F, + snd_se_enemy_Roada_MOVE = 0x2460, + snd_se_enemy_Roada_BRAKE = 0x2461, + snd_se_enemy_Roada_JUMP = 0x2462, + snd_se_enemy_Roada_TURN_JUMP = 0x2463, + snd_se_enemy_Roada_LANDING = 0x2464, + snd_se_enemy_Roada_ACCELERATE = 0x2465, + snd_se_enemy_Roada_CRASH = 0x2466, + snd_se_enemy_Roada_DOSU = 0x2467, + snd_se_enemy_Bombhead_RUN_1 = 0x2468, + snd_se_enemy_Bombhead_RUN_2 = 0x2469, + snd_se_enemy_Bombhead_WALK_1 = 0x246A, + snd_se_enemy_Bombhead_WALK_2 = 0x246B, + snd_se_enemy_Bombhead_TAKE_HEAD = 0x246C, + snd_se_enemy_Bombhead_THROW = 0x246D, + snd_se_enemy_Bombhead_REVIVE = 0x246E, + snd_se_enemy_Bombhead_BOMB = 0x246F, + snd_se_enemy_Gyraan_MOVE = 0x2470, + snd_se_enemy_Gyraan_TURN = 0x2471, + snd_se_enemy_Gyraan_AXE_HURU = 0x2472, + snd_se_enemy_Gyraan_AXE_SASARU = 0x2473, + snd_se_enemy_Gyraan_AXE_MOGAKU = 0x2474, + snd_se_enemy_Gyraan_AXE_NUKU = 0x2475, + snd_se_enemy_Gyraan_JUMP = 0x2476, + snd_se_enemy_Gyraan_LANDING = 0x2477, + snd_se_enemy_Bucyulus_SUITSUKU = 0x2478, + snd_se_enemy_Bucyulus_HANASU = 0x2479, + snd_se_enemy_Bucyulus_TOBIDASU = 0x247A, + snd_se_enemy_Bucyulus_MOGURU = 0x247B, + snd_se_enemy_Bucyulus_04 = 0x247C, + snd_se_enemy_Bucyulus_05 = 0x247D, + snd_se_enemy_Bucyulus_06 = 0x247E, + snd_se_enemy_Tautau_BITE = 0x247F, + snd_se_enemy_Tautau_SLEEP = 0x2480, + snd_se_enemy_Tautau_AKUBI = 0x2481, + snd_se_enemy_Tautau_DOWN = 0x2482, + snd_se_enemy_Tautau_STAND = 0x2483, + snd_se_enemy_Tautau_RAGE_1 = 0x2484, + snd_se_enemy_Tautau_RAGE_2 = 0x2485, + snd_se_enemy_Tautau_DASH_1 = 0x2486, + snd_se_enemy_Tautau_DASH_2 = 0x2487, + snd_se_enemy_Tautau_TURN_1 = 0x2488, + snd_se_enemy_Tautau_TURN_2 = 0x2489, + snd_se_enemy_Tautau_KERU = 0x248A, + snd_se_enemy_Tautau_UNARU = 0x248B, + snd_se_enemy_Tautau_13 = 0x248C, + snd_se_enemy_Flows_CURSE_KAMAE = 0x248D, + snd_se_enemy_Flows_CURSE_KOUGEKI = 0x248E, + snd_se_enemy_Flows_DISAPPEARS = 0x248F, + snd_se_enemy_Flows_FORWARD = 0x2490, + snd_se_enemy_Flows_RETURN = 0x2491, + snd_se_enemy_Aroaros_WING = 0x2492, + snd_se_enemy_Aroaros_FALL = 0x2493, + snd_se_enemy_Aroaros_IMPACT = 0x2494, + snd_se_enemy_Aroaros_03 = 0x2495, + snd_se_enemy_Botron_FLY = 0x2496, + snd_se_enemy_Botron_SHOOT_START = 0x2497, + snd_se_enemy_Botron_SHOOT = 0x2498, + snd_se_enemy_Botron_SHOOT_END = 0x2499, + snd_se_enemy_Botron_TURN = 0x249A, + snd_se_enemy_Botron_05 = 0x249B, + snd_se_enemy_Jyakeel_MOVE = 0x249C, + snd_se_enemy_Ghamgha_00 = 0x249D, + snd_se_enemy_Ghamgha_01 = 0x249E, + snd_se_enemy_Ghamgha_02 = 0x249F, + snd_se_enemy_Ghamgha_03 = 0x24A0, + snd_se_enemy_Ghamgha_04 = 0x24A1, + snd_se_enemy_Pacci_MOVE = 0x24A2, + snd_se_enemy_Pacci_ATACK = 0x24A3, + snd_se_enemy_Faulong_MOVE = 0x24A4, + snd_se_enemy_Faulong_COLLISION = 0x24A5, + snd_se_enemy_Faulong_HANEAGE = 0x24A6, + snd_se_enemy_Deathpod_OPEN = 0x24A7, + snd_se_enemy_Deathpod_READY = 0x24A8, + snd_se_enemy_Deathpod_SHOT = 0x24A9, + snd_se_enemy_Deathpod_03 = 0x24AA, + snd_se_enemy_Spar_ATK_TURN = 0x24AB, + snd_se_enemy_Spar_ATK_DENGEKI = 0x24AC, + snd_se_enemy_Spar_TAME = 0x24AD, + snd_se_enemy_Spar_SHOOT = 0x24AE, + snd_se_enemy_Spar_CHASE_TURN = 0x24AF, + snd_se_enemy_Spar_CHANGE = 0x24B0, + snd_se_enemy_Soar_06 = 0x24B1, + snd_se_enemy_Soar_07 = 0x24B2, + snd_se_enemy_Kokkon_FALL = 0x24B3, + snd_se_enemy_Kokkon_STAND = 0x24B4, + snd_se_enemy_Kokkon_APPEAL_START = 0x24B5, + snd_se_enemy_Kokkon_APPEAL_LOOP = 0x24B6, + snd_se_enemy_Kokkon_APPEAL_END = 0x24B7, + snd_se_enemy_Kokkon_CHASE_NOTICE = 0x24B8, + snd_se_enemy_Kokkon_NAIL_1 = 0x24B9, + snd_se_enemy_Kokkon_NAIL_2 = 0x24BA, + snd_se_enemy_Kokkon_08 = 0x24BB, + snd_se_enemy_Kokkon_09 = 0x24BC, + snd_se_enemy_Jdus_CUT_1 = 0x24BD, + snd_se_enemy_Jdus_CUT_2 = 0x24BE, + snd_se_enemy_Jdus_CUT_3 = 0x24BF, + snd_se_enemy_Jdus_PERSON = 0x24C0, + snd_se_enemy_Jdus_THRUST = 0x24C1, + snd_se_enemy_Jdus_ATK_START = 0x24C2, + snd_se_enemy_Jdus_TORNADE = 0x24C3, + snd_se_enemy_Mite_JUMP = 0x24C4, + snd_se_enemy_Mite_KICK = 0x24C5, + snd_se_enemy_Mite_TACKLE = 0x24C6, + snd_se_enemy_Mite_LANDING = 0x24C7, + snd_se_enemy_Mite_DASH = 0x24C8, + snd_se_enemy_Shelly_KAGAMU = 0x24C9, + snd_se_enemy_Shelly_KOUGEKI = 0x24CA, + snd_se_enemy_Shelly_CAST_OFF = 0x24CB, + snd_se_enemy_Shelly_LANDING = 0x24CC, + snd_se_enemy_Shelly_WALK_1 = 0x24CD, + snd_se_enemy_Shelly_WALK_2 = 0x24CE, + snd_se_enemy_Shelly_TURN = 0x24CF, + snd_se_enemy_Shelly_07 = 0x24D0, + snd_se_enemy_Ngagog_SHIKO_A = 0x24D1, + snd_se_enemy_Ngagog_SHIKO_B = 0x24D2, + snd_se_enemy_Ngagog_BODY_PRESS = 0x24D3, + snd_se_enemy_Ngagog_BRAKE = 0x24D4, + snd_se_enemy_Ngagog_NADE = 0x24D5, + snd_se_enemy_Ngagog_ENLARGE = 0x24D6, + snd_se_enemy_Ngagog_HAND_SLAP_A = 0x24D7, + snd_se_enemy_Ngagog_HAND_SLAP_B = 0x24D8, + snd_se_enemy_Ngagog_HAND_SLAP_C = 0x24D9, + snd_se_enemy_Ngagog_JUMP = 0x24DA, + snd_se_enemy_Ngagog_LANDING = 0x24DB, + snd_se_enemy_Ngagog_RUN_A = 0x24DC, + snd_se_enemy_Ngagog_RUN_B = 0x24DD, + snd_se_enemy_Ngagog_WALK_A = 0x24DE, + snd_se_enemy_Ngagog_WALK_B = 0x24DF, + snd_se_enemy_Ngagog_15 = 0x24E0, + snd_se_enemy_Ngagog_16 = 0x24E1, + snd_se_enemy_Ngagog_17 = 0x24E2, + snd_se_enemy_Ngagog_18 = 0x24E3, + snd_se_enemy_Ngagog_19 = 0x24E4, + snd_se_enemy_Ngagog_20 = 0x24E5, + snd_se_enemy_Ngagog_21 = 0x24E6, + snd_se_enemy_Ngagog_22 = 0x24E7, + snd_se_enemy_Ngagog_23 = 0x24E8, + snd_se_enemy_Ngagog_24 = 0x24E9, + snd_se_enemy_Ngagog_25 = 0x24EA, + snd_se_enemy_Ngagog_26 = 0x24EB, + snd_se_enemy_Ngagog_27 = 0x24EC, + snd_se_enemy_Ngagog_28 = 0x24ED, + snd_se_enemy_Ngagog_29 = 0x24EE, + snd_se_enemy_Ngagog_30 = 0x24EF, + snd_se_enemy_Ngagog_31 = 0x24F0, + snd_se_enemy_Ngagog_32 = 0x24F1, + snd_se_enemy_Ngagog_33 = 0x24F2, + snd_se_enemy_Ngagog_34 = 0x24F3, + snd_se_enemy_Ngagog_35 = 0x24F4, + snd_se_enemy_Ngagog_36 = 0x24F5, + snd_se_enemy_Ngagog_37 = 0x24F6, + snd_se_enemy_Ngagog_38 = 0x24F7, + snd_se_enemy_Ngagog_39 = 0x24F8, + snd_se_enemy_Ngagog_40 = 0x24F9, + snd_se_enemy_Ngagog_41 = 0x24FA, + snd_se_enemy_Ngagog_42 = 0x24FB, + snd_se_enemy_Ngagog_43 = 0x24FC, + snd_se_enemy_Ngagog_44 = 0x24FD, + snd_se_enemy_Cymal_OPEN = 0x24FE, + snd_se_enemy_Cymal_ROLL = 0x24FF, + snd_se_enemy_Cymal_CLOSE = 0x2500, + snd_se_enemy_Teckin_CAST_OFF = 0x2501, + snd_se_enemy_Teckin_RUN_AWAY = 0x2502, + snd_se_enemy_Teckin_FALL_DOWN = 0x2503, + snd_se_enemy_Teckin_FLY = 0x2504, + snd_se_enemy_Teckin_LANDING = 0x2505, + snd_se_enemy_Teckin_TACKLE_CRY = 0x2506, + snd_se_enemy_Teckin_TACKLE_FLY = 0x2507, + snd_se_enemy_Teckin_WALK_A = 0x2508, + snd_se_enemy_Teckin_WALK_B = 0x2509, + snd_se_enemy_Cataguard_ATTACK = 0x250A, + snd_se_enemy_Cataguard_ATK_RETURN = 0x250B, + snd_se_enemy_Cataguard_ATK_HI_THRUST = 0x250C, + snd_se_enemy_Cataguard_ATK_HI_SLASH = 0x250D, + snd_se_enemy_Cataguard_DAMAGE = 0x250E, + snd_se_enemy_Cataguard_LANDING = 0x250F, + snd_se_enemy_Cataguard_LAUNCH_SET = 0x2510, + snd_se_enemy_Cataguard_LAUNCH_SHOOT = 0x2511, + snd_se_enemy_Cataguard_LAUNCH_HIT = 0x2512, + snd_se_enemy_Cataguard_MOVE = 0x2513, + snd_se_enemy_Cataguard_MOVE2_START = 0x2514, + snd_se_enemy_Cataguard_MOVE2 = 0x2515, + snd_se_enemy_Cataguard_TURN = 0x2516, + snd_se_enemy_Cataguard_FACE_OPEN = 0x2517, + snd_se_enemy_Cataguard_BROKEN = 0x2518, + snd_se_enemy_Siralamos_MOVE = 0x2519, + snd_se_enemy_Siralamos_ROLLING = 0x251A, + snd_se_enemy_Siralamos_THROW_A = 0x251B, + snd_se_enemy_Siralamos_THROW_B = 0x251C, + snd_se_enemy_Siralamos_POSE = 0x251D, + snd_se_enemy_Siralamos_SLASH_A = 0x251E, + snd_se_enemy_Siralamos_SLASH_B = 0x251F, + snd_se_enemy_Siralamos_SLASH_C = 0x2520, + snd_se_enemy_Siralamos_08 = 0x2521, + snd_se_enemy_Siralamos_09 = 0x2522, + snd_se_enemy_Boobas_BREATH = 0x2523, + snd_se_enemy_Boobas_BOO = 0x2524, + snd_se_enemy_Boobas_02 = 0x2525, + snd_se_enemy_Boobas_03 = 0x2526, + snd_se_enemy_Boobas_04 = 0x2527, + snd_se_enemy_Boobas_05 = 0x2528, + snd_se_enemy_Arman_ARM_BEAM = 0x2529, + snd_se_enemy_Arman_ARM_DESTRUCTION = 0x252A, + snd_se_enemy_Arman_ARM_IN = 0x252B, + snd_se_enemy_Arman_ARM_ROLL = 0x252C, + snd_se_enemy_Arman_ARM_BITE = 0x252D, + snd_se_enemy_Arman_CORE_DAMAGE = 0x252E, + snd_se_enemy_Arman_CORE_IN = 0x252F, + snd_se_enemy_Arman_CORE_LANDING = 0x2530, + snd_se_enemy_Arman_CORE_OUT = 0x2531, + snd_se_enemy_Arman_LANDING = 0x2532, + snd_se_enemy_Arman_MOVE = 0x2533, + snd_se_enemy_Arman_SHAKES_OFF = 0x2534, + snd_se_enemy_Arman_PUNCH = 0x2535, + snd_se_enemy_Arman_TURN = 0x2536, + snd_se_enemy_Arman_PUNCH_RETURN = 0x2537, + snd_se_enemy_Arman_CLOSE = 0x2538, + snd_se_enemy_Arman_DAMAGE = 0x2539, + snd_se_enemy_Arman_DAMAGE_L = 0x253A, + snd_se_enemy_Arman_18 = 0x253B, + snd_se_enemy_Prim_C_RUN_A = 0x253C, + snd_se_enemy_Prim_C_RUN_B = 0x253D, + snd_se_enemy_Prim_C_BRAKE = 0x253E, + snd_se_enemy_Prim_C_JUMP = 0x253F, + snd_se_enemy_Prim_C_LANDING = 0x2540, + snd_se_enemy_Prim_C_DOWN = 0x2541, + snd_se_enemy_Prim_C_SLIDING = 0x2542, + snd_se_enemy_Prim_B_RUN_A = 0x2543, + snd_se_enemy_Prim_B_RUN_B = 0x2544, + snd_se_enemy_Prim_B_BRAKE = 0x2545, + snd_se_enemy_Prim_B_JUMP = 0x2546, + snd_se_enemy_Prim_B_LANDING = 0x2547, + snd_se_enemy_Prim_B_DOWN = 0x2548, + snd_se_enemy_Prim_M_WALK = 0x2549, + snd_se_enemy_Prim_M_DOWN = 0x254A, + snd_se_enemy_Prim_PUNCH = 0x254B, + snd_se_enemy_Prim_HARD_PUNCH = 0x254C, + snd_se_enemy_Prim_RUSH_A = 0x254D, + snd_se_enemy_Prim_RUSH_B = 0x254E, + snd_se_enemy_Prim_KICK = 0x254F, + snd_se_enemy_Prim_FIRE = 0x2550, + snd_se_enemy_Prim_POWER_FIRE = 0x2551, + snd_se_enemy_Prim_BOOMERANG_THROW = 0x2552, + snd_se_enemy_Prim_BOOMERANG_CATCH = 0x2553, + snd_se_enemy_Prim_SWORD_SHORT = 0x2554, + snd_se_enemy_Prim_SWORD_LONG = 0x2555, + snd_se_enemy_Prim_26 = 0x2556, + snd_se_enemy_Prim_27 = 0x2557, + snd_se_enemy_Prim_28 = 0x2558, + snd_se_enemy_Prim_29 = 0x2559, + snd_se_enemy_Prim30 = 0x255A, + snd_se_enemy_Prim_31 = 0x255B, + snd_se_enemy_Prim_32 = 0x255C, + snd_se_enemy_Prim_33 = 0x255D, + snd_se_enemy_Prim_34 = 0x255E, + snd_se_enemy_Prim_35 = 0x255F, + snd_se_enemy_Prim_36 = 0x2560, + snd_se_enemy_Prim_37 = 0x2561, + snd_se_enemy_Prim_38 = 0x2562, + snd_se_enemy_Prim_39 = 0x2563, + snd_se_enemy_Robo_MISSILE = 0x2564, + snd_se_enemy_Robo_MECA_UP = 0x2565, + snd_se_enemy_Robo_MECA_DOWN = 0x2566, + snd_se_enemy_Robo_LASER = 0x2567, + snd_se_enemy_Robo_CHARGE = 0x2568, + snd_se_enemy_Robo_BEAM = 0x2569, + snd_se_enemy_Robo_DASH_START = 0x256A, + snd_se_enemy_Robo_DASH_STOP = 0x256B, + snd_se_enemy_Robo_DASH_MAX = 0x256C, + snd_se_enemy_Robo_JUMP_1ST = 0x256D, + snd_se_enemy_Robo_JUMP_2ND = 0x256E, + snd_se_enemy_Robo_BURNER = 0x256F, + snd_se_enemy_Robo_ARM_SWING = 0x2570, + snd_se_enemy_Robo_LANDING = 0x2571, + snd_se_enemy_Robo_DASH = 0x2572, + snd_se_enemy_Robo_15 = 0x2573, + snd_se_enemy_Robo_16 = 0x2574, + snd_se_enemy_Robo_17 = 0x2575, + snd_se_enemy_Robo_18 = 0x2576, + snd_se_enemy_Robo_19 = 0x2577, + snd_se_boss_Bosspackun_00 = 0x2578, + snd_se_boss_Bosspackun_01 = 0x2579, + snd_se_boss_Bosspackun_02 = 0x257A, + snd_se_boss_Bosspackun_03 = 0x257B, + snd_se_boss_Bosspackun_04 = 0x257C, + snd_se_boss_Bosspackun_05 = 0x257D, + snd_se_boss_Bosspackun_06 = 0x257E, + snd_se_boss_Bosspackun_07 = 0x257F, + snd_se_boss_Bosspackun_08 = 0x2580, + snd_se_boss_Bosspackun_09 = 0x2581, + snd_se_boss_Bosspackun_10 = 0x2582, + snd_se_boss_Bosspackun_11 = 0x2583, + snd_se_boss_Bosspackun_12 = 0x2584, + snd_se_boss_Bosspackun_13 = 0x2585, + snd_se_boss_Bosspackun_14 = 0x2586, + snd_se_boss_Bosspackun_15 = 0x2587, + snd_se_boss_Bosspackun_16 = 0x2588, + snd_se_boss_Bosspackun_17 = 0x2589, + snd_se_boss_Bosspackun_18 = 0x258A, + snd_se_boss_Bosspackun_19 = 0x258B, + snd_se_boss_Bosspackun_20 = 0x258C, + snd_se_boss_Bosspackun_21 = 0x258D, + snd_se_boss_Bosspackun_22 = 0x258E, + snd_se_boss_Bosspackun_23 = 0x258F, + snd_se_boss_Bosspackun_24 = 0x2590, + snd_se_boss_Rayquaza_00 = 0x2591, + snd_se_boss_Rayquaza_01 = 0x2592, + snd_se_boss_Rayquaza_02 = 0x2593, + snd_se_boss_Rayquaza_03 = 0x2594, + snd_se_boss_Rayquaza_04 = 0x2595, + snd_se_boss_Rayquaza_05 = 0x2596, + snd_se_boss_Rayquaza_06 = 0x2597, + snd_se_boss_Rayquaza_07 = 0x2598, + snd_se_boss_Rayquaza_08 = 0x2599, + snd_se_boss_Rayquaza_09 = 0x259A, + snd_se_boss_Rayquaza_10 = 0x259B, + snd_se_boss_Rayquaza_11 = 0x259C, + snd_se_boss_Rayquaza_12 = 0x259D, + snd_se_boss_Rayquaza_13 = 0x259E, + snd_se_boss_Rayquaza_14 = 0x259F, + snd_se_boss_Rayquaza_15 = 0x25A0, + snd_se_boss_Rayquaza_16 = 0x25A1, + snd_se_boss_Rayquaza_17 = 0x25A2, + snd_se_boss_Rayquaza_18 = 0x25A3, + snd_se_boss_Rayquaza_19 = 0x25A4, + snd_se_boss_Rayquaza_20 = 0x25A5, + snd_se_boss_Rayquaza_21 = 0x25A6, + snd_se_boss_Rayquaza_22 = 0x25A7, + snd_se_boss_Rayquaza_23 = 0x25A8, + snd_se_boss_Rayquaza_24 = 0x25A9, + snd_se_boss_Rayquaza_25 = 0x25AA, + snd_se_boss_Rayquaza_26 = 0x25AB, + snd_se_boss_Rayquaza_27 = 0x25AC, + snd_se_boss_Rayquaza_28 = 0x25AD, + snd_se_boss_Rayquaza_29 = 0x25AE, + snd_se_boss_Porky_00 = 0x25AF, + snd_se_boss_Porky_01 = 0x25B0, + snd_se_boss_Porky_02 = 0x25B1, + snd_se_boss_Porky_03 = 0x25B2, + snd_se_boss_Porky_04 = 0x25B3, + snd_se_boss_Porky_05 = 0x25B4, + snd_se_boss_Porky_06 = 0x25B5, + snd_se_boss_Porky_07 = 0x25B6, + snd_se_boss_Porky_08 = 0x25B7, + snd_se_boss_Porky_09 = 0x25B8, + snd_se_boss_Porky_10 = 0x25B9, + snd_se_boss_Porky_11 = 0x25BA, + snd_se_boss_Porky_12 = 0x25BB, + snd_se_boss_Porky_13 = 0x25BC, + snd_se_boss_Porky_14 = 0x25BD, + snd_se_boss_Porky_15 = 0x25BE, + snd_se_boss_Porky_16 = 0x25BF, + snd_se_boss_Porky_17 = 0x25C0, + snd_se_boss_Porky_18 = 0x25C1, + snd_se_boss_Porky_19 = 0x25C2, + snd_se_boss_Porky_20 = 0x25C3, + snd_se_boss_Porky_21 = 0x25C4, + snd_se_boss_Porky_22 = 0x25C5, + snd_se_boss_Porky_23 = 0x25C6, + snd_se_boss_Porky_24 = 0x25C7, + snd_se_boss_Porky_25 = 0x25C8, + snd_se_boss_Porky_26 = 0x25C9, + snd_se_boss_Porky_27 = 0x25CA, + snd_se_boss_Porky_28 = 0x25CB, + snd_se_boss_Porky_29 = 0x25CC, + snd_se_boss_Porky_30 = 0x25CD, + snd_se_boss_Porky_31 = 0x25CE, + snd_se_boss_Porky_32 = 0x25CF, + snd_se_boss_Porky_33 = 0x25D0, + snd_se_boss_Porky_34 = 0x25D1, + snd_se_boss_Galleom_00 = 0x25D2, + snd_se_boss_Galleom_01 = 0x25D3, + snd_se_boss_Galleom_02 = 0x25D4, + snd_se_boss_Galleom_03 = 0x25D5, + snd_se_boss_Galleom_04 = 0x25D6, + snd_se_boss_Galleom_05 = 0x25D7, + snd_se_boss_Galleom_06 = 0x25D8, + snd_se_boss_Galleom_07 = 0x25D9, + snd_se_boss_Galleom_08 = 0x25DA, + snd_se_boss_Galleom_09 = 0x25DB, + snd_se_boss_Galleom_10 = 0x25DC, + snd_se_boss_Galleom_11 = 0x25DD, + snd_se_boss_Galleom_12 = 0x25DE, + snd_se_boss_Galleom_13 = 0x25DF, + snd_se_boss_Galleom_14 = 0x25E0, + snd_se_boss_Galleom_15 = 0x25E1, + snd_se_boss_Galleom_16 = 0x25E2, + snd_se_boss_Galleom_17 = 0x25E3, + snd_se_boss_Galleom_18 = 0x25E4, + snd_se_boss_Galleom_19 = 0x25E5, + snd_se_boss_Galleom_20 = 0x25E6, + snd_se_boss_Galleom_21 = 0x25E7, + snd_se_boss_Galleom_22 = 0x25E8, + snd_se_boss_Galleom_23 = 0x25E9, + snd_se_boss_Galleom_24 = 0x25EA, + snd_se_boss_Galleom_25 = 0x25EB, + snd_se_boss_Galleom_26 = 0x25EC, + snd_se_boss_Galleom_27 = 0x25ED, + snd_se_boss_Galleom_28 = 0x25EE, + snd_se_boss_Galleom_29 = 0x25EF, + snd_se_boss_Galleom_30 = 0x25F0, + snd_se_boss_Galleom_31 = 0x25F1, + snd_se_boss_Galleom_32 = 0x25F2, + snd_se_boss_Galleom_33 = 0x25F3, + snd_se_boss_Galleom_34 = 0x25F4, + snd_se_boss_Galleom_35 = 0x25F5, + snd_se_boss_Galleom_36 = 0x25F6, + snd_se_boss_Galleom_37 = 0x25F7, + snd_se_boss_Galleom_38 = 0x25F8, + snd_se_boss_Galleom_39 = 0x25F9, + snd_se_boss_Ridley_00 = 0x25FA, + snd_se_boss_Ridley_01 = 0x25FB, + snd_se_boss_Ridley_02 = 0x25FC, + snd_se_boss_Ridley_03 = 0x25FD, + snd_se_boss_Ridley_04 = 0x25FE, + snd_se_boss_Ridley_05 = 0x25FF, + snd_se_boss_Ridley_06 = 0x2600, + snd_se_boss_Ridley_07 = 0x2601, + snd_se_boss_Ridley_08 = 0x2602, + snd_se_boss_Ridley_09 = 0x2603, + snd_se_boss_Ridley_10 = 0x2604, + snd_se_boss_Ridley_11 = 0x2605, + snd_se_boss_Ridley_12 = 0x2606, + snd_se_boss_Ridley_13 = 0x2607, + snd_se_boss_Ridley_14 = 0x2608, + snd_se_boss_Ridley_15 = 0x2609, + snd_se_boss_Ridley_16 = 0x260A, + snd_se_boss_Ridley_17 = 0x260B, + snd_se_boss_Ridley_18 = 0x260C, + snd_se_boss_Ridley_19 = 0x260D, + snd_se_boss_Ridley_20 = 0x260E, + snd_se_boss_Ridley_21 = 0x260F, + snd_se_boss_Ridley_22 = 0x2610, + snd_se_boss_Ridley_23 = 0x2611, + snd_se_boss_Ridley_24 = 0x2612, + snd_se_boss_Ridley_25 = 0x2613, + snd_se_boss_Ridley_26 = 0x2614, + snd_se_boss_Ridley_27 = 0x2615, + snd_se_boss_Ridley_28 = 0x2616, + snd_se_boss_Ridley_29 = 0x2617, + snd_se_boss_Duon_00 = 0x2618, + snd_se_boss_Duon_01 = 0x2619, + snd_se_boss_Duon_02 = 0x261A, + snd_se_boss_Duon_03 = 0x261B, + snd_se_boss_Duon_04 = 0x261C, + snd_se_boss_Duon_05 = 0x261D, + snd_se_boss_Duon_06 = 0x261E, + snd_se_boss_Duon_07 = 0x261F, + snd_se_boss_Duon_08 = 0x2620, + snd_se_boss_Duon_09 = 0x2621, + snd_se_boss_Duon_10 = 0x2622, + snd_se_boss_Duon_11 = 0x2623, + snd_se_boss_Duon_12 = 0x2624, + snd_se_boss_Duon_13 = 0x2625, + snd_se_boss_Duon_14 = 0x2626, + snd_se_boss_Duon_15 = 0x2627, + snd_se_boss_Duon_16 = 0x2628, + snd_se_boss_Duon_17 = 0x2629, + snd_se_boss_Duon_18 = 0x262A, + snd_se_boss_Duon_19 = 0x262B, + snd_se_boss_Duon_20 = 0x262C, + snd_se_boss_Duon_21 = 0x262D, + snd_se_boss_Duon_22 = 0x262E, + snd_se_boss_Duon_23 = 0x262F, + snd_se_boss_Duon_24 = 0x2630, + snd_se_boss_Duon_25 = 0x2631, + snd_se_boss_Duon_26 = 0x2632, + snd_se_boss_Duon_27 = 0x2633, + snd_se_boss_Duon_28 = 0x2634, + snd_se_boss_Duon_29 = 0x2635, + snd_se_boss_Duon_30 = 0x2636, + snd_se_boss_Duon_31 = 0x2637, + snd_se_boss_Duon_32 = 0x2638, + snd_se_boss_Duon_33 = 0x2639, + snd_se_boss_Duon_34 = 0x263A, + snd_se_boss_Duon_35 = 0x263B, + snd_se_boss_Duon_36 = 0x263C, + snd_se_boss_Duon_37 = 0x263D, + snd_se_boss_Duon_38 = 0x263E, + snd_se_boss_Duon_39 = 0x263F, + snd_se_boss_Metaridley_00 = 0x2640, + snd_se_boss_Metaridley_01 = 0x2641, + snd_se_boss_Metaridley_02 = 0x2642, + snd_se_boss_Metaridley_03 = 0x2643, + snd_se_boss_Metaridley_04 = 0x2644, + snd_se_boss_Metaridley_05 = 0x2645, + snd_se_boss_Metaridley_06 = 0x2646, + snd_se_boss_Metaridley_07 = 0x2647, + snd_se_boss_Metaridley_08 = 0x2648, + snd_se_boss_Metaridley_09 = 0x2649, + snd_se_boss_Metaridley_10 = 0x264A, + snd_se_boss_Metaridley_11 = 0x264B, + snd_se_boss_Metaridley_12 = 0x264C, + snd_se_boss_Metaridley_13 = 0x264D, + snd_se_boss_Metaridley_14 = 0x264E, + snd_se_boss_Metaridley_15 = 0x264F, + snd_se_boss_Metaridley_16 = 0x2650, + snd_se_boss_Metaridley_17 = 0x2651, + snd_se_boss_Metaridley_18 = 0x2652, + snd_se_boss_Metaridley_19 = 0x2653, + snd_se_boss_Metaridley_20 = 0x2654, + snd_se_boss_Metaridley_21 = 0x2655, + snd_se_boss_Metaridley_22 = 0x2656, + snd_se_boss_Metaridley_23 = 0x2657, + snd_se_boss_Metaridley_24 = 0x2658, + snd_se_boss_Metaridley_25 = 0x2659, + snd_se_boss_Metaridley_26 = 0x265A, + snd_se_boss_Metaridley_27 = 0x265B, + snd_se_boss_Metaridley_28 = 0x265C, + snd_se_boss_Metaridley_29 = 0x265D, + snd_se_boss_Metaridley_30 = 0x265E, + snd_se_boss_Metaridley_31 = 0x265F, + snd_se_boss_Metaridley_32 = 0x2660, + snd_se_boss_Metaridley_33 = 0x2661, + snd_se_boss_Metaridley_34 = 0x2662, + snd_se_boss_Taboo_00 = 0x2663, + snd_se_boss_Taboo_01 = 0x2664, + snd_se_boss_Taboo_02 = 0x2665, + snd_se_boss_Taboo_03 = 0x2666, + snd_se_boss_Taboo_04 = 0x2667, + snd_se_boss_Taboo_05 = 0x2668, + snd_se_boss_Taboo_06 = 0x2669, + snd_se_boss_Taboo_07 = 0x266A, + snd_se_boss_Taboo_08 = 0x266B, + snd_se_boss_Taboo_09 = 0x266C, + snd_se_boss_Taboo_10 = 0x266D, + snd_se_boss_Taboo_11 = 0x266E, + snd_se_boss_Taboo_12 = 0x266F, + snd_se_boss_Taboo_13 = 0x2670, + snd_se_boss_Taboo_14 = 0x2671, + snd_se_boss_Taboo_15 = 0x2672, + snd_se_boss_Taboo_16 = 0x2673, + snd_se_boss_Taboo_17 = 0x2674, + snd_se_boss_Taboo_18 = 0x2675, + snd_se_boss_Taboo_19 = 0x2676, + snd_se_boss_Taboo_20 = 0x2677, + snd_se_boss_Taboo_21 = 0x2678, + snd_se_boss_Taboo_22 = 0x2679, + snd_se_boss_Taboo_23 = 0x267A, + snd_se_boss_Taboo_24 = 0x267B, + snd_se_boss_Taboo_25 = 0x267C, + snd_se_boss_Taboo_26 = 0x267D, + snd_se_boss_Taboo_27 = 0x267E, + snd_se_boss_Taboo_28 = 0x267F, + snd_se_boss_Taboo_29 = 0x2680, + snd_se_boss_Taboo_30 = 0x2681, + snd_se_boss_Taboo_31 = 0x2682, + snd_se_boss_Taboo_32 = 0x2683, + snd_se_boss_Taboo_33 = 0x2684, + snd_se_boss_Taboo_34 = 0x2685, + snd_se_boss_Taboo_35 = 0x2686, + snd_se_boss_Taboo_36 = 0x2687, + snd_se_boss_Taboo_37 = 0x2688, + snd_se_boss_Taboo_38 = 0x2689, + snd_se_boss_Taboo_39 = 0x268A, + snd_se_boss_Taboo_40 = 0x268B, + snd_se_boss_Taboo_41 = 0x268C, + snd_se_boss_Taboo_42 = 0x268D, + snd_se_boss_Taboo_43 = 0x268E, + snd_se_boss_Taboo_44 = 0x268F, + snd_se_boss_Masterhand_00 = 0x2690, + snd_se_boss_Masterhand_01 = 0x2691, + snd_se_boss_Masterhand_02 = 0x2692, + snd_se_boss_Masterhand_03 = 0x2693, + snd_se_boss_Masterhand_04 = 0x2694, + snd_se_boss_Masterhand_05 = 0x2695, + snd_se_boss_Masterhand_06 = 0x2696, + snd_se_boss_Masterhand_07 = 0x2697, + snd_se_boss_Masterhand_08 = 0x2698, + snd_se_boss_Masterhand_09 = 0x2699, + snd_se_boss_Masterhand_10 = 0x269A, + snd_se_boss_Masterhand_11 = 0x269B, + snd_se_boss_Masterhand_12 = 0x269C, + snd_se_boss_Masterhand_13 = 0x269D, + snd_se_boss_Masterhand_14 = 0x269E, + snd_se_boss_Masterhand_15 = 0x269F, + snd_se_boss_Masterhand_16 = 0x26A0, + snd_se_boss_Masterhand_17 = 0x26A1, + snd_se_boss_Masterhand_18 = 0x26A2, + snd_se_boss_Masterhand_19 = 0x26A3, + snd_se_boss_Masterhand_20 = 0x26A4, + snd_se_boss_Masterhand_21 = 0x26A5, + snd_se_boss_Masterhand_22 = 0x26A6, + snd_se_boss_Masterhand_23 = 0x26A7, + snd_se_boss_Masterhand_24 = 0x26A8, + snd_se_boss_Masterhand_25 = 0x26A9, + snd_se_boss_Masterhand_26 = 0x26AA, + snd_se_boss_Masterhand_27 = 0x26AB, + snd_se_boss_Masterhand_28 = 0x26AC, + snd_se_boss_Masterhand_29 = 0x26AD, + snd_se_boss_Masterhand_30 = 0x26AE, + snd_se_boss_Masterhand_31 = 0x26AF, + snd_se_boss_Masterhand_32 = 0x26B0, + snd_se_boss_Masterhand_33 = 0x26B1, + snd_se_boss_Masterhand_34 = 0x26B2, + snd_se_boss_Masterhand_35 = 0x26B3, + snd_se_boss_Masterhand_36 = 0x26B4, + snd_se_boss_Masterhand_37 = 0x26B5, + snd_se_boss_Masterhand_38 = 0x26B6, + snd_se_boss_Masterhand_39 = 0x26B7, + snd_se_boss_Masterhand_40 = 0x26B8, + snd_se_boss_Masterhand_41 = 0x26B9, + snd_se_boss_Masterhand_42 = 0x26BA, + snd_se_boss_Masterhand_43 = 0x26BB, + snd_se_boss_Masterhand_44 = 0x26BC, + snd_se_boss_Crazyhand_00 = 0x26BD, + snd_se_boss_Crazyhand_01 = 0x26BE, + snd_se_boss_Crazyhand_02 = 0x26BF, + snd_se_boss_Crazyhand_03 = 0x26C0, + snd_se_boss_Crazyhand_04 = 0x26C1, + snd_se_boss_Crazyhand_05 = 0x26C2, + snd_se_boss_Crazyhand_06 = 0x26C3, + snd_se_boss_Crazyhand_07 = 0x26C4, + snd_se_boss_Crazyhand_08 = 0x26C5, + snd_se_boss_Crazyhand_09 = 0x26C6, + snd_se_boss_Crazyhand_10 = 0x26C7, + snd_se_boss_Crazyhand_11 = 0x26C8, + snd_se_boss_Crazyhand_12 = 0x26C9, + snd_se_boss_Crazyhand_13 = 0x26CA, + snd_se_boss_Crazyhand_14 = 0x26CB, + snd_se_boss_Crazyhand_15 = 0x26CC, + snd_se_boss_Crazyhand_16 = 0x26CD, + snd_se_boss_Crazyhand_17 = 0x26CE, + snd_se_boss_Crazyhand_18 = 0x26CF, + snd_se_boss_Crazyhand_19 = 0x26D0, + snd_se_boss_Crazyhand_20 = 0x26D1, + snd_se_boss_Crazyhand_21 = 0x26D2, + snd_se_boss_Crazyhand_22 = 0x26D3, + snd_se_boss_Crazyhand_23 = 0x26D4, + snd_se_boss_Crazyhand_24 = 0x26D5, + snd_se_boss_Crazyhand_25 = 0x26D6, + snd_se_boss_Crazyhand_26 = 0x26D7, + snd_se_boss_Crazyhand_27 = 0x26D8, + snd_se_boss_Crazyhand_28 = 0x26D9, + snd_se_boss_Crazyhand_29 = 0x26DA, + snd_se_boss_Crazyhand_30 = 0x26DB, + snd_se_boss_Crazyhand_31 = 0x26DC, + snd_se_boss_Crazyhand_32 = 0x26DD, + snd_se_boss_Crazyhand_33 = 0x26DE, + snd_se_boss_Crazyhand_34 = 0x26DF, + snd_se_boss_Crazyhand_35 = 0x26E0, + snd_se_boss_Crazyhand_36 = 0x26E1, + snd_se_boss_Crazyhand_37 = 0x26E2, + snd_se_boss_Crazyhand_38 = 0x26E3, + snd_se_boss_Crazyhand_39 = 0x26E4, + snd_se_boss_Crazyhand_40 = 0x26E5, + snd_se_boss_Crazyhand_41 = 0x26E6, + snd_se_boss_Crazyhand_42 = 0x26E7, + snd_se_boss_Crazyhand_43 = 0x26E8, + snd_se_boss_Crazyhand_44 = 0x26E9, + snd_se_boss_Crazyhand_45 = 0x26EA, + snd_se_boss_Crazyhand_46 = 0x26EB, + snd_se_boss_Crazyhand_47 = 0x26EC, + snd_se_boss_Crazyhand_48 = 0x26ED, + snd_se_boss_Crazyhand_49 = 0x26EE, + snd_se_boss_FalconFlyer_00 = 0x26EF, + snd_se_boss_FalconFlyer_01 = 0x26F0, + snd_se_boss_FalconFlyer_02 = 0x26F1, + snd_se_boss_FalconFlyer_03 = 0x26F2, + snd_se_boss_FalconFlyer_04 = 0x26F3, + snd_se_boss_FalconFlyer_05 = 0x26F4, + snd_se_boss_FalconFlyer_06 = 0x26F5, + snd_se_boss_FalconFlyer_07 = 0x26F6, + snd_se_boss_FalconFlyer_08 = 0x26F7, + snd_se_boss_FalconFlyer_09 = 0x26F8, + snd_bgm_X01_MAINTHEME = 0x26F9, + snd_bgm_X02_MENU1 = 0x26FA, + snd_bgm_X03_MENU2 = 0x26FB, + snd_bgm_X04_SENJYOU = 0x26FC, + snd_bgm_X05_SYUUTEN = 0x26FD, + snd_bgm_X06_KEKKA = 0x26FE, + snd_bgm_X07_ONLINE = 0x26FF, + snd_bgm_X08_VSRESULT = 0x2700, + snd_bgm_X09_NARABI = 0x2701, + snd_bgm_X10_TOURNAMENT = 0x2702, + snd_bgm_X11_TRESULT = 0x2703, + snd_bgm_X12_SIMPLEINTRO = 0x2704, + snd_bgm_X13_SIMPLERESULT = 0x2705, + snd_bgm_X14_ENDING = 0x2706, + snd_bgm_X15_REST = 0x2707, + snd_bgm_X16_HOMERUN = 0x2708, + snd_bgm_X17_HUNDRED = 0x2709, + snd_bgm_X18_BOSSBATTLE = 0x270A, + snd_bgm_X19_FIGURE = 0x270B, + snd_bgm_X20_SEAL = 0x270C, + snd_bgm_X21_COINSHOOTER = 0x270D, + snd_bgm_X22_CHRONICLE = 0x270E, + snd_bgm_X23_STAGEEDIT = 0x270F, + snd_bgm_X24_HOW2PLAY = 0x2710, + snd_bgm_X25_GETJINGLE = 0x2711, + snd_bgm_X26_TARGET = 0x2712, + snd_bgm_X27_STAFFROLL = 0x2713, + snd_bgm_A01_CHIJYOU = 0x2714, + snd_bgm_A02_CHIKA = 0x2715, + snd_bgm_A03_SUICHU = 0x2716, + snd_bgm_A04_LANDCHIKA = 0x2717, + snd_bgm_A05_M3HIKOUSEN = 0x2718, + snd_bgm_A06_OSHIROTORIDE = 0x2719, + snd_bgm_A07_MARIOWORLD = 0x271A, + snd_bgm_A08_NEWMARIO = 0x271B, + snd_bgm_A09_LUIGIMANSION = 0x271C, + snd_bgm_A10_MLRPG01 = 0x271D, + snd_bgm_A11_MLRPG02 = 0x271E, + snd_bgm_A12_MORINOKINOKO = 0x271F, + snd_bgm_A13_DOLPICTOWN = 0x2720, + snd_bgm_A14_RICCOHARBOR = 0x2721, + snd_bgm_A15_MARIO64 = 0x2722, + snd_bgm_A16_CHIJYOU2 = 0x2723, + snd_bgm_A17_MARIOBROS = 0x2724, + snd_bgm_A20_MARIOCIRCUIT = 0x2725, + snd_bgm_A21_LUIGICIRCUIT = 0x2726, + snd_bgm_A22_WALIGI = 0x2727, + snd_bgm_A23_RAINBOW = 0x2728, + snd_bgm_B01_MAINTHEME = 0x2729, + snd_bgm_B02_MAPBONUS = 0x272A, + snd_bgm_B03_OPENING = 0x272B, + snd_bgm_B04_FCDONKEY = 0x272C, + snd_bgm_B05_KINGKROOL = 0x272D, + snd_bgm_B06_TOGETOGE = 0x272E, + snd_bgm_B07_ARASHINOOKA = 0x272F, + snd_bgm_B08_JUNGLELEVEL = 0x2730, + snd_bgm_B09_25M = 0x2731, + snd_bgm_B10_TARUJET = 0x2732, + snd_bgm_C01_TITLE = 0x2733, + snd_bgm_C02_MAINTHEME = 0x2734, + snd_bgm_C03_SHINDEN2 = 0x2735, + snd_bgm_C04_ANOTHER = 0x2736, + snd_bgm_C05_URANOYAMA = 0x2737, + snd_bgm_C06_KAZENOSAKANA = 0x2738, + snd_bgm_C07_TARUTARU = 0x2739, + snd_bgm_C08_HYRULE = 0x273A, + snd_bgm_C09_OCARINAMEDLEY = 0x273B, + snd_bgm_C10_ARASHI = 0x273C, + snd_bgm_C11_MORUDOGEIRA = 0x273D, + snd_bgm_C12_AONOMIKO = 0x273E, + snd_bgm_C13_GERUDO = 0x273F, + snd_bgm_C14_TERMINA = 0x2740, + snd_bgm_C15_RYUNOSHIMA = 0x2741, + snd_bgm_C16_OOUNABARA = 0x2742, + snd_bgm_C17_TPMAIN = 0x2743, + snd_bgm_C18_HIDDENVLG = 0x2744, + snd_bgm_C19_MIDONASOS = 0x2745, + snd_bgm_D01_MAIN = 0x2746, + snd_bgm_D02_NOLFARE = 0x2747, + snd_bgm_D03_ENDINGMETROID = 0x2748, + snd_bgm_D04_RIDLEY = 0x2749, + snd_bgm_D05_ENDINGSUPER = 0x274A, + snd_bgm_D06_SECTOR1 = 0x274B, + snd_bgm_D07_OPENING = 0x274C, + snd_bgm_D08_PARASITE = 0x274D, + snd_bgm_D09_METARIDLEY = 0x274E, + snd_bgm_D10_MULTIPLAY = 0x274F, + snd_bgm_E01_YOSSYSTORY = 0x2750, + snd_bgm_E02_ATHLETIC = 0x2751, + snd_bgm_E03_ISLANDMAIN = 0x2752, + snd_bgm_E04_COCKIE = 0x2753, + snd_bgm_E05_OHANABATAKE = 0x2754, + snd_bgm_E06_YOSSYISLAND2 = 0x2755, + snd_bgm_E07_ATHLETIC2 = 0x2756, + snd_bgm_F01_AIRRIDE = 0x2757, + snd_bgm_F02_DEDEDE = 0x2758, + snd_bgm_F03_BOSSMEDLEY = 0x2759, + snd_bgm_F04_BUTTER = 0x275A, + snd_bgm_F05_GOURMET = 0x275B, + snd_bgm_F06_METANIGHT = 0x275C, + snd_bgm_F07_MARX = 0x275D, + snd_bgm_F08_ZERO2 = 0x275E, + snd_bgm_F09_MORISHIZEN = 0x275F, + snd_bgm_F10_CHECKNIGHT = 0x2760, + snd_bgm_F11_COLDA = 0x2761, + snd_bgm_F12_DOROCHE = 0x2762, + snd_bgm_G01_MAINSFC = 0x2763, + snd_bgm_G02_CORNELIA = 0x2764, + snd_bgm_G03_MAIN64 = 0x2765, + snd_bgm_G04_AREA6 = 0x2766, + snd_bgm_G05_STARWOLF = 0x2767, + snd_bgm_G06_COMMAND = 0x2768, + snd_bgm_G07_SENTOUCYUUIKI = 0x2769, + snd_bgm_G08_HYOUGEN = 0x276A, + snd_bgm_G09_STARWOLF2 = 0x276B, + snd_bgm_G10_SPACEAMADA = 0x276C, + snd_bgm_G11_AREA6B = 0x276D, + snd_bgm_H01_MAINTHEME = 0x276E, + snd_bgm_H02_POKECENTER = 0x276F, + snd_bgm_H03_TOKIWA = 0x2770, + snd_bgm_H04_POKEGYM = 0x2771, + snd_bgm_H05_SENTOUYASEI = 0x2772, + snd_bgm_H06_CHAMPIONROAD = 0x2773, + snd_bgm_H07_BLTPDP = 0x2774, + snd_bgm_H08_DIALGA = 0x2775, + snd_bgm_H09_GINGADAN = 0x2776, + snd_bgm_H10_209BAN = 0x2777, + snd_bgm_I01_MUTECITY = 0x2778, + snd_bgm_I02_WHITELAND = 0x2779, + snd_bgm_I03_FIREFIELD = 0x277A, + snd_bgm_I04_CARSELECT = 0x277B, + snd_bgm_I05_DREAMCHASER = 0x277C, + snd_bgm_I06_DEVIL = 0x277D, + snd_bgm_I07_LONGDISTANCE = 0x277E, + snd_bgm_I08_BRAIN = 0x277F, + snd_bgm_I09_SHOTGUN = 0x2780, + snd_bgm_I10_PLANET = 0x2781, + snd_bgm_J01_STAGECHANGE = 0x2782, + snd_bgm_J02_MAINTHEME = 0x2783, + snd_bgm_J03_ANKOKURYU = 0x2784, + snd_bgm_J04_SENTOU3 = 0x2785, + snd_bgm_J05_ERABARESHI = 0x2786, + snd_bgm_J06_SHINGEKI = 0x2787, + snd_bgm_J07_WINNINGROAD = 0x2788, + snd_bgm_J08_KOUGEKI = 0x2789, + snd_bgm_J09_AGAINST = 0x278A, + snd_bgm_J10_CRIMIA = 0x278B, + snd_bgm_J11_POWERHUNGRY = 0x278C, + snd_bgm_J12_VICTORY = 0x278D, + snd_bgm_J13_IKETHEME = 0x278E, + snd_bgm_K01_SNOWMAN = 0x278F, + snd_bgm_K02_SENTOUONIISAN = 0x2790, + snd_bgm_K03_EIGHTMELODIES = 0x2791, + snd_bgm_K04_SMILEANDTEARS = 0x2792, + snd_bgm_K05_HUMORESQUE = 0x2793, + snd_bgm_K06_BECAUSE = 0x2794, + snd_bgm_K07_PORKEY = 0x2795, + snd_bgm_K08_M3LOVETHEME = 0x2796, + snd_bgm_K09_M3BTLMEDLEY = 0x2797, + snd_bgm_K10_UTOPIA = 0x2798, + snd_bgm_L01_STAGESELECT = 0x2799, + snd_bgm_L02_PIKMINSTAGE = 0x279A, + snd_bgm_L03_KANKYOUON = 0x279B, + snd_bgm_L04_AINOUTA = 0x279C, + snd_bgm_L05_TANENOUTA = 0x279D, + snd_bgm_L06_PIKMIN = 0x279E, + snd_bgm_L07_STAGECLEAR = 0x279F, + snd_bgm_L08_FRENCH = 0x27A0, + snd_bgm_M01_WARIOSTAGE = 0x27A1, + snd_bgm_M02_WARIOMEDLEY = 0x27A2, + snd_bgm_M03_MONAPIZAJ = 0x27A3, + snd_bgm_M04_MONAPIZAE = 0x27A4, + snd_bgm_M05_SUKISUKIJ = 0x27A5, + snd_bgm_M06_SUKISUKIE = 0x27A6, + snd_bgm_M07_ASHLEEJ = 0x27A7, + snd_bgm_M08_ASHLEEE = 0x27A8, + snd_bgm_M09_WARIOSTAGE = 0x27A9, + snd_bgm_M10_WARIOSTAGE = 0x27AA, + snd_bgm_M11_WARIOSTAGE = 0x27AB, + snd_bgm_M12_WARIOSTAGE = 0x27AC, + snd_bgm_M13_WARIOSTAGE = 0x27AD, + snd_bgm_M14_WARIOSTAGE = 0x27AE, + snd_bgm_M15_WARIOSTAGE = 0x27AF, + snd_bgm_M16_WARIOSTAGE = 0x27B0, + snd_bgm_M17_WARIOSTAGE = 0x27B1, + snd_bgm_M18_WARIOSTAGE = 0x27B2, + snd_bgm_N01_DOUBUTUMAIN = 0x27B3, + snd_bgm_N02_KEKERIDER = 0x27B4, + snd_bgm_N03_0200AM = 0x27B5, + snd_bgm_N04_RADIOTAISO = 0x27B6, + snd_bgm_N05_HATONOSU = 0x27B7, + snd_bgm_N06_SHIYAKUSHO = 0x27B8, + snd_bgm_N07_KEKE01 = 0x27B9, + snd_bgm_N08_KEKE02 = 0x27BA, + snd_bgm_N09_KEKE03 = 0x27BB, + snd_bgm_N10_KEKE04 = 0x27BC, + snd_bgm_N11_KEKE05 = 0x27BD, + snd_bgm_N12_KEKE06 = 0x27BE, + snd_bgm_P01_MEIFUKAI = 0x27BF, + snd_bgm_P02_MEIFUKAI2 = 0x27C0, + snd_bgm_P03_CHIJYOUKAI = 0x27C1, + snd_bgm_P04_PALMEDLEY = 0x27C2, + snd_bgm_Q01_FAMICOMMEDLEY = 0x27C3, + snd_bgm_Q02_BLOCKGYRO = 0x27C4, + snd_bgm_Q03_SPORTSMEDLEY = 0x27C5, + snd_bgm_Q04_CHILL = 0x27C6, + snd_bgm_Q05_KURUKURULAND = 0x27C7, + snd_bgm_Q06_BALLOONTRIP = 0x27C8, + snd_bgm_Q07_CLIMBER = 0x27C9, + snd_bgm_Q08_SHINONI = 0x27CA, + snd_bgm_Q09_3DHOTRALLY = 0x27CB, + snd_bgm_Q10_TETRISA = 0x27CC, + snd_bgm_Q11_TETRISB = 0x27CD, + snd_bgm_Q12_TUNNEL = 0x27CE, + snd_bgm_Q13_WRECKINGCREW = 0x27CF, + snd_bgm_Q14_MURASAME = 0x27D0, + snd_bgm_R01_WILDTRACKS = 0x27D1, + snd_bgm_R02_PICTCHAT = 0x27D2, + snd_bgm_R03_ELECTRO = 0x27D3, + snd_bgm_R04_GAMEWATCH = 0x27D4, + snd_bgm_R05_MARIOSPORTS = 0x27D5, + snd_bgm_R06_PANELDEPON = 0x27D6, + snd_bgm_R07_MGMAINTHEME = 0x27D7, + snd_bgm_R08_YAWARAKA = 0x27D8, + snd_bgm_R09_GOLDENFOREST = 0x27D9, + snd_bgm_R10_NIGAOECH = 0x27DA, + snd_bgm_R11_SHOPCH = 0x27DB, + snd_bgm_R12_OUGON = 0x27DC, + snd_bgm_R13_COOKING = 0x27DD, + snd_bgm_R14_EXCITETRUCK = 0x27DE, + snd_bgm_R15_NOUTRA = 0x27DF, + snd_bgm_R16_WIISPORTS = 0x27E0, + snd_bgm_R17_USHI = 0x27E1, + snd_bgm_S01_MAINTHEME = 0x27E2, + snd_bgm_S02_ENCOUNTER = 0x27E3, + snd_bgm_S03_TARA = 0x27E4, + snd_bgm_S04_YELLDEADCALL = 0x27E5, + snd_bgm_S05_SNAKEEATER = 0x27E6, + snd_bgm_S06_MGS4LOVETHEME = 0x27E7, + snd_bgm_S07_CAVERN = 0x27E8, + snd_bgm_S08_BATTLEINTHEBASE = 0x27E9, + snd_bgm_S09_BEATMANIA = 0x27EA, + snd_bgm_S10_SOLIDSNAKE = 0x27EB, + snd_bgm_S11_CALLINGTO = 0x27EC, + snd_bgm_T01_STAFFROLL = 0x27ED, + snd_bgm_T02_DXMENU1 = 0x27EE, + snd_bgm_T03_DXOPENING = 0x27EF, + snd_bgm_T04_HOWTOPLAY = 0x27F0, + snd_bgm_T05_DXTERMINAL = 0x27F1, + snd_bgm_U01_GREENHILL = 0x27F2, + snd_bgm_U02_SCRAPBRAIN = 0x27F3, + snd_bgm_U03_EMERALDHILL = 0x27F4, + snd_bgm_U04_ANGELISLAND = 0x27F5, + snd_bgm_U05_UCANDO = 0x27F6, + snd_bgm_U06_SONICBOOM = 0x27F7, + snd_bgm_U07_SUPERSONICRACING = 0x27F8, + snd_bgm_U08_OPENYOURHEART = 0x27F9, + snd_bgm_U09_LIVEANDLEARN = 0x27FA, + snd_bgm_U10_SONICHEROES = 0x27FB, + snd_bgm_U11_RIGHTTHERE = 0x27FC, + snd_bgm_U12_HISWORLD = 0x27FD, + snd_bgm_U13_SECRETRINGS = 0x27FE, + snd_bgm_W01_DX01 = 0x27FF, + snd_bgm_W02_DX02 = 0x2800, + snd_bgm_W03_DX03 = 0x2801, + snd_bgm_W04_DX08 = 0x2802, + snd_bgm_W05_DX10 = 0x2803, + snd_bgm_W06_DX11 = 0x2804, + snd_bgm_W07_DX12 = 0x2805, + snd_bgm_W08_DX13 = 0x2806, + snd_bgm_W09_DX15 = 0x2807, + snd_bgm_W10_DX16 = 0x2808, + snd_bgm_W11_DX18 = 0x2809, + snd_bgm_W12_DX19 = 0x280A, + snd_bgm_W13_DX25 = 0x280B, + snd_bgm_W14_DX26 = 0x280C, + snd_bgm_W15_DX30 = 0x280D, + snd_bgm_W16_DX32 = 0x280E, + snd_bgm_W17_DX33 = 0x280F, + snd_bgm_W18_DX34 = 0x2810, + snd_bgm_W19_DX35 = 0x2811, + snd_bgm_W20_DX36 = 0x2812, + snd_bgm_W21_DX52 = 0x2813, + snd_bgm_W22_DX55 = 0x2814, + snd_bgm_W23_DX58 = 0x2815, + snd_bgm_W24_DX06 = 0x2816, + snd_bgm_W25_DX53 = 0x2817, + snd_bgm_W26_DX04 = 0x2818, + snd_bgm_W27_DX07 = 0x2819, + snd_bgm_W28_DX14 = 0x281A, + snd_bgm_W29_DX17 = 0x281B, + snd_bgm_W30_DX54 = 0x281C, + snd_bgm_W31_DX80 = 0x281D, + snd_bgm_W32_DX81 = 0x281E, + snd_bgm_Y01_ADV01 = 0x281F, + snd_bgm_Y02_ADV02 = 0x2820, + snd_bgm_Y03_ADV03 = 0x2821, + snd_bgm_Y04_ADV04 = 0x2822, + snd_bgm_Y05_ADV05 = 0x2823, + snd_bgm_Y06_ADV06 = 0x2824, + snd_bgm_Y07_ADV07 = 0x2825, + snd_bgm_Y08_ADV08 = 0x2826, + snd_bgm_Y09_ADV09 = 0x2827, + snd_bgm_Y10_ADV10 = 0x2828, + snd_bgm_Y11_ADV11 = 0x2829, + snd_bgm_Y12_ADV12 = 0x282A, + snd_bgm_Y13_ADV13 = 0x282B, + snd_bgm_Y14_ADV14 = 0x282C, + snd_bgm_Y15_ADV15 = 0x282D, + snd_bgm_Y16_ADV16 = 0x282E, + snd_bgm_Y17_ADV17 = 0x282F, + snd_bgm_Y18_ADV18 = 0x2830, + snd_bgm_Y19_ADV19 = 0x2831, + snd_bgm_Y20_ADV20 = 0x2832, + snd_bgm_Y21_ADV21 = 0x2833, + snd_bgm_Y22_ADV22 = 0x2834, + snd_bgm_Y23_ADV23 = 0x2835, + snd_bgm_Y24_ADV24 = 0x2836, + snd_bgm_Y25_ADV25 = 0x2837, + snd_bgm_Y26_ADV26 = 0x2838, + snd_bgm_Y27_ADV27 = 0x2839, + snd_bgm_Y28_ADV28 = 0x283A, + snd_bgm_Y29_ADV29 = 0x283B, + snd_bgm_Y30_ADV30 = 0x283C, + snd_bgm_Z01_FMARIO = 0x283D, + snd_bgm_Z02_FDONKEY = 0x283E, + snd_bgm_Z03_FLINK = 0x283F, + snd_bgm_Z04_FSAMUS = 0x2840, + snd_bgm_Z05_FYOSSY = 0x2841, + snd_bgm_Z06_FKIRBY = 0x2842, + snd_bgm_Z07_FFOX = 0x2843, + snd_bgm_Z08_FPIKACHU = 0x2844, + snd_bgm_Z09_FLUIGI = 0x2845, + snd_bgm_Z10_FCAPTAIN = 0x2846, + snd_bgm_Z11_FNESS = 0x2847, + snd_bgm_Z12_FKUOPA = 0x2848, + snd_bgm_Z13_FPEACH = 0x2849, + snd_bgm_Z14_FZELDA = 0x284A, + snd_bgm_Z15_FSHEIK = 0x284B, + snd_bgm_Z16_FICHICLIMBER = 0x284C, + snd_bgm_Z17_FMARTH = 0x284D, + snd_bgm_Z18_FGAMEWATCH = 0x284E, + snd_bgm_Z19_FFALCO = 0x284F, + snd_bgm_Z20_FGANON = 0x2850, + snd_bgm_Z21_FWARIO = 0x2851, + snd_bgm_Z22_FMETAKNIGHT = 0x2852, + snd_bgm_Z23_FPITT = 0x2853, + snd_bgm_Z24_FZEROSAMUS = 0x2854, + snd_bgm_Z25_FPIKMIN = 0x2855, + snd_bgm_Z26_FLUCAS = 0x2856, + snd_bgm_Z27_FDIDDY = 0x2857, + snd_bgm_Z28_FPOKETRAINER = 0x2858, + snd_bgm_Z32_FDEDEDE = 0x2859, + snd_bgm_Z33_FLICARIO = 0x285A, + snd_bgm_Z34_FIKE = 0x285B, + snd_bgm_Z35_FROBOT = 0x285C, + snd_bgm_Z37_FPURIN = 0x285D, + snd_bgm_Z38_FMYU2 = 0x285E, + snd_bgm_Z39_FROY = 0x285F, + snd_bgm_Z41_FTOONLINK = 0x2860, + snd_bgm_Z46_FSNAKE = 0x2861, + snd_bgm_Z47_FSONIC = 0x2862, + snd_bgm_Z50_JCONTINUE = 0x2863, + snd_bgm_Z51_JGO = 0x2864, + snd_bgm_Z52_JCLEAR1 = 0x2865, + snd_bgm_Z53_JCLEAR2 = 0x2866, + snd_bgm_Z54_JFIGUREGET = 0x2867, + snd_bgm_Z55_JRAREFIGURE = 0x2868, + snd_bgm_Z56_FINCOMING = 0x2869, + snd_bgm_Z57_JYOUSO1 = 0x286A, + snd_bgm_Z58_JYOUSO2 = 0x286B, +}; + +enum SndGroupID { + Snd_Group_Joucyu=0, + Snd_Group_Fighter_Mario=1, + Snd_Group_Fighter_Link=2, + Snd_Group_Fighter_Pit=3, + Snd_Group_Fighter_MetaKnight=4, + Snd_Group_Fighter_Dedede=5, + Snd_Group_Fighter_Donkey=6, + Snd_Group_Fighter_Samus=7, + Snd_Group_Fighter_Yoshi=8, + Snd_Group_Fighter_Kirby=9, + Snd_Group_Fighter_Fox=10, + Snd_Group_Fighter_Pikachu=11, + Snd_Group_Fighter_Luigi=12, + Snd_Group_Fighter_Captain=13, + Snd_Group_Fighter_Ness=14, + Snd_Group_Fighter_Koopa=15, + Snd_Group_Fighter_Peach=16, + Snd_Group_Fighter_Zelda=17, + Snd_Group_Fighter_IceClimber=18, + Snd_Group_Fighter_Marth=19, + Snd_Group_Fighter_GameWatch=20, + Snd_Group_Fighter_Falco=21, + Snd_Group_Fighter_Ganon=22, + Snd_Group_Fighter_Wario=23, + Snd_Group_Fighter_Pikmin=24, + Snd_Group_Fighter_Lucas=25, + Snd_Group_Fighter_Diddy=26, + Snd_Group_Fighter_PokeTrainer=27, + Snd_Group_Fighter_PokeLizardon=28, + Snd_Group_Fighter_PokeZenigame=29, + Snd_Group_Fighter_PokeFushigisou=30, + Snd_Group_Fighter_Lucario=31, + Snd_Group_Fighter_Ike=32, + Snd_Group_Fighter_Robot=33, + Snd_Group_Fighter_Purin=34, + Snd_Group_Fighter_ToonLink=35, + Snd_Group_Fighter_Wolf=36, + Snd_Group_Fighter_Snake=37, + Snd_Group_Fighter_Sonic=38, + Snd_Group_Select=39, + Snd_Group_Fighter_Zako=40, + Snd_Group_Copy_All=41, + Snd_Group_Copy_Captain=42, + Snd_Group_Copy_Dedede=43, + Snd_Group_Copy_Diddy=44, + Snd_Group_Copy_Donkey=45, + Snd_Group_Copy_Falco=46, + Snd_Group_Copy_Fox=47, + Snd_Group_Copy_GameWatch=48, + Snd_Group_Copy_Ganon=49, + Snd_Group_Copy_IceClimber=50, + Snd_Group_Copy_Ike=51, + Snd_Group_Copy_Koopa=52, + Snd_Group_Copy_Link=53, + Snd_Group_Copy_Lucario=54, + Snd_Group_Copy_Lucas=55, + Snd_Group_Copy_Luigi=56, + Snd_Group_Copy_Mario=57, + Snd_Group_Copy_Marth=58, + Snd_Group_Copy_MetaKnight=59, + Snd_Group_Copy_Ness=60, + Snd_Group_Copy_Peach=61, + Snd_Group_Copy_Pikachu=62, + Snd_Group_Copy_Pikmin=63, + Snd_Group_Copy_Pit=64, + Snd_Group_Copy_3Set=65, + Snd_Group_Copy_Purin=66, + Snd_Group_Copy_Robot=67, + Snd_Group_Copy_Sheik=68, + Snd_Group_Copy_Snake=69, + Snd_Group_Copy_Sonic=70, + Snd_Group_Copy_SZeroSuit=71, + Snd_Group_Copy_ToonLink=72, + Snd_Group_Copy_WarioMan=73, + Snd_Group_Copy_Wolf=74, + Snd_Group_Copy_Yoshi=75, + Snd_Group_Stage_Crayon=76, + Snd_Group_Stage_Dolpic=77, + Snd_Group_Stage_Mansion=78, + Snd_Group_Stage_MarioPast=79, + Snd_Group_Stage_Kart=80, + Snd_Group_Stage_Donkey=81, + Snd_Group_Stage_Jungle=82, + Snd_Group_Stage_Pirates=83, + Snd_Group_Stage_Oldin=84, + Snd_Group_Stage_Norfair=85, + Snd_Group_Stage_Orpheon=86, + Snd_Group_Stage_Halberd=87, + Snd_Group_Stage_StarFox=88, + Snd_Group_Stage_Stadium=89, + Snd_Group_Stage_Tengan=90, + Snd_Group_Stage_FZero=91, + Snd_Group_Stage_Ice=92, + Snd_Group_Stage_GW=93, + Snd_Group_Stage_Emblem=94, + Snd_Group_Stage_Madein=95, + Snd_Group_Stage_Pikmin=96, + Snd_Group_Stage_Palutena=97, + Snd_Group_Stage_Famicom=98, + Snd_Group_Stage_NewPork=99, + Snd_Group_Stage_Village=100, + Snd_Group_Stage_MetalGear=101, + Snd_Group_Stage_GreenHill=102, + Snd_Group_Stage_PictChat=103, + Snd_Group_Stage_Plankton=104, + Snd_Group_Stage_StageEdit=105, + Snd_Group_Stage_Garden=106, + Snd_Group_Stage_Zebes=107, + Snd_Group_Stage_Greens=108, + Snd_Group_Stage_Corneria=109, + Snd_Group_Stage_PStadium=110, + Snd_Group_Stage_BigBlue=111, + Snd_Group_Stage_Onett=112, + Snd_Group_CoinShooter=113, + Snd_Group_ClearGetter=114, + Snd_Group_Stage_HomeRun=115, + Snd_Group_Stage_Target=116, + Snd_Group_Stage_CharaRoll=117, + Snd_Group_Item=118, + Snd_Group_MonsterBall=119, + Snd_Group_Assist_Jugem=120, + Snd_Group_Assist_Goroh=121, + Snd_Group_Assist_Joe=122, + Snd_Group_Assist_Waluigi=123, + Snd_Group_Assist_Resetsan=124, + Snd_Group_Assist_Nintendogs=125, + Snd_Group_Assist_Excitebike=126, + Snd_Group_Assist_Devil=127, + Snd_Group_Assist_HammerBros=128, + Snd_Group_Assist_Metroid=129, + Snd_Group_Assist_Wright=130, + Snd_Group_Assist_Stafy=131, + Snd_Group_Assist_Tingle=132, + Snd_Group_Assist_Katana=133, + Snd_Group_Assist_Lin=134, + Snd_Group_Assist_Andross=135, + Snd_Group_Assist_LittleMac=136, + Snd_Group_Assist_Tank=137, + Snd_Group_Assist_Jeff=138, + Snd_Group_Assist_Heririn=139, + Snd_Group_Assist_Barbara=140, + Snd_Group_Assist_Cyborg=141, + Snd_Group_Assist_CustomRobo=142, + Snd_Group_Assist_Robin=143, + Snd_Group_Assist_Saki=144, + Snd_Group_Assist_Kururi=145, + Snd_Group_Assist_Shadow=146, + Snd_Group_StarFox_Fox_Space=147, + Snd_Group_StarFox_Fox_Combat=148, + Snd_Group_StarFox_Fox_Corneria=149, + Snd_Group_StarFox_Fox_Asteroid=150, + Snd_Group_StarFox_Fox_Battleship=151, + Snd_Group_Corneria_Fox_E=156, + Snd_Group_Corneria_Fox_F=157, + Snd_Group_Corneria_Fox_G=158, + Snd_Group_Corneria_Fox_H=159, + Snd_Group_Corneria_Fox_I=160, + Snd_Group_StarFox_Falco_Space=161, + Snd_Group_StarFox_Falco_Combat=162, + Snd_Group_StarFox_Falco_Corneria=163, + Snd_Group_StarFox_Falco_Asteroid=164, + Snd_Group_StarFox_Falco_Battleship=165, + Snd_Group_Corneria_Falco_A=166, + Snd_Group_Corneria_Falco_B=167, + Snd_Group_Corneria_Falco_C=168, + Snd_Group_Corneria_Falco_D=169, + Snd_Group_Corneria_Falco_E=170, + Snd_Group_StarFox_Wolf_Space=171, + Snd_Group_StarFox_Wolf_Combat=172, + Snd_Group_StarFox_Wolf_Corneria=173, + Snd_Group_StarFox_Wolf_Asteroid=174, + Snd_Group_StarFox_Wolf_Battleship=175, + Snd_Group_MetalGear_Mario=176, + Snd_Group_MetalGear_Donkey=177, + Snd_Group_MetalGear_Link=178, + Snd_Group_MetalGear_Samus=179, + Snd_Group_MetalGear_Yoshi=180, + Snd_Group_MetalGear_Kirby=181, + Snd_Group_MetalGear_Fox=182, + Snd_Group_MetalGear_Pikachu=183, + Snd_Group_MetalGear_Luigi=184, + Snd_Group_MetalGear_CaptainFalcon=185, + Snd_Group_MetalGear_Ness=186, + Snd_Group_MetalGear_Koopa=187, + Snd_Group_MetalGear_Peach=188, + Snd_Group_MetalGear_Zelda=189, + Snd_Group_MetalGear_Sheik=190, + Snd_Group_MetalGear_IceClimber=191, + Snd_Group_MetalGear_Marth=192, + Snd_Group_MetalGear_GW=193, + Snd_Group_MetalGear_Falco=194, + Snd_Group_MetalGear_Ganondorf=195, + Snd_Group_MetalGear_Wario=196, + Snd_Group_MetalGear_MetaKnight=197, + Snd_Group_MetalGear_Pit=198, + Snd_Group_MetalGear_SZeroSuit=199, + Snd_Group_MetalGear_Pikmin=200, + Snd_Group_MetalGear_Lucas=201, + Snd_Group_MetalGear_Diddy=202, + Snd_Group_MetalGear_PokeTrainer=203, + Snd_Group_MetalGear_Dedede=204, + Snd_Group_MetalGear_Lucario=205, + Snd_Group_MetalGear_Ike=206, + Snd_Group_MetalGear_Robot=207, + Snd_Group_MetalGear_Snake=208, + Snd_Group_MetalGear_Sonic=209, + Snd_Group_MetalGear_Purin=210, + Snd_Group_MetalGear_ToonLink=211, + Snd_Group_MetalGear_Wolf=212, + Snd_Group_Menu=213, + Snd_Group_Narration_Melee=214, + Snd_Group_Narration_Menu=215, + Snd_Group_Narration_CharaCall=216, + Snd_Group_AdvStage_Common=217, + Snd_Group_AdvStage_01_0=218, + Snd_Group_AdvStage_03_0=219, + Snd_Group_AdvStage_01_1=220, + Snd_Group_AdvStage_04_0=221, + Snd_Group_AdvStage_04_1=222, + Snd_Group_AdvStage_04_2=223, + Snd_Group_AdvStage_05_0=224, + Snd_Group_AdvStage_05_1=225, + Snd_Group_AdvStage_06_0=226, + Snd_Group_AdvStage_07_0=227, + Snd_Group_AdvStage_08_1=228, + Snd_Group_AdvStage_08_2=229, + Snd_Group_AdvStage_09_0=230, + Snd_Group_AdvStage_09_2=231, + Snd_Group_AdvStage_10_0=232, + Snd_Group_AdvStage_10_1=233, + Snd_Group_AdvStage_10_2=234, + Snd_Group_AdvStage_12_0=235, + Snd_Group_AdvStage_14_0=236, + Snd_Group_AdvStage_14_1=237, + Snd_Group_AdvStage_16_2=238, + Snd_Group_AdvStage_16_3=239, + Snd_Group_AdvStage_18_0=240, + Snd_Group_AdvStage_20_0=241, + Snd_Group_AdvStage_22_0=242, + Snd_Group_AdvStage_24_0=243, + Snd_Group_AdvStage_26_0=244, + Snd_Group_AdvStage_27_0=245, + Snd_Group_AdvStage_27_1=246, + Snd_Group_AdvStage_27_2=247, + Snd_Group_AdvStage_28_0=248, + Snd_Group_AdvStage_28_2=249, + Snd_Group_AdvStage_30_0=250, + Snd_Group_AdvStage_31_0=251, + Snd_Group_AdvStage_31_1=252, + Snd_Group_AdvStage_32_0=253, + Snd_Group_AdvStage_33_0=254, + Snd_Group_AdvStage_33_1=255, + Snd_Group_AdvStage_34_0=256, + Snd_Group_AdvStage_35_0=257, + Snd_Group_AdvStage_36_0=258, + Snd_Group_AdvStage_37_0=259, + Snd_Group_AdvStage_37_2=260, + Snd_Group_AdvStage_37_3=261, + Snd_Group_AdvStage_40_0=262, + Snd_Group_AdvStage_41_0=263, + Snd_Group_AdvStage_42_0_05=264, + Snd_Group_AdvStage_42_0_09=265, + Snd_Group_AdvStage_42_0_11=266, + Snd_Group_AdvStage_42_0_13=267, + Snd_Group_AdvStage_42_0_17=268, + Snd_Group_AdvStage_42_0_19=269, + Snd_Group_AdvStage_42_0_21=270, + Snd_Group_AdvStage_42_0_23=271, + Snd_Group_AdvStage_42_0_25=272, + Snd_Group_AdvStage_42_0_27=273, + Snd_Group_AdvStage_42_0_29=274, + Snd_Group_AdvStage_42_0_31=275, + Snd_Group_AdvStage_42_0_33=276, + Snd_Group_AdvStage_42_0_37=277, + Snd_Group_Enemy_Kuribo=278, + Snd_Group_Enemy_Patapata=279, + Snd_Group_Enemy_HammerBros=280, + Snd_Group_Enemy_Killer=281, + Snd_Group_Enemy_DekaKuribo=282, + Snd_Group_Enemy_GalFire=283, + Snd_Group_Enemy_Popperam=284, + Snd_Group_Enemy_Bitan=285, + Snd_Group_Enemy_Roada=286, + Snd_Group_Enemy_Bombhead=287, + Snd_Group_Enemy_Gyraan=288, + Snd_Group_Enemy_Bucyulus=289, + Snd_Group_Enemy_Tautau=290, + Snd_Group_Enemy_Flows=291, + Snd_Group_Enemy_Aroaros=292, + Snd_Group_Enemy_Botron=293, + Snd_Group_Enemy_Jyakeel=294, + Snd_Group_Enemy_Ghamgha=295, + Snd_Group_Enemy_Pacci=296, + Snd_Group_Enemy_Faulong=297, + Snd_Group_Enemy_Deathpod=298, + Snd_Group_Enemy_Spar=299, + Snd_Group_Enemy_Kokkon=300, + Snd_Group_Enemy_Jdus=301, + Snd_Group_Enemy_Mite=302, + Snd_Group_Enemy_Shelly=303, + Snd_Group_Enemy_Ngagog=304, + Snd_Group_Enemy_Cymal=305, + Snd_Group_Enemy_Teckin=306, + Snd_Group_Enemy_Cataguard=307, + Snd_Group_Enemy_SirAlamos=308, + Snd_Group_Enemy_Boobas=309, + Snd_Group_Enemy_Arman=310, + Snd_Group_Enemy_Prim=311, + Snd_Group_Enemy_Robo=312, + Snd_Group_Boss_BossPackun=313, + Snd_Group_Boss_Rayquaza=314, + Snd_Group_Boss_Porky=315, + Snd_Group_Boss_Galleom=316, + Snd_Group_Boss_Ridley=317, + Snd_Group_Boss_Duon=318, + Snd_Group_Boss_MetaRidley=319, + Snd_Group_Boss_Taboo=320, + Snd_Group_Boss_MasterHand=321, + Snd_Group_Boss_CrazyHand=322, + Snd_Group_Boss_FalconFlyer=323, + Snd_Group_Invalid=0xffffffff +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/snd/snd_init_thread.h b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_init_thread.h new file mode 100644 index 0000000000..9ec5128ab3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_init_thread.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class sndInitThread : public gfThread { + mutable OSMutex m_mutex; + bool m_initDone; + bool m_loadDone; +public: + void run(); + bool isFinishInitialize() const; + bool isFinishLoad() const; +}; +static_assert(sizeof(sndInitThread) == 0x360, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/snd/snd_system.h b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_system.h new file mode 100644 index 0000000000..116311c361 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/snd/snd_system.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class sndHeapSys +{ +public: + char _0[0x258]; + nw4r::snd::SoundHeap m_heapArr[0xC]; + char _468[0xC]; + nw4r::snd::SoundHeap* m_heapAddresses[0xC]; + u32 m_heapMaxSizeArr[0xC]; + u32 m_heapCurrSizeArr[0xC]; +}; +static_assert(sizeof(sndHeapSys) == 0x504, "Class is wrong size!"); + +class sndSystem { +public: + nw4r::snd::DvdSoundArchive m_dvdSoundArchive; + nw4r::snd::SoundArchivePlayer m_archivePlayer; + nw4r::snd::Sound3DManager m_3DManager; + nw4r::snd::Sound3DListener m_3DListener; + sndHeapSys* m_sndHeapSys; + char _2D4[0x8FC]; + + int loadSoundGroup(SndGroupID sndGroupId, int, bool isRequest); + bool isSoundGroupLoaded(SndGroupID sndGroupId); + void freeGroup(int heapLevel, int); + bool loadArchiveHeader(); + bool setupBuffers(); + void loadCommon(); + + s32 playSE(SndID sndID, int unk, int unk2, int unk3, int unk4); + void stopSE(s32 handleId, s32 p2); + void stopSE(s8 handleIndex, s32 p2); + void setBGMVol(bool setImmediately, float volume); + void setEffectVol(bool unused, bool setImmediately, float volume); + s32 prepareSE(SndID p1, s32 p2, s32 p3); + void setPan(s32 p1, float p2); + void startSE(s32 p1, s32 p2, s32 p3); + bool isPlay(s32 handleId); + bool isPlaySEID(SndID sndID); + bool playBGM(int bgmId, u32 fade, bool); + int getBGMId(); + void specialPause(); + void specialResume(); + + static SndID constructInterceptSndID(int wavID, SndID infoSndID) { // custom + return static_cast(0xF0000000 + ((wavID & 0xFFF) << 16) + infoSndID); + } +}; +static_assert(sizeof(sndSystem) == 0xbd0, "Class is wrong size!"); + +extern sndSystem* g_sndSystem; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_chr.h b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_chr.h new file mode 100644 index 0000000000..72c5ef0016 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_chr.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include + +class soAnimChr { + nw4r::g3d::AnmObjChrRes* m_anmChrRes; + float m_animFrame; + float m_startFrame; + float m_saveFrame; + float m_rate; + float m_frameAhead; + u8 m_loopFlag: 1; + u8 m_reverseFlag: 1; + + void reinit(bool destroy); +public: + soAnimChr(); + ~soAnimChr(); + void reset(); + void relinquishAnimObj(); + void updateFrame(float p1); + void setFrame(float p1); + bool isEnd() const; + bool isLooped() const; + void setAnimObj(float p1, float p2, nw4r::g3d::AnmObjChrRes *p3, u8 p4, u8 p5); + void destroyAnimObj(); + void disableNode(u32 id); + float getEndFrame(nw4r::g3d::AnmObjChrRes* p1) const; + void rewind(); + void turnBack(); +}; +static_assert(sizeof(soAnimChr) == 0x1C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd.h b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd.h new file mode 100644 index 0000000000..b528c8b474 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd.h @@ -0,0 +1,63 @@ +#pragma once + +#include +#include + +class soAnimCmdArgument; +class soAnimCmd; + +// Variable Data Type +#define ANIM_CMD_INT 0 +#define ANIM_CMD_FLOAT 1 +#define ANIM_CMD_BOOL 2 + +// Variable Memory Type +#define ANIM_CMD_VAR_TYPE_IC 0 +#define ANIM_CMD_VAR_TYPE_LA 1 +#define ANIM_CMD_VAR_TYPE_RA 2 + +enum soAnimCmdArgumentType { + AnimCmd_Arg_Type_Int = 0, + AnimCmd_Arg_Type_Scalar = 1, + AnimCmd_Arg_Type_Ptr = 2, + AnimCmd_Arg_Type_Bool = 3, + AnimCmd_Arg_Type_File = 4, + AnimCmd_Arg_Type_Variable = 5, + AnimCmd_Arg_Type_Requirement = 6 +}; + +class soAnimCmdArgument { +public: + soAnimCmdArgumentType m_varType; + u32 m_rawValue; +}; +static_assert(sizeof(soAnimCmdArgument) == 0x8, "Class is the wrong size!"); + +class soAnimCmd { +public: + char m_module; + char m_code; + char m_argCount; + char m_option; + soAnimCmdArgument *m_args; // ptr to array +}; +static_assert(sizeof(soAnimCmd) == 0x8, "Class is the wrong size!"); + +struct soAnimCmdAddressPack { + u32 unk0; + u32 unk4; + u32 unk8; + + soAnimCmdAddressPack& operator=(const soAnimCmdAddressPack& orig) { + if (this != &orig) { + u32 addr3 = orig.unk8; + u32 addr2 = orig.unk4; + u32 addr1 = orig.unk0; + unk0 = addr1; + unk4 = addr2; + unk8 = addr3; + } + return *this; + } +}; +static_assert(sizeof(soAnimCmdAddressPack) == 0xc, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_arg_list.h b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_arg_list.h new file mode 100644 index 0000000000..543b331cda --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_arg_list.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +struct soModuleAccesser; +struct soAnimCmdArgList { + soArrayContractibleTable m_argList; + // Is not populated by default, must be supplied before using functions for getting arguments. + soModuleAccesser* m_moduleAccesser; + // Is 0 by default. Is set to 1 if a getter function call fails, but is *not* set to 0 if it succeeds, so must be reset between calls. + u8 m_errorOnValueFetch; + // Doesn't appear to be used deliberately, though is sometimes zeroed by functions which zero m_errorOnValueFetch by stw'ing to it. + u8 _unk15[0x3]; + + soAnimCmdArgList(soModuleAccesser* moduleAccesserIn, const soArrayContractibleTable& argListIn) + : m_argList(argListIn), m_moduleAccesser(moduleAccesserIn) { } + + ~soAnimCmdArgList() { } + + // Returns the variable ID of the specified argument. If the specified argument isn't a variable, m_errorOnValueFetch is set to 1! + u32 getValueIndex(u32 index); + // Returns the integer value of the specified argument. If the specified argument isn't a variable or Value/Integer typed, m_errorOnValueFetch is set to 1! + int getInt(u32 index); + // Returns the float value of the specified argument. If the specified argument isn't a variable or Scalar/Float typed, m_errorOnValueFetch is set to 1! + double getFloat(u32 index); + // Returns the boolean value of the specified argument. If the specified argument isn't Boolean typed, m_errorOnValueFetch is set to 1! + bool getBool(u32 index); +}; +static_assert(sizeof(soAnimCmdArgList) == 0x18, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_event_presenter.h new file mode 100644 index 0000000000..32708a737d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_event_presenter.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soAnimCmdEventObserver : public soEventObserver { +public: + soAnimCmdEventObserver(short unitID) : soEventObserver(unitID) {}; + soAnimCmdEventObserver(); + + virtual void addObserver(short param1, s8 param2); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, s32 unk3); +}; +static_assert(sizeof(soAnimCmdEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_module_impl.h new file mode 100644 index 0000000000..431a634194 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/anim/so_anim_cmd_module_impl.h @@ -0,0 +1,169 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +/* + * This class is weird, it has a bunch of data before the event presenter vtable and info, + * but the inheritance info doesn't show any other info. I can't get the layout right while + * inheriting the presenter, so I commented it and added a spacer. + * + * There is an "acCmdInterpreter" class in the code that seems to do a lot + * of the same things as this class, but it doesn't seem to be the missing + * inherited object, as it is about 0x10 bigger than this class. It is perhaps + * the case that the acCmdInterpreter inherits this, but that class doesn't + * seem to have provided inheritance info. + * + * I'm leaving it like this for now, since it is still somewhat useful/usable. + */ +class soAnimCmdInterpreter /*: soEventPresenter */ { +public: + char _inheritance_data[8]; // 0x0; not sure what this is. + float m_frameSpeed; // 0x8 + soAnimCmd* m_currentCmd; // 0xC + soAnimCmd* m_startCmd; // 0x10 + char _unk0x14[8]; // 0x14 + soAnimCmd* m_lastWaitCmd; // 0x18 + char _unk0x1C[4]; // 0x1C, event presenter vtable and fields are in here. + float m_logicalFrame; // 0x20 +}; +static_assert(sizeof(soAnimCmdInterpreter) == 0x28, "Class is the wrong size!"); + +// The unit of soAnimCmdAddressPackArraySeparate: a triple of acAnimCmdConv*s +struct soAnimCmdAddressPackConv { + const acAnimCmdConv* addr1; + const acAnimCmdConv* addr2; + const acAnimCmdConv* addr3; +}; + +// This class zips together three fixed-size arrays of acAnimCmdConv pointers, +// presenting the resulting aggregate as a fixed-size array of +// soAnimCmdAddressPackConv. +// The constituent arrays do not need to be identical in size; nullptrs are +// filled in to pad out any shorter arrays. +class soAnimCmdAddressPackArraySeparate : public soArrayFixed { + soAnimCmdAddressPackConv m_pack; + soArrayFixed* m_addrArr1; + soArrayFixed* m_addrArr2; + soArrayFixed* m_addrArr3; +public: + soAnimCmdAddressPackConv atSub(s32 index) const { + if (index < 0) { + soAnimCmdAddressPackConv pack = { nullptr, nullptr, nullptr }; + return pack; + } + + const acAnimCmdConv* addr1 = nullptr; + if (index < m_addrArr3->size()) + addr1 = m_addrArr3->at(index); + + const acAnimCmdConv* addr2 = nullptr; + if (index < m_addrArr1->size()) + addr2 = m_addrArr1->at(index); + + const acAnimCmdConv* addr3 = nullptr; + if (index < m_addrArr2->size()) + addr3 = m_addrArr2->at(index); + + soAnimCmdAddressPackConv pack = { addr1, addr2, addr3 }; + return pack; + } + + virtual soAnimCmdAddressPackConv& at(s32 index) { + m_pack = atSub(index); + return m_pack; + } + + // UBFIX this function has a bug; don't use the reference it + // returns! TODO flag callers of this function, if any + virtual const soAnimCmdAddressPackConv& at(s32 index) const { + return atSub(index); + } + + virtual s32 size() const { + s32 max = m_addrArr3->size(); + if (max < m_addrArr1->size()) + max = m_addrArr1->size(); + if (max < m_addrArr2->size()) + max = m_addrArr2->size(); + return max; + } + + virtual bool isNull() const { return false; } + + soAnimCmdAddressPackArraySeparate(soArrayFixed* addrs1, + soArrayFixed* addrs2, + soArrayFixed* addrs3) : + m_addrArr1(addrs1), m_addrArr2(addrs2), m_addrArr3(addrs3) { } + + virtual ~soAnimCmdAddressPackArraySeparate() { } +}; +static_assert(sizeof(soAnimCmdAddressPackArraySeparate) == 0x1C, "Class is the wrong size!"); + +class soAnimCmdControlUnit { +public: + soAnimCmdInterpreter* m_animCmdInterpreter; // 0x0 + soAnimCmdAddressPackArraySeparate* m_animCmdAddressPackArraySeparate; // 0x4 + int m_id; // 0x8 + short m_type; // 0xC + short m_unk; // 0xE +}; +static_assert(sizeof(soAnimCmdControlUnit) == 0x10, "Class is the wrong size!"); + +class soAnimCmdModule: public soNullable { +public: + virtual void registInterpreter(); + virtual void interpretCmd(); + virtual void interpretCmdAdjust(); + virtual void interpretCmd1(); + virtual void resetInterpreter1(); + virtual void resetInterpreter2(); + virtual void resetInterpreter3(); + virtual void resetInterpreter4(); + virtual void isInterpreterAnimCmd(); + virtual void skipNextMotionGroup(); + virtual bool isAnimCmdEnd(); + virtual int getAnimCmdFrame(); + virtual void getCmdAddressPack(); + virtual void setAddressPackList(); + virtual void getInterpreterNum(); + virtual ~soAnimCmdModule(); + virtual void activate(soModuleAccesser*); + virtual void deactivate(soModuleAccesser*); +}; + +namespace soAnimCmdControlUnitKind { + enum Kind { + ActionMain, + SubactionMain, + SubactionGfx, + SubactionSfx, + SubactionOther, + AltSubactionMain, + AltSubactionGfx, + AltSubactionSfx, + AltSubactionOther, + InfiniteLoop, + ActionHidden, + Count, + }; +} + +class soAnimCmdModuleImpl: + public soAnimCmdModule, + public soStatusEventObserver, + public soAnimCmdEventObserver +{ +public: + soInstanceManagerFullPropertyVector* m_animCmdThreads; // 0x20 +}; +static_assert(sizeof(soAnimCmdModuleImpl) == 0x24, "Class is the wrong size!"); + +/* TODO: soAnimCmdModuleNull */ diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_enviroment_element_checker_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_enviroment_element_checker_impl.h new file mode 100644 index 0000000000..5bfb814537 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_enviroment_element_checker_impl.h @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soAreaEnviromentElementChecker : public soNull, public soNullable { +public: + virtual ~soAreaEnviromentElementChecker(); + virtual void check(soModuleAccesser*); + virtual void clearWaterInfo(); + virtual void clear(); + virtual void enable(); + virtual void unable(); + virtual bool isEnable(); + virtual bool isWater(); + virtual bool isWaterAreaIndex(int); + virtual int getWaterAreaId(); + virtual float getWaterSurfaceY(); + virtual u32 getOnMovementGroundArea(); + virtual bool testWater(Vec2f*, int*); +}; +static_assert(sizeof(soAreaEnviromentElementChecker) == 0xC, "Class is wrong size!"); + +class soAreaEnviromentElementCheckerImpl : public soAreaEnviromentElementChecker, public soEnable { + char _0xd[15]; +public: + virtual ~soAreaEnviromentElementCheckerImpl(); + virtual void check(soModuleAccesser*); + virtual void clearWaterInfo(); + virtual void clear(); + virtual void enable(); + virtual void unable(); + virtual bool isEnable(); + virtual bool isWater(); + virtual bool isWaterAreaIndex(int); + virtual int getWaterAreaId(); + virtual float getWaterSurfaceY(); + virtual u32 getOnMovementGroundArea(); + virtual bool testWater(Vec2f*, int*); +}; +static_assert(sizeof(soAreaEnviromentElementCheckerImpl) == 0x1C, "Class is wrong size!"); + +typedef soAreaEnviromentElementChecker soAreaEnvironmentElementChecker; +typedef soAreaEnviromentElementCheckerImpl soAreaEnvironmentElementCheckerImpl; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_instance.h b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_instance.h new file mode 100644 index 0000000000..d671680be7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_instance.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +class soAreaInstance { +public: + enum ShapeType { + Shape_Rectangle = 0x0, + Shape_Circle = 0x1, + Shape_Rectangle_Ref_Ground_Rhombus = 0x2, + Shape_Rectangle_Ref_Ground_Rhombus_Upper = 0x3, + Shape_Rectangle_Ref_Ground_Rhombus_Lower = 0x4, + }; + +private: + char _0[32]; +public: + + virtual ~soAreaInstance(); +}; +static_assert(sizeof(soAreaInstance) == 36, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_module_impl.h new file mode 100644 index 0000000000..425709737f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/area/so_area_module_impl.h @@ -0,0 +1,190 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +struct soAreaData { + typedef u16 ShapeMask; + static const ShapeMask SHAPE_MASK_FOLLOW_NODE = 1 << 0; + static const ShapeMask SHAPE_MASK_FIXED = 1 << 1; + static const ShapeMask SHAPE_MASK_LR = 1 << 2; + static const ShapeMask SHAPE_MASK_RESET_DISABLE = 1 << 3; + static const ShapeMask SHAPE_MASK_STATUS_DISABLE = 1 << 4; + static const ShapeMask SHAPE_MASK_STATUS_ENABLE = 1 << 5; + static const ShapeMask SHAPE_MASK_IGNORE_SCALE = 1 << 6; + static const ShapeMask SHAPE_MASK_ENABLE_SITUATION_GROUND= 1 << 7; + static const ShapeMask SHAPE_MASK_ENABLE_SITUATION_AIR = 1 << 8; + static const ShapeMask SHAPE_MASK_APPLY_OFFSET_ROT = 1 << 9; + static const ShapeMask SHAPE_MASK_CHILD = 1 << 10; + + enum Category { + Category_Fighter = 0x0, + Category_Enemy = 0x1, + Category_Yakumono = 0x2, + Category_Item = 0x3, + Category_Weapon = 0x4, + }; + + soAreaInstance::ShapeType m_shapeType : 8; + gfArea::Group m_group : 8; + + union ShapeFlag { + ShapeMask m_mask; + struct { + bool m_flag15 : 1; // 0x8000 + bool m_flag14 : 1; // 0x4000 + bool m_flag13 : 1; // 0x2000 + bool m_flag12 : 1; // 0x1000 + bool m_flag11 : 1; // 0x800 + bool m_child : 1; // 0x400 + bool m_applyOffsetRot : 1; // 0x200 + bool m_enableSituationAir : 1; // 0x100 + bool m_enableSituationGround : 1; // 0x80 + bool m_ignoreScale : 1; // 0x40 + bool m_statusEnable : 1; // 0x20 + bool m_statusDisable : 1; // 0x10 + bool m_resetDisable : 1; // 0x8 + bool m_lr : 1; // 0x4 + bool m_fixed : 1; // 0x2 + bool m_followNode : 1; // 0x1 + }; + inline ShapeFlag() {} + inline ShapeFlag(ShapeMask mask) : m_mask(mask) {} + } m_shapeFlag; + + int m_0x4; + int m_0x8; + int m_nodeIndex; + Vec2f m_offsetPos; + Vec2f m_range; + + inline soAreaData() {} + inline soAreaData(soAreaInstance::ShapeType shapeType, gfArea::Group group, ShapeMask mask, int unk1, int unk2, int nodeIndex, Vec2f offsetPos, Vec2f range) : m_shapeType(shapeType), m_group(group), m_shapeFlag(mask), m_0x4(unk1), m_0x8(unk2), m_nodeIndex(nodeIndex), m_offsetPos(offsetPos), m_range(range) {} + + void set(soAreaInstance::ShapeType shapeType, gfArea::Group group, ShapeMask mask, int unk1, int unk2, int nodeIndex, Vec2f offsetPos, Vec2f range) { + m_shapeType = shapeType; + m_group = group; + m_shapeFlag.m_mask = mask; + m_0x4 = unk1; + m_0x8 = unk2; + m_nodeIndex = nodeIndex; + m_offsetPos = offsetPos; + m_range = range; + } +}; +static_assert(sizeof(soAreaData) == 0x20, "Class is wrong size!"); + +struct soAreaContactLog { + char _0x0[0x18]; +}; +static_assert(sizeof(soAreaContactLog) == 0x18, "Class is wrong size!"); + +struct soAreaWind { + char _0x0[4]; +}; +static_assert(sizeof(soAreaWind) == 0x4, "Class is wrong size!"); + +class soAreaModule : public soNullable { +public: + virtual ~soAreaModule(); + virtual void activate(int ownerId); + virtual void deactivate(); + virtual void update(); + virtual void clearLog(); + virtual void check(); + virtual void clean(); + virtual void setup(soSet*); + virtual void addArea(soSet*); + virtual void setWhole(u8); + virtual gfArea::Group getGroup(u32 index); + virtual void enableArea(int, bool, int); + virtual bool isEnableArea(int); + virtual void resetArea(int); + virtual void setAreaTargetGroupMask(u32 index, u32 mask); + virtual void setAreaTargetLocalGroupMask(u32 index, u32 mask); + virtual void setAreaShape(u32 index, Vec2f*, Vec2f*); + virtual void setAreaShape(u32 index, Vec2f*, float); + virtual void setAreaShapeType(u32 index, soAreaInstance::ShapeType); + virtual void setCenterX0(u32 index, bool); + virtual void setAreaDbgColor(u32 index, GXColor); + virtual int getAreaId(u32 index); + virtual bool isExistAreaInstance(int); + virtual gfArea* getAreaInstance(u32 index); + virtual int getAreaIndexFromId(int); + virtual u32 getAreaContactCount(int); + virtual soAreaContactLog* getAreaContactLog(int, u32); + virtual soAreaEnviromentElementChecker* getEnviromentElementChecker(); + virtual void setLogOverThrough(bool); + virtual void eraseWind(int); + virtual void createWind(u32, u32, stMovementData*); +}; + +class soAreaModuleImpl : public soAreaModule, public gfAreaEventReciver, public soAnimCmdEventObserver, public soStatusEventObserver, public soSituationEventObserver { + soArray* m_areaInstanceArray; + soArray* m_areaContactLogArray; + union { + soAreaEnviromentElementChecker* m_enviromentElementChecker; + soAreaEnvironmentElementChecker* m_environmentElementChecker; + }; + soArray* m_areaWindArray; + int m_0x40; + soAreaData::Category m_category : 8; + char _0x45[3]; + soModuleAccesser* m_moduleAccesser; + +public: + virtual ~soAreaModuleImpl(); + virtual void activate(int ownerId); + virtual void deactivate(); + virtual void update(); + virtual void clearLog(); + virtual void check(); + virtual void clean(); + virtual void setup(soSet*); + virtual void addArea(soSet*); + virtual void setWhole(u8); + virtual gfArea::Group getGroup(u32 index); + virtual void enableArea(int, bool, int); + virtual bool isEnableArea(int); + virtual void resetArea(int); + virtual void setAreaTargetGroupMask(u32 index, u32 mask); + virtual void setAreaTargetLocalGroupMask(u32 index, u32 mask); + virtual void setAreaShape(u32 index, Vec2f*, Vec2f*); + virtual void setAreaShape(u32 index, Vec2f*, float); + virtual void setAreaShapeType(u32 index, soAreaInstance::ShapeType); + virtual void setCenterX0(u32 index, bool); + virtual void setAreaDbgColor(u32 index, GXColor); + virtual int getAreaId(u32 index); + virtual bool isExistAreaInstance(int); + virtual gfArea* getAreaInstance(u32 index); + virtual int getAreaIndexFromId(int); + virtual u32 getAreaContactCount(int); + virtual soAreaContactLog* getAreaContactLog(int, u32); + virtual soAreaEnviromentElementChecker* getEnviromentElementChecker(); + virtual void setLogOverThrough(bool); + virtual void eraseWind(int); + virtual void createWind(u32, u32, stMovementData*); + + virtual void reciveEvent(gfArea*, gfArea*); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, s32 unk3); + virtual bool isObserv(char unk1); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); + + +}; +static_assert(sizeof(soAreaModuleImpl) == 0x4c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/article/so_article.h b/include/lib/BrawlHeaders/Brawl/Include/so/article/so_article.h new file mode 100644 index 0000000000..6a513d03e2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/article/so_article.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soArticleEventObserver : public soEventObserver { +public: + virtual void addObserver(short param1, s8 param2); + char _spacer1[2]; +}; +static_assert(sizeof(soArticleEventObserver) == 12, "Class is wrong size!"); + +struct soLogAttackInfo { + int _0; + int _4; + int _8; +}; + +class soArticle : public soNullable, public soEventPresenter { + // TODO + virtual ~soArticle(); + virtual void remove() = 0; + virtual int getArticleId() = 0; + virtual int getArticleEventManageId() = 0; + virtual int getTaskId() = 0; + virtual void changeMotion(int motionKind, bool); + virtual void setFrame(float frame); + virtual void setRate(float rate); + virtual void changeStatus(int statusKind); + virtual void setVisibilityWhole(u8); + virtual void setVisibility(int, u8); + virtual void set2nd(u8); + virtual void action(int); + virtual void setSituationKind(SituationKind); + virtual bool isConstraint(); + virtual void deactivateDescendantForce(); + virtual bool isActiveArticle() = 0; + virtual void deactivateArticle() = 0; + virtual int getOwnerDeactiveTreatType(); + virtual int getFounderTaskId(); + virtual void have(int, int, int) = 0; + virtual void linkOwner(int, int) = 0; + virtual void unlinkOwner(int) = 0; + virtual bool isSyncOwnerStatus() = 0; + virtual void setSyncOwnerStatus(bool) = 0; + virtual void setLogAttackInfo(soLogAttackInfo* logAttackInfo); + virtual soLogAttackInfo getLogAttackInfo(); + virtual void updateLogAttackInfo(); + virtual void intrudeLogAttackInfo(); + virtual float getActiveGlobalFrame(); + virtual void setAttackPowerMulPattern(float); +}; +static_assert(sizeof(soArticle) == 20, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_impl.h new file mode 100644 index 0000000000..5a1b38c308 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_impl.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include + +class soCameraModuleImpl : public soCameraModuleSimple { + soArray* m_cameraSubjectArray; + soSet* m_cameraRangeSet; + soSet* m_cameraClipSphereSet; + +public: + virtual ~soCameraModuleImpl(); + virtual u32 getSubjectsSize(); + virtual void setup(); + virtual void setup(soSet* cameraRangeSet); + virtual void setTrainingRangeData(soCameraRange*, u32 index); + virtual void setZoomParam(soCameraZoom*, u32 index); + virtual void activate(); + virtual void deactivate(); + virtual void resetAll(); + virtual void update(); + virtual void updateForce(u32 index, Vec3f*, Vec3f*); + virtual void setEnableCamera(bool, int index); + virtual void setEnableUpdatePos(bool, int index); + virtual void setEnableInterpolatePos(bool, int index); + virtual soCameraRange* getCameraRangeData(u32 index); + virtual void resetCameraRange(u32 index); + virtual void addCameraRangeOffset(Vec3f* offset, u32 index); + virtual void addCameraRangeRect(Rect2D* rect, u32 index); + virtual void addCameraZoom(float zoom, u32 index); + virtual void unRegistCamera(u32 index); + virtual void zoomIn(short, u32 index, Vec2f*, float); + virtual void zoomOut(); + virtual void renderDebug(); + virtual void setPri(u8 pri, int index); + virtual u8 getPri(u32 index); + virtual void setAdvPri(u8 pri, int index); + virtual u8 getAdvPri(u32 index); + virtual void setPlayerNo(u8 playerNo, int index); + virtual u8 getPlayerNo(u32 index); + virtual void setDemoDistScaleMul(float, u32 index); + virtual void setDamage(short damage, u32 index); + virtual void setDamageFly(u32 index); + virtual void exitDamageFly(u32 index); + virtual void setRun(u32 index); + virtual void exitRun(u32 index); + virtual bool isLocked(); + virtual bool isClipIn(bool); + virtual bool isClipInAll(bool); + virtual s8 getClipOutStatus(bool); + virtual soCameraClipSphere* getClipSphere(u32 index); + virtual void getSubjectRange(Rect2D* outRange, u32 index); + virtual Vec3f getSubjectPos(u32 index); + virtual float getSubjectOffsetY(u32 index); + virtual soCameraSubject* getSubject(u32 index); + virtual void getCameraRangeGlobalRect(Rect2D* outRange, u32 index); + virtual void setCameraRangeGlobalRect(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); + virtual void setOffsetGlobalRectCenter(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soCameraModuleImpl) == 0x24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_simple.h new file mode 100644 index 0000000000..a814b6316b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_module_simple.h @@ -0,0 +1,146 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soCameraModule { +public: + enum QuakeKind { + Quake_None = -1, + Quake_S = 0, + Quake_Small = 0, + Quake_L = 1, + Quake_Large = 1, + Quake_XL = 2, + Quake_More_Large = 2, + Quake_M = 3, + Quake_Middle = 3, + Quake_S_Half = 4, + Quake_Small_Hf = 4, + }; + + virtual ~soCameraModule(); + virtual u32 getSubjectsSize(); + virtual void setup(); + virtual void setup(soSet* cameraRangeSet); + virtual void setTrainingRangeData(soCameraRange*, u32 index); + virtual void setZoomParam(soCameraZoom*, u32 index); + virtual void activate(); + virtual void deactivate(); + virtual void resetAll(); + virtual void update(); + virtual void updateForce(u32 index, Vec3f*, Vec3f*); + virtual void setWhole(bool); + virtual void setEnableCamera(bool, int index); + virtual void setEnableUpdatePos(bool, int index); + virtual void setEnableInterpolatePos(bool, int index); + virtual soCameraRange* getCameraRangeData(u32 index); + virtual void resetCameraRange(u32 index); + virtual void addCameraRangeOffset(Vec3f* offset, u32 index); + virtual void addCameraRangeRect(Rect2D* rect, u32 index); + virtual void addCameraZoom(float zoom, u32 index); + virtual void unRegistCamera(u32 index); + virtual void zoomIn(short, u32 index, Vec2f*, float); + virtual void zoomOut(); + virtual void renderDebug(); + virtual void setQuake(bool); + virtual void reqQuake(QuakeKind, soModuleAccesser*); + virtual void reqQuake(QuakeKind, Vec3f* pos); + virtual void stopQuake(QuakeKind); + virtual QuakeKind getQuakeKind(); + virtual Vec3f getMainCameraTargetPos(); + virtual void setPri(u8 pri, int index); + virtual u8 getPri(u32 index); + virtual void setAdvPri(u8 pri, int index); + virtual u8 getAdvPri(u32 index); + virtual void setPlayerNo(u8 playerNo, int index); + virtual u8 getPlayerNo(u32 index); + virtual void setDemoDistScaleMul(float, u32 index); + virtual void setDamage(short damage, u32 index); + virtual void setDamageFly(u32 index); + virtual void exitDamageFly(u32 index); + virtual void setRun(u32 index); + virtual void exitRun(u32 index); + virtual bool isLocked(); + virtual bool isClipIn(bool); + virtual bool isClipInAll(bool); + virtual s8 getClipOutStatus(bool); + virtual soCameraClipSphere* getClipSphere(u32 index); + virtual void getSubjectRange(Rect2D* outRange, u32 index); + virtual Vec3f getSubjectPos(u32 index); + virtual float getSubjectOffsetY(u32 index); + virtual soCameraSubject* getSubject(u32 index); + virtual void getCameraRangeGlobalRect(Rect2D* outRange, u32 index); + virtual void setCameraRangeGlobalRect(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); + virtual void setOffsetGlobalRectCenter(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); +}; + + +class soCameraModuleSimple : public soCameraModule, public soAnimCmdEventObserver { + soModuleAccesser* m_moduleAccesser; + u8 _0x14; + char _0x15[3]; +public: + virtual ~soCameraModuleSimple(); + virtual u32 getSubjectsSize(); + virtual void setup(); + virtual void setup(soSet* cameraRangeSet); + virtual void setTrainingRangeData(soCameraRange*, u32 index); + virtual void setZoomParam(soCameraZoom*, u32 index); + virtual void activate(); + virtual void deactivate(); + virtual void resetAll(); + virtual void update(); + virtual void updateForce(u32 index, Vec3f*, Vec3f*); + virtual void setWhole(bool); + virtual void setEnableCamera(bool, int index); + virtual void setEnableUpdatePos(bool, int index); + virtual void setEnableInterpolatePos(bool, int index); + virtual soCameraRange* getCameraRangeData(u32 index); + virtual void resetCameraRange(u32 index); + virtual void addCameraRangeOffset(Vec3f* offset, u32 index); + virtual void addCameraRangeRect(Rect2D* rect, u32 index); + virtual void addCameraZoom(float zoom, u32 index); + virtual void unRegistCamera(u32 index); + virtual void zoomIn(short, u32 index, Vec2f*, float); + virtual void zoomOut(); + virtual void renderDebug(); + virtual void setQuake(bool); + virtual void reqQuake(QuakeKind, soModuleAccesser*); + virtual void reqQuake(QuakeKind, Vec3f* pos); + virtual void stopQuake(QuakeKind); + virtual QuakeKind getQuakeKind(); + virtual Vec3f getMainCameraTargetPos(); + virtual void setPri(u8 pri, int index); + virtual u8 getPri(u32 index); + virtual void setAdvPri(u8 pri, int index); + virtual u8 getAdvPri(u32 index); + virtual void setPlayerNo(u8 playerNo, int index); + virtual u8 getPlayerNo(u32 index); + virtual void setDemoDistScaleMul(float, u32 index); + virtual void setDamage(short damage, u32 index); + virtual void setDamageFly(u32 index); + virtual void exitDamageFly(u32 index); + virtual void setRun(u32 index); + virtual void exitRun(u32 index); + virtual bool isLocked(); + virtual bool isClipIn(bool); + virtual bool isClipInAll(bool); + virtual s8 getClipOutStatus(bool); + virtual soCameraClipSphere* getClipSphere(u32 index); + virtual void getSubjectRange(Rect2D* outRange, u32 index); + virtual Vec3f getSubjectPos(u32 index); + virtual float getSubjectOffsetY(u32 index); + virtual soCameraSubject* getSubject(u32 index); + virtual void getCameraRangeGlobalRect(Rect2D* outRange, u32 index); + virtual void setCameraRangeGlobalRect(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); + virtual void setOffsetGlobalRectCenter(Rect2D* range, soModuleAccesser* moduleAccesser, u32 index); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soCameraModuleSimple) == 0x18, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_subject.h b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_subject.h new file mode 100644 index 0000000000..15ffe24ba1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/camera/so_camera_subject.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct soCameraRange { + char _[0x4]; + Rect2D m_range; +}; +static_assert(sizeof(soCameraRange) == 0x14, "Class is wrong size!"); + +struct soCameraClipSphere { + char _[0x14]; +}; +static_assert(sizeof(soCameraClipSphere) == 0x14, "Class is wrong size!"); + +struct soCameraZoom { + u32 m_nodeIndex; + char _[0x10]; +}; +static_assert(sizeof(soCameraZoom) == 0x14, "Class is wrong size!"); + +class soCameraSubject : public soEnable { + char _4[0x3C]; + + virtual ~soCameraSubject(); +}; +static_assert(sizeof(soCameraSubject) == 0x44, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_event_presenter.h new file mode 100644 index 0000000000..c2074bfaf6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_event_presenter.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soCaptureEventObserver : public soEventObserver { +public: + soCaptureEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual bool notifyEventCaptureStatus(soModuleAccesser* moduleAccesser, int taskId, int, int); +}; +static_assert(sizeof(soCaptureEventObserver) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_module_impl.h new file mode 100644 index 0000000000..d1a8ff27ea --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/capture/so_capture_module_impl.h @@ -0,0 +1,4 @@ +#pragma once + +#include +#include diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision.h new file mode 100644 index 0000000000..952eba8ca0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision.h @@ -0,0 +1,91 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct clTarget { + int m_0; + int m_4; + + clTarget(); + ~clTarget(); +}; +static_assert(sizeof(clTarget) == 0x8, "Class is wrong size!"); + +class soCollision { +public: + enum Category { + Category_Fighter = 0x0, + Category_Enemy = 0x1, + Category_Unk1 = 0x2, + Category_Item = 0x3, + Category_Unk2 = 0x4, + Category_Unk3 = 0x5, + Category_Gimmick = 0x6, + Category_Wall = 0x7, + Category_ItemE = 0x8, + Category_Floor = 0x9, + }; + typedef u32 CategoryMask; + static const CategoryMask CATEGORY_MASK_FIGHTER = 1 << Category_Fighter; + static const CategoryMask CATEGORY_MASK_ENEMY = 1 << Category_Enemy; + static const CategoryMask CATEGORY_MASK_ITEM = 1 << Category_Item; + static const CategoryMask CATEGORY_MASK_GIMMICK = 1 << Category_Gimmick; + static const CategoryMask CATEGORY_MASK_WALL = 1 << Category_Wall; + static const CategoryMask CATEGORY_MASK_ITEM_E = 1 << Category_ItemE; + static const CategoryMask CATEGORY_MASK_FLOOR = 1 << Category_Floor; + static const CategoryMask CATEGORY_MASK_UNK1 = 1 << Category_Unk1; + static const CategoryMask CATEGORY_MASK_UNK2 = 1 << Category_Unk2; + static const CategoryMask CATEGORY_MASK_UNK3 = 1 << Category_Unk3; + static const CategoryMask CATEGORY_MASK_ALL = CATEGORY_MASK_FIGHTER | CATEGORY_MASK_ENEMY | CATEGORY_MASK_ITEM | CATEGORY_MASK_GIMMICK | CATEGORY_MASK_WALL | CATEGORY_MASK_ITEM_E | CATEGORY_MASK_FLOOR | CATEGORY_MASK_UNK1 | CATEGORY_MASK_UNK2 | CATEGORY_MASK_UNK3;; + static const CategoryMask CATEGORY_MASK_NO_GIMMICK = CATEGORY_MASK_ALL & ~CATEGORY_MASK_GIMMICK; + static const CategoryMask CATEGORY_MASK_NO_ITEM = CATEGORY_MASK_ALL & ~CATEGORY_MASK_ITEM & ~CATEGORY_MASK_ITEM_E; + + enum Situation { + Situation_Ground = 0x0, + Situation_Air = 0x1, + Situation_ODD = 0x2, + }; + typedef u32 SituationMask; + static const SituationMask SITUATION_MASK_GROUND = 1 << Situation_Ground; + static const SituationMask SITUATION_MASK_G = SITUATION_MASK_GROUND; + static const SituationMask SITUATION_MASK_AIR = 1 << Situation_Air; + static const SituationMask SITUATION_MASK_A = SITUATION_MASK_AIR; + static const SituationMask SITUATION_MASK_GA = SITUATION_MASK_G | SITUATION_MASK_AIR; + static const SituationMask SITUATION_MASK_ODD = 1 << Situation_ODD; + static const SituationMask SITUATION_MASK_ALL = SITUATION_MASK_GROUND | SITUATION_MASK_AIR | SITUATION_MASK_ODD; + + enum Part { + Part_Body = 0x0, + Part_Arm = 0x1, + Part_Knee = 0x2, + Part_Leg = 0x3 + }; + typedef u32 PartMask; + static const PartMask PART_MASK_BODY = 1 << Part_Body; + static const PartMask PART_MASK_ARM = 1 << Part_Arm; + static const PartMask PART_MASK_KNEE = 1 << Part_Knee; + static const PartMask PART_MASK_LEG = 1 << Part_Leg; + static const PartMask PART_MASK_ALL = PART_MASK_BODY | PART_MASK_ARM | PART_MASK_KNEE | PART_MASK_LEG; + static const PartMask PART_MASK_ETC = PART_MASK_ARM; + static const PartMask PARK_MASK_LEGS = PART_MASK_LEG | PART_MASK_KNEE; + static const PartMask PARK_MASK_BODY_LEGS = PART_MASK_BODY | PARK_MASK_LEGS | PART_MASK_KNEE; + + enum ShapeType { + Shape_Sphere = 0x0, + Shape_Capsule = 0x1, + }; + + int m_kind; + int m_indirectTeam; + soArray* m_collisionGroupArray; + int m_taskId; + gfTask::Category m_taskCategory : 8; + char _17[2]; + bool m_isNoTeam; + char _20[4]; +}; +static_assert(sizeof(soCollision) == 24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_event_presenter.h new file mode 100644 index 0000000000..c232cb452a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_event_presenter.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionAttackEventObserver : public soEventObserver { +public: + typedef u16 AttributeMask; + static const AttributeMask ATTRIBUTE_MASK_NONE = 0; + struct AttributeFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + }; + AttributeMask m_mask; + }; + inline AttributeFlag() : m_mask(ATTRIBUTE_MASK_NONE) {} + inline AttributeFlag(AttributeMask bits) : m_mask(bits) {} + inline ~AttributeFlag() {} + + AttributeFlag(soAttributeFlag f) : m_mask(f.m_mask) { } + operator soAttributeFlag() { return soAttributeFlag(m_mask); } + }; + + soCollisionAttackEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser);; + virtual bool notifyEventCollisionAttackCheck(u32 flags); +}; +static_assert(sizeof(soCollisionAttackEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_module_impl.h new file mode 100644 index 0000000000..6a9ec97f28 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_module_impl.h @@ -0,0 +1,236 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; +class StageObject; + +class soCollisionAttackModule { +public: + // TODO: Verify parameters + virtual ~soCollisionAttackModule(); + virtual void activate(float, float lr, int taskId, Vec2f* pos, u32 index, bool); + virtual void deactivate(); + virtual void begin(); + virtual void clearAll(); + virtual void clear(u32 index); + virtual void sleep(bool); + virtual void set(u32 index, u32 groupIndex, soCollisionAttackData* attackData); + virtual void set(u32 index, u32 groupIndex); + virtual void setAbsolute(u32 index, u32 groupIndex, soCollisionAttackAbsoluteData* attackData); + virtual void hitAbsolute(u32 index, Vec3f* nodeGlobalPos, void*, short, u8); + virtual void hitAbsolute(u32 index, int nodeId, void*, short, u8); + virtual void hitAbsolute(u32 index, const char* nodeName, void*, short, u8); + virtual void setWhole(u32 index, bool); + virtual bool isAttack(u32 index, bool); + virtual bool isInvalidInvincible(u32 index, bool); + virtual bool isInvalidXlu(u32 index, bool); + virtual void setPower(u32 index, int power, bool); + virtual void setVector(u32 index, int vector); + virtual float getSize(u32 index); + virtual void setSize(u32 index, float size); + virtual void setTargetCategory(u32 index, soCollision::CategoryMask categoryMask); + virtual bool setOffset(u32 index, Vec3f* offsetPos); + virtual bool setOffsetFromNode(u32 index, int node); + virtual void setNode(u32 index, int node); + virtual float getBasePower(u32 index, bool); + virtual float getPower(u32 index, bool); + virtual u32 getGroup(u32 index); + virtual int getReactionEffect(u32 index, bool); + virtual void setReactionEffect(u32 index, int reactionEffect, bool); + virtual int getReactionFix(u32 index, bool); + virtual void setReactionFix(u32 index, int reactionFix, bool); + virtual int getReactionAdd(u32 index, bool); + virtual void setReactionAdd(u32 index, int reactionAdd, bool); + virtual float getReactionMul(); + virtual void setPosX(u32 index, float posX); + virtual float getPosX(u32 index, bool); + virtual float getPosX(); + virtual Vec3f getCenterPos(u32 index, bool); + virtual float getSpeedX(); + virtual Vec2f getSpeed(); + virtual void setSpeed(Vec2f* speed); + virtual soCollisionAttackData* getData(u32 index, bool); + virtual void setPowerMulStatus(float powerMulStatus); + virtual float getPowerMulStatus(); + virtual void setPowerAddStatus(float powerAddStatus); + virtual float getPowerSpeedStatus(); + virtual void setPowerSpeedStatus(float powerSpeedStatus); + virtual void setPowerMul(float powerMul); + virtual float getPowerMul(); + virtual void setPowerMul2nd(float powerMul2nd); + virtual float getPowerMul2nd(); + virtual void setReactionMul(float reactionMul); + virtual float getLr(); + virtual u32 getPartSize(); + virtual void update(Vec2f* pos, float scale, float lr, SituationKind kind, Vec2f* speed); + virtual void checkLog(); + virtual bool check(); + virtual void refLogGroup(u32 groupIndex, u32 logGroupIndex); + virtual void unRefLogGroup(u32 groupIndex); + virtual int isInflict(); + virtual int isInflictStatus(); + virtual void setIndirectInfo(int indirectTaskId, int teamNo); + virtual int getIndirectTaskId(); + virtual int getIndirectTeamNo(); + virtual soCollision* getCollision(); + virtual void addPastLog(void*, u32, u32 groupIndex); + virtual void invalidLog(soCollisionLog* collisionLog, u32 groupIndex); + virtual bool checkRebound(float, soModuleAccesser* moduleAccesser, StageObject*, soCollisionLog* collisionLog, float* out1, float* out2); + virtual void setRestrict(bool isRestrict); + virtual void renderDebug(); +}; +static_assert(sizeof(soCollisionAttackModule) == 4, "Class is wrong size!"); + +class soCollisionAttackModuleImpl : public soCollisionAttackModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soEventPresenter { +public: + soModuleAccesser* m_moduleAccesser; + void* m_indirectTeam; + void* m_collisionAttackPart; + void* m_collisionAttackAbsoluteArray; + Vec2f m_pos; + Vec2f m_speed; + float m_powerMulStatus; + float m_powerAdd; + float m_powerSpeedStatus; + float m_powerMul; + float m_powerMul2nd; + float m_reactionMul; + float m_0x60; + void* m_collisionGroupArray; + soCollision m_collision; + char _128[8]; + soCollision::Situation m_situation; + float m_lr; + int m_isInflict; + int m_isInflictStatus; + int m_indirectTaskId; + char _156[4]; + + // TODO: Verify parameters + virtual ~soCollisionAttackModuleImpl(); + virtual void activate(float, float lr, int taskId, Vec2f* pos, u32 index, bool); + virtual void deactivate(); + virtual void begin(); + virtual void clearAll(); + virtual void clear(u32 index); + virtual void sleep(bool); + virtual void set(u32 index, u32 groupIndex, soCollisionAttackData* attackData); + virtual void set(u32 index, u32 groupIndex); + virtual void setAbsolute(u32 index, u32 groupIndex, soCollisionAttackAbsoluteData* attackData); + virtual void hitAbsolute(u32 index, Vec3f* nodeGlobalPos, void*, short, u8); + virtual void hitAbsolute(u32 index, int nodeId, void*, short, u8); + virtual void hitAbsolute(u32 index, const char* nodeName, void*, short, u8); + virtual void setWhole(u32 index, bool); + virtual bool isAttack(u32 index, bool); + virtual bool isInvalidInvincible(u32 index, bool); + virtual bool isInvalidXlu(u32 index, bool); + virtual void setPower(u32 index, int power, bool); + virtual void setVector(u32 index, int vector); + virtual float getSize(u32 index); + virtual void setSize(u32 index, float size); + virtual void setTargetCategory(u32 index, soCollision::CategoryMask categoryMask); + virtual bool setOffset(u32 index, Vec3f* offsetPos); + virtual bool setOffsetFromNode(u32 index, int node); + virtual void setNode(u32 index, int node); + virtual float getBasePower(u32 index, bool); + virtual float getPower(u32 index, bool); + virtual u32 getGroup(u32 index); + virtual int getReactionEffect(u32 index, bool); + virtual void setReactionEffect(u32 index, int reactionEffect, bool); + virtual int getReactionFix(u32 index, bool); + virtual void setReactionFix(u32 index, int reactionFix, bool); + virtual int getReactionAdd(u32 index, bool); + virtual void setReactionAdd(u32 index, int reactionAdd, bool); + virtual float getReactionMul(); + virtual void setPosX(u32 index, float posX); + virtual float getPosX(u32 index, bool); + virtual float getPosX(); + virtual Vec3f getCenterPos(u32 index, bool); + virtual float getSpeedX(); + virtual Vec2f getSpeed(); + virtual void setSpeed(Vec2f* speed); + virtual soCollisionAttackData* getData(u32 index, bool); + virtual void setPowerMulStatus(float powerMulStatus); + virtual float getPowerMulStatus(); + virtual void setPowerAddStatus(float powerAddStatus); + virtual float getPowerSpeedStatus(); + virtual void setPowerSpeedStatus(float powerSpeedStatus); + virtual void setPowerMul(float powerMul); + virtual float getPowerMul(); + virtual void setPowerMul2nd(float powerMul2nd); + virtual float getPowerMul2nd(); + virtual void setReactionMul(float reactionMul); + virtual float getLr(); + virtual u32 getPartSize(); + virtual void update(Vec2f* pos, float scale, float lr, SituationKind kind, Vec2f* speed); + virtual void checkLog(); + virtual bool check(); + virtual void refLogGroup(u32 groupIndex, u32 logGroupIndex); + virtual void unRefLogGroup(u32 groupIndex); + virtual int isInflict(); + virtual int isInflictStatus(); + virtual void setIndirectInfo(int indirectTaskId, int teamNo); + virtual int getIndirectTaskId(); + virtual int getIndirectTeamNo(); + virtual soCollision* getCollision(); + virtual void addPastLog(void*, u32, u32 groupIndex); + virtual void invalidLog(soCollisionLog* collisionLog, u32 groupIndex); + virtual bool checkRebound(float, soModuleAccesser* moduleAccesser, StageObject*, soCollisionLog* collisionLog, float* out1, float* out2); + virtual void setRestrict(bool isRestrict); + virtual void renderDebug(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + + soCollisionAttackModuleImpl(soModuleAccesser* moduleAccesser, int taskId, gfTask::Category taskCategory, + soArray*, soArray*, + soArray*, soEventObserverRegistrationDesc*, bool); +}; +static_assert(sizeof(soCollisionAttackModuleImpl) == 160, "Class is wrong size!"); + +template +class soCollisionAttackModuleBuildConfig { + soArrayVector m_attackPartArrayVector; + soArrayVector m_collisionGroupArrayVector; + soArrayVector m_attackAbsoluteArrayVector; + TCollisionAttackModule m_attackModule; +public: + soCollisionAttackModuleBuildConfig(soModuleAccesser* moduleAccesser, + int taskId, + gfTask::Category taskCategory, + soEventObserverRegistrationDesc* registrationDesc) : + m_attackPartArrayVector(TNumParts, soCollisionAttackPart(TCategory, TBool1), 0), + m_collisionGroupArrayVector(TNumGroups, 0), + m_attackAbsoluteArrayVector(TNumAbsolutes, 0), + m_attackModule(moduleAccesser, taskId, taskCategory, &m_attackPartArrayVector, &m_collisionGroupArrayVector, &m_attackAbsoluteArrayVector, registrationDesc, TBool2) {}; + +}; + +template +class soCollisionAttackModuleBuilder { + TCollisionAttackBuildConfig m_buildConfig; +public: + + soCollisionAttackModule* getModule() { + return &m_buildConfig.m_attackModule; + }; + + soCollisionAttackModuleBuilder(soModuleAccesser* moduleAccesser, + int taskId, + gfTask::Category taskCategory, + soEventObserverRegistrationDesc* registrationDesc) : + m_buildConfig(moduleAccesser, taskId, taskCategory, registrationDesc) { } ; +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_part.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_part.h new file mode 100644 index 0000000000..e5d0c54829 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_attack_part.h @@ -0,0 +1,346 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct soCollisionAttackAbsoluteData { + int m_power; + int m_vector; + int m_reactionEffect; + int m_reactionFix; + int m_reactionAdd; + float m_slipChance; + float m_hitStopFrame; + float m_hitStopDelay; + u32 _32; +}; + +struct soCollisionAttackData { + enum Vec { + Vec_None = 361, + Vec_Rad = 362, + Vec_Speed = 363, + Vec_Random = 364, + Vec_Sync = 365, + Vec_Pull_Reaction = 366, + Vec_Pull = 367, + Vec_Target_Pos = 368, + }; + + enum Attribute { + Attribute_Normal = 0x0, + Attribute_None = 0x1, + Attribute_Cutup = 0x2, + Attribute_Electric = 0x3, + Attribute_Ice = 0x4, + Attribute_Fire = 0x5, + Attribute_Coin = 0x6, + Attribute_Turn = 0x7, + Attribute_Slip = 0x8, + Attribute_Sleep = 0x9, + Attribute_None2 = 0xA, + Attribute_Bury = 0xB, + Attribute_Stun = 0xC, + Attribute_Magic = 0xD, + Attribute_Flower = 0xE, + Attribute_YellowSteam = 0xF, // TODO: real name for this + Attribute_None3 = 0x10, + Attribute_Grass = 0x11, + Attribute_Water = 0x12, + Attribute_Purple = 0x13, + Attribute_Paralyze = 0x14, + Attribute_Aura = 0x15, + Attribute_Pitfall = 0x16, + Attribute_Lay = 0x17, + Attribute_Flinchless = 0x18, // TODO: real name for this? + Attribute_None5 = 0x19, + Attribute_None6 = 0x1A, + Attribute_None7 = 0x1B, + Attribute_None8 = 0x1C, + Attribute_None9 = 0x1D, + Attribute_None10 = 0x1E, + Attribute_None11 = 0x1F, + }; + + enum SoundLevel { + Sound_Level_Small = 0x0, + Sound_Level_S = 0x0, + Sound_Level_Medium = 0x1, + Sound_Level_M = 0x1, + Sound_Level_Large = 0x2, + Sound_Level_L = 0x2, + Sound_Level_Largest = 0x3, + Sound_Level_LL = 0x3, + }; + + enum SoundAttribute { + Sound_Attribute_None = 0x0, + Sound_Attribute_Punch = 0x1, + Sound_Attribute_Kick = 0x2, + Sound_Attribute_Cutup = 0x3, + Sound_Attribute_Coin = 0x4, + Sound_Attribute_Bat = 0x5, + Sound_Attribute_Harisen = 0x6, // (Harisen) + Sound_Attribute_Fan = 0x6, + Sound_Attribute_Elec = 0x7, + Sound_Attribute_Electric = 0x7, + Sound_Attribute_Fire = 0x8, + Sound_Attribute_Water = 0x9, + Sound_Attribute_Grass = 0xA, + Sound_Attribute_Bomb = 0xB, + Sound_Attribute_PeachWeapon = 0xC, + Sound_Attribute_Snake = 0xD, // Exclusive to Snake + Sound_Attribute_Ike = 0xE, // Exclusive to Ike + Sound_Attribute_Dedede = 0xF, // Exclusive to Dedede + Sound_Attribute_Magic = 0x10, + Sound_Attribute_Kamehit = 0x11, // Shell + Sound_Attribute_Shell = 0x11, // Shell + Sound_Attribute_Peach_Binta = 0x12, // Exclusive to Peach (slap) + Sound_Attribute_Peach_Slap = 0x12, + Sound_Attribute_Peach_FryingPan = 0x13, // Exclusive to Peach + Sound_Attribute_Peach_Golf = 0x14, // Exclusive to Peach + Sound_Attribute_Peach_Tennis = 0x15, // Exclusive to Peach + Sound_Attribute_Lucario = 0x16, // Exclusive to Lucario + Sound_Attribute_Marth = 0x17, // Exclusive to Marth + Sound_Attribute_Mario_Coin = 0x18, // Exclusive to Mario + Sound_Attribute_Mario_Final = 0x19, // Exclusive to Mario + Sound_Attribute_Luigi_Coin = 0x1A, // Exclusive to Luigi + Sound_Attribute_Ness_Bat = 0x1B, // Exclusive to Ness + Sound_Attribute_Freeze = 0x1C, + }; + + enum SetOffKind { + SetOff_Off = 0x0, // transcendent + SetOff_Thru = 0x2, // trample (not properly implemented in vBrawl) + SetOff_On = 0x3, // clank + }; + + enum LrCheck { + Lr_Check_Pos = 0x0, // normal reverse hit + Lr_Check_Speed = 0x1, // reverse hit based on horizontal momentum + Lr_Check_Lr = 0x2, // Away from where target is facing + Lr_Check_Forward = 0x3, // forward from attacker direction + Lr_Check_F = 0x3, + Lr_Check_Reverse = 0x3, + Lr_Check_Backward = 0x4, // backward from attacker direction + Lr_Check_B = 0x4, + Lr_Check_Along = 0x4, + Lr_Check_Part = 0x5, // based on where on hitbox you connect / away from center of collision + // LR_Check_Left/LR_Check_Right/LR_Check_BackSlash? + }; + + enum Region { + Region_None = 0x0, + Region_Head = 0x1, + Region_Body = 0x2, + Region_Hip = 0x3, + Region_Punch = 0x4, + Region_Elbow = 0x5, + Region_Kick = 0x6, + Region_Knee = 0x7, + Region_Throw = 0x8, + Region_Object = 0x9, + Region_Sword = 0xA, + Region_Hammer = 0xB, + Region_Bomb = 0xC, + Region_Spin = 0xD, + Region_Bite = 0xE, + Region_Magic = 0xF, + Region_Psi = 0x10, + Region_Palutena = 0x11, + Region_Aura = 0x12, + Region_Bat = 0x13, + Region_Parasol = 0x14, + Region_Pikmin = 0x15, + Region_Water = 0x16, + Region_Whip = 0x17, + Region_Tail = 0x18, + Region_Energy = 0x19 + }; + + int m_power; + Vec3f m_offsetPos; + float m_size; + int m_vector; + int m_reactionEffect; // kbg + int m_reactionFix; // fkb + int m_reactionAdd; // bkb + float m_slipChance; // trip chance + float m_hitStopFrame; // hitstop multiplier + float m_hitStopDelay; // sdi multiplier + union { + struct { + unsigned int : 9; // up to 0x1ff + bool m_targetCategoryFloor : 1; // Skyword platforms, Hanenbow platforms, stage blocks + bool m_targetCategoryItemE : 1; // Soccer Ball, Blast Box etc. (items enemies can hit) + bool m_targetCategoryWall : 1; // Summit ice, Green Hill break, Metal Gear wall, Mario Bros. Pow + bool m_targetCategoryGimmick : 1; // Ground + bool m_targetCategory5 : 1; + bool m_targetCategory4 : 1; + bool m_targetCategoryItem : 1; // Barrel, Crate etc. + bool m_targetCategory2 : 1; + bool m_targetCategoryEnemy : 1; // SSE enemies + bool m_targetCategoryFighter : 1; // Fighter + bool m_targetSituationODD : 1; + bool m_targetSituationAir : 1; + bool m_targetSituationGround : 1; + bool : 1; // up to 0x1 + bool m_targetPartLeg : 1; // Usually legs + bool m_targetPartKnee : 1; // Usually Shin + bool m_targetPartArm : 1; // Usually forearm, wing + bool m_targetPartBody : 1; // Usually head, pelvis, upper arm, tail, item + Attribute : 5; // up to 0x1f + SoundLevel : 2; // up to 0x3 + SoundAttribute : 5; // up to 0x1f + SetOffKind : 2; // up to 0x3 + bool : 1; + bool : 1; + bool : 1; + bool : 1; + unsigned int : 9; // up to 0x1ff added shield damage + unsigned int : 10; // ~up to 0x3ff + unsigned int : 16; // up to 0xffff detectionRate + bool : 1; + bool : 1; // ignore invincibility + bool : 1; // ignore intangibility + LrCheck : 3; // up to 0x7 + bool : 1; // only affect grabbed opponent + bool : 1; // friendly fire + bool : 1; // no hitlag + bool : 1; // disable gfx on hit + bool : 1; // flinchless + Region : 5; // up to 0x1f; + bool : 1; + bool : 1; // custom + unsigned int : 30; // ~up to 0x3fffffff + }; + + struct { + unsigned int m_nodeIndex : 9; // up to 0x1ff + soCollision::CategoryMask m_targetCategory : 10; // up to 0x3ff; + soCollision::SituationMask m_targetSituation : 3; // up to 0x7 + bool m_targetLr : 1; // up to 0x1 // unused in vBrawl? + soCollision::PartMask m_targetPart : 4; // up to 0xf + Attribute m_attribute : 5; // up to 0x1f + SoundLevel m_soundLevel : 2; // up to 0x3 + SoundAttribute m_soundAttribute : 5; // up to 0x1f + SetOffKind m_setOffKind : 2; // up to 0x3 + bool m_noScale : 1; + bool m_isShieldable : 1; + bool m_isReflectable : 1; + bool m_isAbsorbable : 1; + unsigned int m_subShield : 9; // up to 0x1ff added shield damage + unsigned int field_0x34_9 : 10; // ~up to 0x3ff + unsigned int m_serialHitFrame : 16; // up to 0xffff detectionRate + bool m_isDirect : 1; + bool m_isInvalidInvincible : 1; // ignore invincibility + bool m_isInvalidXlu : 1; // ignore intangibility + LrCheck m_lrCheck : 3; // up to 0x7 + bool m_isCatch : 1; // only affect grabbed opponent + bool m_noTeam : 1; // friendly fire + bool m_noHitStop : 1; // no hitlag + bool m_noEffect : 1; // disable gfx on hit + bool m_noTransaction : 1; // flinchless + Region m_region : 5; // up to 0x1f; + soCollision::ShapeType m_shapeType : 1; + bool m_isDeath100 : 1; // custom + unsigned int field_0x3c_2 : 30; // ~up to 0x3fffffff + }; + }; + + inline soCollisionAttackData() { + m_slipChance = 1.0; + m_hitStopFrame = 1.0; + m_hitStopDelay = 1.0; + m_region = Region_None; + } + + inline soCollisionAttackData(int power, Vec3f* offsetPos, float size, int vector, + int reactionEffect, int reactionFix, int reactionAdd, + float slipChance, float hitStopFrame, float hitStopDelay, + u32 nodeIndex, soCollision::CategoryMask targetCategory, soCollision::SituationMask targetSituation, + u32 targetLr, soCollision::PartMask targetPart, + Attribute attribute, SoundLevel soundLevel, SoundAttribute soundAttribute, + SetOffKind setOffKind, bool noScale, + bool isShieldable, bool isReflectable, bool isAbsorbable, u32 subShield, + u16 serialHitFrame, bool isDirect, bool isInvalidInvincible, bool isInvalidXlu, + LrCheck lrCheck, bool isCatch, bool noTeam, bool noHitStop, bool noEffect, + bool noTransaction, Region region, soCollision::ShapeType shapeType) { + MEMINIT(this); + m_power = power; + m_offsetPos = *offsetPos; + m_size = size; + m_vector = vector; + m_reactionEffect = reactionEffect; + m_reactionFix = reactionFix; + m_reactionAdd = reactionAdd; + m_slipChance = slipChance; + m_hitStopFrame = hitStopFrame; + m_hitStopDelay = hitStopDelay; + m_nodeIndex = nodeIndex; + m_targetCategory = targetCategory; + m_targetSituation = targetSituation; + m_targetLr = targetLr; + m_targetPart = targetPart; + m_attribute = attribute; + m_soundLevel = soundLevel; + m_soundAttribute = soundAttribute; + m_setOffKind = setOffKind; + m_noScale = noScale; + m_isShieldable = isShieldable; + m_isReflectable = isReflectable; + m_isAbsorbable = isAbsorbable; + m_subShield = subShield; + m_serialHitFrame = serialHitFrame; + m_isDirect = isDirect; + m_isInvalidInvincible = isInvalidInvincible; + m_isInvalidXlu = isInvalidXlu; + m_lrCheck = lrCheck; + m_isCatch = isCatch; + m_noTeam = noTeam; + m_noHitStop = noHitStop; + m_noEffect = noEffect; + m_noTransaction = noTransaction; + m_region = region; + m_shapeType = shapeType; + } +}; +static_assert(sizeof(soCollisionAttackData) == 64, "Class is wrong size!"); + +struct soCollisionAttackAbsolute { + soCollisionAttackData m_attackData; + char _0x40[4]; + Vec3f m_nodeGlobalPos; + char _0x50[15]; + u8 m_index; + int m_groupIndex; + bool m_isAttack; + char _0x65[3]; + + soCollisionAttackAbsolute(); + ~soCollisionAttackAbsolute(); +}; + +class soCollisionAttackPart { + enum Status { + Status_Inactive = 0x0, + Status_Set = 0x1, + Status_Active = 0x2 + }; + + Status m_status; + soCollisionAttackData m_attackData; + soArrayVector m_clTargetArrayVector; + int m_groupIndex; + char _0x8c[4]; + +public: + soCollisionAttackPart(); + soCollisionAttackPart(soCollision::Category, bool); + ~soCollisionAttackPart(); +}; +static_assert(sizeof(soCollisionAttackPart) == 0x90, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_catch_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_catch_event_presenter.h new file mode 100644 index 0000000000..b1215ee5f6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_catch_event_presenter.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionCatchEventObserver : public soEventObserver { +public: + soCollisionCatchEventObserver(s16 unitID) : + soEventObserver(unitID) { } + + virtual void addObserver(s16 param1, s8 param2); + virtual void notifyEventTurn(float, float, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soCollisionCatchEventObserver) == 0xC, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_group.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_group.h new file mode 100644 index 0000000000..dee3184a8e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_group.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +class soCollisionGroup { + char _spacer[120]; + +public: + soCollisionGroup(); + ~soCollisionGroup(); + +}; +static_assert(sizeof(soCollisionGroup) == 120, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_event_presenter.h new file mode 100644 index 0000000000..67dbcce989 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_event_presenter.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionHitEventObserver : public soEventObserver { +public: + soCollisionHitEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionHit(float power, soCollisionAttackData*, u32 index, int, soModuleAccesser* moduleAccesser, soCollisionLog*); + virtual void notifyEventCollisionHit2nd(float posX, float collisionLr, soCollisionAttackModule*, soCollisionLog*, u32 groupIndex, soModuleAccesser* moduleAccesser, bool); + virtual void notifyEventChangeCollisionHit(int index, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soCollisionHitEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_group.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_group.h new file mode 100644 index 0000000000..500c0c81b7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_group.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include + +class soCollisionHitGroup { +public: + int m_index; + char _4[2]; + short m_partSize; + float m_posX; + float m_scale; + SituationKind m_situationKind; + float m_lr; + char _24[4]; + int m_whole; + int m_global; + int m_xluFrameGlobal; + int m_invincibleFrameGlobal; + union { + struct { + u32 _ : 29; + bool m_isSituationODD : 1; + bool m_isSituationAir : 1; + bool m_isSituationGround : 1; + }; + soCollision::SituationMask m_multiSituation; + }; + char _48[1]; + bool m_49; + bool m_50; + u8 m_51; + u8 m_globalOffset; + char _53[3]; + + void setInvincibleGlobal(); + + soCollisionHitGroup(); + ~soCollisionHitGroup(); +}; +static_assert(sizeof(soCollisionHitGroup) == 56, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_module_impl.h new file mode 100644 index 0000000000..a1846ee38a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_module_impl.h @@ -0,0 +1,178 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionHitModule : public soNullable { +public: + virtual ~soCollisionHitModule(); + virtual void activate(float, float, float, u32 collisionIndex, u32 collisionHitGroupIndex); + virtual void activate(float, float, float, int taskId, u32 collisionIndex); + virtual void reset(float, float, float, u32 collisionIndex, u32 collisionHitGroupIndex); + virtual void deactivate(); + virtual void begin(); + virtual void clean(); + virtual void sleep(bool); + virtual void add(soSet*, u32 collisionHitGroupIndex); + virtual void add(soSet*, u32 collisionHitGroupIndex); + virtual void resetStatusAll(u32 collisionHitGroupIndex); + virtual void set(u32 collisionHitPartIndex, soCollisionHitData* hitData, u32 collisionHitGroupIndex); + virtual void set(soSet*, u32 collisionHitGroupIndex); + virtual void set(soSet*, u32 collisionHitGroupIndex); + virtual void setStatus(u32 collisionHitPartIndex, int status, u32 collisionHitGroupIndex); + virtual void setStatusNode(int, int status, u32 collisionHitGroupIndex); + virtual void setStatusNodeDefault(int, int status, u32 collisionHitGroupIndex); + virtual void setStatusAll(int status, u32 collisionHitGroupIndex); + virtual void setWhole(int, u32 collisionHitGroupIndex); + virtual int getWhole(u32 collisionHitGroupIndex); + virtual void setCheckCatch(bool, u32 collisionHitGroupIndex); + virtual void update(float posX, float scale, float lr, SituationKind, u32 collisionHitGroupIndex); + virtual void update(float posX, float scale, float lr, SituationKind); + virtual void resetStatusGlobal(u32 collisionHitGroupIndex); + virtual void setXluGlobal(u32 collisionHitGroupIndex); + virtual void cancelXluGlobal(u32 collisionHitGroupIndex); + virtual void setXluFrameGlobal(int xluFrameGlobal, u32 collisionHitGroupIndex); + virtual void setInvincibleGlobal(u32 collisionHitGroupIndex); + virtual void cancelInvincibleGlobal(u32 collisionHitGroupIndex); + virtual void setInvincibleFrameGlobal(int invincibleFrameGlobal, bool override, u32 collisionHitGroupIndex); + virtual int getInvincibleFrameGlobal(u32 collisionHitGroupIndex); + virtual int getGlobal(u32 collisionHitGroupIndex); + virtual int getStatus(u32 collisionHitPartIndex, u32 collisionHitGroupIndex); + virtual int getTotalStatus(u32 collisionHitGroupIndex); + virtual float getDurabilityMulFromAttackData(); + virtual int getPartSize(u32 collisionHitGroupIndex); + virtual u32 getPartHeight(u32 collisionHitPartIndex, u32 collisionHitGroupIndex); + virtual void setNoTeam(bool); + virtual void setGlobalOffset(u8, u32 collisionHitGroupIndex); + virtual void setMultiSituation(SituationKind situationKind, u32 collisionHitGroupIndex); + virtual void initMultiSituation(u32 collisionHitGroupIndex); + virtual void setOpponentCategory(u32 categoryMask, bool, u32 collisionHitGroupIndex); + virtual void setSelfCategory(soCollision::Category, u32 collisionHitGroupIndex); + virtual void checkLog(); + virtual u32 getGroupNum(); + virtual bool isReactionFrame(); + virtual short getReactionFrame(); + virtual void setReactionFrame(short reactionFrame); + virtual void setPosX(float posX, u32 collisionGroupIndex); + virtual float getPosX(u32 collisionGroupIndex); + virtual Vec3f getCenterPos(u16 index, u32 collisionHitGroupIndex); + virtual void renderDebug(); +}; +static_assert(sizeof(soCollisionHitModule) == 8, "Class is wrong size!"); + +class soCollisionHitModuleImpl : public soCollisionHitModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soEventPresenter { + +public: + soModuleAccesser* m_moduleAccesser; + char _48[8]; + soCollision m_collision; + char _80[8]; + soArray* m_collisionHitGroupArray; + char _92[8]; + short m_reactionFrame; + char _102[2]; + + virtual ~soCollisionHitModuleImpl(); + virtual void activate(float, float, float, u32 collisionIndex, u32 collisionHitGroupIndex); + virtual void activate(float, float, float, int taskId, u32 collisionIndex); + virtual void reset(float, float, float, u32 collisionIndex, u32 collisionHitGroupIndex); + virtual void deactivate(); + virtual void begin(); + virtual void clean(); + virtual void sleep(bool); + virtual void add(soSet*, u32 collisionHitGroupIndex); + virtual void add(soSet*, u32 collisionHitGroupIndex); + virtual void resetStatusAll(u32 collisionHitGroupIndex); + virtual void set(u32 collisionHitPartIndex, soCollisionHitData* hitData, u32 collisionHitGroupIndex); + virtual void set(soSet*, u32 collisionHitGroupIndex); + virtual void set(soSet*, u32 collisionHitGroupIndex); + virtual void setStatus(u32 collisionHitPartIndex, int status, u32 collisionHitGroupIndex); + virtual void setStatusNode(int, int status, u32 collisionHitGroupIndex); + virtual void setStatusNodeDefault(int, int status, u32 collisionHitGroupIndex); + virtual void setStatusAll(int status, u32 collisionHitGroupIndex); + virtual void setWhole(int, u32 collisionHitGroupIndex); + virtual int getWhole(u32 collisionHitGroupIndex); + virtual void setCheckCatch(bool, u32 collisionHitGroupIndex); + virtual void update(float posX, float scale, float lr, SituationKind, u32 collisionHitGroupIndex); + virtual void update(float posX, float scale, float lr, SituationKind); + virtual void resetStatusGlobal(u32 collisionHitGroupIndex); + virtual void setXluGlobal(u32 collisionHitGroupIndex); + virtual void cancelXluGlobal(u32 collisionHitGroupIndex); + virtual void setXluFrameGlobal(int xluFrameGlobal, u32 collisionHitGroupIndex); + virtual void setInvincibleGlobal(u32 collisionHitGroupIndex); + virtual void cancelInvincibleGlobal(u32 collisionHitGroupIndex); + virtual void setInvincibleFrameGlobal(int invincibleFrameGlobal, bool override, u32 collisionHitGroupIndex); + virtual int getInvincibleFrameGlobal(u32 collisionHitGroupIndex); + virtual int getGlobal(u32 collisionHitGroupIndex); + virtual int getStatus(u32 collisionHitPartIndex, u32 collisionHitGroupIndex); + virtual int getTotalStatus(u32 collisionHitGroupIndex); + virtual float getDurabilityMulFromAttackData(); + virtual int getPartSize(u32 collisionHitGroupIndex); + virtual u32 getPartHeight(u32 collisionHitPartIndex, u32 collisionHitGroupIndex); + virtual void setNoTeam(bool); + virtual void setGlobalOffset(u8, u32 collisionHitGroupIndex); + virtual void setMultiSituation(SituationKind situationKind, u32 collisionHitGroupIndex); + virtual void initMultiSituation(u32 collisionHitGroupIndex); + virtual void setOpponentCategory(u32 categoryMask, bool, u32 collisionHitGroupIndex); + virtual void setSelfCategory(soCollision::Category, u32 collisionHitGroupIndex); + virtual void checkLog(); + virtual u32 getGroupNum(); + virtual bool isReactionFrame(); + virtual short getReactionFrame(); + virtual void setReactionFrame(short reactionFrame); + virtual void setPosX(float posX, u32 collisionGroupIndex); + virtual float getPosX(u32 collisionGroupIndex); + virtual Vec3f getCenterPos(u16 index, u32 collisionHitGroupIndex); + virtual void renderDebug(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + + soCollisionHitModuleImpl(soModuleAccesser*, int taskId, gfTask::Category taskCategory, soArray*, + soArray*, soArray*, soEventObserverRegistrationDesc*, bool); +}; +static_assert(sizeof(soCollisionHitModuleImpl) == 104, "Class is wrong size!"); + +template +class soCollisionHitModuleBuildConfig { + soArrayVector m_hitPartArrayVector; + soArrayVector m_collisionGroupArrayVector; + soArrayVector m_hitGroupArrayVector; + TCollisionHitModule m_hitModule; +public: + soCollisionHitModuleBuildConfig(soModuleAccesser* moduleAccesser, + int taskId, + gfTask::Category taskCategory, + soEventObserverRegistrationDesc* registrationDesc) : + m_hitPartArrayVector(TNumParts, soCollisionHitPart(TSelfCategory, TOpponentCategoryMask), 0), + m_collisionGroupArrayVector(TNumGroups, 0), + m_hitGroupArrayVector(TNumGroups, 0), + m_hitModule(moduleAccesser, taskId, taskCategory, &m_hitPartArrayVector, &m_collisionGroupArrayVector, &m_hitGroupArrayVector, registrationDesc, TBool1) {}; +}; + +template +class soCollisionHitModuleBuilder { + TCollisionHitBuildConfig m_buildConfig; +public: + + soCollisionHitModule* getModule() { + return &m_buildConfig.m_hitModule; + }; + + soCollisionHitModuleBuilder(soModuleAccesser* moduleAccesser, + int taskId, + gfTask::Category taskCategory, + soEventObserverRegistrationDesc* registrationDesc) : + m_buildConfig(moduleAccesser, taskId, taskCategory, registrationDesc) { } ; +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_part.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_part.h new file mode 100644 index 0000000000..ccb2c943b1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_hit_part.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct soCollisionHitData { + enum Height { + Height_Low = 0x1, + Height_Center = 0x2, + Height_High = 0x3, + }; + + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + float m_size; + unsigned int m_nodeIndex : 9; + soCollision::Part m_part : 2; + Height m_height : 2; + unsigned int m_0x1c_3 : 2; + soCollision::ShapeType m_shapeType : 1; + unsigned int m_0x1c_1 : 16; + + struct Simple { + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + float m_size; + soCollision::ShapeType m_shapeType : 8; + char _0x1d[3]; + Height m_height; + unsigned int m_nodeIndex; + }; + static_assert(sizeof(Simple) == 40, "Class is wrong size!"); + +}; +static_assert(sizeof(soCollisionHitData) == 32, "Class is wrong size!"); + +class soCollisionHitPart { + int m_status; + char _0x4[4]; + soCollisionHitData m_hitData; + soArrayVector m_clTargetArrayVector; + char _0x64[4]; + +public: + soCollisionHitPart(); + soCollisionHitPart(soCollision::Category selfCategory, u32 opponentCategory); + ~soCollisionHitPart(); +}; +static_assert(sizeof(soCollisionHitPart) == 0x68, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_log.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_log.h new file mode 100644 index 0000000000..36d0d3cc66 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_log.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include + +class soCollisionLog { +public: + char _spacer[12]; + int m_taskId; + Vec3f m_pos; + short m_life; + short m_30; + s8 m_teamNo; + char _33; + gfTask::Category m_taskCategory : 8; + char _35; + u8 m_collsionIndex; + u8 m_damageIndex; + char _38; + bool m_isAbsolute; + char _40; + char _41; + char _42; + char _43[1]; + +}; // size 44 +static_assert(sizeof(soCollisionLog) == 44, "Class is wrong size!"); // size 44 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_event_presenter.h new file mode 100644 index 0000000000..8a97b6ee1b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_event_presenter.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionSearchEventObserver : public soEventObserver { +public: + soCollisionSearchEventObserver() : soEventObserver(0x11) {}; + soCollisionSearchEventObserver(short unitID) : soEventObserver(unitID) {}; + soCollisionSearchEventObserver(short, s8); + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionSearch(soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionSearchCheck(); +}; +static_assert(sizeof(soCollisionSearchEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_module_impl.h new file mode 100644 index 0000000000..238748ce4e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_module_impl.h @@ -0,0 +1,79 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soCollisionSearchModule { +public: + virtual ~soCollisionSearchModule(); + virtual void activate(float, int taskId); + virtual void deactivate(); + virtual void begin(); + virtual void clearAll(); + virtual void clear(u32 partIndex); + virtual void set(u32 partIndex, u32 groupIndex, soCollisionSearchData* collisionSearchData); + virtual bool isSearch(u32 partIndex); + virtual float getSize(u32 partIndex); + virtual void setSize(u32 partIndex, float size); + virtual void setPos(int nodeIndex, Vec3f* startOffsetPos, Vec3f* endOffsetPos); + virtual soCollisionSearchData* getData(u32 partIndex); + virtual void update(float posX, float scale); + virtual void checkLog(); + virtual bool check(); + virtual int isInflict(); + virtual void invalidLog(soCollisionLog* collisionLog, u32 groupIndex); + virtual void setCheckInterval(int); + virtual void renderDebug(); +}; +static_assert(sizeof(soCollisionSearchModule) == 4, "Class is wrong size!"); + +class soCollisionSearchModuleImpl : public soCollisionSearchModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soEventPresenter { +public: + soModuleAccesser* m_moduleAccesser; + void* m_collisionSearchPartArray; + float m_48; + soArrayVector m_collisionGroupArrayVector; + soCollision m_collision; + char _208[12]; + Vec3f m_startOffsetPos; + Vec3f m_endOffsetPos; + int m_nodeIndex; + int m_isInflict; + char _252[12]; + + virtual ~soCollisionSearchModuleImpl(); + virtual void activate(float, int taskId); + virtual void deactivate(); + virtual void begin(); + virtual void clearAll(); + virtual void clear(u32 partIndex); + virtual void set(u32 partIndex, u32 groupIndex, soCollisionSearchData* collisionSearchData); + virtual bool isSearch(u32 partIndex); + virtual float getSize(u32 partIndex); + virtual void setSize(u32 partIndex, float size); + virtual void setPos(int nodeIndex, Vec3f* startOffsetPos, Vec3f* endOffsetPos); + virtual soCollisionSearchData* getData(u32 partIndex); + virtual void update(float posX, float scale); + virtual void checkLog(); + virtual bool check(); + virtual int isInflict(); + virtual void invalidLog(soCollisionLog* collisionLog, u32 groupIndex); + virtual void setCheckInterval(int); + virtual void renderDebug(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soCollisionSearchModuleImpl) == 264, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_part.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_part.h new file mode 100644 index 0000000000..0f5c5d9be7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_search_part.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include + +struct soCollisionSearchData { + char _0[0x18]; +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_absorber.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_absorber.h new file mode 100644 index 0000000000..c95371a513 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_absorber.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; +class soCollisionAttackModule; +class soCollisionSearchModule; + +class soCollisionAbsorberEventObserver : public soEventObserver { +public: + soCollisionAbsorberEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionAbsorber(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual bool notifyEventCollisionAbsorberCheck(); +}; +static_assert(sizeof(soCollisionAbsorberEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_reflector.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_reflector.h new file mode 100644 index 0000000000..c78362e235 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_reflector.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; +class soCollisionAttackModule; +class soCollisionSearchModule; + +class soCollisionReflectorEventObserver : public soEventObserver { +public: + soCollisionReflectorEventObserver() : soEventObserver(0xf) {}; + soCollisionReflectorEventObserver(short unitID) : soEventObserver(unitID) {}; + soCollisionReflectorEventObserver(short, s8); + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionReflector(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionReflectorSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionReflectorCheck(); +}; +static_assert(sizeof(soCollisionReflectorEventObserver) == 12, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_shield.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_shield.h new file mode 100644 index 0000000000..cdc4ccf94c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_event_presenter_shield.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; +class soCollisionAttackModule; +class soCollisionSearchModule; + +class soCollisionShieldEventObserver : public soEventObserver { +public: + soCollisionShieldEventObserver() : soEventObserver(0xe) {}; + soCollisionShieldEventObserver(short unitID) : soEventObserver(unitID) {}; + soCollisionShieldEventObserver(short, s8); + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventCollisionShield(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionShieldSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionShieldCheck(); +}; +static_assert(sizeof(soCollisionShieldEventObserver) == 12, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_group.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_group.h new file mode 100644 index 0000000000..ce4817b67e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_group.h @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include + +struct soCollisionShieldData { + char _[0x20]; +}; +static_assert(sizeof(soCollisionShieldData) == 0x20, "Class is wrong size!"); + +struct soCollisionReflectorData { + char _0[0x4]; + float m_speedMul; + float m_attackLimit; + float m_lifeMul; + char _16[0x4]; +}; +static_assert(sizeof(soCollisionReflectorData) == 0x14, "Class is wrong size!"); + +struct soCollisionShieldGroupData { + soSet m_shieldDataSet; + u32 _8[4]; +}; + +struct soCollisionReflectorGroupData { + soSet m_shieldDataSet; + soCollisionReflectorData* m_reflectorData; +}; + +class soCollisionShieldGroup { +public: + u8 _00[0x90]; + float m_posX; + u32 _94; + float m_Lr; + float m_hopAngle; + float m_attackMul; + float m_speedMul; + float m_attackLimit; + float m_lifeMul; + u8 m_isFront; + u8 m_isHop; + u8 m_isTurn; + u8 m_isNoMBall; + u8 m_isNoHop; + u8 _b5[0x3]; +}; +static_assert(sizeof(soCollisionShieldGroup) == 0xB8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_module_impl.h new file mode 100644 index 0000000000..5befefcca1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/collision/so_collision_shield_module_impl.h @@ -0,0 +1,116 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class soCollisionShieldModule +{ +public: + virtual ~soCollisionShieldModule(); + virtual void activate(double, double, double); + virtual void activate(double, double, double, u32 taskId); + virtual void deactivate(); + virtual void begin(); + virtual void clean(); + virtual void add(soCollisionShieldGroupData*, u32 collisionShieldGroupIndex); + virtual void add(soCollisionReflectorGroupData*, u32 collisionShieldGroupIndex); + virtual void set(u32, soCollisionShieldData*, u32 collisionShieldGroupIndex); + virtual void setReflectorData(soCollisionReflectorData*, u32 collisionShieldGroupIndex); + virtual void update(double, double, double, u32 collisionShieldGroupIndex); + virtual void update(double, double, double); + virtual u8 isShield(u32, u32 collisionShieldGroupIndex); + virtual void setStatus(u32, u32, u32); + virtual void setStatusAll(u32, u32); + virtual u8 isTurn(u32 collisionShieldGroupIndex); + virtual u8 isFront(u32 collisionShieldGroupIndex); + virtual u8 isHop(u32 collisionShieldGroupIndex); + virtual double getHopAngle(); + virtual void isNoHop(u32 collisionShieldGroupIndex); + virtual void setTurn(u32, u32 collisionShieldGroupIndex); + virtual void setFront(u32, u32 collisionShieldGroupIndex); + virtual void setHop(double, u32, u32 collisionShieldGroupIndex); + virtual double getAttackMul(u32 collisionShieldGroupIndex); + virtual double getSpeedMul(u32 collisionShieldGroupIndex); + virtual double getLifeMul(u32 collisionShieldGroupIndex); + virtual void getAttackLimit(u32 collisionShieldGroupIndex); + virtual u8 isNoMBall(u32 collisionShieldGroupIndex); + virtual int getPartSize(u32 collisionShieldGroupIndex); + virtual u32 getTeam(); + virtual void checkLog(); + virtual void check(); + virtual void renderDebug(); + virtual void clearAll(); + virtual void clearAll(u32 collisionShieldGroupIndex); + virtual Vec3f getCenterPos(u32, u32 collisionShieldGroupIndex); + virtual double getLR(u32 collisionShieldGroupIndex); + virtual u32 getGroupNum(); + virtual double getPosX(u32 collisionShieldGroupIndex); + virtual void setTargetProperty(u32, u32 collisionShieldGroupIndex); +}; + +class soCollisionShieldModuleImpl : public soCollisionShieldModule, public soStatusEventObserver, public soAnimCmdEventObserver +{ +public: + soModuleAccesser* m_moduleAccesser; + u32 _20; + u32 _24; + soCollision m_collision; + u8 _40[0x8]; + soArray* m_collisionShieldGroupArray; + u32 _4C; + u8 _50; + u8 m_collisionOccurred; + u8 _52; + u8 _53_padding; + + virtual ~soCollisionShieldModuleImpl(); + virtual void activate(double, double, double); + virtual void activate(double, double, double, u32 taskId); + virtual void deactivate(); + virtual void begin(); + virtual void clean(); + virtual void add(soCollisionShieldGroupData*, u32 collisionShieldGroupIndex); + virtual void add(soCollisionReflectorGroupData*, u32 collisionShieldGroupIndex); + virtual void set(u32, soCollisionShieldData*, u32 collisionShieldGroupIndex); + virtual void setReflectorData(soCollisionReflectorData*, u32 collisionShieldGroupIndex); + virtual void update(double, double, double, u32 collisionShieldGroupIndex); + virtual void update(double, double, double); + virtual u8 isShield(u32, u32 collisionShieldGroupIndex); + virtual void setStatus(u32, u32 status, u32 collisionShieldGroupIndex); + virtual void setStatusAll(u32 status, u32 collisionShieldGroupIndex); + virtual u8 isTurn(u32 collisionShieldGroupIndex); + virtual u8 isFront(u32 collisionShieldGroupIndex); + virtual u8 isHop(u32 collisionShieldGroupIndex); + virtual double getHopAngle(); + virtual void isNoHop(u32 collisionShieldGroupIndex); + virtual void setTurn(u32, u32 collisionShieldGroupIndex); + virtual void setFront(u32, u32 collisionShieldGroupIndex); + virtual void setHop(double, u32, u32 collisionShieldGroupIndex); + virtual double getAttackMul(u32 collisionShieldGroupIndex); + virtual double getSpeedMul(u32 collisionShieldGroupIndex); + virtual double getLifeMul(u32 collisionShieldGroupIndex); + virtual void getAttackLimit(u32 collisionShieldGroupIndex); + virtual u8 isNoMBall(u32 collisionShieldGroupIndex); + virtual int getPartSize(u32 collisionShieldGroupIndex); + virtual u32 getTeam(); + virtual void checkLog(); + virtual void check(); + virtual void renderDebug(); + virtual void clearAll(); + virtual void clearAll(u32 collisionShieldGroupIndex); + virtual Vec3f getCenterPos(u32, u32 collisionShieldGroupIndex); + virtual double getLR(u32 collisionShieldGroupIndex); + virtual u32 getGroupNum(); + virtual double getPosX(u32 collisionShieldGroupIndex); + virtual void setTargetProperty(u32, u32 collisionShieldGroupIndex); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soCollisionShieldModuleImpl) == 0x54, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend.h b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend.h new file mode 100644 index 0000000000..a32eeec44a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include +#include + +class soColorBlend { + soColorFlash m_flash; + soColorLight m_light; + char _0x78[0x10]; +}; +static_assert(sizeof(soColorBlend) == 0x88, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend_module_impl.h new file mode 100644 index 0000000000..6fca4c07e8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_blend_module_impl.h @@ -0,0 +1,108 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soColorBlendModule: public soNullable { +public: + // TODO: Fill out params for most of these. + virtual bool isNull() const = 0; // 0x8 + virtual ~soColorBlendModule(); // 0xc + virtual void activate() = 0; // 0x10 + virtual void deactivate() = 0; // 0x14 + virtual void update() = 0; // 0x18 + virtual void updateMaterial() = 0; // 0x1C + virtual void offAll(bool) = 0; // 0x20 + virtual void setFlash(GXColor color, bool) = 0; // 0x24 + virtual void setFlashColorFrame(GXColor color, u32) = 0; // 0x28 + virtual void offFlash(bool) = 0; // 0x2C + virtual void setLight(float, float, GXColor color, u8, bool) = 0; // 0x30 + virtual void setLightColor(GXColor color, bool) = 0; // 0x34 + virtual void setLightColorFrame(GXColor color, bool) = 0; // 0x38 + virtual void setLightDir(float, float, bool) = 0; // 0x3C + virtual void offLight(bool) = 0; // 0x40 + virtual void setPri(u32, bool) = 0; // 0x44 + virtual void setSubColor(GXColor color, char enabled) = 0; // 0x48 + virtual char isEnableSubColor() = 0; // 0x4C + virtual GXColor getSubColor() = 0; // 0x50 + virtual soColorBlend *getColorBlend() = 0; // 0x54 + virtual s8 getLightSet() = 0; // 0x58 +}; + +class soColorBlendModuleImpl: + public soColorBlendModule, + public soStatusEventObserver, + public soAnimCmdEventObserver, + public soModelEventObserver +{ +public: + // 0x2C + soModuleAccesser* m_moduleAccesser; + soColorBlend m_colorBlend1; + soColorBlend m_colorBlend2; + char _0x140[10]; + GXColor m_subColor; + char _0x14e[1]; + bool m_useSubColor; + char _0x150[4]; + + virtual bool isNull() const; + virtual ~soColorBlendModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void update(); + virtual void updateMaterial(); + virtual void offAll(bool); + virtual void setFlash(GXColor color, bool); + virtual void setFlashColorFrame(GXColor color, u32); + virtual void offFlash(bool); + virtual void setLight(float, float, GXColor color, u8, bool); + virtual void setLightColor(GXColor color, bool); + virtual void setLightColorFrame(GXColor color, bool); + virtual void setLightDir(float, float, bool); + virtual void offLight(bool); + virtual void setPri(u32, bool); + virtual void setSubColor(GXColor color, char enabled); + virtual char isEnableSubColor(); + virtual GXColor getSubColor(); + virtual soColorBlend *getColorBlend(); + virtual s8 getLightSet(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventConstructInstance(bool, soModuleAccesser* moduleAccesser); +}; +static_assert(0x154 == sizeof(soColorBlendModuleImpl), "Class is wrong size!"); + +class soColorBlendModuleNull: public soColorBlendModule { + virtual ~soColorBlendModuleNull(); + virtual void activate(); + virtual void deactivate(); + virtual void update(); + virtual void updateMaterial(); + virtual void offAll(bool); + virtual void setFlash(); + virtual void setFlashColorFrame(); + virtual void offFlash(bool); + virtual void setLight(); + virtual void setLightColor(); + virtual void setLightColorFrame(); + virtual void setLightDir(); + virtual void offLight(bool); + virtual void setPri(); + virtual void setSubColor(GXColor color, char enabled); + virtual char isEnableSubColor(); + virtual GXColor getSubColor(); + virtual soColorBlend *getColorBlend(); + virtual s8 getLightSet(); + + soColorBlendModuleNull* getNullInstance(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_flash.h b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_flash.h new file mode 100644 index 0000000000..846ddb231a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_flash.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +class soColorFlash { +public: + char _0x0[0x34]; + bool m_isEnable; + char _0x35[0x3]; + + virtual ~soColorFlash(); + virtual void reset(); +}; +static_assert(sizeof(soColorFlash) == 0x3C, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_light.h b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_light.h new file mode 100644 index 0000000000..343a5afec1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/color/so_color_light.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include +#include + +class soColorLight : public soColorFlash { +public: + virtual ~soColorLight(); + virtual void reset(); +}; +static_assert(sizeof(soColorLight) == 0x3C, "Class is the wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_impl.h new file mode 100644 index 0000000000..9567665f6d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_impl.h @@ -0,0 +1,175 @@ +#pragma once + +#include +#include +#include +#include + +class soController : public soNullable { +public: + enum PadButton { + Pad_Button_Attack = 0x0, + Pad_Button_Special = 0x1, + Pad_Button_Jump = 0x2, + Pad_Button_Guard = 0x3, + Pad_Button_Guard_2 = 0x4, + Pad_Button_Smash = 0x5, + Pad_Button_Appeal_Hi = 0x6, + Pad_Button_Appeal_Lw = 0x7, + Pad_Button_Appeal_S = 0x8, + Pad_Button_Appeal_S_L = 0x9, + Pad_Button_Appeal_S_R = 0xA, + Pad_Button_Dir_L = 0xB, + Pad_Button_Dir_Hi = 0xC, + Pad_Button_Dir_R = 0xD, + Pad_Button_Stock_Share = 0xE, + Pad_Button_CStick = 0xF, + Pad_Button_Flick_Jump = 0x10, + }; + + virtual void resetFlick(); + virtual void resetButton(); + virtual void resetTrigger(); + virtual void resetMainStickX(); + virtual void setMainStickX(float); + virtual void resetMainStickY(); + virtual void setMainStickY(float); + virtual void resetMainStick(); + virtual void resetSubStickX(); + virtual void resetSubStickY(); + virtual void resetSubStick(); + virtual void reset(); + virtual void update(Input*, bool); + virtual void resetFlickX(); + virtual void resetFlickY(); + virtual void setOff(bool); + virtual float getStickX(); + virtual float getStickPrevX(); + virtual float getStickY(); + virtual float getStickPrevY(); + virtual u8 getFlickX(); + virtual s8 getFlickXDir(); + virtual u8 getFlickY(); + virtual s8 getFlickYDir(); + virtual u8 getFlickNoResetX(); + virtual u8 getFlickNoResetY(); + virtual u8 getFlickAfterX(); + virtual s8 getFlickAfterXDir(); + virtual u8 getFlickAfterY(); + virtual float getSubStickX(); + virtual float getSubStickPrevX(); + virtual float getSubStickY(); + virtual float getSubStickPrevY(); + virtual int getTrigger(); + virtual u8 getTriggerCount(u8 index); + virtual u8 getTriggerCountPrev(u8 index); + virtual int getButton(); + virtual int getRelease(); + virtual float getLr(); + virtual u8 getFlickBonus(); + virtual u8 getFlickBonusLr(); + virtual void resetFlickBonus(); + virtual void resetFlickBonusLr(); + virtual ~soController(); + + static u32 getButtonMask(PadButton); +}; +static_assert(sizeof(soController) == 8, "Class is wrong size!"); + +class soControllerImpl : public soController { + + class soControllerTriggerData { + u8 m_countPrev; + u8 m_count; + }; + +public: + float m_mainStickX; + float m_mainStickY; + float m_mainStickPrevX; + float m_mainStickPrevY; + char _24[8]; + float m_subStickX; + float m_subStickY; + float m_subStickPrevX; + float m_subStickPrevY; + char _48[8]; + float m_lr; + char _60[8]; + int m_button; + int m_buttonPrev; + char _76[4]; + int m_trigger; + int m_release; + soControllerTriggerData m_triggerData[2]; + char _92[30]; + u8 m_flickX; + u8 m_flickXDir; + u8 m_flickY; + u8 m_flickYDir; + u8 m_flickNoResetX; + char _127; + u8 m_flickNoResetY; + char _129; + u8 m_flickAfterX; + u8 m_flickAfterXDir; + u8 m_flickAfterY; + char _133; + u8 m_flickBonus; + u8 m_flickBonusLr; + bool _136; + bool _isOff; + char _138[2]; + + virtual void resetFlick(); + virtual void resetButton(); + virtual void resetTrigger(); + virtual void resetMainStickX(); + virtual void setMainStickX(float); + virtual void resetMainStickY(); + virtual void setMainStickY(float); + virtual void resetMainStick(); + virtual void resetSubStickX(); + virtual void resetSubStickY(); + virtual void resetSubStick(); + virtual void reset(); + virtual void update(Input*, bool); + virtual void resetFlickX(); + virtual void resetFlickY(); + virtual void setOff(bool); + virtual float getStickX(); + virtual float getStickPrevX(); + virtual float getStickY(); + virtual float getStickPrevY(); + virtual u8 getFlickX(); + virtual s8 getFlickXDir(); + virtual u8 getFlickY(); + virtual s8 getFlickYDir(); + virtual u8 getFlickNoResetX(); + virtual u8 getFlickNoResetY(); + virtual u8 getFlickAfterX(); + virtual s8 getFlickAfterXDir(); + virtual u8 getFlickAfterY(); + virtual float getSubStickX(); + virtual float getSubStickPrevX(); + virtual float getSubStickY(); + virtual float getSubStickPrevY(); + virtual int getTrigger(); + virtual u8 getTriggerCount(); + virtual u8 getTriggerCountPrev(); + virtual int getButton(); + virtual int getRelease(); + virtual float getLr(); + virtual u8 getFlickBonus(); + virtual u8 getFlickBonusLr(); + virtual void resetFlickBonus(); + virtual void resetFlickBonusLr(); + virtual ~soControllerImpl(); +}; +static_assert(sizeof(soControllerImpl) == 140, "Class is wrong size!"); + +class soControllerNull : public soController { + +}; + +extern soControllerNull g_soControllerNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_impl.h new file mode 100644 index 0000000000..1769489aef --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_impl.h @@ -0,0 +1,118 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soControllerModule { +public: + virtual ~soControllerModule(); + virtual void activate(); + virtual void deactivate(); + virtual void resetButton(); + virtual void resetTrigger(); + virtual void resetMainStickX(); + virtual void setMainStickX(float); + virtual void resetMainStickY(); + virtual void setMainStickY(float); + virtual void resetMainStick(); + virtual void resetSubStickX(); + virtual void resetSubStickY(); + virtual void resetSubStick(); + virtual void update(Input*, bool); + virtual void resetFlickX(); + virtual void resetFlickY(); + virtual float getStickX(); + virtual float getStickPrevX(); + virtual float getStickY(); + virtual float getStickPrevY(); + virtual float getStickAngle(); + virtual float getStickDir(); + virtual bool isStickSide(); + virtual u8 getFlickX(); + virtual s8 getFlickXDir(); + virtual u8 getFlickY(); + virtual s8 getFlickYDir(); + virtual u8 getFlickNoResetX(); + virtual u8 getFlickNoResetY(); + virtual u8 getFlickAfterX(); + virtual s8 getFlickAfterXDir(); + virtual u8 getFlickAfterY(); + virtual float getSubStickX(); + virtual float getSubStickPrevX(); + virtual float getSubStickY(); + virtual float getSubStickPrevY(); + virtual float getSubStickDir(); + virtual bool isSubStickSide(); + virtual ipPadButton getTrigger(); + virtual u8 getTriggerCount(u8 index); + virtual u8 getTriggerCountPrev(u8 index); + virtual ipPadButton getButton(); + virtual ipPadButton getRelease(); + virtual void setOff(bool); + virtual void setPrev(s32); + virtual void clearLog(); + virtual s32 getLogNum(); + virtual void setLogActive(bool); + virtual void startClatter(float, float, float, u8, u8, u32 index, bool); + virtual void setClatterTime(float clatterTime, u32 index); + virtual void addClatterTime(float clatterTime, u32 index); + virtual float getClatterTime(u32 index); + virtual void endClatter(u32 index); + virtual float getClatterThreshold(); + virtual soController* getController(); + virtual void setRumble(s32, s32, bool, s32); + virtual void stopRumbleKind(s32, s32); + virtual void stopRumble(bool); + virtual void setRumbleAll(s32, s32, s32); + virtual void stopRumbleAll(s32, s32); + virtual void setReverseXFrame(s32, bool); + virtual float getLr(); + virtual u8 getFlickBonus(); + virtual u8 getFlickBonusLr(); + virtual void resetFlickBonus(); + virtual void resetFlickBonusLr(); +}; +static_assert(sizeof(soControllerModule) == 4, "Class is wrong size!"); + +class soControllerModuleImpl : public soControllerModule, public soAnimCmdEventObserver { + char _16[4]; + +public: + virtual ~soControllerModuleImpl(); + virtual void activate(); + virtual void deactivate(); + + virtual float getStickAngle(); + virtual float getStickDir(); + virtual bool isStickSide(); + + virtual float getSubStickDir(); + virtual bool isSubStickSide(); + + virtual void startClatter(float, float, float, u8, u8, u32 index, bool); + virtual void setClatterTime(float clatterTime, u32 index); + virtual void addClatterTime(float clatterTime, u32 index); + virtual float getClatterTime(u32 index); + virtual void endClatter(u32 index); + + virtual void setRumble(s32, s32, bool, s32); + virtual void stopRumbleKind(s32, s32); + virtual void stopRumble(bool); + virtual void setRumbleAll(s32, s32, s32); + virtual void stopRumbleAll(s32, s32); + virtual void setReverseXFrame(s32, bool); + virtual float getLr(); + virtual u8 getFlickBonus(); + virtual u8 getFlickBonusLr(); + virtual void resetFlickBonus(); + virtual void resetFlickBonusLr(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, s32 unk3); + + void updateClatter(soController* linkController); +}; +static_assert(sizeof(soControllerModuleImpl) == 20, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_link_ref.h b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_link_ref.h new file mode 100644 index 0000000000..f5c6e76d77 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/controller/so_controller_module_link_ref.h @@ -0,0 +1,68 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soControllerModuleLinkRef : public soControllerModuleImpl { + soModuleAccesser* m_moAccessor; + soController* m_lkController; +public: + virtual ~soControllerModuleLinkRef(); + virtual void resetButton(); + virtual void resetTrigger(); + virtual void resetMainStickX(); + virtual void setMainStickX(float); + virtual void resetMainStickY(); + virtual void setMainStickY(float); + virtual void resetMainStick(); + virtual void resetSubStickX(); + virtual void resetSubStickY(); + virtual void resetSubStick(); + virtual void update(Input*, bool); + virtual void resetFlickX(); + virtual void resetFlickY(); + virtual float getStickX(); + virtual float getStickPrevX(); + virtual float getStickY(); + virtual float getStickPrevY(); + virtual u8 getFlickX(); + virtual s8 getFlickXDir(); + virtual u8 getFlickY(); + virtual s8 getFlickYDir(); + virtual u8 getFlickNoResetX(); + virtual u8 getFlickNoResetY(); + virtual u8 getFlickAfterX(); + virtual s8 getFlickAfterXDir(); + virtual u8 getFlickAfterY(); + virtual float getSubStickX(); + virtual float getSubStickPrevX(); + virtual float getSubStickY(); + virtual float getSubStickPrevY(); + virtual ipPadButton getTrigger(); + virtual u8 getTriggerCount(u8 index); + virtual u8 getTriggerCountPrev(u8 index); + virtual ipPadButton getButton(); + virtual ipPadButton getRelease(); + virtual void setOff(bool); + virtual void setPrev(s32); + virtual void clearLog(); + virtual s32 getLogNum(); + virtual void setLogActive(bool); + virtual float getClatterThreshold(); + virtual soController* getController(); + virtual void setRumble(s32, s32, bool, s32); + virtual void stopRumbleKind(s32, s32); + virtual void stopRumble(bool); + virtual void setRumbleAll(s32, s32, s32); + virtual void stopRumbleAll(s32, s32); + virtual float getLr(); + virtual u8 getFlickBonus(); + virtual u8 getFlickBonusLr(); + virtual void resetFlickBonus(); + virtual void resetFlickBonusLr(); +}; +static_assert(sizeof(soControllerModuleLinkRef) == 0x1C, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage.h new file mode 100644 index 0000000000..54d82d1f63 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage.h @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include +#include + +class soDamage { +public: + enum Level { + Level_1 = 0x0, + Level_2 = 0x1, + Level_3 = 0x2, + Level_Fly = 0x3, + }; + + float m_damage; + float m_damageAdd; + float m_powerMax; + float m_reaction; + soCollisionLog m_collisionLog; + soCollisionAttackData m_attackData; + float m_lr; + Vec3f m_pos; + float m_140; + float m_144; + float m_damageAdd_; + int m_attackerTeamOwnerId; + char _156[4]; +}; +static_assert(sizeof(soDamage) == 160, "Class is wrong size!"); // size 160 + +struct soDamageLog { + float m_reaction; + soDamage::Level m_level; + int m_height; + Vec2f m_speed; + float m_angle; + float m_lr; + float m_frame; + u32 m_hitStopFrame; + soCollisionAttackData::Attribute m_attribute; + float m_damageAdd; + int m_attackerTeamNo; + float m_hitStopDelay; + Vec2f m_groundTouchNormal; + int m_attackerTaskId; + int m_attackerTeamOwnerId; + gfTask::Category m_attackerTaskCategory : 8; + bool m_isDamageAir : 1; + bool m_isSituationGround : 1; + bool : 1; + bool m_isCollisionAbsolute : 1; + bool m_isMeteor : 1; + bool m_isAttackDirect : 1; + bool m_isVector365 : 1; + bool : 1; + char _0x46[2]; +}; +static_assert(sizeof(soDamageLog) == 0x48, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_attacker_info.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_attacker_info.h new file mode 100644 index 0000000000..370c3a3871 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_attacker_info.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include +#include + +class soDamageAttackerInfo { +public: + gfTask::Category m_directTaskCategory : 8; + char _spacer[3]; + int m_directTaskId; + soKind m_directSoKind; + int m_directSoSubKind; + + gfTask::Category m_indirectTaskCategory : 8; + char _spacer2[3]; + int m_indirectTaskId; + soKind m_indirectSoKind; + int m_indirectSoSubKind; + int m_indirectEntryId; + + int m_clearFrame; +}; +static_assert(sizeof(soDamageAttackerInfo) == 40, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_effector_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_effector_impl.h new file mode 100644 index 0000000000..3c1773511d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_effector_impl.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include +#include + +class soDamageEffector : public soNullable { + // TODO: +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_event_presenter.h new file mode 100644 index 0000000000..f4479c1412 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_event_presenter.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include + +class StageObject; +class soModuleAccesser; + +class soDamageEventObserver : public soEventObserver { +public: + soDamageEventObserver() : soEventObserver(0x6) {}; + soDamageEventObserver(short unitID) : soEventObserver(unitID) {}; + soDamageEventObserver(short param1, s8 param2) : soEventObserver(0x6) { + initialize(param1, param2); + } + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventOnDamage(soDamage* damage, bool, soModuleAccesser* moduleAccesser); + virtual void notifyEventAddDamage(soDamage* damage, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soDamageEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_module_impl.h new file mode 100644 index 0000000000..4a860c246c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_module_impl.h @@ -0,0 +1,161 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StageObject; +class soModuleAccesser; + +class soDamageModule : public soNull, public soNullable { +public: + virtual ~soDamageModule(); + virtual void activate(float damage); + virtual void deactivate(); + virtual void sleep(bool); + virtual void update(); + virtual void initDamage(float damage); + virtual void initInfo(); + virtual void setInfo(); + virtual void storeDamage(float addedDamage, soDamage* damage); + virtual bool check(bool); + virtual float getDamageLr(float, float, void*, void*, int, int); + virtual bool setForceDamage(StageObject* stageObject, Vec3f* pos, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual bool setForceDamage(StageObject* stageObject, int nodeId, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual bool setForceDamage(StageObject* stageObject, const char* nodeName, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual void addDamage(float damage, u32 damageIndex); + virtual float getDamage(u32 damageIndex); + virtual float getReaction(u32 damageIndex); + virtual float getPowerMax(u32 damageIndex); + virtual bool checkNoReaction(void*); + virtual void setNoReactionModeStatus(float, float, int mode); + virtual void setNoReactionMode2nd(float, float, int mode); + virtual void resetNoReactionModeStatus(); + virtual void setNoReactionMode(int mode); + virtual void resetNoReactionMode(); + virtual void setNoReactionModeAlways(bool); + virtual void setNoReactionModePerfect(bool); + virtual bool isNoReactionModePerfect(); + virtual void toTurnDamage(); + virtual void leaveTurnDamage(); + virtual soDamageLog* getDamageLog(); + virtual void clearDamageLog(); + virtual void getAttackerInfo(soDamageAttackerInfo* attackerInfo); + virtual soDamageAttackerInfo* getAttackerInfo(); + virtual void restoreAttackerInfo(soDamageAttackerInfo* attackerInfo); + virtual void clearAttackerInfo(); + virtual soDamageEffector* getEffector(); + virtual soDamageTransactor* getTransactor(); + virtual bool isReaction(); + virtual bool isCatchCut(); + virtual float getCaptureDamage(); + virtual bool isCaptureCut(); + virtual bool isCaptureCut(void*); + virtual void setDamageMul(float damageMul); + virtual void setReactionMul(float reactionMul); + virtual void setReactionMul2nd(float reactionMul2nd); + virtual void setDamageLock(bool); + virtual bool isDamageLock(); + virtual void heal(float healAmount, u32 damageIndex); + virtual void updateAttackerInfo(); +}; +static_assert(sizeof(soDamageModule) == 12, "Class is wrong size!"); + +class soDamageModuleImpl : public soDamageModule, public soCollisionHitEventObserver, public soStatusEventObserver, public soEventPresenter, public soAnimCmdEventObserver { + +public: + soModuleAccesser* m_moduleAccesser; + soArray* m_damageArray; + soDamageNoReactionModule m_noReactionModule; + soDamageAttackerInfo m_attackerInfo; + soDamageEffector* m_effector; + soDamageTransactor* m_transactor; + float m_damageMul; + float m_reactionMul; + float m_reactionMul2nd; + char _160[8]; + bool m_isDamageLock; + u8 m_sleep; + char _pad[2]; + + virtual ~soDamageModuleImpl(); + virtual void activate(float damage); + virtual void deactivate(); + virtual void sleep(bool); + virtual void update(); + virtual void initDamage(float damage); + virtual void initInfo(); + virtual void setInfo(); + virtual void storeDamage(float addedDamage, soDamage* damage); + virtual bool check(bool); + virtual float getDamageLr(float, float, void*, void*, int, int); + virtual bool setForceDamage(StageObject* stageObject, Vec3f* pos, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual bool setForceDamage(StageObject* stageObject, int nodeId, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual bool setForceDamage(StageObject* stageObject, const char* nodeName, u32 collisionIndex, u32 damageIndex, bool getAbsolute, bool initInfo); + virtual void addDamage(float damage, u32 damageIndex); + virtual float getDamage(u32 damageIndex); + virtual float getReaction(u32 damageIndex); + virtual float getPowerMax(u32 damageIndex); + virtual bool checkNoReaction(void*); + virtual void setNoReactionModeStatus(float, float, int mode); + virtual void setNoReactionMode2nd(float, float, int mode); + virtual void resetNoReactionModeStatus(); + virtual void setNoReactionMode(int mode); + virtual void resetNoReactionMode(); + virtual void setNoReactionModeAlways(bool); + virtual void setNoReactionModePerfect(bool); + virtual bool isNoReactionModePerfect(); + virtual void toTurnDamage(); + virtual void leaveTurnDamage(); + virtual soDamageLog* getDamageLog(); + virtual void clearDamageLog(); + virtual void getAttackerInfo(soDamageAttackerInfo* attackerInfo); + virtual soDamageAttackerInfo* getAttackerInfo(); + virtual void restoreAttackerInfo(soDamageAttackerInfo* attackerInfo); + virtual void clearAttackerInfo(); + virtual soDamageEffector* getEffector(); + virtual soDamageTransactor* getTransactor(); + virtual bool isReaction(); + virtual bool isCatchCut(); + virtual float getCaptureDamage(); + virtual bool isCaptureCut(); + virtual bool isCaptureCut(void*); + virtual void setDamageMul(float damageMul); + virtual void setReactionMul(float reactionMul); + virtual void setReactionMul2nd(float reactionMul2nd); + virtual void setDamageLock(bool); + virtual bool isDamageLock(); + virtual void heal(float healAmount, u32 damageIndex); + virtual void updateAttackerInfo(); + + // TODO: Check parameters + virtual void reqDamageShake(); + virtual bool preProcessCheckDamage(); + virtual bool onDamage(u32 damageIndex); + virtual bool isCheckGroundDamage(); + virtual bool onGroundDamage(); + virtual float getReactionSub(); + virtual float getReactionMul(); + virtual float getWeightReactionMul(); + virtual float getDamageMul(); + virtual void reqDamageEffect(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventCollisionHit(float power, soCollisionAttackData*, u32 index, int, soModuleAccesser* moduleAccesser, soCollisionLog*); + virtual void notifyEventCollisionHit2nd(float posX, float collisionLr, soCollisionAttackModule*, soCollisionLog*, u32 groupIndex, soModuleAccesser* moduleAccesser, bool); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soDamageModuleImpl) == 172, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_no_reaction_module.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_no_reaction_module.h new file mode 100644 index 0000000000..c663590086 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_no_reaction_module.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +class soDamageNoReactionModule { + int m_mode; + int m_modeStatus; + char _8[8]; + int m_modeStatus2nd; + char _20[8]; + bool m_isModeAlways; + bool m_isModePerfect; + char _30[2]; +}; +static_assert(sizeof(soDamageNoReactionModule) == 32, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_transactor_actor.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_transactor_actor.h new file mode 100644 index 0000000000..045cf4993e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_transactor_actor.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include + +class soDamageTransactor { + // TODO: +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_util_actor.h b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_util_actor.h new file mode 100644 index 0000000000..754e023596 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/damage/so_damage_util_actor.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include +#include +#include + +class soDamageUtilActor : public soNullable { + // TODO: +public: + static double getDamageAngle(soModuleAccesser* moduleAccesser, double reaction, double lr, int attackVector, Vec2f *speed); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_module_impl.h new file mode 100644 index 0000000000..2e5b023039 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_module_impl.h @@ -0,0 +1,139 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soEffectModule : public soNullable { +public: + virtual ~soEffectModule(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(); + virtual void update(bool); + virtual u32 req(EfID effectID, Vec3f* pos, Vec3f* rot, float scale, u32, int); + virtual u32 req2D(EfID effectID, Vec3f* pos, Vec3f* rot, float scale, u32); + virtual u32 req(EfID effectID, int, Vec3f* pos, Vec3f* rot, float scale, Vec3f* posRange, Vec3f* rotRange, bool, u32); + virtual bool req(EfID effectID, int, int*, Vec3f* pos, Vec3f* rot, float scale, Vec3f* posRange, Vec3f* rotRange, bool, u32); + virtual u32 reqAttachGround(EfID effectID, int*, Vec3f* pos, Vec3f* rot, float scale, Vec3f* rotRange, u32); + virtual u32 reqFollow(EfID effectID, int, Vec3f*, Vec3f*, float scale, bool, u32, u32 effectIDAdd, int); + virtual int reqContinual(EfID effectID, float, int, bool, u32 index); + virtual void removeContinual(u32 index); + virtual void removeAllContinual(); + virtual void reqTime(EfID effectID, int, Vec3f* pos, Vec3f* rot, float scale, u32); + virtual void reqTimeFollow(EfID effectID, int, int, Vec3f*, Vec3f*, float scale, u32); + virtual void removeTime(int); + virtual void removeAllTime(); + virtual void reqEmit(EfID effectID, u32); + virtual void remove(int); + virtual void removeAll(u32); + virtual void kill(int, bool, bool); + virtual void killKind(bool, bool, int); + virtual void killAll(u32, bool, bool); + virtual int reqAfterImage(int nodeID1, int nodeID2, int, short, Vec3f*, Vec3f*, u32, EfID effectId, int, Vec3f* pos, Vec3f*, float scale, u8, u8, float); + virtual bool removeAfterImage(int, int); + virtual void removeAllAfterImage(u32, int); + virtual void setPos(int, Vec3f* pos); + virtual void setRot(int, Vec3f* rot); + virtual void setScale(int, Vec3f* scale); + virtual bool isExistEffect(int); + virtual void setVisible(int, bool); + virtual void setWhole(bool); + virtual void reqPause(bool); + virtual void fillScreen(int index, u32, int, int); + virtual void clearScreen(int index, u32); + virtual float getDeadEffectRotZ(Vec3f*, bool* out); + virtual void reqCommon(float, int index); + virtual void removeCommon(int); + virtual void resetCommon(); + virtual bool isEndCommon(); + virtual bool isExistCommon(int); + virtual void reqScreen(int index); + virtual void removeScreen(int index); + virtual void setSyncVisibility(bool); + virtual bool isSyncVisibility(); + virtual void setSyncScale(bool); + virtual bool isSyncScale(); + virtual void setShieldEffect(int); + virtual void ignoreScaleZ(bool); +}; +static_assert(sizeof(soEffectModule) == 8, "Class is wrong size!"); + +class soEffectModuleImpl : public soEffectModule, public soAnimCmdEventObserver, public soStatusEventObserver, public soModelEventObserver, public soCollisionAttackEventObserver, public soCollisionShieldEventObserver { +public: + soModuleAccesser* m_moduleAccesser; + u8 unk48[0x8]; + s32 unk50; + u8 unk54[0xE4]; + + virtual ~soEffectModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(); + virtual void update(bool); + virtual u32 req(EfID effectID, Vec3f* pos, Vec3f* rot, float scale, u32, int); + virtual u32 req2D(EfID effectID, Vec3f* pos, Vec3f* rot, float scale, u32); + virtual u32 req(EfID effectID, int, Vec3f* pos, Vec3f* rot, float scale, Vec3f* posRange, Vec3f* rotRange, bool, u32); + virtual bool req(EfID effectID, int, int*, Vec3f* pos, Vec3f* rot, float scale, Vec3f* posRange, Vec3f* rotRange, bool, u32); + virtual u32 reqAttachGround(EfID effectID, int*, Vec3f* pos, Vec3f* rot, float scale, Vec3f* rotRange, u32); + virtual u32 reqFollow(EfID effectID, int, Vec3f*, Vec3f*, float scale, bool, u32, u32 effectIDAdd, int); + virtual int reqContinual(EfID effectID, float, int, bool, u32 index); + virtual void removeContinual(u32 index); + virtual void removeAllContinual(); + virtual void reqTime(EfID effectID, int, Vec3f* pos, Vec3f* rot, float scale, u32); + virtual void reqTimeFollow(EfID effectID, int, int, Vec3f*, Vec3f*, float scale, u32); + virtual void removeTime(int); + virtual void removeAllTime(); + virtual void reqEmit(EfID effectID, u32); + virtual void remove(int); + virtual void removeAll(u32); + virtual void kill(int, bool, bool); + virtual void killKind(bool, bool, int); + virtual void killAll(u32, bool, bool); + virtual int reqAfterImage(int nodeID1, int nodeID2, int, short, Vec3f*, Vec3f*, u32, EfID effectId, int, Vec3f* pos, Vec3f*, float scale, u8, u8, float); + virtual bool removeAfterImage(int, int); + virtual void removeAllAfterImage(u32, int); + virtual void setPos(int, Vec3f* pos); + virtual void setRot(int, Vec3f* rot); + virtual void setScale(int, Vec3f* scale); + virtual bool isExistEffect(int); + virtual void setVisible(int, bool); + virtual void setWhole(bool); + virtual void reqPause(bool); + virtual void fillScreen(int index, u32, int, int); + virtual void clearScreen(int index, u32); + virtual float getDeadEffectRotZ(Vec3f*, bool* out); + virtual void reqCommon(float, int index); + virtual void removeCommon(int); + virtual void resetCommon(); + virtual bool isEndCommon(); + virtual bool isExistCommon(int); + virtual void reqScreen(int index); + virtual void removeScreen(int index); + virtual void setSyncVisibility(bool); + virtual bool isSyncVisibility(); + virtual void setSyncScale(bool); + virtual bool isSyncScale(); + virtual void setShieldEffect(int); + virtual void ignoreScaleZ(bool); + + virtual bool notifyEventCollisionShieldCheck(); + virtual void notifyEventDestructInstance(soModuleAccesser* moduleAccesser); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual void notifyEventCollisionShield(soCollisionAttackModule* attackModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser, float power, float posX, float); + virtual void notifyEventCollisionShieldSearch(soCollisionSearchModule* searchModule, soCollisionLog* collisionLog, u32 groupIndex, soModuleAccesser* moduleAccesser); + virtual bool isObserv(char unk1); +}; +static_assert(sizeof(soEffectModuleImpl) == 0x138, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_screen.h b/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_screen.h new file mode 100644 index 0000000000..59a125b4b6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/effect/so_effect_screen.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +class soEffectScreen { +public: + void notifyEventAnimCmd(const acAnimCmd* cmd, soModuleAccesser* accessor); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_manage_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_manage_module_impl.h new file mode 100644 index 0000000000..cddb6dc9d2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_manage_module_impl.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include + +class soEventManageModule : public soNullable, public soEventManager { +public: + virtual s16 addUnit(soEventUnit*); + virtual void eraseUnit(u32); + virtual bool isNullUnit(u32); + virtual void eraseObserver(u32, int); + virtual u32 getObserverCapacity(u32 index); + virtual u32 getObserverSize(u32 index); + virtual bool isExist(short); + virtual s16 getManageId(); + virtual soEventUnit* getEventUnit(short); +}; +static_assert(sizeof(soEventManageModule) == 12, "Class is wrong size!"); + +class soEventManageModuleImpl : public soEventManageModule { +public: + void* m_12; + short m_manageId; + short _pad; + + virtual s16 addUnit(soEventUnit*); + virtual void eraseUnit(u32); + virtual bool isNullUnit(u32); + virtual void eraseObserver(u32, int); + virtual u32 getObserverCapacity(u32 index); + virtual u32 getObserverSize(u32 index); + virtual bool isExist(short); + virtual s16 getManageId(); + virtual soEventUnit* getEventUnit(short); + + soEventManageModuleImpl(void* p1); // TODO p1 type + + // UBFIX this should have been virtual + ~soEventManageModuleImpl(); +}; +static_assert(sizeof(soEventManageModuleImpl) == 20, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_presenter.h new file mode 100644 index 0000000000..dc25d719ab --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_presenter.h @@ -0,0 +1,266 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; +class StageObject; + +template +class soEventObserver { + s16 addObserverPrivate(s32 manageId, T* obsvr, s8 p3) { + soEventManager* evtMgr = soEventSystem::getInstance()-> + getManager(manageId); + if (!evtMgr->getObserverCapacity(obsvr->m_unitID)) + return -1; + soEventUnitWrapper* evt = dynamic_cast*>( + evtMgr->getEventUnit(obsvr->m_unitID)); + if (!evt) + return -1; + s16 res = evt->addObserverSub(obsvr, p3); + return res; + } + +public: + virtual void addObserver(s16 param1, s8 param2) { } + s16 m_manageID; + s16 m_unitID; + s16 m_sendID; + + s32 getObserverId() const { return m_sendID; } + + soEventObserver(s16 unitID) { + m_manageID = -1; + m_unitID = unitID; + m_sendID = -1; + } + + void removeObserver(s16 manageId) { + const soInstanceManager &instMgr = + soEventSystem::getInstance()->getInstanceManager(); + if (instMgr.isContain(manageId) == true) { + soEventSystem::getInstance()->getManager(m_manageID) + ->eraseObserver(m_unitID, m_sendID); + } + m_sendID = -1; + m_manageID = -1; + } + + ~soEventObserver() { + removeObserver(m_manageID); + } + + void addObserverSub(s32 manageId, T* obsvr, s8 p3) { + bool check4 = false; + bool check3 = false; + bool check2 = false; + bool check1 = false; + s32 removeID; + s32 checkID = m_manageID; + + if (m_manageID >= 0 && m_unitID >= 0) + check1 = true; + if (check1 && m_sendID > -1) + check2 = true; + if (check2 && soEventSystem::getInstance()->getInstanceManager(). + isContain(checkID) == true) + check3 = true; + if (check3 && soEventSystem::getInstance()->getManager(m_manageID)-> + getObserverCapacity(m_unitID) == 1) + check4 = true; + if (check4 == true) { + removeID = m_manageID; + removeObserver(removeID); + } + if (manageId <= -1 || m_unitID <= -1 || + soEventSystem::getInstance()->getInstanceManager(). + isContain(manageId) == false) + return; + soEventManager* eventManager = soEventSystem::getInstance()-> + getManager(manageId); + if (eventManager->isNullUnit(m_unitID) != true) { + m_sendID = addObserverPrivate(manageId, obsvr, p3); + if (m_sendID > -1 && m_sendID > -1) + m_manageID = manageId; + } + } + + void initialize(s16 param1, s8 param2) { + addObserver(param1, param2); + } + + void setupObserver(s16 manageId) { + bool bVar5 = false; + bool bVar4 = false; + bool bVar3 = false; + bool bVar2 = false; + if (-1 < m_manageID && -1 < m_unitID) { + bVar2 = true; + } + if (bVar2 && -1 < m_sendID) { + bVar3 = true; + } + if (bVar3) { + if (soEventSystem::getInstance()->m_instanceManager.isContain(this->m_manageID)) { + bVar4 = true; + } + } + if (bVar4) { + if (soEventSystem::getInstance()->getManager(this->m_manageID)->isExist(m_unitID)) { + bVar5 = true; + } + } + if (bVar5) { + if (soEventSystem::getInstance()->m_instanceManager.isContain(this->m_manageID)) { + soEventSystem::getInstance()->getManager(this->m_manageID)->eraseObserver(m_unitID, m_sendID); + } + m_sendID = -1; + m_manageID = -1; + } + if (-1 < manageId && -1 < m_unitID) { + if (soEventSystem::getInstance()->m_instanceManager.isContain(manageId)) { + soEventManager* eventManager = soEventSystem::getInstance()->getManager(manageId); + if (!eventManager->isNullUnit(m_unitID)) { + int sendId; + if (eventManager->isExist(m_unitID)) { + soEventUnitWrapper* eventUnit = dynamic_cast*>(eventManager->getEventUnit(m_unitID)); + if (eventUnit == NULL) { + sendId = -1; + } + else { + sendId = eventUnit->addObserverSub(static_cast(this), -1); + } + } + else { + sendId = -1; + } + this->m_sendID = sendId; + if (-1 < sendId) { + this->m_manageID = manageId; + } + } + } + } + } +}; +static_assert(sizeof(soEventObserver) == 0xC, "Class is wrong size!"); + +template +class soEventPresenter { + static soInstanceManagerFullPropertyNull g_nullObserverList; + + bool getObserverListHelper2() { + soEventManager* mgr; + s16 uid = m_unitID; + mgr = soEventSystem::getInstance()->getManager(m_manageID); + + if (mgr->getObserverCapacity(uid) == 0) + return false; + soEventUnitWrapper* evtUnitWrapper = + dynamic_cast* >(mgr->getEventUnit(uid)); + if (!evtUnitWrapper) + return false; + m_obsrvrList = evtUnitWrapper->getObserverListSub(); + return m_obsrvrList; + } + + bool checkManageId() const { + const s16 mId = m_manageID; + return soEventSystem::getInstance()->getInstanceManager().isContain(mId); + } + + bool getObserverListHelper() { + if (m_manageID <= -1 || !checkManageId()) + return false; + if (soEventSystem::getInstance()->getManager(m_manageID)->getObserverCapacity(m_unitID) == 0) { + m_obsrvrList = nullptr; + return false; + } + return getObserverListHelper2(); + } + +public: + virtual ~soEventPresenter() { } + + s16 m_manageID; + s16 m_unitID; + soInstanceManagerFullProperty* m_obsrvrList; + + void setManageId(s16 id) { + if (m_manageID != id) { + m_manageID = id; + if (id > -1) + m_obsrvrList = nullptr; + } + } + + // NONMATCHING regswap + soInstanceManagerFullProperty* getObserverList() { + if (m_manageID <= -1) + return &g_nullObserverList; + if (!(m_obsrvrList || getObserverListHelper())) + return &g_nullObserverList; + if (soEventSystem::getInstance()-> + getManager(m_manageID)-> + getObserverCapacity(m_unitID) == 0) { + m_obsrvrList = nullptr; + return &g_nullObserverList; + } + return m_obsrvrList; + } +}; + +class soEventObserverRegistrationDesc : public soNullable { +public: + soEventObserverRegistrationDesc(bool isNull) : soNullable(isNull) { } + virtual ~soEventObserverRegistrationDesc(); + virtual bool checkCollisionHit(); + virtual bool checkCollisionAttack(); + virtual bool checkCollisionCatch(); + virtual bool checkGimmick(); + virtual bool checkStatus(); + virtual bool checkAnimCmd(); + virtual bool checkDamage(); + virtual bool checkLink(); + virtual bool checkSituation(); + virtual bool checkModel(); + virtual bool checkMotion(); + virtual bool checkArticle(); + virtual bool checkItemManage(); + virtual bool checkCapture(); + virtual bool checkCollisionShield(); + virtual bool checkCollisionReflector(); + virtual bool checkCollisionAbsorber(); + virtual bool checkCollisionSearch(); + virtual bool checkTurn(); +}; + +class soEventObserverRegistrationDescNull : public soEventObserverRegistrationDesc { +public: + soEventObserverRegistrationDescNull() : soEventObserverRegistrationDesc(true) { } + virtual ~soEventObserverRegistrationDescNull() { } + virtual bool checkCollisionHit() { return true; } + virtual bool checkCollisionAttack() { return true; } + virtual bool checkCollisionCatch() { return true; } + virtual bool checkGimmick() { return true; } + virtual bool checkStatus() { return true; } + virtual bool checkAnimCmd(){ return true; } + virtual bool checkDamage(){ return true; } + virtual bool checkLink() { return true; } + virtual bool checkSituation() { return true; } + virtual bool checkModel() { return true; } + virtual bool checkMotion() { return true; } + virtual bool checkArticle() { return true; } + virtual bool checkItemManage() { return true; } + virtual bool checkCapture() { return true; } + virtual bool checkCollisionShield() { return true; } + virtual bool checkCollisionReflector() { return true; } + virtual bool checkCollisionAbsorber() { return true; } + virtual bool checkCollisionSearch() { return true; } + virtual bool checkTurn() { return true; } +}; + +extern soEventObserverRegistrationDescNull g_soEventObserverRegistrationDescNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_system.h b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_system.h new file mode 100644 index 0000000000..fc682e2dce --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_event_system.h @@ -0,0 +1,131 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soEventUnit : public soNullableInterface { +public: + virtual void eraseObserver(s16 id, s16 sendID) = 0; + virtual s16 getEventId() = 0; + virtual u32 getObserverCapacity(u32 index) = 0; + virtual u32 getObserverSize(u32 index) = 0; + virtual ~soEventUnit() { } +}; + +class soEventManager { +public: + virtual s16 addUnit(soEventUnit*); + virtual void eraseUnit(u32); + virtual bool isNullUnit(u32); + virtual void eraseObserver(s16 id, s16 sendID); + virtual u32 getObserverCapacity(u32 index); + virtual u32 getObserverSize(u32 index); + virtual bool isExist(short); + virtual s16 getManageId(); + virtual soEventUnit* getEventUnit(short); +}; + +class soEventSystem { +public: + soInstanceManagerSimpleEntity, 500 > > m_instanceManager; + + soEventManager* getManager(s32 manageID); + static soEventSystem* getInstance(); + soInstanceManager& getInstanceManager() { return m_instanceManager; } + +}; +static_assert(sizeof(soEventSystem) == 4032, "Class is wrong size!"); + +template +class soEventUnitWrapper : public soEventUnit { +public: + virtual s16 getEventId() { return m_eventID; } + virtual ~soEventUnitWrapper() { + if (isValid()) + soEventSystem::getInstance()->getManager(m_managerID)->eraseUnit(m_eventID); + } + virtual s16 addObserverSub(T*, s8) = 0; + virtual soInstanceManagerFullProperty* getObserverListSub() = 0; + + soEventUnitWrapper(s16 mgrId, s16 p2) : m_managerID(mgrId), m_eventID(p2) { + if (mgrId != -1) { + s16 eid = soEventSystem::getInstance()->getManager(m_managerID)->addUnit(this); + if (eid > -1) + m_eventID = eid; + } + } + + bool isValid() const { return m_managerID != -1; } + + s16 m_managerID; + s16 m_eventID; +}; + +template +class soEventUnitNull : public soEventUnitWrapper { +public: + virtual bool isNull() const { + return true; + } + + soEventUnitNull(s16 mgrId, s16 p2) : soEventUnitWrapper(mgrId, p2) { } +}; + +template +class soEventUnitImpl : public soEventUnitWrapper { +public: + soInstanceManagerFullProperty* m_observerListPtr; // 0x8 + + virtual bool isNull() const { + return false; + } + + virtual void eraseObserver(s16 id, s16 sendID) { + m_observerListPtr->erase(id); + } + + // TODO: shouldn't need index + virtual u32 getObserverCapacity(u32 index) { + return m_observerListPtr->capacity(); + } + + // TODO: shouldn't need index + virtual u32 getObserverSize(u32 index) { + return m_observerListPtr->size(); + } + + virtual ~soEventUnitImpl() { } + + virtual s16 addObserverSub(T* obsvr, s8 p2) { + return m_observerListPtr->add(obsvr, -1, soAttributeFlag(), p2); + } + + virtual soInstanceManagerFullProperty* getObserverListSub() { + return m_observerListPtr; + } + + virtual u32 getObserverNum() const = 0; + + soEventUnitImpl(s16 mgrId, s16 p2) : soEventUnitWrapper(mgrId, p2) { + m_observerListPtr = reinterpret_cast*>( + reinterpret_cast(this) + + sizeof(soEventUnitImpl)); + } +}; + +template +class soEventUnitWithWorkArea : public soEventUnitImpl { + soInstanceManagerFullPropertyVector m_observerList; // 0xC +public: + soEventUnitWithWorkArea(s16 mgrId, s16 p2) : + soEventUnitImpl(mgrId, p2) { } + + virtual ~soEventUnitWithWorkArea() { } + virtual u32 getObserverNum() const { + return m_observerList.size(); + } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/event/so_gimmick_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_gimmick_event_presenter.h new file mode 100644 index 0000000000..7b0571ab4e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_gimmick_event_presenter.h @@ -0,0 +1,234 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace Gimmick { + enum EventKind { + Barrel_Event_In = 0x2, + Barrel_Event_Shoot_Trigger = 0x3, + Barrel_Event_Shoot = 0x4, + Barrel_Event_Set_Speed = 0x5, + Barrel_Event_Set_Path = 0x6, + Barrel_Event_End_Path = 0x7, + Barrel_Event_Break = 0x8, + Barrel_Event_Pos = 0x9, + + Catapult_Event_On = 0xC, + Catapult_Event_Shoot = 0xD, + Catapult_Event_Pos = 0xE, + + Door_Event_In = 0x11, + + Ladder_Event_Get_Info = 0x14, + + Spring_Event_On = 0x17, + Spring_Event_Shoot = 0x18, + Spring_Event_Pos = 0x19, + + Truck_Event_In = 0x1C, + Truck_Event_Ride = 0x1D, + Truck_Event_Exit = 0x1E, + Truck_Event_Start_Run = 0x1F, + Truck_Event_Pos = 0x20, + Truck_Event_Crash = 0x21, + + Chappy_Event_In = 0x27, + Chappy_Event_Pos = 0x28, + + Elevator_Event_On = 0x2b, + Elevator_Event_Up = 0x2c, + Elevator_Event_Down = 0x2d, + + Event_Boot = 0x32, + Event_Exit = 0x33, + Event_Disable = 0x34, + }; +} + + +struct soGimmickEventArgs { + Gimmick::EventKind m_kind; + int m_sendID; +protected: + inline soGimmickEventArgs(Gimmick::EventKind kind, int sendID) : m_kind(kind), m_sendID(sendID) {} +}; + +struct soGimmickSpringEventArgs : soGimmickEventArgs { + Vec3f m_topPos; + float m_bounce; + float m_rot; +protected: + inline soGimmickSpringEventArgs(Gimmick::EventKind kind, int sendID) : soGimmickEventArgs(kind, sendID) {} + inline soGimmickSpringEventArgs(Gimmick::EventKind kind, int sendID, Vec3f topPos, float bounce, float rot) : soGimmickEventArgs(kind, sendID), m_topPos(topPos), m_bounce(bounce), m_rot(rot) {} + inline soGimmickSpringEventArgs(Gimmick::EventKind kind, int sendID, Vec3f topPos) : soGimmickEventArgs(kind, sendID), m_topPos(topPos) {} +}; +struct soGimmickSpringEventArgs_On : soGimmickSpringEventArgs { + inline soGimmickSpringEventArgs_On() : soGimmickSpringEventArgs(Gimmick::Spring_Event_On, 0) {} +}; +struct soGimmickSpringEventArgs_Shoot : soGimmickSpringEventArgs { + inline soGimmickSpringEventArgs_Shoot(Vec3f topPos, float bounce, float rot) : soGimmickSpringEventArgs(Gimmick::Spring_Event_Shoot, 0, topPos, bounce, rot) {} +}; +struct soGimmickSpringEventArgs_Pos : soGimmickSpringEventArgs { + inline soGimmickSpringEventArgs_Pos(Vec3f topPos) : soGimmickSpringEventArgs(Gimmick::Spring_Event_Pos, 0, topPos) {} +}; + +struct soGimmickLadderEventArgs : soGimmickEventArgs { + Vec3f m_upperNodePos; + Vec3f m_underNodePos; + bool m_restrictUpExit; + bool m_33; +protected: + inline soGimmickLadderEventArgs(Gimmick::EventKind kind, int sendID) : soGimmickEventArgs(kind, sendID) {}; +}; +struct soGimmickLadderEventArgs_GetInfo : soGimmickLadderEventArgs { + inline soGimmickLadderEventArgs_GetInfo() : soGimmickLadderEventArgs(Gimmick::Ladder_Event_Get_Info, 0) {}; +}; + +struct soGimmickCatapultEventArgs : soGimmickEventArgs { + Vec2f m_pos; + float m_lr; + float m_launchSpeed; + float m_vector; +protected: + inline soGimmickCatapultEventArgs(Gimmick::EventKind kind, int sendID) : soGimmickEventArgs(kind, sendID) {} + inline soGimmickCatapultEventArgs(Gimmick::EventKind kind, int sendID, float launchSpeed, float vector) : soGimmickEventArgs(kind, sendID), m_launchSpeed(launchSpeed), m_vector(vector) {} + inline soGimmickCatapultEventArgs(Gimmick::EventKind kind, int sendID, Vec2f pos, float lr) : soGimmickEventArgs(kind, sendID), m_pos(pos), m_lr(lr) {} +}; +struct soGimmickCatapultEventArgs_On : soGimmickCatapultEventArgs { + inline soGimmickCatapultEventArgs_On() : soGimmickCatapultEventArgs(Gimmick::Catapult_Event_On, 0) {} +}; +struct soGimmickCatapultEventArgs_Shoot : soGimmickCatapultEventArgs { + inline soGimmickCatapultEventArgs_Shoot(float launchSpeed, float vector) : soGimmickCatapultEventArgs(Gimmick::Catapult_Event_Shoot, 0, launchSpeed, vector) {}; +}; +struct soGimmickCatapultEventArgs_Pos : soGimmickCatapultEventArgs { + inline soGimmickCatapultEventArgs_Pos(Vec2f pos, float lr) : soGimmickCatapultEventArgs(Gimmick::Catapult_Event_Pos, 0, pos, lr) {}; +}; + +struct soGimmickDoorEventArgs : soGimmickEventArgs { + Vec3f m_pos; + bool m_noInto; +protected: + inline soGimmickDoorEventArgs(Gimmick::EventKind kind, int sendID) : soGimmickEventArgs(kind, sendID) {}; +}; +struct soGimmickDoorEventArgs_In : soGimmickDoorEventArgs { + inline soGimmickDoorEventArgs_In() : soGimmickDoorEventArgs(Gimmick::Door_Event_In, 0) {}; +}; + +struct soGimmickBarrelEventArgs : soGimmickEventArgs { + Vec3f m_pos; + unsigned int m_breakHitstopFrame; + soCollisionAttackData* m_attackData; + float m_shootSpeed; + float m_rot; + float m_shootTimerSpeed; + float m_shootAngleOffset; + float m_shootFallSpeed; +protected: + inline soGimmickBarrelEventArgs(Gimmick::EventKind kind, int sendID) : soGimmickEventArgs(kind, sendID) {}; + inline soGimmickBarrelEventArgs(Gimmick::EventKind kind, int sendID, Vec3f pos, soCollisionAttackData* attackData) : soGimmickEventArgs(kind, sendID), m_pos(pos), m_attackData(attackData) {}; + inline soGimmickBarrelEventArgs(Gimmick::EventKind kind, int sendID, Vec3f pos, soCollisionAttackData* attackData, float rot) : soGimmickEventArgs(kind, sendID), m_pos(pos), m_attackData(attackData), m_rot(rot) {}; + inline soGimmickBarrelEventArgs(Gimmick::EventKind kind, int sendID, Vec3f pos, soCollisionAttackData* attackData, float rot, float shootSpeed, float shootTimerSpeed, float shootAngleoffset, float shootStunTimerSpeed) : soGimmickEventArgs(kind, sendID), m_pos(pos), m_attackData(attackData), m_rot(rot), m_shootSpeed(shootSpeed), m_shootTimerSpeed(shootTimerSpeed), m_shootAngleOffset(shootAngleoffset), m_shootFallSpeed(shootStunTimerSpeed) {}; +}; +struct soGimmickBarrelEventArgs_In : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_In() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_In, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; +}; +struct soGimmickBarrelEventArgs_ShootTrigger : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_ShootTrigger() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Shoot_Trigger, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; +}; +struct soGimmickBarrelEventArgs_Shoot: soGimmickBarrelEventArgs { + //inline soGimmickBarrelEventArgs_Shoot() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Shoot, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; + inline soGimmickBarrelEventArgs_Shoot(Vec3f pos, soCollisionAttackData* attackData, float rot) : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Shoot, 0, pos, attackData, rot) {}; +}; +struct soGimmickBarrelEventArgs_SetSpeed : soGimmickBarrelEventArgs { + //inline soGimmickBarrelEventArgs_SetSpeed() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Set_Speed, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; + inline soGimmickBarrelEventArgs_SetSpeed(float rot, float shootSpeed, float shootTimerSpeed, float shootAngleOffset, float shootStunTimerSpeed) : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Set_Speed, 0, Vec3f(0.0, 0.0, 0.0), NULL, rot, shootSpeed, shootTimerSpeed, shootAngleOffset, shootStunTimerSpeed) {}; +}; +struct soGimmickBarrelEventArgs_SetPath : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_SetPath(Vec3f pos) : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Set_Path, 0, pos, NULL) {}; +}; +struct soGimmickBarrelEventArgs_EndPath : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_EndPath() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_End_Path, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; +}; +struct soGimmickBarrelEventArgs_Break : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_Break() : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Break, 0, Vec3f(0.0, 0.0, 0.0), NULL) {}; +}; +struct soGimmickBarrelEventArgs_Pos : soGimmickBarrelEventArgs { + inline soGimmickBarrelEventArgs_Pos(Vec3f pos) : soGimmickBarrelEventArgs(Gimmick::Barrel_Event_Pos, 0, pos, NULL) {}; +}; + +struct soGimmickElevatorEventArgs_On : soGimmickEventArgs { + bool m_canGoUp; + bool m_canGoDown; + inline soGimmickElevatorEventArgs_On() : soGimmickEventArgs(Gimmick::Elevator_Event_On, 0), m_canGoUp(false), m_canGoDown(false) {}; +}; +struct soGimmickElevatorEventArgs_Up : soGimmickEventArgs { + inline soGimmickElevatorEventArgs_Up() : soGimmickEventArgs(Gimmick::Elevator_Event_Up, 0) {}; +}; +struct soGimmickElevatorEventArgs_Down : soGimmickEventArgs { + inline soGimmickElevatorEventArgs_Down() : soGimmickEventArgs(Gimmick::Elevator_Event_Down, 0) {}; +}; + +struct soGimmickTruckEventArgs : soGimmickEventArgs { + Vec3f m_pos; + Vec2f m_stick; +protected: + inline soGimmickTruckEventArgs(Gimmick::EventKind eventKind, int sendID, Vec3f pos) : soGimmickEventArgs(eventKind, sendID), m_pos(pos) {}; + inline soGimmickTruckEventArgs(Gimmick::EventKind eventKind, int sendID, Vec3f pos, Vec2f stick) : soGimmickEventArgs(eventKind, sendID), m_pos(pos), m_stick(stick) {}; +}; +struct soGimmickTruckEventArgs_In : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_In(Vec3f pos) : soGimmickTruckEventArgs(Gimmick::Truck_Event_In, 0, pos) {}; +}; +struct soGimmickTruckEventArgs_Ride : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_Ride(Vec2f stick) : soGimmickTruckEventArgs(Gimmick::Truck_Event_Ride, 0, Vec3f(0, 0, 0), stick) {}; +}; +struct soGimmickTruckEventArgs_Exit : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_Exit() : soGimmickTruckEventArgs(Gimmick::Truck_Event_Exit, 0, Vec3f(0, 0, 0)) {}; +}; +struct soGimmickTruckEventArgs_StartRun : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_StartRun() : soGimmickTruckEventArgs(Gimmick::Truck_Event_Start_Run, 0, Vec3f(0, 0, 0)) {}; +}; +struct soGimmickTruckEventArgs_Pos : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_Pos(Vec3f pos) : soGimmickTruckEventArgs(Gimmick::Truck_Event_Pos, 0, pos) {}; +}; +struct soGimmickTruckEventArgs_Crash : soGimmickTruckEventArgs { + inline soGimmickTruckEventArgs_Crash() : soGimmickTruckEventArgs(Gimmick::Truck_Event_Crash, 0, Vec3f(0, 0, 0)) {}; +}; + +struct soGimmickChappyEventArgs : soGimmickEventArgs { + Vec3f m_pos; +protected: + inline soGimmickChappyEventArgs(Gimmick::EventKind eventKind, int sendID) : soGimmickEventArgs(eventKind, sendID) {}; + inline soGimmickChappyEventArgs(Gimmick::EventKind eventKind, int sendID, Vec3f pos) : soGimmickEventArgs(eventKind, sendID), m_pos(pos) {}; +}; +struct soGimmickChappyEventArgs_In : soGimmickChappyEventArgs { + inline soGimmickChappyEventArgs_In() : soGimmickChappyEventArgs(Gimmick::Chappy_Event_In, 0) {}; +}; +struct soGimmickChappyEventArgs_Pos : soGimmickChappyEventArgs { + inline soGimmickChappyEventArgs_Pos(Vec3f pos) : soGimmickChappyEventArgs(Gimmick::Chappy_Event_Pos, 0, pos) {}; +}; + +struct soGimmickEventArgs_Exit : soGimmickEventArgs { + inline soGimmickEventArgs_Exit() : soGimmickEventArgs(Gimmick::Event_Exit, 0) {} +}; +struct soGimmickEventArgs_Boot : soGimmickEventArgs { + inline soGimmickEventArgs_Boot() : soGimmickEventArgs(Gimmick::Event_Boot, 0) {} +}; +struct soGimmickEventArgs_Disable : soGimmickEventArgs { + inline soGimmickEventArgs_Disable() : soGimmickEventArgs(Gimmick::Event_Disable, 0) {} +}; + +class soGimmickEventObserver : public soEventObserver { +public: + soGimmickEventObserver() : soEventObserver(0x3) {}; + soGimmickEventObserver(short unitID) : soEventObserver(unitID) {}; + soGimmickEventObserver(short param1, s8 param2); + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventGimmick(soGimmickEventArgs* eventInfo, int* taskId); +}; +static_assert(sizeof(soGimmickEventObserver) == 12, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/event/so_log_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_log_event_presenter.h new file mode 100644 index 0000000000..1943ae0095 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/event/so_log_event_presenter.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class soLogEventObserver : public soEventObserver { +public: + virtual void addObserver(short param1, s8 param2); + virtual void notifyLogEventCollisionHit(float, int taskId1, int taskId2, int); + virtual void notifyLogEventGroundDamage(); // TODO + virtual void notifyLogEventDead(int entryId1, int entryId2, int, int); + char _spacer1[2]; +}; +static_assert(sizeof(soLogEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_module_impl.h new file mode 100644 index 0000000000..aaa1450c7f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_module_impl.h @@ -0,0 +1,357 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; +class StageObject; + +class soGroundConditionChecker { +public: + virtual ~soGroundConditionChecker() { } + virtual bool isConditionNoCliffStop(soModuleAccesser* moduleAccesser) = 0; +}; + +class soGroundModule : public soNull, public soNullable { + +public: + virtual ~soGroundModule(); + virtual void setup(void*, int taskId, bool); + virtual void clean(); + virtual void constructGrCollision(int, int, Heaps::HeapType, u8, u8, u8); + virtual void activate(int taskId, Vec2f*); + virtual void deactivate(); + virtual void relocate(Vec2f*, u32 index); + virtual void begin(); + virtual void update(u32); + virtual void processFixPosition(); + virtual float getRotateYForGrCollisionMatrix(); + virtual void updateCheckGrCollision(); + virtual void updateGrCollisionMatrix(); + virtual void pause(bool); + virtual void apply(); + virtual bool isReferenceModelNode(); + virtual void setCorrect(soGroundShapeImpl::CorrectKind correct, u32 index); + virtual soGroundShapeImpl::CorrectKind getCorrect(u32 index); + virtual void setCalcLineMove(bool calcLineMove, u32 index); + virtual void setTargetLineCategory(grCollisionLine::CategoryMask targetLineCategory, u32 index); + virtual void setExclusiveLineAttr(short exclusiveLineAttr, u32 index); + virtual void setPassableCheck(bool passableCheck, u32 index); + virtual bool isPassableCheck(u32 index); + virtual void setCloudThrough(bool cloudThrough, u32 index); + virtual bool isCloudThrough(u32 index); + virtual bool isCloudThroughOut(Vec2f* out, u32 index); + virtual void setCorrectIgnoreSlope(u8 correctIgnoreSlope, u32 index); + virtual void setCliffCheck(soGroundShapeImpl::CliffCheckKind, u32 index); + virtual void setCliffHangData(void*); + virtual void selectCliffHangData(u32 i, u32 index); + virtual void setCliffBackRangeXMul(float cliffBackRangeXMul); + virtual bool isStCliff(u32 index); + virtual Vec3f getCorrectPos(u32 index); + virtual void setCliffTeam(u8 cliffTeam, u32 index); + virtual void entryCliff(u32 index); + virtual void leaveCliff(u32 index); + virtual Vec3f getCliffPos(u32 index); + virtual float getCliffDir(u32 index); + virtual void setStGroundForce(u32 index); + virtual void setTestCollStop(bool testCollStop, u32 index); + virtual void setTestCollStopStatus(bool testCollStop, u32 index); + virtual void setTestPreMap(bool testPreMap, u32 index); + virtual void setTestPreMapStatus(bool testPreMap, u32 index); + virtual void setTestDynamicCollisionStatus(bool testDynamicCollision, u32 index); + virtual void setTestDynamicCollision(bool testDynamicCollision, u32 index); + virtual void setEventToGround(bool eventToGround, u32 index); + virtual void setEventToGroundStatus(bool eventToGround, u32 index); + virtual grCollStatus* getCollStatus(u32 index); + virtual bool isOttotto(float, u32 index); + virtual bool isNearCliff(float, float, u32 index); + virtual bool isMissStepR(u32 index); + virtual bool isMissStepL(u32 index); + virtual bool isTouch(grCollStatus::TouchMask, u32 index); + virtual u8 getTouchCount(u32 index); + virtual Vec2f getTouchNormal(grCollStatus::TouchMask, u32 index); + virtual Vec2f getTouchSpeed(grCollStatus::TouchMask, u32 index); + virtual Vec2f getAttachMovementSpeed(u32 index); + virtual Vec2f getAttachNormal(u32 index); + virtual grCollStatus::TouchMask getTouchFlag(u32 index); + virtual grCollisionLine::MaterialType getTouchMaterialType(grCollStatus::TouchMask, u32 index); + virtual Vec2f getTouchPos(grCollStatus::TouchMask, u32 index); + virtual bool getTouchAttackData(soCollisionAttackData* outAttackData, int* out2, int* out3, u32 index); + virtual float getTouchLength(grCollStatus::TouchMask, u32 index); + virtual float getTouchLineRate(grCollStatus::TouchMask, u32 index); + virtual bool getTouchNextNormal(bool getNext, Vec2f* outNormal, grCollStatus::TouchMask, u32 index); + virtual void ignoreTouchLine(grCollStatus::TouchMask, u32 index); + virtual bool isDiveDown(u32 index); + virtual bool isCrush(float, u32 index); + virtual bool isOnDynamicCollision(u32 index); + virtual u32 getDownLineId(u32 index); + virtual u32 getRightLineId(u32 index); + virtual u32 getLeftLineId(u32 index); + virtual u32 getUpLineId(u32 index); + virtual u32 getDownLeftLineId(u32 index); + virtual u32 getDownRightLineId(u32 index); + virtual u32 getUpLeftLineId(u32 index); + virtual u32 getUpRightLineId(u32 index); + virtual u32 getCliffId(u32 index); + virtual bool isSameJoint(int*, int*); + virtual Vec2f getUpPos(u32 index); + virtual Vec2f getDownPos(u32 index); + virtual Vec2f getLeftPos(u32 index); + virtual Vec2f getRightPos(u32 index); + virtual Vec2f getCenterPos(u32 index); + virtual float getWidth(u32 index); + virtual Vec2f getDownMovementSpeed(u32 index); + virtual bool getDownCorrectPos(Vec3f*, Vec3f*, u32 index); + virtual float getDownFriction(u32 index); + virtual bool isCliffOver(u8, u32 index); + virtual bool isCliffOverPos(Vec2f* pos, u8, u32 index); + virtual void initRhombus(u32 index); + virtual void modifyRhombus(float newRhombusUp, float newRhombusDown, float newRhombusWidth, u32 index); + virtual void modifyRhombusUp(float newRhombusUp, u32 index); + virtual void modifyRhombusDown(float newRhombusDown, u32 index); + virtual void modifyRhombusWidth(float newRhombusWidth, u32 index); + virtual void modifyRhombusFollowNode(float newRhombusUp, float newRhombusDown, float newRhombusWidth, int newRhombusFollowNode, u32 index); + virtual void getRhombus(float* outRhombusUp, float* outRhombusDown, float* outRhombusWidth, u32 index); + virtual void getRhombus(float* outRhombusUp, float* outRhombusDown, float* outRhombusWidth, int* outRhombusFollowNode, u32 index); + virtual void getRhombus(clRhombus2D* outPrevCollShape, clRhombus2D* outCurrentCollShape, u32 index); + virtual void calcRhombusModify(float* out1, float* out2, float* out3, float* out4, u32 index); + virtual void setOffsetX(float offsetX, u32 index); + virtual void setOffsetY(float offsetY, u32 index); + virtual void setShapeFlag(soGroundShapeImpl::ShapeFlagId flag, bool setFlag, u32 index); + virtual bool checkShapeFlag(soGroundShapeImpl::ShapeFlagId flag, u32 index); + virtual void setShapeSafePos(Vec2f* safePos, u32 index); + virtual void setShapeKind(soGroundShapeImpl::ShapeKind shapeKind, u32 index); + virtual bool isPassableGround(u32 index); + virtual void setZ(float Z); + virtual float getZ(); + virtual bool attachGround(u32 index); + virtual bool isAttachable(u8, u32 index); + virtual void attach(u8, u32 index); + virtual bool isAttach(u32 index); + virtual void detach(u32 index); + virtual void setAttackPoint(bool, bool, bool, bool, bool, u32 index); + virtual void getAttackPointBreak(bool*, bool*, bool*, bool*, u32 index); + virtual void test(u32 index); + virtual bool rayCheckTarget(StageObject* stageobject, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, Vec3f* out1, Vec3f* out2, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, int* out0, Vec3f* out1, Vec3f* out2, bool); + virtual float getDistanceFromUnderGrCol(float, Vec3f*, u8); + virtual grCollision* getGrCollision(); + virtual bool isEnableGrCollision(); + virtual void setGrCollisionMode(bool); + virtual short getGrCollisionVertexNum(); + virtual void initGrCollisionVertexPos(u16 vtxPosIndex, Vec2f* vertexPo); + virtual void setGrCollisionVertexPos(u16 vtxPosIndex, Vec2f* vertexPos); + virtual void setGrCollisionFlagAll(u16, int); + virtual void setGrCollisionFlagDefaultAll(); + virtual void renderDebug(); + virtual bool isTraced(); + virtual bool canTraceStart(u8, u32, u32 index, float); + virtual bool startTrace(u8, u32, u32 index, u8, float, float, float); + virtual Vec2f getTraceTargetVec(u32 index, float); + virtual Vec2f getTraceTargetPosturePos(u32 index, float); + virtual bool isTraceArrived(u32 index, float); + virtual bool canIntercept(u8, u32, u32 index, float); + virtual bool renewTrace(u8, u32, u32 index, float, float); + virtual void endTrace(u32 index); + virtual Vec2f getTraceGroundMovementSpeed(); + virtual float getTraceDistanceFromLine(u32 index); + virtual Vec2f getTraceVecFromLine(u32 index); + virtual bool isSameNormalTraceLineCurrentAndNext(u32); + virtual bool isOpenTraceLineCurrentAndNext(u32); + virtual bool isTouchTraceLine(u32 index); + virtual void updateTrace(bool, u32 index); + virtual void testGround(u32 index); + virtual soGroundConditionChecker* getConditionChecker(); + virtual void setIgnoreFriction(bool); + virtual void setDetachChangeStatus(bool); +}; +static_assert(sizeof(soGroundModule) == 12, "Class is wrong size!"); + +class soGroundModuleImpl : public soGroundModule, public soStatusEventObserver, public soAnimCmdEventObserver, public grCollStatusEventReceiver { +public: + soArray* m_groundShapeArray; + grCollData* m_collData; + grCollision* m_collision; + int m_52; + u8 m_56; + char _57[3]; + void* m_cliffHangData; + float m_cliffBackRangeXMul; + soGroundTracer* m_groundTracer; + soGroundConditionChecker* m_groundConditionChecker; + float m_Z; + u8 m_80; + char _81[3]; + soModuleAccesser* m_moduleAccesser; + + virtual ~soGroundModuleImpl(); + virtual void setup(void*, int taskId, bool); + virtual void clean(); + virtual void constructGrCollision(int, int, Heaps::HeapType, u8, u8, u8); + virtual void activate(int taskId, Vec2f*); + virtual void deactivate(); + virtual void relocate(Vec2f*, u32 index); + virtual void begin(); + virtual void update(u32); + virtual void processFixPosition(); + virtual float getRotateYForGrCollisionMatrix(); + virtual void updateCheckGrCollision(); + virtual void updateGrCollisionMatrix(); + virtual void pause(bool); + virtual void apply(); + virtual bool isReferenceModelNode(); + virtual void setCorrect(soGroundShapeImpl::CorrectKind correct, u32 index); + virtual soGroundShapeImpl::CorrectKind getCorrect(u32 index); + virtual void setCalcLineMove(bool calcLineMove, u32 index); + virtual void setTargetLineCategory(grCollisionLine::CategoryMask targetLineCategory, u32 index); + virtual void setExclusiveLineAttr(short exclusiveLineAttr, u32 index); + virtual void setPassableCheck(bool passableCheck, u32 index); + virtual bool isPassableCheck(u32 index); + virtual void setCloudThrough(bool cloudThrough, u32 index); + virtual bool isCloudThrough(u32 index); + virtual bool isCloudThroughOut(Vec2f* out, u32 index); + virtual void setCorrectIgnoreSlope(u8 correctIgnoreSlope, u32 index); + virtual void setCliffCheck(soGroundShapeImpl::CliffCheckKind cliffCheck, u32 index); + virtual void setCliffHangData(void*); + virtual void selectCliffHangData(u32 i, u32 index); + virtual void setCliffBackRangeXMul(float cliffBackRangeXMul); + virtual bool isStCliff(u32 index); + virtual Vec3f getCorrectPos(u32 index); + virtual void setCliffTeam(u8 cliffTeam, u32 index); + virtual void entryCliff(u32 index); + virtual void leaveCliff(u32 index); + virtual Vec3f getCliffPos(u32 index); + virtual float getCliffDir(u32 index); + virtual void setStGroundForce(u32 index); + virtual void setTestCollStop(bool testCollStop, u32 index); + virtual void setTestCollStopStatus(bool testCollStop, u32 index); + virtual void setTestPreMap(bool testPreMap, u32 index); + virtual void setTestPreMapStatus(bool testPreMap, u32 index); + virtual void setTestDynamicCollisionStatus(bool testDynamicCollision, u32 index); + virtual void setTestDynamicCollision(bool testDynamicCollision, u32 index); + virtual void setEventToGround(bool eventToGround, u32 index); + virtual void setEventToGroundStatus(bool eventToGround, u32 index); + virtual grCollStatus* getCollStatus(u32 index); + virtual bool isOttotto(float, u32 index); + virtual bool isNearCliff(float, float, u32 index); + virtual bool isMissStepR(u32 index); + virtual bool isMissStepL(u32 index); + virtual bool isTouch(grCollStatus::TouchMask, u32 index); + virtual u8 getTouchCount(u32 index); + virtual Vec2f getTouchNormal(grCollStatus::TouchMask, u32 index); + virtual Vec2f getTouchSpeed(grCollStatus::TouchMask, u32 index); + virtual Vec2f getAttachMovementSpeed(u32 index); + virtual Vec2f getAttachNormal(u32 index); + virtual grCollStatus::TouchMask getTouchFlag(u32 index); + virtual grCollisionLine::MaterialType getTouchMaterialType(grCollStatus::TouchMask, u32 index); + virtual Vec2f getTouchPos(grCollStatus::TouchMask, u32 index); + virtual bool getTouchAttackData(soCollisionAttackData* outAttackData, int* out2, int* out3, u32 index); + virtual float getTouchLength(grCollStatus::TouchMask, u32 index); + virtual float getTouchLineRate(grCollStatus::TouchMask, u32 index); + virtual bool getTouchNextNormal(bool getNext, Vec2f* outNormal, grCollStatus::TouchMask, u32 index); + virtual void ignoreTouchLine(grCollStatus::TouchMask, u32 index); + virtual bool isDiveDown(u32 index); + virtual bool isCrush(float, u32 index); + virtual bool isOnDynamicCollision(u32 index); + virtual u32 getDownLineId(u32 index); + virtual u32 getRightLineId(u32 index); + virtual u32 getLeftLineId(u32 index); + virtual u32 getUpLineId(u32 index); + virtual u32 getDownLeftLineId(u32 index); + virtual u32 getDownRightLineId(u32 index); + virtual u32 getUpLeftLineId(u32 index); + virtual u32 getUpRightLineId(u32 index); + virtual u32 getCliffId(u32 index); + virtual bool isSameJoint(int*, int*); + virtual Vec2f getUpPos(u32 index); + virtual Vec2f getDownPos(u32 index); + virtual Vec2f getLeftPos(u32 index); + virtual Vec2f getRightPos(u32 index); + virtual Vec2f getCenterPos(u32 index); + virtual float getWidth(u32 index); + virtual Vec2f getDownMovementSpeed(u32 index); + virtual bool getDownCorrectPos(Vec3f*, Vec3f*, u32 index); + virtual float getDownFriction(u32 index); + virtual bool isCliffOver(u8, u32 index); + virtual bool isCliffOverPos(Vec2f* pos, u8, u32 index); + virtual void initRhombus(u32 index); + virtual void modifyRhombus(float newRhombusUp, float newRhombusDown, float newRhombusWidth, u32 index); + virtual void modifyRhombusUp(float newRhombusUp, u32 index); + virtual void modifyRhombusDown(float newRhombusDown, u32 index); + virtual void modifyRhombusWidth(float newRhombusWidth, u32 index); + virtual void modifyRhombusFollowNode(float newRhombusUp, float newRhombusDown, float newRhombusWidth, int newRhombusFollowNode, u32 index); + virtual void getRhombus(float* outRhombusUp, float* outRhombusDown, float* outRhombusWidth, u32 index); + virtual void getRhombus(float* outRhombusUp, float* outRhombusDown, float* outRhombusWidth, int* outRhombusFollowNode, u32 index); + virtual void getRhombus(clRhombus2D* outPrevCollShape, clRhombus2D* outCurrentCollShape, u32 index); + virtual void calcRhombusModify(float* out1, float* out2, float* out3, float* out4, u32 index); + virtual void setOffsetX(float offsetX, u32 index); + virtual void setOffsetY(float offsetY, u32 index); + virtual void setShapeFlag(soGroundShapeImpl::ShapeFlagId flag, bool setFlag, u32 index); + virtual bool checkShapeFlag(soGroundShapeImpl::ShapeFlagId flag, u32 index); + virtual void setShapeSafePos(Vec2f* safePos, u32 index); + virtual void setShapeKind(soGroundShapeImpl::ShapeKind shapeKind, u32 index); + virtual bool isPassableGround(u32 index); + virtual void setZ(float Z); + virtual float getZ(); + virtual bool attachGround(u32 index); + virtual bool isAttachable(u8, u32 index); + virtual void attach(u8, u32 index); + virtual bool isAttach(u32 index); + virtual void detach(u32 index); + virtual void setAttackPoint(bool, bool, bool, bool, bool, u32 index); + virtual void getAttackPointBreak(bool*, bool*, bool*, bool*, u32 index); + virtual void test(u32 index); + virtual bool rayCheckTarget(StageObject* stageobject, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, Vec3f* out1, Vec3f* out2, bool); + virtual bool rayCheck(Vec3f*, Vec3f*, int* out0, Vec3f* out1, Vec3f* out2, bool); + virtual float getDistanceFromUnderGrCol(float, Vec3f*, u8); + virtual grCollision* getGrCollision(); + virtual bool isEnableGrCollision(); + virtual void setGrCollisionMode(bool); + virtual short getGrCollisionVertexNum(); + virtual void initGrCollisionVertexPos(u16 vtxPosIndex, Vec2f* vertexPo); + virtual void setGrCollisionVertexPos(u16 vtxPosIndex, Vec2f* vertexPos); + virtual void setGrCollisionFlagAll(u16, int); + virtual void setGrCollisionFlagDefaultAll(); + virtual void renderDebug(); + virtual bool isTraced(); + virtual bool canTraceStart(u8, u32, u32 index, float); + virtual bool startTrace(u8, u32, u32 index, u8, float, float, float); + virtual Vec2f getTraceTargetVec(u32 index, float); + virtual Vec2f getTraceTargetPosturePos(u32 index, float); + virtual bool isTraceArrived(u32 index, float); + virtual bool canIntercept(u8, u32, u32 index, float); + virtual bool renewTrace(u8, u32, u32 index, float, float); + virtual void endTrace(u32 index); + virtual Vec2f getTraceGroundMovementSpeed(); + virtual float getTraceDistanceFromLine(u32 index); + virtual Vec2f getTraceVecFromLine(u32 index); + virtual bool isSameNormalTraceLineCurrentAndNext(u32); + virtual bool isOpenTraceLineCurrentAndNext(u32); + virtual bool isTouchTraceLine(u32 index); + virtual void updateTrace(bool, u32 index); + virtual void testGround(u32 index); + virtual soGroundConditionChecker* getConditionChecker(); + virtual void setIgnoreFriction(bool); + virtual void setDetachChangeStatus(bool); + + virtual void receive(int, bool); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soGroundModuleImpl) == 88, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_shape_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_shape_impl.h new file mode 100644 index 0000000000..1732e8fbbb --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_shape_impl.h @@ -0,0 +1,153 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soGroundShapeImpl { +public: + enum ShapeKind { + Shape_Rhombus_Modify = 0x0, + Shape_Rhombus = 0x1, + Shape_Rhombus_Follow_Node = 0x2, + }; + + enum ShapeFlagId { + Shape_Flag_Ground = 0x0, + Shape_Flag_Ignore_Scale = 0x1, + + Shape_Rhombus_Flag_Min_L = 0x3, + Shape_Rhombus_Flag_Min_R = 0x4, + Shape_Rhombus_Flag_Min_U = 0x5, + Shape_Rhombus_Flag_Min_D = 0x6, + + Shape_Rhombus_Modify_Flag_Fix = 0x3, + Shape_Rhombus_Modify_Flag_No_OFS = 0x4, + Shape_Rhombus_Modify_Flag_Min_U = 0x5, + Shape_Rhombus_Modify_Flag_Min_LR = 0x6, + Shape_Rhombus_Modify_Flag_No_Modify = 0x7, + Shape_Rhombus_Modify_Flag_Free_Y = 0x8, + Shape_Rhombus_Modify_Flag_Front_Fix = 0x9, + Shape_Rhombus_Modify_Flag_Up_Fix = 0xa, + }; + + enum CorrectKind { + Correct_None = 0x0, + Correct_Ground = 0x1, + Correct_Ground_Cliff_Stop = 0x2, + Correct_Ground_Ottotto = 0x3, + Correct_Cliff = 0x4, + Correct_Air = 0x5, + Correct_Air_Passable = 0x6, + Correct_Keep = 0x7, + Correct_Ground_Cliff_Stop_Front = 0x8, + }; + + enum CliffCheckKind { + Cliff_Check_None = 0x0, + Cliff_Check_Always = 0x1, + Cliff_Check_Always_Both_Sides = 0x2, + Cliff_Check_On_Drop = 0x3, + Cliff_Check_On_Drop_Both_Sides = 0x4, + }; + + char _0[4]; + grCollStatus* m_collStatus; + Vec2f m_savePos; + Vec2f m_offset; + float m_24; + float m_28; + float m_rhombusUp; + float m_rhombusDown; + float m_rhombusWidth; + int m_rhombusFollowNode; + float m_downFriction; + grCollisionLine::MaterialType m_collMaterialType : 8; + char _53; + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_ignoreScale : 1; + bool m_ground : 1; + }; + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_upFix : 1; + bool m_frontFix : 1; + bool m_freeY : 1; + bool m_noModify : 1; + bool m_minLR : 1; + bool m_minU : 1; + bool m_noOFS : 1; + bool m_fix : 1; + bool : 1; + bool : 1; + bool : 1; + } m_rhombus; + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_minD : 1; + bool m_minU : 1; + bool m_minR : 1; + bool m_minL : 1; + bool : 1; + bool : 1; + bool : 1; + } m_rhombusModify; + }; + } m_flag; + + CorrectKind m_correctKind : 8; + CliffCheckKind m_cliffCheck : 8; + ShapeKind m_shapeKind : 4; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_testPreMap : 1; + bool m_testDynamicCollision : 1; + bool m_testCollStop : 1; + + char _60[4]; + + virtual ~soGroundShapeImpl(); + + void updateRhombus(soModuleAccesser* moduleAccesser); + void updateRhombusFollowNode(soModuleAccesser* moduleAccesser); + void updateRhombusModify(soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soGroundShapeImpl) == 68, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_tracer_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_tracer_impl.h new file mode 100644 index 0000000000..408b72762b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_tracer_impl.h @@ -0,0 +1,58 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soGroundModule; + +class soGroundTracer : public soNullable { +public: + virtual ~soGroundTracer(); + virtual bool isTraced(); + virtual bool canStart(u32, u8, soGroundModule* groundModule, u32 index, float); + virtual bool start(u32, u8, soPostureModule* postureModule, soGroundModule* groundModule, u32 index, u8, float, float, float); + virtual Vec2f getTraceTargetVec(soGroundModule* groundModule, u32 index, float); + virtual Vec2f getTraceTargetPosturePos(soGroundModule* groundModule, u32 index, float); + virtual bool isArrived(soPostureModule* postureModule, soGroundModule* groundModule, u32 index, float); + virtual bool canIntercept(u32, u8, soGroundModule* groundModule, u32 index, float); + virtual bool renew(u32, u8, soPostureModule* postureModule, soGroundModule* groundModule, u32 index, float, float); + virtual void end(); + virtual void update(bool, soGroundModule* groundModule, u32 index); + virtual Vec2f getGroundMovementSpeed(); + virtual Vec2f getDistanceFromCurrentLine(soGroundModule* groundModule, u32 index, bool); + virtual Vec2f getVecFromCurrentLine(soGroundModule* groundModule, u32 index); + virtual bool isSameNormalTraceLineCurrentAndNext(soGroundModule* groundModule, u32); + virtual bool isOpenTraceLineCurrentAndNext(soGroundModule* groundModule, u32); + virtual bool isTouchCurrentLine(soGroundModule* groundModule, u32 index); +}; + +class soGroundTracerImpl : public soGroundTracer { + char _4[12]; + Vec2f m_20; + Vec2f m_groundMovementSpeed; + bool m_isTraced; + char _pad[3]; + +public: + virtual ~soGroundTracerImpl(); + virtual bool isTraced(); + virtual bool canStart(u32, u8, soGroundModule* groundModule, u32 index, float); + virtual bool start(u32, u8, soPostureModule* postureModule, soGroundModule* groundModule, u32 index, u8, float, float, float); + virtual Vec2f getTraceTargetVec(soGroundModule* groundModule, u32 index, float); + virtual Vec2f getTraceTargetPosturePos(soGroundModule* groundModule, u32 index, float); + virtual bool isArrived(soPostureModule* postureModule, soGroundModule* groundModule, u32 index, float); + virtual bool canIntercept(u32, u8, soGroundModule* groundModule, u32 index, float); + virtual bool renew(u32, u8, soPostureModule* postureModule, soGroundModule* groundModule, u32 index, float, float); + virtual void end(); + virtual void update(bool, soGroundModule* groundModule, u32 index); + virtual Vec2f getGroundMovementSpeed(); + virtual Vec2f getDistanceFromCurrentLine(soGroundModule* groundModule, u32 index, bool); + virtual Vec2f getVecFromCurrentLine(soGroundModule* groundModule, u32 index); + virtual bool isSameNormalTraceLineCurrentAndNext(soGroundModule* groundModule, u32); + virtual bool isOpenTraceLineCurrentAndNext(soGroundModule* groundModule, u32); + virtual bool isTouchCurrentLine(soGroundModule* groundModule, u32 index); +}; +static_assert(sizeof(soGroundTracerImpl) == 40, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_util.h b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_util.h new file mode 100644 index 0000000000..e51212dded --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/ground/so_ground_util.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +namespace soGroundUtil { + enum DeadAreaCheckResult { + Dead_Area_Check_Result_None = -1, + Dead_Area_Check_Result_Outside_Up = 0, + Dead_Area_Check_Result_Outside_Down = 1, + Dead_Area_Check_Result_Outside_Left = 2, + Dead_Area_Check_Result_Outside_Right = 3, + }; + + DeadAreaCheckResult checkDeadArea(Vec3f* pos, float, float); +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_event_presenter.h new file mode 100644 index 0000000000..9ba9aecfbe --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_event_presenter.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; +class BaseItem; + +class soItemManageEventObserver : public soEventObserver { +public: + soItemManageEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual bool notifyHaveItemPreCheck(BaseItem* item, bool*); + virtual void notifyHaveItem(itParam::SizeKind, BaseItem* item, u32 nodeIndex, u32 index, bool); + virtual void notifyAttachItem(BaseItem* item, u32 nodeIndex, u32 attachNodeIndex, bool, bool); + virtual void notifyUseItem(BaseItem* item, u32 nodeIndex, int*); + virtual void notifyThrowItem(BaseItem* item, u32 nodeIndex, int*); + virtual void notifyDropItem(BaseItem*); + virtual void notifyShootBulletItem(BaseItem* item); + virtual void notifyEjectItem(BaseItem* item, u32 index, bool); + virtual void notifyEjectAttachItem(BaseItem* item, u32 index, bool); + virtual void notifyVisibilityItem(BaseItem* item, int, bool, u8); +}; +static_assert(sizeof(soItemManageEventObserver) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_module_impl.h new file mode 100644 index 0000000000..fd6a6df0ad --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_manage_module_impl.h @@ -0,0 +1,176 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; +class BaseItem; + +struct soItemNodeData { + struct AttachData { + itKind m_itKind; + u32 m_nodeIndex; + char m_8[0x8]; + }; + static_assert(sizeof(AttachData) == 0x10, "Class is wrong size!"); + + u32 m_haveNNodeIndex; + u32 m_haveNNodeIndex_; + u32 m_throwNNodeIndex; + u32 m_numAttachNodes; + AttachData* m_attachNodesData; + char _0x14[4]; +}; +static_assert(sizeof(soItemNodeData) == 0x18, "Class is wrong size!"); + +class soItemManageModule : public soNullable { +public: + virtual ~soItemManageModule(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(); + virtual void check(); + virtual bool haveItem(itKind kind, u32 variation, u32 index, bool); + virtual bool createThrowItem(itKind kind, u32 variation, u32 nodeIndex, float angle, float speed, float power); + virtual bool haveItem(BaseItem* item, u32 index, bool, bool); + virtual bool haveItem(u32 nodeIndex, BaseItem* item, u32 index, bool, bool); + virtual bool useItem(BaseItem* item); + virtual bool attachItem(BaseItem* item, bool); + virtual bool pickupItem(u8, u32, u32, u32 index); + virtual bool isSuccessPickupItem(); + virtual bool isHaveItem(u32 index); + virtual itParam::SizeKind getHaveItemSize(u32 index); + virtual itKind getHaveItemKind(u32 index); + virtual itParam::TraitFlag getHaveItemTrait(u32 index); + virtual itParam::HaveKind getHaveItemHoldKind(u32 index); + virtual int getHaveItemParamInt(u32, u32 index); + virtual float getHaveItemParamFloat(u32, u32 index); + virtual void getHaveItemInfo(soItemInfo*, u32 index); + virtual itParam::SizeKind getPickableItemSize(); + virtual itKind getPickableItemKind(); + virtual itParam::TraitFlag getPickableItemTrait(); + virtual void getPickableItemInfo(soItemInfo*); + virtual bool removeItem(BaseItem*); + virtual void removeItem(u32 index); + virtual void removeAll(); + virtual void throwItem(float angle, float speed, float power, u32 index); + virtual void throwItem(float angle, float speed, float power, Vec2f* pos, u32 index); + virtual void dropItem(float, float, u32 index); + virtual void useItem(u32 index); + virtual void warpItem(Vec3f* pos, u32 index); + virtual void bornItem(u32 index); + virtual void shootItemBullet(u32, float, u32 index); + virtual void shootItemBulletBlanks(u32, u32 index); + virtual u32 getShootItemBullet(u32 index); + virtual void updateHaveItemActionInfo(u32 index); + virtual void setHaveItemScaleAnim(float, u32, u32 index); + virtual void setHaveItemAction(u32, float, u32 index); + virtual void setHaveItemVisibility(u8, int index); + virtual void setHaveItemHoldAnim(bool, u32 index); + virtual void setHaveItemConstraintNode(u32, u32 index); + virtual void resetHaveItemConstraintNode(u32 index); + virtual bool attachItem(itKind, u32 variation, bool); + virtual bool isAttachItem(itKind); + virtual u32 getAttachItemCount(); + virtual void getAttachItemInfo(soItemInfo*, u32 index); + virtual void setAttachItemVisibility(u8, itParam::AttachGroup); + virtual u8 getAttachItemVisibility(); + virtual void ejectHaveItem(u32 index, bool, bool); + virtual void ejectAttachItem(u32 index, bool, bool); + virtual void eject(int taskId); + virtual void ejectAttach(itKind, bool, bool); + virtual void dropAttach(itKind, float, float); + virtual void dropAttachGroup(itParam::AttachGroup, float, float); + virtual void scaleAttach(itKind, float); + virtual void scaleItem(BaseItem*, float); + virtual void setHaveItemTeam(int, u32 index); +}; + +class soItemManageModuleImpl : public soItemManageModule, public soLinkEventObserver, public soStatusEventObserver, public soAnimCmdEventObserver, public soEventPresenter { + soArray* m_haveItemInfoArray; + soItemNodeData* m_itemNodeData; + soArray* m_attachItemInfoArray; + soItemSearch* m_itemSearch; + soItemPickTransactor* m_itemPickTransactor; + soItemInfo m_pickableItemInfo; + bool m_isSuccessPickupItem; + char _0x61[3]; + u8 m_attachItemVisibility; + char _0x65[3]; + soModuleAccesser* m_moduleAccesser; + +public: + virtual ~soItemManageModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(); + virtual void check(); + virtual bool haveItem(itKind kind, u32 variation, u32 index, bool); + virtual bool createThrowItem(itKind kind, u32 variation, u32 nodeIndex, float angle, float speed, float power); + virtual bool haveItem(BaseItem* item, u32 index, bool, bool); + virtual bool haveItem(u32 nodeIndex, BaseItem* item, u32 index, bool, bool); + virtual bool useItem(BaseItem* item); + virtual bool attachItem(BaseItem* item, bool); + virtual bool pickupItem(u8, u32, u32, u32 index); + virtual bool isSuccessPickupItem(); + virtual bool isHaveItem(u32 index); + virtual itParam::SizeKind getHaveItemSize(u32 index); + virtual itKind getHaveItemKind(u32 index); + virtual itParam::TraitFlag getHaveItemTrait(u32 index); + virtual itParam::HaveKind getHaveItemHoldKind(u32 index); + virtual int getHaveItemParamInt(u32, u32 index); + virtual float getHaveItemParamFloat(u32, u32 index); + virtual void getHaveItemInfo(soItemInfo*, u32 index); + virtual itParam::SizeKind getPickableItemSize(); + virtual itKind getPickableItemKind(); + virtual itParam::TraitFlag getPickableItemTrait(); + virtual void getPickableItemInfo(soItemInfo*); + virtual bool removeItem(BaseItem*); + virtual void removeItem(u32 index); + virtual void removeAll(); + virtual void throwItem(float angle, float speed, float power, u32 index); + virtual void throwItem(float angle, float speed, float power, Vec2f* pos, u32 index); + virtual void dropItem(float, float, u32 index); + virtual void useItem(u32 index); + virtual void warpItem(Vec3f* pos, u32 index); + virtual void bornItem(u32 index); + virtual void shootItemBullet(u32, float, u32 index); + virtual void shootItemBulletBlanks(u32, u32 index); + virtual u32 getShootItemBullet(u32 index); + virtual void updateHaveItemActionInfo(u32 index); + virtual void setHaveItemScaleAnim(float, u32, u32 index); + virtual void setHaveItemAction(u32, float, u32 index); + virtual void setHaveItemVisibility(u8, int index); + virtual void setHaveItemHoldAnim(bool, u32 index); + virtual void setHaveItemConstraintNode(u32, u32 index); + virtual void resetHaveItemConstraintNode(u32 index); + virtual bool attachItem(itKind, u32 variation, bool); + virtual bool isAttachItem(itKind); + virtual u32 getAttachItemCount(); + virtual void getAttachItemInfo(soItemInfo*, u32 index); + virtual void setAttachItemVisibility(u8, itParam::AttachGroup); + virtual u8 getAttachItemVisibility(); + virtual void ejectHaveItem(u32 index, bool, bool); + virtual void ejectAttachItem(u32 index, bool, bool); + virtual void eject(int taskId); + virtual void ejectAttach(itKind, bool, bool); + virtual void dropAttach(itKind, float, float); + virtual void dropAttachGroup(itParam::AttachGroup, float, float); + virtual void scaleAttach(itKind, float); + virtual void scaleItem(BaseItem*, float); + virtual void setHaveItemTeam(int, u32 index); + + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual bool isObserv(char unk1); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); +}; +static_assert(sizeof(soItemManageModuleImpl) == 0x6c, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_pick_transactor_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_pick_transactor_impl.h new file mode 100644 index 0000000000..e20fb550dd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_pick_transactor_impl.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +struct soItemInfo { + itKind m_kind; + BaseItem* m_item; + itParam::TraitFlag m_trait; + itParam::SizeKind m_size; + bool m_isVisible : 1; + bool m_isHoldAnim : 1; + itParam::AttachGroup m_attachGroup : 6; + char _0x11[3]; +}; +static_assert(sizeof(soItemInfo) == 0x14, "Class is wrong size!"); + +class soItemPickTransactor : public soNull, public soNullable { +public: + virtual ~soItemPickTransactor(); + virtual bool check(soItemSearch*, soItemInfo*, soModuleAccesser*); + virtual bool pickup(soItemSearch*, soModuleAccesser*, u8, itParam::TraitMask, u32, u32 index); +}; +static_assert(sizeof(soItemPickTransactor) == 12, "Class is wrong size!"); + +class soItemPickTransactorImpl : public soItemPickTransactor { +public: + virtual ~soItemPickTransactorImpl(); + virtual bool check(soItemSearch*, soItemInfo*, soModuleAccesser*); + virtual bool pickup(soItemSearch*, soModuleAccesser*, u8, itParam::TraitMask, u32, u32 index); +}; +static_assert(sizeof(soItemPickTransactorImpl) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_search_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_search_impl.h new file mode 100644 index 0000000000..fc95f0d861 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/item/so_item_search_impl.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soItemSearch : public soNull, public soNullable { +public: + virtual ~soItemSearch(); + virtual bool search(int*, u32, soModuleAccesser*); + +}; +static_assert(sizeof(soItemSearch) == 12, "Class is wrong size!"); + +class soItemSearchImpl : public soItemSearch { +public: + virtual ~soItemSearchImpl(); + virtual bool search(int* areaId, u32, soModuleAccesser*); + +}; +static_assert(sizeof(soItemSearchImpl) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_energy.h b/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_energy.h new file mode 100644 index 0000000000..2c4b972492 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_energy.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soKineticEnergy : public soNullable, public soEnable, public soSuspendable { +public: + enum Attribute { + Attribute_Main = 0x0, + Attribute_Damage = 0x1, + Attribute_Extern = 0x2, + Attribute_Ground = 0x3, + Attribute_Extern2 = 0x4, + }; + typedef u16 AttributeMask; + static const AttributeMask ATTRIBUTE_MASK_NONE = 0; + static const AttributeMask ATTRIBUTE_MASK_MAIN = 1 << Attribute_Main; + static const AttributeMask ATTRIBUTE_MASK_DAMAGE = 1 << Attribute_Damage; + static const AttributeMask ATTRIBUTE_MASK_EXTERN = 1 << Attribute_Extern; + static const AttributeMask ATTRIBUTE_MASK_GROUND = 1 << Attribute_Ground; + static const AttributeMask ATTRIBUTE_MASK_EXTERN2 = 1 << Attribute_Extern2; + static const AttributeMask ATTRIBUTE_MASK_ALL = USHRT_MAX; + struct AttributeFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool m_extern2 : 1; + bool m_ground : 1; + bool m_extern : 1; + bool m_damage: 1; + bool m_main : 1; + }; + AttributeMask m_mask; + }; + inline AttributeFlag() : m_mask(ATTRIBUTE_MASK_NONE) {} + inline AttributeFlag(AttributeMask bits) : m_mask(bits) {} + inline ~AttributeFlag() {} + + AttributeFlag(soAttributeFlag f) : m_mask(f.m_mask) { } + operator soAttributeFlag() { return soAttributeFlag(m_mask); } + }; + + enum OutsideType { + Outside_None = -1, + Outside_Movement_Ground = 0x0, + Outside_Wind = 0x1, + Outside_Attack = 0x2, + Outside_Damage_Reserved = 0x3 + }; + + virtual void updateEnergy(soModuleAccesser* moduleAccesser); + virtual Vec2f getSpeed(); + virtual Vec3f getSpeed3f(); + virtual Vec3f getRotation(); + virtual void resetEnergy(int, Vec2f*, Vec3f*, soModuleAccesser* moduleAccesser); + virtual void clearSpeed(); + virtual void clearRotSpeed(); + virtual void mulSpeed(Vec3f* speed); + virtual void mulAccel(Vec3f* accel); + virtual void reflectSpeed(Vec3f* speed); + virtual void reflectAccel(Vec3f* accel); + virtual void onConsiderGroundFriction(); + virtual void offConsiderGroundFriction(); + virtual ~soKineticEnergy(); +}; +static_assert(sizeof(soKineticEnergy) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_module_impl.h new file mode 100644 index 0000000000..167cdce69a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/kinetic/so_kinetic_module_impl.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soKineticModule : public soNullable { +public: + virtual void activate(); + virtual void deactivate(); + virtual void addEnergy(soKineticEnergy* kineticEnergy, int, soKineticEnergy::AttributeFlag, short); + virtual void eraseEnergy(int index); + virtual void eraseEnergyAll(); + virtual soKineticEnergy* getEnergy(int index); + virtual bool isContain(int index); + virtual void updateEnergy(soModuleAccesser* moduleAccesser, soKineticEnergy::AttributeFlag); + virtual void clearSpeedAll(); + virtual void suspendEnergyAll(); + virtual void resumeEnergyAll(); + virtual void unableEnergyAll(); + virtual Vec2f getSumSpeed(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumSpeed3f(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumRotation(soKineticEnergy::AttributeFlag); + virtual void setConsiderGroundFriction(bool, soKineticEnergy::AttributeFlag); + virtual void mulSpeed(Vec3f* speed, soKineticEnergy::AttributeFlag); + virtual void mulAccel(Vec3f* accel, soKineticEnergy::AttributeFlag); + virtual void reflectSpeed(Vec3f* speed, soKineticEnergy::AttributeFlag); + virtual void reflectAccel(Vec3f* accel, soKineticEnergy::AttributeFlag); + virtual void changeKinetic(int kineticType, soModuleAccesser* moduleAccesser); + virtual int getKineticType(); + virtual void addSpeed(Vec3f* speed, soModuleAccesser* moduleAccesser); + virtual void addSpeedOutside(soKineticEnergy::OutsideType, Vec3f* speed); +}; +static_assert(sizeof(soKineticModule) == 8, "Class is wrong size!"); + +class soKineticModuleImpl : public soKineticModule, public soAnimCmdEventObserver { + soInstanceManagerFullProperty* m_kineticEnergyInstanceManager; + int m_kineticType; + soModuleAccesser* m_moduleAccesser; + +public: + + virtual void activate(); + virtual void deactivate(); + virtual void addEnergy(soKineticEnergy* kineticEnergy, int, soKineticEnergy::AttributeFlag, short); + virtual void eraseEnergy(int index); + virtual void eraseEnergyAll(); + virtual soKineticEnergy* getEnergy(int index); + virtual bool isContain(int index); + virtual void updateEnergy(soModuleAccesser* moduleAccesser, soKineticEnergy::AttributeFlag); + virtual void clearSpeedAll(); + virtual void suspendEnergyAll(); + virtual void resumeEnergyAll(); + virtual void unableEnergyAll(); + virtual Vec2f getSumSpeed(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumSpeed3f(soKineticEnergy::AttributeFlag); + virtual Vec3f getSumRotation(soKineticEnergy::AttributeFlag); + virtual void setConsiderGroundFriction(bool, soKineticEnergy::AttributeFlag); + virtual void mulSpeed(Vec3f* speed, soKineticEnergy::AttributeFlag); + virtual void mulAccel(Vec3f* accel, soKineticEnergy::AttributeFlag); + virtual void reflectSpeed(Vec3f* speed, soKineticEnergy::AttributeFlag); + virtual void reflectAccel(Vec3f* accel, soKineticEnergy::AttributeFlag); + virtual void changeKinetic(int kineticType, soModuleAccesser* moduleAccesser); + virtual int getKineticType(); + + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual bool isObserv(char unk1); + +}; +static_assert(sizeof(soKineticModuleImpl) == 32, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_connection_server.h b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_connection_server.h new file mode 100644 index 0000000000..606e98d0c4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_connection_server.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include + +class soLinkModule; +class soLinkConnection; + +class soLinkNode { + char _0x0[0xC]; + soLinkConnection* m_connection; + soLinkModule* m_linkModule; +}; +static_assert(0x14 == sizeof(soLinkNode), "Class is wrong size!"); + +class soLinkConnection { + char _0x0[0x4]; + soLinkNode m_node1; + soLinkNode m_node2; + union { + struct { + u32 : 21; + bool m_attributeReferenceParentScale : 1; + bool m_attributeReferenceParentShake : 1; + bool m_attributeReferenceParentStop : 1; + u8 m_id : 7; + bool : 1; + }; + struct { + u32 m_attribute : 24; + u8 : 7; + bool : 1; + }; + }; + + char _0x30[0x4]; + +public: + enum Attribute { + Attribute_Reference_Parent_Stop = 0x0, + Attribute_Reference_Parent_Shake = 0x1, + Attribute_Reference_Parent_Scale = 0x2, + + Attribute_Reference_Parent_Unknown_4 = 0x4, + + Attribute_Reference_Parent_Visibility = 0x7, + + Attribute_Reference_Parent_Power_Up = 0xA, // glow + }; +}; +static_assert(0x34 == sizeof(soLinkConnection), "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_event_presenter.h new file mode 100644 index 0000000000..4163362eca --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_event_presenter.h @@ -0,0 +1,58 @@ +#pragma once + +#include +#include +#include + +class StageObject; +class soModuleAccesser; + +struct soLinkEventArgs { + int m_eventKind; + bool _0x4; +protected: + inline soLinkEventArgs(int eventKind) : m_eventKind(eventKind), _0x4(false) {} +}; +static_assert(sizeof(soLinkEventArgs) == 8, "Class is wrong size!"); + + +class soLinkEventObserver : public soEventObserver { +public: + typedef u16 AttributeMask; + static const AttributeMask ATTRIBUTE_MASK_NONE = 0; + struct AttributeFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + }; + AttributeMask m_mask; + }; + inline AttributeFlag() : m_mask(ATTRIBUTE_MASK_NONE) {} + inline AttributeFlag(AttributeMask bits) : m_mask(bits) {} + inline ~AttributeFlag() {} + + AttributeFlag(soAttributeFlag f) : m_mask(f.m_mask) { } + operator soAttributeFlag() { return soAttributeFlag(m_mask); } + }; + + soLinkEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); +}; +static_assert(sizeof(soLinkEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_module_impl.h new file mode 100644 index 0000000000..a31f24c21a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/link/so_link_module_impl.h @@ -0,0 +1,285 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StageObject; +class soModuleAccesser; +class soArticle; + +class soLinkModule : public soNullable { +public: + union ModelConstraintFlag { + u16 m_mask; + struct { + bool m_setMatrix : 1; + bool m_offsetTranslateSelf : 1; + bool m_offsetTranslate : 1; + bool m_noUpdateLinkPos : 1; + bool m_mtxNoScale : 1; + bool m_offsetScale : 1; + bool m_offsetRot : 1; + bool m_flipRotZ : 1; + bool m_flipRotY : 1; + bool m_flipRotX : 1; + bool m_noFlip : 1; + bool m_oneNode : 1; + bool m_mtx : 1; + bool m_orientationPostureRot : 1; + bool m_orientation : 1; + bool m_position : 1; + }; + inline ModelConstraintFlag() {} + inline ModelConstraintFlag(u16 mask) : m_mask(mask) {} + }; + + soLinkModule() { } + virtual ~soLinkModule() { }; + virtual void activate() = 0; + virtual void deactivate() = 0; + virtual bool link(u32 index, int taskId) = 0; + virtual void unlinkAll() = 0; + virtual void unlinkNode(u32 index) = 0; + virtual void unlinkNodeAll() = 0; + virtual void unlink(u32 index) = 0; + virtual bool isLink(int index) = 0; + virtual bool isLinked(int index) = 0; + virtual StageObject *getParent(u32 index) = 0; + virtual StageObject *searchParent(int taskId) = 0; + virtual StageObject* searchParentAttr(soLinkConnection::Attribute ) = 0; + virtual StageObject *searchNode(int taskId) = 0; + virtual void sendEventParents(s32 p1, soLinkEventArgs& p2) = 0; + virtual void sendEventNodes(s32, soLinkEventArgs &, u32 attributeMask) = 0; + virtual void sendEventNodes(s32, int taskId, soLinkEventArgs &) = 0; + virtual StageObject *getNode(u8) = 0; + virtual int getNodeTaskId(u8) = 0; + virtual bool isNodeDamageReaction(u8) = 0; + virtual bool isNodeDamageCaptureCut(u8) = 0; + virtual s8 getParentModelLoupeNo(u32 index) = 0; + virtual bool chkLinkStop() = 0; + virtual void toLinkStop() = 0; + virtual void leaveLinkStop() = 0; + virtual bool isValidLinkStop() = 0; + virtual bool chkLinkShake(Vec2f*) = 0; + virtual soColorBlend *getLinkColorBlend() = 0; + virtual s8 getLinkLightSet() = 0; + virtual bool chkLinkVisibility() = 0; + virtual soController* getLinkController() = 0; + virtual float getLinkScale() = 0; + virtual float getParentScale(u32 index) = 0; + virtual void adjustLinkGroundCollision(int, float*) = 0; + virtual void setConstraint2ndWind(u8) = 0; + virtual Vec3f getParentModelNodeGlobalPosition(u32 index, u32 correctNodeId, bool) = 0; + virtual Vec3f getParentModelNodeGlobalPosition(u32 index, const char *nodeName, bool) = 0; + virtual float getParentMotionFrame(u32 index) = 0; + virtual SituationKind getParentSituationKind(u32 index) = 0; + virtual float getParentLr(u32 index) = 0; + virtual Vec2f getParentSumSpeed(u32 index) = 0; + virtual int getParentTaskId(u32 index) = 0; + virtual Vec3f getParentRot(u32 index) = 0; + virtual float getParentDamage(u32 index) = 0; + virtual float getParentDamageReaction(u32 index) = 0; + virtual float getParentDamagePowerMax(u32 index) = 0; + virtual void setNodeScalePowerMul(float) = 0; + virtual bool isParentDamageReaction(u32 index) = 0; + virtual bool isParentDamageCatchCut(u32 index) = 0; + virtual int getParentTotalHitStatus(u32 index) = 0; + virtual nw4r::g3d::ResFile getParentAnmFile(u32 index, u16 fileIndex) = 0; + virtual bool isValidParentShape(u32 index) = 0; + virtual Vec2f getParentShapeCenterPos(u32 index) = 0; + virtual bool getParentShapeCenterPosTaskId(int taskId, Vec2f *outCenterPos) = 0; + virtual float getOwnerAttackPowerMulArticle(u32 index) = 0; + virtual bool isParentEnableEnvMap(u32 index) = 0; + virtual bool isParentRefFB(u32 index) = 0; + virtual int getParentTexResourceId(u32 index) = 0; + virtual bool isParentEffectSyncScale(u32 index) = 0; + virtual void sendEnvMapNodes(bool) = 0; + virtual bool isParentGlow(u32 index) = 0; + virtual int getParentGlowAttack(u32 index, soCollisionAttackData*) = 0; + virtual int getParentWeaponGlowAttack(u32 index) = 0; + virtual int getParentWeaponGlowDefense(u32 index) = 0; + virtual int getParentGlowAttackAdd(soCollisionAttackData*) = 0; + virtual float getParentWeaponGlowEff(u32 index) = 0; + virtual float getParentWeaponGlowDamageMin(u32 index) = 0; + virtual float getParentWeaponGlowDamageMax(u32 index) = 0; + virtual void setParentHitStopFrame(u32, u32, bool) = 0; + virtual void setParentAttackerInfo(u32 index, StageObject*) = 0; + virtual u8 getParentAttachItemVisibility(u32 index) = 0; + virtual bool isParentEnableSubColor(u32 index) = 0; + virtual GXColor getParentSubColor(u32 index) = 0; + virtual bool correctParent2ndBoth(u32 index, Vec3f*, float) = 0; + virtual void setModelConstraintPosOrt(u32 modelConstraintNo, int modelConstraintNode, int modelConstraintTargetNode, u16 modelConstraintFlag, bool + modelConstraintAttribute) = 0; + virtual void setModelConstraintPosOrt(u32 modelConstraintNo, int modelConstraintNode, const char *modelConstraintTargetNode, u16 modelConstraintFlag, bool + modelConstraintAttribute) = 0; + virtual void setModelConstraintAttribute(u32 index, bool) = 0; + virtual ModelConstraintFlag getModelConstraintFlag() = 0; + virtual void setModelConstraintFlag(u16) = 0; + virtual void offModelConstraintFlag(u16) = 0; + virtual int getModelConstraintNode() = 0; + virtual void setModelConstraintNode(int) = 0; + virtual void setModelConstraintTargetNode(int) = 0; + virtual u32 getModelConstraintNo() = 0; + virtual void adjustModelConstraintPosture(Matrix*, Vec3f*) = 0; + virtual void adjustModelConstraintPosture(u16, Matrix*, Vec3f*) = 0; + virtual void removeModelConstraint(bool) = 0; + virtual bool isModelConstraint() = 0; + virtual bool isModelConstraintMutual() = 0; + virtual void getModelConstraintTargetNodeWorldMtx(Matrix*, bool) = 0; + virtual Vec3f getModelConstraintTargetNodePosition() = 0; + virtual Vec3f getModelConstraintNodeGlobalPosition(u32 nodeIndex) = 0; + virtual Vec3f getModelConstraintNodeGlobalPositionRecursive(u32 nodeIndex) = 0; + virtual Vec3f getModelConstraintTargetNodeRotation() = 0; + virtual bool getNodeRotation(u32 index, u32 nodeIndex, Vec3f *rotation) = 0; + virtual float getConstraintModelScale() = 0; + virtual bool setUpModelConstraintTargetMtx() = 0; + virtual void calcModelConstraintNodeMtx(Matrix*) = 0; + virtual void setAttribute(u32 index, soLinkConnection::Attribute, bool) = 0; + virtual bool chkAttribute(int index, soLinkConnection::Attribute) = 0; + virtual bool chkLinkedAttribute(soLinkConnection::Attribute) = 0; + virtual nw4r::g3d::ResFile getAnmFile(u16 fileIndex) = 0; + virtual void setAnmFileTransactorLinkNo(int) = 0; + virtual soSlopeStatusParam::Status getLinkSlopeStatus(int index) = 0; + virtual bool getLinkSlopeRotation(int index, Vec3f*) = 0; + virtual soArticle *generateArticleLinkParents(u32 connectionIndex, int id, soModuleAccesser*) = 0; + virtual void getCmdAddressPackParents(u32 linkConnectionIndex, soArray*, int motionKind, short*) = 0; + virtual bool isLinkParentSlow(int index) = 0; + virtual bool getLinkParentSlowInfo(float *rate, bool *isSkip, int index) = 0; + virtual void getLinkParentCameraInfo(u32 index, u8* playerNo, u8* pri, u8* advPri) = 0; + virtual bool isNodeGroundCrush(float) = 0; +}; + +class soLinkModuleImpl : public soLinkModule, public soAnimCmdEventObserver { +public: + soLinkModuleImpl(short unitID) : soAnimCmdEventObserver(unitID) { } + virtual ~soLinkModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual bool link(u32 index, int taskId); + virtual void unlinkAll(); + virtual void unlinkNode(u32 index); + virtual void unlinkNodeAll(); + virtual void unlink(u32 index); + virtual bool isLink(int index); + virtual bool isLinked(int index); + virtual StageObject *getParent(u32 index); + virtual StageObject *searchParent(int taskId); + virtual StageObject* searchParentAttr(soLinkConnection::Attribute ); + virtual StageObject *searchNode(int taskId); + virtual void sendEventParents(s32 p1, soLinkEventArgs& p2); + virtual void sendEventNodes(s32, soLinkEventArgs &, u32 attributeMask); + virtual void sendEventNodes(s32, int taskId, soLinkEventArgs &); + virtual StageObject *getNode(u8); + virtual int getNodeTaskId(u8); + virtual bool isNodeDamageReaction(u8); + virtual bool isNodeDamageCaptureCut(u8); + virtual s8 getParentModelLoupeNo(u32 index); + virtual bool chkLinkStop(); + virtual void toLinkStop(); + virtual void leaveLinkStop(); + virtual bool isValidLinkStop(); + virtual bool chkLinkShake(Vec2f*); + virtual soColorBlend *getLinkColorBlend(); + virtual s8 getLinkLightSet(); + virtual bool chkLinkVisibility(); + virtual soController* getLinkController(); + virtual float getLinkScale(); + virtual float getParentScale(u32 index); + virtual void adjustLinkGroundCollision(int, float*); + virtual void setConstraint2ndWind(u8); + virtual Vec3f getParentModelNodeGlobalPosition(u32 index, u32 correctNodeId, bool); + virtual Vec3f getParentModelNodeGlobalPosition(u32 index, const char *nodeName, bool); + virtual float getParentMotionFrame(u32 index); + virtual SituationKind getParentSituationKind(u32 index); + virtual float getParentLr(u32 index); + virtual Vec2f getParentSumSpeed(u32 index); + virtual int getParentTaskId(u32 index); + virtual Vec3f getParentRot(u32 index); + virtual float getParentDamage(u32 index); + virtual float getParentDamageReaction(u32 index); + virtual float getParentDamagePowerMax(u32 index); + virtual void setNodeScalePowerMul(float); + virtual bool isParentDamageReaction(u32 index); + virtual bool isParentDamageCatchCut(u32 index); + virtual int getParentTotalHitStatus(u32 index); + virtual nw4r::g3d::ResFile getParentAnmFile(u32 index, u16 fileIndex); + virtual bool isValidParentShape(u32 index); + virtual Vec2f getParentShapeCenterPos(u32 index); + virtual bool getParentShapeCenterPosTaskId(int taskId, Vec2f *outCenterPos); + virtual float getOwnerAttackPowerMulArticle(u32 index); + virtual bool isParentEnableEnvMap(u32 index); + virtual bool isParentRefFB(u32 index); + virtual int getParentTexResourceId(u32 index); + virtual bool isParentEffectSyncScale(u32 index); + virtual void sendEnvMapNodes(bool); + virtual bool isParentGlow(u32 index); + virtual int getParentGlowAttack(u32 index, soCollisionAttackData*); + virtual int getParentWeaponGlowAttack(u32 index); + virtual int getParentWeaponGlowDefense(u32 index); + virtual int getParentGlowAttackAdd(soCollisionAttackData*); + virtual float getParentWeaponGlowEff(u32 index); + virtual float getParentWeaponGlowDamageMin(u32 index); + virtual float getParentWeaponGlowDamageMax(u32 index); + virtual void setParentHitStopFrame(u32, u32, bool); + virtual void setParentAttackerInfo(u32 index, StageObject*); + virtual u8 getParentAttachItemVisibility(u32 index); + virtual bool isParentEnableSubColor(u32 index); + virtual GXColor getParentSubColor(u32 index); + virtual bool correctParent2ndBoth(u32 index, Vec3f*, float); + virtual void setModelConstraintPosOrt(u32 modelConstraintNo, int modelConstraintNode, int modelConstraintTargetNode, u16 modelConstraintFlag, bool + modelConstraintAttribute); + virtual void setModelConstraintPosOrt(u32 modelConstraintNo, int modelConstraintNode, const char *modelConstraintTargetNode, u16 modelConstraintFlag, bool + modelConstraintAttribute); + virtual void setModelConstraintAttribute(u32 index, bool); + virtual ModelConstraintFlag getModelConstraintFlag(); + virtual void setModelConstraintFlag(u16); + virtual void offModelConstraintFlag(u16); + virtual int getModelConstraintNode(); + virtual void setModelConstraintNode(int); + virtual void setModelConstraintTargetNode(int); + virtual u32 getModelConstraintNo(); + virtual void adjustModelConstraintPosture(Matrix*, Vec3f*); + virtual void adjustModelConstraintPosture(u16, Matrix*, Vec3f*); + virtual void removeModelConstraint(bool); + virtual bool isModelConstraint(); + virtual bool isModelConstraintMutual(); + virtual void getModelConstraintTargetNodeWorldMtx(Matrix*, bool); + virtual Vec3f getModelConstraintTargetNodePosition(); + virtual Vec3f getModelConstraintNodeGlobalPosition(u32 nodeIndex); + virtual Vec3f getModelConstraintNodeGlobalPositionRecursive(u32 nodeIndex); + virtual Vec3f getModelConstraintTargetNodeRotation(); + virtual bool getNodeRotation(u32 index, u32 nodeIndex, Vec3f *rotation); + virtual float getConstraintModelScale(); + virtual bool setUpModelConstraintTargetMtx(); + virtual void calcModelConstraintNodeMtx(Matrix*); + virtual void setAttribute(u32 index, soLinkConnection::Attribute, bool); + virtual bool chkAttribute(int index, soLinkConnection::Attribute); + virtual bool chkLinkedAttribute(soLinkConnection::Attribute); + virtual nw4r::g3d::ResFile getAnmFile(u16 fileIndex); + virtual void setAnmFileTransactorLinkNo(int); + virtual soSlopeStatusParam::Status getLinkSlopeStatus(int index); + virtual bool getLinkSlopeRotation(int index, Vec3f*); + virtual soArticle *generateArticleLinkParents(u32 connectionIndex, int id, soModuleAccesser*); + virtual void getCmdAddressPackParents(u32 linkConnectionIndex, soArray*, int motionKind, short*); + virtual bool isLinkParentSlow(int index); + virtual bool getLinkParentSlowInfo(float *rate, bool *isSkip, int index); + virtual void getLinkParentCameraInfo(u32 index, u8* playerNo, u8* pri, u8* advPri); + virtual bool isNodeGroundCrush(float); + + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual bool isObserv(char unk1); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_event_presenter.h new file mode 100644 index 0000000000..ec28de4338 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_event_presenter.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soModelEventObserver : public soEventObserver { +public: + soModelEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventConstructInstance(bool, soModuleAccesser* moduleAccesser); + virtual void notifyEventDestructInstance(soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soModelEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_impl.h new file mode 100644 index 0000000000..67d531268b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_impl.h @@ -0,0 +1,141 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soModelModuleImpl : public soModelModuleSimple, public soAnimCmdEventObserver, public soEventPresenter { + char _spacer1[156]; + soModuleAccesser* m_moduleAccesser; // +0xC8 +public: + soModelModuleImpl(soModuleAccesser* acc, + soArray* nodeSetUps, + void* extendNodeTbl, + soArray* virtualNodes, + soEventObserverRegistrationDesc* regDesc, + float f1); + // TODO: Verify Params + virtual void setUpMtx(u32 nodeId); + virtual void setUpMtx(u32* nodeIds, s32 numNodeIds); + virtual void setUpMtxFinal(); + virtual void setUpSkinningMtx(); + virtual void clearSetUpMtx(); + virtual void constructInstance(gfSceneRoot::LayerType, u32 flags, bool, s8, nw4r::g3d::ResFile, const char*, const char*, s16 mdlResId, void*, u8 loupeNo, int + priorityDrawXlu); + virtual void destructInstance(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(bool); + virtual nw4r::g3d::ScnMdl* getScnMdl(bool) const; + virtual void setScnMdl(nw4r::g3d::ScnMdl*, void*, gfSceneRoot::LayerType); + virtual void setScnMdlExtern(nw4r::g3d::ScnMdl *); + virtual nw4r::g3d::ScnMdl* detachScnMdl(void*); + virtual void setLockMtx(bool); + virtual void clearNodeSetUp(); + virtual void clearNodeSRT(u32 p1); + virtual void setNodeSRT(u32 , Vec3f* scale, Vec3f* rot, Vec3f* xlate); + virtual Vec3f getNodeScale(u32 nodeIndex); + virtual void setNodeScale(u32 , Vec3f* ); + virtual Vec3f getNodeRotate(u32 nodeIndex); + virtual void setNodeRotateX(u32 , float x); + virtual void setNodeRotateY(u32 , float y); + virtual void setNodeRotateZ(u32 , float z); + virtual void setNodeRotate(u32 , Vec3f* rot); + virtual Vec3f getNodeTranslate(u32 p1); + virtual void setNodeTranslate(u32 , Vec3f* xlate); + virtual int getCorrectNodeId(u32); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, bool ); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, const Vec3f* p2, bool, bool ); + virtual Vec3f getNodeLocalPosition(u32 correctNodeId, bool ); + virtual void getNodeLocalMtxFromNode(u32 node1, u32 node2, Matrix* outMtx, bool ); + virtual void getNodeGlobalMtx(u32 index, Matrix* outMtx, bool ) const; + virtual void setNodeGlobalMtx(u32 index, Matrix* , bool ); + virtual Vec3f getNodeGlobalRotation(u32 nodeIndex, bool ); + virtual bool isNode(u32 id); + virtual u32 getNodeNum(bool) const; + virtual void setTransNNodeId(int); + virtual const char *getTransNNodeName(); + virtual int getTransNNodeId(); + virtual Vec3f getResFileNodeTranslate(u32 nodeIndex); + virtual Vec3f getResFileNodeRotation(u32 nodeIndex); + virtual void renderNodeAxis(u32 nodeIndex, float ); + virtual float getScale(); + virtual void setScale(float); + virtual void setScaleZ(float); + virtual gfSceneRoot::LayerType getLayerType(); + virtual s8 getLoupeNo(); + virtual void setLoupeNo(s8); + virtual void setVisibility(bool visibility, bool); + virtual void setNodeVisibility(u32 nodeId, bool visibility, bool); + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility, bool); + virtual void changeMaterialTex(soResourceModule*, const char*resMat, const char*resPlt, nw4r::g3d::ResFile); + virtual void initVirtualNode(int, u32, u32, void*, Matrix*); + virtual void setVirtualNodeUpdate(u32 virtualNodeIndex, bool); + virtual bool isAddEnvMapMat(); + virtual bool isEnvMap(); + virtual void switchEnvMap(bool); + virtual bool isRefFB(); + virtual void preShadowCalcView(); + virtual Matrix *getWorldMtxArray(); + virtual void setShadowNode(int); + virtual void setDisposeInstanceImm(bool); + virtual ~soModelModuleImpl(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soModelModuleImpl) == 204, "Class is wrong size!"); + +class soModelModuleImplVariable : public soModelModuleImpl { + u32** unkCC; +public: + soModelModuleImplVariable(soModuleAccesser* acc, + soArray* nodeSetUps, + void* extendNodeTbl, + soArray* virtualNodes, + soEventObserverRegistrationDesc* regDesc, + float f1); + virtual void setUpMtx(u32* nodeIds, s32 numNodeIds); + virtual void clearNodeSRT(u32 p1); + virtual void setNodeSRT(u32 , Vec3f* scale, Vec3f* rot, Vec3f* xlate); + virtual Vec3f getNodeScale(u32 nodeIndex); + virtual void setNodeScale(u32 , Vec3f* ); + virtual Vec3f getNodeRotate(u32 nodeIndex); + virtual void setNodeRotateX(u32 , float x); + virtual void setNodeRotateY(u32 , float y); + virtual void setNodeRotateZ(u32 , float z); + virtual void setNodeRotate(u32 , Vec3f* rot); + virtual Vec3f getNodeTranslate(u32 p1); + virtual void setNodeTranslate(u32 , Vec3f* xlate); + virtual int getNodeId(const char *nodeName); + virtual int getCorrectNodeId(u32); + virtual int getRealNodeId(u32) const; + virtual const char* getNodeName(u32 p1); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, bool ); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, const Vec3f* p2, bool, bool ); + virtual Vec3f getNodeLocalPosition(u32 correctNodeId, bool ); + virtual void getNodeLocalMtxFromNode(u32 node1, u32 node2, Matrix* outMtx, bool ); + virtual void getNodeGlobalMtx(u32 index, Matrix* outMtx, bool ) const; + virtual void setNodeGlobalMtx(u32 index, Matrix* , bool ); + virtual Vec3f getNodeGlobalRotation(u32 nodeIndex, bool ); + virtual bool isNode(u32 id); + virtual Vec3f getResFileNodeTranslate(u32 nodeIndex); + virtual Vec3f getResFileNodeRotation(u32 nodeIndex); + virtual Vec3f getNodeGlobalOffsetFromTop(u32 p1); + virtual Vec3f getTopNodeGlobalPosFromNode(u32 p1, Vec3f* p2); + virtual void renderNodeAxis(u32 nodeIndex, float ); + virtual void setNodeVisibility(u32 nodeId, bool visibility, bool); + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility, bool); + virtual void setNodeConvertData(u32** convertData); + virtual ~soModelModuleImplVariable(); +}; +static_assert(sizeof(soModelModuleImplVariable) == 0xD0, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_simple.h new file mode 100644 index 0000000000..305e479db9 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_module_simple.h @@ -0,0 +1,196 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModelModule : private soNull, public soNullable { +public: + soModelModule() { } + + // TODO: Verify Params + virtual void setUpMtx(u32 nodeId) = 0; + virtual void setUpMtx(u32* nodeIds, s32 numNodeIds) = 0; + virtual void setUpMtxFinal() = 0; + virtual void setUpSkinningMtx() = 0; + virtual void clearSetUpMtx() = 0; + virtual void constructInstance(gfSceneRoot::LayerType, u32 flags, bool, s8, nw4r::g3d::ResFile, const char*, const char*, s16 mdlResId, void*, u8 loupeNo, int + priorityDrawXlu) = 0; + virtual void destructInstance() = 0; + virtual void activate() = 0; + virtual void deactivate() = 0; + virtual void begin(bool) = 0; + virtual nw4r::g3d::ScnMdl* getScnMdl() const = 0; + virtual nw4r::g3d::ScnMdl* getScnMdl(bool) const = 0; + virtual void setScnMdl(nw4r::g3d::ScnMdl*, void*, gfSceneRoot::LayerType) = 0; + virtual void setScnMdlExtern(nw4r::g3d::ScnMdl *) = 0; + virtual nw4r::g3d::ScnMdl* detachScnMdl(void*) = 0; + virtual void resetLayerType(gfSceneRoot::LayerType lt) = 0; + virtual void setLockMtx(bool) = 0; + virtual void clearNodeSetUp() = 0; + virtual void clearNodeSRT(u32 p1) = 0; + virtual void setNodeSRT(u32 , Vec3f* scale, Vec3f* rot, Vec3f* xlate) = 0; + virtual Vec3f getNodeScale(u32 nodeIndex) = 0; + virtual void setNodeScale(u32 , Vec3f* ) = 0; + virtual Vec3f getNodeRotate(u32 nodeIndex) = 0; + virtual void setNodeRotateX(u32 , float x) = 0; + virtual void setNodeRotateY(u32 , float y) = 0; + virtual void setNodeRotateZ(u32 , float z) = 0; + virtual void setNodeRotate(u32 , Vec3f* rot) = 0; + virtual Vec3f getNodeTranslate(u32 p1) = 0; + virtual void setNodeTranslate(u32 , Vec3f* xlate) = 0; + virtual int getNodeId(const char *nodeName) = 0; + virtual int getCorrectNodeId(u32) = 0; + virtual int getRealNodeId(u32) const = 0; + virtual const char* getNodeName(u32 p1) = 0; + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, bool ) = 0; + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, const Vec3f* p2, bool, bool ) = 0; + virtual Vec3f getNodeLocalPosition(u32 correctNodeId, bool ) = 0; + virtual void getNodeLocalMtxFromNode(u32 node1, u32 node2, Matrix* outMtx, bool ) = 0; + virtual void getNodeGlobalMtx(u32 idx, Matrix* outMtx, bool) const = 0; + virtual void setNodeGlobalMtx(u32 index, Matrix* , bool ) = 0; + virtual Vec3f getNodeGlobalRotation(u32 nodeIndex, bool ) = 0; + virtual bool isNode(u32 id) = 0; + virtual u32 getNodeNum() const = 0; + virtual u32 getNodeNum(bool) const = 0; + virtual void setTransNNodeId(int) = 0; + virtual const char *getTransNNodeName() = 0; + virtual int getTransNNodeId() = 0; + virtual Vec3f getResFileNodeTranslate(u32 nodeIndex) = 0; + virtual Vec3f getResFileNodeRotation(u32 nodeIndex) = 0; + virtual Vec3f getNodeGlobalOffsetFromTop(u32 p1) = 0; + virtual Vec3f getTopNodeGlobalPosFromNode(u32 p1, Vec3f* p2) = 0; + virtual void renderNodeAxis(u32 nodeIndex, float ) = 0; + virtual float getScale() = 0; + virtual void setScale(float) = 0; + virtual void setScaleZ(float) = 0; + virtual gfSceneRoot::LayerType getLayerType() = 0; + virtual bool setAnmObj(nw4r::g3d::AnmObj* obj) = 0; + virtual bool removeAnmObj(nw4r::g3d::ScnMdlSimple::AnmObjType type) = 0; + virtual bool setOption(u32 option, u32 value) = 0; + virtual bool getResMdl(nw4r::g3d::ResMdl* resMdl) = 0; + virtual s8 getLoupeNo() = 0; + virtual void setLoupeNo(s8) = 0; + virtual void setVisibility(bool visibility) = 0; + virtual void setVisibility(bool visibility, bool) = 0; + virtual void setNodeVisibility(u32 nodeId, bool visibility) = 0; + virtual void setNodeVisibility(u32 nodeId, bool visibility, bool) = 0; + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility) = 0; + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility, bool) = 0; + virtual void changeMaterialTex(soResourceModule*, const char*resMat, const char*resPlt, nw4r::g3d::ResFile) = 0; + virtual void initVirtualNode(int, u32, u32, void*, Matrix*) = 0; + virtual void setVirtualNodeUpdate(u32 virtualNodeIndex, bool) = 0; + virtual bool isAddEnvMapMat() = 0; + virtual bool isEnvMap() = 0; + virtual void switchEnvMap(bool) = 0; + virtual bool isRefFB() = 0; + virtual void preShadowCalcView() = 0; + virtual Matrix *getWorldMtxArray() = 0; + virtual void setNodeConvertData(u32** convertData) = 0; + virtual void setShadowNode(int) = 0; + virtual void setDisposeInstanceImm(bool) = 0; + virtual ~soModelModule() { } +}; + +class soModelModuleSimple : public soModelModule { + // 0xC + nw4r::g3d::ScnMdl* m_scnMdl; + + // 0x10 + gfSceneRoot::LayerType m_layerType; +public: + soModelModuleSimple(); + + // TODO: Verify Params + virtual void setUpMtx(u32 nodeId); + virtual void setUpMtx(u32* nodeIds, s32 numNodeIds); + virtual void setUpMtxFinal(); + virtual void setUpSkinningMtx(); + virtual void clearSetUpMtx(); + virtual void constructInstance(gfSceneRoot::LayerType, u32 flags, bool, s8, nw4r::g3d::ResFile, const char*, const char*, s16 mdlResId, void*, u8 loupeNo, int + priorityDrawXlu); + virtual void destructInstance(); + virtual void activate(); + virtual void deactivate(); + virtual void begin(bool); + virtual nw4r::g3d::ScnMdl* getScnMdl() const; // 0x3C + virtual nw4r::g3d::ScnMdl* getScnMdl(bool) const; + virtual void setScnMdl(nw4r::g3d::ScnMdl*, void*, gfSceneRoot::LayerType); + virtual void setScnMdlExtern(nw4r::g3d::ScnMdl *); + virtual nw4r::g3d::ScnMdl* detachScnMdl(void*); + virtual void resetLayerType(gfSceneRoot::LayerType lt); + virtual void setLockMtx(bool); + virtual void clearNodeSetUp(); + virtual void clearNodeSRT(u32 p1); + virtual void setNodeSRT(u32 , Vec3f* scale, Vec3f* rot, Vec3f* xlate); + virtual Vec3f getNodeScale(u32 nodeIndex); + virtual void setNodeScale(u32 , Vec3f* ); + virtual Vec3f getNodeRotate(u32 nodeIndex); + virtual void setNodeRotateX(u32 , float x); + virtual void setNodeRotateY(u32 , float y); + virtual void setNodeRotateZ(u32 , float z); + virtual void setNodeRotate(u32 , Vec3f* rot); + virtual Vec3f getNodeTranslate(u32 p1); + virtual void setNodeTranslate(u32 , Vec3f* xlate); + virtual int getNodeId(const char *nodeName); + virtual int getCorrectNodeId(u32); + virtual int getRealNodeId(u32) const; + virtual const char* getNodeName(u32 p1); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, bool ); + virtual Vec3f getNodeGlobalPosition(u32 correctNodeId, const Vec3f* p2, bool, bool ); + virtual Vec3f getNodeLocalPosition(u32 correctNodeId, bool ); + virtual void getNodeLocalMtxFromNode(u32 node1, u32 node2, Matrix* outMtx, bool ); + virtual void getNodeGlobalMtx(u32 idx, Matrix* outMtx, bool) const; + virtual void setNodeGlobalMtx(u32 index, Matrix* , bool ); + virtual Vec3f getNodeGlobalRotation(u32 nodeIndex, bool ); + virtual bool isNode(u32 id); + virtual u32 getNodeNum() const; + virtual u32 getNodeNum(bool) const; + virtual void setTransNNodeId(int); + virtual const char *getTransNNodeName(); + virtual int getTransNNodeId(); + virtual Vec3f getResFileNodeTranslate(u32 nodeIndex); + virtual Vec3f getResFileNodeRotation(u32 nodeIndex); + virtual Vec3f getNodeGlobalOffsetFromTop(u32 p1); + virtual Vec3f getTopNodeGlobalPosFromNode(u32 p1, Vec3f* p2); + virtual void renderNodeAxis(u32 nodeIndex, float ); + virtual float getScale(); + virtual void setScale(float); + virtual void setScaleZ(float); + virtual gfSceneRoot::LayerType getLayerType(); + virtual bool setAnmObj(nw4r::g3d::AnmObj* obj); + virtual bool removeAnmObj(nw4r::g3d::ScnMdlSimple::AnmObjType type); + virtual bool setOption(u32 option, u32 value); + virtual bool getResMdl(nw4r::g3d::ResMdl* resMdl); + virtual s8 getLoupeNo(); + virtual void setLoupeNo(s8); + virtual void setVisibility(bool visibility); + virtual void setVisibility(bool visibility, bool); + virtual void setNodeVisibility(u32 nodeId, bool visibility); + virtual void setNodeVisibility(u32 nodeId, bool visibility, bool); + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility); + virtual void setNodeVisibility(s32 numIds, const u32* nodeIds, bool visibility, bool); + virtual void changeMaterialTex(soResourceModule*, const char*resMat, const char*resPlt, nw4r::g3d::ResFile); + virtual void initVirtualNode(int, u32, u32, void*, Matrix*); + virtual void setVirtualNodeUpdate(u32 virtualNodeIndex, bool); + virtual bool isAddEnvMapMat(); + virtual bool isEnvMap(); + virtual void switchEnvMap(bool); + virtual bool isRefFB(); + virtual void preShadowCalcView(); + virtual Matrix *getWorldMtxArray(); + virtual void setNodeConvertData(u32** convertData); + virtual void setShadowNode(int); + virtual void setDisposeInstanceImm(bool); + virtual ~soModelModuleSimple(); +}; +static_assert(sizeof(soModelModuleSimple) == 20, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_scene_root_event.h b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_scene_root_event.h new file mode 100644 index 0000000000..1f2796e634 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_scene_root_event.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +class soModelSceneRootEvent : public gfSceneRootEvent { +public: + virtual void notify(s32 p1); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_virtual_node.h b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_virtual_node.h new file mode 100644 index 0000000000..38d5728837 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/model/so_model_virtual_node.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModelNodeSetUp { + // TODO data and functions + u8 unk0[0x34]; +}; +static_assert(sizeof(soModelNodeSetUp) == 0x34, "Class is the wrong size!"); + +// TODO: name +struct UnkVirtualNodeInfo { + u32 m_parentNodeId; + Vec3f m_translate; + Vec3f m_rotate; +}; +static_assert(sizeof(UnkVirtualNodeInfo) == 0x1C, "Class is the wrong size!"); + +// Manages the SRT matrices for a set of model nodes with IDs ranging +// from m_start to m_end. TODO: This class likely has more inline methods +class soModelVirtualNode { + u32 m_start; + u32 m_end; + UnkVirtualNodeInfo* m_nodeInfo; + Matrix* m_matrices; + bool m_unused; +public: + soModelVirtualNode(); + ~soModelVirtualNode(); + void init(u32 start, u32 end, UnkVirtualNodeInfo* info, Matrix* mtxs); + bool updateMatrix(const soModelModule& mod, u32 id, const Vec3f& scale); + bool getMatrix(u32 id, Matrix& mtx) const; + bool setMatrix(u32 id, Matrix& mtx); + bool isNode(u32 id) const; + bool getOffset(u32 id, Vec3f& offset) const; + bool getNodeParent(u32 id, u32& parent) const; +}; +static_assert(sizeof(soModelVirtualNode) == 0x14, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_event_presenter.h new file mode 100644 index 0000000000..c47acb1bec --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_event_presenter.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include +#include + +class StageObject; +class soModuleAccesser; + +class soMotionEventObserver : public soEventObserver { +public: + soMotionEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventChangeMotion(int, int, void*, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soMotionEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_module_impl.h new file mode 100644 index 0000000000..2ff27d471f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/motion/so_motion_module_impl.h @@ -0,0 +1,310 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soMotionChangeParam { +public: + int m_kind; + float m_frame; + float m_rate; + u8 _12; + u8 _13; + u8 _14; + u8 _15; +}; +static_assert(sizeof(soMotionChangeParam) == 16, "Class is wrong size!"); + +class soMotionModule { +public: + // TODO: verify params + virtual ~soMotionModule(); + virtual void activate(); + virtual void deactivate(); + virtual void setData(void*); + virtual void updateFrame(float); + virtual void updateNode(); + virtual float getRate(); + virtual void setRate(float rate); + virtual void setLoopFlag(bool loopFlag); + virtual bool isLoopFlag(); + virtual void setFrame(float frame); + virtual void setFrameSyncAnimCmd(float frame); + virtual float getFrame(); + virtual bool isAnimResFile(int kind); + virtual float getEndFrame(int kind); + virtual float getEndFrame(); + virtual bool isEnd(); + virtual bool isLooped(); + virtual bool isAnimCmd(int); + virtual char* getName(int kind, bool); + virtual char* getName(); + virtual int getKind(); + virtual float getWeight(); + virtual float getPrevWeight(); + virtual void setWeight(float weight); + virtual void setWeightRate(float weightRate); + virtual bool isBlend(); + virtual void disableNode(int); + virtual void calcNode(void*, int, int); + virtual void calcNode(int, void*, void*); + virtual bool changeMotionRequest(soMotionChangeParam* changeParam); + virtual void processFixPosition(); + virtual void processFixCamera(); + virtual void add2ndAnimChr(float, float, int kind, bool); + virtual void remove2ndAnimChr(); + virtual void set2ndRate(float rate); + virtual float get2ndFrame(); + virtual int get2ndKind(); + virtual bool is2ndEnd(); + virtual void addPartialAnimChr(float, float, void*, void*, int, int, int); + virtual void removePartialAnimChr(int); + virtual void compRemovePartialAnimChr(int); + virtual void detachPartialAnimChr(u32, bool); + virtual void attachPartialAnimChr(u32); + virtual int getPartialSize(); + virtual int getPartialKind(int); + virtual void setPartialRate(float rate, int); + virtual float getPartialRate(int); + virtual void setPartialFrame(float frame, int); + virtual void setPartialFrameSyncAnimCmd(float frame, int); + virtual float getPartialFrame(int); + virtual float getPartialEndFrame(int); + virtual bool isEndPartial(int); + virtual bool isLoopedPartial(int); + virtual int getOtherAnimSize(); + virtual int getOtherAnimKind(int); + virtual void addOtherAnim(float, float, int, u32, bool); + virtual void addOtherAnim(float, float, int, int, int, bool); + virtual void removeOtherAnim(int); + virtual void setOtherAnimRate(float rate, int); + virtual float getOtherAnimRate(int); + virtual void setOtherAnimFrame(float frame, int); + virtual float getOtherAnimFrame(int); + virtual float getOtherAnimEndFrame(int); + virtual bool isEndOtherAnim(int); + virtual bool isLoopedOtherAnim(int); + virtual float getTransNTranslateEndFrame(void*, int kind); + virtual Vec3f getTransNTranslate(); + virtual void updateTransMoveSpeed(); + virtual bool isTransMove(float); + virtual Vec3f getTransMoveSpeed(); + virtual Vec3f get2ndTransNTranslate(); + virtual void update2ndTransMoveSpeed(); + virtual bool is2ndTransMove(); + virtual Vec3f get2ndTransMoveSpeed(); + virtual Vec3f getBlendTransMoveSpeed(); + virtual int getNum(); + virtual void setShareAdjustNode(float, void*); + virtual void setPartialCancelNodeData(void*); + virtual void enablePartialCancelNode(bool); + virtual Vec3f getNodeRotate(int nodeId); + virtual Vec3f getNodeTranslate(int nodeId, bool); + virtual Vec3f getNodeTranslate(float, int kind, int nodeId, bool); + virtual void begin(); + virtual void rewind(); + virtual void turnBack(); + virtual bool checkTransition(int); + virtual void addDefaultTransitionTerm(void*, int numTerms); + virtual void addTransitionTerm(void*, int numTerms, int); + virtual void setShareCancelNode(int, int); + virtual void setOnlyChr(bool); + virtual void* getLastMotionTransitionInfo(); + virtual void cacheAnimChrForce(int kind); + virtual void setAnimObjCacheModule(void*); + virtual void setCheckTexBind(); // TODO + virtual void* detachAnmObjChrBlend(); + virtual void setAnmObjChrBlend(void*); + virtual void setResourceId(int, int); + virtual void clearResourceId(); + virtual void setKindOffset(int kindOffset); + virtual void setShareAnimObjKind(int shareAnimObjKind); + virtual void setShareAnimObjPartialInfo(int, int); + virtual void setNoComp(bool); + virtual void setTransMoveSpeedNoScale(bool); + virtual bool isProcessFixPositionDone(); + virtual bool isForceImmediatelyStatusInterpret(); + virtual void changeMotion(soMotionChangeParam* changeParam); +}; +static_assert(sizeof(soMotionModule) == 4, "Class is wrong size!"); + +class soMotionModuleImpl : public soMotionModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soModelEventObserver, public soEventPresenter { +public: + + // 52 + char _spacer1[4]; + + // 56 + int m_kindOffset; + + // 60 + soAnimChr m_mainAnim; + + // 88 + int m_kind; + + // 92 + float m_weight; + + // 96 + float m_prevWeight; + + // 100 + char _100[4]; + + // 104 + float m_weightRate; + + // 108 + soAnimChr m_secondaryAnim; + + // 136 + int m_secondaryKind; + + // 140 + char _spacer3[100]; + + // 240 + soTransitionModule* m_transitionModule; + + // 244 + soArrayVector m_motionChangeParamArray; + + // 320 + char _spacer4[40]; + + // 360 + soModuleAccesser* m_moduleAccesser; + + // 364 + char _spacer5[4]; + + // TODO: verify params + virtual ~soMotionModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void setData(void*); + virtual void updateFrame(float); + virtual void updateNode(); + virtual float getRate(); + virtual void setRate(float rate); + virtual void setLoopFlag(bool loopFlag); + virtual bool isLoopFlag(); + virtual void setFrame(float frame); + virtual void setFrameSyncAnimCmd(float frame); + virtual float getFrame(); + virtual bool isAnimResFile(int kind); + virtual float getEndFrame(int kind); + virtual float getEndFrame(); + virtual bool isEnd(); + virtual bool isLooped(); + virtual bool isAnimCmd(int); + virtual char* getName(int kind, bool); + virtual char* getName(); + virtual int getKind(); + virtual float getWeight(); + virtual float getPrevWeight(); + virtual void setWeight(float weight); + virtual void setWeightRate(float weightRate); + virtual bool isBlend(); + virtual void disableNode(int); + virtual void calcNode(void*, int, int); + virtual void calcNode(int, void*, void*); + virtual bool changeMotionRequest(soMotionChangeParam* changeParam); + virtual void processFixPosition(); + virtual void processFixCamera(); + virtual void add2ndAnimChr(float, float, int kind, bool); + virtual void remove2ndAnimChr(); + virtual void set2ndRate(float rate); + virtual float get2ndFrame(); + virtual int get2ndKind(); + virtual bool is2ndEnd(); + virtual void addPartialAnimChr(float, float, void*, void*, int, int, int); + virtual void removePartialAnimChr(int); + virtual void compRemovePartialAnimChr(int); + virtual void detachPartialAnimChr(u32, bool); + virtual void attachPartialAnimChr(u32); + virtual int getPartialSize(); + virtual int getPartialKind(int); + virtual void setPartialRate(float rate, int); + virtual float getPartialRate(int); + virtual void setPartialFrame(float frame, int); + virtual void setPartialFrameSyncAnimCmd(float frame, int); + virtual float getPartialFrame(int); + virtual float getPartialEndFrame(int); + virtual bool isEndPartial(int); + virtual bool isLoopedPartial(int); + virtual int getOtherAnimSize(); + virtual int getOtherAnimKind(int); + virtual void addOtherAnim(float, float, int, u32, bool); + virtual void addOtherAnim(float, float, int, int, int, bool); + virtual void removeOtherAnim(int); + virtual void setOtherAnimRate(float rate, int); + virtual float getOtherAnimRate(int); + virtual void setOtherAnimFrame(float frame, int); + virtual float getOtherAnimFrame(int); + virtual float getOtherAnimEndFrame(int); + virtual bool isEndOtherAnim(int); + virtual bool isLoopedOtherAnim(int); + virtual float getTransNTranslateEndFrame(void*, int kind); + virtual Vec3f getTransNTranslate(); + virtual void updateTransMoveSpeed(); + virtual bool isTransMove(float); + virtual Vec3f getTransMoveSpeed(); + virtual Vec3f get2ndTransNTranslate(); + virtual void update2ndTransMoveSpeed(); + virtual bool is2ndTransMove(); + virtual Vec3f get2ndTransMoveSpeed(); + virtual Vec3f getBlendTransMoveSpeed(); + virtual int getNum(); + virtual void setShareAdjustNode(float, void*); + virtual void setPartialCancelNodeData(void*); + virtual void enablePartialCancelNode(bool); + virtual Vec3f getNodeRotate(int nodeId); + virtual Vec3f getNodeTranslate(int nodeId, bool); + virtual Vec3f getNodeTranslate(float, int kind, int nodeId, bool); + virtual void begin(); + virtual void rewind(); + virtual void turnBack(); + virtual bool checkTransition(int); + virtual void addDefaultTransitionTerm(void*, int numTerms); + virtual void addTransitionTerm(void*, int numTerms, int); + virtual void setShareCancelNode(int, int); + virtual void setOnlyChr(bool); + virtual void* getLastMotionTransitionInfo(); + virtual void cacheAnimChrForce(int kind); + virtual void setAnimObjCacheModule(void*); + virtual void setCheckTexBind(); // TODO + virtual void* detachAnmObjChrBlend(); + virtual void setAnmObjChrBlend(void*); + virtual void setResourceId(int, int); + virtual void clearResourceId(); + virtual void setKindOffset(int kindOffset); + virtual void setShareAnimObjKind(int shareAnimObjKind); + virtual void setShareAnimObjPartialInfo(int, int); + virtual void setNoComp(bool); + virtual void setTransMoveSpeedNoScale(bool); + virtual bool isProcessFixPositionDone(); + virtual bool isForceImmediatelyStatusInterpret(); + virtual void changeMotion(soMotionChangeParam* changeParam); + + virtual void* getResFileData(int); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventConstructInstance(bool, soModuleAccesser* moduleAccesser); + virtual void notifyEventDestructInstance(soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soMotionModuleImpl) == 368, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/param/so_param_customize_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/param/so_param_customize_module_impl.h new file mode 100644 index 0000000000..79cadb44b2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/param/so_param_customize_module_impl.h @@ -0,0 +1,85 @@ +#pragma once + +#include +#include +#include + +class soParamCustomizeModule : soNullable { +public: + virtual ~soParamCustomizeModule() { } + virtual void activate() = 0; + virtual void setDefault() = 0; + virtual void addCustomize(u8) = 0; + virtual void removeCustomize(u8) = 0; + virtual bool isCustomize(u32) const = 0; + virtual float getAttackPowerMul(void* p1) = 0; // TODO type, see ftLucarioParamCustomizeModule + virtual void setAttackPowerMulPattern(float) = 0; + virtual float getAttackPowerMulPattern() = 0; + virtual void setAttackPowerMulScale(float) = 0; + virtual float getAttackPowerMulScale() = 0; + virtual float getAttackPowerMulArticle() = 0; + virtual float getAttackReactionMul() = 0; + virtual float getWalkSpeedMul() = 0; + virtual int getParamInt(u32, u32) = 0; + virtual float getParamFloat(u32, u32) = 0; + virtual void* getParamIndefinite(u32, u32) = 0; +}; +static_assert(sizeof(soParamCustomizeModule) == 8, "Class is wrong size!"); + +class soParamCustomizeModuleImpl : soParamCustomizeModule { + float m_attackPowerMulPattern; + float m_attackPowerMulScale; + +public: + virtual ~soParamCustomizeModuleImpl(); + virtual void activate(); + virtual void setDefault(); + virtual void addCustomize(u8); + virtual void removeCustomize(u8); + virtual bool isCustomize(u32) const; + virtual float getAttackPowerMul(void* p1); + virtual void setAttackPowerMulPattern(float pattern) { + m_attackPowerMulPattern = pattern; + } + + virtual float getAttackPowerMulPattern() { + return m_attackPowerMulPattern; + } + + virtual void setAttackPowerMulScale(float scale) { + m_attackPowerMulScale = scale; + } + + virtual float getAttackPowerMulScale() { + return m_attackPowerMulScale; + } + virtual float getAttackPowerMulArticle(); + virtual float getAttackReactionMul(); + virtual float getWalkSpeedMul(); + virtual int getParamInt(u32, u32); + virtual float getParamFloat(u32, u32); + virtual void* getParamIndefinite(u32, u32); +}; +static_assert(sizeof(soParamCustomizeModuleImpl) == 16, "Class is wrong size!"); + +class soParamCustomizeModuleNull : soParamCustomizeModule { +public: + virtual ~soParamCustomizeModuleNull() { } + virtual void activate() { } + virtual void setDefault() { } + virtual void addCustomize(u8) { } + virtual void removeCustomize(u8) { } + virtual bool isCustomize(u32) const { return false; } + virtual float getAttackPowerMul(void* p1) { return 1.0f; } + virtual void setAttackPowerMulPattern(float) { } + virtual float getAttackPowerMulPattern() { return 1.0f; } + virtual void setAttackPowerMulScale(float) { } + virtual float getAttackPowerMulScale() { return 1.0f; } + virtual float getAttackPowerMulArticle() { return 1.0f; } + virtual float getAttackReactionMul() { return 1.0f; } + virtual float getWalkSpeedMul() { return 1.0f; } + virtual int getParamInt(u32, u32) { return 0; } + virtual float getParamFloat(u32, u32) { return 0.0f; } + virtual void* getParamIndefinite(u32, u32) { return nullptr; } +}; +static_assert(sizeof(soParamCustomizeModuleNull) == 0x8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_impl.h new file mode 100644 index 0000000000..6e4b9d35e4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_impl.h @@ -0,0 +1,90 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +template +class soInterpolation { + T m_elements[4]; +public: + soInterpolation() {}; + ~soInterpolation() {}; +}; + +typedef soInterpolation interpolationVec3f; + +class soPostureModuleImpl : public soPostureModuleSimple, public soStatusEventObserver, public soAnimCmdEventObserver { + soArray >* m_interpolationArray; + float m_rotYLr; + int m_syncConstraintNode; + float m_ownerScale; + Vec3f m_prevRoughPos; + +public: + virtual ~soPostureModuleImpl(); + virtual void init(Vec3f* pos, float lr); + virtual void initPos(Vec3f* pos); + virtual Vec3f getPrevRoughPos(); + virtual void setPrevRoughPos(Vec3f* roughPos); + virtual void setLr(float lr); + virtual void initRot(); + virtual void initRot(u32 index); + virtual Vec3f getRot(u32 index); + virtual void setRot(Vec3f* rot, u32 index); + virtual void initRotYLr(); + virtual bool isRotYLrDifferentInnerLr(); + virtual float getRotYLr(); + virtual void updateRotYLr(); + virtual void reverseRotYLr(); + virtual float getScale(); + virtual float getOwnerScale(); + virtual void setOwnerScale(float ownerScale); + virtual void begin(); + virtual void rewind(); + virtual void turnBack(); + virtual float interpolate(float); + virtual bool setStickLR(float stickLR); + virtual void setSyncConstraintNode(int); + virtual void fixConstraintNodePosture(int, void*); + virtual void fixRot(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + + soPostureModuleImpl(soModuleAccesser*, soArray >*, soEventObserverRegistrationDesc*); +}; +static_assert(sizeof(soPostureModuleImpl) == 120, "Class is wrong size!"); + +template +class soPostureModuleBuildConfig { +public: + soArrayVector,TNumInterpolation> m_interpolationArrayVector; + TPostureModule m_postureModule; + + soPostureModuleBuildConfig(soModuleAccesser* moduleAccesser, + soEventObserverRegistrationDesc* registrationDesc) : + m_interpolationArrayVector(TNumInterpolation, 0), + m_postureModule(moduleAccesser, &m_interpolationArrayVector, registrationDesc) { + } +}; + +template +class soPostureModuleBuilder { + TPostureModuleBuildConfig m_buildConfig; +public: + soPostureModule* getModule() { + return &m_buildConfig.m_postureModule; + } + + soPostureModuleBuilder(soModuleAccesser* moduleAccesser, + soEventObserverRegistrationDesc* registrationDesc) : + m_buildConfig(moduleAccesser, registrationDesc) { + this->getModule()->initRot(); + }; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_simple.h new file mode 100644 index 0000000000..9583bea864 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/posture/so_posture_module_simple.h @@ -0,0 +1,94 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soPostureModule : public soNullable { +public: + virtual ~soPostureModule(); + virtual void init(Vec3f* pos, float lr); + virtual void initPos(Vec3f* pos); + virtual Vec3f getPos(); + virtual void setPos(Vec3f* pos); + virtual Vec3f getPrevPos(); + virtual Vec3f getPrevRoughPos(); + virtual void setPrevRoughPos(Vec3f* roughPos); + virtual float getLr(); + virtual void setLr(float lr); + virtual void reverseLr(); + virtual void initRot(); + virtual void initRot(u32 index); + virtual Vec3f getRot(u32 index); + virtual void setRot(Vec3f* rot, u32 index); + virtual void initRotYLr(); + virtual bool isRotYLrDifferentInnerLr(); + virtual float getRotYLr(); + virtual void updateRotYLr(); + virtual void reverseRotYLr(); + virtual float getBaseScale(); + virtual float getScale(); + virtual void setScale(float scale); + virtual void initScale(); + virtual float getOwnerScale(); + virtual void setOwnerScale(float ownerScale); + virtual void begin(); + virtual void rewind(); + virtual void turnBack(); + virtual float interpolate(float); + virtual bool setStickLR(float stickLR); + virtual void setSyncConstraintNode(int); + virtual void fixConstraintNodePosture(int, void*); + virtual void fixRot(); +}; + +class soPostureModuleSimple : public soPostureModule { + + soModuleAccesser* m_moduleAccesser; + Vec3f m_pos; + Vec3f m_prevPos; + Vec3f _36; + char _48[12]; + float m_baseScale; + float m_lr; + +public: + virtual ~soPostureModuleSimple(); + virtual void init(Vec3f* pos, float lr); + virtual void initPos(Vec3f* pos); + virtual Vec3f getPos(); + virtual void setPos(Vec3f* pos); + virtual Vec3f getPrevPos(); + virtual Vec3f getPrevRoughPos(); + virtual void setPrevRoughPos(Vec3f* roughPos); + virtual float getLr(); + virtual void setLr(float lr); + virtual void reverseLr(); + virtual void initRot(); + virtual void initRot(u32 index); + virtual Vec3f getRot(u32 index); + virtual void setRot(Vec3f* rot, u32 index); + virtual void initRotYLr(); + virtual bool isRotYLrDifferentInnerLr(); + virtual float getRotYLr(); + virtual void updateRotYLr(); + virtual void reverseRotYLr(); + virtual float getBaseScale(); + virtual float getScale(); + virtual void setScale(float scale); + virtual void initScale(); + virtual float getOwnerScale(); + virtual void setOwnerScale(float ownerScale); + virtual void begin(); + virtual void rewind(); + virtual void turnBack(); + virtual float interpolate(float); + virtual bool setStickLR(float stickLR); + virtual void setSyncConstraintNode(int); + virtual void fixConstraintNodePosture(int, void*); + virtual void fixRot(); +}; +static_assert(sizeof(soPostureModuleSimple) == 68, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_id_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_id_accesser.h new file mode 100644 index 0000000000..6032b7f2aa --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_id_accesser.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include + +class soResourceIdAccesser : public soNullable { +public: + soResourceIdAccesser(bool isNull) : soNullable(isNull) { } + virtual ~soResourceIdAccesser() = 0; + virtual void setResIdPacked(u32 id) { } + virtual void setAnmResId(u32 id) { } + virtual void setMdlResId(u32 id) { } + virtual void setTexResId(u32 id) { } + virtual void setMdlResIndex(u16 idx) { } + virtual void setTexResIndex(u16 idx) { } + virtual u32 getTexResId() = 0; + virtual u32 getTexResIndex() { return 0; } + virtual u32 getMdlResId() = 0; + virtual u32 getMdlResIndex() { return 0; } + virtual u32 getAnmResId() = 0; + virtual u32 getBinResId() = 0; + virtual u32 getArchiveId() = 0; + virtual u32 getEtcResId() = 0; + virtual u32 getMdlArchiveId() = 0; + virtual u32 getTexArchiveId() = 0; + virtual u32 getAnmArchiveId() = 0; + virtual u32 getEtcArchiveId() = 0; + virtual u32 getBinArchiveId() = 0; +}; +static_assert(sizeof(soResourceIdAccesser) == 0x8, "Class is the wrong size!"); + +class soResourceIdAccesserImpl : public soResourceIdAccesser { + u32 m_mdlResId; + u32 m_texResId; + u32 m_anmResId; + u16 m_mdlResIndex; + u16 m_texResIndex; +public: + soResourceIdAccesserImpl(u32 mdlId, u32 texId, u32 anmId) : + soResourceIdAccesser(false), + m_mdlResId(mdlId), + m_texResId(texId), + m_anmResId(anmId), + m_mdlResIndex(0), + m_texResIndex(0) { } + virtual ~soResourceIdAccesserImpl() { } + virtual void setResIdPacked(u32 id) { + m_anmResId = id; + m_texResId = id; + m_mdlResId = id; + } + virtual void setAnmResId(u32 id) { m_anmResId = id; } + virtual void setMdlResId(u32 id) { m_mdlResId = id; } + virtual void setTexResId(u32 id) { m_texResId = id; } + virtual void setMdlResIndex(u16 idx) { m_mdlResIndex = idx; } + virtual void setTexResIndex(u16 idx) { m_texResIndex = idx; } + virtual u32 getTexResId() { return m_texResId; } + virtual u32 getTexResIndex() { return m_texResIndex; } + virtual u32 getMdlResId() { return m_mdlResId; } + virtual u32 getMdlResIndex() { return m_mdlResIndex; } + virtual u32 getAnmResId() { return m_anmResId; } + virtual u32 getBinResId() { return m_anmResId; } + virtual u32 getEtcResId() { return m_anmResId; } + virtual u32 getMdlArchiveId() { return getArchiveId(); } + virtual u32 getTexArchiveId() { return getArchiveId(); } + virtual u32 getAnmArchiveId() { return getArchiveId(); } + virtual u32 getEtcArchiveId() { return getArchiveId(); } + virtual u32 getArchiveId() { return 0xFFFFFFFF; } + virtual u32 getBinArchiveId() { return getArchiveId(); } +}; +static_assert(sizeof(soResourceIdAccesserImpl) == 0x18, "Class is the wrong size!"); + +class soResourceIdAccesserNull : public soResourceIdAccesser { +public: + soResourceIdAccesserNull() : soResourceIdAccesser(true) { } + virtual ~soResourceIdAccesserNull() { } + virtual u32 getTexResId() { return 0xFFFF; } + virtual u32 getMdlResId() { return 0xFFFF; } + virtual u32 getAnmResId() { return 0xFFFF; } + virtual u32 getBinResId() { return 0xFFFF; } + virtual u32 getEtcResId() { return 0xFFFF; } + virtual u32 getArchiveId() { return 0xFFFFFFFF; } + virtual u32 getMdlArchiveId() { return 0xFFFFFFFF; } + virtual u32 getTexArchiveId() { return 0xFFFFFFFF; } + virtual u32 getAnmArchiveId() { return 0xFFFFFFFF; } + virtual u32 getEtcArchiveId() { return 0xFFFFFFFF; } + virtual u32 getBinArchiveId() { return 0xFFFFFFFF; } +}; +static_assert(sizeof(soResourceIdAccesserNull) == 0x8, "Class is the wrong size!"); + +extern soResourceIdAccesserNull g_soResourceIdAccesserNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_module_impl.h new file mode 100644 index 0000000000..1e6965a305 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/resource/so_resource_module_impl.h @@ -0,0 +1,89 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soResourceModule : private soNull, public soNullable { +public: + soResourceModule(bool isNull) : soNullable(isNull) { } + virtual ~soResourceModule() { } + virtual soResourceIdAccesser* getResourceIdAccesser() = 0; + virtual u32 getGroupNo(int unk1) = 0; + virtual void setGroupNo(u8 unk1, u16 index) = 0; + virtual nw4r::g3d::ResFile getTexFile(u16 fileIndex, u32 texResId) = 0; + virtual nw4r::g3d::ResFile getMdlFile(u16 fileIndex, u32 mdlResId) = 0; + virtual nw4r::g3d::ResFile getAnmFile(u16 fileIndex, u32 anmResId, u32 p3) = 0; + virtual nw4r::g3d::ResFile getBinFile(u32 binResId, u16 fileIndex, s32 archiveId) = 0; + virtual void* getFile(u32 resId, ARCNodeType nodeType, u16 fileIndex) = 0; +}; +static_assert(sizeof(soResourceModule) == 0xC, "Class is the wrong size!"); + +class soResourceModuleImpl : public soResourceModule { + // 0xC + int m_managerID; + // 0x10 + soResourceIdAccesser* m_resourceIdAccesser; + // 0x14 + char m_archiveType1; + // 0x15 + char m_archiveType2; + // 0x16 + char m_archiveType3; + // 0x17 + char m_archiveType4; +public: + soResourceModuleImpl(u32 mId, soResourceIdAccesser* rsrcIdAcc, u8 arcGrp); + + virtual ~soResourceModuleImpl(); + virtual soResourceIdAccesser* getResourceIdAccesser() { return m_resourceIdAccesser; } + virtual u32 getGroupNo(int unk1) { + // TODO: UBFIX just a char array? + u8* ptr = (u8*)((int)this + unk1); + return ptr[0x14]; + } + virtual void setGroupNo(u8 unk1, u16 index); + virtual nw4r::g3d::ResFile getTexFile(u16 fileIndex, u32 texResId); + virtual nw4r::g3d::ResFile getMdlFile(u16 fileIndex, u32 mdlResId); + virtual nw4r::g3d::ResFile getAnmFile(u16 fileIndex, u32 anmResId, u32 p3); + virtual nw4r::g3d::ResFile getBinFile(u32 binResId, u16 fileIndex, s32 archiveId); + virtual void* getFile(u32 resId, ARCNodeType nodeType, u16 fileIndex); +}; +static_assert(sizeof(soResourceModuleImpl) == 0x18, "Class is the wrong size!"); + +class soResourceModuleNull : public soResourceModule { +public: + soResourceModuleNull(bool isNull) : soResourceModule(true) { } + virtual ~soResourceModuleNull() { } + virtual soResourceIdAccesser* getResourceIdAccesser() { + return &g_soResourceIdAccesserNull; + } + virtual u32 getGroupNo(int unk1) { return 0; } + virtual void setGroupNo(u8 unk1, u16 index) { } + + virtual nw4r::g3d::ResFile getTexFile(u16 fileIndex, u32 texResId) { + return nw4r::g3d::ResFile(); + } + + virtual nw4r::g3d::ResFile getMdlFile(u16 fileIndex, u32 mdlResId) { + return nw4r::g3d::ResFile(); + } + + virtual nw4r::g3d::ResFile getAnmFile(u16 fileIndex, u32 anmResId, u32 p3) { + return nw4r::g3d::ResFile(); + } + + virtual nw4r::g3d::ResFile getBinFile(u32 binResId, u16 fileIndex, s32 archiveId) { + return nw4r::g3d::ResFile(); + } + + virtual void* getFile(u32 resId, ARCNodeType nodeType, u16 fileIndex) { + return nullptr; + } +}; +static_assert(sizeof(soResourceModuleNull) == 0xC, "Class is the wrong size!"); + +extern soResourceModuleNull g_soResourceModuleNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/shadow/so_shadow_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/shadow/so_shadow_module_impl.h new file mode 100644 index 0000000000..79c5657521 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/shadow/so_shadow_module_impl.h @@ -0,0 +1,87 @@ +#pragma once + +#include +#include +#include +#include + +class soShadowModule { +public: + virtual ~soShadowModule(); + virtual void activate(); + virtual void deactivate(); + virtual void setActive(bool); + virtual void setActiveStatus(int status); + virtual void update(); + virtual void setSize(int); + virtual void setNode(void*); + virtual void setSizeMinMax(float, float); + virtual void setYOffset(float); + virtual void setGroundRef(int); + virtual void setSizeMul(float); + virtual void setGroundPokemon(int); + virtual int getMode(); // maybe static? unsure. + virtual void setIgnoreMode(int); + virtual bool isDispProjection(); +}; + +class soShadowModuleImpl: public soShadowModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soModelEventObserver { +public: + virtual ~soShadowModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void setActive(bool); + virtual void setActiveStatus(int status); + virtual void update(); + virtual void setSize(int); + virtual void setNode(void*); + virtual void setSizeMinMax(float, float); + virtual void setYOffset(float); + virtual void setGroundRef(int); + virtual void setSizeMul(float); + virtual void setGroundPokemon(int); + virtual int getMode(); // maybe static? unsure. + virtual void setIgnoreMode(int); + virtual bool isDispProjection(); + + // statusEventObserver + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + + // animCmdEventObserver + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + + // modelEventObserver + virtual void notifyEventDestructInstance(soModuleAccesser* moduleAccesser); + + soModuleAccesser* m_moduleAccesser; // 0x28 + float _0x2C; + float _0x30; + float _0x34; + float _0x38; + float _0x3C; + int _0x40; + char _0x44; // looks like a bitfield of some kind. +}; +// Class is actually 0x45, but the extra space is padded out in Brawl anyway. +static_assert(sizeof(soShadowModuleImpl) == 0x48, "Class is wrong size!"); + +class soShadowModuleNull : soShadowModule { +public: + virtual ~soShadowModuleNull(); + virtual void activate(); + virtual void deactivate(); + virtual void setActive(bool); + virtual void setActiveStatus(int status); + virtual void update(); + virtual void setSize(int); + virtual void setNode(void*); + virtual void setSizeMinMax(float, float); + virtual void setYOffset(float); + virtual void setGroundRef(int); + virtual void setSizeMul(float); + virtual void setGroundPokemon(int); + virtual int getMode(); // maybe static? unsure. + virtual void setIgnoreMode(int); + virtual bool isDispProjection(); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_event_presenter.h new file mode 100644 index 0000000000..49a93961d4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_event_presenter.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +enum SituationKind { + Situation_None = -0x1, + Situation_Ground = 0x0, + Situation_Cliff = 0x1, + Situation_Air = 0x2, + Situation_Water = 0x3, + Situation_Restraint = 0x4, + Situation_Outfield = 0x5, + Situation_Ladder = 0x6, + Situation_ODD = 0x7 +}; + +class soSituationEventObserver : public soEventObserver { +public: + soSituationEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soSituationEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_module_impl.h new file mode 100644 index 0000000000..5549ffec1a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/situation/so_situation_module_impl.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soSituationModule { +public: + virtual ~soSituationModule(); + virtual void activate(); + virtual void deactivate(); + virtual SituationKind getKind(); + virtual SituationKind getPrevKind(); + virtual bool isSituationChanged(); + virtual void setKind(SituationKind kind, bool); + virtual void setKeepAir(bool); + virtual void update(); +}; +static_assert(sizeof(soSituationModule) == 4, "Class is wrong size!"); + +class soSituationModuleImpl : public soSituationModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soEventPresenter { + soModuleAccesser* m_moduleAccesser; + int m_kind; + int m_prevKind; + char _52[8]; + +public: + virtual ~soSituationModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual SituationKind getKind(); + virtual SituationKind getPrevKind(); + virtual bool isSituationChanged(); + virtual void setKind(SituationKind kind, bool); + virtual void setKeepAir(bool); + virtual void update(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soSituationModuleImpl) == 60, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/slope/so_slope_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/slope/so_slope_module_impl.h new file mode 100644 index 0000000000..92f7959ff3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/slope/so_slope_module_impl.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soSlopeStatusParam { +public: + typedef u32 StatusMask; + static const StatusMask STATUS_MASK_NONE = 0; + static const StatusMask STATUS_MASK_TOP = 1 << 0; + static const StatusMask STATUS_MASK_L = 1 << 1; + static const StatusMask STATUS_MASK_R = 1 << 2; + static const StatusMask STATUS_MASK_PART = 1 << 3; + static const StatusMask STATUS_MASK_LR = STATUS_MASK_L | STATUS_MASK_R; + static const StatusMask STATUS_MASK_TPART = STATUS_MASK_TOP | STATUS_MASK_PART; + + union Status { + u32 m_mask; + struct { + u32 : 28; + bool m_part : 1; + bool m_r : 1; + bool m_l : 1; + bool m_top : 1; + }; + inline Status() {} + inline Status(StatusMask mask) : m_mask(mask) {} + } m_status; + int m_0x4; + bool m_0x8; + char _0x9[3]; +}; +static_assert(0xC == sizeof(soSlopeStatusParam), "Class is wrong size!"); + +class soSlopeModule { +public: + virtual ~soSlopeModule(); + virtual void activate(); + virtual void setStatus(u32 statusMask, int, bool); + virtual soSlopeStatusParam::Status getStatus(); + virtual void update(bool); + virtual void updateModelTopAngle(); + virtual void setTopAngleUnlimit(bool); + virtual void setPartNode(int); + virtual void setInvalidStatus(u32 statusMask); +}; + +class soSlopeModuleImpl : public soSlopeModule, public soStatusEventObserver, public soAnimCmdEventObserver { + soModuleAccesser* m_moduleAccesser; + int m_0x20; + int m_0x24; + soSlopeStatusParam::Status m_status; + char _0x2c[8]; + soArrayVector m_statusParamArrayVector; + float _0x4c; + char _0x50[28]; + int m_0x6C; + float m_0x70; + int m_partNode; + soSlopeStatusParam::Status m_invalidStatus; + u8 m_0x7C; + bool m_isTopAngleUnlimit; + char _0x7E[2]; +public: + virtual ~soSlopeModuleImpl(); + virtual void activate(); + virtual void setStatus(u32 statusMask, int, bool); + virtual soSlopeStatusParam::Status getStatus(); + virtual void update(bool); + virtual void updateModelTopAngle(); + virtual void setTopAngleUnlimit(bool); + virtual void setPartNode(int); + virtual void setInvalidStatus(u32 statusMask); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_impl.h new file mode 100644 index 0000000000..13268ccbac --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_impl.h @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soSlowModuleImpl : public soSlowModuleSimple, public soAnimCmdEventObserver { + char _36[4]; + int m_frame; + u8 m_44; + char _45[3]; + int m_wholeFrame; + int m_mag; + +public: + virtual ~soSlowModuleImpl(); + virtual void activate(); + virtual void deactivate(); + virtual void update(bool); + virtual void resetSkip(); + virtual void set(int mag, int frame); + virtual int getMag(); + virtual int getFrame(); + virtual void clear(); + virtual void setWhole(int, int wholeFrame); + virtual void clearWhole(); + virtual u8 getWholeMag(); + virtual void setWholeFrame(int wholeFrame); + virtual int getWholeFrame(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soSlowModuleImpl) == 56, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_simple.h new file mode 100644 index 0000000000..793682982f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/slow/so_slow_module_simple.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soSlowModule : public soNull, public soNullable { +public: + virtual ~soSlowModule(); + virtual void activate(); + virtual void deactivate(); + virtual void update(bool); + virtual void resetSkip(); + virtual bool isSlow(); + virtual void set(int mag, int frame); + virtual int getMag(); + virtual int getFrame(); + virtual void clear(); + virtual float getRate(); + virtual bool isSkip(); + virtual void setWhole(int, int wholeFrame); + virtual void clearWhole(); + virtual u8 getWholeMag(); + virtual void setWholeFrame(int wholeFrame); + virtual int getWholeFrame(); +}; +static_assert(sizeof(soSlowModule) == 12, "Class is wrong size!"); + +class soSlowModuleSimple : public soSlowModule { + soModuleAccesser* m_moduleAccesser; + float m_rate; + bool m_isSkip; + char _pad[3]; + +public: + virtual ~soSlowModuleSimple(); + virtual void activate(); + virtual void deactivate(); + virtual void update(bool); + virtual void resetSkip(); + virtual bool isSlow(); + virtual void set(int mag, int frame); + virtual int getMag(); + virtual int getFrame(); + virtual void clear(); + virtual float getRate(); + virtual bool isSkip(); + virtual void setWhole(int, int wholeFrame); + virtual void clearWhole(); + virtual u8 getWholeMag(); + virtual void setWholeFrame(int wholeFrame); + virtual int getWholeFrame(); +}; +static_assert(sizeof(soSlowModuleSimple) == 24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_activate.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_activate.h new file mode 100644 index 0000000000..fec12b6997 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_activate.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +class soActivatable { +public: + soActivatable(bool active) : m_isActive(active) { } + virtual ~soActivatable() { } + + bool m_isActive; + void setActive(bool active) { m_isActive = active; } +}; +static_assert(sizeof(soActivatable) == 8, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_archive_db.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_archive_db.h new file mode 100644 index 0000000000..a5b3713c97 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_archive_db.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +// TODO: class size +class soArchiveDb { +public: + static utArchiveManager* getManager(u32 index); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_array.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_array.h new file mode 100644 index 0000000000..ab0fbb31b1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_array.h @@ -0,0 +1,730 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +template +class soSet { + T* m_elements; + size_t m_size; + +public: + T* elements() { + return m_elements; + } + + u32 size() { + return m_size; + } +}; + +template +class soArrayFixed : public soNullableInterface { +public: + + virtual bool isNull() const { return false; } + virtual T& at(s32 index) = 0; + virtual const T& at(s32 index) const = 0; + virtual s32 size() const = 0; + virtual bool isEmpty() const { return this->size() == 0; } + virtual ~soArrayFixed() { }; +}; + +template +class soArrayFixedNull : soArrayFixed { +public: + virtual bool isNull() const { return true; } + virtual T& at(s32 index) { + static T m_nullElement; + return m_nullElement; + }; + virtual const T& at(s32 index) const { + static T m_nullElement; + return m_nullElement; + }; + virtual s32 size() const { return 0; } + virtual ~soArrayFixedNull() { } +}; + +template +class soArrayContractible : public soArrayFixed { +public: + virtual ~soArrayContractible() { } + virtual void shift() = 0; + virtual void pop() = 0; + virtual void clear() = 0; +}; + +template +class soArrayContractibleTable : public soArrayContractible, + public soConnectable > { + T* m_elements; + s32 m_size; +public: + soArrayContractibleTable() : m_elements(nullptr), m_size(0) { } + soArrayContractibleTable(T* elmnts, s32 size) : m_elements(elmnts), m_size(size) { + if (!elmnts) { + this->m_size = 0; + } + } + + virtual ~soArrayContractibleTable() { } + + soArrayContractibleTable& operator=(const soArrayContractibleTable& other) { + if (this == &other) + return *this; + soConnectable >::operator=(other); + const bool noElements = (other.m_elements == nullptr); + m_elements = other.m_elements; + m_size = other.m_size; + if (noElements) + m_size = 0; + return *this; + } + + virtual T& at(s32 index) { return atSub(index); } + virtual const T& at(s32 index) const { return atSub(index); } + + virtual void shift() { + if (!this->isEmpty()) { + if (m_size > 0) { + if (--m_size <= 0) { + m_elements = nullptr; + } else { + m_elements++; + } + } else if (this->m_link) { + this->m_link->shift(); + } + } + } + + virtual void pop() { + if (this->m_link && !this->m_link->isEmpty()) { + this->m_link->pop(); + } else if (m_size > 0) { + m_size--; + } + } + + virtual void clear() { + if (this->m_link) { + this->m_link->clear(); + } + m_elements = nullptr; + m_size = 0; + } + + virtual s32 size() const { + s32 res = m_size; + if (!m_elements) { + res = 0; + } + if (this->m_link) { + return res + this->m_link->size(); + } + return res; + } + + bool isNull() const { return false; } + + virtual T& atSub(s32 index) const { + if (index >= m_size && this->m_link) { + return this->m_link->at(index - m_size); + } + return m_elements[index]; + } +}; + +template +class soArrayContractibleNull : public soArrayContractible { + +public: + bool isNull() const { return true; } + virtual T& at(s32 index) { + static T nullObject; + return nullObject; + } + virtual const T& at(s32 index) const { + static T nullObject; + return nullObject; + } + virtual s32 size() const { + return 0; + } + virtual ~soArrayContractibleNull() { } + virtual void shift() { } + virtual void pop() { } + virtual void clear() { } +}; + +template +class soArray : public soArrayContractible { +public: + virtual ~soArray() {}; + + virtual void unshift(const T&) = 0; + virtual void push(const T&) = 0; + virtual void insert(s32, const T&) = 0; + virtual void erase(s32) = 0; + virtual s32 capacity() const = 0; + virtual bool isFull() const = 0; + virtual void set(s32 startingIndex, const T& element, s32 numIndicesToSet) = 0; +}; + +template +class soArrayNull : public soArray { + +public: + virtual bool isNull() const { return true; } + virtual T& at(s32 index) { + static T m_nullElement; + return m_nullElement; + }; + virtual const T& at(s32 index) const { + static T m_nullElement; + return m_nullElement; + }; + virtual s32 size() const { return 0; } + virtual ~soArrayNull() { } + virtual void shift() { return; } + virtual void pop() { return; } + virtual void clear() { return; } + virtual void unshift(const T&) { return; } + virtual void push(const T&) { return; } + virtual void insert(s32, const T&) { return; } + virtual void erase(s32) { return; } + virtual s32 capacity() const { return 0; } + virtual bool isFull() const { return true; } + virtual void set(s32 startingIndex, const T& element, s32 numIndicesToSet) { } + + soArrayNull() { } + soArrayNull(s32 size, s32 = 0) { } + soArrayNull(s32 size, const T& element, s32) { } +}; + +template +struct soArrayListUnit { + u8 m_inUse : 1; + ElementTy m_element; + IndexTy m_prev; + IndexTy m_next; + + static const s32 End = -1; + + soArrayListUnit() : m_inUse(false), m_prev(End), m_next(End) { } + ~soArrayListUnit() { } + + void setNext(IndexTy n) { m_next = n; } +}; + +template +class soEnumerator : public soNullable { +public: + virtual bool next() = 0; + virtual bool hasNext() const = 0; + virtual bool isEnd() const = 0; + virtual T& getCurrent() const = 0; + virtual ~soEnumerator() = 0; +}; + +template +struct soArrayListEnumerator : public soEnumerator { + soArrayListUnit* m_units; + s32 m_next; + + static const s32 End = -1; +public: + soArrayListEnumerator() : m_units(nullptr), m_next(End) { } + soArrayListEnumerator(soArrayListUnit* units, s32 next) : + m_units(units), m_next(next) { } + s32 getNext() const { return m_next; } + + // TODO: verify whether ft_pikmin code triggers the generation + // of an implicitly-defined copy-assign and copy-ctor + + virtual bool next() { + if (!hasNext()) { + m_next = End; + return false; + } + m_next = m_units[m_next].m_next; + return true; + } + + virtual bool hasNext() const { + return m_units[m_next].m_next >= 0; + } + + virtual bool isEnd() const { + return m_next < 0; + } + + virtual ElementTy& getCurrent() const { + return m_units[m_next].m_element; + } + + virtual ~soArrayListEnumerator() { } +}; + +// A dynamic array of soArrayListUnits, but with a fixed maximum capacity. +// Each unit has a logical "position" corresponding to an actual "index" +// in the internal array. This distinction is implemented via an intrusive +// doubly-linked list connecting the units; see getArrayIndex for details. +template +class soArrayList : public soArray { + // The index of the next available free unit in the list + s32 m_freeIndex : sizeof(bit_width) + 1; + // The index of logical position 0 + s32 m_topIndex : sizeof(bit_width) + 1; + // The index of logical position size() - 1 + s32 m_lastIndex : sizeof(bit_width) + 1; + // The current number of allocated units + s32 m_size : sizeof(bit_width) + 1; + + soArrayListUnit m_units[C]; + + // Allocate an soArrayListUnit from the internal list, + // incrementing the size and returning the index of the + // allocated unit. If idx is negative, get the next available + // free unit. In practice, idx is always negative + s32 shiftFreeArrayIndex(s32 idx); + // Get the index of the element at position pos + s32 getArrayIndex(s32 pos) const; + // Make space in the list such that a new element may be assigned + // to the returned index, if space is available. The index returned + // corresponds to the logical position prevPos+1 + s32 insertSub(s32 prevPos, s32 where = End); + // Make all necessary updates to the internal linked list of units + // to erase the element at idx + void eraseSub(s32 idx); + + s32 getFreeIndex() const { return m_freeIndex; } + + // Mark the element at idx as deleted, and set idx to m_freeIndex + void clearElement(s32 idx) { + if (idx >= 0) { + m_units[idx].m_next = m_freeIndex; + m_units[idx].m_prev = End; + m_units[idx].m_inUse = false; + if (m_freeIndex > 0) + m_units[idx].m_prev = idx; + m_freeIndex = idx; + m_size--; + } + } + + static const s32 End = -1; +public: + // Note that the call to clear() immediately overwrites a 0 to m_freeIndex, so + // allocations begin at the start of the fixed internal array. + soArrayList() : m_freeIndex(End), m_topIndex(End), m_lastIndex(End) { + clear(); + } + + virtual bool isNull() const { + return false; + } + + virtual T& at(s32 i) { + s32 idx = getArrayIndex(i); + if (this->isEmpty() != true && idx >= 0) + static_cast(capacity()); + return m_units[idx].m_element; + } + + virtual const T& at(s32 i) const { + s32 idx = getArrayIndex(i); + if (this->isEmpty() != true && idx >= 0) + static_cast(capacity()); + return m_units[idx].m_element; + } + + virtual s32 size() const { + return m_size; + } + + virtual ~soArrayList() { } + + // Erase the element in the first position + virtual void shift() { + eraseSub(getArrayIndex(0)); + } + + // Erase the element in the last position + virtual void pop() { + eraseSub(getArrayIndex(size() - 1)); + } + + // Erase all elements of the list, resetting the bitfields and linked list + virtual void clear() { + m_freeIndex = 0; + m_topIndex = End; + m_lastIndex = End; + m_size = 0; + + if (capacity() == 1) { + m_units[0].m_prev = End; + m_units[0].m_next = End; + m_units[0].m_inUse = false; + } else { + for (s32 i = 0; i < capacity(); i++) { + m_units[i].m_prev = i - 1; + m_units[i].m_next = i + 1; + m_units[i].m_inUse = false; + } + m_units[capacity() - 1].setNext(End); + } + } + + // Prepend elm to the list, if space is available + virtual void unshift(const T& elm) { + s32 idx = insertSub(-1); + if (idx >= 0) + m_units[idx].m_element = elm; + } + + // Append elm to the list, if space is available + virtual void push(const T& elm) { + s32 idx = insertSub(size() - 1); + if (idx >= 0) + m_units[idx].m_element = elm; + } + + // Insert elm at position i of the list, if i is in range and space is + // available + virtual void insert(s32 pos, const T& elm) { + s32 idx = insertSub(pos - 1); + if (idx >= 0) + m_units[idx].m_element = elm; + } + + // Erase the element at position pos + virtual void erase(s32 pos) { + eraseSub(getArrayIndex(pos)); + } + + virtual s32 capacity() const { + return C; + } + + virtual bool isFull() const { + return m_freeIndex < 0; + } + + // Starting at position pos, assign elm to consecutive elements, stopping + // when either count or the end of the list has been reached + virtual void set(s32 pos, const T& elm, s32 count) { + if (count) { + if (count + pos >= size()) + count = size() - pos; + s32 curr = m_topIndex; + while (count > 0) { + if (pos > 0) + pos--; + else { + m_units[curr].m_element = elm; + count--; + } + if ((curr = m_units[curr].m_next) < 0) + break; + } + } + } + + // TODO: check implicit generation by for these two + soArrayListEnumerator getEnumerator() { + return soArrayListEnumerator(m_units, m_topIndex); + } + + // Erase the element at position enm.getNext() + void erase(const soArrayListEnumerator& enm) { + eraseSub(enm.getNext()); + } + + soArrayListUnit* getUnits() { return m_units; } +}; + +template +s32 soArrayList::shiftFreeArrayIndex(s32 idx) { + if (isFull() == true) + return End; + if (idx < 0) { + s32 freeIndex = getFreeIndex(); + m_freeIndex = m_units[m_freeIndex].m_next; + if (m_freeIndex > 0) + m_units[m_freeIndex].m_prev = End; + m_size++; + return freeIndex; + } + + // Note: the remainder of this function is unused, since + // all callers pass -1 for idx. It apparently removes the + // soArrayListUnit at position idx from the doubly-linked list. + if (idx >= capacity()) + return End; + const soArrayListUnit& curr = m_units[idx]; + if (static_cast(curr.m_inUse) == true) + return End; + s32 next = curr.m_next; + s32 prev = curr.m_prev; + if (prev < 0 && next < 0) + m_freeIndex = End; + else if (prev < 0) { + m_units[next].m_prev = End; + m_freeIndex = curr.m_next; + } else if (next < 0) + m_units[prev].m_next = End; + else { + m_units[prev].m_next = next; + m_units[next].m_prev = prev; + } + m_size++; + return idx; +} + +template +s32 soArrayList::getArrayIndex(s32 pos) const { + if (pos < 0 || pos >= size()) + return End; + if (pos == 0) + return m_topIndex; + if (pos == size() - 1) + return m_lastIndex; + s32 count = pos; + s32 curr = m_topIndex; + if (pos > size() / 2) { + // Step from the back of the list instead + count = size() - pos - 1; + curr = m_lastIndex; + } + for (s32 i = 0; i < size(); i++) { + if (i == count) + return curr; + if (pos > size() / 2) + curr = m_units[curr].m_prev; + else + curr = m_units[curr].m_next; + if (curr < 0) + break; + } + return End; +} + +template +s32 soArrayList::insertSub(s32 prevPos, s32 where) { + s32 prevIdx = End; + if (prevPos >= 0) { + prevIdx = getArrayIndex(prevPos); + if (prevIdx < 0) + return End; + } + s32 freeIdx = shiftFreeArrayIndex(where); + if (freeIdx < 0) + return End; + + s32 newNext = End; + if (prevIdx < 0) + newNext = m_topIndex; + else if (m_units[prevIdx].m_next >= 0) + newNext = m_units[prevIdx].m_next; + + if (prevIdx >= 0) + m_units[prevIdx].m_next = freeIdx; + else + m_topIndex = freeIdx; + + m_units[freeIdx].m_prev = prevIdx; + if (newNext >= 0) + m_units[newNext].m_prev = freeIdx; + else + m_lastIndex = freeIdx; + m_units[freeIdx].m_next = newNext; + m_units[freeIdx].m_inUse = true; + return freeIdx; +} + +template +void soArrayList::eraseSub(s32 idx) { + if (idx < 0 || idx >= capacity()) + return; + if (size() == 1) { + m_topIndex = End; + m_lastIndex = End; + clearElement(idx); + } else { + s32 next = getUnits()[idx].m_next; + s32 prev = getUnits()[idx].m_prev; + + // Remove from list + if (prev < 0) { + m_units[next].m_prev = End; + m_topIndex = next; + } else if (next < 0) { + m_units[prev].m_next = End; + m_lastIndex = prev; + } else { + m_units[prev].m_next = next; + m_units[next].m_prev = prev; + } + clearElement(idx); + } +} + +class soArrayVectorCalcInterface { +public: + virtual void substitution(s32, s32) = 0; + virtual void onFull() = 0; + virtual void offFull() = 0; + virtual void setTopIndex(s32) = 0; + virtual void setLastIndex(s32) = 0; + virtual ~soArrayVectorCalcInterface() { } +}; + +template +class soArrayVectorAbstract : public soArray, public soArrayVectorCalcInterface { +public: + virtual bool isNull() const { + return false; + } + virtual T& at(s32 index) { + return this->atFastAbstractSub(index); + } + virtual const T& at(s32 index) const { + return this->atFastAbstractSub(index); + } + virtual ~soArrayVectorAbstract() { } + virtual void shift() { + soArrayVectorCalculator::shift(*this, this->isEmpty(), this->capacity(), this->getTopIndex()); + this->setSize(this->size() - 1); + } + virtual void pop() { + soArrayVectorCalculator::pop(*this, this->isEmpty(), this->capacity(), this->getLastIndex()); + this->setSize(this->size() - 1); + } + virtual void clear() { + soArrayVectorCalculator::clear(*this); + this->setSize(0); + } + virtual void unshift(const T& newElement) { + s32 topIndex = soArrayVectorCalculator::unshift(*this, this->isFull(), this->capacity(), this->getTopIndex(), this->getLastIndex()); + T& element = this->getArrayValueConst(topIndex); + element = newElement; + this->setSize(this->size() + 1); + } + virtual void push(const T& newElement) { + s32 lastIndex = soArrayVectorCalculator::push(*this, this->isFull(), this->capacity(), this->getTopIndex(), this->getLastIndex()); + T& element = this->getArrayValueConst(lastIndex); + element = newElement; + this->setSize(this->size() + 1); + } + virtual void insert(s32 index, const T& newElement) { + s32 lastIndex = soArrayVectorCalculator::insert(*this, index, this->isFull(), this->size(), this->capacity(), this->getTopIndex(), this->getLastIndex()); + T& element = this->getArrayValueConst(lastIndex); + element = newElement; + this->setSize(this->size() + 1); + } + virtual void erase(s32 index) { + soArrayVectorCalculator::erase(*this, index, this->size(), this->capacity(), this->getTopIndex(), this->getLastIndex()); + this->setSize(this->size() - 1); + } + virtual s32 capacity() const = 0; + + virtual void set(s32 start, const T& elm, s32 count) { + int c = count; + if (c + start >= this->size()) + c = this->size() - start; + for (s32 i = 0; i < c; i++) + this->at(start+i) = elm; + } + + virtual T& atFastAbstractSub(s32 index) const = 0; + virtual void substitution(s32 subIndex, s32 targetIndex) { + T& subElement = this->getArrayValueConst(subIndex); + T& targetElement = this->getArrayValueConst(targetIndex); + targetElement = subElement; + } + virtual T& getArrayValueConst(s32) = 0; + virtual s32 getTopIndex() const = 0; + virtual s32 getLastIndex() const = 0; + virtual void setSize(s32) = 0; +}; + +template +class soArrayVector : public soArrayVectorAbstract { + s32 m_topIndex : sizeof(bit_width) + 1; + s32 m_lastIndex : sizeof(bit_width) + 1; + s32 m_size : sizeof(bit_width) + 1; + u32 m_isFull : 1; + + T m_elements[C]; + +public: + virtual s32 size() const { return m_size; } + virtual ~soArrayVector() { } + virtual s32 capacity() const { return C; } + virtual bool isFull() const { return m_isFull; } + + virtual T& atFastAbstractSub(s32 index) const { + return atFast(index); + } + virtual T& getArrayValueConst(s32 index) { + return this->m_elements[index]; + } + virtual s32 getTopIndex() const { return m_topIndex; } + virtual s32 getLastIndex() const { return m_lastIndex; } + virtual void setSize(s32 size) { m_size = size; } + virtual void setTopIndex(s32 topIndex) { m_topIndex = topIndex; } + virtual void setLastIndex(s32 lastIndex) { m_lastIndex = lastIndex; } + virtual void onFull() { m_isFull = true; } + virtual void offFull() { m_isFull = false; } + + soArrayVector() : m_topIndex(0), m_lastIndex(0), m_size(0), m_isFull(false) { } + + soArrayVector(s32 size, s32 = 0) { + m_topIndex = 0; + m_lastIndex = 0; + m_isFull = false; + m_size = size; + soArrayVectorCalculator::postInitialize(*this, size, C); + } + soArrayVector(s32 size, const T& element, s32) { + m_topIndex = 0; + m_lastIndex = 0; + m_size = 0; + m_isFull = false; + size = soArrayVectorCalculator::resize(*this, size, this->isEmpty(), this->isFull(), this->capacity(), this->getTopIndex(), this->getLastIndex()); + for (u32 i = 0; i < size; i++) { + this->push(element); + } + } + T& atFast(s32 idx) const { + s32 i = m_topIndex + idx; + if (i >= C) + i -= C; + return const_cast(m_elements[i]); + } +}; + +template +class soArrayVector : public soArrayNull { +public: + inline soArrayVector() : soArrayNull() { } + inline soArrayVector(s32 size, s32 unk) : soArrayNull(size, unk) { } + inline soArrayVector(s32 size, const T& element, s32 unk) : soArrayNull(size, element, unk) { } +}; + +template +soArray& getNullArray() { + static soArrayNull NullObj; + return NullObj; +} + +extern soArrayNull g_s32ArrayNull; +extern soArrayNull g_floatArrayNull; +extern soArrayNull > g_s32GeneralFlagArrayNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_array_vector_calculator.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_array_vector_calculator.h new file mode 100644 index 0000000000..8d9a815121 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_array_vector_calculator.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +class soArrayVectorCalcInterface; + +namespace soArrayVectorCalculator { + void shift(soArrayVectorCalcInterface& interface, bool isEmpty, s32 capacity, s32 topIndex); + void pop(soArrayVectorCalcInterface& interface, bool isEmpty, s32 capacity, s32 lastIndex); + void clear(soArrayVectorCalcInterface& interface); + s32 unshift(soArrayVectorCalcInterface& interface, bool isFull, s32 capacity, s32 topIndex, s32 lastIndex); + s32 push(soArrayVectorCalcInterface& interface, bool isFull, s32 capacity, s32 topIndex, s32 lastIndex); + s32 insert(soArrayVectorCalcInterface& interface, s32 index, bool isFull, s32 size, s32 capacity, s32 topIndex, s32 lastIndex); + void erase(soArrayVectorCalcInterface& interface, s32 index, s32 size, s32 capacity, s32 topIndex, s32 lastIndex); + s32 resize(soArrayVectorCalcInterface& interface, s32 size, bool isEmpty, bool isFull, s32 capacity, s32 topIndex, s32 lastIndex); + void postInitialize(soArrayVectorCalcInterface& interface, s32 size, s32 capacity); +} diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_common_data_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_common_data_accesser.h new file mode 100644 index 0000000000..5146cd5a16 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_common_data_accesser.h @@ -0,0 +1,699 @@ +#pragma once + +#include +#include +#include +#include + +// TODO: Define these classes and decide which headers they should belong to + +struct soMotionData { }; +struct ftMotionData : public soMotionData { }; +struct wnMotionData : public soMotionData { }; + +struct soShakeData { }; +struct ftShakeData : public soShakeData { }; +struct wnShakeData : public soShakeData { }; + +struct soJostleData { }; +struct ftJostleData : public soJostleData { }; +struct wnJostleData : public soJostleData { }; + +struct soIkData { }; +struct ftIkData : public soIkData { }; +struct wnIkData : public soIkData { }; + +struct soVisibilityData { }; +struct ftVisibilityData : public soVisibilityData { }; +struct wnVisibilityData : public soVisibilityData { }; + +struct soStatusData { }; +struct ftStatusData : public soStatusData { }; +struct wnStatusData : public soStatusData { }; + +struct soPreCheckAnimCmdData { }; +struct ftPreCheckAnimCmdData : public soPreCheckAnimCmdData { }; + +struct soEffectCommonData { }; +struct ftEffectCommonData : public soEffectCommonData { }; +struct wnEffectCommonData : public soEffectCommonData { }; + +struct soEffectScreenData { }; +struct ftEffectScreenData : public soEffectScreenData { }; + +struct soCommonParamFloat { + float data[40]; +}; + +struct soCommonParamInt { + s32 data[5]; +}; + +struct soCommonParamIndefinite { + s32* data[1]; +}; + +struct soCommonParam { + float m_0; + float m_4; + float m_8; + float m_C; + + s32 m_10; + s32 m_14; + float m_18; + float m_1C; + + float m_20; + float m_24; + float m_28; + float m_2C; + + float m_30; + float m_34; + float m_38; + float m_3C; + + float m_40; + s32 m_44; + float m_48; + float m_4C; + + float m_50; + float m_54; + s32 m_58; + float m_5C; + + float m_60; + s32 m_64; + u8 unk68[0x4]; + float m_6C; + + float m_70; + float m_74; + float m_78; + float m_7C; + + float m_80; + float m_84; + float m_88; + float m_8C; + + float m_90; + float m_94; + float m_98; + float m_9C; + + float m_A0; + float m_A4; + float m_A8; + float m_AC; + + float m_B0; + float m_B4; + s32 m_B8; +}; + +struct ftCommonParamFloat { + float m_0[0x17E]; +}; + +struct ftCommonParamIndefinite { + s32* m_0[0x5]; +}; + +struct ftCommonParamInt { + s32 m_0[0x8D]; +}; + +struct ftCommonParam { + s32 m_0; + float m_4; + float m_8; + float m_c; + float m_10; + float m_14; + float m_18; + s32 m_1c; + float m_20; + float m_24; + s32 m_28; + s32 m_2c; + float m_30; + float m_34; + float m_38; + float m_3c; + float m_40; + s32 m_44; + float m_48; + float m_4c; + float m_50; + float m_54; + float m_58; + float m_5c; + float m_60; + float m_64; + float m_68; + s32 m_6c; + float m_70; + float m_74; + float m_78; + float m_7c; + float m_80; + float m_84; + s32 m_88; + float m_8c; + float m_90; + float m_94; + float m_98; + s32 m_9c; + float m_a0; + s32 m_a4; + float m_a8; + float m_ac; + float m_b0; + float m_b4; + float m_b8; + float m_bc; + float m_c0; + float m_c4; + float m_c8; + float m_cc; + float m_d0; + float m_d4; + float m_d8; + float m_dc; + float m_e0; + float m_e4; + float m_e8; + float m_ec; + s32 m_f0; + float m_f4; + s32 m_f8; + float m_fc; + float m_100; + float m_104; + float m_108; + float m_10c; + s32 m_110; + float m_114; + float m_118; + float m_11c; + float m_120; + float m_124; + s32 m_128; + float m_12c; + float m_130; + float m_134; + float m_138; + float m_13c; + s32 m_140; + float m_144; + float m_148; + float m_14c; + s32 m_150; + s32 m_154; + float m_158; + s32 m_15c; + float m_160; + float m_164; + float m_168; + float m_16c; + float m_170; + s32 m_174; + float m_178; + s32 m_17c; + s32 m_180; + float m_184; + float m_188; + s32 m_18c; + s32 m_190; + float m_194; + float m_198; + s32 m_19c; + s32 m_1a0; + s32 m_1a4; + float m_1a8; + float m_1ac; + s32 m_1b0; + s32 m_1b4; + float m_1b8; + float m_1bc; + float m_1c0; + float m_1c4; + float m_1c8; + float m_1cc; + float m_1d0; + float m_1d4; + s32 m_1d8; + float m_1dc; + float m_1e0; + float m_1e4; + float m_1e8; + float m_1ec; + s32 m_1f0; + s32 m_1f4; + float m_1f8; + s32 m_1fc; + float m_200; + float m_204; + s32 m_208; + s32 m_20c; + float cursorForceDispDistance; + s32 m_214; + s32 m_218; + s32 m_21c; + s32 m_220; + s32 m_224; + float m_228; + float m_22c; + float m_230; + s32 noDiscretionFinalCount; + float m_238; + float m_23c; + float m_240; + s32 m_244; + float m_248; + s32 m_24c; + s32 m_250; + float m_254; + s32 m_258; + float m_25c; + float m_260; + float m_264; + s32 m_268; + float m_26c; + float m_270; + s32 m_274; + float m_278; + float m_27c; + s32 m_280; + float m_284; + float m_288; + float m_28c; + s32 m_290; + float m_294; + float m_298; + s32 m_29c; + float m_2a0; + float m_2a4; + float m_2a8; + float m_2ac; + float m_2b0; + float m_2b4; + float m_2b8; + float m_2bc; + float m_2c0; + float m_2c4; + float m_2c8; + float m_2cc; + float m_2d0; + float m_2d4; + s32 m_2d8; + s32 m_2dc; + float m_2e0; + float m_2e4; + float m_2e8; + float m_2ec; + float m_2f0; + float m_2f4; + float m_2f8; + s32 m_2fc; + s32 m_300; + float m_304; + s32 m_308; + float m_30c; + float m_310; + float m_314; + float m_318; + float m_31c; + s32 m_320; + s32 m_324; + float m_328; + float m_32c; + s32 m_330; + float m_334; + float m_338; + float m_33c; + float m_340; + float m_344; + float m_348; + s32 m_34c; + float m_350; + float m_354; + float m_358; + s32 m_35c; + s32 m_360; + s32 m_364; + float m_368; + float m_36c; + float m_370; + float m_374; + float m_378; + float m_37c; + s32 m_380; + s32 m_384; + float m_388; + float m_38c; + float m_390; + float m_394; + s32 m_398; + float m_39c; + float m_3a0; + s32 m_3a4; + float m_3a8; + float m_3ac; + float m_3b0; + float m_3b4; + s32 m_3b8; + float m_3bc; + float m_3c0; + float m_3c4; + float m_3c8; + float m_3cc; + float m_3d0; + float m_3d4; + float m_3d8; + float m_3dc; + s32 m_3e0; + s32 m_3e4; + s32 m_3e8; + s32 m_3ec; + float m_3f0; + float m_3f4; + float m_3f8; + float m_3fc; + float m_400; + float m_404; + float m_408; + float m_40c; + float m_410; + s32 m_414; + float m_418; + float m_41c; + float m_420; + float m_424; + float m_428; + float m_42c; + float m_430; + float m_434; + float m_438; + float m_43c; + float m_440; + float m_444; + float m_448; + float m_44c; + float m_450; + float m_454; + s32 m_458; + s32 m_45c; + s32 m_460; + s32 m_464; + float m_468; + float m_46c; + float m_470; + float m_474; + float m_478; + float m_47c; + float m_480; + float m_484; + float m_488; + float m_48c; + float m_490; + float m_494; + float m_498; + float m_49c; + float m_4a0; + float m_4a4; + float m_4a8; + float m_4ac; + float m_4b0; + float m_4b4; + float m_4b8; + float m_4bc; + float m_4c0; + float m_4c4; + s32 m_4c8; + float m_4cc; + float m_4d0; + float m_4d4; + float m_4d8; + float m_4dc; + float m_4e0; + float m_4e4; + float m_4e8; + float m_4ec; + s32 m_4f0; + float m_4f4; + float m_4f8; + float m_4fc; + float m_500; + float m_504; + float m_508; + float m_50c; + float m_510; + float m_514; + float m_518; + float m_51c; + float m_520; + float m_524; + float m_528; + s32 m_52c; + s32 m_530; + float m_534; + float m_538; + float m_53c; + s32 m_540; + float m_544; + float m_548; + float m_54c; + s32 m_550; + float m_554; + float m_558; + s32 m_55c; + s32 m_560; + s32 m_564; + float m_568; + float m_56c; + s32 m_570; + s32 m_574; + float m_578; + float m_57c; + float m_580; + s32 m_584; + s32 m_588; + s32 m_58c; + s32 m_590; + float m_594; + float m_598; + float m_59c; + s32 m_5a0; + float m_5a4; + float m_5a8; + float m_5ac; + float m_5b0; + float m_5b4; + float m_5b8; + float m_5bc; + float m_5c0; + s32 m_5c4; + float m_5c8; + float m_5cc; + float m_5d0; + float m_5d4; + float m_5d8; + float m_5dc; + float m_5e0; + float m_5e4; + s32 m_5e8; + float m_5ec; + float m_5f0; + float m_5f4; + float m_5f8; + float m_5fc; + float m_600; + float m_604; + float m_608; + float m_60c; + float m_610; + float m_614; + float m_618; + float m_61c; + float m_620; + float m_624; + float m_628; + float m_62c; + float m_630; + float m_634; + float m_638; + float m_63c; + float m_640; + float m_644; + float m_648; + float m_64c; + float m_650; + float m_654; + float m_658; + float m_65c; + float m_660; + float m_664; + float m_668; + float m_66c; + float m_670; + float m_674; + float m_678; + float m_67c; + float m_680; + float m_684; + float m_688; + float m_68c; + float m_690; + float m_694; + float m_698; + float m_69c; + float m_6a0; + float m_6a4; + float m_6a8; + float m_6ac; + float m_6b0; + float m_6b4; + float m_6b8; + float m_6bc; + float m_6c0; + float m_6c4; + float m_6c8; + float m_6cc; + float m_6d0; + s32 m_6d4; + float m_6d8; + float m_6dc; + float m_6e0; + float m_6e4; + s32 m_6e8; + s32 m_6ec; + s32 m_6f0; + s32 m_6f4; + s32 m_6f8; + s32 m_6fc; + s32 m_700; + s32 m_704; + s32 m_708; + float m_70c; + float m_710; + s32 m_714; + float m_718; + s32 m_71c; + float m_720; + float m_724; + float m_728; + float m_72c; + float m_730; + s32 m_734; + s32 m_738; + s32 m_73c; + s32 m_740; + s32 m_744; + s32 m_748; + float m_74c; + float m_750; + float m_754; + float m_758; + float m_75c; + float m_760; + s32 m_764; + float m_768; + float m_76c; + float m_770; + s32 m_774; + s32 m_778; + float m_77c; + float m_780; + s32 m_784; + s32 m_788; + s32 m_78c; + s32 m_790; + float m_794; + float m_798; + float m_79c; + float m_7a0; + float m_7a4; + float m_7a8; + float m_7ac; + float m_7b0; + s32 m_7b4; + float m_7b8; + s32 m_7bc; + float m_7c0; + float m_7c4; + float m_7c8; + float m_7cc; + s32 m_7d0; + s32 m_7d4; + s32 m_7d8; + float m_7dc; + float m_7e0; + s32 m_7e4; + s32 m_7e8; + s32 m_7ec; + s32 m_7f0; + s32 m_7f4; + s32 m_7f8; + s32 m_7fc; + s32 m_800; + float m_804; + float m_808; + float m_80c; + float m_810; + float m_814; + float m_818; + float m_81c; + s32 m_820; + float m_824; + s32 m_828; + float m_82c; + float m_830; + float m_834; + float m_838; + float m_83c; + float m_840; + s32 m_844; + s32 m_848; + s32 m_84c; + float m_850; + float m_854; + float m_858; + float m_85c; + float m_860; + s32 m_864; + s32 m_868; + s32 m_86c; + s32 m_870; + float m_874; + float m_878; + float m_87c; + float m_880; + float m_884; + float m_888; + float m_88c; + float m_890; + s32 m_894; + float m_898; +}; + +class soCommonDataAccesser { + nw4r::g3d::ResFileData* resFileTex; + nw4r::g3d::ResFileData* resFileAnim; + soCommonParam** commonData; + soCommonParamFloat paramFloats[2]; + soCommonParamInt paramInts[2]; + soCommonParamIndefinite paramIndefinites[2]; +public: + soCommonDataAccesser() : resFileTex(0), resFileAnim(0) { } + ~soCommonDataAccesser() { } + void setupCommonParam(soCommonParam** p2); + float getParamCommonFloat(u32 p1, u32 p2); + s32 getParamCommonInt(u32 p1, u32 p2); + s32* getParamCommonIndefinite(u32 p1, u32 p2); +}; + +extern soCommonDataAccesser g_soCommonDataAccesser; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_connectable.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_connectable.h new file mode 100644 index 0000000000..5190c11dd9 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_connectable.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +template +class soConnectable { +protected: + T* m_link; + +public: + soConnectable() : m_link(nullptr) { } + soConnectable& operator=(const soConnectable& other) { + if (this != &other) + m_link = other.m_link; + return *this; + } + + void connect(T* node) { + if (m_link) + m_link->connect(node); + else + m_link = node; + } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_dispose_instance_manager.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_dispose_instance_manager.h new file mode 100644 index 0000000000..13da6a480c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_dispose_instance_manager.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include + +class soDisposeInstanceManager { + u8 unk0[0xD0C]; + +public: + virtual void notifyDrawDone(); + + // Dynamically allocate and populate *g_soDisposeInstanceManager + static void create(); +}; +static_assert(sizeof(soDisposeInstanceManager) == 0xD10, "Class is wrong size!"); + +class soDisposeInstanceEventObserver : public soEventObserver { +public: + virtual void addObserver(short param1, s8 param2); + virtual bool isObserv(); // TODO + virtual void notifyDisposeInstance(bool, int, int taskId); + virtual void notifyDrawDone(); // TODO + char _spacer1[2]; +}; +static_assert(sizeof(soDisposeInstanceEventObserver) == 12, "Class is wrong size!"); + +extern soDisposeInstanceManager* g_soDisposeInstanceManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_enable.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_enable.h new file mode 100644 index 0000000000..081c6a6dbd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_enable.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class soEnable { + u8 m_isEnable : 1; +public: + bool isEnable() const { return m_isEnable; } +}; +static_assert(sizeof(soEnable) == 1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_external_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_external_value_accesser.h new file mode 100644 index 0000000000..1f840b54af --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_external_value_accesser.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soExternalValueAccesser { +public: + static int getTeamNo(StageObject* stageObject); + static Vec3f getPos(StageObject* stageObject); + static float getLr(StageObject* stageObject); + static SituationKind getSituationKind(StageObject* stageObject); + static int getStatusKind(StageObject* stageObject); + static bool getWorkFlag(StageObject* stageObject, u32); + static int getWorkInt(StageObject* stageObject, u32); + static soModuleAccesser* getModuleAccesser(StageObject* stageObject); + static soCollisionHitModule* getCollisionHitModule(StageObject* stageObject); + static soControllerModule* getControllerModule(StageObject* stageObject); + static u32 getTeamOwnerId(StageObject* stageObject); +}; +// TODO size assertion diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_general_flag.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_general_flag.h new file mode 100644 index 0000000000..26eedf86ad --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_general_flag.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +template +struct soGeneralFlag { + T flag; + soGeneralFlag(T init) : flag(init) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module.h new file mode 100644 index 0000000000..eb6bef73cf --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include + +class soHeapModule : public soNullable { +public: + soHeapModule(bool isNull) : soNullable(isNull) { } + virtual ~soHeapModule() { } + virtual HeapType getInstanceHeap() const = 0; + virtual void setInstanceHeap(HeapType heap) { } + virtual HeapType getNWModelInstanceHeap() const = 0; + virtual HeapType getNWMotionInstanceHeap() const = 0; + virtual u32 getSlotNo() const = 0; +}; +static_assert(sizeof(soHeapModule) == 8, "Class is wrong size!"); + +class soHeapModuleNull : public soHeapModule { +public: + soHeapModuleNull() : soHeapModule(true) { } + virtual ~soHeapModuleNull() { } + virtual HeapType getInstanceHeap() const { return Heaps::Invalid; } + virtual void setInstanceHeap(HeapType heap) { } + virtual HeapType getNWModelInstanceHeap() const { return Heaps::Invalid; } + virtual HeapType getNWMotionInstanceHeap() const { return Heaps::Invalid; } + virtual u32 getSlotNo() const { return 0; } +}; +static_assert(sizeof(soHeapModuleNull) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module_impl.h new file mode 100644 index 0000000000..52e39c9d80 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_heap_module_impl.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include +#include + +class soHeapModuleImpl : public soHeapModule { + Heaps::HeapType m_instanceHeap; + Heaps::HeapType m_modelInstanceHeap; + Heaps::HeapType m_motionInstanceHeap; + s32 m_heapSlotNo; +public: + soHeapModuleImpl(Heaps::HeapType instHeap, Heaps::HeapType modelInstHeap, + Heaps::HeapType motionInstHeap, s32 heapSlotNo); + + HeapType getInstanceHeap() const { + return m_instanceHeap; + } + + void setInstanceHeap(HeapType heap) { + m_instanceHeap = heap; + } + + HeapType getNWModelInstanceHeap() const { + return m_modelInstanceHeap; + } + + HeapType getNWMotionInstanceHeap() const { + return m_motionInstanceHeap; + } + + u32 getSlotNo() const { + return m_heapSlotNo; + } + + ~soHeapModuleImpl() { } +}; +static_assert(sizeof(soHeapModuleImpl) == 0x18, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_info.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_info.h new file mode 100644 index 0000000000..1736387c69 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_info.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +class soInfo { +public: + virtual ~soInfo() { } + virtual bool isInvalidKind(int kind) = 0; + virtual int getInvalidKind() = 0; + virtual const char* getNamePtr(int kind) = 0; + virtual u32 getMotionNum(int kind) = 0; + virtual u32 getStatusNum(int kind) = 0; + +}; +static_assert(sizeof(soInfo) == 0x4, "Class has the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_inside_event_manage_module_builder.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_inside_event_manage_module_builder.h new file mode 100644 index 0000000000..5d92aed394 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_inside_event_manage_module_builder.h @@ -0,0 +1,232 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +// For the EventObserver classes referenced by soInsideEventManageModuleBuilder +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct wnInsideEventManageModuleTypes { + enum { + hasStatus = true, + hasAnimCmd = true, + hasDamage = true, + hasLink = true, + hasSituation = true, + hasCollisionHit = true, + hasCollisionAttack = true, + hasModel = true, + hasArticle = true, + hasCapture = true, + hasCollisionShield = true, + hasCollisionReflector = true, + hasCollisionAbsorber = true, + hasCollisionSearch = true, + hasItemManage = true, + hasMotion = true, + hasGimmick = true, + hasTurn = true, + hasCollisionCatch = true, + }; +}; + +// Identical to wnInsideEventManageModuleTypes, except hasGimmick is false +struct ftInsideEventManageModuleTypes { + enum { + hasStatus = true, + hasAnimCmd = true, + hasDamage = true, + hasLink = true, + hasSituation = true, + hasCollisionHit = true, + hasCollisionAttack = true, + hasModel = true, + hasArticle = true, + hasCapture = true, + hasCollisionShield = true, + hasCollisionReflector = true, + hasCollisionAbsorber = true, + hasCollisionSearch = true, + hasItemManage = true, + hasMotion = true, + hasGimmick = false, + hasTurn = true, + hasCollisionCatch = true, + }; +}; + +template +struct GetEventUnit { + struct GetUnitHelper { + typedef typename soSelect, + soEventUnitNull >::Result Type; + }; + + typedef typename soSelect::Result Type; +}; + +template +class soInsideEventManageModuleBuildConfig { +public: + // The capacities of the observer lists comprising the + // soInsideEventManageModuleBuilder, as selected according to the + // instantiation of this build configuration template + enum { + StatusCap = C1, + AnimCmdCap = C2, + DamageCap = C3, + LinkCap = C4, + SituationCap = C5, + CollisionHitCap = C6, + CollisionAttackCap = C7, + ModelCap = C8, + ArticleCap = C9, + CaptureCap = C10, + CollisionShieldCap = C11, + CollisionReflectorCap = C12, + CollisionAbsorberCap = C13, + CollisionSearchCap = C14, + ItemManageCap = C15, + MotionCap = C16, + GimmickCap = C17, + TurnCap = C18, + CollisionCatchCap = C19, + }; + + // The event IDs of each kind of EventObserver, which are apparently + // fixed across all build configurations + enum { + StatusEvtId = 4, + AnimCmdEvtId = 5, + DamageEvtId = 6, + LinkEvtId = 7, + SituationEvtId = 8, + CollisionHitEvtId = 0, + CollisionAttackEvtId = 1, + ModelEvtId = 9, + ArticleEvtId = 11, + CaptureEvtId = 13, + CollisionShieldEvtId = 14, + CollisionReflectorEvtId = 15, + CollisionAbsorberEvtId = 16, + CollisionSearchEvtId = 17, + ItemManageEvtId = 12, + MotionEvtId = 10, + GimmickEvtId = 3, + TurnEvtId = 18, + CollisionCatchEvtId = 2, + }; +}; + +#define soInsideEventManageModuleBuilder_MEMBER_LIST \ + soInstanceManagerSimpleEntity, 19> > m_entity; \ + soEventManageModuleImpl m_module; \ + typename GetEventUnit::Type m_status; \ + typename GetEventUnit::Type m_animCmd; \ + typename GetEventUnit::Type m_damage; \ + typename GetEventUnit::Type m_link; \ + typename GetEventUnit::Type m_situation; \ + typename GetEventUnit::Type m_collisionHit; \ + typename GetEventUnit::Type m_collisionAttack; \ + typename GetEventUnit::Type m_model; \ + typename GetEventUnit::Type m_article; \ + typename GetEventUnit::Type m_capture; \ + typename GetEventUnit::Type m_collisionShield; \ + typename GetEventUnit::Type m_collisionReflector;\ + typename GetEventUnit::Type m_collisionAbsorber; \ + typename GetEventUnit::Type m_collisionSearch; \ + typename GetEventUnit::Type m_itemManage; \ + typename GetEventUnit::Type m_motion; \ + typename GetEventUnit::Type m_gimmick; \ + typename GetEventUnit::Type m_turn; \ + typename GetEventUnit::Type m_collisionCatch; + +template +class soInsideEventManageModuleBuilder { + soInsideEventManageModuleBuilder_MEMBER_LIST +public: + soInsideEventManageModuleBuilder() : + m_entity(), + m_module(this), + m_status(m_module.getManageId(), B::StatusEvtId), + m_animCmd(m_module.getManageId(), B::AnimCmdEvtId), + m_damage(m_module.getManageId(), B::DamageEvtId), + m_link(m_module.getManageId(), B::LinkEvtId), + m_situation(m_module.getManageId(), B::SituationEvtId), + m_collisionHit(m_module.getManageId(), B::CollisionHitEvtId), + m_collisionAttack(m_module.getManageId(), B::CollisionAttackEvtId), + m_model(m_module.getManageId(), B::ModelEvtId), + m_article(m_module.getManageId(), B::ArticleEvtId), + m_capture(m_module.getManageId(), B::CaptureEvtId), + m_collisionShield(m_module.getManageId(), B::CollisionShieldEvtId), + m_collisionReflector(m_module.getManageId(), B::CollisionReflectorEvtId), + m_collisionAbsorber(m_module.getManageId(), B::CollisionAbsorberEvtId), + m_collisionSearch(m_module.getManageId(), B::CollisionSearchEvtId), + m_itemManage(m_module.getManageId(), B::ItemManageEvtId), + m_motion(m_module.getManageId(), B::MotionEvtId), + m_gimmick(m_module.getManageId(), B::GimmickEvtId), + m_turn(m_module.getManageId(), B::TurnEvtId), + m_collisionCatch(m_module.getManageId(), B::CollisionCatchEvtId) { } + + ~soInsideEventManageModuleBuilder() { } + soEventManageModuleImpl* getModule() { return &m_module; } +}; + +template +class soInsideEventManageModuleBuilder { + typedef ftInsideEventManageModuleTypes T; + soInsideEventManageModuleBuilder_MEMBER_LIST +public: + // Note that this specialized constructor leaves out the initializer + // for m_gimmick + soInsideEventManageModuleBuilder() : + m_entity(), + m_module(this), + m_status(m_module.getManageId(), B::StatusEvtId), + m_animCmd(m_module.getManageId(), B::AnimCmdEvtId), + m_damage(m_module.getManageId(), B::DamageEvtId), + m_link(m_module.getManageId(), B::LinkEvtId), + m_situation(m_module.getManageId(), B::SituationEvtId), + m_collisionHit(m_module.getManageId(), B::CollisionHitEvtId), + m_collisionAttack(m_module.getManageId(), B::CollisionAttackEvtId), + m_model(m_module.getManageId(), B::ModelEvtId), + m_article(m_module.getManageId(), B::ArticleEvtId), + m_capture(m_module.getManageId(), B::CaptureEvtId), + m_collisionShield(m_module.getManageId(), B::CollisionShieldEvtId), + m_collisionReflector(m_module.getManageId(), B::CollisionReflectorEvtId), + m_collisionAbsorber(m_module.getManageId(), B::CollisionAbsorberEvtId), + m_collisionSearch(m_module.getManageId(), B::CollisionSearchEvtId), + m_itemManage(m_module.getManageId(), B::ItemManageEvtId), + m_motion(m_module.getManageId(), B::MotionEvtId), + m_turn(m_module.getManageId(), B::TurnEvtId), + m_collisionCatch(m_module.getManageId(), B::CollisionCatchEvtId) { } + + ~soInsideEventManageModuleBuilder() { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_manager.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_manager.h new file mode 100644 index 0000000000..81be884f3c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_manager.h @@ -0,0 +1,315 @@ +#pragma once + +#include +#include +#include +#include + +template +class soInstanceManagerFixed : public soNullable { +public: + virtual T& at(s32 index) = 0; + virtual T& atIndex(s32 index) = 0; + virtual s32 getId(s32 index) = 0; + virtual u32 size() const = 0; + virtual bool isEmpty() const { return size() == 0; } + virtual bool isContain(s32) const = 0; +}; + +template +class soInstanceManager : public soInstanceManagerFixed { +public: + virtual s32 add(T&, s32) = 0; + virtual void erase(s32) = 0; + virtual void clear() = 0; + virtual void set(const T&, s32 index) = 0; +}; + +template +class soInstanceManagerSimple : public soInstanceManager { +public: + virtual T& at(s32 index); + virtual T& atIndex(s32 index); + virtual s32 getId(s32 index); + virtual u32 size() const; + virtual bool isContain(s32) const; + virtual s32 add(T&, s32); + virtual void erase(s32); + virtual void clear(); + virtual void set(const T&, s32 index); +}; + +template +class soInstanceManagerFixedSimple : public soInstanceManagerFixed { +public: + virtual T& at(s32 index); + virtual T& atIndex(s32 index); + virtual s32 getId(s32 index); + virtual u32 size() const; + virtual bool isEmpty() const; + virtual bool isContain(s32) const; + + V* m_array; + + soInstanceManagerFixedSimple(V* arrPtr) : m_array(arrPtr) { } +}; + + +template +class soInstanceManagerSimpleEntity : public soInstanceManagerSimple{ +public: + soInstanceManagerFixedSimple, soArray > > m_fixedSimple; + U m_arrayVector; + + soInstanceManagerSimpleEntity() : m_fixedSimple(&m_arrayVector) { } + ~soInstanceManagerSimpleEntity(); +}; + +template +class soInstanceManagerPriorityPolicy { +public: + virtual void getPriorityArray(soArray& arr) = 0; +}; + +template +class soInstanceManagerAttributePolicy { +public: + virtual void getAttributeArray(soAttributeFlag mask, soArray& arr) = 0; + virtual soAttributeFlag getAttribute(s32) const = 0; +}; + +template +class soInstanceManagerFullProperty : public soInstanceManager, + public soInstanceManagerPriorityPolicy, + public soInstanceManagerAttributePolicy { +public: + // UBFIX: There should have been a virtual dtor in the base class + ~soInstanceManagerFullProperty() { } + virtual s32 add(T& p1, s32 p2) { + return add(p1, p2, soAttributeFlag(), -1); + } + + virtual s32 add(T&, s32, soAttributeFlag, s16) = 0; + virtual u32 capacity() = 0; + virtual T& atIndexFast(s32 index) { return this->at(index); } + virtual soInstanceUnitFullProperty& atUnitIndexFast(s32 index) = 0; + virtual s32 getIndex(s32 index) const = 0; +}; + +template +class soInstanceManagerFullPropertyNull : public soInstanceManagerFullProperty { +public: + + virtual s32 getIndex(s32 index) const { return -1; } + virtual soInstanceUnitFullProperty& atUnitIndexFast(s32 index) { + static soInstanceUnitFullProperty NullElement; + return NullElement; + } + virtual u32 capacity() { return 0; } + virtual s32 getId(s32 index) { return -1; } + virtual soAttributeFlag getAttribute(s32) const { return soAttributeFlag(); } + virtual void getAttributeArray(soAttributeFlag mask, soArray& arr) { } + virtual void getPriorityArray(soArray& arr) { } + virtual bool isContain(s32) const { return false; } + virtual u32 size() const { return 0; } + virtual void set(const T&, s32 index) { } + virtual T& atIndex(s32 index) { + static T NullElement; + return NullElement; + } + virtual T& at(s32 index) { + static T NullElement; + return NullElement; + } + virtual void clear() { } + virtual void erase(s32) { } + virtual s32 add(T&, s32, soAttributeFlag, s16) { return -1; } + + // UBFIX: There should have been a virtual dtor in the base class + ~soInstanceManagerFullPropertyNull() { } +}; + +template +class soInstanceManagerFullPropertyUniqImpl : public soInstanceManagerFullProperty { + soArrayList, 11> m_arrayList; +public: + virtual T& at(s32 index); + virtual T& atIndex(s32 index); + virtual s32 getId(s32 index); + virtual u32 size() const; + virtual bool isContain(s32) const; + virtual void erase(s32); + virtual void clear(); + virtual void set(const T&, s32 index); + + virtual s32 add(T&, s32, soAttributeFlag, s16); + virtual u32 capacity(); + virtual soInstanceUnitFullProperty& atUnitIndexFast(s32 index); + virtual s32 getIndex(s32 index) const; + + virtual void getAttributeArray(soAttributeFlag mask, soArray& arr); + virtual soAttributeFlag getAttribute(s32) const; + virtual void getPriorityArray(soArray& arr); + +}; + +template +class soInstanceManagerFullPropertyVector : public soInstanceManagerFullProperty { + soArrayVector, C> m_arrayVector; // 0x10 + bool m_unk1; + + s32 getFreeId() const; + + s32 unkFindIndex(s32 p4) const { + s32 sz = size(); + for (s32 i = 0; i < sz; i++) { + s32 r0 = m_arrayVector.at(i).m_10; + if (r0 <= -1) + return i; + if (r0 > p4) + return i; + } + return sz; + } + + s32 searchIndex(s32 id) const { + if (id <= -1) + return -1; + s32 sz = size(); + for (s32 i = 0; i < sz; i++) + if (id == m_arrayVector.at(i).m_id) + return i; + return -1; + } +public: + soInstanceManagerFullPropertyVector() : m_unk1(false) { } + soInstanceManagerFullPropertyVector(bool p1) : m_unk1(p1) { } + ~soInstanceManagerFullPropertyVector() { } + + virtual T& at(s32 id) { + if (id <= -1) + return m_arrayVector.at(0).m_element; + s32 i = searchIndex(id); + return (i < 0) ? m_arrayVector.at(0).m_element : m_arrayVector.at(i).m_element; + } + + virtual T& atIndex(s32 idx) { + return m_arrayVector.at(idx).m_element; + } + + virtual s32 getId(s32 idx) { + return m_arrayVector.at(idx).m_id; + } + + virtual u32 size() const { + return m_arrayVector.size(); + } + + virtual bool isContain(s32 id) const { + return searchIndex(id) >= 0; + } + + virtual void erase(s32 id) { + s32 idx = searchIndex(id); + if (idx >= 0) + m_arrayVector.erase(idx); + } + + virtual void clear() { + m_arrayVector.clear(); + } + + virtual void set(const T& elm, s32 id) { + T& ref = at(id); + ref = elm; + } + + virtual s32 add(T& elm, s32 id, soAttributeFlag attr, s16 p4) { + if (m_arrayVector.isFull() == true) + return -1; + if ((!m_unk1 || id > -1) && isContain(id) == true) + return -1; + if (!m_unk1 && id <= -1) { + id = getFreeId(); + if (id <= -1) + return -1; + } + s32 idx = (p4 <= -1) ? size() : unkFindIndex(p4); + if (idx < 0) + return -1; + m_arrayVector.insert(idx, + soInstanceUnitFullPropertyWrapper(attr, elm, id, p4).m_prop); + return id; + } + + virtual u32 capacity() { + return m_arrayVector.capacity(); + } + + virtual T& atIndexFast(s32 idx) { + return m_arrayVector.atFast(idx).m_element; + } + + virtual soInstanceUnitFullProperty& atUnitIndexFast(s32 idx) { + return m_arrayVector.atFast(idx); + } + + virtual s32 getIndex(s32 id) const { return searchIndex(id); } + + virtual void getAttributeArray(soAttributeFlag targetAttr, soArray& arr) { + s32 sz = m_arrayVector.size(); + for (s32 i = 0; i < sz; i++) { + soAttributeFlag attrFlag = m_arrayVector.at(i).getAttribute(); + if (attrFlag.m_mask & targetAttr.m_mask) { + arr.push(&m_arrayVector.at(i).m_element); + } + } + } + + virtual soAttributeFlag getAttribute(s32 id) const { + s32 idx = searchIndex(id); + if (idx < 0) + return soAttributeFlag(); + return m_arrayVector.at(idx).getAttribute(); + } + + virtual void getPriorityArray(soArray& arr) { + s32 sz = m_arrayVector.size(); + for (s32 i = 0; i < sz; i++) + arr.push(&m_arrayVector.at(i).m_element); + } +}; + +template +s32 soInstanceManagerFullPropertyVector::getFreeId() const { + if (m_arrayVector.isFull() == true) + return 0x7FFF; + if (this->isEmpty() == true) + return 0; + s32 end = m_arrayVector.size() - 1; + if (m_arrayVector.at(end).m_id < 0x7FFF) { + end = m_arrayVector.size() - 1; + return m_arrayVector.at(end).m_id + 1; + } + for (s32 i = m_arrayVector.size() - 1; i >= 0; i--) { + if (i == 0) { + if (m_arrayVector.at(i).m_id == 0) + return -1; + return m_arrayVector.at(i).m_id - 1; + } + if (m_arrayVector.at(i).m_id - 1 > m_arrayVector.at(i - 1).m_id) + return m_arrayVector.at(i).m_id - 1; + } + return -1; +} + +template +class soInstanceManagerFullPropertyEccentric : public soInstanceManagerAttributePolicy, public soInstanceManagerPriorityPolicy { +public: + // Starts at 0x8, because there are 2 vtables. + soArray >* m_array; + + virtual void getPriorityArray(soArray& arr); + virtual void getAttributeArray(soAttributeFlag mask, soArray& arr); + virtual soAttributeFlag getAttribute(s32) const; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_unit.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_unit.h new file mode 100644 index 0000000000..ad3aadc2a8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_instance_unit.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include +#include + +typedef s16 soAttributeMask; +static const soAttributeMask ATTRIBUTE_MASK_NONE = 0; +struct soAttributeFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + }; + soAttributeMask m_mask; + }; + soAttributeFlag() : m_mask(ATTRIBUTE_MASK_NONE) { } + soAttributeFlag(soAttributeMask bits) : m_mask(bits) { } + ~soAttributeFlag() { } +}; + +template +class soInstanceUnit { +public: + T m_element; + int m_id; + + soInstanceUnit() : m_element(), m_id(-1) { } + soInstanceUnit(T& elm, s32 id) : m_element(elm), m_id(id) { } +}; + +template +class soInstanceUnitFullProperty : public soInstanceUnit { +public: + soAttributeFlag m_attribute; + s16 m_10; + + soInstanceUnitFullProperty() : m_attribute(0), m_10(-1) { } + soInstanceUnitFullProperty(T& elm, s32 id, soAttributeFlag attr, s16 p4) : + soInstanceUnit(elm, id), m_attribute(attr), m_10(p4) { } + ~soInstanceUnitFullProperty() { } + + soAttributeFlag getAttribute() const { + return m_attribute; + } +}; + +// TODO: inferred class +template +class soInstanceUnitFullPropertyWrapper { +public: + soAttributeFlag m_attr; + soInstanceUnitFullProperty m_prop; + + soInstanceUnitFullPropertyWrapper() { } + soInstanceUnitFullPropertyWrapper(soAttributeFlag attr, T& elm, s32 id, s16 p4) : + m_attr(attr), m_prop(elm, id, m_attr, p4) { } + ~soInstanceUnitFullPropertyWrapper() { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_kind.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_kind.h new file mode 100644 index 0000000000..cab66db4db --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_kind.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +enum soKind { + StageObject_Invalid = -0x1, + StageObject_Fighter = 0x0, + StageObject_Enemy = 0x1, + StageObject_Weapon = 0x2, + StageObject_Yakumono = 0x3, + StageObject_Item = 0x4 +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_lock.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_lock.h new file mode 100644 index 0000000000..b5b5d45b2e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_lock.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +class soLockable { + char _spacer[8]; +}; +static_assert(sizeof(soLockable) == 8, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser.h new file mode 100644 index 0000000000..6719f2b50b --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser.h @@ -0,0 +1,438 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StageObject; + +class soModuleEnumeration { +public: + soModuleEnumeration( + soResourceModule* resourceModule, + soModelModule* modelModule, + soMotionModule* motionModule, + soPostureModule* postureModule, + soGroundModule* groundModule, + soSituationModule* situationModule, + void* teamModule, + soCollisionAttackModule* collisionAttackModule, + soCollisionHitModule* collisionHitModule, + soCollisionShieldModule* collisionShieldModule, + soCollisionShieldModule* collisionReflectorModule, + soCollisionShieldModule* collisionAbsorberModule, + void* collisionCatchModule, + soCollisionSearchModule* collisionSearchModule, + soDamageModule* damageModule, + void* catchModule, + void* captureModule, + soStopModule* stopModule, + void* turnModule, + void* shakeModule, + soSoundModule* soundModule, + soLinkModule* linkModule, + soVisibilityModule* visibilityModule, + soControllerModule* controllerModule, + soCameraModule* cameraModule, + soWorkManageModule* workManageModule, + void* debugModule, + soAnimCmdModule* animCmdModule, + soStatusModule* statusModule, + void* generalTermDecideModule, + void* switchDecideModule, + soKineticModule* kineticModule, + soEventManageModule* eventManageModule, + void* generateArticleManageModule, + soEffectModule* effectModule, + void* comboModule, + soAreaModule* areaModule, + void* territoryModule, + void* targetSearchModule, + void* physicsModule, + void* slopeModule, + soShadowModule* shadowModule, + soItemManageModule* itemManageModule, + soColorBlendModule* colorBlendModule, + void* jostleModule, + void* abnormalModule, + soSlowModule* slowModule, + void* reflectModule, + void* heapModule, + soParamCustomizeModule* paramCustomizeModule, + void* glowModule, + void* unusedParam = nullptr + ); + + static const soModuleEnumeration NullObject; + + soModuleEnumeration() { + m_resourceModule = NullObject.m_resourceModule, + m_modelModule = NullObject.m_modelModule, + m_motionModule = NullObject.m_motionModule, + m_postureModule = NullObject.m_postureModule, + m_groundModule = NullObject.m_groundModule, + m_situationModule = NullObject.m_situationModule, + m_teamModule = NullObject.m_teamModule, + m_collisionAttackModule = NullObject.m_collisionAttackModule, + m_collisionHitModule = NullObject.m_collisionHitModule, + m_collisionShieldModule = NullObject.m_collisionShieldModule, + m_collisionReflectorModule = NullObject.m_collisionReflectorModule, + m_collisionAbsorberModule = NullObject.m_collisionAbsorberModule, + m_collisionCatchModule = NullObject.m_collisionCatchModule, + m_collisionSearchModule = NullObject.m_collisionSearchModule, + m_damageModule = NullObject.m_damageModule, + m_catchModule = NullObject.m_catchModule, + m_captureModule = NullObject.m_captureModule, + m_stopModule = NullObject.m_stopModule, + m_turnModule = NullObject.m_turnModule, + m_shakeModule = NullObject.m_shakeModule, + m_soundModule = NullObject.m_soundModule, + m_linkModule = NullObject.m_linkModule, + m_visibilityModule = NullObject.m_visibilityModule, + m_controllerModule = NullObject.m_controllerModule, + m_cameraModule = NullObject.m_cameraModule, + m_workManageModule = NullObject.m_workManageModule, + m_debugModule = NullObject.m_debugModule, + m_animCmdModule = NullObject.m_animCmdModule, + m_statusModule = NullObject.m_statusModule, + m_generalTermDecideModule = NullObject.m_generalTermDecideModule, + m_switchDecideModule = NullObject.m_switchDecideModule, + m_kineticModule = NullObject.m_kineticModule, + m_eventManageModule = NullObject.m_eventManageModule, + m_generateArticleManageModule = NullObject.m_generateArticleManageModule, + m_effectModule = NullObject.m_effectModule, + m_comboModule = NullObject.m_comboModule, + m_areaModule = NullObject.m_areaModule, + m_territoryModule = NullObject.m_territoryModule, + m_targetSearchModule = NullObject.m_targetSearchModule, + m_physicsModule = NullObject.m_physicsModule, + m_slopeModule = NullObject.m_slopeModule, + m_shadowModule = NullObject.m_shadowModule, + m_itemManageModule = NullObject.m_itemManageModule, + m_colorBlendModule = NullObject.m_colorBlendModule, + m_jostleModule = NullObject.m_jostleModule, + m_abnormalModule = NullObject.m_abnormalModule, + m_slowModule = NullObject.m_slowModule, + m_reflectModule = NullObject.m_reflectModule, + m_heapModule = NullObject.m_heapModule, + m_paramCustomizeModule = NullObject.m_paramCustomizeModule, + m_glowModule = NullObject.m_glowModule; + } + + soResourceModule* m_resourceModule; + soModelModule* m_modelModule; + soMotionModule* m_motionModule; + soPostureModule* m_postureModule; + soGroundModule* m_groundModule; + soSituationModule* m_situationModule; + void* m_teamModule; + soCollisionAttackModule* m_collisionAttackModule; + soCollisionHitModule* m_collisionHitModule; + soCollisionShieldModule* m_collisionShieldModule; + soCollisionShieldModule* m_collisionReflectorModule; + soCollisionShieldModule* m_collisionAbsorberModule; + void* m_collisionCatchModule; + soCollisionSearchModule* m_collisionSearchModule; + soDamageModule* m_damageModule; + void* m_catchModule; + void* m_captureModule; + soStopModule* m_stopModule; + void* m_turnModule; + void* m_shakeModule; + soSoundModule* m_soundModule; + soLinkModule* m_linkModule; // +0x54 + soVisibilityModule* m_visibilityModule; + soControllerModule* m_controllerModule; + soCameraModule* m_cameraModule; + soWorkManageModule* m_workManageModule; + void* m_debugModule; + soAnimCmdModule* m_animCmdModule; + soStatusModule* m_statusModule; + void* m_generalTermDecideModule; + void* m_switchDecideModule; + soKineticModule* m_kineticModule; // +0x7C + soEventManageModule* m_eventManageModule; + void* m_generateArticleManageModule; + soEffectModule* m_effectModule; + void* m_comboModule; + soAreaModule* m_areaModule; + void* m_territoryModule; + void* m_targetSearchModule; + void* m_physicsModule; + void* m_slopeModule; + soShadowModule* m_shadowModule; + soItemManageModule* m_itemManageModule; + soColorBlendModule* m_colorBlendModule; + void* m_jostleModule; + void* m_abnormalModule; + soSlowModule* m_slowModule; + void* m_reflectModule; + void* m_heapModule; + soParamCustomizeModule* m_paramCustomizeModule; + void* m_glowModule; +}; +static_assert(sizeof(soModuleEnumeration) == 204, "Class is wrong size!"); + +class soModuleAccesser : private soNull, private soActivatable { +public: + StageObject* m_stageObject; + soModuleEnumeration m_moduleEnumeration; + const soModuleEnumeration* m_enumerationStart; // +0xD8 + + soModuleAccesser(); + soModuleAccesser( + StageObject* stageObject, + soResourceModule* resourceModule, + soModelModule* modelModule, + soMotionModule* motionModule, + soPostureModule* postureModule, + soGroundModule* groundModule, + soSituationModule* situationModule, + void* teamModule, + soCollisionAttackModule* collisionAttackModule, + soCollisionHitModule* collisionHitModule, + soCollisionShieldModule* collisionShieldModule, + soCollisionShieldModule* collisionReflectorModule, + soCollisionShieldModule* collisionAbsorberModule, + void* collisionCatchModule, + soCollisionSearchModule* collisionSearchModule, + soDamageModule* damageModule, + void* catchModule, + void* captureModule, + soStopModule* stopModule, + void* turnModule, + void* shakeModule, + soSoundModule* soundModule, + soLinkModule* linkModule, + soVisibilityModule* visibilityModule, + soControllerModule* controllerModule, + soCameraModule* cameraModule, + soWorkManageModule* workManageModule, + void* debugModule, + soAnimCmdModule* animCmdModule, + soStatusModule* statusModule, + void* generalTermDecideModule, + void* switchDecideModule, + soKineticModule* kineticModule, + soEventManageModule* eventManageModule, + void* generateArticleManageModule, + soEffectModule* effectModule, + void* comboModule, + soAreaModule* areaModule, + void* territoryModule, + void* targetSearchModule, + void* physicsModule, + void* slopeModule, + soShadowModule* shadowModule, + soItemManageModule* itemManageModule, + soColorBlendModule* colorBlendModule, + void* jostleModule, + void* abnormalModule, + soSlowModule* slowModule, + void* reflectModule, + void* heapModule, + soParamCustomizeModule* paramCustomizeModule, + void* glowModule + ); + virtual ~soModuleAccesser(); + + void activate(); + void deactivate(); + + StageObject& getStageObject() const { + return *m_stageObject; + } + + soResourceModule& getResourceModule() const { + return *m_enumerationStart->m_resourceModule; + } + + soModelModule& getModelModule() const + { + return *m_enumerationStart->m_modelModule; + } + + soMotionModule& getMotionModule() const { + return *m_enumerationStart->m_motionModule; + } + + soPostureModule& getPostureModule() const + { + return *m_enumerationStart->m_postureModule; + } + + soGroundModule& getGroundModule() const + { + return *m_enumerationStart->m_groundModule; + } + + soShadowModule& getShadowModule() const + { + return *m_enumerationStart->m_shadowModule; + } + + soSituationModule& getSituationModule() const + { + return *m_enumerationStart->m_situationModule; + } + + soCollisionAttackModule& getCollisionAttackModule() const + { + return *m_enumerationStart->m_collisionAttackModule; + } + + soCollisionHitModule& getCollisionHitModule() const + { + return *m_enumerationStart->m_collisionHitModule; + } + + soCollisionShieldModule& getCollisionShieldModule() const + { + return *m_enumerationStart->m_collisionShieldModule; + } + + soCollisionShieldModule& getCollisionReflectorModule() const + { + return *m_enumerationStart->m_collisionReflectorModule; + } + + soCollisionShieldModule& getCollisionAbsorberModule() const + { + return *m_enumerationStart->m_collisionAbsorberModule; + } + + soCollisionSearchModule& getCollisionSearchModule() const + { + return *m_enumerationStart->m_collisionSearchModule; + } + + soDamageModule& getDamageModule() const + { + return *m_enumerationStart->m_damageModule; + } + + soStopModule& getStopModule() const { + return *m_enumerationStart->m_stopModule; + } + + soSoundModule& getSoundModule() const + { + return *m_enumerationStart->m_soundModule; + } + + soLinkModule& getLinkModule() const { + return *m_enumerationStart->m_linkModule; + } + + soVisibilityModule& getVisibilityModule() const + { + return *m_enumerationStart->m_visibilityModule; + } + + soControllerModule& getControllerModule() const + { + return *m_enumerationStart->m_controllerModule; + } + + soCameraModule& getCameraModule() const { + return *m_enumerationStart->m_cameraModule; + } + + soWorkManageModule& getWorkManageModule() const { + return *m_enumerationStart->m_workManageModule; + } + + soAnimCmdModule& getAnimCmdModule() const + { + return *m_enumerationStart->m_animCmdModule; + } + + soStatusModule& getStatusModule() const + { + return *m_enumerationStart->m_statusModule; + } + + soKineticModule& getKineticModule() const + { + return *m_enumerationStart->m_kineticModule; + } + + soEventManageModule& getEventManageModule() const + { + return *m_enumerationStart->m_eventManageModule; + } + + soEffectModule& getEffectModule() const { + return *m_enumerationStart->m_effectModule; + } + + soAreaModule& getAreaModule() const { + return *m_enumerationStart->m_areaModule; + } + + soSlowModule& getSlowModule() const + { + return *m_enumerationStart->m_slowModule; + } + + soItemManageModule& getItemManageModule() const + { + return *m_enumerationStart->m_itemManageModule; + } + + soColorBlendModule& getColorBlendModule() const + { + return *m_enumerationStart->m_colorBlendModule; + } + + soParamCustomizeModule& getParamCustomizeModule() const + { + return *m_enumerationStart->m_paramCustomizeModule; + } +}; +static_assert(sizeof(soModuleAccesser) == 0xE0, "Class is wrong size!"); + +class soModuleAccesserNull : public soModuleAccesser { + +}; + +extern soModuleAccesserNull g_soModuleAccesserNull; + +// TODO: Move this to a new header once its full definition is decomped +#ifndef MATCHING +template +class soModuleAccesserBuilder { + BC t; +}; +#endif diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_build_data.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_build_data.h new file mode 100644 index 0000000000..0cfe1a07b4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_build_data.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class soModuleAccesserBuildData { +public: + virtual u32 getMdlResId() const = 0; + virtual u32 getAnmResId() const = 0; + virtual u8 getResGroupNo() const = 0; + virtual s32 getTeam() const = 0; + virtual soMotionData* getMotionData() const = 0; + virtual soShakeData* getShakeData() const = 0; + virtual soVisibilityData* getVisibilityData() const = 0; + virtual soStatusData* getStatusData() const = 0; + virtual soGroundConditionChecker* getGroundConditionChecker() const = 0; + virtual void* getEffectNodeData() const { return nullptr; } + virtual void* getEffectEmitData() const = 0; + virtual soEffectCommonData* getEffectCommonData() const = 0; + virtual soEffectScreenData* getEffectScreenData() const { return nullptr; }; + virtual void* getTerritoryParam() const { return nullptr; } + + // UBFIX this function has a bug; don't dereference the pointer it + // returns! TODO flag callers of this function, if any + virtual s32* getTerritoryRect() const { + s32 rect[4] = { 0, 0, 0, 0 }; + return rect; + } + virtual void* getTargetSearchParam() const { return nullptr; } + virtual soIkData* getIkData() const { return nullptr; } + virtual s32 getModelLayerType() const { return 2; } + virtual float getModelScale() const { return 1.0f; } + virtual soParamAccesser* getParamAccesser() const = 0; + virtual s32 getAreaCategory() const = 0; + virtual void* getCameraRangeSet() const = 0; + virtual void* getCameraClipSphereSet() const = 0; + virtual void* getItemNodeData() const = 0; + virtual void* getModelExtendNodeTable() const { return nullptr; } + virtual soJostleData* getJostleData() const = 0; + virtual soPreCheckAnimCmdData* getPreCheckAnimCmdData() const { return nullptr; } + virtual Heaps::HeapType getInstanceHeap() const = 0; + virtual Heaps::HeapType getNWModelInstanceHeap() const = 0; + virtual Heaps::HeapType getNWMotionInstanceHeap() const = 0; + virtual s32 getHeapSlotNo() const { return 0; } + virtual soSoundIdExchanger* getSoundIdExchanger() const { + return &g_soSoundIdExchangerNull; + } + virtual float getSlopeAngleLimit() const { return 20.0f; } + virtual ~soModuleAccesserBuildData() { } + virtual void* getAnimCmdData(u32 eventThread, s32 p2) const = 0; +}; +static_assert(sizeof(soModuleAccesserBuildData) == 0x4, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_builder.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_builder.h new file mode 100644 index 0000000000..5a8839df59 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_module_accesser_builder.h @@ -0,0 +1,176 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soModuleAccesser; + +//////////////////////////////////////// +// soHeapModuleBuilder +//////////////////////////////////////// + +template +class soHeapModuleBuildConfig { +public: + typedef T ModuleType; +}; + +template +class soHeapModuleBuilder { + typename BC::ModuleType m_heapModule; +public: + soHeapModuleBuilder(const ftFighterBuildData& fbd) : + m_heapModule( + fbd.getInstanceHeap(), + fbd.getNWModelInstanceHeap(), + fbd.getNWMotionInstanceHeap(), + fbd.getHeapSlotNo() + ) { } +}; + +//////////////////////////////////////// +// soParamCustomizeModuleBuilder +//////////////////////////////////////// + +template +class soParamCustomizeModuleBuildConfig { +public: + typedef T ModuleType; +}; + +template +class soParamCustomizeModuleBuilder { + typename BC::ModuleType m_paramCustomizeModule; +public: + soParamCustomizeModuleBuilder(soModuleAccesser* accsr) : + m_paramCustomizeModule(accsr) { } +}; + +//////////////////////////////////////// +// soResourceModuleBuilder +//////////////////////////////////////// + +template +class soResourceModuleBuildConfig { +public: + enum { ManagerId = M }; + typedef I IdAccesserType; + typedef T ModuleType; +}; + +template +class soResourceModuleBuildConfigDynamic { +public: + enum { ManagerId = M }; + typedef I IdAccesserType; + typedef T ModuleType; +}; + +class soResourceModuleBuildConfigNull { }; + +template +class soResourceModuleBuilder { + typename BC::IdAccesserType m_idAccsr; + typename BC::ModuleType m_resourceModule; +public: + static typename BC::ModuleType* getModule(soResourceModuleBuilder* b) { + return &b->m_resourceModule; + } + + soResourceModuleBuilder(u32 mdlResId, u32 anmResId, u8 resGrpNo, soModuleAccesser* accsr) : + m_idAccsr(accsr), m_resourceModule(BC::ManagerId, &m_idAccsr, resGrpNo) { } +}; + +template +class soResourceModuleBuilder > { + I m_idAccsr; + T m_resourceModule; +public: + static T* getModule(soResourceModuleBuilder* b) { + return &b->m_resourceModule; + } + + soResourceModuleBuilder(u32 mdlResId, u32 anmResId, u8 resGrpNo, soModuleAccesser* accsr) : + m_idAccsr(mdlResId, mdlResId, anmResId), m_resourceModule(M, &m_idAccsr, resGrpNo) { } +}; + +template <> +class soResourceModuleBuilder { +public: + soResourceModuleBuilder(u32 mdlResId, u32 anmResId, u8 resGrpNo, soModuleAccesser* accsr) { } + + static soResourceModule* getModule(soResourceModuleBuilder* b) { + return &g_soResourceModuleNull; + } +}; + +//////////////////////////////////////// +// soModelModuleBuilder +//////////////////////////////////////// + +template +class soModelModuleBuildConfig { +public: + enum { + NodeSetUpCap = S, + VirtualNodeCap = N, + }; + typedef T ModuleType; +}; + +template +class soModelModuleBuilder { + soArrayVector m_nodeSetUps; + soArrayVector m_virtualNodes; + typename BC::ModuleType m_modelModule; +public: + static typename BC::ModuleType* getModule(soModelModuleBuilder* b) { + return &b->m_modelModule; + } + + soModelModuleBuilder(soModuleAccesser* acc, + void* extendNodeTbl, + soEventObserverRegistrationDesc* regDesc, + float modelScale) : + m_nodeSetUps(BC::NodeSetUpCap), + m_virtualNodes(BC::VirtualNodeCap), + m_modelModule( + acc, + &m_nodeSetUps, + extendNodeTbl, + &m_virtualNodes, + regDesc, + modelScale + ) { + } +}; + +template +class soModelModuleBuilder > { + soArrayVector m_nodeSetUps; + soArrayVector m_virtualNodes; + T m_modelModule; +public: + static T* getModule(soModelModuleBuilder* b) { + return &b->m_modelModule; + } + + soModelModuleBuilder(soModuleAccesser* acc, + void* extendNodeTable, + soEventObserverRegistrationDesc* regDesc, + float modelScale) : + m_nodeSetUps(S), + m_virtualNodes(), + m_modelModule( + acc, + &m_nodeSetUps, + extendNodeTable, + &getNullArray(), + regDesc, + modelScale + ) { + } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_null.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_null.h new file mode 100644 index 0000000000..e0114cac80 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_null.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include + +// Note: The name of this class is hypothesized and does not appear in the +// compiled code files. Its existence is inferred from the use of multiple +// inheritance in its derived classes. +class soNull { +// fix for bug in Clang fork not producing empty vtable. +// This is technically incorrect as it will make soNull +// always 4 bytes when the bug only affects multiple +// inheritance, however soNull is never used on it's own +// so this shouldn't be an issue (for now?) +#ifndef __MWERKS__ + int pad; +#endif +}; + +class soNullableInterface { +public: + virtual bool isNull() const = 0; +}; + +class soNullable { +public: + soNullable() { m_isNull = false; } + soNullable(bool isNull) { m_isNull = isNull; } + virtual bool isNull() const { return m_isNull; } + void setNull(bool is_null) { m_isNull = is_null; } + + bool m_isNull; +}; +static_assert(sizeof(soNullable) == 8, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_photo_call_back.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_photo_call_back.h new file mode 100644 index 0000000000..5d431aad80 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_photo_call_back.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +class cmPhotoCallBack : public utListNode { +public: + virtual ~cmPhotoCallBack() { } +}; + +class soPhotoCallBack : public cmPhotoCallBack { +public: + virtual ~soPhotoCallBack() { } + void addCallback(); + void removeCallBack(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_suspend.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_suspend.h new file mode 100644 index 0000000000..1a09f523da --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_suspend.h @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +class soSuspendable { + u8 m_isSuspend : 1; +public: + bool isSuspend() const { return m_isSuspend; } + +}; +static_assert(sizeof(soSuspendable) == 1, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_target_search_unit.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_target_search_unit.h new file mode 100644 index 0000000000..e7fdc75f58 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_target_search_unit.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include +#include +#include + +// TODO ID this class +struct UnkTargetSearchUnit { + u8 unk0[0x14]; + float unk14; +}; + +// Note: inferred base class +class AbstractTargetSearchUnit { +public: + virtual bool checkTargetExist(soModuleAccesser* acc, u32 p2) = 0; + virtual bool checkTargetInArea(soModuleAccesser* acc, u32 p2, u32 p3) = 0; + virtual Vec3f getTargetPos(soModuleAccesser* acc, u32 p2) = 0; + virtual Vec3f getSelfPos(soModuleAccesser* acc) = 0; + virtual void initInterval(soModuleAccesser* acc) = 0; +}; +static_assert(sizeof(AbstractTargetSearchUnit) == 0x4, "Class is the wrong size!"); + +class soTargetSearchUnit : private AbstractTargetSearchUnit { +protected: + UnkTargetSearchUnit* unk4; + gfGameFrameCounter m_frameCounter; + s32 unk14; +public: + soTargetSearchUnit(); + ~soTargetSearchUnit(); + virtual bool checkTargetExist(soModuleAccesser* acc, u32 p2) = 0; + virtual bool checkTargetInArea(soModuleAccesser* acc, u32 p2, u32 p3) = 0; + virtual Vec3f getTargetPos(soModuleAccesser* acc, u32 p2) = 0; + virtual Vec3f getSelfPos(soModuleAccesser* acc) = 0; + virtual void initInterval(soModuleAccesser* acc); +}; +static_assert(sizeof(soTargetSearchUnit) == 0x18, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_value_accesser.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_value_accesser.h new file mode 100644 index 0000000000..fe8a0e85b3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_value_accesser.h @@ -0,0 +1,180 @@ +#pragma once + +#include +#include +#include +#include + +class soParamAccesser : private soNull, public soNullable { +public: + virtual ~soParamAccesser() { } + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0) = 0; +}; + +class soParamAccesserNull : public soParamAccesser { +public: + virtual ~soParamAccesserNull(); + virtual float getParamFloat(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual s32 getParamInt(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); + virtual void* getParamIndefinite(soModuleAccesser* moduleAccesser, s32 p2, s32 p3 = 0); +}; + +extern soParamAccesserNull g_soParamAccesserNull; + +class soValueAccesser { +public: + + enum ParamFloat { + Common_Param_Float_Damage_Frame_Mul = 2002, + Common_Param_Float_Damage_Level_1 = 2003, + Common_Param_Float_Damage_Level_2 = 2004, + Common_Param_Float_Damage_Level_3 = 2005, + Common_Param_Float_Damage_Angle_Ground_Zero_Speed_Mul = 2006, + Common_Param_Float_Damage_Angle_Ground_Max = 2007, + Common_Param_Float_Damage_Angle_Ground_Reaction_Min = 2008, + Common_Param_Float_Damage_Angle_Ground_Reaction_Max = 2009, + Common_Param_Float_Damage_Speed_Mul = 2010, + Common_Param_Float_Damage_Speed_Limit = 2011, + Common_Param_Float_Damage_Sync_Speed_Mul = 2012, + Common_Param_Float_Damage_Down_On_Ground_Angle = 2013, + Common_Param_Float_Damage_Down_On_Ground_Speed_Y_Mul = 2014, + Common_Param_Float_Fly_Top_Angle_Lw = 2015, + Common_Param_Float_Fly_Top_Angle_Hi = 2016, + Common_Param_Float_Fly_Roll_Rate = 2017, + Common_Param_Float_Hit_Stop_Frame_Max = 2018, + Common_Param_Float_Hit_Stop_Frame_Mul = 2019, + Common_Param_Float_Hit_Stop_Frame_Add = 2020, + Common_Param_Float_Damage_Shake_Mul_Value = 2021, + Common_Param_Float_Damage_Shake_Add_Value = 2022, + + Common_Param_Float_Down_Damage_Reaction = 2025, + Common_Param_Float_Down_Damage_S_Reaction = 2026, + + Common_Param_Float_Hit_Stop_Elec_Mul = 2028, + Common_Param_Float_Hit_Stop_Frame_Paralyze_Max = 2029, + Common_Param_Float_Hit_Stop_Frame_Paralyze_Mul = 2030, + Common_Param_Float_Hit_Stop_Frame_Paralyze_Add = 2031, + Common_Param_Float_Slip_Damage_Reaction = 2032, + Common_Param_Float_Capture_Cut_Attack_Power = 2033, + Common_Param_Float_Capture_Cut_Damage = 2034, + Common_Param_Float_Damage_Fly_Quake_M = 2035, + Common_Param_Float_Damage_Fly_Quake_L = 2036, + Common_Param_Float_Rebound_Power_Diff = 2037, + Common_Param_Float_Rebound_Reaction_Mul = 2038, + Common_Param_Float_Rebound_Reaction_Add = 2039, + Common_Param_Float_Rebound_Speed_Mul = 2040, + Common_Param_Float_Rebound_Speed_Add = 2041, + }; + + enum ParamInt { + Common_Param_Int_Meteor_Vector_Min = 22001, + Common_Param_Int_Meteor_Vector_Max = 22002, + Common_Param_Int_Fly_Roll_Damage = 22003, + + Common_Param_Int_Reflect_Count_Max = 22005, + }; + + enum ParamIndefinite { + + }; + + enum VariableFloat { + Var_Float_Motion_Frame = 0, + Var_Float_Motion_End_Frame = 1, + Var_Float_Damage = 2, + Var_Float_Posture_Pos_X = 3, + Var_Float_Posture_Pos_Y = 4, + Var_Float_Posture_Rot_X = 5, + Var_Float_Posture_Rot_Y = 6, + Var_Float_Posture_Rot_Z = 7, + Var_Float_Posture_Lr = 8, + Var_Float_Posture_Lr_Rv = 9, + Var_Float_Motion_Other_1_Frame = 10, + Var_Float_Motion_Other_2_Frame = 11, + Var_Float_Motion_Other_3_Frame = 12, + Var_Float_Motion_Other_4_Frame = 13, + Var_Float_Motion_Other_5_Frame = 14, + Var_Float_Motion_Other_1_End_Frame = 15, + Var_Float_Motion_Other_2_End_Frame = 16, + Var_Float_Motion_Other_3_End_Frame = 17, + Var_Float_Motion_Other_4_End_Frame = 18, + Var_Float_Motion_Other_5_End_Frame = 19, + Var_Float_Posture_Scale = 20, + Var_Float_Posture_Pos_Z = 21, + Var_Float_Kinetic_Sum_Speed_X = 22, + Var_Float_Kinetic_Sum_Speed_Y = 23, + Var_Float_Motion_Rate = 24, + Var_Float_Controller_Stick_X = 25, + Var_Float_Controller_Stick_X_Rv = 26, + Var_Float_Kinetic_Sum_Speed_X_Abs = 27, + Var_Float_Kinetic_Sum_Speed_X_Lr = 28, + Var_Float_Kinetic_Sum_Speed_X_Lr_Rv = 29, + Var_Float_Camera_Range_Up = 30, + Var_Float_Camera_Range_Down = 31, + Var_Float_Camera_Range_Right = 32, + Var_Float_Camera_Range_Left = 33, + Var_Float_Dead_Range_Up = 34, + Var_Float_Dead_Range_Down = 35, + Var_Float_Dead_Range_Right = 36, + Var_Float_Dead_Range_Left = 37, + Var_Float_Damage_Reaction = 38, + Var_Float_Ground_Down_Friction = 39, + Var_Float_Ground_Down_Movement_Speed = 40 + }; + + enum VariableInt { + Var_Int_Motion_Kind = 20000, + Var_Int_Status_Kind = 20001, + Var_Int_Status_Ground_Correct_Kind = 20002, + Var_Int_Status_Prev_Kind = 20003, + Var_Int_Status_Last_Transition_Group_Id = 20004, + Var_Int_Status_Last_Transition_Unit_Id = 20005, + Var_Int_Pickable_Item_Size = 20006, + Var_Int_Pickable_Item_Kind = 20007, + Var_Int_Have_Item_Size = 20008, + Var_Int_Have_Item_Kind = 20009, + Var_Int_Motion_Partial_1_Kind = 20010, + Var_Int_Motion_Partial_2_Kind = 20011, + Var_Int_Motion_Other_1_Kind = 20012, + Var_Int_Motion_Other_2_Kind = 20013, + Var_Int_Motion_Other_3_Kind = 20014, + Var_Int_Motion_Other_4_Kind = 20015, + Var_Int_Motion_Other_5_Kind = 20016, + Var_Int_Controller_Flick_X = 20017, + Var_Int_Shoot_Item_Bullet = 20018, + Var_Int_Have_Item_Hold_Kind = 20019, + Var_Int_Camera_Quake_Kind = 20020, + Var_Int_Team_No = 20021, + Var_Int_Task_Id = 20022, + Var_Int_Ground_Correct_Kind = 20023, + Var_Int_Kinetic_Type = 20024, + Var_Int_Situation_Kind = 20025, + Var_Int_Stage_Default_Light_Set_Index = 20026, + }; + + virtual soParamAccesser* getExtendParamAccesser(); + virtual ~soValueAccesser(); + virtual float getVariableFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getVariableIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getVariableIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual float getConstantFloatCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual int getConstantIntCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual void* getConstantIndefiniteCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual bool isControllerValueCore(soModuleAccesser* moduleAccesser, u32, u32); + virtual bool isEnableSpeedOperationCore(soModuleAccesser* moduleAccesser); + + static float getVariableFloat(soModuleAccesser* moduleAccesser, u32, u32); + static int getVariableInt(soModuleAccesser* moduleAccesser, u32, u32); + static void* getVariableIndefinite(soModuleAccesser* moduleAccesser, u32, u32); + + static float getConstantFloat(soModuleAccesser* moduleAccesser, u32, u32); + static int getConstantInt(soModuleAccesser* moduleAccesser, u32, u32); + static void* getConstantIndefinite(soModuleAccesser* moduleAccesser, u32, u32); + + static float getValueFloat(soModuleAccesser* moduleAccesser, u32, u32); + static int getValueInt(soModuleAccesser* moduleAccesser, u32, u32); + + static int getValueVariation(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/so_world.h b/include/lib/BrawlHeaders/Brawl/Include/so/so_world.h new file mode 100644 index 0000000000..28178d8321 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/so_world.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +class soWorld { +public: + float m_gravityUp; + float m_gravityDown; + float m_8; + u8 m_12; + u8 m_13; + char _14[2]; +}; +static_assert(sizeof(soWorld) == 0x10, "Class is wrong size!"); + +extern soWorld* g_soWorld; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_3d_generator_accesser_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_3d_generator_accesser_impl.h new file mode 100644 index 0000000000..e8cdefe691 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_3d_generator_accesser_impl.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include + +class soSound3dGeneratorAccesser { +protected: + struct GeneratorInstance { + int m_0; + snd3DGenerator m_soundGenerator; + }; + +public: + virtual ~soSound3dGeneratorAccesser(); + virtual void activate(Vec3f* pos); + virtual void deactivate(); + virtual void getInstance(); +}; + +class soSound3dGeneratorAccesserImpl : public soSound3dGeneratorAccesser { + GeneratorInstance m_generatorInstance; + +public: + virtual ~soSound3dGeneratorAccesserImpl(); + virtual void activate(Vec3f* pos); + virtual void deactivate(); + virtual GeneratorInstance* getInstance(int); +}; +static_assert(sizeof(soSound3dGeneratorAccesserImpl) == 16, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_module_impl.h new file mode 100644 index 0000000000..99aee1dc16 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/sound/so_sound_module_impl.h @@ -0,0 +1,133 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soSoundIdExchanger : public soNullable { +public: + virtual ~soSoundIdExchanger(); + virtual SndID getId(SndID sndID, soModuleAccesser* moduleAccesser); + virtual int getStepId(int); // TODO: Verify + virtual int getLandingId(int); // TODO: Verify +}; +static_assert(sizeof(soSoundIdExchanger) == 8, "Class is wrong size!"); + +class soSoundIdExchangerNull : public soSoundIdExchanger { +public: + virtual ~soSoundIdExchangerNull(); + virtual SndID getId(SndID sndID, soModuleAccesser* moduleAccesser); + virtual int getStepId(int); + virtual int getLandingId(int); +}; + +extern soSoundIdExchangerNull g_soSoundIdExchangerNull; + +class soSoundModule { +public: + class SoundIdList { + public: + SndID* sndIDs; + u32 numSndIDs; + }; + + class SoundIdData { + public: + SoundIdList* soundIdLists; + u32 numSoundIdLists; + }; + + // TODO: Verify params + virtual ~soSoundModule(); + virtual void update(Vec3f* pos); + virtual void deactivate(); + virtual void activate(Vec3f* pos); + virtual void setPos(Vec3f* pos, int); + virtual int playSE(SndID sndId, bool, int, int); + virtual int playSENo3d(SndID sndId, bool); + virtual int playSEPos(SndID sndId, Vec3f* pos, bool, int, int); + virtual int playStatusSE(SndID sndId, bool, int); + virtual void stopStatusSE(); + virtual void setPlayHitSEFlag(bool); + virtual bool getPlayHitSEFlag(); + virtual void playHitSE(float, void*); + virtual void playDamageSE(u32 index1, u32 index2); + virtual void setSEVol(float, int, int); + virtual float getSEVol(int); + virtual void setSEPitch(float); + virtual void setSEPitch(u32, double); + virtual float getSEPitch(); + virtual void stopSE(int, int); + virtual void stopSEHandle(int); + virtual void setSESpeed(int, float); + virtual void playLandingSE(); + virtual void setSoundIdData(SoundIdData*); + virtual SoundIdData* getSoundIdData(); + virtual void setFixGeneratorStatus(); + virtual void setCheckSoundGroup(int); + virtual int getCheckSoundGroup(); + virtual bool isPlay(int); +}; +static_assert(sizeof(soSoundModule) == 4, "Class is wrong size!"); + +class soSoundModuleImpl : public soSoundModule, public soStatusEventObserver, public soAnimCmdEventObserver, public soCollisionHitEventObserver, public soSituationEventObserver { + char _52[8]; + soSound3dGeneratorAccesser* m_soundGeneratorAccesser; + soModuleAccesser* m_moduleAccesser; + soSoundIdExchanger* m_soundIdExchanger; + SndID m_sndID; + SoundIdData* m_soundIdData; + float m_sePitch; + int m_checkSoundGroup; + bool m_playHitSEFlag; + u8 m_generatorStatus; + char _pad[2]; + +public: + // TODO: Verify params + virtual ~soSoundModuleImpl(); + virtual void update(Vec3f* pos); + virtual void deactivate(); + virtual void activate(Vec3f* pos); + virtual void setPos(Vec3f* pos, int); + virtual int playSE(SndID sndId, bool, int, int); + virtual int playSENo3d(SndID sndId, bool); + virtual int playSEPos(SndID sndId, Vec3f* pos, bool, int, int); + virtual int playStatusSE(SndID sndId, bool, int); + virtual void stopStatusSE(); + virtual void setPlayHitSEFlag(bool); + virtual bool getPlayHitSEFlag(); + virtual void playHitSE(float, void*); + virtual void playDamageSE(u32 index1, u32 index2); + virtual void setSEVol(float, int, int); + virtual float getSEVol(int); + virtual void setSEPitch(float); + virtual void setSEPitch(u32, double); + virtual float getSEPitch(); + virtual void stopSE(int, int); + virtual void stopSEHandle(int); + virtual void setSESpeed(int, float); + virtual void playLandingSE(); + virtual void setSoundIdData(SoundIdData*); + virtual SoundIdData* getSoundIdData(); + virtual void setFixGeneratorStatus(); + virtual void setCheckSoundGroup(int); + virtual int getCheckSoundGroup(); + virtual bool isPlay(int); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual void notifyEventCollisionHit(float power, soCollisionAttackData*, u32 index, int, soModuleAccesser* moduleAccesser, soCollisionLog*); + virtual void notifyEventChangeSituation(SituationKind kind, SituationKind prevKind, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soSoundModuleImpl) == 92, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/stageobject.h b/include/lib/BrawlHeaders/Brawl/Include/so/stageobject.h new file mode 100644 index 0000000000..18eb8520dd --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/stageobject.h @@ -0,0 +1,107 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class StageObject : public gfTask, private soActivatable, public soAnimCmdEventObserver, public soLinkEventObserver { +public: + + struct Link { + enum No { + No_Capture = 0x0, + }; + + enum EventKind { + Event_Deactivate_Parent = 0, + Event_Dead = 2, + Event_Deactivate_Node = 4, + + Event_Yoshi_Special_N_Catch = 29, + Event_Yoshi_Special_N_Swallow = 30, + + Event_Disconnect_Parent = 60, + Event_Disconnect_Node = 61, + Event_Touch_Item = 62, + }; + }; + + struct AnimCmd { + enum Type { + Type_Update_Node_SRT = 0x1, + Type_Set_Inactive = 0x2, + Type_Set_Active = 0x3, + Type_Set_Air = 0x4, + }; + }; + + soModuleAccesser* m_moduleAccesser; + StageObject(const char* name, int unk1, int unk2, int unk3, int unk4, soModuleAccesser* moduleAccesser); + virtual void processAnim(); + virtual void processUpdate(); + virtual void processPreMapCorrection(); + virtual void processMapCorrection(); + virtual void processFixPosition(); + virtual void processPreCollision(); + virtual void processCollision(); + virtual void processCatch(); + virtual void processHit(); + virtual void processFixCamera(); + virtual void processGameProc(); + virtual void processEnd(); + virtual void renderPre(); + virtual void processDebug(); + virtual void renderDebug(); + virtual ~StageObject(); + + // TODO: Verify params? + virtual void updatePosture(bool); + virtual void processFixPositionPreAnimCmd(); + virtual Input* getInput(); + virtual float getCollisionLr(soModuleAccesser*); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual bool isActive(); + virtual bool checkTransitionStatus(u32); + virtual void updateNodeSRT(); + virtual void adjustParentGroundCollision(int unk1, float* unk2); + virtual bool isTreadPassive(); + virtual void notifyLostGround(soModuleAccesser*); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + + virtual void notifyArticleEventRemove(int unk1, int* unk2); + virtual void notifyArticleEventEject(int unk1, int unk2, int* unk3, int* unk4); + virtual void updateRoughPos(); + + void activate(Vec3f* pos, float lr, float, bool); +}; +static_assert(sizeof(StageObject) == 0x64, "Class is wrong size!"); + +class BaseItem; +struct soLinkTouchItemEventArgs : public soLinkEventArgs { + BaseItem* m_item; + Vec3f m_pos; + float m_0x18; + bool m_0x1C; + + inline soLinkTouchItemEventArgs(BaseItem* item, Vec3f& pos, float arg3, bool arg4) : soLinkEventArgs(StageObject::Link::Event_Touch_Item), m_item(item), m_pos(pos), m_0x18(arg3), m_0x1C(arg4) {} +}; +static_assert(sizeof(soLinkTouchItemEventArgs) == 0x20, "Class is wrong size!"); + +struct UnkLinkEvent : public soLinkEventArgs { + + u32 unk8; + + inline UnkLinkEvent(u32 p1, u32 p3) : soLinkEventArgs(p1), unk8(p3) { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_event_presenter.h new file mode 100644 index 0000000000..56bf932073 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_event_presenter.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soStatusEventObserver : public soEventObserver { +public: + soStatusEventObserver() : soEventObserver(0x4) {}; + soStatusEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soStatusEventObserver) == 12, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_module_impl.h new file mode 100644 index 0000000000..2964ad3d05 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/status/so_status_module_impl.h @@ -0,0 +1,144 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class soModuleAccesser; + +class soStatusUniqProcess { +public: + virtual ~soStatusUniqProcess() { } + virtual void initStatus(soModuleAccesser* moduleAccesser) { } + virtual void exitStatus(soModuleAccesser* moduleAccesser, int) { } + virtual void execStatus(soModuleAccesser* moduleAccesser) { } + virtual void execStop(soModuleAccesser* moduleAccesser) { } + virtual void execMapCorrection(soModuleAccesser* moduleAccesser) { } + virtual void execFixPosCounter(soModuleAccesser* moduleAccesser) { } + virtual void execFixPos(soModuleAccesser* moduleAccesser) { } + virtual void execFixCamera(soModuleAccesser* moduleAccesser) { } + virtual bool checkDamage(soModuleAccesser* moduleAccesser, void*) { + return false; + } + virtual void checkAttack(soModuleAccesser* moduleAccesser, void*, float) { } + virtual bool onChangeLr(soModuleAccesser* moduleAccesser, float, float) { + return false; + } + virtual void leaveStop(soModuleAccesser* moduleAccesser, int, bool) { } + virtual bool checkTransitionPrecede(soModuleAccesser* moduleAccesser, int*) { + return true; + } +}; +static_assert(sizeof(soStatusUniqProcess) == 4, "Class is the wrong size!"); + +class soStatusUniqProcessNull : public soStatusUniqProcess { +public: + virtual ~soStatusUniqProcessNull() { } +}; +static_assert(sizeof(soStatusUniqProcessNull) == 4, "Class is the wrong size!"); + +class soStatusModule : public soNullable { +public: + virtual void activate(soModuleAccesser* moduleAccesser); + virtual void deactivate(soModuleAccesser* moduleAccesser); + virtual bool changeStatusRequest(int status, soModuleAccesser* moduleAccesser); + virtual void processFixPosition(soModuleAccesser* moduleAccesser, bool); + virtual void begin(); + virtual void execStatus(soModuleAccesser* moduleAccesser); + virtual void execStop(soModuleAccesser* moduleAccesser); + virtual void execMapCorrection(soModuleAccesser* moduleAccesser); + virtual void execFixPosCounter(soModuleAccesser* moduleAccesser); + virtual void execFixPos(soModuleAccesser* moduleAccesser); + virtual void execFixCamera(soModuleAccesser* moduleAccesser); + virtual bool checkDamage(soModuleAccesser* moduleAccesser, void*); + virtual void checkAttack(soModuleAccesser* moduleAccesser, void*, float); + virtual bool onChangeLr(soModuleAccesser* moduleAccesser, float, float); + virtual void leaveStop(soModuleAccesser* moduleAccesser, int, bool); + virtual int getStatusKind(); + virtual bool isCollisionAttackOccer(); + virtual bool isCollisionAttackTarget(u32* collisionAttackCategory); + virtual void startWatchChange(); + virtual bool isChanged(); + virtual bool checkTransition(soModuleAccesser* moduleAccesser); + virtual void enableTransitionTermGroup(int groupID); + virtual void unableTransitionTermGroup(int groupID); + virtual bool isEnableTransitionTermGroup(int groupID); + virtual void enableTransitionTermAll(int); + virtual void clearTransitionTermAll(int); + virtual void* getLastStatusTransitionInfo(); + virtual void addRangeUniqProc(soStatusUniqProcess* uniqProcs, u32 numUniqProcs); + virtual char* getStatusName(); + virtual char* getStatusName(int); + virtual u32 getStatusGroundCorrect(int); + virtual int getPrevStatusKind(u32); + virtual void connectStatusDataList(void*); + virtual void changeStatusForce(int status, soModuleAccesser* moduleAccesser); + virtual void unableTransitionTerm(int, int); + virtual void setUniqProc(u32 index, soStatusUniqProcess* uniqProc); + virtual ~soStatusModule(); + virtual void changeStatus(int status, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soStatusModule) == 8, "Class is wrong size!"); + +class soStatusModuleImpl : public soStatusModule, public soEventPresenter, public soAnimCmdEventObserver, public soCollisionAttackEventObserver { + +public: + soTransitionModule* m_transitionModule; + soArray* m_statusUniqProcessArr; + int m_statusKind; + int m_nextStatusKind; +private: + char _spacer[0x68]; +public: + virtual void activate(soModuleAccesser* moduleAccesser); + virtual void deactivate(soModuleAccesser* moduleAccesser); + virtual bool changeStatusRequest(int status, soModuleAccesser* moduleAccesser); + virtual void processFixPosition(soModuleAccesser* moduleAccesser, bool); + virtual void begin(); + virtual void execStatus(soModuleAccesser* moduleAccesser); + virtual void execStop(soModuleAccesser* moduleAccesser); + virtual void execMapCorrection(soModuleAccesser* moduleAccesser); + virtual void execFixPosCounter(soModuleAccesser* moduleAccesser); + virtual void execFixPos(soModuleAccesser* moduleAccesser); + virtual void execFixCamera(soModuleAccesser* moduleAccesser); + virtual bool checkDamage(soModuleAccesser* moduleAccesser, void*); + virtual void checkAttack(soModuleAccesser* moduleAccesser, void*, float); + virtual bool onChangeLr(soModuleAccesser* moduleAccesser, float, float); + virtual void leaveStop(soModuleAccesser* moduleAccesser, int, bool); + virtual int getStatusKind(); + virtual bool isCollisionAttackOccer(); + virtual bool isCollisionAttackTarget(u32* collisionAttackCategory); + virtual void startWatchChange(); + virtual bool isChanged(); + virtual bool checkTransition(soModuleAccesser* moduleAccesser); + virtual void enableTransitionTermGroup(int groupID); + virtual void unableTransitionTermGroup(int groupID); + virtual bool isEnableTransitionTermGroup(int groupID); + virtual void enableTransitionTermAll(int); + virtual void clearTransitionTermAll(int); + virtual void* getLastStatusTransitionInfo(); + virtual void addRangeUniqProc(soStatusUniqProcess* uniqProcs, u32 numUniqProcs); + virtual char* getStatusName(); + virtual char* getStatusName(int); + virtual u32 getStatusGroundCorrect(int); + virtual int getPrevStatusKind(u32); + virtual void connectStatusDataList(void*); + virtual void changeStatusForce(int status, soModuleAccesser* moduleAccesser); + virtual void unableTransitionTerm(int, int); + virtual void setUniqProc(u32 index, soStatusUniqProcess* uniqProc); + virtual ~soStatusModuleImpl(); + virtual void changeStatus(int status, soModuleAccesser* moduleAccesser); + + virtual bool notifyEventCollisionAttackCheck(u32 flags); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser);; +}; +static_assert(sizeof(soStatusModuleImpl) == 0xA4, "Class is wrong size!"); + +extern soStatusUniqProcessNull g_soStatusUniqProcessNull; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/stop/so_stop_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/stop/so_stop_module_impl.h new file mode 100644 index 0000000000..938e20e075 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/stop/so_stop_module_impl.h @@ -0,0 +1,74 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soStopModule { +public: + virtual void setSpecialStop(u32 duration); + virtual ~soStopModule(); + virtual void activate(); + virtual void end(s32); + virtual void setHitStop(); + virtual void cancelHitStop(); + virtual void setOtherStop(u32 duration); + virtual void cancelOtherStop(); + virtual void setLinkStop(u32 duration); + virtual bool isStop(); + virtual bool isSpecialStop(); + virtual bool isHit(); + virtual bool isDamage(); + virtual void update(); + virtual s32 getHitStopFrame(); + virtual s32 getHitStopRealFrame(); + virtual void setHitStopFrame(u32 duration, bool allowSDI); + virtual void setHitStopFrameFix(s32); +}; +static_assert(sizeof(soStopModule) == 0x4, "Class is wrong size!"); + +class soStopModuleImpl : public soStopModule, public soAnimCmdEventObserver { +private: + s32 m_hitStopRealFrame; +public: + char m_hitStopFrameFix; +private: + char unk15[0x7]; + u8 m_isStop : 1; + u8 m_isHit : 1; + u8 m_isDamage : 1; + u8 unk1C_b4 : 1; + u8 unk1C_b3 : 1; + u8 m_isSpecialStop : 1; + u8 unk1C_b1 : 1; + u8 unk1C_b0 : 1; +public: + soModuleAccesser* m_moduleAccesser; + + soStopModuleImpl(soModuleAccesser* acc); + + virtual void setSpecialStop(u32 duration); + virtual ~soStopModuleImpl(); + virtual void activate(); + virtual void end(s32); + virtual void setHitStop() { } + virtual void cancelHitStop(); + virtual void setOtherStop(u32 duration); + virtual void cancelOtherStop(); + virtual void setLinkStop(u32 duration); + virtual bool isStop() { return m_isStop != 0; } + virtual bool isSpecialStop() { return m_isSpecialStop != 0; } + virtual bool isHit() { return m_isHit != 0; } + virtual bool isDamage() { return m_isDamage != 0; } + virtual void update(); + virtual s32 getHitStopFrame(); + virtual s32 getHitStopRealFrame() { return m_hitStopRealFrame; } + virtual void setHitStopFrame(u32 duration, bool allowSDI); + virtual void setHitStopFrameFix(s32); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, s32 unk3); +}; +static_assert(sizeof(soStopModuleImpl) == 0x24, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/template_utils.h b/include/lib/BrawlHeaders/Brawl/Include/so/template_utils.h new file mode 100644 index 0000000000..3189623ef2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/template_utils.h @@ -0,0 +1,21 @@ +#pragma once + +// C++98 metaprogramming facilities + +template +struct soSelect { + typedef T Result; +}; + +template +struct soSelect { + typedef U Result; +}; + +template +struct soEnableIf { }; + +template +struct soEnableIf { + typedef T Type; +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/transition/so_transition_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/transition/so_transition_module_impl.h new file mode 100644 index 0000000000..be090936d2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/transition/so_transition_module_impl.h @@ -0,0 +1,171 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soGeneralTerm { +public: + soArrayContractibleTable m_animCmdTable; +}; +static_assert(sizeof(soGeneralTerm) == 0x10, "Class is wrong size!"); + +class soGeneralTermManager +{ +public: + soGeneralTerm* m_generalTerms; + s16* m_indices; + u16 _unk08; + u16 m_numGeneralTerms; + // Same as m_generalTerms? + soGeneralTerm* m_generalTerms2; + // Same as m_indices? + s16* m_indices2; +}; +static_assert(sizeof(soGeneralTermManager) == 0x14, "Class is wrong size!"); +extern soGeneralTermManager g_soGeneralTermManager; + +class soGeneralTermCache +{ +public: + u32 m_flags; + u32 m_flags2; + u32 m_buttonOnMask; + u32 m_buttonOnMask2; + u32 m_buttonTriggerMask; + u32 m_buttonTriggerMask2; + + void clearAll(); + void clearController(); + bool isFlag(u32 flagID, u8* resultOut); + bool isButtonOn(u32 buttonID, u8* resultOut); + bool isButtonTrigger(u32 buttonID, u8* resultOut); + void setFlag(u32 flagID, bool saveToMask2); + void setButtonOn(u32 buttonID, bool saveToMask2); + void setButtonTrigger(u32 buttonID, bool saveToMask2); +}; +static_assert(sizeof(soGeneralTermCache) == 0x18, "Class is wrong size!"); +extern soGeneralTermCache g_soGeneralTermCache; + +class soTransitionInfo { +public: + int m_groupId; + int m_unitId; + u32 _unk08; +}; +static_assert(sizeof(soTransitionInfo) == 0xC, "Class is wrong size!"); + +class soTransitionTerm { +public: + typedef u16 AttributeMask; + static const AttributeMask ATTRIBUTE_MASK_NONE = 0; + struct AttributeFlag { + union { + struct { + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + bool : 1; + }; + AttributeMask m_mask; + }; + inline AttributeFlag() : m_mask(ATTRIBUTE_MASK_NONE) {} + inline AttributeFlag(AttributeMask bits) : m_mask(bits) {} + inline ~AttributeFlag() {} + + AttributeFlag(soAttributeFlag f) : m_mask(f.m_mask) { } + operator soAttributeFlag() { return soAttributeFlag(m_mask); } + }; + + u8 m_flags; + u8 _pad01; + u16 m_targetKind; + s16 m_generalTermIndex; + u8 _pad06[2]; + + // Checks if term currently has all of its soGeneralTerms satisfied. + int checkEstablish(soModuleAccesser* accesserIn, u32* returnWord, soGeneralTermCache* generalTermCache); + void addGeneralTerm(soGeneralTerm* termIn); + void clearGeneralTerm(); +}; +static_assert(sizeof(soTransitionTerm) == 0x8, "Class is wrong size!"); + +class soTransitionTermGroup { +public: + u8 _unk00[4]; + soInstanceManagerFullPropertyEccentric m_transitionTermInstanceManager; + int m_unitID; + + // Checks if any of the terms within this group currently have all of their soGeneralTerms satisfied. + int checkEstablish(soModuleAccesser* moduleAccesser, u32* targetKindOut, int* termIDOut, u32* returnWord, u16* attrMask, soGeneralTermCache* generalTermCache); + // Creates a new empty term with the specified Unit ID, resetting any existing term if necessary. + int addTerm(int unitId, u32, soTransitionTerm* termIn, u16*); + // Calls addGeneralTerm on registered transitionTerm whose UnitID matches the supplied value (or the last registered, if -1 is supplied). + void addGeneralTerm(int unitID, soGeneralTerm* termIn); + // Calls addGeneralTerm on registered transitionTerm whoes ID matches m_unitID (or the last, if that value is -1); + void addGeneralTermLastTerm(soGeneralTerm* termIn); + void enableTerm(int unitId); + void unableTerm(int unitId); + void clearTransitionTermAll(); + void enableTermAll(); + void unableTermAll(); +}; +static_assert(sizeof(soTransitionTermGroup) == 0x14, "Class is wrong size!"); + + +class soTransitionModule { +public: + virtual int checkEstablish(soModuleAccesser* accesser, u32* targetKindOut, int groupID, u16* attrMask, soGeneralTermCache* generalTermCache); + virtual void enableTerm(int unitID, int groupID); + virtual void unableTerm(int unitID, int groupID); + virtual void enableTermAll(int groupID); + virtual void unableTermAll(int groupID); + virtual void enableTermGroup(int groupID); + virtual void unableTermGroup(int groupID); + virtual bool isEnableTermGroup(int groupID); + virtual void addTerm(int groupID, int, int unitID, int, u16* option); + virtual void addGeneralTerm(int groupID, int unitID, soGeneralTerm* term); + virtual void addGeneralTermLastTerm(int groupID, soGeneralTerm* term); + virtual void clearTransitionTermAll(int groupID); + virtual int notifyEventAnimCmd(int commandType, void* commandArgList, u8* option, soModuleAccesser* accesser); + virtual soTransitionInfo* getLastTransitionInfo(); + virtual ~soTransitionModule(); +}; + +class soTransitionModuleImpl : public soTransitionModule { +public: + soArray* m_transitionTermGroupArray; + int m_groupID; + soTransitionInfo m_transitionInfo; + virtual int checkEstablish(soModuleAccesser* accesser, u32* targetKindOut, int groupID, u16* attrMask, soGeneralTermCache* generalTermCache); + virtual void enableTerm(int unitID, int groupID); + virtual void unableTerm(int unitID, int groupID); + virtual void enableTermAll(int groupID); + virtual void unableTermAll(int groupID); + virtual void enableTermGroup(int groupID); + virtual void unableTermGroup(int groupID); + virtual bool isEnableTermGroup(int groupID); + virtual void addTerm(int groupID, int, int unitID, int, u16* option); + virtual void addGeneralTerm(int groupID, int unitID, soGeneralTerm* term); + virtual void addGeneralTermLastTerm(int groupID, soGeneralTerm* term); + virtual void clearTransitionTermAll(int groupID); + virtual int notifyEventAnimCmd(int commandType, void* commandArgList, u8* option, soModuleAccesser* accesser); + virtual soTransitionInfo* getLastTransitionInfo(); + virtual ~soTransitionModuleImpl(); +}; +static_assert(sizeof(soTransitionModuleImpl) == 0x18, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_event_presenter.h b/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_event_presenter.h new file mode 100644 index 0000000000..ac84ce89c2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_event_presenter.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include + +class soModuleAccesser; + +class soTurnEventObserver : public soEventObserver { +public: + soTurnEventObserver(short unitID) : soEventObserver(unitID) {}; + + virtual void addObserver(short param1, s8 param2); + virtual void notifyEventTurn(float, float, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soTurnEventObserver) == 12, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_module_impl.h new file mode 100644 index 0000000000..cc78affcf1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/turn/so_turn_module_impl.h @@ -0,0 +1,4 @@ +#pragma once + +#include +#include diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_impl.h new file mode 100644 index 0000000000..ff3a2809d3 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_impl.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include +#include + +class soVisibilityModuleImpl : public soVisibilityModuleSimple, public soStatusEventObserver { + char _0x18[2]; + soVisibilityData* m_data; + s8* m_setData; + u32 m_numSets; + char _0x2c[4]; + +public: + virtual void activate(); + virtual void setData(soVisibilityData*); + virtual void set(u32, u8); + virtual void setStatusDefault(u32, u8, bool); + virtual void setDefaultAll(); + virtual void update(); + virtual void hideAll(); + virtual int get(u32); + + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); +}; +static_assert(sizeof(soVisibilityModuleImpl) == 0x30, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_simple.h new file mode 100644 index 0000000000..ae01e77d8c --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/visibility/so_visibility_module_simple.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include + +class soModuleAccesser; + +class soVisibilityModule { +public: + virtual void activate(); + virtual void setData(soVisibilityData*); + virtual void set(u32, u8); + virtual void setStatusDefault(u32, u8, bool); + virtual void setDefaultAll(); + virtual void update(); + virtual void hideAll(); + virtual void setWhole(u8); + virtual u8 getWhole(); + virtual bool isVisible(); + virtual int get(u32); +}; + +class soVisibilityModuleSimple : public soVisibilityModule, public soAnimCmdEventObserver { + u8 m_whole; + char _0xe[1]; + soModuleAccesser* m_moduleAccesser; + +public: + virtual void activate(); + virtual void setData(soVisibilityData*); + virtual void set(u32, u8); + virtual void setStatusDefault(u32, u8, bool); + virtual void setDefaultAll(); + virtual void update(); + virtual void hideAll(); + virtual void setWhole(u8); + virtual u8 getWhole(); + virtual bool isVisible(); + virtual int get(u32); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soVisibilityModuleSimple) == 0x14, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work.h b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work.h new file mode 100644 index 0000000000..fee6473499 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include +#include +#include + +class soGeneralWork : public soGeneralWorkAbstract { + soArray* m_ints; + soArray* m_floats; + soArray >* m_flags; +public: + soGeneralWork( + soArray* p1, + soArray* p2, + soArray >* p3 + ) : m_ints(p1), m_floats(p2), m_flags(p3) { } + ~soGeneralWork() { } + virtual s32 getIntWork(u32 index) const; + virtual void setIntWork(s32 value, u32 index); + virtual void addIntWork(s32 value, u32 index); + virtual void subIntWork(s32 value, u32 index); + virtual void mulIntWork(s32 value, u32 index); + virtual void divIntWork(s32 value, u32 index); + virtual void incIntWork(u32 index); + virtual void decIntWork(u32 index); + virtual u32 getIntWorkSize(); + virtual float getFloatWork(u32 index) const; + virtual void setFloatWork(float value, u32 index); + virtual void addFloatWork(float value, u32 index); + virtual void subFloatWork(float value, u32 index); + virtual void mulFloatWork(float value, u32 index); + virtual void divFloatWork(float value, u32 index); + virtual u32 getFloatWorkSize(); + virtual void onFlag(u32 flag, u32 index); + virtual void offFlag(u32 flag, u32 index); + virtual void clearFlag(u32 index); + virtual bool isFlag(u32 flag, u32 index) const; + virtual u32 turnOffFlag(u32 flag, u32 index); + virtual u32 getFlagWorkSize(); + virtual void clearWorkAll(); +}; +static_assert(sizeof(soGeneralWork) == 0x18, "Class is wrong size!"); + +extern soGeneralWork g_soGeneralWork; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_abstract.h b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_abstract.h new file mode 100644 index 0000000000..94bdc67129 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_abstract.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include + +class soGeneralWorkAbstract : private soNull, public soNullable { +public: + soGeneralWorkAbstract(); + ~soGeneralWorkAbstract() { } + virtual s32 getIntWork(u32 index) const { return 0; } + virtual void setIntWork(s32 value, u32 index) { } + virtual void addIntWork(s32 value, u32 index) { } + virtual void subIntWork(s32 value, u32 index) { } + virtual void mulIntWork(s32 value, u32 index) { } + virtual void divIntWork(s32 value, u32 index) { } + virtual void incIntWork(u32 index) { } + virtual void decIntWork(u32 index) { } + virtual u32 getIntWorkSize() { return 0; } + virtual float getFloatWork(u32 index) const { return 0.0f; } + virtual void setFloatWork(float value, u32 index) { } + virtual void addFloatWork(float value, u32 index) { } + virtual void subFloatWork(float value, u32 index) { } + virtual void mulFloatWork(float value, u32 index) { } + virtual void divFloatWork(float value, u32 index) { } + virtual u32 getFloatWorkSize() { return 0; } + virtual void onFlag(u32 flag, u32 index) { } + virtual void offFlag(u32 flag, u32 index) { } + virtual void clearFlag(u32 index) { } + virtual bool isFlag(u32 flag, u32 index) const { return false; } + virtual u32 turnOffFlag(u32 flag, u32 index) { return 0; } + virtual u32 getFlagWorkSize() { return 0; } + virtual void clearWorkAll() { } +}; +static_assert(sizeof(soGeneralWorkAbstract) == 12, "Class is wrong size!"); + +extern soGeneralWorkAbstract g_soGeneralWorkAbstract; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_simple.h b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_simple.h new file mode 100644 index 0000000000..50042fbd0e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_general_work_simple.h @@ -0,0 +1,145 @@ +#pragma once + +#include +#include +#include + +class soGeneralWorkSimple : public soGeneralWorkAbstract { + void clearInts() { + s32 intWorkSize = m_intWorkSize; + intWorkSize = (intWorkSize != m_intWorkSize) ? m_intWorkSize : intWorkSize; + for (s32 i = 0; i < intWorkSize; i++) { + m_intWorks[i] = 0; + } + } + + void clearFloats() { + s32 floatWorkSize = m_floatWorkSize; + floatWorkSize = (floatWorkSize != m_floatWorkSize) ? m_floatWorkSize : floatWorkSize; + for (s32 i = 0; i < floatWorkSize; i++) { + m_floatWorks[i] = 0; + } + } + + void clearFlags() { + s32 flagWorkSize = m_flagWorkSize; + flagWorkSize = (flagWorkSize != m_flagWorkSize) ? m_flagWorkSize : flagWorkSize; + for (s32 i = 0; i < flagWorkSize; i++) { + m_flagWorks[i] = 0; + } + } +public: + s32* m_intWorks; + u32 m_intWorkSize; + float* m_floatWorks; + u32 m_floatWorkSize; + u32* m_flagWorks; + u32 m_flagWorkSize; + + soGeneralWorkSimple() { } + + virtual s32 getIntWork(u32 index) const { + return m_intWorks[index]; + } + + virtual void setIntWork(s32 value, u32 index) { + m_intWorks[index] = value; + } + + virtual void addIntWork(s32 value, u32 index) { + m_intWorks[index] += value; + } + + virtual void subIntWork(s32 value, u32 index) { + m_intWorks[index] -= value; + } + + virtual void mulIntWork(s32 value, u32 index) { + m_intWorks[index] *= value; + } + + virtual void divIntWork(s32 value, u32 index) { + if (0 != value) { + m_intWorks[index] /= value; + } + } + + virtual void incIntWork(u32 index) { + m_intWorks[index]++; + } + + virtual void decIntWork(u32 index) { + m_intWorks[index]--; + } + + virtual u32 getIntWorkSize() { + return m_intWorkSize; + } + + virtual float getFloatWork(u32 index) const { + return m_floatWorks[index]; + } + + virtual void setFloatWork(float value, u32 index) { + m_floatWorks[index] = value; + } + + virtual void addFloatWork(float value, u32 index) { + m_floatWorks[index] += value; + } + + virtual void subFloatWork(float value, u32 index) { + m_floatWorks[index] -= value; + } + + virtual void mulFloatWork(float value, u32 index) { + m_floatWorks[index] *= value; + } + + virtual void divFloatWork(float value, u32 index) { + if (0.0f != value) { + m_floatWorks[index] /= value; + } + } + + virtual u32 getFloatWorkSize() { + return m_floatWorkSize; + } + + virtual void onFlag(u32 flag, u32 index) { + m_flagWorks[index] |= flag; + } + + virtual void offFlag(u32 flag, u32 index) { + m_flagWorks[index] &= ~flag; + } + + virtual void clearFlag(u32 index) { + m_flagWorks[index] = 0; + } + + virtual bool isFlag(u32 flag, u32 index) const { + return m_flagWorks[index] & flag; + } + + virtual u32 turnOffFlag(u32 flag, u32 index) { + u32 result; + if ((result = isFlag(flag, index)) == 1) { + offFlag(flag, index); + } + return result; + } + + virtual u32 getFlagWorkSize() { + return m_flagWorkSize; + } + + virtual void clearWorkAll() { + clearInts(); + clearFloats(); + clearFlags(); + } +}; +static_assert(sizeof(soGeneralWorkSimple) == 0x24, "Class is wrong size!"); + +extern soGeneralWorkSimple g_soGeneralWorkSimple; diff --git a/include/lib/BrawlHeaders/Brawl/Include/so/work/so_work_manage_module_impl.h b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_work_manage_module_impl.h new file mode 100644 index 0000000000..80f603acab --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/so/work/so_work_manage_module_impl.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class soWorkManageModule : public soNullable { +public: + virtual ~soWorkManageModule(); + virtual void activate(); + virtual void setWork(u32 index, soGeneralWorkAbstract* generalWork); + virtual int getInt(u32 index); + virtual void setInt(int value, u32 index); + virtual void rndInt(int minValue, int maxValue, u32 index); + virtual void incInt(u32 index); + virtual void decInt(u32 index); + virtual void addInt(int addValue, u32 index); + virtual void subInt(int subtractValue, u32 index); + virtual u32 countDownInt(u32 index, int threshold); + virtual float getFloat(u32 index); + virtual void setFloat(float value, u32 index); + virtual void rndFloat(float minValue, float maxValue, u32 index); + virtual void addFloat(float addValue, u32 index); + virtual void subFloat(float subtractValue, u32 index); + virtual bool isFlag(u32 index); + virtual void onFlag(u32 index); + virtual void offFlag(u32 index); + virtual void setFlag(bool on, u32 index); + virtual bool turnOffFlag(u32 index); + virtual void clearAll(u32 index); + virtual void* getParamAccesser(); +}; +static_assert(sizeof(soWorkManageModule) == 8, "Class is wrong size!"); + +class soWorkManageModuleImpl : public soWorkManageModule, public soLockable, public soAnimCmdEventObserver { + +public: + char _spacer[4]; + soGeneralWorkAbstract* m_generalWorks[2]; + char _spacer2[8]; + + virtual ~soWorkManageModuleImpl(); + virtual void activate(); + virtual void setWork(u32 index, soGeneralWorkAbstract* generalWork); + virtual int getInt(u32 index); + virtual void setInt(int value, u32 index); + virtual void rndInt(int minValue, int maxValue, u32 index); + virtual void incInt(u32 index); + virtual void decInt(u32 index); + virtual void addInt(int addValue, u32 index); + virtual void subInt(int subtractValue, u32 index); + virtual u32 countDownInt(u32 index, int threshold); + virtual float getFloat(u32 index); + virtual void setFloat(float value, u32 index); + virtual void rndFloat(float minValue, float maxValue, u32 index); + virtual void addFloat(float addValue, u32 index); + virtual void subFloat(float subtractValue, u32 index); + virtual bool isFlag(u32 index); + virtual void onFlag(u32 index); + virtual void offFlag(u32 index); + virtual void setFlag(bool on, u32 index); + virtual bool turnOffFlag(u32 index); + virtual void clearAll(u32 index); + virtual void* getParamAccesser(); + + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); +}; +static_assert(sizeof(soWorkManageModuleImpl) == 48, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sq/sq_sequence_init.h b/include/lib/BrawlHeaders/Brawl/Include/sq/sq_sequence_init.h new file mode 100644 index 0000000000..2d457f8fb7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sq/sq_sequence_init.h @@ -0,0 +1,6 @@ +#pragma once + +#include + +void sqRegistSequence(); +void sqSystemSetStartSequence(bool p1); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sr/sr_common.h b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_common.h new file mode 100644 index 0000000000..3d41a7e1c6 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_common.h @@ -0,0 +1,87 @@ +#pragma once + +#include + +namespace Heaps { + enum HeapType { + SystemFW = 0x1, + System = 0x2, + Effect = 0x3, + RenderFifo = 0x4, + Sound = 0x5, + Network = 0x6, + WiiPad = 0x7, + IteamResource = 0x8, + ItemResource = 0x8, + InfoResource = 0x9, + CommonResource = 0xa, + Replay = 0xb, + Tmp = 0xc, + Physics = 0xd, + ItemInstance = 0xe, + StageInstance = 0xf, + StageCommonResource = 0x10, + StageResource = 0x11, + Fighter1Resource = 0x12, + Fighter2Resource = 0x13, + Fighter3Resource = 0x14, + Fighter4Resource = 0x15, + Fighter1Resource2 = 0x16, + Fighter2Resource2 = 0x17, + Fighter3Resource2 = 0x18, + Fighter4Resource2 = 0x19, + FighterEffect = 0x1a, + Fighter1Instance = 0x1b, + Fighter2Instance = 0x1c, + Fighter3Instance = 0x1d, + Fighter4Instance = 0x1e, + FighterTechqniq = 0x1f, + FighterKirbyResource1 = 0x20, + FighterKirbyResource2 = 0x21, + FighterKirbyResource3 = 0x22, + AssistFigureResource = 0x23, + ItemExtraResource = 0x24, + EnemyInstance = 0x25, + PokemonResource = 0x26, + WeaponInstance = 0x27, + InfoInstance = 0x28, + InfoExtraResource = 0x29, + MenuInstance = 0x2a, + MenuResource = 0x2b, + CopyFB = 0x2c, + GameGlobal = 0x2d, + GlobalMode = 0x2e, + MeleeFont = 0x30, + OverlayCommon = 0x32, + OverlayStage = 0x33, + OverlayMenu = 0x34, + OverlayFighter1 = 0x35, + OverlayFighter2 = 0x36, + OverlayFighter3 = 0x37, + OverlayFighter4 = 0x38, + OverlayEnemy = 0x39, + Thread = 0x3a, + Invalid = 0xff, + + // NON-STANDARD + BrawlEx = 0x3b, + Syringe = 0x3c, + CodeMenu = 0x3d, + FudgeAI = 0x3e, + StockFaceResource = 0x3f, + RetroMode = 0x40 + }; +} // namespace HeapType + +// using namespace Heaps; + +typedef Heaps::HeapType HeapType; +typedef Heaps::HeapType srHeapType; + +s32 srSystemGetDebugLevel(); +void* operator new(size_t size); +void* operator new(size_t size, Heaps::HeapType heap); +void operator delete(void* ptr); +void* operator new[](size_t size, Heaps::HeapType heap); +void* operator new[](size_t size); +void operator delete[](void* ptr); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sr/sr_getappname.h b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_getappname.h new file mode 100644 index 0000000000..5db23a6f13 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_getappname.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +const char* srGetAppGamename(); +u32 srGetAppInitialCode(); +u32 srGetAppInitialCodeLocaleNum(); +u32 srGetAppInitialCodeLocale(u32 i); diff --git a/include/lib/BrawlHeaders/Brawl/Include/sr/sr_revision.h b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_revision.h new file mode 100644 index 0000000000..31cdeba070 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/sr/sr_revision.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +u16 srSystemGetRevisionNumber(); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader.h b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader.h new file mode 100644 index 0000000000..cf5d8e0024 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include + +class stLoader : public gfTask { +public: + gmGlobalModeMelee* m_globalModeMelee; + u8 m_state; + char _0x45[3]; + + virtual void processBegin(); + virtual ~stLoader(); + virtual void entryEntity(); + virtual void removeEntity(); + virtual bool isLoad(); + virtual bool isEmpty(); +}; +static_assert(sizeof(stLoader) == 0x48, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_manager.h b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_manager.h new file mode 100644 index 0000000000..039bc82c63 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_manager.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include + +class stLoaderManager { +public: + stLoaderPlayer* m_loaderPlayers[MAX_PLAYERS]; + void* m_loaderStage; + void* m_loaderStageAlt; + void* m_loaderStageSe; + void* m_loaderPokemonSe; + void* m_loaderInfo; + void* m_loaderSandbag; + void* m_loaderStageAdvCommon; + char _0x38[0x1C]; +}; + +extern stLoaderManager* g_stLoaderManager; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_player.h b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_player.h new file mode 100644 index 0000000000..8eacc64931 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/loader/st_loader_player.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +class stLoaderPlayer : public stLoader { +public: + enum Mode { + Mode_Entry = 0x1, + Mode_Appear = 0x2, + Mode_Result = 0x6, + }; + + u32 m_playerId; + int m_entryId; + int m_slotId; + char _0x54[2]; + u8 m_56; + Mode m_mode : 8; + char _0x58[2]; + gmCharacterKind m_characterKind : 8; + char _0x5b[5]; + + virtual void processBegin(); + virtual ~stLoaderPlayer(); + virtual void entryEntity(); + virtual void removeEntity(); + virtual bool isLoad(); + virtual bool isEmpty(); + virtual void setSuddenDeath(); + virtual void entryInfoBefore(); + virtual void entryInfo(bool); + virtual void removeInfo(); + virtual void entryEntitySuddenDeath(); + virtual void entryEntityRebirth(); + virtual void entryEntityRebirthAdventure(u8); + virtual void lockEntity(); + virtual void unlockEntity(); + virtual bool isEntry(); + virtual gmPlayerInitData* getWatchPlayerInitData(); + + +}; +static_assert(sizeof(stLoaderPlayer) == 0x60, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/module.h b/include/lib/BrawlHeaders/Brawl/Include/st/module.h new file mode 100644 index 0000000000..d3732de7e2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/module.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +struct StageModuleId { + srStageKind kind; + const char name[0x20]; +}; + +void moUnResolvedMessage(char const* name); +char const* moGetStageModuleName(srStageKind kind); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator.h new file mode 100644 index 0000000000..b6dbc96851 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include + +class stOperator : public gfTask { +public: + u8 m_state; + bool m_isStart; + bool m_isExit; + bool m_isPause; + gmGlobalModeMelee* m_condition; + + virtual void processBegin(); + virtual ~stOperator(); +}; +static_assert(sizeof(stOperator) == 72, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_drop_item.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_drop_item.h new file mode 100644 index 0000000000..1142626b13 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_drop_item.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include +#include + + +class stOperatorDropItem : public stOperator { +public: + static const u32 FRAMES_REQUIRED_START_BOMB_DROP = 1200; + + enum Frequency { + Frequency_Low = 0x0, + Frequency_Medium = 0x1, + Frequency_High = 0x2, + Frequency_VeryHigh = 0x3, // Custom + Frequency_Intense = 0x4, // Custom + Frequency_BombRain = 0x5 // Custom + }; + + bool m_isSuddenDeath; + char _0x9[0x3]; + float m_framesElapsedStartBombDrop; + float m_framesElapsedBombDrop; + Vec3f m_posItemDrop; + float m_framesElapsedItemDrop; + float m_framesRequiredItemDrop; + float m_framesElapsed; + Frequency m_frequency : 8; + char _0x2D[3]; + + virtual ~stOperatorDropItem(); +}; +static_assert(sizeof(stOperatorDropItem) == 112, "Class is wrong size!"); + +class stOperatorDropItemMelee : public stOperatorDropItem { +public: + virtual ~stOperatorDropItemMelee(); + virtual void processBegin(); + virtual void startOperator(); +}; +static_assert(sizeof(stOperatorDropItem) == 112, "Class is wrong size!"); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_info.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_info.h new file mode 100644 index 0000000000..486f8cd05e --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_info.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include +#include + +class stOperatorInfo : public stOperator { +public: + stLoaderPlayer* m_loaderPlayers[MAX_PLAYERS]; + s8 m_playersCursorStatus[MAX_PLAYERS]; + s8 m_playersNameCursorStatus[MAX_PLAYERS]; + char _0x74[0x42]; + s8 m_playersLoupeStatus[MAX_PLAYERS]; + char _0x7B[0x60]; + + virtual void processBegin(); + virtual void processEnd(); + virtual ~stOperatorInfo(); + virtual void startOperator(); + virtual void stopOperatorRequest(); + virtual bool isEnableOperation(); + virtual u32 getEndType(); + virtual u32 getErrorLevel(); + virtual bool isError(); + virtual void setPlayerCursorClear(u8 index); + virtual void setPlayerCursorStatus(u8 index, s8 status); + virtual void setPlayerNameCursorStatus(u8 index, s8 status); + virtual void setPlayerLoupeStatus(u8 index, s8 status); + virtual void updatePlayerCursor(bool); + +}; +static_assert(sizeof(stOperatorInfo) == 0x11c, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule.h new file mode 100644 index 0000000000..aa65b57aa4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include + +class stOperatorRule : public stOperator { +public: + enum DecisionKind { + Decision_Timeup = 0x0, + Decision_Gameset = 0x1, + Decision_Complete = 0x2, + Decision_Failure = 0x3, + Decision_Success = 0x4 + }; + + void* m_operatorBgm; + void* m_operatorNetwork; + void* m_operatorController; + char _20[32]; + bool m_isGameSet; + char _53[87]; + + virtual void processBegin(); + virtual ~stOperatorRule(); + virtual void setOperatorBgm(void*); + virtual void setOperatorNetwork(void*); + virtual void setOperatorController(void*); + virtual bool isGameSet(); + virtual bool isEnd(); + virtual void startOperator(); + virtual void calcScore(); + virtual bool isSuddenDeath(); + virtual void adjustResultInfo(); + virtual void notifyEventKnockout(u32); + virtual bool notifyEventDead(int entryId, u32 playerIndex, int); + virtual void notifyEventStartStage(); + virtual void notifyEventSetupCorps(); + virtual void notifyEventBeat(u32 playerIndex1, u32 playerIndex2); + virtual void notifyEventYoshiEgg(); + virtual void notifyEventPikminBloom(); + virtual void nortifyNetworkOtherNodeExit(); + virtual void networkWriteRanking(); + virtual void setOpAppearanceHelper(void*); +}; +static_assert(sizeof(stOperatorRule) == 204, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_melee.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_melee.h new file mode 100644 index 0000000000..121a2b07d0 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_melee.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include +#include + +class stOperatorRuleMelee : public stOperatorRule { +public: + gmResultInfo* m_resultInfo; + char _144[2]; + u8 m_146; + char _147[12]; + bool m_isStart; + u32 m_remainingFrameTime; + u32 m_framesElapsed; + u32 m_frameCounter; + char _0xAC[0x18]; + int m_numPlayers; + u32 m_playersLastDeadSleepFrame[MAX_PLAYERS]; + u32 m_0x124[MAX_PLAYERS]; + int m_0x140[MAX_PLAYERS]; + int m_0x15C[MAX_PLAYERS]; + int m_0x178[MAX_PLAYERS]; + int m_playersRankPoint[MAX_PLAYERS]; + char _0x1B0[0xA4]; + DecisionKind m_decisionKind; + char _0x258[4]; + + virtual void processBegin(); + virtual ~stOperatorRuleMelee(); + virtual bool isEnd(); + virtual void startOperator(); + virtual void calcScore(); + virtual bool isSuddenDeath(); + virtual void adjustResultInfo(); + virtual void notifyEventKnockout(u32); + virtual bool notifyEventDead(int entryId, u32 playerIndex, int); + virtual void notifyEventStartStage(); + virtual void notifyEventSetupCorps(); + virtual void notifyEventBeat(u32 playerIndex1, u32 playerIndex2); + virtual void networkWriteRanking(); + virtual void updateExtraInfo(); + virtual bool checkExtraRule(); + virtual void decisionExtraRule(); + virtual void calcHighScore(); + virtual bool getNextCorpsPutMemberCharaKind(u8*, u8*); + virtual bool searchCorpsPutMember(u32, int, u32*, u32*, u8*); + virtual void putCorpsPutMember(void*, u32 characterKind, u32 costumeId, u8, bool); +}; +static_assert(sizeof(stOperatorRuleMelee) == 604, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_targetbreak.h b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_targetbreak.h new file mode 100644 index 0000000000..729f106362 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/operator/st_operator_rule_targetbreak.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include + +class stOperatorRuleTargetBreak : public stOperatorRuleMelee { +public: + int m_damageBonus; + int m_timeBonus; + int m_leftTime; + int m_brokenTargetCount; + u32 m_level; + u8 m_numPlayers; + char _0x271[23]; + bool m_isComplete; + char _0x289[3]; + + virtual ~stOperatorRuleTargetBreak(); + virtual void calcScore(); + virtual bool isSuddenDeath(); + virtual bool notifyEventDead(int entryId, u32 playerIndex, int); + virtual void notifyEventStartStage(); + virtual void updateExtraInfo(); + virtual bool checkExtraRule(); + virtual void decisionExtraRule(); + virtual void calcHighScore(); +}; +static_assert(sizeof(stOperatorRuleTargetBreak) == 0x28c, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/se_util.h b/include/lib/BrawlHeaders/Brawl/Include/st/se_util.h new file mode 100644 index 0000000000..231423ae62 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/se_util.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace StSeUtil { + // TODO: Find more descriptive name + struct UnkStruct { + SndID id; + float unk4; // pan? + float unk8; + float unkC; + }; + + // TODO: Find more descriptive name + struct UnkStruct2 { + UnkStruct* unk0; + size_t unk4; // length of both unk0 and unk8 + // Maps index of the SeSeq's UnkStruct3 array with the same SndID + // as this type's UnkStruct array + size_t* unk8; + }; + + // TODO: Find more descriptive name + struct UnkStruct3 { + SndID id; + s32 unk4; + s32 unk8; // 2 LSBits form a logical bitfield + UnkStruct* unkC; + }; + + class SeSeq { + public: + virtual ~SeSeq() = 0; + + public: + UnkStruct2* unk4; // 0x04 + size_t unk8; // 0x08 + UnkStruct3* unkC; // 0x0C + size_t unk10; // 0x10 + snd3DGenerator* m_sndGenerator; // 0x14 + s32 unk18; + float unk1C; + + public: + SeSeq(UnkStruct2* unk, size_t unk2, UnkStruct3* unk3, size_t unk4); + void playFrame(s32 unk, float frame); + void playFrame(s32 unk2, float frame, float unk1); + void registId(SndID* ids, size_t n); // n is limited to be < unk10 + void registSeq(int unk1, UnkStruct* ID, size_t unk2, Heaps::HeapType heapType); + void mapping(); + }; + static_assert(sizeof(SeSeq) == 0x20, "Class is wrong size!"); + + template + struct SeSeqInstance : public SeSeq { + SeSeqInstance() : SeSeq(unk20, M, unk50, N) { } + virtual ~SeSeqInstance() { } + UnkStruct2 unk20[M]; + UnkStruct3 unk50[N]; + }; +} diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_area_manager.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_area_manager.h new file mode 100644 index 0000000000..1fd8e6f6e2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_area_manager.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include +#include + +struct stAreaInfoData { + int m_areaId; +}; + +struct stMovementData { + Gimmick::AreaKind m_gimmickKind : 16; + char _0x2[2]; + float m_speed; + float m_vector; + float _0xC; + float _0x10; + float _0x14; + int m_taskId; + char _0x1c[4]; +}; +static_assert(sizeof(stMovementData) == 0x20, "Class is wrong size!"); + +struct stMovementAreaInfoData : public stAreaInfoData, public stMovementData { + +}; +static_assert(sizeof(stMovementAreaInfoData) == 0x24, "Class is wrong size!"); + +struct stWaterData { + Gimmick::AreaKind m_gimmickKind : 16; + char _0x2[2]; + float m_swimHeight; + float m_currentSpeed; + u8 m_0xc; + char _0xd[3]; +}; +static_assert(sizeof(stWaterData) == 0x10, "Class is wrong size!"); + +struct stWaterAreaInfoData : public stAreaInfoData, public stWaterData { + +}; +static_assert(sizeof(stWaterAreaInfoData) == 0x14, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_class_info.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_class_info.h new file mode 100644 index 0000000000..60a88231ba --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_class_info.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include + +class stClassInfo { +private: +public: + void setClassInfo(Stages::srStageKind, stClassInfo*); + stClassInfo(); + virtual ~stClassInfo(); +}; + +template +class stClassInfoImpl : public stClassInfo { +private: +public: + stClassInfoImpl() : stClassInfo() { setClassInfo(I, this); }; + virtual ~stClassInfoImpl(); + virtual T* create(); + virtual void preload(); +}; + +#define ST_CLASS_INFO \ + template \ + T* stClassInfoImpl::create() \ + { \ + T* stage = new (Heaps::StageInstance) T(); \ + return stage; \ + }; \ + template \ + stClassInfoImpl::~stClassInfoImpl() \ + { \ + setClassInfo(I, 0); \ + } \ + template \ + void stClassInfoImpl::preload() \ + { \ + return; \ + } diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_collision_attr_param.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_collision_attr_param.h new file mode 100644 index 0000000000..83bd9763b1 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_collision_attr_param.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +struct grGimmickDamageFloor { + grGimmick::AttackData m_attackData; + char _88[4]; + u32 m_index; + int m_teamNo; + + inline grGimmickDamageFloor() {}; + inline grGimmickDamageFloor(grGimmick::AttackData* attackData, u32 index, int teamNo = -1) + : m_attackData(*attackData), m_index(index), m_teamNo(teamNo) { + } + +}; +static_assert(sizeof(grGimmickDamageFloor) == 100, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_common_gimmick.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_common_gimmick.h new file mode 100644 index 0000000000..c32cb63fe7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_common_gimmick.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class stCommonGimmick : public Stage { +public: + gfArchive* m_fileData; // +0x1A0 + gfArchive* m_secondaryFileData; + gfArchive* unk1A8; + bool unk1AC; + bool m_isPaused; + gfArchive* m_commonFileData; // +0x1B0 + + stCommonGimmick(const char* name, srStageKind stageKind); + virtual void processBegin(); + virtual ~stCommonGimmick(); + + void setupItemSheet(); + void releaseArchive(); + void releaseArchiveCommon(); + void setPause(bool pause); + bool createGimmickFrameTrigger(grGimmickFrameTriggerData* frameTriggerData); + void createGimmickCollision(u32 collIndex, Ground* ground, gfArchive* archive); + bool createGimmickBeltConveyor2(grGimmickBeltConveyorData* beltConveyorAreaData); + bool createGimmickWaterArea(grGimmickWaterData* waterAreaData); + bool createGimmickWind2(grGimmickWindData* windAreaData); + bool createGimmickHitPointEffectArea(grGimmickHitPointEffectData* hitPointEffectData); + grGimmickLadder* createGimmickLadder(grGimmickLadderData* ladderData, gfArchive* archive); + grGimmickCatapult* createGimmickCatapult(grGimmickCatapultData* catapultData, gfArchive* archive); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_data_container.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_data_container.h new file mode 100644 index 0000000000..fa6f178b07 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_data_container.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include +#include +#include + +struct stDataContainerData { + u32 m_MAGIC; + u32 m_numFiles; + s32 m_version; + u32 m_extParam; +}; + +struct BlocMagicT { + u32 data; + BlocMagicT(u32 d) : data(d) { } +}; +extern u32 g_BlocMagicInit; +extern BlocMagicT g_BlocMagic; + +class stDataContainer { +public: + stDataContainer(stDataContainerData* data); + virtual ~stDataContainer(); + virtual u32 getVersion() const { return 0; } + virtual u32 getExtParam() const { return 0; } + virtual stDataContainerData* getData(u32 index); + virtual void* getDataAddressHead(); + + u32 m_headerSize; + stDataContainerData* m_filedata; + static const u32 HeaderSize = 8; +}; +static_assert(sizeof(stDataContainer) == 0xC, "Class is wrong size!"); + +class stDataSimpleContainer : public stDataContainer { + static const u32 SimpleHeaderSize = 16; + +public: + stDataSimpleContainer(stDataContainerData* data); + virtual ~stDataSimpleContainer(); +}; +static_assert(sizeof(stDataSimpleContainer) == 0xC, "Class is wrong size!"); + +class stDataMultiContainer : public stDataContainer { +private: + u16 m_maxFiles; + u16 m_numFiles; + stDataContainer** m_nodes; + + static const u32 Capacity = 64; + static const u32 HeaderSize = 16; +public: + stDataMultiContainer(stDataContainerData* filedata, HeapType destHeap) : + stDataContainer(filedata), + m_maxFiles(Capacity), + m_numFiles(0), + m_nodes((stDataContainer**)(gfHeapManager::alloc(destHeap, sizeof(m_nodes[0]) * Capacity))) + { + gfMemFill(m_nodes, 0, sizeof(m_nodes[0]) * Capacity); + m_headerSize = HeaderSize; + const u32 numFiles = m_filedata->m_numFiles; + for (u32 i = 0; i < numFiles; i++) { + stDataContainerData* data = getData(i); + // BUG: starts to leak stDataContainers once Capacity is exceeded + stDataContainer* c = new (destHeap) stDataContainer(data); + if (m_numFiles < m_maxFiles) { + m_nodes[m_numFiles] = c; + m_numFiles++; + } + } + } + + virtual ~stDataMultiContainer(); + virtual u32 getVersion() const; + virtual u32 getExtParam() const; + + stDataContainer* searchContainer(u32 targetMagic, u32 nodeIdx); + stDataContainerData* getContainerData(u32 targetMagic, u32 nodeDataIdx, u32 nodeIdx); + u32 getContainerDataNum(u32 targetMagic, u32 nodeIdx); + + static stDataMultiContainer* create(stDataContainerData* filedata, HeapType destHeap); +}; +static_assert(sizeof(stDataMultiContainer) == 0x14, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_enemy_id_manager.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_enemy_id_manager.h new file mode 100644 index 0000000000..759ba5f003 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_enemy_id_manager.h @@ -0,0 +1,58 @@ +#pragma once + +#include +#include +#include +#include + +class stEnemyIdManager : public utUnCopyable { + soArrayList m_enemyIdArrayList; + u32 m_maxNumEnemmies; + u32 m_numEnemies; +public: + virtual ~stEnemyIdManager(); + + inline bool addEnemyId(u32 createId) { + if (!isFull()) { + m_enemyIdArrayList.push(createId); + m_numEnemies++; + return true; + } + return false; + } + + inline bool removeEnemyId(u32 createId) { + for (u32 i = 0; i < getNumEnemies(); i++) { + if (createId == getEnemyId(i)) { + m_enemyIdArrayList.erase(i); + m_numEnemies--; + return true; + } + } + return false; + } + + inline void removeAll() { + m_enemyIdArrayList.clear(); + m_numEnemies = 0; + } + + inline u32 getEnemyId(u32 index) { + return m_enemyIdArrayList.at(index); + } + + inline u32 getNumEnemies() { + return m_numEnemies; + } + + inline bool isFull() { + return getNumEnemies() >= m_maxNumEnemmies; + } + + static void create(); + static void remove(); + +}; +static_assert(sizeof(stEnemyIdManager) == 0x194, "Class is wrong size!"); + +extern stEnemyIdManager* g_stEnemyIdManager; diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_melee.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_melee.h new file mode 100644 index 0000000000..59874765b8 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_melee.h @@ -0,0 +1,63 @@ +#pragma once + +#include +#include +#include + +class stCollisionWork { + grCollData::VtxData* m_vtxDatas; + grCollData::LineData* m_lineDatas; + grCollData::JointData* m_jointDatas; +public: + u16 m_vtxLen; + bool m_isClosed; + char _0xf; + + void initialize(); +}; +static_assert(sizeof(stCollisionWork) == 0x10, "Class is wrong size!"); + +class stMelee : public stCommonGimmick { +protected: + // 0 + char _spacer[0x10]; + + stTrigger* m_wind2ndTrigger; // +0x1C4 + + grGimmickWindData2nd* m_wind2ndData; // +0x1C8 + + // 0x18 + char _396[0xc]; + +public: + stMelee(char const* name, srStageKind stageKind); + virtual void processBegin(); + virtual void processUpdate(); + virtual void getItemGenPac(gfArchive** archive); + virtual void getFighterStartPos(Vec3f* startPos, int fighterIndex); + virtual void getFighterReStartPos(Vec3f* startPos, int fighterIndex); + virtual bool createWind2ndOnly(); + virtual grGimmickWindData2nd* getWind2ndOnlyData() { return m_wind2ndData; } + virtual void updateWind2ndOnly(); + virtual bool isReStartSamePoint() { return true; } + virtual void update(float deltaFrame); + virtual void setCameraLimitRange(float unk1, float unk2, float unk3, float unk4); // TODO + virtual void resetCameraLimitRange(); // TODO + virtual bool checkChangeScene(); // TODO + virtual void resetChangeScene(); // TODO + virtual void setChangeSceneNumber(s32 n); // TODO + ~stMelee(); + + void zoomInCamera(); + void zoomOutCamera(float, float); + void setPlayerPositionIndexSerial(); + int playSeBasic(SndID id, float p2); + void stopSeBasic(int index, float); + void setSePan(int index, float); + void setGravityHalf(); + void setGravityNormal(); + grCollision* createCollisionSelf(stCollisionWork* collisionWork, Ground* ground, const char*, const char*, u16); + + static bool getPlayerPosition(int playerNo, Vec3f* pos); +}; +static_assert(sizeof(stMelee) == 472, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_positions.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_positions.h new file mode 100644 index 0000000000..1dbac98669 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_positions.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include +#include + +class stPositions { +public: + char _0x8[8]; + nw4r::g3d::ResFileData* m_resFile; + nw4r::g3d::ScnMdlSimple* m_scnMdl; + char _0x10[4]; + Vec3f m_centerPos; + Vec3f m_offsetPos; + short m_0x2c; + char _0x30[38]; + u8 m_itemPosCount; + char _0x55[15]; + + float* getDeadRange(Rect2D* range); + float* getCameraRange(Rect2D* range); + float* getKirifudaPos(u32, Vec3f* pos); + void getCameraCenter(Vec3f* pos); + void loadPositionData(nw4r::g3d::ResFile* resFile); + + +}; +static_assert(sizeof(stPositions) == 100, "Class is wrong size!"); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_result.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_result.h new file mode 100644 index 0000000000..5ff6407a51 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_result.h @@ -0,0 +1,114 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +template +class stClassInfoImpl : public stClassInfo { +public: + stClassInfoImpl() : stClassInfo() { + setClassInfo(Stages::Result, this); + }; + + virtual ~stClassInfoImpl() { + setClassInfo(Stages::Result, 0); + } + + virtual T* create() { + return T::create(); + } + + virtual void preload() { } +}; + +struct unkStruct { + gmCharacterKind _00; + float m_scale; + float m_camY[3]; +}; + +unkStruct fighterResultData[] = { + {Character_SelectNone, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_Mario, 1.0f, 4.2f, 2.8f, 4.8f}, + {Character_Donkey, 1.0f, 8.5f, 9.0f, 7.0f}, + {Character_Link, 1.0f, 6.0f, 7.5f, 7.0f}, + {Character_Samus, 1.015f,8.0f, 3.5f, 8.0f}, + {Character_SZeroSuit, 1.0f, 6.5f, 3.8f, 7.5f}, + {Character_Yoshi, 1.0f, 6.0f, 5.0f, 5.5f}, + {Character_Kirby, 0.98f, 0.8f, 0.8f, 0.8f}, + {Character_Fox, 1.08f, 5.5f, 3.5f, 5.5f}, + {Character_Pikachu, 0.96f, 2.5f, 2.0f, 0.0f}, + {Character_Luigi, 1.0f, 0.0f, 6.0f, 5.0f}, + {Character_Captain, 1.05f, 4.0f, 1.8f, 8.0f}, + {Character_Ness, 1.0f, 5.0f, 5.0f, 4.0f}, + {Character_Koopa, 1.0f, 8.0f, 4.5f,10.0f}, + {Character_Peach, 1.0f, 5.5f, 4.0f, 4.5f}, + {Character_Zelda, 1.0f, 4.5f, 5.0f, 4.0f}, + {Character_Sheik, 1.0f, 6.5f, 6.5f, 3.2f}, + {Character_IceClimber, 1.0f, 5.5f, 3.5f, 3.0f}, + {Character_IceClimber_Popo, 1.0f, 5.5f, 3.5f, 3.0f}, + {Character_IceClimber_Nana, 1.0f, 5.5f, 3.5f, 3.0f}, + {Character_Marth, 1.0f, 7.0f, 6.0f, 6.0f}, + {Character_GameWatch, 1.0f, 4.0f, 3.5f, 6.0f}, + {Character_Falco, 1.05f, 3.0f, 3.0f, 5.5f}, + {Character_Ganon, 1.0f, 6.0f, 9.5f, 8.5f}, + {Character_Wario, 1.0f, 5.0f, 7.5f, 3.5f}, + {Character_MetaKnight, 0.95f, 1.5f, 0.5f, 1.0f}, + {Character_Pit, 1.0f, 1.5f, 7.0f, 4.0f}, + {Character_Pikmin, 0.95f, 2.5f, 1.5f, 3.8f}, + {Character_Lucas, 1.0f, 1.5f, 2.0f, 3.0f}, + {Character_Diddy, 1.0f, 4.0f, 5.8f, 3.0f}, + {Character_Charizard_Trainer, 1.0f, 7.0f, 7.5f, 7.0f}, + {Character_Charizard_Solo, 1.0f, 7.0f, 7.5f, 7.0f}, + {Character_Squirtle_Trainer, 1.03f, 4.5f, 6.5f, 2.0f}, + {Character_Squirtle_Solo, 1.03f, 4.5f, 6.5f, 2.0f}, + {Character_Ivysaur_Trainer, 1.14f, 5.5f, 7.2f, 2.5f}, + {Character_Ivysaur_Solo, 1.14f, 5.5f, 7.2f, 2.5f}, + {Character_Dedede, 0.95f, 7.0f, 7.0f, 6.0f}, + {Character_Lucario, 1.05f, 6.0f, 6.0f, 3.0f}, + {Character_Ike, 1.0f, 7.5f, 7.0f, 2.5f}, + {Character_Robot, 1.0f, 6.3f, 6.0f, 6.0f}, + {Character_Purin, 1.0f, 1.0f, 1.0f, 1.0f}, + {Character_ToonLink, 1.0f, 3.5f, 4.5f, 4.0f}, + {Character_Wolf, 1.25f, 5.0f, 4.5f, 7.0f}, + {Character_Snake, 1.08f, 9.3f, 2.2f, 2.0f}, + {Character_Sonic, 0.97f, 4.5f, 4.5f, 3.5f}, + {Character_GKoopa, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_WarioMan, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_Zako_Boy, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_Zako_Girl, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_Zako_Child, 1.0f, 0.0f, 0.0f, 0.0f}, + {Character_Zako_Ball, 1.0f, 0.0f, 0.0f, 0.0f} +}; + +class stResult : public stMelee { +// void* m_shrineStageData; + Vec3f m_positions[12]; + u32 m_winningCharKind; + u32 m_winAnim; + u8 unk270; + int unkState274; + int unk278; + Vec3f unk27C; + float unk288; + float unk28C; + float m_fighterRot[4]; + float unk2A0; + + public: + stResult(); + virtual ~stResult(); + virtual void createObj(); + virtual bool loading(); + virtual void update(float deltaFrame); + virtual void getFighterStartPos(Vec3f* out, int ftIndex); + virtual bool isReStartSamePoint() { return false; } + static stResult* create(); + static stClassInfoImpl bss_loc_14; +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_shadow.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_shadow.h new file mode 100644 index 0000000000..1bc5bb25b4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_shadow.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include + +class stShadow : public gfTask { + char _0x40[0x24c]; +public: + virtual void renderPre(); + virtual ~stShadow(); + + void clearShadowObject(); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger.h new file mode 100644 index 0000000000..69cef7b8be --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger.h @@ -0,0 +1,82 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class stTrigger : public utListNode { + + Gimmick::AreaKind m_gimmickAreaKind; + int m_id; + stTriggerData::KeepKind m_keepKind : 8; + char _spacer[7]; + stObsTriggerCB* m_obsTriggerCB; + Yakumono* m_yakumono; + char _spacer2[12]; + bool m_isValid; + char _spacer3[3]; + +public: + virtual ~stTrigger(); + + void setObserveYakumono(Yakumono* yakumono); + void setValidCallback(gfCallBack* cb); + stObsTriggerSquareBeltConveyorCB* setBeltConveyorTrigger(grGimmickBeltConveyorData* gimmickAreaData); + stObsTriggerSquareHitPointEffectCB* setHitPointEffectTrigger(grGimmickHitPointEffectData* gimmickAreaData); + stObsTriggerSquareWaterCB* setWaterTrigger(grGimmickWaterData* gimmickAreaData); + stObsTriggerSquareWindCB* setWindTrigger(grGimmickWindData* gimmickAreaData); + + void setAreaSleep(bool); + void setWindParam(grGimmickWindData2nd* wnd, s32 p2); + void setBeltConveyorParam(grGimmickBeltConveyorData* belt); + //void setBeltConveyorParam(grGimmickTriBeltConveyorData* belt); + void setWaterParam(grGimmickWaterData* water); + + +}; +static_assert(sizeof(stTrigger) == 52, "Class is wrong size!"); + +class stTriggerCB : public gfCallBack { +public: + virtual ~stTriggerCB() { + if (dynamic_cast(m_next)) { + stTriggerCB* next = dynamic_cast(m_next); + delete next; + } + } + + void updateBegin() { } + void updateFixPosition() { } + void updateEnd() { } +}; + +class stActTriggerFrameExcelCB : public stTriggerCB { + u8 unk8[0x14]; +public: + stActTriggerFrameExcelCB(grGimmickFrameTriggerData* data); + virtual void userProc(); +}; +static_assert(sizeof(stActTriggerFrameExcelCB) == 0x1C, "Class is the wrong size!"); + +class stTriggerMng : public gfTask { + utList m_triggerList; + char _spacer[24]; + +public: + virtual void processBegin(); + virtual void processFix(); + virtual void processGameProc(); + virtual ~stTriggerMng(); + + stTrigger* createTrigger(Gimmick::AreaKind gimmickKind, int triggerId); + stTrigger* createTrigger(Gimmick::AreaKind gimmickKind, stTriggerData* triggerData); + void setTriggerFlag(stTriggerData* triggerData); + bool getTriggerFlag(stTriggerData* triggerData, bool defaultFlag); +}; +static_assert(sizeof(stTriggerMng) == 100, "Class is wrong size!"); + +extern stTriggerMng* g_stTriggerMng; diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger_observe.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger_observe.h new file mode 100644 index 0000000000..1003d19943 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_trigger_observe.h @@ -0,0 +1,287 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace Gimmick { + enum AreaKind { + Area_None = 0x0, + Area_RebirthPoint = 0x5, + Area_Reactor = 0x6, + Area_Camera = 0x7, + Area_Sound = 0xb, + Area_Wind = 0xc, + Area_Wind_2nd = 0xd, + Area_BeltConveyor = 0xe, + Area_Yuka = 0xf, + Area_Pow = 0x10, + Area_Water = 0x11, + Area_HitPoint_Effect = 0x12, + Area_ScrollLock = 0x15, + Area_Common = 0x1e, + Area_Barrel_Natural = 0x1f, + Area_Barrel_Path = 0x20, + Area_Barrel_Natural_Auto = 0x21, + Area_Barrel_Path_Auto = 0x22, + Area_Spring = 0x23, + Area_Catapult = 0x24, + Area_Ladder = 0x25, + Area_Door = 0x28, + Area_Door_Air = 0x29, + Area_Door_Auto = 0x2a, + Area_Block = 0x2b, + Area_Warp = 0x2c, + Area_SavePoint = 0x2d, + Area_Peripheral_Lock = 0x2f, + Area_MotionPath = 0x32, + Area_Elevator = 0x35, + Area_Truck = 0x3a, + Area_Truck_Running = 0x3b, + + // alternate names + Area_Barrel_Static = 0x1f, + Area_Barrel_Static_Auto = 0x21, + }; +} + +struct stTriggerData { + enum KeepKind { + Keep_None = 0x0, + Keep_Stage = 0x1, + Keep_Global = 0x2 + }; + + unsigned short m_triggerId; + int _padding : 7; + bool m_isValid : 1; + KeepKind m_keepKind : 8; + + inline stTriggerData() {} + inline stTriggerData(KeepKind keepKind) : m_keepKind(keepKind) {} + inline stTriggerData(u16 triggerId, bool isValid, KeepKind keepKind) : m_triggerId(triggerId), _padding(0), m_isValid(isValid), m_keepKind(keepKind) {} + + inline void set(u16 triggerId, bool isValid, KeepKind keepKind) { + m_triggerId = triggerId; + _padding = 0; + m_isValid = isValid; + m_keepKind = keepKind; + } +}; +static_assert(sizeof(stTriggerData) == 4, "Class is wrong size!"); + +struct stSimpleAreaData { + bool m_useTwoBoundingPoints; + char _1[3]; + Vec2f m_pos1; + Vec2f m_pos2; +}; + +struct grAdventureTruckReactorData : public stSimpleAreaData { + stTriggerData m_triggerData; +}; +static_assert(sizeof(grAdventureTruckReactorData) == 24, "Class is wrong size!"); + +struct stGimmickAreaData { + gfArea::ShapeType m_shapeType; + gfArea::Group m_group; + int m_checkTargetGroup; + int m_checkTargetLocalGroup; + short m_16; + short m_18; + char _20[4]; + Vec2f m_offsetPos; + Vec2f m_range; + + inline void set(Vec2f* areaPos, Vec2f* areaRange) { + m_offsetPos = *areaPos; + m_range = *areaRange; + } + + inline void set(Vec2f* areaPos, Vec2f* areaRange, gfArea::ShapeType shapeType) { + m_offsetPos = *areaPos; + m_range = *areaRange; + m_shapeType = shapeType; + } +}; + +struct grGimmickBeltConveyorData { + stGimmickAreaData m_areaData; + Vec3f m_pos; + float m_speed; + bool m_isRight; + char _spacer[3]; + stTriggerData m_isValidTriggerData; + + inline grGimmickBeltConveyorData() { + + }; + + inline grGimmickBeltConveyorData(Vec3f* pos, float speed, bool isRight, Vec2f* areaPos, Vec2f* areaRange, gfArea::ShapeType shapeType) { + initialize(pos, speed, isRight, areaPos, areaRange, shapeType); + }; + + inline void initialize(Vec3f* pos, float speed, bool isRight, Vec2f* areaPos, Vec2f* areaRange, gfArea::ShapeType shapeType) { + MEMINIT(this); + m_pos = *pos; + m_speed = speed; + m_isRight = isRight; + m_areaData.set(areaPos, areaRange, shapeType); + }; +}; +static_assert(sizeof(grGimmickBeltConveyorData) == 64, "Class is wrong size!"); + +struct grGimmickWaterData { + stGimmickAreaData m_areaData; + float m_swimHeight; + bool m_canDrown; + char _45[3]; + float m_speed; + char m_52[4]; + + inline grGimmickWaterData() { + + }; + + inline grGimmickWaterData(float swimHeight, bool canDrown, float currentSpeed, Vec2f* areaPos, Vec2f* areaRange) { + initialize(swimHeight, canDrown, currentSpeed, areaPos, areaRange); + }; + + inline void initialize(float swimHeight, bool canDrown, float currentSpeed, Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_swimHeight = swimHeight; + m_canDrown = canDrown; + m_speed = currentSpeed; + m_areaData.set(areaPos, areaRange); + }; + +}; +static_assert(sizeof(grGimmickWaterData) == 56, "Class is wrong size!"); + +struct grGimmickWindData { + stGimmickAreaData m_areaData; + Vec3f m_pos; + float m_speed; + float m_vector; + stTriggerData m_isValidTriggerData; + + inline grGimmickWindData() { + + }; + + inline grGimmickWindData(Vec3f* pos, float speed, float vector, Vec2f* areaPos, Vec2f* areaRange) { + initialize(pos, speed, vector, areaPos, areaRange); + }; + + inline void initialize(Vec3f* pos, float speed, float vector, Vec2f* areaPos, Vec2f* areaRange) { + MEMINIT(this); + m_pos = *pos; + m_speed = speed; + m_vector = vector; + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickWindData) == 64, "Class is wrong size!"); + +struct grGimmickWindData2nd { + stGimmickAreaData m_areaData; + Vec3f m_pos; + float m_speed; + float m_vector; + float m_60; + float m_64; + float m_68; + u32 m_72; +}; +static_assert(sizeof(grGimmickWindData2nd) == 76, "Class is wrong size!"); + +struct grGimmickHitPointEffectData { + stGimmickAreaData m_areaData; + u8 m_damage; + bool m_isHeal; + short m_serialHitFrame; + stTriggerData m_isValidTriggerData; + + inline grGimmickHitPointEffectData() { + + }; + + inline grGimmickHitPointEffectData(float damage, bool isHeal, short serialHitFrame, Vec2f *areaPos, Vec2f *areaRange) { + initialize(damage, isHeal, serialHitFrame, areaPos, areaRange); + }; + + inline void initialize(float damage, bool isHeal, short serialHitFrame, Vec2f *areaPos, Vec2f *areaRange) { + MEMINIT(this); + m_damage = damage; + m_isHeal = isHeal; + m_serialHitFrame = serialHitFrame; + m_areaData.set(areaPos, areaRange); + }; +}; +static_assert(sizeof(grGimmickHitPointEffectData) == 48, "Class is wrong size!"); + +struct grGimmickFrameTriggerData { + Vec3f unk0; + stTriggerData unkC; + stTriggerData unk10; + u8 unk14[0x8]; +}; +static_assert(sizeof(grGimmickFrameTriggerData) == 0x1C, "Class is the wrong size!"); + +class stObsTriggerCB : public gfCallBack { + + char _spacer[8]; + + virtual ~stObsTriggerCB(); + virtual gfArea* getAreaPointer(); + virtual bool getAreaID(int* areaID); + virtual void setAreaSleep(bool isSleep); +}; + +class stObsTriggerArea : public stObsTriggerCB { + + gfArea* m_area; + stGimmickAreaData m_gimmickAreaData; + + virtual void userProc(); + virtual ~stObsTriggerArea(); + virtual gfArea* getAreaPointer(); + virtual bool getAreaID(int* areaID); + virtual void setAreaSleep(bool isSleep); + virtual stGimmickAreaData* getAreaDataPointer(); + virtual void setArea(gfArea* area); + + void setDefaultGimmickAreaData(stSimpleAreaData* simpleAreaData, stGimmickAreaData* gimmickAreaData); +}; + +class stObsTriggerSquareHitPointEffectCB : public stObsTriggerArea { + int m_hitPointEffectIndex; + + virtual ~stObsTriggerSquareHitPointEffectCB(); + +}; +static_assert(sizeof(stObsTriggerSquareHitPointEffectCB) == 0x40, "Class is wrong size!"); + +class stObsTriggerSquareBeltConveyorCB : public stObsTriggerArea { + int m_beltConveyorIndex; + + virtual ~stObsTriggerSquareBeltConveyorCB(); +}; +static_assert(sizeof(stObsTriggerSquareBeltConveyorCB) == 0x40, "Class is wrong size!"); + +class stObsTriggerSquareWaterCB : public stObsTriggerArea { + int m_waterIndex; + + virtual ~stObsTriggerSquareWaterCB(); +}; +static_assert(sizeof(stObsTriggerSquareWaterCB) == 0x40, "Class is wrong size!"); + +class stObsTriggerSquareWindCB : public stObsTriggerArea { + int m_windIndex; + + virtual ~stObsTriggerSquareWindCB(); +}; +static_assert(sizeof(stObsTriggerSquareWindCB) == 0x40, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/st_utility.h b/include/lib/BrawlHeaders/Brawl/Include/st/st_utility.h new file mode 100644 index 0000000000..60831ac445 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/st_utility.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include +#include +#include + +bool stRayCheck(Vec3f* pos, Vec3f* dir, bool, grCollision*, bool, u8 targetMask); +bool stRayCheck(Vec3f* pos, Vec3f* dir, Vec3f* outHitPos, Vec3f* outCollNormalVec, bool, grCollision*, bool, u8 targetMask); +bool stRayCheck(Vec3f* pos, Vec3f* dir, int* lineId, Vec3f* outHitPos, Vec3f* outCollNormalVec, bool, bool, u8 targetMask); + diff --git a/include/lib/BrawlHeaders/Brawl/Include/st/stage.h b/include/lib/BrawlHeaders/Brawl/Include/st/stage.h new file mode 100644 index 0000000000..554bf3453d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/st/stage.h @@ -0,0 +1,708 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct stGameFrame { + float m_frameDelta; + bool m_isJust; + char _[3]; +}; + +extern stGameFrame g_stGameFrame; + +class stParam { // STPM +public: + u8 m_echo; + u8 m_id1; + u8 m_id2; + char _3; + float _4; + float _8; + float _12; + float _16; + u8 m_bgmVolume; + u8 m_sfxVolume; + char _22; + char _23; + float m_shadowPitch; + float m_shadowYaw; + char _26[8]; + float m_camFOV; + float m_camMinZ; + float m_camMaxZ; + float m_camMinTilt; + float m_camMaxTilt; + float m_camHorizontalRotationFactor; + float m_camVerticalRotationFactor; + float m_fighterBubbleBufferMultiplier; + float _72; + float m_cameraSpeed; + float m_starKOCamTilt; + float m_finalSmashCamTilt; + float m_camRight; + float m_camLeft; + Vec3f m_pauseCamCenterPos; + float m_pauseCamAngle; + float m_pauseCamZoomIn; + float m_pauseCamZoomDefault; + float m_pauseCamZoomOut; + float m_pauseCamRotYMin; + float m_pauseCamRotYMax; + float m_pauseCamRotXMin; + float m_pauseCamRotXMax; + Vec3f m_fixedCamCenterPos; + float m_fixedCamFOV; + float m_fixedHorizontalAngle; + float m_fixedVerticalAngle; + char _164[4]; + float m_olimarFinalCamAngle; + Vec3f m_iceClimbersFinalPos; + Vec2f m_iceClimbersFinalScale; + Vec2f m_pitFinalPalutenaScale; + u8 m_kirifudaModelType; + bool m_characterWindEnabled; + char _202[2]; + float m_windStrength; + float m_horizontalWindRotation; + float m_verticalWindRotation; + float _216; + GXColor _220; + char _224[4]; + bool _228; + bool _229; + u8 m_effectVol; + u8 m_reverbLPF; + u8 m_reverbType; + u8 m_reverbColoration; + u8 m_reverbDamping; + u8 m_reverbPreDelay; + u8 m_reverbBalance; + u8 m_delayFeedback; + u8 m_delayOutput; + char _239; + s16 m_reverbTime; + u16 m_delayTime; + char _244[16]; +}; +static_assert(sizeof(stParam) == 260, "Class is wrong size!"); + +struct stDestroyBossParamCommon { + char _[0x18]; +}; +static_assert(sizeof(stDestroyBossParamCommon) == 0x18, "Class is wrong size!"); + +class Stage; +extern Stage* g_Stage; +class Stage : public gfTask { +public: + // 0 + u32 unk40; + // 4 + srStageKind m_stageKind; + // 8 + char _spacer1[0x10]; + // 18 + Rect2D m_deadRange; + // 28 + Rect2D m_aiRange; + // 38 + cmStageParam* m_cameraParam1; + // 3c + char _3c[0x4]; + // 40 + cmStageParam* m_cameraParam2; + // 44 + char _spacer2[4]; + // 48 + Ground* m_headGround; + // 4c + void* m_collConv; + // 50 + stPositions* m_stagePositions; + // 54 + char _spacer3[4]; + // 58 + stParam* m_stageParam; + // 5C + void* m_stageData; + // 60 + stTriggerMng* m_triggerMng; + // 64 + char _spacer4[0x18]; + // 7C + Vec3f* m_pokeTrainerPos; + // 80 + u8 m_pokeTrainerPosIndex; + // 81 + u8 m_pokeTrainerPosCount; + // 82 + u8 m_pokeTrainerPosType; + // 83 + char _0x83[1]; + // 84 + stShadow* m_shadow; + // 88 + float _0x88[6]; + // A0 + char _0xA0[11]; + // AB + bool m_isDevil; + // AC + Vec2f m_devilOffset; + // B4 + char _0xB4[4]; + // B8 + char collisionAttrs[0xC]; + // C4 + gfArchive m_itemSheetArchive; + // 144 + bool m_unk2; + // 145 + char _spacer6[3]; + // 148 + u32 m_unk3; + // 14C + float m_unk4; + // 150 + float m_frameRuleTime; + // 154 + u32 unk194; + // 158 + char _spacer7[0x8]; + // TOTAL_SIZE == 0x160 + + void testStageParamInit(gfArchive* archive, int fileIndex); + void testCollDataInit(gfArchive* archive, grCollData* collData, u32 index); + void setCollision(grCollision* coll); + void stageParamChange(); + void testStageDataInit(gfArchive* archive, int fileIndex, int unk2); + void initSoundParameters(); + void setSoundParameters(stParam* stpm); + void addGround(Ground* Ground); + Ground* getGround(int index); + u32 getGroundNum(); + grCollision* createCollision(gfArchive* archive, int index, Ground* ground); + void createStagePositions(); + void createStagePositions(nw4r::g3d::ResFile* resFile); + void loadStageAttrParam(gfArchive* filedata, int fileIndex); + void registScnAnim(nw4r::g3d::ResFileData* scnData, u32 index); + void initPosPokeTrainer(int unk1, int unk2); + void setStageAttackData(grGimmickDamageFloor* attackData, u32 index); + void removeGround(Ground*); + bool isPokemonTrainer(); + + Stage(const char* name, srStageKind stageKind); + virtual void processBegin(); + virtual void processAnim(); + virtual void processUpdate(); + virtual void processMapCorrection(); + virtual void processFixCamera(); + virtual void processEnd(); + virtual void renderPre(); + virtual void renderDebug(); + virtual ~Stage(); + + virtual void createObj(); + virtual void createObjPokeTrainer(gfArchive* filedata, int fileindex, const char* name, Vec3f* pokeTrainerPos, Vec3f* unk2); + virtual int getPokeTrainerPointNum() { return 0; } + virtual void getPokeTrainerPointData(int* unk1, int unk2) {} + virtual float getPokeTrainerPositionZ() { return 0.0f; } + virtual int getPokeTrainerDrawLayer() { return 0; } + virtual bool isAdventureStage() { return false; } +#ifdef MATCHING + virtual void getItemPac(gfArchive** brres, gfArchive** param, itKind itemID, int variantID); +#else + virtual void getItemPac(gfArchive** brres, gfArchive** param, itKind itemID, int variantID, gfArchive** commonParam = NULL, itCustomizerInterface** customizer = NULL); // Note: Optional parameters for modding purposes to use custom itmParams and customizers +#endif + virtual void getItemGenPac(gfArchive** archive); + virtual void getItemPacEnemyFigure(gfArchive** archive); + virtual void getEnemyPac(gfArchive** brres, gfArchive** param, gfArchive** enmCommon, gfArchive** primFaceBrres, EnemyKind enemyKind); + virtual void getAdvRadarData(gfArchive**, gfArchive**); + virtual void initializeStage(); + virtual void closeStage(); + virtual void renderDebugPositions(); + virtual bool loading(); + virtual void process(); + virtual void updateStagePositions(); + virtual void debugCollision(); + virtual Rect2D* getAIRange() { return &m_aiRange; } + virtual int getDefaultLightSetIndex() { return 0x14; } + virtual int getZoneLightSetIndex(); + virtual int getScrollDir(Vec3f* unk1) + { + unk1->m_x = 0.0f; + unk1->m_y = 0.0f; + unk1->m_z = 0.0f; + return 0; + } + virtual void clearCameraParam(); + virtual void initCameraParam(); + virtual void startLoadLocalData(); + virtual bool isLoadLocalData(); + virtual int entryLocalData(); + virtual void removeLocalData(); + virtual void appearanceFighterLocal() {} + virtual void getFighterStartPos(Vec3f* startPos, int fighterIndex); + virtual void getFighterReStartPos(Vec3f* startPos, int fighterIndex); + virtual bool isReStartSamePoint(); + virtual void getPokeTrainerStartPos(Vec3f* pos, u32); + virtual u8 getItemPosCount(); + virtual void getItemPos(Vec3f*, Vec3f*, u32 index); + virtual void getRandItemPos(Vec3f* pos); + virtual void getKirifudaPos(Vec3f* pos, u32); + virtual float getKirifudaAngle(u32); + virtual void getKirifudaScale(Vec3f* scale, u32); + virtual u8 getKirifudaModelType(u32); + virtual u8 getPokeTrainerPosCount(); + virtual void getPokeTrainerPos(Vec3f*, Vec3f*, u32 index); + virtual float getFighterDeadEffectSizeRate(); + virtual float getEnemyDeadEffectSizeRate(); + virtual float getEnableZ(); + virtual int getBgmID() { return 0; } + virtual int getBgmID() const { return 0; } + virtual int getNowStepBgmID() { return 0; } + virtual int getBgmOptionID() { return 0; } + virtual bool isBgmChange() { return m_unk2; } + virtual void getBgmChangeID(u32* unk1, float* unk2) + { + *unk1 = m_unk3; + *unk2 = m_unk4; + } + virtual void setBgmChange(float unk1, bool unk2, u32 unk3) + { + m_unk2 = unk2; + m_unk3 = unk3; + m_unk4 = unk1; + } + virtual float getBgmVolume() { return 1.0f; } + virtual float getBgmPlayOffsetFrame() { return 0.0f; } + virtual bool isNextStepBgmEqualNowStepBgmFromFlag() { return false; } + virtual void setFrameRuleTime(float unk1) { m_frameRuleTime = unk1; } + virtual float getFrameRuleTime() { return m_frameRuleTime; } + virtual void notifyTimmingGameStart() {} + virtual bool isEnd(); + virtual bool isEventEnd(int param1, int* eventState, int* eventDecision); + virtual void enableDevil(); + virtual void disableDevil(); + virtual bool isDevil(); + virtual void setDevilScrool(float x, float y); + virtual void getLucarioFinalTechniquePosition(Vec3f* pos); + virtual bool startAppear(); // TODO + virtual void setAppearKind(u8 kind); // TODO + virtual void endAppear(); // TODO + virtual IfSmashAppearTask* getAppearTask(); // TODO + virtual void forceStopAppear(); // TODO + virtual GXColor getFinalTechniqColor(); + virtual void setMotionRatio(float unk1, float unk2); // TODO + virtual void saveMotionRatio(int unk1); // TODO + virtual void restoreMotionRatio(int unk1); // TODO + virtual void setMotionSubRatio(float unk1, float unk2); // TODO + virtual void saveMotionSubRatio(int unk1); // TODO + virtual void restoreMotionSubRatio(int unk1); // TODO + virtual bool isCameraLocked() { return true; } + virtual bool isBossBattleMode() { return false; } + virtual bool isSimpleBossBattleMode() { return false; } + virtual bool isAppear(); // TODO + virtual bool isStartAppearTimming(); // TODO + virtual void* getMadeinAiData(); // TODO + virtual bool isBamperVector(); // TODO + virtual void getBamperVector(Vec3f*); + virtual void notifyEventInfoReady(); // TODO + virtual void notifyEventInfoGo(); // TODO +#ifdef MATCHING + virtual stDestroyBossParamCommon getDestroyBossParamCommon(u32); +#else + virtual stDestroyBossParamCommon getDestroyBossParamCommon(u32, int enemyCreateId = -1, int enemyMessageKind = -1); +#endif + virtual void stAdventureEventGetItem(int entryId, itKind kind, int itVariation, int genParamId, int instanceId); + virtual void setStageOutEffectInit(); // TODO + virtual void setStageInEffectInit(); // TODO + virtual int helperStarWarp() { return 0; } + virtual int initializeFighterAttackRatio() { return 0; } + virtual void startFighterEvent() {} + virtual int getZoneState(); // TODO + virtual void getZonePos(Vec3f* pos); + virtual float getMagmaHeight(); // TODO + virtual float getAcidHeight(); // TODO + virtual u8 getIteamDropStatus(); + virtual bool createWind2ndOnly(); + virtual grGimmickWindData2nd* getWind2ndOnlyData(); // TODO + virtual void updateWind2ndOnly(); + virtual void setVision(u8); + + inline static Stage* getInstance() { return g_Stage; } +}; + + +ENUM_U32(ArchiveOverrideSetting, + Archive_Override_None = 0x0, + Archive_Override_Brres = 0x1, + Archive_Override_Param = 0x2, + Archive_Override_Both = 0x3, +); + +struct ItemOverride { // Custom Misc Data node + char _header[4]; + char m_itmOverrideName[12]; + char m_pkmOverrideName[12]; + s8 m_pokemonOverload; + ArchiveOverrideSetting m_overrideCommon : 8; + ArchiveOverrideSetting m_overrideTorchic : 8; + ArchiveOverrideSetting m_overrideCelebi : 8; + ArchiveOverrideSetting m_overrideChikorita : 8; + ArchiveOverrideSetting m_overrideChikoritaShot : 8; + ArchiveOverrideSetting m_overrideEntei : 8; + ArchiveOverrideSetting m_overrideMoltres : 8; + ArchiveOverrideSetting m_overrideMunchlax : 8; + ArchiveOverrideSetting m_overrideDeoxys : 8; + ArchiveOverrideSetting m_overrideGroudon : 8; + ArchiveOverrideSetting m_overrideGulpin : 8; + ArchiveOverrideSetting m_overrideStaryu: 8; + ArchiveOverrideSetting m_overrideStaryuShot : 8; + ArchiveOverrideSetting m_overrideHoOh : 8; + ArchiveOverrideSetting m_overrideHoOhShot : 8; + ArchiveOverrideSetting m_overrideJirachi : 8; + ArchiveOverrideSetting m_overrideSnorlax : 8; + ArchiveOverrideSetting m_overrideBellosom : 8; + ArchiveOverrideSetting m_overrideKyogre : 8; + ArchiveOverrideSetting m_overrideKyogreShot : 8; + ArchiveOverrideSetting m_overrideLatiasLatios : 8; + ArchiveOverrideSetting m_overrideLugia : 8; + ArchiveOverrideSetting m_overrideLugiaShot : 8; + ArchiveOverrideSetting m_overrideManaphy : 8; + ArchiveOverrideSetting m_overrideWeavile : 8; + ArchiveOverrideSetting m_overrideElectrode : 8; + ArchiveOverrideSetting m_overrideMetagross : 8; + ArchiveOverrideSetting m_overrideMew : 8; + ArchiveOverrideSetting m_overrideMeowth : 8; + ArchiveOverrideSetting m_overrideMeowthShot : 8; + ArchiveOverrideSetting m_overridePiplup : 8; + ArchiveOverrideSetting m_overrideTogepi : 8; + ArchiveOverrideSetting m_overrideGoldeen : 8; + ArchiveOverrideSetting m_overrideGardevoir : 8; + ArchiveOverrideSetting m_overrideWobbuffet : 8; + ArchiveOverrideSetting m_overrideSuicune : 8; + ArchiveOverrideSetting m_overrideBonsly : 8; + ArchiveOverrideSetting m_overrideAndross : 8; + ArchiveOverrideSetting m_overrideAndrossShot : 8; + ArchiveOverrideSetting m_overrideBarbara : 8; + ArchiveOverrideSetting m_overrideGrayFox : 8; + ArchiveOverrideSetting m_overrideRayMKII : 8; + ArchiveOverrideSetting m_overrideRayMKIIBomb : 8; + ArchiveOverrideSetting m_overrideRayMKIIGun : 8; + ArchiveOverrideSetting m_overrideSamuraiGoroh : 8; + ArchiveOverrideSetting m_overrideDevil : 8; + ArchiveOverrideSetting m_overrideExcitebike : 8; + ArchiveOverrideSetting m_overrideJeff : 8; + ArchiveOverrideSetting m_overrideJeffPencilBullet : 8; + ArchiveOverrideSetting m_overrideJeffPencilRocket : 8; + ArchiveOverrideSetting m_overrideLakitu : 8; + ArchiveOverrideSetting m_overrideKnuckleJoe : 8; + ArchiveOverrideSetting m_overrideKnuckleJoeShot : 8; + ArchiveOverrideSetting m_overrideHammerBro : 8; + ArchiveOverrideSetting m_overrideHammerBroHammer : 8; + ArchiveOverrideSetting m_overrideHelirin : 8; + ArchiveOverrideSetting m_overrideKat : 8; + ArchiveOverrideSetting m_overrideAna : 8; + ArchiveOverrideSetting m_overrideJillDozer : 8; + ArchiveOverrideSetting m_overrideLyn : 8; + ArchiveOverrideSetting m_overrideLittleMac : 8; + ArchiveOverrideSetting m_overrideMetroid : 8; + ArchiveOverrideSetting m_overrideNintendog : 8; + ArchiveOverrideSetting m_overrideNintendogFull : 8; + ArchiveOverrideSetting m_overrideMrResetti : 8; + ArchiveOverrideSetting m_overrideIsaac : 8; + ArchiveOverrideSetting m_overrideIsaacShot : 8; + ArchiveOverrideSetting m_overrideSaki : 8; + ArchiveOverrideSetting m_overrideSakiShot1 : 8; + ArchiveOverrideSetting m_overrideSakiShot2 : 8; + ArchiveOverrideSetting m_overrideShadow : 8; + ArchiveOverrideSetting m_overrideWarInfantry : 8; + ArchiveOverrideSetting m_overrideWarInfantryShot : 8; + ArchiveOverrideSetting m_overrideStarfy : 8; + ArchiveOverrideSetting m_overrideWarTank : 8; + ArchiveOverrideSetting m_overrideWarTankShot : 8; + ArchiveOverrideSetting m_overrideTingle : 8; + ArchiveOverrideSetting m_overrideLakituSpiny : 8; + ArchiveOverrideSetting m_overrideWaluigi : 8; + ArchiveOverrideSetting m_overrideDrWright : 8; + ArchiveOverrideSetting m_overrideDrWrightBuilding : 8; + char m_stageItemFolder[12]; +}; + +struct EnemyOverride { // Custom Misc Data node + char _header[4]; + char m_enmOverrideFolder[12]; + char m_stageItemFolder[12]; + + // HeapType instanceHeapType + // HeapType resourceHeapType + + char _ : 4; + bool m_useIndividualFolders : 1; // for Primids/Glire/Gamygabase + bool m_overrideModuleCommon : 1; + ArchiveOverrideSetting m_overrideCommon : 2; + + u8 m_faceIndexGoomba : 5; + bool m_overrideModuleGoomba : 1; + ArchiveOverrideSetting m_overrideGoomba : 2; + + u8 m_faceIndexPoppant : 5; + bool m_overrideModulePoppant : 1; + ArchiveOverrideSetting m_overridePoppant : 2; + + u8 m_faceIndexFeyesh : 5; + bool m_overrideModuleFeyesh : 1; + ArchiveOverrideSetting m_overrideFeyesh : 2; + + u8 m_faceIndexJyk : 5; + bool m_overrideModuleJyk : 1; + ArchiveOverrideSetting m_overrideJyk : 2; + + u8 m_faceIndexAuroros : 5; + bool m_overrideModuleAuroros : 1; + ArchiveOverrideSetting m_overrideAuroros : 2; + + u8 m_faceIndexCymul : 5; + bool m_overrideModuleCymul : 1; + ArchiveOverrideSetting m_overrideCymul : 2; + + u8 m_faceIndexRoturret : 5; + bool m_overrideModuleRoturret : 1; + ArchiveOverrideSetting m_overrideRoturret : 2; + + u8 m_faceIndexBorboras : 5; + bool m_overrideModuleBorboras : 1; + ArchiveOverrideSetting m_overrideBorboras : 2; + + u8 m_faceIndexGiantGoomba : 5; + bool m_overrideModuleGiantGoomba : 1; + ArchiveOverrideSetting m_overrideGiantGoomba : 2; + + u8 m_faceIndexBuckot : 5; + bool m_overrideModuleBuckot : 1; + ArchiveOverrideSetting m_overrideBuckot : 2; + + u8 m_faceIndexBucculus : 5; + bool m_overrideModuleBucculus : 1; + ArchiveOverrideSetting m_overrideBucculus : 2; + + u8 m_faceIndexGreap : 5; + bool m_overrideModuleGreap : 1; + ArchiveOverrideSetting m_overrideGreap : 2; + + u8 m_faceIndexArmight : 5; + bool m_overrideModuleArmight : 1; + ArchiveOverrideSetting m_overrideArmight : 2; + + u8 m_faceIndexBulletBill : 5; + bool m_overrideModuleBulletBill : 1; + ArchiveOverrideSetting m_overrideBulletBill : 2; + + u8 m_faceIndexRoader : 5; + bool m_overrideModuleRoader : 1; + ArchiveOverrideSetting m_overrideRoader : 2; + + u8 m_faceIndexSpaak : 5; + bool m_overrideModuleSpaak : 1; + ArchiveOverrideSetting m_overrideSpaak : 2; + + u8 m_faceIndexMite : 5; + bool m_overrideModuleMite : 1; + ArchiveOverrideSetting m_overrideMite : 2; + + u8 m_faceIndexTicken : 5; + bool m_overrideModuleTicken : 1; + ArchiveOverrideSetting m_overrideTicken : 2; + + u8 m_faceIndexTowtow : 5; + bool m_overrideModuleTowtow : 1; + ArchiveOverrideSetting m_overrideTowtow : 2; + + u8 m_faceIndexHammerBro : 5; + bool m_overrideModuleHammerBro : 1; + ArchiveOverrideSetting m_overrideHammerBro : 2; + + u8 m_faceIndexBytan : 5; + bool m_overrideModuleBytan : 1; + ArchiveOverrideSetting m_overrideBytan : 2; + + u8 m_faceIndexFloow : 5; + bool m_overrideModuleFloow : 1; + ArchiveOverrideSetting m_overrideFloow : 2; + + u8 m_faceIndexPuppit : 5; + bool m_overrideModulePuppit : 1; + ArchiveOverrideSetting m_overridePuppit : 2; + + u8 m_faceIndexPrimid : 5; + bool m_overrideModulePrimid : 1; + ArchiveOverrideSetting m_overridePrimid : 2; + + u8 m_faceIndexShellpod : 5; + bool m_overrideModuleShellpod : 1; + ArchiveOverrideSetting m_overrideShellpod : 2; + + u8 m_faceIndexKoopa : 5; + bool m_overrideModuleKoopa : 1; + ArchiveOverrideSetting m_overrideKoopa : 2; + + u8 m_faceIndexShaydas : 5; + bool m_overrideModuleShaydas : 1; + ArchiveOverrideSetting m_overrideShaydas : 2; + + u8 m_faceIndexBombed : 5; + bool m_overrideModuleBombed : 1; + ArchiveOverrideSetting m_overrideBombed : 2; + + u8 m_faceIndexPrimidMetal : 5; + bool m_overrideModulePrimidMetal : 1; + ArchiveOverrideSetting m_overridePrimidMetal : 2; + + u8 m_faceIndexNagagog : 5; + bool m_overrideModuleNagagog : 1; + ArchiveOverrideSetting m_overrideNagagog : 2; + + u8 m_faceIndexTrowlon : 5; + bool m_overrideModuleTrowlon : 1; + ArchiveOverrideSetting m_overrideTrowlon : 2; + + u8 m_faceIndexPrimidBig : 5; + bool m_overrideModulePrimidBig : 1; + ArchiveOverrideSetting m_overridePrimidBig : 2; + + u8 m_faceIndexPrimidBoom : 5; + bool m_overrideModulePrimidBoom : 1; + ArchiveOverrideSetting m_overridePrimidBoom : 2; + + u8 m_faceIndexPrimidFire : 5; + bool m_overrideModulePrimidFire : 1; + ArchiveOverrideSetting m_overridePrimidFire : 2; + + u8 m_faceIndexPrimidScope : 5; + bool m_overrideModulePrimidScope : 1; + ArchiveOverrideSetting m_overridePrimidScope : 2; + + u8 m_faceIndexPrimidSword : 5; + bool m_overrideModulePrimidSword : 1; + ArchiveOverrideSetting m_overridePrimidSword : 2; + + u8 m_faceIndexGamyga : 5; + bool m_overrideModuleGamyga : 1; + ArchiveOverrideSetting m_overrideGamyga : 2; + + u8 m_faceIndexROBBlaster : 5; + bool m_overrideModuleROBBlaster : 1; + ArchiveOverrideSetting m_overrideROBBlaster : 2; + + u8 m_faceIndexROBDistance : 5; + bool m_overrideModuleROBDistance : 1; + ArchiveOverrideSetting m_overrideROBDistance : 2; + + u8 m_faceIndexROBLauncher : 5; + bool m_overrideModuleROBLauncher : 1; + ArchiveOverrideSetting m_overrideROBLauncher : 2; + + u8 m_faceIndexROBSentry : 5; + bool m_overrideModuleROBSentry : 1; + ArchiveOverrideSetting m_overrideROBSentry : 2; + + u8 m_faceIndexAutolance : 5; + bool m_overrideModuleAutolance : 1; + ArchiveOverrideSetting m_overrideAutolance : 2; + + u8 m_faceIndexArmank : 5; + bool m_overrideModuleArmank : 1; + ArchiveOverrideSetting m_overrideArmank : 2; + + u8 m_faceIndexGlire : 5; + bool m_overrideModuleGlire : 1; + ArchiveOverrideSetting m_overrideGlire : 2; + + u8 m_faceIndexGlice : 5; + bool m_overrideModuleGlice : 1; + ArchiveOverrideSetting m_overrideGlice : 2; + + u8 m_faceIndexGlunder : 5; + bool m_overrideModuleGlunder : 1; + ArchiveOverrideSetting m_overrideGlunder : 2; + + u8 m_faceIndexPeteyPiranha : 5; + bool m_overrideModulePeteyPiranha : 1; + ArchiveOverrideSetting m_overridePeteyPiranha : 2; + + u8 m_faceIndexGamygaBase01 : 5; + bool m_overrideModuleGamygaBase01 : 1; + ArchiveOverrideSetting m_overrideGamygaBase01 : 2; + + u8 m_faceIndexGamygaBase02 : 5; + bool m_overrideModuleGamygaBase02 : 1; + ArchiveOverrideSetting m_overrideGamygaBase02 : 2; + + u8 m_faceIndexGamygaBase03 : 5; + bool m_overrideModuleGamygaBase03 : 1; + ArchiveOverrideSetting m_overrideGamygaBase03 : 2; + + u8 m_faceIndexGamygaBase04 : 5; + bool m_overrideModuleGamygaBase04 : 1; + ArchiveOverrideSetting m_overrideGamygaBase04 : 2; + + u8 m_faceIndexGalleom : 5; + bool m_overrideModuleGalleom : 1; + ArchiveOverrideSetting m_overrideGalleom : 2; + + u8 m_faceIndexRidley : 5; + bool m_overrideModuleRidley : 1; + ArchiveOverrideSetting m_overrideRidley : 2; + + u8 m_faceIndexRayquaza : 5; + bool m_overrideModuleRayquaza : 1; + ArchiveOverrideSetting m_overrideRayquaza : 2; + + u8 m_faceIndexDuon : 5; + bool m_overrideModuleDuon : 1; + ArchiveOverrideSetting m_overrideDuon : 2; + + u8 m_faceIndexPorky : 5; + bool m_overrideModulePorky : 1; + ArchiveOverrideSetting m_overridePorky : 2; + + u8 m_faceIndexMetaRidley : 5; + bool m_overrideModuleMetaRidley : 1; + ArchiveOverrideSetting m_overrideMetaRidley : 2; + + u8 m_faceIndexFalconFlyer : 5; + bool m_overrideModuleFalconFlyer : 1; + ArchiveOverrideSetting m_overrideFalconFlyer : 2; + + u8 m_faceIndexTabuu : 5; + bool m_overrideModuleTabuu : 1; + ArchiveOverrideSetting m_overrideTabuu : 2; + + u8 m_faceIndexMasterhand : 5; + bool m_overrideModuleMasterhand : 1; + ArchiveOverrideSetting m_overrideMasterHand : 2; + + u8 m_faceIndexCrazyhand : 5; + bool m_overrideModuleCrazyhand : 1; + ArchiveOverrideSetting m_overrideCrazyHand : 2; +}; +extern EnemyOverride g_EnemyOverride; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ty/ty_fig_listmng.h b/include/lib/BrawlHeaders/Brawl/Include/ty/ty_fig_listmng.h new file mode 100644 index 0000000000..1eb55378cf --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ty/ty_fig_listmng.h @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include +#include + +struct tyFigListData { + s32 id; + u8 unk4[0x4]; + const char* name; // relocated pointer to a string at data section start + u32 unkC; + u8 unk10[0x10]; + s32 series; + s32 kind; + Vec3f unk28; + float unk34; + float unk38; + float unk3C; + u8 unk40[0xC]; + s32 bilTexIdx; + u8 unk50[0x10]; +}; +static_assert(sizeof(tyFigListData) == 0x60, "Class is the wrong size!"); + +struct tyFigListDataManager { + tyFigListData* m_data; // address of symbol tyDataList in file + u32 m_count; // count of items in tyDataList, i.e. 544 + u32 m_bySeries[0x28A]; // trophy IDs in order of increasing series code + u32 m_byKind[0x28A]; // trophy IDs in order of increasing kind (or type) code + u32 unk1458; + u8 m_isLoaded; + gfFileIOHandle m_fileHandle; + u8 m_isUnloaded; + + static const u32 TrophiesPerPage = 12; + +public: + tyFigListDataManager(bool loadFile); + ~tyFigListDataManager(); + bool loadRequest(); + bool isLoadFinish(); + void setData(void* fileBuf, u32 fileSz); + u32 getFigListSeries(s32 series, u32 pageNum, u32* figList); + u32 getPageNumSeries(s32 series); + u32 nextIdSeries(u32 id); + u32 prevIdSeries(u32 id); + u32 getFigListKind(s32 kind, u32 pageNum, u32* figList); + u32 getPageNumKind(s32 kind); + u32 nextIdKind(u32 id); + u32 prevIdKind(u32 id); + u32 getTotalId(u32 id, bool bySeries); + s32 getBilTexFileIdx(u32 id); + s32 getBilTexFileIdxFigId(u16 id); + void getBilTexFileNameFigId(u16 id, char* name); + void getBilTexName(u32 i, char* name); + void getBilTexNameFigId(u32 id, char* name); + tyFigListData* getFigDataId(u32 id); +}; +static_assert(sizeof(tyFigListDataManager) == 0x1468, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ty/ty_seal_list.h b/include/lib/BrawlHeaders/Brawl/Include/ty/ty_seal_list.h new file mode 100644 index 0000000000..03d59a19db --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ty/ty_seal_list.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class tySealListTask : public gfTask { +public: + u8 unk40[0x4]; + s32 unk44; + u8 unk48[0x53D0]; + + tySealListTask(); +}; +static_assert(sizeof(tySealListTask) == 0x5418, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_archive_manager.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_archive_manager.h new file mode 100644 index 0000000000..eecb94a083 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_archive_manager.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include +#include + +// TODO: class size +class utArchiveManager { +public: + void* getPublicAddress(u32 paramArcId, const char* nodeName, u16 fileIndex, u32 groupID, u32 endian); + void resolveReference(u32 paramArcId, u32 emCommonArcId, u32 p3, u32 p4, u32 p5, u32 p6); + nw4r::g3d::ResFileData* getResFileFromId(s32 p1, ARCNodeType type, u32 p3, u32 p4, u32 p5); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_list.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_list.h new file mode 100644 index 0000000000..27f4112289 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_list.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include + +/// Node object for utList +class utListNode { +public: + utListNode* m_next; + utListNode* m_prev; +}; +static_assert(sizeof(utListNode) == 0x8, "Class is the wrong size!"); + +/// Non-intrusive doubly-linked list with a head and tail +class utList { + utListNode* m_head; + utListNode* m_tail; + u32 m_length; +public: + /// Make node the new tail of the linked list + void addTail(utListNode* node); + + /// Remove node from the list, assuming it is present + void remove(utListNode* node); + + /// If node is not in the list, return false, else remove it and return true + bool removeExist(utListNode* node); + + /// Get the node at the specified index + utListNode* getNode(u32 index); + + /// If node is not present, return -1, else return its position in the list + s32 isExistNode(utListNode* node) const; + + inline void clear() { + m_head = nullptr; + m_tail = nullptr; + m_length = 0; + } +}; +static_assert(sizeof(utList) == 0xC, "Class is the wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_nw.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_nw.h new file mode 100644 index 0000000000..c239ab7d50 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_nw.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include +#include + +Vec3f nwSMGetGlobalPosition(const nw4r::g3d::ScnMdlSimple* scnMdl, u32 nodeId); +Vec3f nwSMGetGlobalPosition(const nw4r::g3d::ScnMdlSimple* scnMdl, u32 nodeId, const Vec3f* pos); +Vec3f nwSMGetLocalPosition(const nw4r::g3d::ScnMdlSimple* scnMdl, u32 nodeId); +Vec3f nwSMGetGlobalRotation(const nw4r::g3d::ScnMdlSimple* scnMdl, u32 nodeId); +void nwSMSetVisibility(nw4r::g3d::ScnMdlSimple* scnMdl, bool vis); +void nwSMSetNodeVisibility(nw4r::g3d::ScnMdl* scnMdl, u32 nodeId, bool vis); +void nwSMSetNodeVisibility(nw4r::g3d::ScnMdl* scnMdl, s32 numIds, const u32* nodeIds, bool vis); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_queue.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_queue.h new file mode 100644 index 0000000000..a30b49fed4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_queue.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +template +class utQueue { + u16 m_size; + u16 unk2; +public: + T m_elements[C]; + + utQueue() { + m_size = C; + unk2 = 0; + T* p = m_elements; + do { + *p = 0; + p++; + } while (p < m_elements + C); + } + + u32 size() const { return C; } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_relocate.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_relocate.h new file mode 100644 index 0000000000..23c5b445c7 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_relocate.h @@ -0,0 +1,82 @@ +#pragma once + +#include + +/** + * 32-byte file header for certain .dat files, such as /toy/seal/ty_seal_data.dat + */ +struct DATHeader { + u32 fileSz; // bytes + u32 dataSz; // bytes + u32 nRels; // 32-bit words + u32 nSymbols; // DATSymbols + u32 nImports; // DATImports + u32 unk14; + u32 isAbsolute; // if false, apply relocations to the data section and set to true + u32 unk1C; +}; + +struct DATSymbol { + u32 offset; // offset into data section + u32 name; // offset into strtab section +}; + +/** + * A record representing the location of an reference to a symbol that + * is undefined in this utRelocate module, but can be resolved against another + * utRelocate that defines the symbol via utRelocate::resolveReference. + * + * The locations of the references are compactly encoded into the .dat file. + * DATImport::offset gives the first offset into the data section in which a reference is found; + * the word at that offset gives another offset where the next reference is found. + * Thus, locateExtern grabs the next offset as it performs each relocation, stopping when + * it reaches the sentinel value, 0xFFFFFFFF. + */ +struct DATImport { + u32 offset; // offset into data section + u32 name; // offset into strtab section +}; + +/** + * A relocatable .dat file that has been loaded into main memory. + * + * A .dat file contains: + * + * 1. A 32-byte header, described in DATHeader + * 2. A main payload, called the "data" section here + * 3. A rel table containing offsets into the data section where a defined symbol is used + * 4. A symbol table, with entries defining the name of a symbol and its offset in the data section + * 5. An import table containing offsets into the data section where an undefined symbol is used + * 6. A string table containing the names of all of the symbols used by the module. + */ +class utRelocate { + DATHeader m_hdr; + u8* m_dataStart; + const u32* m_relStart; + const DATSymbol* m_symtabStart; + const DATImport* m_importStart; + const char* m_strtabStart; + + // Resolve all internal relocations + void relocate(u8* fileBuf) { + if (!m_hdr.isAbsolute) { + for (u32 i = 0; i < m_hdr.nRels; i++) { + u32 base = reinterpret_cast(m_dataStart); + *reinterpret_cast(&m_dataStart[m_relStart[i]]) += base; + } + reinterpret_cast(fileBuf)->isAbsolute = true; + } + } +public: + const char* getImportName(s32 i, u32 nImports) const { + if (i < 0 || nImports <= i) + return 0; + return m_strtabStart + m_importStart[i].name; + } + + utRelocate(u8* fileBuf, u32 fileSz); + ~utRelocate(); + void* getPublicAddress(const char* name) const; + void resolveReference(const utRelocate* p1); + void locateExtern(const char* externName, void* addr); +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_stageobject_pool.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_stageobject_pool.h new file mode 100644 index 0000000000..a409a227d4 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_stageobject_pool.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include + +template +class utStageObjectPool { +public: + T* m_stageObjects; + u32 m_numStageObjects; + utList m_list1; + utList m_list2; + bool m_32; + char _pad[3]; + + virtual ~utStageObjectPool(); + virtual void clean(); + virtual void reset(); + virtual utListNode* getObject(bool); + virtual void releaseObject(utListNode*); +}; +static_assert(sizeof(utStageObjectPool) == 40, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/ut/ut_uncopyable.h b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_uncopyable.h new file mode 100644 index 0000000000..6b183cecde --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/ut/ut_uncopyable.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class utUnCopyable { + utUnCopyable(const utUnCopyable&); + utUnCopyable& operator=(const utUnCopyable&); +protected: + utUnCopyable() { } +}; diff --git a/include/lib/BrawlHeaders/Brawl/Include/wn/weapon.h b/include/lib/BrawlHeaders/Brawl/Include/wn/weapon.h new file mode 100644 index 0000000000..b3774e3c8f --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/wn/weapon.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class Weapon : public StageObject, public soStatusEventObserver, public soCollisionAttackEventObserver, public soCollisionHitEventObserver, public soArticle { + + char unk9C[0x34]; + +public: + struct Instance { + struct Work { + enum Int { + Int_Activate_Founder_Id = 0x10000000, + + Int_Init_Life = 0x10000003, + Int_Life = 0x10000004, + }; + enum Float { + Float_Active_Global_Frame = 0x11000000, + }; + enum Flag { + }; + }; + }; + + virtual void processUpdate(); + virtual void processFixPosition(); + virtual void processHit(); + virtual void processFixCamera(); + virtual ~Weapon(); + + virtual void updatePosture(bool); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual bool isObserv(char unk1); + virtual bool notifyEventAnimCmd(acAnimCmd* acmd, soModuleAccesser* moduleAccesser, int unk3); + virtual void notifyEventLink(soLinkEventArgs *eventInfo, soModuleAccesser* moduleAccesser, StageObject*, int unk4); + + virtual void remove(); + virtual void changeMotion(int motionKind, bool); + virtual void setFrame(float); + virtual void setRate(float); + virtual void changeStatus(int statusKind); + virtual void setVisibilityWhole(u8); + virtual void setVisibility(int, u8); + virtual void set2nd(u8); + virtual void setSituationKind(SituationKind); + virtual bool isConstraint(); + virtual void have(int, int, int); + virtual void notifyEventChangeStatus(int statusKind, int prevStatusKind, soStatusData* statusData, soModuleAccesser* moduleAccesser); + virtual int getArticleId(); + virtual int getArticleEventManageId(); + virtual int getTaskId(); + virtual int getFounderTaskId(); + virtual void linkOwner(int, int); + virtual void unlinkOwner(int); + virtual bool isActiveArticle(); + virtual void deactivateArticle(); + virtual float getActiveGlobalFrame(); + virtual bool isSyncOwnerStatus(); + virtual void setSyncOwnerStatus(bool); + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackCheck(u32 flags); + virtual void notifyEventCollisionHit(float power, soCollisionAttackData*, u32 index, int, soModuleAccesser* moduleAccesser, soCollisionLog*); + virtual void notifyEventCollisionHit2nd(float posX, float collisionLr, soCollisionAttackModule*, soCollisionLog*, u32 groupIndex, soModuleAccesser* moduleAccesser, bool); + virtual int getOwnerDeactiveTreatType(); + virtual void initialize(); + virtual void onDeactivate(); + virtual bool reflect(); + virtual bool hop(); + virtual void reflectSettingTeam(); + virtual void deactivate(bool); + virtual void setLogAttackInfo(soLogAttackInfo* logAttackInfo); + virtual soLogAttackInfo getLogAttackInfo(); + virtual void updateLogAttackInfo(); + virtual void setAttackPowerMulPattern(float); + virtual void setPosForce(Vec3f*); + virtual bool isCanInhaled(); + virtual bool isInhaled(); + virtual Vec3f startInhaled(); + virtual void updateInhaled(); + virtual void endInhaled(); + virtual Vec3f* getInhaledStartPos(); + virtual int getInhaledCount(); + virtual bool isCanEat(); +}; +static_assert(sizeof(Weapon) == 0xD0, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/wn/wn_em_simple.h b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_em_simple.h new file mode 100644 index 0000000000..ff84878a88 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_em_simple.h @@ -0,0 +1,64 @@ +#pragma once + +#include +#include +#include +#include +#include + +class wnemSimple_ModuleAccesserBuildConfig { + // TODO +}; + +class utWeaponObjectBase : public utListNode { + virtual ~utWeaponObjectBase(); + virtual void setDeactivate(int unk); +}; +static_assert(sizeof(utWeaponObjectBase) == 12, "Class is wrong size!"); + +class wnemSimple : public utWeaponObjectBase, public wnWeaponBuilder, public soDamageEventObserver, public soCollisionSearchEventObserver { +public: + u32 unk2184[0xC]; + u8 unk21B4[0x2]; + bool unk21B6; + u8 unk21B7[0x1]; + bool unk21B8; + bool unk21B9; + u8 unk21BA[0x1]; + bool unk21BB; + u8 unk21BC[0x18]; + float unk21D4; + float unk21D8; + u8 unk21DC[0xC]; + s32 unk21E8; + s32 unk21EC; + u8 unk21F0[0x8]; + float unk21F8; + float unk21FC; + float unk2200; + float unk2204; + u8 unk2208[0xC]; + bool unk2214; + bool unk2215; + u8 unk2216[0x2]; + bool unk2218; + u8 unk2219[0x1B]; + s32* unk2234; + u8 unk2238[0x13C]; + + wnemSimple(); + bool setProcFnc_TouchGround(s32 p1); + bool setProcFnc_LifeZero(s32 p1); + bool setProcFnc_HitShell(s32 p1); + bool setProcFnc_HpZero(s32 p1); + bool changeProcFnc(s32 p1, s32 p2); + bool executeAnimCmd(u32 p1); + bool executeAnimCmd(s32 p1, s32 p2, s32 p3); + void SetLifeLimit(s32 p1); + u32 getFrameCounter(s32 p1); + void RequestDeactive(); + void SetDeadMode(); + virtual ~wnemSimple(); + // TODO: virtual functions +}; +static_assert(sizeof(wnemSimple) == 0x2374, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/wn/wn_module_accesser_build_data.h b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_module_accesser_build_data.h new file mode 100644 index 0000000000..10795ac04a --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_module_accesser_build_data.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class wnModuleAccesserBuildData : public soModuleAccesserBuildData { +public: + // TODO: add missing params + wnModuleAccesserBuildData(s32 entryId, s32 kind, Heaps::HeapType instHeap, + Heaps::HeapType nwModelInstHeap, + Heaps::HeapType nwMotionInstHeap, + s8 resGroupNo, soModuleAccesser* acc, + s32 team, void* cameraRangeSet, + void* cameraClipSphereSet); + + virtual u32 getMdlResId() const; + virtual u32 getAnmResId() const; + virtual u8 getResGroupNo() const; + virtual s32 getTeam() const; + virtual wnMotionData* getMotionData() const; + virtual wnShakeData* getShakeData() const; + virtual wnVisibilityData* getVisibilityData() const; + virtual wnStatusData* getStatusData() const; + virtual soGroundConditionChecker* getGroundConditionChecker() const; + virtual void* getEffectEmitData() const; + virtual wnEffectCommonData* getEffectCommonData() const; + virtual soParamAccesser* getParamAccesser() const; + virtual s32 getAreaCategory() const; + virtual void* getCameraRangeSet() const; + virtual void* getCameraClipSphereSet() const; + virtual void* getItemNodeData() const; + virtual wnJostleData* getJostleData() const; + virtual Heaps::HeapType getInstanceHeap() const; + virtual Heaps::HeapType getNWMotionInstanceHeap() const; + virtual Heaps::HeapType getNWModelInstanceHeap() const; + virtual ~wnModuleAccesserBuildData(); + virtual void* getAnimCmdData(u32 eventThread, s32 p2) const; +}; +// TODO: size diff --git a/include/lib/BrawlHeaders/Brawl/Include/wn/wn_weapon_builder.h b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_weapon_builder.h new file mode 100644 index 0000000000..ab354cf2f2 --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/wn/wn_weapon_builder.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include + +template +class wnWeaponBuilder : public Weapon { +public: + char unkD0[0x2090]; + // TODO: virtual functions +}; +static_assert(sizeof(wnWeaponBuilder) == 0x2160, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/Brawl/Include/yk/yakumono.h b/include/lib/BrawlHeaders/Brawl/Include/yk/yakumono.h new file mode 100644 index 0000000000..671a6ea85d --- /dev/null +++ b/include/lib/BrawlHeaders/Brawl/Include/yk/yakumono.h @@ -0,0 +1,70 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class grYakumono; + +struct ykDataGroup { + u32 m_hitGroupIndex; + soSet* m_hitDataSimpleSet; + soSet* m_hitDataSet; +}; + +struct ykData { + int m_dataGroupNum; + ykDataGroup* m_dataGroups; + + ykData(); + inline ykData(int numDataGroups, ykDataGroup* dataGroups) { + m_dataGroupNum = numDataGroups; + m_dataGroups = dataGroups; + } +}; + +struct ykAreaData : ykData { + soSet* m_areaDataSet; +}; + +class Yakumono : public StageObject, public soCollisionAttackEventObserver { +public: + void setSituationKind(SituationKind situationKind); + void setCollisionHitOpponentCategory(int unk1, bool unk2); + void setCollisionHitSelfCatagory(soCollision::Category); + void setReactionFrame(int reactionFrame); + void setTeamOwnerId(int teamOwnerId); + void setTeam(int teamId); + int getTeam(); + + virtual void processFixPosition(); + virtual void processPreCollision(); + virtual void renderDebug(); + virtual ~Yakumono(); + virtual void updatePosture(bool); + virtual soKind soGetKind(); + virtual int soGetSubKind(); + virtual void updateNodeSRT(); + + virtual float getAttackPosX(int index); + virtual float getHitPosX(int index); + virtual void initAttackPosXWork(int unk1, int unk2); + virtual void initHitPosXWork(int unk1, int unk2); + virtual void presentEventGimmick(soGimmickEventArgs* eventInfo, int sendID); + + virtual void notifyEventCollisionAttack(float power, soCollisionLog* collisionLog, soModuleAccesser* moduleAccesser); + virtual bool notifyEventCollisionAttackCheck(u32 flags); + + grYakumono* m_ground; + char _104[4]; + soCollisionLog m_collisionLog; + char _116[4]; + soModuleAccesser moduleAccesser; + ykData* m_data; + char _spacer[457]; + char _pad[3]; +}; +static_assert(sizeof(Yakumono) == 856, "Class is wrong size!"); diff --git a/include/lib/BrawlHeaders/OpenRVL/.clang-format b/include/lib/BrawlHeaders/OpenRVL/.clang-format new file mode 100644 index 0000000000..4a75e4bdb2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/.clang-format @@ -0,0 +1,11 @@ +--- +BasedOnStyle: LLVM +Language: Cpp +SortIncludes: "true" +SortUsingDeclarations: "true" +UseTab: Never +IndentWidth: 4 +PointerAlignment: Left +ConstructorInitializerAllOnOneLineOrOnePerLine: true +FixNamespaceComments: true +AccessModifierOffset: -4 diff --git a/include/lib/BrawlHeaders/OpenRVL/.gitattributes b/include/lib/BrawlHeaders/OpenRVL/.gitattributes new file mode 100644 index 0000000000..dfe0770424 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/include/lib/BrawlHeaders/OpenRVL/.github/workflows/test.yml b/include/lib/BrawlHeaders/OpenRVL/.github/workflows/test.yml new file mode 100644 index 0000000000..d714a509c1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: Test + +on: + push: + pull_request: + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout open_rvl + uses: actions/checkout@v3 + - name: Download compilers + run: | + curl -L -k https://cdn.discordapp.com/attachments/727918646525165659/917185027656286218/GC_WII_COMPILERS.zip --output GC_WII_COMPILERS.zip && mkdir "tools/GC_WII_COMPILERS" && tar -xvf GC_WII_COMPILERS.zip -C tools/GC_WII_COMPILERS + - name: Run tester + run: python3 tools/tester/tester.py --run=all diff --git a/include/lib/BrawlHeaders/OpenRVL/.gitignore b/include/lib/BrawlHeaders/OpenRVL/.gitignore new file mode 100644 index 0000000000..1110f3f170 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/.gitignore @@ -0,0 +1,12 @@ +*.pyc +__pycache__/ + +tools/*.exe +tools/*.dll +tools/old/*.exe +tools/old/*.dll +tools/*.o +tools/tester/include/baserom.dol +tools/GC_WII_COMPILERS + +.vscode/ diff --git a/include/lib/BrawlHeaders/OpenRVL/.pre-commit-config.yaml b/include/lib/BrawlHeaders/OpenRVL/.pre-commit-config.yaml new file mode 100644 index 0000000000..6b697aa327 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: end-of-file-fixer + - id: mixed-line-ending diff --git a/include/lib/BrawlHeaders/OpenRVL/README.md b/include/lib/BrawlHeaders/OpenRVL/README.md new file mode 100644 index 0000000000..0bae18d2c9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/README.md @@ -0,0 +1,38 @@ +# open_rvl + +## Overview + This repo contains a WIP decompilation of the Revolution (RVL) SDK. + + This project targets the version in Wii Sports (`__MWCC__ == 0x4199_60831`), but it should be adaptable to other projects with minimal effort. + + The Revolution SDK makes up a considerable portion of most game binaries (avg. > 20%), so this project is designed to save other projects' time by containing common code for anyone to use. + + File, function, symbol, variable, and other names come from various games' debugging information (symbol map, DWARF, etc.). + + Leaked material must not be referenced, as doing so will jeopardize the legality of any project that uses open_rvl. + +## Testing + Because open_rvl does not build a binary, a new method of testing was implemented to ensure function/data equivalence. + + All unit test files exist in `tests/`. The `tests/` directory mirrors the structure of the `src/` directory, so that unit tests can be mapped to the corresponding source file. + - Unit test files consist of SHA-256 hashes of any code/data that should be tested. + - The file is in JSON format, and can be generated from an assembly file (`*.s`) or object file (`*.o`) by using `tester.py`. + + However, there are some caveats. The open_rvl code is not linked, so non-local symbol references will stay unresolved. + + The tester is automatically run on push/pull request. + + **Only files that are fully matching should have a corresponding unit test.** + +## Using the tester + When using the tester, you can either create or run a unit test. + + Configurable arguments: + - `--make_asm={ASM_FILE}` + - Creates a unit test from the specified assembly file, and writes the JSON data to the console. + - `--make_obj={OBJ_FILE}` + - Creates a unit test from the specified object file, and writes the JSON data to the console. + - `--run={UNIT_TEST}` + - Runs the specified unit test, and displays whether each case passes or fails. + - **Specify "`all`" as the unit test name to recursively run everything under `tests/`.** + - The program returns an exit code of zero if all test cases pass, otherwise 1. diff --git a/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK.h b/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK.h new file mode 100644 index 0000000000..47bd0054ac --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK.h @@ -0,0 +1,12 @@ +#ifndef METROTRK_H +#define METROTRK_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK/dolphin_trk.h b/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK/dolphin_trk.h new file mode 100644 index 0000000000..31acf41505 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/MetroTRK/dolphin_trk.h @@ -0,0 +1,17 @@ +#ifndef METROTRK_DOLPHIN_TRK_H +#define METROTRK_DOLPHIN_TRK_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void InitMetroTRK(void); +void InitMetroTRK_BBA(void); + +void EnableMetroTRKInterrupts(void); +void TRK_flush_cache(void*, size_t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib.h new file mode 100644 index 0000000000..37b962f7e1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib.h @@ -0,0 +1,17 @@ +#ifndef RVL_FACE_LIBRARY_H +#define RVL_FACE_LIBRARY_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Icon.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Icon.h new file mode 100644 index 0000000000..7f17c2f6fb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Icon.h @@ -0,0 +1,14 @@ +#ifndef RVL_FACE_LIBRARY_ICON_H +#define RVL_FACE_LIBRARY_ICON_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void RFLSetIconDrawDoneCallback(RFLIconDrawDoneCallback callback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_MiddleDatabase.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_MiddleDatabase.h new file mode 100644 index 0000000000..330b2e4532 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_MiddleDatabase.h @@ -0,0 +1,25 @@ +#ifndef RVL_FACE_LIBRARY_MIDDLE_DATABASE_H +#define RVL_FACE_LIBRARY_MIDDLE_DATABASE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + RFLMiddleDBType_HiddenRandom, + RFLMiddleDBType_HiddenNewer, + RFLMiddleDBType_HiddenOlder, + RFLMiddleDBType_Random, + RFLMiddleDBType_UserSet, + RFLMiddleDBType_Reserved1 +} RFLMiddleDBType; + +typedef struct RFLMiddleDB { + u8 dummy[0x18]; +} RFLMiddleDB; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Model.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Model.h new file mode 100644 index 0000000000..5e826ebaf5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Model.h @@ -0,0 +1,74 @@ +#ifndef RVL_FACE_LIBRARY_MODEL_H +#define RVL_FACE_LIBRARY_MODEL_H +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct RFLMiddleDB; + +typedef enum { + RFLCoordinateType_X = 0x01000000, + RFLCoordinateType_Y = 0x00010000, + RFLCoordinateType_Z = 0x00000100, + + RFLCoordinateType_RevX = 0x11000000, + RFLCoordinateType_RevY = 0x00110000, + RFLCoordinateType_RevZ = 0x00001100, + + RFLCoordinateType_RevMask = 0x10101000 +} RFLCoordinateType; + +typedef struct RFLCharModel { + u8 dummy[0x88]; +} RFLCharModel; + +typedef struct RFLDrawSetting { + u8 lightEnable; // at 0x0 + GXLightID lightMask; // at 0x4 + GXDiffuseFn diffuse; // at 0x8 + GXAttnFn attn; // at 0xC + GXColor ambColor; // at 0x10 + u8 compLoc; // at 0x14 +} RFLDrawSetting; + +typedef struct RFLDrawCoreSetting { + u8 txcGenNum; // at 0x0 + GXTexCoordID txcID; // at 0x4 + GXTexMapID texMapID; // at 0x8 + u8 tevStageNum; // at 0xC + GXTevSwapSel tevSwapTable; // at 0x10 + GXTevKColorID tevKColorID; // at 0x14 + GXTevRegID tevOutRegID; // at 0x18 + GXPosNrmMtx posNrmMtxID; // at 0x1C + u8 reverseCulling; // at 0x20 +} RFLDrawCoreSetting; + +void RFLSetCoordinate(RFLCoordinateType t1, RFLCoordinateType t2); +u32 RFLGetModelBufferSize(RFLResolution res, u32 exprFlags); +RFLErrcode RFLInitCharModel(RFLCharModel* model, RFLDataSource src, + RFLMiddleDB* db, u16 id, void* work, + RFLResolution res, u32 exprFlags); +void RFLSetMtx(RFLCharModel* model, const Mtx mvMtx); +void RFLSetExpression(RFLCharModel* model, RFLExpression expr); +RFLExpression RFLGetExpression(RFLCharModel* model); +GXColor RFLGetFavoriteColor(RFLFavoriteColor color); +void RFLLoadDrawSetting(const RFLDrawSetting* setting); +void RFLDrawOpa(const RFLCharModel* model); +void RFLDrawXlu(const RFLCharModel* model); +void RFLLoadVertexSetting(const RFLDrawCoreSetting* setting); +void RFLLoadMaterialSetting(const RFLDrawCoreSetting* setting) DECOMP_DONT_INLINE; +void RFLDrawOpaCore(const RFLCharModel* model, + const RFLDrawCoreSetting* setting); +void RFLDrawXluCore(const RFLCharModel* model, + const RFLDrawCoreSetting* setting); +void RFLDrawShape(const RFLCharModel* model); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_NANDLoader.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_NANDLoader.h new file mode 100644 index 0000000000..31bbca08c9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_NANDLoader.h @@ -0,0 +1,15 @@ +#ifndef RVL_FACE_LIBRARY_NAND_LOADER_H +#define RVL_FACE_LIBRARY_NAND_LOADER_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +BOOL RFLFreeCachedResource(void); +BOOL RFLIsResourceCached(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_System.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_System.h new file mode 100644 index 0000000000..8e3bf72175 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_System.h @@ -0,0 +1,23 @@ +#ifndef RVL_FACE_LIBRARY_SYSTEM_H +#define RVL_FACE_LIBRARY_SYSTEM_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +u32 RFLGetWorkSize(BOOL deluxeTex); +RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, + BOOL deluxeTex); +RFLErrcode RFLInitRes(void* workBuffer, void* resBuffer, u32 resSize, + BOOL deluxeTex); +void RFLExit(void); +BOOL RFLAvailable(void); +RFLErrcode RFLGetAsyncStatus(void); +s32 RFLGetLastReason(void); +RFLErrcode RFLWaitAsync(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Types.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Types.h new file mode 100644 index 0000000000..981b9fa328 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFL_Types.h @@ -0,0 +1,120 @@ +#ifndef RVL_FACE_LIBRARY_TYPES_H +#define RVL_FACE_LIBRARY_TYPES_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Common types used throughout many RFL files. + * + * To avoid circular depencies, common structures and all enums have been moved + * here. + * + * Everything is organized in alphabetical order (when possible, otherwise + * dependency order). + */ + +/** + * Common defines + */ + +#define RFL_NAME_LEN 10 +#define RFL_CREATOR_LEN 10 +#define RFL_CREATEID_LEN 8 + +#define RFL_CTRL_MAX 4 +#define RFL_CTRL_CHAR_MAX 10 + +#define RFL_DB_CHAR_MAX 100 + +/** + * Common enums + */ + +typedef enum { + RFLDataSource_Official, + RFLDataSource_Hidden, + RFLDataSource_Controller1, + RFLDataSource_Controller2, + RFLDataSource_Controller3, + RFLDataSource_Controller4, + RFLDataSource_Default, + RFLDataSource_Middle, + + RFLDataSource_Max +} RFLDataSource; + +typedef enum { + RFLErrcode_Success, + RFLErrcode_NotAvailable, + RFLErrcode_NANDCommandfail, + RFLErrcode_Loadfail, + RFLErrcode_Savefail, + RFLErrcode_Fatal, + RFLErrcode_Busy, + RFLErrcode_Broken, + RFLErrcode_Exist, + RFLErrcode_DBFull, + RFLErrcode_DBNodata, + RFLErrcode_Controllerfail, + RFLErrcode_NWC24Fail, + RFLErrcode_MaxFiles, + RFLErrcode_MaxBlocks, + RFLErrcode_WrongParam, + RFLErrcode_NoFriends, + RFLErrcode_Isolation, + + RFLErrcode_Unknown = 0xFF +} RFLErrcode; + +typedef enum { + RFLExp_Normal, + RFLExp_Smile, + RFLExp_Anger, + RFLExp_Sorrow, + RFLExp_Surprise, + RFLExp_Blink, + RFLExp_OpenMouth, + + RFLExp_Max +} RFLExpression; + +typedef enum { + RFLFavoriteColor_Red, + RFLFavoriteColor_Orange, + RFLFavoriteColor_Yellow, + RFLFavoriteColor_YellowGreen, + RFLFavoriteColor_Green, + RFLFavoriteColor_Blue, + RFLFavoriteColor_SkyBlue, + RFLFavoriteColor_Pink, + RFLFavoriteColor_Purple, + RFLFavoriteColor_Brown, + RFLFavoriteColor_White, + RFLFavoriteColor_Black, + + RFLFavoriteColor_Max +} RFLFavoriteColor; + +typedef enum { + RFLResolution_64 = 64, + RFLResolution_128 = 128, + RFLResolution_256 = 256, + + RFLResolution_64M = 96, + RFLResolution_128M = 224, + RFLResolution_256M = 480 +} RFLResolution; + +/** + * Common typedefs + */ + +typedef void (*RFLIconDrawDoneCallback)(void); +typedef void (*RFLModelDrawDoneCallback)(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Controller.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Controller.h new file mode 100644 index 0000000000..77e91d9c7f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Controller.h @@ -0,0 +1,60 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_CONTROLLER_H +#define RVL_FACE_LIBRARY_INTERNAL_CONTROLLER_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct MEMiHeapHead; + +// 0x34919d +typedef struct RFLiCtrlCharInfo { + u8 dummy; +} RFLiCtrlCharInfo; + +typedef struct RFLiCtrlData { + u32 id; // at 0x0 + u16 secretFlag; // at 0x4 + u16 padding; // at 0x6 + RFLiCtrlCharInfo* data[RFL_CTRL_CHAR_MAX]; // at 0x8 + u16 deleted; // at 0x2EC + u16 checksum; // at 0x2EE +} RFLiCtrlData; + +typedef struct RFLiCtrlWriteDeleteList { + u8 isDelete[100]; +} RFLiCtrlWriteDeleteList; + +typedef struct RFLiCtrlBufManager { + RFLiCtrlData* buffer[RFL_CTRL_MAX]; // at 0x0 + BOOL isLoaded[RFL_CTRL_MAX]; // at 0x10 + RFLiCtrlData* replaceBuf[2]; // at 0x20 + BOOL isRead; // at 0x28 + CARDFileInfo file; // at 0x2C + void* tempBuffer; // at 0x40 + void* readBuffer; // at 0x44 + void* writeBuffer; // at 0x48 + u16 writeSize; // at 0x4C + u16 writeOffset; // at 0x4E + u16 deleted; // at 0x50 + s32 writeChan; // at 0x54 + const RFLiCtrlWriteDeleteList* writeDeleteList; // at 0x58 + u16 readSize; // at 0x5C + u16 currPos; // at 0x5E + BOOL readIsChMode; // at 0x60 + u8 writeCount; // at 0x64 + u16 rwLen; // at 0x66 + u8 retry; // at 0x68 + u8* verifyBuffer; // at 0x6C + u8 hiddenMDB[24]; // at 0x0 +} RFLiCtrlBufManager; + +void RFLiInitCtrlBuf(struct MEMiHeapHead*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_DataUtility.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_DataUtility.h new file mode 100644 index 0000000000..c587c0eeca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_DataUtility.h @@ -0,0 +1,19 @@ +#ifndef RVL_FACE_LIBRARY_INTENRAL_DATA_UTILITY_H +#define RVL_FACE_LIBRARY_INTERNAL_DATA_UTILITY_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct RFLiCharInfo; +typedef struct RFLMiddleDB; + +RFLErrcode RFLiPickupCharInfo(struct RFLiCharInfo*, RFLDataSource, + struct RFLMiddleDB*, u16); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Database.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Database.h new file mode 100644 index 0000000000..c2dd9a5446 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Database.h @@ -0,0 +1,56 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_DATABASE_H +#define RVL_FACE_LIBRARY_INTERNAL_DATABASE_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct MEMiHeapHead; + +// TODO: 0x34a009 +typedef struct RFLiDatabase { + u8 dummy[0x1F1E0]; +} RFLiDatabase; + +// TODO: IDK what this name is +// 0x3491af +typedef struct RFLiTrg { + u8 dummy[0x4A]; +} RFLiTrg; + +// TODO: 0x34a921 +typedef struct RFLiDBCharInfo { + u8 dummy[0x40]; +} RFLiDBCharInfo; + +typedef struct RFLiCRCInfo { + void* head; // at 0x0 + u32 size; // at 0x4 + u8* current; // at 0x8 + u32 count; // at 0xC + u16 crc; // at 0x10 + OSAlarm alarm; // at 0x18 + RFLiAlarmCallback callback; // at 0x48 +} RFLiCRCInfo; + +typedef struct RFLiDBManager { + RFLiDatabase* database; // at 0x0 + RFLiDatabaseCallback saveCb; // at 0x4 + RFLiDatabaseCallback formatCb; // at 0x8 + RFLiDatabaseCallback bootloadCb; // at 0xC + RFLiOpenType saveType; // at 0x10 + RFLiTrg trg; // at 0x14 + RFLiCRCInfo crcInfo; // at 0x60 +} RFLiDBManager; + +void RFLiInitDatabase(struct MEMiHeapHead*); + +RFLErrcode RFLiBootLoadDatabaseAsync(RFLiDatabaseCallback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_HiddenDatabase.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_HiddenDatabase.h new file mode 100644 index 0000000000..b2f6e62261 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_HiddenDatabase.h @@ -0,0 +1,40 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_HIDDEN_DATABASE_H +#define RVL_FACE_LIBRARY_INTERNAL_HIDDEN_DATABASE_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct RFLiHDBList { + RFLiDBCharInfo data[RFL_DB_CHAR_MAX]; // at 0x0 + u16 num; // at 0x1900 + u8 current; // at 0x1901 +} RFLiHDBList; + +typedef struct RFLiHDBManager { + BOOL loaded; // at 0x0 + BOOL readError; // at 0x4 + void* writeTmp; // at 0x8 + s16 writeIndex; // at 0xC + RFLiDatabaseCallback writeCb; // at 0x10 + void* formatTmp; // at 0x14 + RFLiDatabaseCallback formatCb; // at 0x18 + s16 formatIndex; // at 0x1C + RFLiDBCharInfo* loadDst; // at 0x20 + void* loadTmp; // at 0x24 + u32 loadArg; // at 0x28 + RFLiAlarmCallback loadCb; // at 0x2C + u16 loadIndex; // at 0x30 + RFLiDBCharInfo* cachedDB; // at 0x34 + BOOL cached; // at 0x38 + RFLiHDBList list; // at 0x3C +} RFLiHDBManager; + +void RFLiInitHiddenDatabase(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MakeTex.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MakeTex.h new file mode 100644 index 0000000000..82b58c00c1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MakeTex.h @@ -0,0 +1,22 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_MAKE_TEX_H +#define RVL_FACE_LIBRARY_INTERNAL_MAKE_TEX_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct RFLiCharInfo; + +void RFLiMakeTexture(const struct RFLiCharInfo* info, u8** texBuffer, + RFLResolution res); + +RFLi_MASKRSL RFLiGetMaxMaskRsl(RFLResolution); + +u32 RFLiGetMaskBufSize(RFLResolution); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MiddleDatabase.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MiddleDatabase.h new file mode 100644 index 0000000000..443500df30 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_MiddleDatabase.h @@ -0,0 +1,24 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_MIDDLE_DATABASE_H +#define RVL_FACE_LIBRARY_INTERNAL_MIDDLE_DATABASE_H +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct RFLiMiddleDB { + RFLMiddleDBType type; // at 0x0 + RFLiDatabaseCallback callback; // at 0x4 + RFLiDBCharInfo* data; // at 0x8 + u16 size; // at 0xC + u16 storedSize; // at 0xE + u32 userData1; // at 0x10 + u32 userData2; // at 0x14 +} RFLiMiddleDB; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Model.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Model.h new file mode 100644 index 0000000000..9a13c6f8f7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Model.h @@ -0,0 +1,275 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_MODEL_H +#define RVL_FACE_LIBRARY_INTERNAL_MODEL_H +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define VTX_COORDS_IN_POS 3 +#define VTX_COORDS_IN_NRM 3 +#define VTX_COORDS_IN_TXC 2 + +#define VTX_COORD_SIZE sizeof(s16) +#define VTX_POS_SIZE (VTX_COORD_SIZE * VTX_COORDS_IN_POS) +#define VTX_NRM_SIZE (VTX_COORD_SIZE * VTX_COORDS_IN_NRM) +#define VTX_TXC_SIZE (VTX_COORD_SIZE * VTX_COORDS_IN_TXC) + +typedef struct RFLiCoordinateData { + u8 uOff; // at 0x0 + u8 fOff; // at 0x1 + u8 rOff; // at 0x2 + BOOL uRev; // at 0x4 + BOOL fRev; // at 0x8 + BOOL rRev; // at 0xC +} RFLiCoordinateData; + +typedef struct RFLiCharModelRes { + u8 noseDl[0xC0]; // at 0x0 + u8 capDl[0x560]; // at 0xC0 + u8 faceDl[0x2E0]; // at 0x620 + u8 beardDl[0x160]; // at 0x900 + u8 noselineDl[0x60]; // at 0xA60 + u8 maskDl[0x380]; // at 0xAC0 + u8 glassesDl[0x40]; // at 0xE40 + + u8 faceTex[0x4000]; // at 0xE80 + u8 capTex[0x400]; // at 0x4E80 + u8 noseTex[0x400]; // at 0x5280 + u8 glassesTex[0x1000]; // at 0x5680 + + s16 noseVtxPos[23 * VTX_COORDS_IN_POS]; // at 0x6680 + s16 noseVtxNrm[23 * VTX_COORDS_IN_NRM]; // at 0x670A + + s16 capVtxPos[173 * VTX_COORDS_IN_POS]; // at 0x6794 + s16 capVtxNrm[246 * VTX_COORDS_IN_NRM]; // at 0x6BA2 + s16 capVtxTxc[95 * VTX_COORDS_IN_TXC]; // at 0x7166 + + s16 faceVtxPos[66 * VTX_COORDS_IN_POS]; // at 0x72E2 + s16 faceVtxNrm[66 * VTX_COORDS_IN_NRM]; // at 0x746E + s16 faceVtxTxc[115 * VTX_COORDS_IN_TXC]; // at 0x75FA + + s16 beardVtxPos[40 * VTX_COORDS_IN_POS]; // at 0x77C6 + s16 beardVtxNrm[68 * VTX_COORDS_IN_NRM]; // at 0x78B6 + + s16 noselineVtxPos[6 * VTX_COORDS_IN_POS]; // at 0x7A4E + s16 noselineVtxNrm[2 * VTX_COORDS_IN_NRM]; // at 0x7A72 + s16 noselineVtxTxc[7 * VTX_COORDS_IN_TXC]; // at 0x7A7E + + s16 maskVtxPos[88 * VTX_COORDS_IN_POS]; // at 0x7A9A + s16 maskVtxNrm[86 * VTX_COORDS_IN_NRM]; // at 0x7CAA + s16 maskVtxTxc[176 * VTX_COORDS_IN_TXC]; // at 0x7EAE + + s16 glassesVtxPos[4 * VTX_COORDS_IN_POS]; // at 0x816E + s16 glassesVtxNrm[1 * VTX_COORDS_IN_NRM]; // at 0x8186 + s16 glassesVtxTxc[4 * VTX_COORDS_IN_TXC]; // at 0x818C + + GXTexObj faceTexObj; // at 0x819C + GXTexObj capTexObj; // at 0x81BC + GXTexObj noseTexObj; // at 0x81DC + GXTexObj glassesTexObj; // at 0x81FC + + s16* hairVtxPos; // at 0x821C + s16* hairVtxNrm; // at 0x8220 + u8* hairDl; // at 0x8224 + s16* foreheadVtxPos; // at 0x8228 + s16* foreheadVtxNrm; // at 0x822C + u8* foreheadDl; // at 0x8230 + + u16 noseDlSize; // at 0x8234 + u16 faceDlSize; // at 0x8236 + u16 hairDlSize; // at 0x8238 + u16 capDlSize; // at 0x823A + u16 foreheadDlSize; // at 0x823C + u16 beardDlSize; // at 0x823E + u16 noselineDlSize; // at 0x8240 + u16 maskDlSize; // at 0x8242 + u16 glassesDlSize; // at 0x8244 + + u8 facelineColor; // at 0x8246 + u8 hairColor; // at 0x8247 + u8 beardColor; // at 0x8248 + u8 glassesColor; // at 0x8249 + u8 favoriteColor; // at 0x824A + + BOOL flipHair; // at 0x824C + + char UNK_0x8250[0x10]; +} RFLiCharModelRes; + +typedef struct RFLiShapeRes { + RFLiPartsShp part; // at 0x0 + u16 file; // at 0x4 + BOOL transform; // at 0x8 + BOOL flipX; // at 0xC + s16* vtxPosBuf; // at 0x10 + s16* vtxNrmBuf; // at 0x14 + s16* vtxTxcBuf; // at 0x18 + u8* dlBuf; // at 0x1C + u16 vtxPosBufSize; // at 0x20 + u16 vtxNrmBufSize; // at 0x22 + u16 vtxTxcBufSize; // at 0x24 + u16 dlBufSize; // at 0x26 + u16 numVtxPos; // at 0x28 + u16 numVtxNrm; // at 0x2A + u16 numVtxTxc; // at 0x2C + u16 dlSize; // at 0x2E + f32 posScale; // at 0x30 + Vec* posTrans; // at 0x34 + Vec* noseTrans; // at 0x38 + Vec* beardTrans; // at 0x3C + Vec* hairTrans; // at 0x40 +} RFLiShapeRes; + +typedef struct RFLiCharModel { + Mtx posMtx; // at 0x0 + Mtx nrmMtx; // at 0x30 + RFLExpression expression; // at 0x60 + RFLResolution resolution; // at 0x64 + RFLiCharModelRes* res; // at 0x68 + GXTexObj* maskTexObj[RFLExp_Max]; // at 0x6C +} RFLiCharModel; + +typedef struct RFLiCharInfo { + union { + struct { + u16 type : 3; + u16 color : 3; + u16 texture : 4; + u16 padding : 6; + }; + u16 rawdata; + } faceline; // at 0x0 + + union { + struct { + u16 type : 7; + u16 color : 3; + u16 flip : 1; + u16 padding : 5; + }; + u16 rawdata; + } hair; // at 0x2 + + union { + struct { + u32 type : 6; + u32 color : 3; + u32 scale : 4; + u32 rotate : 5; + u32 x : 4; + u32 y : 5; + u32 padding : 5; + }; + u32 rawdata; + } eye; // at 0x4 + + union { + struct { + u32 type : 5; + u32 color : 3; + u32 scale : 4; + u32 rotate : 5; + u32 x : 4; + u32 y : 5; + u32 padding : 6; + }; + u32 rawdata; + } eyebrow; // at 0x8 + + union { + struct { + u16 type : 4; + u16 scale : 4; + u16 y : 5; + u16 padding : 3; + }; + u16 rawdata; + } nose; // at 0xC + + union { + struct { + u16 type : 5; + u16 color : 2; + u16 scale : 4; + u16 y : 5; + }; + u16 rawdata; + } mouth; // at 0xE + + union { + struct { + u16 mustache : 2; + u16 type : 2; + u16 color : 3; + u16 scale : 4; + u16 y : 5; + }; + u16 rawdata; + } beard; // at 0x10 + + union { + struct { + u16 type : 4; + u16 color : 3; + u16 scale : 4; + u16 y : 5; + }; + u16 rawdata; + } glass; // at 0x12 + + union { + struct { + u16 type : 1; + u16 scale : 4; + u16 x : 5; + u16 y : 5; + u16 padding : 1; + }; + u16 rawdata; + } mole; // at 0x14 + + struct { + u8 height; + u8 build; + } body; // at 0x16 + + struct { + wchar_t name[RFL_NAME_LEN + 1]; + wchar_t creator[RFL_CREATOR_LEN + 1]; + u16 sex : 1; + u16 bmonth : 4; + u16 bday : 5; + u16 color : 4; + u16 favorite : 1; + u16 localOnly : 1; + } personal; // at 0x18 + + struct { + u8 data[RFL_CREATEID_LEN]; + } createID; // at 0x46 +} RFLiCharInfo; + +extern RFLiCoordinateData coordinateData; + +static inline void RFLiSetCoordinateData(const RFLiCoordinateData* data) { + coordinateData = *data; +} + +u32 RFLiGetExpressionNum(u32 exprFlags); +void RFLiInitCharModel(RFLCharModel* model, RFLiCharInfo* info, void* work, + RFLResolution res, u32 exprFlags); +GXColor RFLiGetFacelineColor(RFLiCharInfo* info); +void RFLiInitCharModelRes(RFLiCharModelRes* res, const RFLiCharInfo* info); +void RFLiInitShapeRes(RFLiShapeRes* shape); +void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex part, u16 file, + void* buffer); +void RFLiTransformCoordinate(s16* to, const s16* from); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDAccess.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDAccess.h new file mode 100644 index 0000000000..6fd5dbe802 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDAccess.h @@ -0,0 +1,81 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_NAND_ACCESS_H +#define RVL_FACE_LIBRARY_INTERNAL_NAND_ACCESS_H +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct RFLiCallbackTag { + RFLiAsyncTag tag; // at 0x0 + RFLiFileType type; // at 0x4 +} RFLiCallbackTag; + +typedef struct RFLiAccessInfo { + RFLiAccessCallback callback; // at 0x0 + union { + struct { + char path[FS_MAX_PATH + 1]; // at 0x4 + u8 openMode; // at 0x46 + u8 perm; // at 0x47 + u8 attr; // at 0x48 + } openInfo; + + struct { + void* dst; // at 0x4 + u32 size; // at 0x8 + s32 offset; // at 0xC + } readInfo; + + struct { + const void* src; // at 0x4 + u32 size; // at 0x8 + s32 offset; // at 0xC + } writeInfo; + + struct { + u8 count; // at 0x4 + } closeInfo; + + struct { + u32* dst; // at 0x4 + } getLengthInfo; + }; + NANDFileInfo file; // at 0x48 + NANDCommandBlock block; // at 0xD4 + RFLiCallbackTag tag; // at 0x190 + OSAlarm alarm; // at 0x198 + RFLiFileType alarmData; // at 0x1C8 + RFLiAlarmCallback retryCallback; // at 0x1CC + u8 retryCount; // at 0x1D0 + void* safeBuffer; // at 0x1D4 + u8 opened; // at 0x1D8 +} RFLiAccessInfo; + +void RFLiInitAccessInfo(struct MEMiHeapHead* heap); +void RFLiExitAccessInfo(void); +BOOL RFLiIsWorking(void); +void RFLiStartWorking(void); +void RFLiEndWorkingReason(RFLErrcode err, s32 reason); +void RFLiEndWorking(RFLErrcode err); +NANDCommandBlock* RFLiSetCommandBlock(RFLiFileType type, RFLiAsyncTag tag); +RFLiFileType RFLiGetType(NANDCommandBlock* block); +NANDFileInfo* RFLiGetWorkingFile(RFLiFileType type); +RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openMode, + RFLiAccessCallback callback); +RFLErrcode RFLiReadAsync(RFLiFileType type, void* dst, u32 size, + RFLiAccessCallback callback, s32 offset); +RFLErrcode RFLiWriteAsync(RFLiFileType type, const void* src, u32 size, + RFLiAccessCallback callback, s32 offset); +RFLErrcode RFLiCloseAsync(RFLiFileType type, RFLiAccessCallback callback); +RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* out, + RFLiAccessCallback callback); +RFLErrcode RFLiDeleteAsync(RFLiFileType type, RFLiAccessCallback callback); +RFLErrcode RFLiCreateSaveDirAsync(RFLiAccessCallback callback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDLoader.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDLoader.h new file mode 100644 index 0000000000..72dfc2613a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_NANDLoader.h @@ -0,0 +1,43 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_NAND_LOADER_H +#define RVL_FACE_LIBRARY_INTERNAL_NAND_LOADER_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct RFLiTexture; + +typedef struct RFLiArchive { + u16 numFiles; // at 0x0 + u16 biggestSize; // at 0x2 + u32 offset; // at 0x4 +} RFLiArchive; + +typedef struct RFLiLoader { + RFLiArchive archives[RFLiArcID_Max]; // at 0x0 + u32 cacheSize; // at 0x90 + void* cache; // at 0x94 + BOOL cached; // at 0x98 + u16 version; // at 0x9C + void* headerBuf1; // at 0xA0 + void* headerBuf2; // at 0xA4 + u8 numResources; // at 0xA8 +} RFLiLoader; + +void RFLiInitLoader(void); +RFLErrcode RFLiLoadResourceHeaderAsync(void); +u32 RFLiGetTexSize(RFLiPartsTex part, u16 file); +struct RFLiTexture* RFLiLoadTexture(RFLiPartsTex part, u16 file, void* dst); +u32 RFLiGetShpTexSize(RFLiPartsShpTex part, u16 file); +struct RFLiTexture* RFLiLoadShpTexture(RFLiPartsShpTex part, u16 file, + void* dst); +u32 RFLiGetShapeSize(RFLiPartsShp part, u16 file); +void* RFLiLoadShape(RFLiPartsShp part, u16 file, void* dst); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_System.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_System.h new file mode 100644 index 0000000000..c5458fb386 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_System.h @@ -0,0 +1,62 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_SYSTEM_H +#define RVL_FACE_LIBRARY_INTERNAL_SYSTEM_H +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct MEMiHeapHead; + +typedef struct RFLiManager { + void* workBuffer; // at 0x0 + struct MEMiHeapHead* rootHeap; // at 0x4 + struct MEMiHeapHead* systemHeap; // at 0x8 + struct MEMiHeapHead* tmpHeap; // at 0xC + RFLiDBManager dbMgr; // at 0x10 + RFLiLoader loader; // at 0xC0 + RFLiHDBManager hdbMgr; // at 0x16C + RFLiCtrlBufManager ctrlMgr; // at 0x1AAC + BOOL working; // at 0x1B34 + BOOL deluxeTex; // at 0x1B38 + u8 brokenType; // at 0x1B3C + RFLErrcode lastErrCode; // at 0x1B40 + RFLErrcode beforeCloseErr; // at 0x1B44 + s32 lastReason; // at 0x1B48 + s32 beforeCloseReason; // at 0x1B4C + RFLiAccessInfo info[RFLiFileType_Max]; // at 0x1B50 + RFLiSystemCallback systemCb; // at 0x1F10 + RFLIconDrawDoneCallback iconDrawCb; // at 0x1F14 + RFLModelDrawDoneCallback modelDrawCb; // at 0x1F18 + char UNK_0x1F1C[0x4]; +} RFLiManager; + +RFLErrcode RFLiBootLoadAsync(void); +void* RFLiAlloc(u32 size); +void* RFLiAlloc32(u32 size); +void RFLiFree(void* block); +RFLiDBManager* RFLiGetDBManager(void); +RFLiHDBManager* RFLiGetHDBManager(void); +RFLiLoader* RFLiGetLoader(void); +BOOL RFLiGetWorking(void); +void RFLiSetWorking(BOOL working); +RFLiManager* RFLiGetManager(void); +RFLiAccessInfo* RFLiGetAccInfo(RFLiFileType type); +RFLiCtrlBufManager* RFLiGetCtrlBufManager(void); +s32 RFLiGetLastReason(void); +void RFLiSetFileBroken(RFLiFileBrokenType type); +BOOL RFLiNotFoundError(void); +BOOL RFLiNeedRepairError(void); +BOOL RFLiCriticalError(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Texture.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Texture.h new file mode 100644 index 0000000000..0a1683fafd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Texture.h @@ -0,0 +1,41 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_TEXTURE_H +#define RVL_FACE_LIBRARY_INTERNAL_TEXTURE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct RFLiTexture { + u8 format; // at 0x0 + u8 alpha; // at 0x1 + u16 width; // at 0x2 + u16 height; // at 0x4 + u8 wrapS; // at 0x6 + u8 wrapT; // at 0x7 + u8 indexTexture; // at 0x8 + u8 colorFormat; // at 0x9 + u16 numColors; // at 0xA + u32 paletteOfs; // at 0xC + u8 enableLOD; // at 0x10 + u8 enableEdgeLOD; // at 0x11 + u8 enableBiasClamp; // at 0x12 + u8 enableMaxAniso; // at 0x13 + u8 minFilt; // at 0x14 + u8 magFilt; // at 0x15 + s8 minLOD; // at 0x16 + s8 maxLOD; // at 0x16 + u8 mipmapLevel; // at 0x18 + s8 reserved; // at 0x19 + s16 lodBias; // at 0x1A + u32 imageOfs; // at 0x1C +} RFLiTexture; + +inline void* RFLiGetTexImage(const RFLiTexture* tex) { + return (u8*)tex + tex->imageOfs; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Types.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Types.h new file mode 100644 index 0000000000..a8ebb21763 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RFLi_Types.h @@ -0,0 +1,143 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_TYPES_H +#define RVL_FACE_LIBRARY_INTERNAL_TYPES_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Common types used throughout many RFL files. + * + * To avoid circular depencies, common structures and all enums have been moved + * here. + * + * Everything is organized in alphabetical order (when possible, otherwise + * dependency order). + */ + +/** + * Common enums + */ + +typedef enum { + RFLiArcID_Beard, + RFLiArcID_Eye, + RFLiArcID_Eyebrow, + RFLiArcID_Faceline, + RFLiArcID_FaceTex, + RFLiArcID_ForeHead, + RFLiArcID_Glass, + RFLiArcID_GlassTex, + RFLiArcID_Hair, + RFLiArcID_Mask, + RFLiArcID_Mole, + RFLiArcID_Mouth, + RFLiArcID_Mustache, + RFLiArcID_Nose, + RFLiArcID_Nline, + RFLiArcID_NlineTex, + RFLiArcID_Cap, + RFLiArcID_CapTex, + RFLiArcID_Max +} RFLiArcID; + +typedef enum { + RFLiAsyncTag_WriteFile, + RFLiAsyncTag_WriteCloseFile, + RFLiAsyncTag_ReadFile, + RFLiAsyncTag_ReadCloseFile, + RFLiAsyncTag_ReadCache, + RFLiAsyncTag_ReadCacheClose, + RFLiAsyncTag_WriteHDBFile, + RFLiAsyncTag_WriteHDBFileClose, + RFLiAsyncTag_ReadHDBFile, + RFLiAsyncTag_ReadHDBFileClose, + RFLiAsyncTag_CreateAsync, + RFLiAsyncTag_OpenAsync, + RFLiAsyncTag_SeekAsync, + RFLiAsyncTag_ReadAsync, + RFLiAsyncTag_WriteAsync, + RFLiAsyncTag_CloseAsync, + RFLiAsyncTag_GetLengthAsync, + RFLiAsyncTag_DeleteAsync, + RFLiAsyncTag_CreateDirAsync, + + RFLiAsyncTag_Max +} RFLiAsyncTag; + +typedef enum { + RFLiFileBrokenType_DBNotFound, + RFLiFileBrokenType_DBBroken, + RFLiFileBrokenType_ResBroken, + RFLiFileBrokenType_Corrupt, + + RFLiFileBrokenType_Max +} RFLiFileBrokenType; + +typedef enum { + RFLiFileType_Database, + RFLiFileType_Resource, + + RFLiFileType_Max +} RFLiFileType; + +typedef enum { + RFLi_MASKRSL_32 = 32, + RFLi_MASKRSL_64 = 64, + RFLi_MASKRSL_128 = 128, + RFLi_MASKRSL_256 = 256 +} RFLi_MASKRSL; + +typedef enum { + RFLiOpenType_Multi, + RFLiOpenType_Single, + RFLiOpenType_Opened +} RFLiOpenType; + +typedef enum { + RFLiPartsShp_Nose, + RFLiPartsShp_Forehead, + RFLiPartsShp_Faceline, + RFLiPartsShp_Hair, + RFLiPartsShp_Cap, + RFLiPartsShp_Beard, + RFLiPartsShp_Noseline, + RFLiPartsShp_Mask, + RFLiPartsShp_Glass, + + RFLiPartsShp_Max +} RFLiPartsShp; + +typedef enum { + RFLiPartsShpTex_Face, + RFLiPartsShpTex_Cap, + RFLiPartsShpTex_Noseline, + RFLiPartsShpTex_Glass, + + RFLiPartsShpTex_Max +} RFLiPartsShpTex; + +typedef enum { + RFLiPartsTex_Eye, + RFLiPartsTex_Eyebrow, + RFLiPartsTex_Mouth, + RFLiPartsTex_Mustache, + RFLiPartsTex_Mole, + + RFLiPartsTex_Max +} RFLiPartsTex; + +/** + * Common typedefs + */ + +typedef void (*RFLiSystemCallback)(void); +typedef void (*RFLiAccessCallback)(void); +typedef void (*RFLiAlarmCallback)(RFLiFileType type); +typedef void (*RFLiDatabaseCallback)(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RVLFaceLibInternal.h b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RVLFaceLibInternal.h new file mode 100644 index 0000000000..215ac49edd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/RVLFaceLib/RVLFaceLibInternal.h @@ -0,0 +1,24 @@ +#ifndef RVL_FACE_LIBRARY_INTERNAL_H +#define RVL_FACE_LIBRARY_INTERNAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI.h new file mode 100644 index 0000000000..c953e2ff58 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI.h @@ -0,0 +1,17 @@ +/** + * References: YAGCD + */ + +#ifndef RVL_SDK_PUBLIC_AI_H +#define RVL_SDK_PUBLIC_AI_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai.h new file mode 100644 index 0000000000..87a9633b70 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai.h @@ -0,0 +1,30 @@ +#ifndef RVL_SDK_AI_H +#define RVL_SDK_AI_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSContext OSContext; + +typedef void (*AIDMACallback)(void); + +typedef enum { + AI_DSP_32KHZ, + AI_DSP_48KHZ, +} AIDSPSampleRate; + +AIDMACallback AIRegisterDMACallback(AIDMACallback callback); +void AIInitDMA(void* buffer, u32 length); +void AIStartDMA(void); +u32 AIGetDMABytesLeft(void); +void AISetDSPSampleRate(u32 rate); +u32 AIGetDSPSampleRate(void); +void AIInit(void* stack); +void __AIDHandler(s16 intr, OSContext* ctx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai_hardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai_hardware.h new file mode 100644 index 0000000000..b132ea4b20 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AI/ai_hardware.h @@ -0,0 +1,39 @@ +#ifndef RVL_SDK_AI_HARDWARE_H +#define RVL_SDK_AI_HARDWARE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * AI hardware registers + */ +volatile u32 AI_HW_REGS[] +#ifdef __MWERKS__ +: 0xCD006C00 +#endif +; + +/** + * Hardware register indexes + */ +typedef enum { + AI_AICR, //!< 0xCD006C00 + AI_AIVR, //!< 0xCD006C04 + AI_AISCNT, //!< 0xCD006C08 + AI_AIIT, //!< 0xCD006C0C +}; + +// AICR - AI Control Register +#define AI_AICR_SAMPLERATE (1 << 6) +#define AI_AICR_SCRESET (1 << 5) +#define AI_AICR_AIINTVLD (1 << 4) +#define AI_AICR_AIINT (1 << 3) +#define AI_AICR_AIINTMSK (1 << 2) +#define AI_AICR_AFR (1 << 1) +#define AI_AICR_PSTAT (1 << 0) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC.h new file mode 100644 index 0000000000..d41a24f95b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_ARC_H +#define RVL_SDK_PUBLIC_ARC_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC/arc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC/arc.h new file mode 100644 index 0000000000..e0a7eafbe0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ARC/arc.h @@ -0,0 +1,98 @@ +/** + * Modified from decompilation by riidefi in WiiCore + */ + +#ifndef RVL_SDK_ARC_H +#define RVL_SDK_ARC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { ARC_ENTRY_FILE, ARC_ENTRY_FOLDER } ARCEntryType; + +typedef struct ARCNode { + union { + struct { + u32 is_folder : 8; + u32 name : 24; + }; + u32 packed_type_name; + }; // at 0x0 + + union { + struct { + u32 offset; + u32 size; + } file; + + struct { + u32 parent; + u32 sibling_next; + } folder; + }; // at 0x4 +} ARCNode; + +typedef struct ARCHeader { + u32 magic; // at 0x0 + + struct { + s32 offset; // at 0x4 + s32 size; // at 0x8 + } nodes; + + struct { + s32 offset; // at 0xC + } files; + + char UNK_0x10[0x10]; +} ARCHeader; + +typedef struct ARCHandle { + ARCHeader* header; // at 0x0 + ARCNode* nodes; // at 0x4 + u8* file; // at 0x8 + u32 count; // at 0xC + const char* strings; // at 0x10 + u32 fstSize; // at 0x14 + s32 entrynum; // at 0x18 +} ARCHandle; + +typedef struct ARCFileInfo { + ARCHandle* handle; // at 0x0 + u32 offset; // at 0x4 + u32 size; // at 0x8 +} ARCFileInfo; + +typedef struct ARCEntry { + ARCHandle* handle; // at 0x0 + u32 path; // at 0x4 + ARCEntryType type; // at 0x8 + const char* name; // at 0xC +} ARCEntry; + +typedef struct ARCDir { + ARCHandle* handle; // at 0x0 + u32 path_begin; // at 0x4 + u32 path_it; // at 0x8 + u32 path_end; // at 0xC +} ARCDir; + +BOOL ARCGetCurrentDir(ARCHandle* handle, char* string, u32 maxlen); +BOOL ARCInitHandle(void* bin, ARCHandle* handle); +BOOL ARCOpen(ARCHandle* handle, const char* path, ARCFileInfo* info); +BOOL ARCFastOpen(ARCHandle* handle, s32 entrynum, ARCFileInfo* info); +s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path); +void* ARCGetStartAddrInMem(ARCFileInfo* info); +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); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX.h new file mode 100644 index 0000000000..5e7d7451ea --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX.h @@ -0,0 +1,26 @@ +/** + * References: Dolphin Emulator, Retro Modding Wiki, vgmstream + */ + +#ifndef RVL_SDK_PUBLIC_AX_H +#define RVL_SDK_PUBLIC_AX_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AX.h new file mode 100644 index 0000000000..09c6ca9609 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AX.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_AX_H +#define RVL_SDK_AX_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void AXInit(void); +void AXInitEx(u32 mode); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAlloc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAlloc.h new file mode 100644 index 0000000000..b158c16979 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAlloc.h @@ -0,0 +1,31 @@ +#ifndef RVL_SDK_AX_ALLOC_H +#define RVL_SDK_AX_ALLOC_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AX_PRIORITY_FREE 0 +#define AX_PRIORITY_MIN 1 +#define AX_PRIORITY_MAX 31 + +AXVPB* __AXGetStackHead(u32 prio); +void __AXServiceCallbackStack(void); +void __AXInitVoiceStacks(void); +void __AXAllocInit(void); +void __AXPushFreeStack(AXVPB* vpb); +AXVPB* __AXPopFreeStack(void); +void __AXPushCallbackStack(AXVPB* vpb); +AXVPB* __AXPopCallbackStack(void); +void __AXRemoveFromStack(AXVPB* vpb); +void __AXPushStackHead(AXVPB* vpb, u32 prio); +AXVPB* __AXPopStackFromBottom(u32 prio); +void AXFreeVoice(AXVPB* vpb); +AXVPB* AXAcquireVoice(u32 prio, AXVoiceCallback callback, u32 userContext); +void AXSetVoicePriority(AXVPB* vpb, u32 prio); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAux.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAux.h new file mode 100644 index 0000000000..bdc7216b0a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXAux.h @@ -0,0 +1,62 @@ +#ifndef RVL_SDK_AX_AUX_H +#define RVL_SDK_AX_AUX_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AX_SAMPLES_PER_FRAME 96 +#define AX_SAMPLE_DEPTH_BYTES sizeof(u32) +#define AX_SAMPLES_PER_FRAME_RMT 18 +#define AX_FRAME_SIZE (AX_SAMPLES_PER_FRAME * AX_SAMPLE_DEPTH_BYTES) + +/** + * Stereo: Left, Right, Surround + * DPL2: Left, Right, Left Surround, Right Surround + */ +typedef enum { + AX_STEREO_L, + AX_STEREO_R, + AX_STEREO_S, + + AX_STEREO_MAX +} AXStereoChannel; + +typedef enum { + AX_DPL2_L, + AX_DPL2_R, + AX_DPL2_LS, + AX_DPL2_RS, + + AX_DPL2_MAX +} AXDPL2Channel; + +typedef void (*AXAuxCallback)(void* chans, void* context); + +void __AXAuxInit(void); +void __AXGetAuxAInput(void** out); +void __AXGetAuxAOutput(void** out); +void __AXGetAuxAInputDpl2(void** out); +void __AXGetAuxAOutputDpl2R(void** out); +void __AXGetAuxAOutputDpl2Ls(void** out); +void __AXGetAuxAOutputDpl2Rs(void** out); +void __AXGetAuxBInput(void** out); +void __AXGetAuxBOutput(void** out); +void __AXGetAuxBInputDpl2(void** out); +void __AXGetAuxBOutputDpl2R(void** out); +void __AXGetAuxBOutputDpl2Ls(void** out); +void __AXGetAuxBOutputDpl2Rs(void** out); +void __AXGetAuxCInput(void** out); +void __AXGetAuxCOutput(void** out); +void __AXProcessAux(void); +void AXRegisterAuxACallback(AXAuxCallback callback, void* context); +void AXRegisterAuxBCallback(AXAuxCallback callback, void* context); +void AXRegisterAuxCCallback(AXAuxCallback callback, void* context); +void AXGetAuxACallback(AXAuxCallback* callback, void** context); +void AXGetAuxBCallback(AXAuxCallback* callback, void** context); +void AXGetAuxCCallback(AXAuxCallback* callback, void** context); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXCL.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXCL.h new file mode 100644 index 0000000000..4a865f8f4c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXCL.h @@ -0,0 +1,40 @@ +#ifndef RVL_SDK_AX_CL_H +#define RVL_SDK_AX_CL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AX_MAX_VOLUME 32768 +// Command list can hold up to 64 commands +#define AX_CL_MAX_CMD 64 +// Each command takes up two bytes +#define AX_CL_SIZE (AX_CL_MAX_CMD * sizeof(u16)) + +typedef enum { + AX_OUTPUT_STEREO, + AX_OUTPUT_SURROUND, + AX_OUTPUT_DPL2 +} AXOutputMode; + +extern u32 __AXClMode; + +u32 __AXGetCommandListCycles(void); +void* __AXGetCommandListAddress(void); +void __AXWriteToCommandList(u16 cmd); +void __AXNextFrame(void* surround, void* lr, void* rmt); +void __AXClInit(void); +void AXSetMode(u32 mode); +u32 AXGetMode(void); +u16 AXGetAuxAReturnVolume(void); +u16 AXGetAuxBReturnVolume(void); +u16 AXGetAuxCReturnVolume(void); +void AXSetMasterVolume(u16 volume); +void AXSetAuxAReturnVolume(u16 volume); +void AXSetAuxBReturnVolume(u16 volume); +void AXSetAuxCReturnVolume(u16 volume); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXComp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXComp.h new file mode 100644 index 0000000000..1a8a11230d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXComp.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_AX_COMP_H +#define RVL_SDK_AX_COMP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern u16 __AXCompressorTable[]; + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXOut.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXOut.h new file mode 100644 index 0000000000..3405398e4c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXOut.h @@ -0,0 +1,26 @@ +#ifndef RVL_SDK_AX_OUT_H +#define RVL_SDK_AX_OUT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AX_STREAM_SIZE_RMT 40 +#define AX_RMT_MAX 4 + +typedef void (*AXOutCallback)(void); +typedef void (*AXExceedCallback)(u32 cycles); + +u32 __AXOutNewFrame(void); +void __AXOutAiCallback(void); +void __AXOutInitDSP(void); +void __AXOutInit(u32 mode); +AXOutCallback AXRegisterCallback(AXOutCallback callback); +s32 AXRmtGetSamplesLeft(void); +s32 AXRmtGetSamples(s32 chan, s16* out, s32 num); +s32 AXRmtAdvancePtr(s32 num); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXPB.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXPB.h new file mode 100644 index 0000000000..c5f06685f1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXPB.h @@ -0,0 +1,280 @@ +#ifndef RVL_SDK_AX_PB_H +#define RVL_SDK_AX_PB_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * One frame contains eight bytes: + * - One for the header + * - Seven for the audio samples + */ +#define AX_ADPCM_FRAME_SIZE 8 +#define AX_ADPCM_SAMPLE_BYTES_PER_FRAME (AX_ADPCM_FRAME_SIZE - 1) + +// Two audio samples per byte (each nibble) +#define AX_ADPCM_SAMPLES_PER_BYTE 2 + +// Amount of audio samples in a frame +#define AX_ADPCM_SAMPLES_PER_FRAME \ + (AX_ADPCM_SAMPLE_BYTES_PER_FRAME * AX_ADPCM_SAMPLES_PER_BYTE) + +// Amount of nibbles in a frame +#define AX_ADPCM_NIBBLES_PER_FRAME (AX_ADPCM_FRAME_SIZE * 2) + +typedef enum { AX_VOICE_NORMAL, AX_VOICE_STREAM } AXVOICETYPE; + +typedef enum { AX_VOICE_STOP, AX_VOICE_RUN } AXVOICESTATE; + +typedef enum { + AX_SAMPLE_FORMAT_DSP_ADPCM = 0, + AX_SAMPLE_FORMAT_PCM_S16 = 10, + AX_SAMPLE_FORMAT_PCM_S8 = 25, +} AXSAMPLETYPE; + +// For rmtIIR union I think? From NW4R asserts, but fits well in __AXSyncPBs +typedef enum { + AX_PB_LPF_ON = 1, + AX_PB_BIQUAD_ON, +}; + +typedef enum { + AX_SRC_TYPE_NONE, + AX_SRC_TYPE_LINEAR, + AX_SRC_TYPE_4TAP_8K, + AX_SRC_TYPE_4TAP_12K, + AX_SRC_TYPE_4TAP_16K, + AX_SRC_TYPE_4TAP_AUTO +} AXPBSRCTYPE; + +typedef enum { + AX_MIXER_CTRL_L = (1 << 0), + AX_MIXER_CTRL_R = (1 << 1), + AX_MIXER_CTRL_DELTA = (1 << 2), + AX_MIXER_CTRL_S = (1 << 3), + AX_MIXER_CTRL_DELTA_S = (1 << 4), + + AX_MIXER_CTRL_AL = (1 << 16), + AX_MIXER_CTRL_AR = (1 << 17), + AX_MIXER_CTRL_DELTA_A = (1 << 18), + AX_MIXER_CTRL_AS = (1 << 19), + AX_MIXER_CTRL_DELTA_AS = (1 << 20), + + AX_MIXER_CTRL_BL = (1 << 21), + AX_MIXER_CTRL_BR = (1 << 22), + AX_MIXER_CTRL_DELTA_B = (1 << 23), + AX_MIXER_CTRL_BS = (1 << 24), + AX_MIXER_CTRL_DELTA_BS = (1 << 25), + + AX_MIXER_CTRL_CL = (1 << 26), + AX_MIXER_CTRL_CR = (1 << 27), + AX_MIXER_CTRL_DELTA_C = (1 << 28), + AX_MIXER_CTRL_CS = (1 << 29), + AX_MIXER_CTRL_DELTA_CS = (1 << 30) +}; + +typedef enum { + AX_MIXER_CTRL_RMT_M0 = (1 << 0), + AX_MIXER_CTRL_RMT_DELTA_M0 = (1 << 1), + AX_MIXER_CTRL_RMT_A0 = (1 << 2), + AX_MIXER_CTRL_RMT_DELTA_A0 = (1 << 3), + + AX_MIXER_CTRL_RMT_M1 = (1 << 4), + AX_MIXER_CTRL_RMT_DELTA_M1 = (1 << 5), + AX_MIXER_CTRL_RMT_A1 = (1 << 6), + AX_MIXER_CTRL_RMT_DELTA_A1 = (1 << 7), + + AX_MIXER_CTRL_RMT_M2 = (1 << 8), + AX_MIXER_CTRL_RMT_DELTA_M2 = (1 << 9), + AX_MIXER_CTRL_RMT_A2 = (1 << 10), + AX_MIXER_CTRL_RMT_DELTA_A2 = (1 << 11), + + AX_MIXER_CTRL_RMT_M3 = (1 << 12), + AX_MIXER_CTRL_RMT_DELTA_M3 = (1 << 13), + AX_MIXER_CTRL_RMT_A3 = (1 << 14), + AX_MIXER_CTRL_RMT_DELTA_A3 = (1 << 15) +}; + +typedef struct _AXPBMIX { + u16 vL; // at 0x0 + u16 vDeltaL; // at 0x2 + u16 vR; // at 0x4 + u16 vDeltaR; // at 0x6 + u16 vAuxAL; // at 0x8 + u16 vDeltaAuxAL; // at 0xA + u16 vAuxAR; // at 0xC + u16 vDeltaAuxAR; // at 0xE + u16 vAuxBL; // at 0x10 + u16 vDeltaAuxBL; // at 0x12 + u16 vAuxBR; // at 0x14 + u16 vDeltaAuxBR; // at 0x16 + u16 vAuxCL; // at 0x18 + u16 vDeltaAuxCL; // at 0x1A + u16 vAuxCR; // at 0x1C + u16 vDeltaAuxCR; // at 0x1E + u16 vS; // at 0x20 + u16 vDeltaS; // at 0x22 + u16 vAuxAS; // at 0x24 + u16 vDeltaAuxAS; // at 0x26 + u16 vAuxBS; // at 0x28 + u16 vDeltaAuxBS; // at 0x2A + u16 vAuxCS; // at 0x2C + u16 vDeltaAuxCS; // at 0x2E +} AXPBMIX; + +typedef struct _AXPBITD { + u16 flag; // at 0x0 + u16 bufferHi; // at 0x2 + u16 bufferLo; // at 0x4 + u16 shiftL; // at 0x6 + u16 shiftR; // at 0x8 + u16 targetShiftL; // at 0xA + u16 targetShiftR; // at 0xC +} AXPBITD; + +typedef struct _AXPBDPOP { + s16 aL; // at 0x0 + s16 aAuxAL; // at 0x2 + s16 aAuxBL; // at 0x4 + s16 aAuxCL; // at 0x6 + s16 aR; // at 0x8 + s16 aAuxAR; // at 0xA + s16 aAuxBR; // at 0xC + s16 aAuxCR; // at 0xE + s16 aS; // at 0x10 + s16 aAuxAS; // at 0x12 + s16 aAuxBS; // at 0x14 + s16 aAuxCS; // at 0x16 +} AXPBDPOP; + +typedef struct _AXPBVE { + u16 currentVolume; // at 0x0 + s16 currentDelta; // at 0x2 +} AXPBVE; + +typedef struct _AXPBADDR { + u16 loopFlag; // at 0x0 + u16 format; // at 0x2 + u16 loopAddressHi; // at 0x4 + u16 loopAddressLo; // at 0x6 + u16 endAddressHi; // at 0x8 + u16 endAddressLo; // at 0xA + u16 currentAddressHi; // at 0xC + u16 currentAddressLo; // at 0xE +} AXPBADDR; + +typedef struct _AXPBADPCM { + u16 a[8][2]; // at 0x0 + u16 gain; // at 0x20 + u16 pred_scale; // at 0x22 + u16 yn1; // at 0x24 + u16 yn2; // at 0x26 +} AXPBADPCM; + +typedef struct _AXPBSRC { + u16 ratioHi; // at 0x0 + u16 ratioLo; // at 0x2 + u16 currentAddressFrac; // at 0x4 + u16 last_samples[4]; // at 0x6 +} AXPBSRC; + +typedef struct _AXPBADPCMLOOP { + u16 loop_pred_scale; // at 0x0 + u16 loop_yn1; // at 0x2 + u16 loop_yn2; // at 0x4 +} AXPBADPCMLOOP; + +typedef struct _AXPBLPF { + u16 on; // at 0x0 + u16 yn1; // at 0x2 + u16 a0; // at 0x4 + u16 b0; // at 0x6 +} AXPBLPF; + +typedef struct _AXPBBIQUAD { + u16 on; // at 0x0 + u16 xn1; // at 0x2 + u16 xn2; // at 0x4 + u16 yn1; // at 0x6 + u16 yn2; // at 0x8 + u16 b0; // at 0xA + u16 b1; // at 0xC + u16 b2; // at 0xE + u16 a1; // at 0x10 + u16 a2; // at 0x12 +} AXPBBIQUAD; + +typedef struct _AXPBRMTMIX { + u16 vMain0; // at 0x0 + u16 vDeltaMain0; // at 0x2 + u16 vAux0; // at 0x4 + u16 vDeltaAux0; // at 0x6 + u16 vMain1; // at 0x8 + u16 vDeltaMain1; // at 0xA + u16 vAux1; // at 0xC + u16 vDeltaAux1; // at 0xE + u16 vMain2; // at 0x10 + u16 vDeltaMain2; // at 0x12 + u16 vAux2; // at 0x14 + u16 vDeltaAux2; // at 0x16 + u16 vMain3; // at 0x18 + u16 vDeltaMain3; // at 0x1A + u16 vAux3; // at 0x1C + u16 vDeltaAux3; // at 0x1E +} AXPBRMTMIX; + +typedef struct _AXPBRMTDPOP { + s16 aMain0; // at 0x0 + s16 aMain1; // at 0x2 + s16 aMain2; // at 0x4 + s16 aMain3; // at 0x6 + s16 aAux0; // at 0x8 + s16 aAux1; // at 0xA + s16 aAux2; // at 0xC + s16 aAux3; // at 0xE +} AXPBRMTDPOP; + +typedef struct _AXPBRMTSRC { + u16 currentAddressFrac; // at 0x0 + u16 last_samples[4]; // at 0x2 +} AXPBRMTSRC; + +typedef union __AXPBRMTIIR { + AXPBLPF lpf; + AXPBBIQUAD biquad; +} AXPBRMTIIR; + +typedef struct _AXPB { + u16 nextHi; // at 0x0 + u16 nextLo; // at 0x2 + u16 currHi; // at 0x4 + u16 currLo; // at 0x6 + u16 srcSelect; // at 0x8 + u16 coefSelect; // at 0xA + u32 mixerCtrl; // at 0xC + u16 state; // at 0x10 + u16 type; // at 0x12 + AXPBMIX mix; // at 0x14 + AXPBITD itd; // at 0x44 + AXPBDPOP dpop; // at 0x52 + AXPBVE ve; // at 0x6A + AXPBADDR addr; // at 0x6E + AXPBADPCM adpcm; // at 0x7E + AXPBSRC src; // at 0xA6 + AXPBADPCMLOOP adpcmLoop; // at 0xB4 + AXPBLPF lpf; // at 0xBA + AXPBBIQUAD biquad; // at 0xC2 + u16 remote; // at 0xD6 + u16 rmtMixerCtrl; // at 0xD8 + AXPBRMTMIX rmtMix; // at 0xDA + AXPBRMTDPOP rmtDpop; // at 0xFA + AXPBRMTSRC rmtSrc; // at 0x10A + AXPBRMTIIR rmtIIR; // at 0x114 + u8 padding[0x140 - 0x128]; // at 0x128 +} AXPB; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXProf.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXProf.h new file mode 100644 index 0000000000..db4286af6a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXProf.h @@ -0,0 +1,24 @@ +#ifndef RVL_SDK_AX_PROF_H +#define RVL_SDK_AX_PROF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _AXPROFILE { + s64 timeBegin; // at 0x0 + s64 timeProcessAuxBegin; // at 0x8 + s64 timeProcessAuxEnd; // at 0x10 + s64 timeUserFrameBegin; // at 0x18 + s64 timeUserFrameEnd; // at 0x20 + s64 timeEnd; // at 0x28 + s32 numVoices; // at 0x30 + UNKWORD WORD_0x34; +} AXPROFILE; + +AXPROFILE* __AXGetCurrentProfile(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXSPB.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXSPB.h new file mode 100644 index 0000000000..a0956a40fd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXSPB.h @@ -0,0 +1,82 @@ +#ifndef RVL_SDK_AX_SPB_H +#define RVL_SDK_AX_SPB_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(push, 1) +typedef struct _AXSTUDIO { + s32 L; + s16 dL; + + s32 R; + s16 dR; + + s32 S; + s16 dS; + + s32 AuxAL; + s16 dAuxAL; + + s32 AuxAR; + s16 dAuxAR; + + s32 AuxAS; + s16 dAuxAS; + + s32 AuxBL; + s16 dAuxBL; + + s32 AuxBR; + s16 dAuxBR; + + s32 AuxBS; + s16 dAuxBS; + + s32 AuxCL; + s16 dAuxCL; + + s32 AuxCR; + s16 dAuxCR; + + s32 AuxCS; + s16 dAuxCS; + + s32 Main0; + s16 dMain0; + + s32 Aux0; + s16 dAux0; + + s32 Main1; + s16 dMain1; + + s32 Aux1; + s16 dAux1; + + s32 Main2; + s16 dMain2; + + s32 Aux2; + s16 dAux2; + + s32 Main3; + s16 dMain3; + + s32 Aux3; + s16 dAux3; +} AXSTUDIO; +#pragma pack(pop) + +AXSTUDIO* __AXGetStudio(void); +void __AXDepopFadeMain(s32* all, s32* value, s16* depop) DECOMP_DONT_INLINE; +void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) DECOMP_DONT_INLINE; +void __AXPrintStudio(void); +void __AXSPBInit(void); +void __AXDepopVoice(AXPB* pb); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXVPB.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXVPB.h new file mode 100644 index 0000000000..8b243c896f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/AXVPB.h @@ -0,0 +1,79 @@ +#ifndef RVL_SDK_AX_VPB_H +#define RVL_SDK_AX_VPB_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define AX_SAMPLE_RATE 32000 +#define AX_VOICE_MAX 96 + +typedef enum { + AX_PBSYNC_SELECT = (1 << 0), + AX_PBSYNC_MIXER_CTRL = (1 << 1), + AX_PBSYNC_STATE = (1 << 2), + AX_PBSYNC_TYPE = (1 << 3), + AX_PBSYNC_MIX = (1 << 4), + AX_PBSYNC_ITD = (1 << 5), + AX_PBSYNC_ITD_SHIFT = (1 << 6), + AX_PBSYNC_DPOP = (1 << 7), + AX_PBSYNC_VE = (1 << 8), + AX_PBSYNC_VE_DELTA = (1 << 9), + AX_PBSYNC_ADDR = (1 << 10), + AX_PBSYNC_LOOP_FLAG = (1 << 11), + AX_PBSYNC_LOOP_ADDR = (1 << 12), + AX_PBSYNC_END_ADDR = (1 << 13), + AX_PBSYNC_CURR_ADDR = (1 << 14), + AX_PBSYNC_ADPCM = (1 << 15), + AX_PBSYNC_SRC = (1 << 16), + AX_PBSYNC_SRC_RATIO = (1 << 17), + AX_PBSYNC_ADPCM_LOOP = (1 << 18), + AX_PBSYNC_LPF = (1 << 19), + AX_PBSYNC_LPF_COEFS = (1 << 20), + AX_PBSYNC_BIQUAD = (1 << 21), + AX_PBSYNC_BIQUAD_COEFS = (1 << 22), + AX_PBSYNC_REMOTE = (1 << 23), + AX_PBSYNC_RMT_MIXER_CTRL = (1 << 24), + AX_PBSYNC_RMTMIX = (1 << 25), + AX_PBSYNC_RMTDPOP = (1 << 26), + AX_PBSYNC_RMTSRC = (1 << 27), + AX_PBSYNC_RMTIIR = (1 << 28), + AX_PBSYNC_RMTIIR_LPF_COEFS = (1 << 29), + AX_PBSYNC_RMTIIR_BIQUAD_COEFS = (1 << 30), + AX_PBSYNC_ALL = (1 << 31), +}; + +typedef void (*AXVoiceCallback)(void* vpb); + +typedef struct _AXVPB { + void* next; // at 0x0 + void* prev; // at 0x4 + void* next1; // at 0x8 + u32 priority; // at 0xC + AXVoiceCallback callback; // at 0x10 + u32 userContext; // at 0x14 + u32 index; // at 0x18 + u32 sync; // at 0x1C + u32 depop; // at 0x20 + void* itdBuffer; // at 0x24 + AXPB pb; // at 0x28 +} AXVPB; + +s32 __AXGetNumVoices(void); +void __AXServiceVPB(AXVPB* vpb); +void __AXDumpVPB(AXVPB* vpb); +void __AXSyncPBs(u32 baseCycles); +AXPB* __AXGetPBs(void); +void __AXSetPBDefault(AXVPB* vpb); +void __AXVPBInit(void); +void AXSetVoiceState(AXVPB* vpb, u16 state); +void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr); +void AXGetLpfCoefs(u16 freq, u16* a, u16* b); +void AXSetMaxDspCycles(u32 num); +s32 AXGetMaxVoices(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/DSPCode.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/DSPCode.h new file mode 100644 index 0000000000..2b3b0a655f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AX/DSPCode.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_AX_DSP_CODE_H +#define RVL_SDK_AX_DSP_CODE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern u16 axDspInitVector; +extern u16 axDspResumeVector; + +extern u8 axDspSlave[]; +extern u16 axDspSlaveLength; + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX.h new file mode 100644 index 0000000000..7dc382e707 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX.h @@ -0,0 +1,22 @@ +#ifndef RVL_SDK_PUBLIC_AXFX_H +#define RVL_SDK_PUBLIC_AXFX_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorus.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorus.h new file mode 100644 index 0000000000..a9315ba2ca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorus.h @@ -0,0 +1,25 @@ +#ifndef RVL_SDK_AXFX_CHORUS_H +#define RVL_SDK_AXFX_CHORUS_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AXFX_CHORUS { + AXFX_CHORUS_EXP exp; // at 0x0 + u32 baseDelay; // at 0xA0 + u32 variation; // at 0xA4 + u32 period; // at 0xA8 +} AXFX_CHORUS; + +u32 AXFXChorusGetMemSize(const AXFX_CHORUS* fx); +BOOL AXFXChorusInit(AXFX_CHORUS* fx); +BOOL AXFXChorusShutdown(AXFX_CHORUS* fx); +BOOL AXFXChorusSettings(AXFX_CHORUS* fx); +void AXFXChorusCallback(void* chans, void* context); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorusExp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorusExp.h new file mode 100644 index 0000000000..5b02497ad4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXChorusExp.h @@ -0,0 +1,59 @@ +#ifndef RVL_SDK_AXFX_CHORUS_EXP_H +#define RVL_SDK_AXFX_CHORUS_EXP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct AXFX_BUS AXFX_BUS; +typedef struct AXFX_BUFFERUPDATE AXFX_BUFFERUPDATE; + +typedef struct AXFX_CHORUS_EXP_DELAY { + f32* line[3]; // at 0x0 + u32 inPos; // at 0xC + u32 outPos; // at 0x10 + u32 lastPos; // at 0x14 + u32 sizeFP; // at 0x18 + u32 size; // at 0x1C +} AXFX_CHORUS_EXP_DELAY; + +typedef struct AXFX_CHORUS_EXP_LFO { + s32* table; // at 0x0 + s32 phaseAdd; // at 0x4 + s32 stepSamp; // at 0x8 + s32 depthSamp; // at 0xC + u32 phase; // at 0x10 + u32 sign; // at 0x14 + u32 lastNum; // at 0x18 + s32 lastValue; // at 0x1C + s32 grad; // at 0x20 + s32 gradFactor; // at 0x24 +} AXFX_CHORUS_EXP_LFO; + +typedef struct AXFX_CHORUS_EXP { + AXFX_CHORUS_EXP_DELAY delay; // at 0x0 + AXFX_CHORUS_EXP_LFO lfo; // at 0x20 + f32 history[3][4]; // at 0x48 + u32 histIndex; // at 0x78 + u32 active; // at 0x7C + f32 delayTime; // at 0x80 + f32 depth; // at 0x84 + f32 rate; // at 0x88 + f32 feedback; // at 0x8C + AXFX_BUS* busIn; // at 0x90 + AXFX_BUS* busOut; // at 0x94 + f32 outGain; // at 0x98 + f32 sendGain; // at 0x9C +} AXFX_CHORUS_EXP; + +u32 AXFXChorusExpGetMemSize(const AXFX_CHORUS_EXP* fx); +BOOL AXFXChorusExpInit(AXFX_CHORUS_EXP* fx); +void AXFXChorusExpShutdown(AXFX_CHORUS_EXP* fx); +BOOL AXFXChorusExpSettings(AXFX_CHORUS_EXP* fx); +void AXFXChorusExpCallback(AXFX_BUFFERUPDATE* update, AXFX_CHORUS_EXP* fx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXCommon.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXCommon.h new file mode 100644 index 0000000000..71013cf805 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXCommon.h @@ -0,0 +1,30 @@ +#ifndef RVL_SDK_AXFX_COMMON_H +#define RVL_SDK_AXFX_COMMON_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AXFX_BUS { + s32* left; // at 0x0 + s32* right; // at 0x4 + s32* surround; // at 0x8 +} AXFX_BUS; + +typedef struct AXFX_BUFFERUPDATE { + s32* left; // at 0x0 + s32* right; // at 0x4 + s32* surround; // at 0x8 +} AXFX_BUFFERUPDATE; + +typedef struct AXFX_BUFFERUPDATE_DPL2 { + s32* left; // at 0x0 + s32* right; // at 0x4 + s32* left_surround; // at 0x8 + s32* right_surround; // at 0xC +} AXFX_BUFFERUPDATE_DPL2; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXDelay.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXDelay.h new file mode 100644 index 0000000000..3a11b84ff9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXDelay.h @@ -0,0 +1,29 @@ +#ifndef RVL_SDK_AXFX_DELAY_H +#define RVL_SDK_AXFX_DELAY_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AXFX_DELAY { + s32* line[3]; // at 0x0 + u32 curPos[3]; // at 0xC + u32 length[3]; // at 0x18 + s32 feedbackGain[3]; // at 0x24 + s32 outGain[3]; // at 0x30 + u32 active; // at 0x3C + u32 delay[3]; // at 0x40 + u32 feedback[3]; // at 0x4C + u32 output[3]; // at 0x58 +} AXFX_DELAY; + +u32 AXFXDelayGetMemSize(const AXFX_DELAY* fx); +BOOL AXFXDelayInit(AXFX_DELAY* fx); +BOOL AXFXDelaySettings(AXFX_DELAY* fx); +void AXFXDelayShutdown(AXFX_DELAY* fx); +void AXFXDelayCallback(void* chans, void* context); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXHooks.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXHooks.h new file mode 100644 index 0000000000..01cce851e8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXHooks.h @@ -0,0 +1,20 @@ +#ifndef RVL_SDK_AXFX_HOOKS_H +#define RVL_SDK_AXFX_HOOKS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* (*AXFXAllocHook)(size_t size); +typedef void (*AXFXFreeHook)(void* block); + +extern AXFXAllocHook __AXFXAlloc; +extern AXFXFreeHook __AXFXFree; + +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free); +void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXLfoTable.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXLfoTable.h new file mode 100644 index 0000000000..6de23d9b95 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXLfoTable.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_AXFX_LFO_TABLE_H +#define RVL_SDK_AXFX_LFO_TABLE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +s32* __AXFXGetLfoSinTable(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHi.h new file mode 100644 index 0000000000..0430b99832 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHi.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_AXFX_REVERB_HI_H +#define RVL_SDK_AXFX_REVERB_HI_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AXFX_REVERBHI { + AXFX_REVERBHI_EXP exp; // at 0x0 + f32 coloration; // at 0x148 + f32 mix; // at 0x14C + f32 time; // at 0x150 + f32 damping; // at 0x154 + f32 preDelay; // at 0x158 + f32 crosstalk; // at 0x15C +} AXFX_REVERBHI; + +u32 AXFXReverbHiGetMemSize(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiSettings(AXFX_REVERBHI* fx); +void AXFXReverbHiCallback(void* chans, void* context); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiDpl2.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiDpl2.h new file mode 100644 index 0000000000..1e11240d96 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiDpl2.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_AXFX_REVERB_HI_DPL2_H +#define RVL_SDK_AXFX_REVERB_HI_DPL2_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct AXFX_REVERBHI_DPL2 { + AXFX_REVERBHI_EXP_DPL2 exp; // at 0x0 + f32 coloration; // at 0x148 + f32 mix; // at 0x14C + f32 time; // at 0x150 + f32 damping; // at 0x154 + f32 preDelay; // at 0x158 + f32 crosstalk; // at 0x15C +} AXFX_REVERBHI_DPL2; + +u32 AXFXReverbHiGetMemSizeDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiShutdownDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiSettingsDpl2(AXFX_REVERBHI_DPL2* fx); +void AXFXReverbHiCallbackDpl2(void* chans, void* context); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExp.h new file mode 100644 index 0000000000..f4081a3ba0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExp.h @@ -0,0 +1,69 @@ +#ifndef RVL_SDK_AXFX_REVERB_HI_EXP_H +#define RVL_SDK_AXFX_REVERB_HI_EXP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct AXFX_BUS AXFX_BUS; +typedef struct AXFX_BUFFERUPDATE AXFX_BUFFERUPDATE; + +typedef struct AXFX_REVERBHI_EXP { + f32* earlyLine[3]; // at 0x0 + u32 earlyPos[3]; // at 0xC + u32 earlyLength; // at 0x18 + u32 earlyMaxLength; // at 0x1C + f32 earlyCoef[3]; // at 0x20 + + f32* preDelayLine[3]; // at 0x2C + u32 preDelayPos; // at 0x38 + u32 preDelayLength; // at 0x3C + u32 preDelayMaxLength; // at 0x40 + + f32* combLine[3][3]; // at 0x44 + u32 combPos[3]; // at 0x68 + u32 combLength[3]; // at 0x74 + u32 combMaxLength[3]; // at 0x80 + f32 combCoef[3]; // at 0x8C + + f32* allpassLine[3][2]; // at 0x98 + u32 allpassPos[2]; // at 0xB0 + u32 allpassLength[2]; // at 0xB8 + u32 allpassMaxLength[2]; // at 0xC0 + + f32* lastAllpassLine[3]; // at 0xC8 + u32 lastAllpassPos[3]; // at 0xD4 + u32 lastAllpassLength[3]; // at 0xE0 + u32 lastAllpassMaxLength[3]; // at 0xEC + + f32 allpassCoef; // at 0xF8 + f32 lastLpfOut[3]; // at 0xFC + f32 lpfCoef; // at 0x108 + u32 active; // at 0x10C + u32 earlyMode; // at 0x110 + f32 preDelayTimeMax; // at 0x114 + f32 preDelayTime; // at 0x118 + u32 fusedMode; // at 0x11C + f32 fusedTime; // at 0x120 + f32 coloration; // at 0x124 + f32 damping; // at 0x128 + f32 crosstalk; // at 0x12C + f32 earlyGain; // at 0x130 + f32 fusedGain; // at 0x134 + AXFX_BUS* busIn; // at 0x138 + AXFX_BUS* busOut; // at 0x13C + f32 outGain; // at 0x140 + f32 sendGain; // at 0x144 +} AXFX_REVERBHI_EXP; + +u32 AXFXReverbHiExpGetMemSize(const AXFX_REVERBHI_EXP* fx); +BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx); +BOOL AXFXReverbHiExpSettings(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* update, AXFX_REVERBHI_EXP* fx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExpDpl2.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExpDpl2.h new file mode 100644 index 0000000000..04b34d35c7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXReverbHiExpDpl2.h @@ -0,0 +1,70 @@ +#ifndef RVL_SDK_AXFX_REVERB_HI_EXP_DPL2_H +#define RVL_SDK_AXFX_REVERB_HI_EXP_DPL2_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct AXFX_BUS AXFX_BUS; +typedef struct AXFX_BUFFERUPDATE AXFX_BUFFERUPDATE; + +typedef struct AXFX_REVERBHI_EXP_DPL2 { + f32* earlyLine[4]; // at 0x0 + u32 earlyPos[3]; // at 0x10 + u32 earlyLength; // at 0x1C + u32 earlyMaxLength; // at 0x20 + f32 earlyCoef[3]; // at 0x24 + + f32* preDelayLine[4]; // at 0x30 + u32 preDelayPos; // at 0x40 + u32 preDelayLength; // at 0x44 + u32 preDelayMaxLength; // at 0x48 + + f32* combLine[4][3]; // at 0x4C + u32 combPos[3]; // at 0x7C + u32 combLength[3]; // at 0x88 + u32 combMaxLength[3]; // at 0x94 + f32 combCoef[3]; // at 0xA0 + + f32* allpassLine[4][2]; // at 0xAC + u32 allpassPos[2]; // at 0xCC + u32 allpassLength[2]; // at 0xD4 + u32 allpassMaxLength[2]; // at 0xDC + + f32* lastAllpassLine[4]; // at 0xE4 + u32 lastAllpassPos[4]; // at 0xF4 + u32 lastAllpassLength[4]; // at 0x104 + u32 lastAllpassMaxLength[4]; // at 0x114 + + f32 allpassCoef; // at 0x124 + f32 lastLpfOut[4]; // at 0x128 + f32 lpfCoef; // at 0x138 + u32 active; // at 0x13C + u32 earlyMode; // at 0x140 + f32 preDelayTimeMax; // at 0x144 + f32 preDelayTime; // at 0x148 + u32 fusedMode; // at 0x14C + f32 fusedTime; // at 0x150 + f32 coloration; // at 0x154 + f32 damping; // at 0x158 + f32 crosstalk; // at 0x15C + f32 earlyGain; // at 0x160 + f32 fusedGain; // at 0x164 + AXFX_BUS* busIn; // at 0x168 + AXFX_BUS* busOut; // at 0x16C + f32 outGain; // at 0x170 + f32 sendGain; // at 0x174 +} AXFX_REVERBHI_EXP_DPL2; + +u32 AXFXReverbHiExpGetMemSizeDpl2(const AXFX_REVERBHI_EXP_DPL2* fx); +BOOL AXFXReverbHiExpInitDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +void AXFXReverbHiExpShutdownDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +BOOL AXFXReverbHiExpSettingsDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +void AXFXReverbHiExpCallbackDpl2(AXFX_BUFFERUPDATE_DPL2* update, + AXFX_REVERBHI_EXP_DPL2* fx); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXSrcCoef.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXSrcCoef.h new file mode 100644 index 0000000000..ff5beb3647 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/AXFX/AXFXSrcCoef.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_AXFX_SRC_COEF_H +#define RVL_SDK_AXFX_SRC_COEF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +f32* __AXFXGetSrcCoef(u32 i); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE.h new file mode 100644 index 0000000000..7a281f6f07 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_BASE_H +#define RVL_SDK_PUBLIC_BASE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE/PPCArch.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE/PPCArch.h new file mode 100644 index 0000000000..2a6b4be764 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/BASE/PPCArch.h @@ -0,0 +1,339 @@ +#ifndef RVL_SDK_PPC_ARCH_H +#define RVL_SDK_PPC_ARCH_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +u32 PPCMfmsr(void); +void PPCMtmsr(u32 val); + +u32 PPCMfhid0(void); +void PPCMthid0(u32 val); + +u32 PPCMfl2cr(void); +void PPCMtl2cr(u32 val); + +void PPCMtdec(u32 val); + +void PPCSync(void); +void PPCHalt(void); + +void PPCMtmmcr0(u32 val); +void PPCMtmmcr1(u32 val); + +void PPCMtpmc1(u32 val); +void PPCMtpmc2(u32 val); +void PPCMtpmc3(u32 val); +void PPCMtpmc4(u32 val); + +u32 PPCMffpscr(void); +void PPCMtfpscr(u32 val); + +u32 PPCMfhid2(void); +void PPCMthid2(u32 val); + +u32 PPCMfwpar(void); +void PPCMtwpar(u32 val); + +void PPCDisableSpeculation(void); +void PPCSetFpNonIEEEMode(void); + +void PPCMthid4(u32 val); + +#ifdef __cplusplus +} +#endif +#endif + +/** + * MSR + * Machine Status Register + */ +// Power management enable +#define MSR_POW (1 << (31 - 13)) +// Exception little-endian mode +#define MSR_ILE (1 << (31 - 15)) +// External interrupt enable +#define MSR_EE (1 << (31 - 16)) +// Privilege level +#define MSR_PR (1 << (31 - 17)) +// Floating-point available +#define MSR_FP (1 << (31 - 18)) +// Machine check enable +#define MSR_ME (1 << (31 - 19)) +// IEEE floating-point exception mode 0 +#define MSR_FE0 (1 << (31 - 20)) +// Single-step trace enable +#define MSR_SE (1 << (31 - 21)) +// Branch trace enable +#define MSR_BE (1 << (31 - 22)) +// IEEE floating-point exception mode 1 +#define MSR_FE1 (1 << (31 - 23)) +// Exception prefix +#define MSR_IP (1 << (31 - 25)) +// Instruction address translation +#define MSR_IR (1 << (31 - 26)) +// Data address translation +#define MSR_DR (1 << (31 - 27)) +// Performance monitor marked mode +#define MSR_PM (1 << (31 - 29)) +// Indicates whether system reset or machine check exception is recoverable +#define MSR_RI (1 << (31 - 30)) +// Little-endian mode enable +#define MSR_LE (1 << (31 - 31)) + +/** + * HID0 + * Hardware Implementation-Dependent Register 0 + */ +// Enable MCP +#define HID0_EMCP (1 << (31 - 0)) +// Enable/disable 60x bus address and data parity generation +#define HID0_DBP (1 << (31 - 1)) +// Enable/disable 60x bus address parity checking +#define HID0_EBA (1 << (31 - 2)) +// Enable 60x bus data parity checking +#define HID0_EBD (1 << (31 - 3)) +// CLK_OUT enable +#define HID0_BCLK (1 << (31 - 4)) +// CLK_OUT enable +#define HID0_ECLK (1 << (31 - 6)) +// Disable precharge of ARTRY +#define HID0_PAR (1 << (31 - 7)) +// Doze mode enable +#define HID0_DOZE (1 << (31 - 8)) +// Nap mode enable +#define HID0_NAP (1 << (31 - 9)) +// Sleep mode enable +#define HID0_SLEEP (1 << (31 - 10)) +// Dynamic power management enable +#define HID0_DPM (1 << (31 - 11)) +// Not hard reset (software-use only) +#define HID0_NHR (1 << (31 - 15)) +// Instruction cache enable +#define HID0_ICE (1 << (31 - 16)) +// Data cache enable +#define HID0_DCE (1 << (31 - 17)) +// Instruction cache lock +#define HID0_ILOCK (1 << (31 - 18)) +// Data cache lock +#define HID0_DLOCK (1 << (31 - 19)) +// Instruction cache flash invalidate +#define HID0_ICFI (1 << (31 - 20)) +// Data cache flash invalidate +#define HID0_DCFI (1 << (31 - 21)) +// Speculative cache access disable +#define HID0_SPD (1 << (31 - 22)) +// Enable M bit on bus for instruction fetches +#define HID0_IFEM (1 << (31 - 23)) +// Store gathering enable +#define HID0_SGE (1 << (31 - 24)) +// Data cache flush assist +#define HID0_DCFA (1 << (31 - 25)) +// Branch Target Instruction Cache enable +#define HID0_BTIC (1 << (31 - 26)) +// Address broadcast enable +#define HID0_ABE (1 << (31 - 28)) +// Branch history table enable +#define HID0_BHT (1 << (31 - 29)) +// No-op the data cache touch instructions +#define HID0_NOOPTI (1 << (31 - 31)) + +/** + * HID1 + * Hardware Implementation-Dependent Register 1 + */ +// PLL configuration bits (read-only) +#define HID1_PC0 (1 << (31 - 0)) +#define HID1_PC1 (1 << (31 - 1)) +#define HID1_PC2 (1 << (31 - 2)) +#define HID1_PC3 (1 << (31 - 3)) +#define HID1_PC4 (1 << (31 - 4)) + +/** + * L2CR + * L2 Control Register + */ +// L2 enable +#define L2CR_L2E (1 << (31 - 0)) +// L2 Checkstop enable +#define L2CR_L2CE (1 << (31 - 1)) +// L2 data-only +#define L2CR_L2DO (1 << (31 - 9)) +// L2 global invalidate +#define L2CR_L2I (1 << (31 - 10)) +// L2 write-through +#define L2CR_L2WT (1 << (31 - 12)) +// L2 test support +#define L2CR_L2TS (1 << (31 - 13)) +// L2 global invalidate in progress (read only) +#define L2CR_L2IP (1 << (31 - 31)) + +/** + * PMC1-PMC4 + * Performance Monitor Counter Registers + */ +// Overflow +#define PMC_OV (1 << (31 - 0)) + +/** + * FPSCR + * Floating-Point Status and Control Register + */ +// Floating-point exception summary +#define FPSCR_FX (1 << (31 - 0)) +// Floating-point enabled exception summary +#define FPSCR_FEX (1 << (31 - 1)) +// Floating-point invalid operation exception summary +#define FPSCR_VX (1 << (31 - 2)) +// Floating-point overflow exception +#define FPSCR_OX (1 << (31 - 3)) +// Floating-point underflow exception +#define FPSCR_UX (1 << (31 - 4)) +// Floating-point zero divide exception +#define FPSCR_ZX (1 << (31 - 5)) +// Floating-point inexact exception +#define FPSCR_XX (1 << (31 - 6)) +// Floating-point invalid operation exception for SNaN +#define FPSCR_VXSNAN (1 << (31 - 7)) +// Floating-point invalid operation exception for (inf - inf) +#define FPSCR_VXISI (1 << (31 - 8)) +// Floating-point invalid operation exception for (inf / inf) +#define FPSCR_VXIDI (1 << (31 - 9)) +// Floating-point invalid operation exception for (0 / 0) +#define FPSCR_VXZDZ (1 << (31 - 10)) +// Floating-point invalid operation exception for (inf * 0) +#define FPSCR_VXIMZ (1 << (31 - 11)) +// Floating-point invalid operation exception for invalid compare +#define FPSCR_VXVC (1 << (31 - 12)) +// Floating-point fraction rounded +#define FPSCR_FR (1 << (31 - 13)) +// Floating-point fraction inexact +#define FPSCR_FI (1 << (31 - 14)) +// Floating-point result flags +#define FPSCR_FPRF (0b11111 << (31 - 19)) +// Unknown +#define FPSCR_UNK20 (1 << (31 - 20)) +// Floating-point invalid operation exception for software request +#define FPSCR_VXSOFT (1 << (31 - 21)) +// Floating-point invalid operation exception for invalid square root +#define FPSCR_VXSQRT (1 << (31 - 22)) +// Floating-point invalid operation exception for invalid integer convert +#define FPSCR_VXCVI (1 << (31 - 23)) +// Floating-point invalid operation exception enable +#define FPSCR_VE (1 << (31 - 24)) +// IEEE floating-point overflow exception enable +#define FPSCR_OE (1 << (31 - 25)) +// IEEE floating-point underflow exception enable +#define FPSCR_UE (1 << (31 - 26)) +// IEEE floating-point zero divide exception enable +#define FPSCR_ZE (1 << (31 - 27)) +// Floating-point inexact exception enable +#define FPSCR_XE (1 << (31 - 28)) +// Floating-point non-IEEE mode +#define FPSCR_NI (1 << (31 - 29)) +// Floating-point rounding control +#define FPSCR_RN (0b11 << (31 - 31)) + +/** + * HID2 + * Hardware Implementation-Dependent Register 2 + */ +// Write pipe enable +#define HID2_WPE (1 << (31 - 1)) +// Paired-single enable +#define HID2_PSE (1 << (31 - 2)) +// Locked cache enable +#define HID2_LCE (1 << (31 - 3)) +// DMA queue length (read only) +#define HID2_DMAQL \ + ((1 << (31 - 4)) | (1 << (31 - 5)) | (1 << (31 - 6)) | (1 << (31 - 7))) +// dcbz_l cache hit error +#define HID2_DCHERR (1 << (31 - 8)) +// DMA access to normal cache error +#define HID2_DNCERR (1 << (31 - 9)) +// DMA cache miss error +#define HID2_DCMERR (1 << (31 - 10)) +// DMA queue overflow error +#define HID2_DQOERR (1 << (31 - 11)) +// dcbz_l cache hit error enable +#define HID2_DCHEE (1 << (31 - 12)) +// DMA access to normal cache error enable +#define HID2_DNCEE (1 << (31 - 13)) +// DMA cache miss error enable +#define HID2_DCMEE (1 << (31 - 14)) +// DMA queue overflow error enable +#define HID2_DQOEE (1 << (31 - 15)) + +/** + * WPAR + * Write Pipe Address Register + */ +// High order address bits of the data to be gathered +#define WPAR_GB_ADDR (0x07FFFFFF << (31 - 26)) +// Buffer not empty (read only) +#define WPAR_BNE (1 << (31 - 31)) + +/** + * DMAU + * Direct Memory Access Upper Register + */ +// High order address bits of starting address in external memory of the DMA +// transfer +#define DMAU_MEM_ADDR (0x07FFFFFF << (31 - 26)) +// High order bits of transfer length, in cache lines. Low order bits are in +// DMAL +#define DMAU_DMA_LEN_U (0x0000001F << (31 - 31)) + +/** + * DMAL + * Direct Memory Access Lower Register + */ +// High order address bits of starting address in locked cache of the DMA +// transfer +#define DMAL_LC_ADDR (0x07FFFFFF << (31 - 26)) +// DMA load command +#define DMAL_DMA_LD (1 << (31 - 27)) +// Low order bits of transfer length, in cache lines. High order bits are in +// DMAU +#define DMAL_DMA_LEN_L (0b11 << (31 - 29)) +// Trigger bit +#define DMAL_DMA_T (1 << (31 - 30)) +// Flush bit +#define DMAL_DMA_F (1 << (31 - 31)) + +/** + * PVR + * Processor Version Register + */ +// A 16-bit number that uniquely identifies a particular processor version +#define PVR_VER (0xFFFF0000) +// A 16-bit number that distinguishes between various releases of a particular +// version (that is, an engineering change level) +#define PVR_REV (0x0000FFFF) + +/** + * HID4 + * Hardware Implementation-Dependent Register 4 + */ +// Unknown +#define HID4_H4A (1 << (31 - 0)) +// L2 fetch mode +#define HID4_L2FM (0b11 << (31 - 2)) +// Bus pipeline depth +#define HID4_BPD (0b11 << (31 - 4)) +// L2 second castout buffer enable +#define HID4_BCO (1 << (31 - 5)) +// Secondary BAT enable +#define HID4_SBE (1 << (31 - 6)) +// Paired-singles control bit 1 +#define HID4_PS1_CTL (1 << (31 - 7)) +// Data bus parking +#define HID4_DBP (1 << (31 - 9)) +// L2 MUM enable +#define HID4_L2MUM (1 << (31 - 10)) +// L2CFI - L2 complete castout prior to L2 flash invalidate +#define HID4_L2_CCFI (1 << (31 - 11)) +// Paired-singles control bit 2 +#define HID4_PSS2_CTL (1 << (31 - 12)) diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD.h new file mode 100644 index 0000000000..00b4d9c945 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_CARD_H +#define RVL_SDK_PUBLIC_CARD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD/CARD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD/CARD.h new file mode 100644 index 0000000000..e217b60a2d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CARD/CARD.h @@ -0,0 +1,20 @@ +#ifndef RVL_SDK_CARD_H +#define RVL_SDK_CARD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CARDFileInfo { + s32 chan; // at 0x0 + s32 fileNo; // at 0x4 + s32 offset; // at 0x8 + s32 length; // at 0xC + u16 iBlock; // at 0x10 + u16 padding; // at 0x12 +} CARDFileInfo; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT.h new file mode 100644 index 0000000000..2dd70fa182 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_CNT_H +#define RVL_SDK_PUBLIC_CNT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT/cnt.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT/cnt.h new file mode 100644 index 0000000000..302fc61573 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CNT/cnt.h @@ -0,0 +1,30 @@ +#ifndef RVL_SDK_CNT_H +#define RVL_SDK_CNT_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CNTHandle { + ARCHandle arcHandle; // at 0x0 + s32 fd; // at 0x1C +} CNTHandle; + +typedef struct CNTFileInfo { + CNTHandle* handle; // at 0x0 + u32 offset; // at 0x4 + u32 length; // at 0x8 + u32 position; // at 0xC +} CNTFileInfo; + +s32 contentFastOpenNAND(CNTHandle* handle, s32 entrynum, CNTFileInfo* info); +s32 contentConvertPathToEntrynumNAND(CNTHandle* handle, const char* path); +u32 contentGetLengthNAND(const CNTFileInfo* info); +s32 contentReadNAND(CNTFileInfo* info, void* dst, u32 len, s32 offset); +s32 contentCloseNAND(CNTFileInfo* info); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX.h new file mode 100644 index 0000000000..0988c11203 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_CX_H +#define RVL_SDK_PUBLIC_CX_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX/CXCompression.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX/CXCompression.h new file mode 100644 index 0000000000..d3765f8ed4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/CX/CXCompression.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_CX_COMPRESSION_H +#define RVL_SDK_CX_COMPRESSION_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CXStream { + u8 m_type : 4; // compression type + u8 pad : 4; + u32 m_size : 24; // 24-bit uncompressed size, in little-endian + u32 m_size32; // TODO: 32-bit uncompressed size, in little-endian? + u8 m_data[0x1]; // UBFIX: this is a C99 flexible array member +} CXStream; +// TODO size + +typedef struct CXUncompContext { + u8 unk0[0x30]; +} CXUncompContext; +// TODO size + +void CXInitUncompContextRL(CXUncompContext* ctx, void* dest); +void CXInitUncompContextLZ(CXUncompContext* ctx, void* dest); +void CXInitUncompContextHuffman(CXUncompContext* ctx, void* dest); + +s32 CXReadUncompRL(CXUncompContext* ctx, const CXStream* src, u32 len); +s32 CXReadUncompLZ(CXUncompContext* ctx, const CXStream* src, u32 len); +s32 CXReadUncompHuffman(CXUncompContext* ctx, const CXStream* src, u32 len); + +void CXUncompressLZ(void* data, void* destination); +u32 CXGetUncompressedSize(const void* data); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB.h new file mode 100644 index 0000000000..9e03910e7a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB.h @@ -0,0 +1,16 @@ +/** + * References: YAGCD + */ + +#ifndef RVL_SDK_PUBLIC_DB_H +#define RVL_SDK_PUBLIC_DB_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB/db.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB/db.h new file mode 100644 index 0000000000..bdb2fb473c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DB/db.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_DB_H +#define RVL_SDK_DB_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void DBInit(void); +void __DBExceptionDestinationAux(void); +void __DBExceptionDestination(void); +BOOL __DBIsExceptionMarked(u8 exc); +void DBPrintf(const char* msg, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP.h new file mode 100644 index 0000000000..1069182044 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP.h @@ -0,0 +1,19 @@ +/** + * References: YAGCD, Dolphin Emulator + */ + +#ifndef RVL_SDK_PUBLIC_DSP_H +#define RVL_SDK_PUBLIC_DSP_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp.h new file mode 100644 index 0000000000..7a321d0a5a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp.h @@ -0,0 +1,27 @@ +#ifndef RVL_SDK_DSP_H +#define RVL_SDK_DSP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct DSPTask DSPTask; + +// General-purpose typedef +typedef void* DSPMail; + +BOOL DSPCheckMailToDSP(void); +BOOL DSPCheckMailFromDSP(void); +DSPMail DSPReadMailFromDSP(void); +void DSPSendMailToDSP(DSPMail mail); +void DSPAssertInt(void); +void DSPInit(void); +BOOL DSPCheckInit(void); +DSPTask* DSPAddTask(DSPTask* task); +DSPTask* DSPAssertTask(DSPTask* task); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_debug.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_debug.h new file mode 100644 index 0000000000..9802a8a306 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_debug.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_DSP_DEBUG_H +#define RVL_SDK_DSP_DEBUG_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __DSP_debug_printf(const char* fmt, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_hardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_hardware.h new file mode 100644 index 0000000000..8b7d5b57c2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_hardware.h @@ -0,0 +1,77 @@ +#ifndef RVL_SDK_DSP_HARDWARE_H +#define RVL_SDK_DSP_HARDWARE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * DSP hardware registers + */ +volatile u16 DSP_HW_REGS[] +#ifdef __MWERKS__ +: 0xCC005000 +#endif +; + +/** + * Hardware register indexes + */ +typedef enum { + DSP_DSPMBOX_H, //!< 0xCC005000 + DSP_DSPMBOX_L, //!< 0xCC005002 + DSP_CPUMBOX_H, //!< 0xCC005004 + DSP_CPUMBOX_L, //!< 0xCC005006 + DSP_REG_0x8, //!< 0xCC005008 + DSP_CSR, //!< 0xCC00500A + DSP_REG_0xC, //!< 0xCC00500C + DSP_REG_0xE, //!< 0xCC00500E + DSP_REG_0x10, //!< 0xCC005010 + DSP_AR_SIZE, //!< 0xCC005012 + DSP_REG_0x14, //!< 0xCC005014 + DSP_AR_MODE, //!< 0xCC005016 + DSP_REG_0x18, //!< 0xCC005018 + DSP_AR_REFRESH, //!< 0xCC00501A + DSP_REG_0x1C, //!< 0xCC00501C + DSP_REG_0x1E, //!< 0xCC00501E + DSP_AR_DMA_MMADDR_H, //!< 0xCC005020 + DSP_AR_DMA_MMADDR_L, //!< 0xCC005022 + DSP_AR_DMA_ARADDR_H, //!< 0xCC005024 + DSP_AR_DMA_ARADDR_L, //!< 0xCC005026 + DSP_AR_DMA_CNT_H, //!< 0xCC005028 + DSP_AR_DMA_CNT_L, //!< 0xCC00502A + DSP_REG_0x2C, //!< 0xCC00502C + DSP_REG_0x2E, //!< 0xCC00502E + DSP_AI_DMA_START_H, //!< 0xCC005030 + DSP_AI_DMA_START_L, //!< 0xCC005032 + DSP_REG_0x34, //!< 0xCC005034 + DSP_AI_DMA_CSR, //!< 0xCC005036 + DSP_REG_0x38, //!< 0xCC005038 + DSP_AI_DMA_BYTES_LEFT //!< 0xCC00503A +} DSPHwReg; + +// DSPMBOX_H - DSP Mailbox High (to DSP) +#define DSP_DSPMBOX_H_STATUS (1 << 15) + +// CPUMBOX_H - CPU Mailbox High (from DSP) +#define DSP_CPUMBOX_H_STATUS (1 << 15) + +// CSR - Control Status Register +#define DSP_CSR_RES (1 << 11) +#define DSP_CSR_DMAINT (1 << 9) +#define DSP_CSR_DSPINTMSK (1 << 8) +#define DSP_CSR_DSPINT (1 << 7) +#define DSP_CSR_ARINTMSK (1 << 6) +#define DSP_CSR_ARINT (1 << 5) +#define DSP_CSR_AIDINTMSK (1 << 4) +#define DSP_CSR_AIDINT (1 << 3) +#define DSP_CSR_HALT (1 << 2) +#define DSP_CSR_PIINT (1 << 1) + +// AI_DMA_CSR - AI DMA Control Status Register +#define DSP_AI_DMA_CSR_PLAY (1 << 15) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_task.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_task.h new file mode 100644 index 0000000000..07d2807f0d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DSP/dsp_task.h @@ -0,0 +1,71 @@ +#ifndef RVL_SDK_DSP_TASK_H +#define RVL_SDK_DSP_TASK_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define DSP_SEND_MAIL_SYNC(x) \ + do { \ + DSPSendMailToDSP((DSPMail)(x)); \ + while (DSPCheckMailToDSP()) { \ + ; \ + } \ + } while (0) + +// Forward declarations +typedef struct DSPTask DSPTask; +typedef struct OSContext OSContext; + +typedef enum { + DSP_TASK_ACTIVE = (1 << 0), + DSP_TASK_CANCELED = (1 << 1), +} DSPTaskFlags; + +typedef enum { + DSP_TASK_STATE_0, + DSP_TASK_STATE_1, + DSP_TASK_STATE_2, + DSP_TASK_STATE_3, +} DSPTaskState; + +typedef void (*DSPTaskCallback)(DSPTask* task); + +typedef struct DSPTask { + u32 state; // at 0x0 + volatile u32 prio; // at 0x4 + u32 flags; // at 0x8 + void* iramMmemAddr; // at 0xC + u32 iramMmemLen; // at 0x10 + uintptr_t iramDspAddr; // at 0x14 + void* dramMmemAddr; // at 0x18 + u32 dramMmemLen; // at 0x1C + uintptr_t dramDspAddr; // at 0x20 + u16 startVector; // at 0x24 + u16 resumeVector; // at 0x26 + DSPTaskCallback initCallback; // at 0x28 + DSPTaskCallback resumeCallback; // at 0x2C + DSPTaskCallback doneCallback; // at 0x30 + DSPTaskCallback requestCallback; // at 0x34 + DSPTask* next; // at 0x38 + DSPTask* prev; // at 0x3C + char UNK_0x40[0x50 - 0x40]; +} DSPTask; + +extern BOOL __DSP_rude_task_pending; +extern DSPTask* __DSP_rude_task; +extern DSPTask* __DSP_tmp_task; +extern DSPTask* __DSP_last_task; +extern DSPTask* __DSP_first_task; +extern DSPTask* __DSP_curr_task; + +void __DSPHandler(s16 intr, OSContext* ctx); +void __DSP_exec_task(DSPTask* task1, DSPTask* task2); +void __DSP_boot_task(DSPTask* task); +void __DSP_insert_task(DSPTask* task); +void __DSP_remove_task(DSPTask* task); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD.h new file mode 100644 index 0000000000..4027201b47 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD.h @@ -0,0 +1,22 @@ +/** + * References: WiiBrew, YAGCD + */ + +#ifndef RVL_SDK_PUBLIC_DVD_H +#define RVL_SDK_PUBLIC_DVD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd.h new file mode 100644 index 0000000000..1e86e5ca9c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd.h @@ -0,0 +1,118 @@ +#ifndef RVL_SDK_DVD_H +#define RVL_SDK_DVD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// OS sets MSB to signal that the device code was successfully read +#define DVD_DEVICE_CODE_READ (1 << 15) +#define MAKE_DVD_DEVICE_CODE(x) (DVD_DEVICE_CODE_READ | (x)) + +// Forward declarations +typedef struct DVDCommandBlock DVDCommandBlock; +typedef struct DVDFileInfo DVDFileInfo; +typedef struct OSAlarm OSAlarm; + +typedef enum { + DVD_RESULT_COVER_CLOSED = -4, + DVD_RESULT_CANCELED, + DVD_RESULT_M2, + DVD_RESULT_FATAL, + DVD_RESULT_OK, +} DVDResult; + +typedef enum { + DVD_STATE_FATAL = -1, + DVD_STATE_IDLE, + DVD_STATE_BUSY, + DVD_STATE_WAITING, + DVD_STATE_COVER_CLOSED, + DVD_STATE_NO_DISK, + DVD_STATE_COVER_OPENED, + DVD_STATE_WRONG_DISK_ID, + DVD_STATE_7, + DVD_STATE_PAUSED, + DVD_STATE_9, + DVD_STATE_CANCELED, + DVD_STATE_DISK_ERROR, + DVD_STATE_MOTOR_STOPPED, +} DVDAsyncState; + +typedef enum { + DVD_COVER_BUSY, + DVD_COVER_OPENED, + DVD_COVER_CLOSED, +} DVDCoverState; + +typedef void (*DVDAsyncCallback)(s32 result, DVDFileInfo* info); +typedef void (*DVDCommandCallback)(s32 result, DVDCommandBlock* block); + +typedef struct DVDDiskID { + char game[4]; // at 0x0 + char company[2]; // at 0x4 + u8 disk; // at 0x6 + u8 version; // at 0x7 + u8 strmEnable; // at 0x8 + u8 strmBufSize; // at 0x9 + u8 padding[14]; // at 0xA + u32 rvlMagic; // at 0x18 + u32 gcMagic; // at 0x1C +} DVDDiskID; + +typedef struct DVDCommandBlock { + DVDCommandBlock* next; // at 0x0 + DVDCommandBlock* prev; // at 0x4 + u32 command; // at 0x8 + volatile s32 state; // at 0xC + u32 offset; // at 0x10 + u32 length; // at 0x14 + void* addr; // at 0x18 + u32 transferSize; // at 0x1C + u32 transferTotal; // at 0x20 + DVDDiskID* id; // at 0x24 + DVDCommandCallback callback; // at 0x28 + void* userData; // at 0x2C +} DVDCommandBlock; + +typedef struct DVDDriveInfo { + u16 revision; // at 0x0 + u16 deviceCode; // at 0x2 + u32 releaseDate; // at 0x4 + char padding[32 - 0x8]; +} DVDDriveInfo; + +typedef struct DVDFileInfo { + DVDCommandBlock block; // at 0x0 + u32 offset; // at 0x30 + u32 size; // at 0x34 + DVDAsyncCallback callback; // at 0x38 +} DVDFileInfo; + +extern volatile u32 __DVDLayoutFormat; + +void DVDInit(void); +BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* dst, u32 size, + u32 offset, DVDCommandCallback callback, s32 prio); +BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info, + DVDCommandCallback callback); +s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block); +s32 DVDGetDriveStatus(void); +void DVDPause(void); +void DVDResume(void); +BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback); +s32 DVDCancel(DVDCommandBlock* block); +BOOL DVDCancelAllAsync(DVDCommandCallback callback); +const DVDDiskID* DVDGetCurrentDiskID(void); +u32 __DVDGetCoverStatus(void); +void __DVDPrepareResetAsync(DVDCommandCallback callback); +void __DVDPrepareReset(void); +BOOL __DVDTestAlarm(const OSAlarm* alarm); +BOOL __DVDLowBreak(void); +BOOL __DVDStopMotorAsync(DVDCommandBlock* block, DVDCommandCallback callback); +void __DVDRestartMotor(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd_broadway.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd_broadway.h new file mode 100644 index 0000000000..391348c817 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvd_broadway.h @@ -0,0 +1,64 @@ +#ifndef RVL_SDK_DVD_BROADWAY_H +#define RVL_SDK_DVD_BROADWAY_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define DVD_LOW_OFFSET(x) ((x) >> 2) +#define DVD_LOW_SPEED(x) (((x) & 3) << 16) + +// Forward declarations +typedef struct DVDDiskID DVDDiskID; +typedef struct DVDDriveInfo DVDDriveInfo; +typedef struct ESPTicket ESPTicket; +typedef struct ESPTmd ESPTmd; +typedef struct OSAlarm OSAlarm; + +typedef enum { + DVD_INTTYPE_TC = (1 << 0), // Transaction callback? + DVD_INTTYPE_DE = (1 << 1), // Drive error + DVD_INTTYPE_CVR = (1 << 2), // Something with DVD cover + DVD_INTTYPE_BR = (1 << 3), // Break requested + DVD_INTTYPE_TIME = (1 << 4), // Time out + DVD_INTTYPE_SERR = (1 << 5), // Security error + DVD_INTTYPE_VERR = (1 << 6), // Verify error + DVD_INTTYPE_ARGS = (1 << 7), // Bad arguments +} DVDLowIntType; + +// DICVR - DI Cover Register (via DVDLowGetCoverRegister) +#define DVD_DICVR_CVR (1 << 0) +#define DVD_DICVR_CVRINTMASK (1 << 1) +#define DVD_DICVR_CVRINT (1 << 2) + +typedef void (*DVDLowCallback)(u32 intType); + +BOOL DVDLowInit(void); +BOOL DVDLowReadDiskID(DVDDiskID* out, DVDLowCallback callback); +BOOL DVDLowOpenPartition(u32 offset, const ESPTicket* ticket, u32 certsSize, + const void* certs, ESPTmd* tmd, + DVDLowCallback callback); +BOOL DVDLowClosePartition(DVDLowCallback callback); +BOOL DVDLowUnencryptedRead(void* dst, u32 size, u32 offset, + DVDLowCallback callback); +BOOL DVDLowStopMotor(BOOL eject, BOOL kill, DVDLowCallback callback); +BOOL DVDLowInquiry(DVDDriveInfo* out, DVDLowCallback callback); +BOOL DVDLowRequestError(DVDLowCallback callback); +BOOL DVDLowSetSpinupFlag(BOOL enable); +BOOL DVDLowReset(DVDLowCallback callback); +BOOL DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback); +BOOL DVDLowSetMaximumRotation(u32 speed, DVDLowCallback callback); +BOOL DVDLowRead(void* dst, u32 size, u32 offset, DVDLowCallback callback); +BOOL DVDLowSeek(u32 offset, DVDLowCallback callback); +u32 DVDLowGetCoverRegister(void); +BOOL DVDLowPrepareCoverRegister(DVDLowCallback callback); +u32 DVDLowGetImmBufferReg(void); +BOOL DVDLowUnmaskStatusInterrupts(void); +BOOL DVDLowMaskCoverInterrupt(void); +BOOL DVDLowClearCoverInterrupt(DVDLowCallback callback); +BOOL __DVDLowTestAlarm(const OSAlarm* alarm); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvderror.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvderror.h new file mode 100644 index 0000000000..52ce207785 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvderror.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_DVD_ERROR_H +#define RVL_SDK_DVD_ERROR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*DVDErrorCallback)(s32 result, s32 arg1); + +#define DVD_ERROR_CMD_MAX 5 + +typedef struct DVDErrorInfo { + char game[4]; // at 0x0 + u8 disk; // at 0x4 + u8 version; // at 0x5 + u32 error; // at 0x8 + s32 sec; // at 0xC + u32 disr; // at 0x10 + u32 dicr; // at 0x14 + u32 next; // at 0x18 + + struct { + u32 command; // at 0x1C + u32 param1; // at 0x20 + u32 param2; // at 0x24 + u32 intType; // at 0x28 + u32 tick; // at 0x2C + } info[DVD_ERROR_CMD_MAX]; +} DVDErrorInfo; + +extern DVDErrorInfo __ErrorInfo; + +void __DVDStoreErrorCode(u32 error, DVDErrorCallback callback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfatal.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfatal.h new file mode 100644 index 0000000000..04ef32e2ee --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfatal.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_DVD_FATAL_H +#define RVL_SDK_DVD_FATAL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __DVDShowFatalMessage(void); +BOOL DVDSetAutoFatalMessaging(BOOL enable); +BOOL __DVDGetAutoFatalMessaging(void); +void __DVDPrintFatalMessage(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfs.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfs.h new file mode 100644 index 0000000000..7175a4e879 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdfs.h @@ -0,0 +1,26 @@ +#ifndef RVL_SDK_DVD_FS_H +#define RVL_SDK_DVD_FS_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern OSThreadQueue __DVDThreadQueue; +extern BOOL __DVDLongFileNameFlag; + +void __DVDFSInit(void); +s32 DVDConvertPathToEntrynum(const char* path); +BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* info); +BOOL DVDOpen(const char* path, DVDFileInfo* info); +BOOL DVDClose(DVDFileInfo* info); +BOOL DVDGetCurrentDir(char* buffer, u32 maxlen); +BOOL DVDReadAsyncPrio(DVDFileInfo* info, void* dst, s32 size, s32 offset, + DVDAsyncCallback callback, s32 prio); +s32 DVDReadPrio(DVDFileInfo* info, void* dst, s32 size, s32 offset, s32 prio); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdidutils.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdidutils.h new file mode 100644 index 0000000000..c917ca8a99 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdidutils.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_DVD_ID_UTILS_H +#define RVL_SDK_DVD_ID_UTILS_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdqueue.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdqueue.h new file mode 100644 index 0000000000..d06f2bae5c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DVD/dvdqueue.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_DVD_QUEUE_H +#define RVL_SDK_DVD_QUEUE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + DVD_PRIO_HIGHEST, + DVD_PRIO_HIGH, + DVD_PRIO_MEDIUM, + DVD_PRIO_LOW, + + DVD_PRIO_MAX, +} DVDQueuePriority; + +void __DVDClearWaitingQueue(void); +BOOL __DVDPushWaitingQueue(s32 prio, DVDCommandBlock* block); +DVDCommandBlock* __DVDPopWaitingQueue(void); +BOOL __DVDCheckWaitingQueue(void); +DVDCommandBlock* __DVDGetNextWaitingQueue(void); +BOOL __DVDDequeueWaitingQueue(const DVDCommandBlock* block); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC.h new file mode 100644 index 0000000000..5187fc10da --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_PUBLIC_DWC_H +#define RVL_SDK_PUBLIC_DWC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_auth_interface.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_auth_interface.h new file mode 100644 index 0000000000..5298ae7f2d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_auth_interface.h @@ -0,0 +1,11 @@ +#ifndef RVL_SDK_DWC_AUTH_INTERFACE_H +#define RVL_SDK_DWC_AUTH_INTERFACE_H +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_error.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_error.h new file mode 100644 index 0000000000..540ffdf0d4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_error.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void DWC_ClearError(void); +s32 DWC_GetLastErrorEx(s32 *p1, s32 *p2); + +#ifdef __cplusplus +} +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_init.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_init.h new file mode 100644 index 0000000000..398fd6c9a3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_init.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_DWC_INIT_H +#define RVL_SDK_DWC_INIT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +s32 DWC_Init(int, const char*, u32 gamecode, DWCAlloc alloc, DWCFree free); +void DWC_Shutdown(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_main.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_main.h new file mode 100644 index 0000000000..6e68386574 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_main.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +s32 DWC_GetState(void); +s32 DWC_InitFriendsMatch(s32 p1, s32 p2, s32 p3, s32 p4, s32 p5, s32 p6, s32 p7, s32 p8, s32 p9); +s32 DWC_LoginAsync(s32 p1, s32 p2, void (*p3)(s32, s32, void *), void *p4); +void DWC_ProcessFriendsMatch(void); +void DWC_ShutdownFriendsMatch(void); + +#ifdef __cplusplus +} +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_memfunc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_memfunc.h new file mode 100644 index 0000000000..38785b9296 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_memfunc.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_DWC_MEMFUNC_H +#define RVL_SDK_DWC_MEMFUNC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* (*DWCAlloc)(int, size_t size, int align); +typedef void (*DWCFree)(int, void*, int); + +void DWCi_SetMemFunc(DWCAlloc alloc, DWCFree free); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nastime.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nastime.h new file mode 100644 index 0000000000..b399f15d0e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nastime.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct DWCTime { + s32 sec; + s32 min; + s32 hour; + s32 msec; + s32 usec; +} DWCTime; + +typedef struct DWCDate { + s32 mday; + s32 month; + s32 year; + s32 wday; + s32 yday; +} DWCDate; + +BOOL DWC_GetDateTime(DWCDate *date, DWCTime *time); + +#ifdef __cplusplus +} +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nd.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nd.h new file mode 100644 index 0000000000..9beb9852e6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_nd.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_DWC_ND_H +#define RVL_SDK_DWC_ND_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +static void* DWCi_NdAlloc(size_t size, int align); +static void DWCi_NdFree(void*); + + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_transport.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_transport.h new file mode 100644 index 0000000000..29469940c3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/dwc_transport.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_DWC_TRANSPORT_H +#define RVL_SDK_DWC_TRANSPORT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void DWC_SendUnreliable(u8 aid, const void* packet, u32 size); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/neterrorcode.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/neterrorcode.h new file mode 100644 index 0000000000..ccb1174c45 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/neterrorcode.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +s32 NETGetStartupErrorCode(s32 p1); + +#ifdef __cplusplus +} +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/nonport.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/nonport.h new file mode 100644 index 0000000000..d73b4aafd9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/DWC/nonport.h @@ -0,0 +1,20 @@ +#pragma once + +extern "C" { +int socket(int domain, int type, int protocal); +int bind(int socket, const struct sockaddr* address, int address_len); +int connect(int socket, const struct sockaddr* address, int address_len); +int closesocket(int socket); +int recvfrom(int socket, void* buffer, u32 length, int flags, struct sockaddr* address, u32* address_len); +int sendto(int socket, const void* message, u32 length, int flags, const struct sockaddr* dest_addr, u32 dest_len); +bool CanReceiveOnSocket(int socket); +bool CanSendOnSocket(int socket); + +int recv(int sockfd, void* buf, size_t len, int flags); +int send(int sockfd, const void* buf, size_t len, int flags); +int accept(int sockfd, struct sockaddr* addr, u32* addrlen); +int listen(int sockfd, int backlog); +int getsockname(int sockfd, struct sockaddr* addr, u32* addrlen); +int SetReceiveBufferSize(int socket, int size); +int SetSendBufferSize(int socket, int size); +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP.h new file mode 100644 index 0000000000..5901fd568f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP.h @@ -0,0 +1,16 @@ +/** + * References: WiiBrew + */ + +#ifndef RVL_SDK_PUBLIC_ESP_H +#define RVL_SDK_PUBLIC_ESP_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP/esp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP/esp.h new file mode 100644 index 0000000000..ea3eb8d47c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/ESP/esp.h @@ -0,0 +1,34 @@ +#ifndef RVL_SDK_ESP_H +#define RVL_SDK_ESP_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + ES_IOCTLV_LAUNCH_TITLE = 8, + ES_IOCTLV_READ_CONTENT_FILE = 10, + ES_IOCTLV_GET_NUM_TICKET_VIEWS = 18, + ES_IOCTLV_GET_TICKET_VIEWS = 19, + ES_IOCTLV_GET_DATA_DIR = 29, + ES_IOCTLV_GET_TITLE_ID = 32, + ES_IOCTLV_SEEK_CONTENT_FILE = 35, +} ESIoctl; + +typedef struct ESPTicket { + u8 dummy[0x2A4]; +} ESPTicket; + +typedef struct ESPTmd { + u8 dummy[0x49E4]; +} ESPTmd; + +s32 ESP_ReadContentFile(s32 fd, void* dst, u32 len); +s32 ESP_SeekContentFile(s32 fd, s32 offset, s32 origin); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART.h new file mode 100644 index 0000000000..ad14acbb1d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_EUART_H +#define RVL_SDK_PUBLIC_EUART_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART/euart.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART/euart.h new file mode 100644 index 0000000000..63b7e5d770 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EUART/euart.h @@ -0,0 +1,24 @@ +#ifndef RVL_SDK_EUART_EUART_H +#define RVL_SDK_EUART_EUART_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + EUART_ERROR_OK, + EUART_ERROR_FATAL, + EUART_ERROR_INVALID, + EUART_ERROR_BUSY, + EUART_ERROR_4, + EUART_ERROR_EXI, +} EUARTError; + +BOOL EUARTInit(void); +EUARTError InitializeUART(void); +EUARTError WriteUARTN(const char* msg, u32 n); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI.h new file mode 100644 index 0000000000..f46994c882 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI.h @@ -0,0 +1,19 @@ +/** + * References: YAGCD, publicly available patents + */ + +#ifndef RVL_SDK_PUBLIC_EXI_H +#define RVL_SDK_PUBLIC_EXI_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIBios.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIBios.h new file mode 100644 index 0000000000..18889e6245 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIBios.h @@ -0,0 +1,50 @@ +#ifndef RVL_SDK_EXI_BIOS_H +#define RVL_SDK_EXI_BIOS_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct EXIItem { + u32 dev; // at 0x0 + EXICallback callback; // at 0x4 +} EXIItem; + +typedef struct EXIData { + EXICallback exiCallback; // at 0x0 + EXICallback tcCallback; // at 0x4 + EXICallback extCallback; // at 0x8 + volatile s32 state; // at 0xC + s32 bytesRead; // at 0x10 + void* buffer; // at 0x14 + u32 dev; // at 0x18 + u32 id; // at 0x1C + s32 lastInsert; // at 0x20 + s32 numItems; // at 0x24 + EXIItem items[3]; // at 0x28 +} EXIData; + +BOOL EXIImm(EXIChannel chan, void* buf, s32 len, u32 type, + EXICallback callback); +BOOL EXIImmEx(EXIChannel chan, void* buf, s32 len, u32 type); +BOOL EXIDma(EXIChannel chan, void* buf, s32 len, u32 type, + EXICallback callback); +BOOL EXISync(EXIChannel chan); +void EXIClearInterrupts(EXIChannel chan, BOOL exi, BOOL tc, BOOL ext); +EXICallback EXISetExiCallback(EXIChannel chan, EXICallback callback); +void EXIProbeReset(void); +BOOL EXIProbe(EXIChannel chan); +BOOL EXIAttach(EXIChannel chan, EXICallback callback); +BOOL EXIDetach(EXIChannel chan); +BOOL EXISelect(EXIChannel chan, u32 dev, u32 freq); +BOOL EXIDeselect(EXIChannel chan); +void EXIInit(void); +BOOL EXILock(EXIChannel chan, u32 dev, EXICallback callback); +BOOL EXIUnlock(EXIChannel chan); +s32 EXIGetID(EXIChannel chan, u32 dev, u32* out); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXICommon.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXICommon.h new file mode 100644 index 0000000000..cd4799a406 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXICommon.h @@ -0,0 +1,64 @@ +#ifndef RVL_SDK_EXI_COMMON_H +#define RVL_SDK_EXI_COMMON_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSContext OSContext; + +typedef enum { + EXI_STATE_DMA_ACCESS = (1 << 0), + EXI_STATE_IMM_ACCESS = (1 << 1), + EXI_STATE_SELECTED = (1 << 2), + EXI_STATE_ATTACHED = (1 << 3), + EXI_STATE_LOCKED = (1 << 4), + + EXI_STATE_BUSY = EXI_STATE_DMA_ACCESS | EXI_STATE_IMM_ACCESS +} EXIState; + +typedef enum { + EXI_FREQ_1MHZ, + EXI_FREQ_2MHZ, + EXI_FREQ_4MHZ, + EXI_FREQ_8MHZ, + EXI_FREQ_16MHZ, + EXI_FREQ_32HZ, + EXI_MAX_FREQ +} EXIFreq; + +typedef enum { EXI_CHAN_0, EXI_CHAN_1, EXI_CHAN_2, EXI_MAX_CHAN } EXIChannel; + +typedef enum { EXI_DEV_EXT, EXI_DEV_INT, EXI_DEV_NET, EXI_MAX_DEV } EXIDev; + +typedef enum { EXI_READ, EXI_WRITE, EXI_TYPE_2, EXI_MAX_TYPE } EXIType; + +typedef enum { + EXI_ID_MEMCARD_59 = 0x00000004, + EXI_ID_MEMCARD_123 = 0x00000008, + EXI_ID_MEMCARD_251 = 0x00000010, + EXI_ID_MEMCARD_507 = 0x00000020, + EXI_ID_MEMCARD_1019 = 0x00000040, + EXI_ID_MEMCARD_2043 = 0x00000080, + EXI_ID_USB_ADAPTER = 0x01010000, + EXI_ID_IS_DOL_VIEWER = 0x05070000, + EXI_ID_BROADBAND_ADAPTER = 0x04020200, + EXI_ID_INVALID = 0xFFFFFFFF +} EXIDeviceID; + +typedef void (*EXICallback)(EXIChannel chan, OSContext* ctx); + +extern const u32 __EXIFreq; + +static u32 __EXISwap32(u32 val) { + return val >> 24 & 0x000000FF | val >> 8 & 0x0000FF00 | + val << 8 & 0x00FF0000 | val << 24 & 0xFF000000; +} + +BOOL EXIWriteReg(EXIChannel chan, u32 dev, u32 cmd, const void* buf, s32 len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIHardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIHardware.h new file mode 100644 index 0000000000..29e09e0091 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIHardware.h @@ -0,0 +1,42 @@ +#ifndef RVL_SDK_EXI_HARDWARE_H +#define RVL_SDK_EXI_HARDWARE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct EXIChannelParam { + u32 cpr; // at 0x0 + void* mar; // at 0x4 + u32 length; // at 0x8 + u32 cr; // at 0xC + u32 data; // at 0x10 +} EXIChannelParam; + +volatile EXIChannelParam EXI_CHAN_PARAMS[EXI_MAX_CHAN] : 0xCD006800; + +// CPR - Channel Parameter Register +#define EXI_CPR_EXIINTMASK (1 << 0) +#define EXI_CPR_EXIINT (1 << 1) +#define EXI_CPR_TCINTMASK (1 << 2) +#define EXI_CPR_TCINT (1 << 3) +#define EXI_CPR_CLK (1 << 4 | 1 << 5 | 1 << 6) +#define EXI_CPR_CS0B (1 << 7) +#define EXI_CPR_CS1B (1 << 8) +#define EXI_CPR_CS2B (1 << 9) +#define EXI_CPR_EXTINTMASK (1 << 10) +#define EXI_CPR_EXTINT (1 << 11) +#define EXI_CPR_EXT (1 << 12) +#define EXI_CPR_ROMDIS (1 << 13) + +// CR - Control Register +#define EXI_CR_TSTART (1 << 0) +#define EXI_CR_DMA (1 << 1) +#define EXI_CR_RW (1 << 2 | 1 << 3) +#define EXI_CR_TLEN (1 << 4 | 1 << 5) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIUart.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIUart.h new file mode 100644 index 0000000000..27b50dc805 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/EXI/EXIUart.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_EXI_UART_H +#define RVL_SDK_EXI_UART_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __OSEnableBarnacle(EXIChannel chan, u32 dev); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA.h new file mode 100644 index 0000000000..2f07fce831 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA.h @@ -0,0 +1,23 @@ +#ifndef RVL_SDK_PUBLIC_FA_H +#define RVL_SDK_PUBLIC_FA_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FA.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FA.h new file mode 100644 index 0000000000..4bf3183f89 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FA.h @@ -0,0 +1,24 @@ +#ifndef RVL_SDK_FA_H +#define RVL_SDK_FA_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void FAHandle; + +typedef struct FAEntryInfo { + char _0x0[0x224]; + s16 modifiedTime; + s16 modifiedDate; + int size; + char _flag; + char shortname[0xd]; + char name[0x38]; + char unk[0x1e2]; +} FAEntryInfo; + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAClosedir.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAClosedir.h new file mode 100644 index 0000000000..6fbfca97a4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAClosedir.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_CLOSEDIR_H +#define RVL_SDK_FA_CLOSEDIR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAClosedir(FAHandle* handle); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFclose.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFclose.h new file mode 100644 index 0000000000..b65eb4b60d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFclose.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FCLOSE_H +#define RVL_SDK_FA_FCLOSE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFclose(FAHandle* handle); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFopen.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFopen.h new file mode 100644 index 0000000000..ff1d62a947 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFopen.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FOPEN_H +#define RVL_SDK_FA_FOPEN_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +FAHandle* FAFopen(const char* filepath, const char* mode); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFread.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFread.h new file mode 100644 index 0000000000..f5ce1d2fc3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFread.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FREAD_H +#define RVL_SDK_FA_FREAD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFread(void* dest, size_t size, size_t num, FAHandle* handle); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFseek.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFseek.h new file mode 100644 index 0000000000..676da92a27 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFseek.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FSEEK_H +#define RVL_SDK_FA_FSEEK_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFseek(FAHandle* handle, int offset, int mode); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsfirst.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsfirst.h new file mode 100644 index 0000000000..34c1cfe630 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsfirst.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FSFIRST_H +#define RVL_SDK_FA_FSFIRST_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFsfirst(const char* pattern, int filter, FAEntryInfo* ret); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsnext.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsnext.h new file mode 100644 index 0000000000..41adbfd749 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFsnext.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FSNEXT_H +#define RVL_SDK_FA_FSNEXT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFsnext(FAEntryInfo* ret); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFstat.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFstat.h new file mode 100644 index 0000000000..cd27e479be --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFstat.h @@ -0,0 +1,24 @@ +#ifndef RVL_SDK_FA_FSTAT_H +#define RVL_SDK_FA_FSTAT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct FAStat { + int filesize; + s16 accessDate; + s16 modifiedTime; + s16 modifiedDate; + s16 createdTime; + s16 createdDate; + u16 unk; + char flags; +} FAStat; + +int FAFstat(const char* filepath, FAStat* st); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFwrite.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFwrite.h new file mode 100644 index 0000000000..5313f1e559 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAFwrite.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_FWRITE_H +#define RVL_SDK_FA_FWRITE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int FAFwrite(void* buffer, size_t size, size_t num, FAHandle* handle); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAOpendir.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAOpendir.h new file mode 100644 index 0000000000..c61c79c2e7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FAOpendir.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_FA_OPENDIR_H +#define RVL_SDK_FA_OPENDIR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +FAHandle* FAOpendir(const char* path); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FARemove.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FARemove.h new file mode 100644 index 0000000000..8305cc1bb4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FA/FARemove.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_FA_REMOVE_H +#define RVL_SDK_FA_REMOVE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int FARemove(const char* filepath); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS.h new file mode 100644 index 0000000000..d23c84522d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS.h @@ -0,0 +1,16 @@ +/** + * References: WiiBrew + */ + +#ifndef RVL_SDK_PUBLIC_FS_H +#define RVL_SDK_PUBLIC_FS_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS/fs.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS/fs.h new file mode 100644 index 0000000000..e614210965 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/FS/fs.h @@ -0,0 +1,73 @@ +#ifndef RVL_SDK_FS_H +#define RVL_SDK_FS_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define FS_MAX_PATH 64 + +typedef void (*FSAsyncCallback)(s32 result, void* arg); + +typedef struct FSStats { + char UNK_0x0[0x1C]; +} FSStats; + +// Could be more fields, but not larger than 32B +typedef struct FSFileStats { + u32 length; // at 0x0 + u32 position; // at 0x4 +} FSFileStats ALIGN(32); + +s32 ISFS_OpenLib(void); +s32 ISFS_CreateDir(const char* path, u32 attr, u32 ownerPerm, u32 groupPerm, + u32 otherPerm); +s32 ISFS_CreateDirAsync(const char* path, u32 attr, u32 ownerPerm, + u32 groupPerm, u32 otherPerm, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_ReadDir(const char* path, char* filesOut, u32* fileCountOut); +s32 ISFS_ReadDirAsync(const char* path, char* filesOut, u32* fileCountOut, + FSAsyncCallback callback, void* callbackArg); +s32 ISFS_GetAttr(const char* path, u32* ownerIdOut, u16* groupIdOut, + u32* attrOut, u32* ownerPermOut, u32* groupPermOut, + u32* otherPermOut); +s32 ISFS_GetAttrAsync(const char* path, u32* ownerIdOut, u16* groupIdOut, + u32* attrOut, u32* ownerPermOut, u32* groupPermOut, + u32* otherPermOut, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_Delete(const char* path); +s32 ISFS_DeleteAsync(const char* path, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_Rename(const char* from, const char* to); +s32 ISFS_RenameAsync(const char* from, const char* to, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_GetUsage(const char* path, s32* blockCountOut, s32* fileCountOut); +s32 ISFS_CreateFile(const char* path, u32 attr, u32 ownerPerm, u32 groupPerm, + u32 otherPerm); +s32 ISFS_CreateFileAsync(const char* path, u32 attr, u32 ownerPerm, + u32 groupPerm, u32 otherPerm, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_Open(const char* path, IPCOpenMode mode); +s32 ISFS_OpenAsync(const char* path, IPCOpenMode mode, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_GetFileStats(s32 fd, FSFileStats* statsOut); +s32 ISFS_GetFileStatsAsync(s32 fd, FSFileStats* statsOut, + FSAsyncCallback callback, void* callbackArg); +s32 ISFS_Seek(s32 fd, s32 offset, IPCSeekMode mode); +s32 ISFS_SeekAsync(s32 fd, s32 offset, IPCSeekMode mode, + FSAsyncCallback callback, void* callbackArg); +s32 ISFS_Read(s32 fd, void* dst, s32 len); +s32 ISFS_ReadAsync(s32 fd, void* dst, s32 len, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_Write(s32 fd, const void* src, s32 len); +s32 ISFS_WriteAsync(s32 fd, const void* src, s32 len, FSAsyncCallback callback, + void* callbackArg); +s32 ISFS_Close(s32 fd); +s32 ISFS_CloseAsync(s32 fd, FSAsyncCallback callback, void* callbackArg); +s32 ISFS_ShutdownAsync(FSAsyncCallback callback, void* callbackArg); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX.h new file mode 100644 index 0000000000..ea88e0e929 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX.h @@ -0,0 +1,36 @@ +/** + * References: YAGCD, Dolphin Emulator, publicly available patents + */ + +#ifndef RVL_SDK_PUBLIC_GX_H +#define RVL_SDK_PUBLIC_GX_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXAttr.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXAttr.h new file mode 100644 index 0000000000..36534215cd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXAttr.h @@ -0,0 +1,57 @@ +#ifndef RVL_SDK_GX_ATTR_H +#define RVL_SDK_GX_ATTR_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GXVtxDescList { + GXAttr attr; // at 0x0 + GXAttrType type; // at 0x4 +} GXVtxDescList; + +typedef struct _GXVtxAttrFmtList { + GXAttr attr; // at 0x0 + GXCompCnt compCnt; // at 0x4 + GXCompType compType; // at 0x8 + u8 shift; // at 0xC +} GXVtxAttrFmtList; + +void GXSetVtxDesc(GXAttr name, GXAttrType type); +void GXSetVtxDescv(const GXVtxDescList* list); +void GXGetVtxDesc(GXAttr name, GXAttrType* type); +void GXGetVtxDescv(GXVtxDescList* list); +void GXClearVtxDesc(void); +void GXSetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt compCnt, + GXCompType compType, u8 shift); + +// TODO: Please find a way to get rid of this +#ifdef GXATTR_MATCH_HACK +void GXSetVtxAttrFmtv(s16 fmt, const GXVtxAttrFmtList* list); +#else +void GXSetVtxAttrFmtv(GXVtxFmt fmt, const GXVtxAttrFmtList* list); +#endif + +void GXGetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt* compCnt, + GXCompType* compType, u8* shift); +void GXGetVtxAttrFmtv(GXVtxFmt fmt, GXVtxAttrFmtList* list); +void GXSetArray(GXAttr attr, const void* base, u8 stride); +void GXInvalidateVtxCache(void); +void GXSetTexCoordGen2(GXTexCoordID id, GXTexGenType type, GXTexGenSrc src, + u32 texMtxIdx, GXBool normalize, u32 dualTexMtxIdx); +void GXSetNumTexGens(u8 num); + +void __GXSetVCD(void); +void __GXCalculateVLim(void); +void __GXSetVAT(void); + +inline void GXSetTexCoordGen(GXTexCoordID id, GXTexGenType type, + GXTexGenSrc src, u32 texMtxIdx) { + GXSetTexCoordGen2(id, type, src, texMtxIdx, FALSE, GX_DUALMTX_IDENT); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXBump.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXBump.h new file mode 100644 index 0000000000..e1b6106caf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXBump.h @@ -0,0 +1,29 @@ +#ifndef RVL_SDK_GX_BUMP_H +#define RVL_SDK_GX_BUMP_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void GXSetTevIndirect(GXTevStageID tevStage, GXIndTexStageID texStage, + GXIndTexFormat texFmt, GXIndTexBiasSel biasSel, + GXIndTexMtxID mtxId, GXIndTexWrap wrapS, + GXIndTexWrap wrapT, GXBool addPrev, GXBool utcLod, + GXIndTexAlphaSel alphaSel); +void GXSetIndTexMtx(GXIndTexMtxID id, const f32 offset[2][3], s8 scaleExp); +void GXSetIndTexCoordScale(GXIndTexStageID stage, GXIndTexScale scaleS, + GXIndTexScale scaleT); +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); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDisplayList.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDisplayList.h new file mode 100644 index 0000000000..2e99b21266 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDisplayList.h @@ -0,0 +1,22 @@ +#ifndef RVL_SDK_GX_DISPLAY_LIST_H +#define RVL_SDK_GX_DISPLAY_LIST_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void GXBeginDisplayList(void* list, u32 size); +u32 GXEndDisplayList(void); +void GXCallDisplayList(void* list, u32 size); + +static void GXFastCallDisplayList(void* list, u32 size) { + WGPIPE.c = GX_FIFO_CMD_CALL_DL; + WGPIPE.p = list; + WGPIPE.ui = size; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDraw.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDraw.h new file mode 100644 index 0000000000..d2a93c7bca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXDraw.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_GX_DRAW_H +#define RVL_SDK_GX_DRAW_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void GXDrawCylinder(u8 sides); +void GXDrawSphere(u32 stacks, u32 sectors); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFifo.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFifo.h new file mode 100644 index 0000000000..233e427eae --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFifo.h @@ -0,0 +1,23 @@ +#ifndef RVL_SDK_GX_FIFO_H +#define RVL_SDK_GX_FIFO_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +GX_PUBLIC_STRUCT_DECL(GXFifoObj, 128); + +void GXGetGPStatus(u8*, u8*, u8*, u8*, u8*); + +void GXSetCPUFifo(GXFifoObj*); +BOOL GXGetCPUFifo(GXFifoObj*); + +u32 GXGetFifoCount(GXFifoObj*); +u8 GXGetFifoWrap(GXFifoObj*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFrameBuf.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFrameBuf.h new file mode 100644 index 0000000000..4fd769c654 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXFrameBuf.h @@ -0,0 +1,43 @@ +#ifndef RVL_SDK_GX_FRAMEBUF_H +#define RVL_SDK_GX_FRAMEBUF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GXRenderModeObj { + u32 tvInfo; // at 0x0 + u16 fbWidth; // at 0x4 + u16 efbHeight; // at 0x6 + u16 xfbHeight; // at 0x8 + u16 viXOrigin; // at 0xA + u16 viYOrigin; // at 0xC + u16 viWidth; // at 0xE + u16 viHeight; // at 0x10 + u32 xfbMode; // at 0x14 + u8 field_rendering; // at 0x18 + u8 aa; // at 0x19 + u8 sample_pattern[12][2]; // at 0x1A + u8 vfilter[7]; // at 0x32 +} GXRenderModeObj; + +extern GXRenderModeObj GXNtsc480IntDf; +extern GXRenderModeObj GXPal528IntDf; +extern GXRenderModeObj GXEurgb60Hz480IntDf; +extern GXRenderModeObj GXMpal480IntDf; + +void GXSetTexCopySrc(u16 x, u16 y, u16 w, u16 h); +void GXSetTexCopyDst(u16 w, u16 h, GXTexFmt fmt, GXBool mipmap); + +void GXSetCopyClamp(GXCopyClamp clamp); + +void GXSetCopyClear(GXColor color, u32 z); +void GXSetCopyFilter(GXBool, u8 sample_pattern[12][2], GXBool, u8 vfilter[7]); + +void GXCopyDisp(void*, GXBool); +void GXCopyTex(void*, GXBool); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXGeometry.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXGeometry.h new file mode 100644 index 0000000000..f949f0f5ee --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXGeometry.h @@ -0,0 +1,26 @@ +#ifndef RVL_SDK_GX_GEOMETRY_H +#define RVL_SDK_GX_GEOMETRY_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void GXBegin(GXPrimitive prim, GXVtxFmt fmt, u16 verts); +inline void GXEnd(void) {} + +void GXSetLineWidth(u8 width, u32 offset); +void GXSetPointSize(u8 size, u32 offset); +void GXEnableTexOffsets(GXTexCoordID coordId, GXBool lineOfs, GXBool pointOfs); +void GXSetCullMode(GXCullMode mode); +void GXGetCullMode(GXCullMode* out); +void GXSetCoPlanar(GXBool coplanar); + +void __GXSetDirtyState(void); +void __GXSendFlushPrim(void); +void __GXSetGenMode(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardware.h new file mode 100644 index 0000000000..7d2f980d71 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardware.h @@ -0,0 +1,230 @@ +/** + * For more details, see: + * https://www.gc-forever.com/yagcd/chap8.html#sec8 + * https://www.gc-forever.com/yagcd/chap5.html#sec5 + * https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/BPMemory.h + * https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/XFMemory.h + * https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoCommon/OpcodeDecoding.h + * https://patents.google.com/patent/US6700586B1/en + * https://patents.google.com/patent/US6639595B1/en + * https://patents.google.com/patent/US7002591 + * https://patents.google.com/patent/US6697074 + */ + +#ifndef RVL_SDK_GX_HARDWARE_H +#define RVL_SDK_GX_HARDWARE_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************ + * + * + * GX FIFO + * + * + ***********************************************************/ + +/** + * FIFO write/gather pipe + */ +extern volatile union { + // 1-byte + char c; + unsigned char uc; + // 2-byte + short s; + unsigned short us; + // 4-byte + int i; + unsigned int ui; + void* p; + float f; +} WGPIPE +// Codewarrior allows specifying symbold addr with ':' +// however this breaks other compilers +#ifdef __MWERKS__ + : 0xCC008000 +#endif +; + +/** + * FIFO commands + */ +typedef enum { + GX_FIFO_CMD_NOOP = 0x00, + + GX_FIFO_CMD_LOAD_BP_REG = 0x61, + GX_FIFO_CMD_LOAD_CP_REG = 0x08, + GX_FIFO_CMD_LOAD_XF_REG = 0x10, + + GX_FIFO_CMD_LOAD_INDX_A = 0x20, + GX_FIFO_CMD_LOAD_INDX_B = 0x28, + GX_FIFO_CMD_LOAD_INDX_C = 0x30, + GX_FIFO_CMD_LOAD_INDX_D = 0x38, + + GX_FIFO_CMD_CALL_DL = 0x40, + GX_FIFO_CMD_INVAL_VTX = 0x48 +} GXFifoCmd; + +#define __GX_FIFO_SET_LOAD_INDX_DST(reg, x) ((reg) = GX_BITSET(reg, 20, 12, x)) +#define __GX_FIFO_SET_LOAD_INDX_NELEM(reg, x) ((reg) = GX_BITSET(reg, 16, 4, x)) +#define __GX_FIFO_SET_LOAD_INDX_INDEX(reg, x) ((reg) = GX_BITSET(reg, 0, 16, x)) + +#define __GX_FIFO_LOAD_INDX(reg, dst, nelem, index) \ + { \ + u32 cmd = 0; \ + __GX_FIFO_SET_LOAD_INDX_DST(cmd, dst); \ + __GX_FIFO_SET_LOAD_INDX_NELEM(cmd, nelem); \ + __GX_FIFO_SET_LOAD_INDX_INDEX(cmd, index); \ + WGPIPE.c = reg; \ + WGPIPE.i = cmd; \ + } + +#define GX_FIFO_LOAD_INDX_A(dst, nelem, index) \ + __GX_FIFO_LOAD_INDX(GX_FIFO_CMD_LOAD_INDX_A, dst, nelem, index) + +#define GX_FIFO_LOAD_INDX_B(dst, nelem, index) \ + __GX_FIFO_LOAD_INDX(GX_FIFO_CMD_LOAD_INDX_B, dst, nelem, index) + +#define GX_FIFO_LOAD_INDX_C(dst, nelem, index) \ + __GX_FIFO_LOAD_INDX(GX_FIFO_CMD_LOAD_INDX_C, dst, nelem, index) + +#define GX_FIFO_LOAD_INDX_D(dst, nelem, index) \ + __GX_FIFO_LOAD_INDX(GX_FIFO_CMD_LOAD_INDX_D, dst, nelem, index) + +/************************************************************ + * + * + * GX Blitting Processor (BP) + * + * + ***********************************************************/ + +/** + * Load immediate value into BP register + */ +#define GX_BP_LOAD_REG(data) \ + WGPIPE.c = GX_FIFO_CMD_LOAD_BP_REG; \ + WGPIPE.i = (data); + +/** + * Set BP command opcode (first 8 bits) + */ +#define GX_BP_SET_OPCODE(cmd, opcode) (cmd) = GX_BITSET(cmd, 0, 8, (opcode)) + +#define GX_BP_OPCODE_SHIFT 24 +#define GX_BP_CMD_SZ (sizeof(u8) + sizeof(u32)) + +/************************************************************ + * + * + * GX Command Processor (CP) + * + * + ***********************************************************/ + +/** + * Load immediate value into CP register + */ +#define GX_CP_LOAD_REG(addr, data) \ + WGPIPE.c = GX_FIFO_CMD_LOAD_CP_REG; \ + WGPIPE.c = (addr); \ + WGPIPE.i = (data); + +#define GX_CP_CMD_SZ (sizeof(u8) + sizeof(u8) + sizeof(u32)) + +/************************************************************ + * + * + * GX Transform Unit (XF) + * + * + ***********************************************************/ + +/** + * XF memory + */ +typedef enum { + GX_XF_MEM_POSMTX = 0x0000, + GX_XF_MEM_NRMMTX = 0x0400, + GX_XF_MEM_DUALTEXMTX = 0x0500, + GX_XF_MEM_LIGHTOBJ = 0x0600 +} GXXfMem; + +/** + * Header for an XF register load + */ +#define GX_XF_LOAD_REG_HDR(addr) \ + WGPIPE.c = GX_FIFO_CMD_LOAD_XF_REG; \ + WGPIPE.i = (addr); + +/** + * Load immediate value into XF register + */ +#define GX_XF_LOAD_REG(addr, data) \ + GX_XF_LOAD_REG_HDR(addr); \ + WGPIPE.i = (data); + +#define GX_XF_CMD_SZ (sizeof(u8) + sizeof(u32) + sizeof(u32)) + +/** + * Load immediate values into multiple XF registers + */ +#define GX_XF_LOAD_REGS(size, addr) \ + { \ + u32 cmd = 0; \ + cmd |= (addr); \ + cmd |= (size) << 16; \ + GX_XF_LOAD_REG_HDR(cmd); \ + } + +/** + * Enums for Tex0-Tex7 register fields + */ +typedef enum { + GX_XF_TEX_PROJ_ST, // (s,t): texmul is 2x4 + GX_XF_TEX_PROJ_STQ // (s,t,q): texmul is 3x4 +} GXXfTexProj; + +typedef enum { + GX_XF_TEX_FORM_AB11, // (A, B, 1.0, 1.0) (used for regular texture source) + GX_XF_TEX_FORM_ABC1 // (A, B, C, 1.0) (used for geometry or normal source) +} GXXfTexForm; + +typedef enum { + GX_XF_TG_REGULAR, // Regular transformation (transform incoming data) + GX_XF_TG_BUMP, // Texgen bump mapping + + GX_XF_TG_CLR0, // Color texgen: (s,t)=(r,g:b) (g and b are concatenated), + // color0 + + GX_XF_TG_CLR1 // Color texgen: (s,t)=(r,g:b) (g and b are concatenated), + // color1 +} GXXfTexGen; + +/** + * Misc. hardware enums + */ +typedef enum { + GX_RAS_COLOR0A0, + GX_RAS_COLOR1A1, + GX_RAS_ALPHA_BUMP = 5, + GX_RAS_ALPHA_BUMPN, + GX_RAS_COLOR_ZERO, + + GX_RAS_MAX_CHANNEL +} GXRasChannelID; + +typedef enum { + GX_TEVREG_COLOR, + GX_TEVREG_KONST, +} GXTevRegType; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareBP.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareBP.h new file mode 100644 index 0000000000..5d623ffbc1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareBP.h @@ -0,0 +1,1907 @@ +#ifndef RVL_SDK_GX_HARDWARE_BP_H +#define RVL_SDK_GX_HARDWARE_BP_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * + * + * GX Blitting Processor (BP) + * + * + *****************************************************************************/ + +/** + * BP registers + */ +typedef enum { + GX_BP_REG_GENMODE = 0x0, + GX_BP_REG_DISPCOPYFILTER0 = 0x1, + GX_BP_REG_DISPCOPYFILTER1 = 0x2, + GX_BP_REG_DISPCOPYFILTER2 = 0x3, + GX_BP_REG_DISPCOPYFILTER3 = 0x4, + GX_BP_REG_INDMTX0A = 0x6, + GX_BP_REG_INDMTX0B = 0x7, + GX_BP_REG_INDMTX0C = 0x8, + GX_BP_REG_INDMTX1A = 0x9, + GX_BP_REG_INDMTX1B = 0xA, + GX_BP_REG_INDMTX1C = 0xB, + GX_BP_REG_INDMTX2A = 0xC, + GX_BP_REG_INDMTX2B = 0xD, + GX_BP_REG_INDMTX2C = 0xE, + GX_BP_REG_INDIMASK = 0xF, + GX_BP_REG_INDTEVSTAGE0 = 0x10, + GX_BP_REG_INDTEVSTAGE1 = 0x11, + GX_BP_REG_INDTEVSTAGE2 = 0x12, + GX_BP_REG_INDTEVSTAGE3 = 0x13, + GX_BP_REG_INDTEVSTAGE4 = 0x14, + GX_BP_REG_INDTEVSTAGE5 = 0x15, + GX_BP_REG_INDTEVSTAGE6 = 0x16, + GX_BP_REG_INDTEVSTAGE7 = 0x17, + GX_BP_REG_INDTEVSTAGE8 = 0x18, + GX_BP_REG_INDTEVSTAGE9 = 0x19, + GX_BP_REG_INDTEVSTAGE10 = 0x1A, + GX_BP_REG_INDTEVSTAGE11 = 0x1B, + GX_BP_REG_INDTEVSTAGE12 = 0x1C, + GX_BP_REG_INDTEVSTAGE13 = 0x1D, + GX_BP_REG_INDTEVSTAGE14 = 0x1E, + GX_BP_REG_INDTEVSTAGE15 = 0x1F, + GX_BP_REG_SCISSORTL = 0x20, + GX_BP_REG_SCISSORBR = 0x21, + GX_BP_REG_LINEPTWIDTH = 0x22, + GX_BP_REG_PERF0TRI = 0x23, + GX_BP_REG_PERF0QUAD = 0x24, + GX_BP_REG_RAS1_SS0 = 0x25, + GX_BP_REG_RAS1_SS1 = 0x26, + GX_BP_REG_RAS1_IREF = 0x27, + GX_BP_REG_RAS1_TREF0 = 0x28, + GX_BP_REG_RAS1_TREF1 = 0x29, + GX_BP_REG_RAS1_TREF2 = 0x2A, + GX_BP_REG_RAS1_TREF3 = 0x2B, + GX_BP_REG_RAS1_TREF4 = 0x2C, + GX_BP_REG_RAS1_TREF5 = 0x2D, + GX_BP_REG_RAS1_TREF6 = 0x2E, + GX_BP_REG_RAS1_TREF7 = 0x2F, + GX_BP_REG_SU_SSIZE0 = 0x30, + GX_BP_REG_SU_TSIZE0 = 0x31, + GX_BP_REG_SU_SSIZE1 = 0x32, + GX_BP_REG_SU_TSIZE1 = 0x33, + GX_BP_REG_SU_SSIZE2 = 0x34, + GX_BP_REG_SU_TSIZE2 = 0x35, + GX_BP_REG_SU_SSIZE3 = 0x36, + GX_BP_REG_SU_TSIZE3 = 0x37, + GX_BP_REG_SU_SSIZE4 = 0x38, + GX_BP_REG_SU_TSIZE4 = 0x39, + GX_BP_REG_SU_SSIZE5 = 0x3A, + GX_BP_REG_SU_TSIZE5 = 0x3B, + GX_BP_REG_SU_SSIZE6 = 0x3C, + GX_BP_REG_SU_TSIZE6 = 0x3D, + GX_BP_REG_SU_SSIZE7 = 0x3E, + GX_BP_REG_SU_TSIZE7 = 0x3F, + GX_BP_REG_ZMODE = 0x40, + GX_BP_REG_BLENDMODE = 0x41, + GX_BP_REG_DSTALPHA = 0x42, + GX_BP_REG_ZCONTROL = 0x43, + GX_BP_REG_FIELDMASK = 0x44, + GX_BP_REG_DRAWDONE = 0x45, + GX_BP_REG_PETOKEN = 0x47, + GX_BP_REG_PETOKENINT = 0x48, + GX_BP_REG_TEXCOPYSRCXY = 0x49, + GX_BP_REG_TEXCOPYSRCWH = 0x4A, + GX_BP_REG_TEXCOPYDST = 0x4B, + GX_BP_REG_DISPCOPYSTRIDE = 0x4D, + GX_BP_REG_DISPCOPYSCALEY = 0x4E, + GX_BP_REG_COPYCLEARAR = 0x4F, + GX_BP_REG_COPYCLEARGB = 0x50, + GX_BP_REG_COPYCLEARZ = 0x51, + GX_BP_REG_COPYFILTER0 = 0x53, + GX_BP_REG_COPYFILTER1 = 0x54, + GX_BP_REG_BOUNDINGBOX0 = 0x55, + GX_BP_REG_BOUNDINGBOX1 = 0x56, + GX_BP_REG_SCISSOROFFSET = 0x59, + GX_BP_REG_TMEMPRELOADADDR = 0x60, + GX_BP_REG_TMEMPRELOADEVEN = 0x61, + GX_BP_REG_TMEMPRELOADODD = 0x62, + GX_BP_REG_TMEMPRELOADMODE = 0x63, + GX_BP_REG_TMEMTLUTSRC = 0x64, + GX_BP_REG_TMEMTLUTDST = 0x65, + GX_BP_REG_TMEMTEXINVALIDATE = 0x66, + GX_BP_REG_PERF1 = 0x67, + GX_BP_REG_FIELDMODE = 0x68, + GX_BP_REG_SETMODE0_TEX0 = 0x80, + GX_BP_REG_SETMODE0_TEX1 = 0x81, + GX_BP_REG_SETMODE0_TEX2 = 0x82, + GX_BP_REG_SETMODE0_TEX3 = 0x83, + GX_BP_REG_SETMODE1_TEX0 = 0x84, + GX_BP_REG_SETMODE1_TEX1 = 0x85, + GX_BP_REG_SETMODE1_TEX2 = 0x86, + GX_BP_REG_SETMODE1_TEX3 = 0x87, + GX_BP_REG_SETIMAGE0_TEX0 = 0x88, + GX_BP_REG_SETIMAGE0_TEX1 = 0x89, + GX_BP_REG_SETIMAGE0_TEX2 = 0x8A, + GX_BP_REG_SETIMAGE0_TEX3 = 0x8B, + GX_BP_REG_SETIMAGE1_TEX0 = 0x8C, + GX_BP_REG_SETIMAGE1_TEX1 = 0x8D, + GX_BP_REG_SETIMAGE1_TEX2 = 0x8E, + GX_BP_REG_SETIMAGE1_TEX3 = 0x8F, + GX_BP_REG_SETIMAGE2_TEX0 = 0x90, + GX_BP_REG_SETIMAGE2_TEX1 = 0x91, + GX_BP_REG_SETIMAGE2_TEX2 = 0x92, + GX_BP_REG_SETIMAGE2_TEX3 = 0x93, + GX_BP_REG_SETIMAGE3_TEX0 = 0x94, + GX_BP_REG_SETIMAGE3_TEX1 = 0x95, + GX_BP_REG_SETIMAGE3_TEX2 = 0x96, + GX_BP_REG_SETIMAGE3_TEX3 = 0x97, + GX_BP_REG_SETTLUT_TEX0 = 0x98, + GX_BP_REG_SETTLUT_TEX1 = 0x99, + GX_BP_REG_SETTLUT_TEX2 = 0x9A, + GX_BP_REG_SETTLUT_TEX3 = 0x9B, + GX_BP_REG_SETMODE0_TEX4 = 0xA0, + GX_BP_REG_SETMODE0_TEX5 = 0xA1, + GX_BP_REG_SETMODE0_TEX6 = 0xA2, + GX_BP_REG_SETMODE0_TEX7 = 0xA3, + GX_BP_REG_SETMODE1_TEX4 = 0xA4, + GX_BP_REG_SETMODE1_TEX5 = 0xA5, + GX_BP_REG_SETMODE1_TEX6 = 0xA6, + GX_BP_REG_SETMODE1_TEX7 = 0xA7, + GX_BP_REG_SETIMAGE0_TEX4 = 0xA8, + GX_BP_REG_SETIMAGE0_TEX5 = 0xA9, + GX_BP_REG_SETIMAGE0_TEX6 = 0xAA, + GX_BP_REG_SETIMAGE0_TEX7 = 0xAB, + GX_BP_REG_SETIMAGE1_TEX4 = 0xAC, + GX_BP_REG_SETIMAGE1_TEX5 = 0xAD, + GX_BP_REG_SETIMAGE1_TEX6 = 0xAE, + GX_BP_REG_SETIMAGE1_TEX7 = 0xAF, + GX_BP_REG_SETIMAGE2_TEX4 = 0xB0, + GX_BP_REG_SETIMAGE2_TEX5 = 0xB1, + GX_BP_REG_SETIMAGE2_TEX6 = 0xB2, + GX_BP_REG_SETIMAGE2_TEX7 = 0xB3, + GX_BP_REG_SETIMAGE3_TEX4 = 0xB4, + GX_BP_REG_SETIMAGE3_TEX5 = 0xB5, + GX_BP_REG_SETIMAGE3_TEX6 = 0xB6, + GX_BP_REG_SETIMAGE3_TEX7 = 0xB7, + GX_BP_REG_SETTLUT_TEX4 = 0xB8, + GX_BP_REG_SETTLUT_TEX5 = 0xB9, + GX_BP_REG_SETTLUT_TEX6 = 0xBA, + GX_BP_REG_SETTLUT_TEX7 = 0xBB, + GX_BP_REG_TEVCOLORCOMBINER0 = 0xC0, + GX_BP_REG_TEVALPHACOMBINER0 = 0xC1, + GX_BP_REG_TEVCOLORCOMBINER1 = 0xC2, + GX_BP_REG_TEVALPHACOMBINER1 = 0xC3, + GX_BP_REG_TEVCOLORCOMBINER2 = 0xC4, + GX_BP_REG_TEVALPHACOMBINER2 = 0xC5, + GX_BP_REG_TEVCOLORCOMBINER3 = 0xC6, + GX_BP_REG_TEVALPHACOMBINER3 = 0xC7, + GX_BP_REG_TEVCOLORCOMBINER4 = 0xC8, + GX_BP_REG_TEVALPHACOMBINER4 = 0xC9, + GX_BP_REG_TEVCOLORCOMBINER5 = 0xCA, + GX_BP_REG_TEVALPHACOMBINER5 = 0xCB, + GX_BP_REG_TEVCOLORCOMBINER6 = 0xCC, + GX_BP_REG_TEVALPHACOMBINER6 = 0xCD, + GX_BP_REG_TEVCOLORCOMBINER7 = 0xCE, + GX_BP_REG_TEVALPHACOMBINER7 = 0xCF, + GX_BP_REG_TEVCOLORCOMBINER8 = 0xD0, + GX_BP_REG_TEVALPHACOMBINER8 = 0xD1, + GX_BP_REG_TEVCOLORCOMBINER9 = 0xD2, + GX_BP_REG_TEVALPHACOMBINER9 = 0xD3, + GX_BP_REG_TEVCOLORCOMBINER10 = 0xD4, + GX_BP_REG_TEVALPHACOMBINER10 = 0xD5, + GX_BP_REG_TEVCOLORCOMBINER11 = 0xD6, + GX_BP_REG_TEVALPHACOMBINER11 = 0xD7, + GX_BP_REG_TEVCOLORCOMBINER12 = 0xD8, + GX_BP_REG_TEVALPHACOMBINER12 = 0xD9, + GX_BP_REG_TEVCOLORCOMBINER13 = 0xDA, + GX_BP_REG_TEVALPHACOMBINER13 = 0xDB, + GX_BP_REG_TEVCOLORCOMBINER14 = 0xDC, + GX_BP_REG_TEVALPHACOMBINER14 = 0xDD, + GX_BP_REG_TEVCOLORCOMBINER15 = 0xDE, + GX_BP_REG_TEVALPHACOMBINER15 = 0xDF, + GX_BP_REG_TEVREG0LO = 0xE0, + GX_BP_REG_TEVREG0HI = 0xE1, + GX_BP_REG_TEVREG1LO = 0xE2, + GX_BP_REG_TEVREG1HI = 0xE3, + GX_BP_REG_TEVREG2LO = 0xE4, + GX_BP_REG_TEVREG2HI = 0xE5, + GX_BP_REG_TEVREG3LO = 0xE6, + GX_BP_REG_TEVREG3HI = 0xE7, + GX_BP_REG_FOGRANGE = 0xE8, + GX_BP_REG_FOGRANGEK0 = 0xE9, + GX_BP_REG_FOGRANGEK1 = 0xEA, + GX_BP_REG_FOGRANGEK2 = 0xEB, + GX_BP_REG_FOGRANGEK3 = 0xEC, + GX_BP_REG_FOGRANGEK4 = 0xED, + GX_BP_REG_FOGPARAM0 = 0xEE, + GX_BP_REG_FOGPARAM1 = 0xEF, + GX_BP_REG_FOGPARAM2 = 0xF0, + GX_BP_REG_FOGPARAM3 = 0xF1, + GX_BP_REG_FOGCOLOR = 0xF2, + GX_BP_REG_ALPHACOMPARE = 0xF3, + GX_BP_REG_ZTEXTURE0 = 0xF4, + GX_BP_REG_ZTEXTURE1 = 0xF5, + GX_BP_REG_TEVKSEL0 = 0xF6, + GX_BP_REG_TEVKSEL1 = 0xF7, + GX_BP_REG_TEVKSEL2 = 0xF8, + GX_BP_REG_TEVKSEL3 = 0xF9, + GX_BP_REG_TEVKSEL4 = 0xFA, + GX_BP_REG_TEVKSEL5 = 0xFB, + GX_BP_REG_TEVKSEL6 = 0xFC, + GX_BP_REG_TEVKSEL7 = 0xFD, + GX_BP_REG_SSMASK = 0xFE, +} GX_BP_REG; + +/****************************************************************************** + * BP register 0x0 - GenMode + *****************************************************************************/ +// NUMTEX [28:31] (4) - Active texture count + /* start bit */ #define GX_BP_GENMODE_NUMTEX_B 28 + /* end bit */ #define GX_BP_GENMODE_NUMTEX_E 31 + /* bit size */ #define GX_BP_GENMODE_NUMTEX_SZ 4 + + /* raw mask */ #define GX_BP_GENMODE_NUMTEX_MASK (((1 << 4) - 1) << 31 - 31) + /* local mask */ #define GX_BP_GENMODE_NUMTEX_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_GENMODE_NUMTEX_SHIFT 0 + + /* get value */ #define GX_BP_GET_GENMODE_NUMTEX(reg) GX_BITGET((reg), 28, 4) + /* set value */ #define GX_BP_SET_GENMODE_NUMTEX(reg, x) ((reg) = GX_BITSET((reg), 28, 4, x)) + +// NUMCOLORS [25:27] (3) - Color/channel count + /* start bit */ #define GX_BP_GENMODE_NUMCOLORS_B 25 + /* end bit */ #define GX_BP_GENMODE_NUMCOLORS_E 27 + /* bit size */ #define GX_BP_GENMODE_NUMCOLORS_SZ 3 + + /* raw mask */ #define GX_BP_GENMODE_NUMCOLORS_MASK (((1 << 3) - 1) << 31 - 27) + /* local mask */ #define GX_BP_GENMODE_NUMCOLORS_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_GENMODE_NUMCOLORS_SHIFT 4 + + /* get value */ #define GX_BP_GET_GENMODE_NUMCOLORS(reg) GX_BITGET((reg), 25, 3) + /* set value */ #define GX_BP_SET_GENMODE_NUMCOLORS(reg, x) ((reg) = GX_BITSET((reg), 25, 3, x)) + +// MULTISAMPLE [22:22] (1) + /* start bit */ #define GX_BP_GENMODE_MULTISAMPLE_B 22 + /* end bit */ #define GX_BP_GENMODE_MULTISAMPLE_E 22 + /* bit size */ #define GX_BP_GENMODE_MULTISAMPLE_SZ 1 + + /* raw mask */ #define GX_BP_GENMODE_MULTISAMPLE_MASK (((1 << 1) - 1) << 31 - 22) + /* local mask */ #define GX_BP_GENMODE_MULTISAMPLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_GENMODE_MULTISAMPLE_SHIFT 9 + + /* get value */ #define GX_BP_GET_GENMODE_MULTISAMPLE(reg) GX_BITGET((reg), 22, 1) + /* set value */ #define GX_BP_SET_GENMODE_MULTISAMPLE(reg, x) ((reg) = GX_BITSET((reg), 22, 1, x)) + +// NUMTEVSTAGES [18:21] (4) + /* start bit */ #define GX_BP_GENMODE_NUMTEVSTAGES_B 18 + /* end bit */ #define GX_BP_GENMODE_NUMTEVSTAGES_E 21 + /* bit size */ #define GX_BP_GENMODE_NUMTEVSTAGES_SZ 4 + + /* raw mask */ #define GX_BP_GENMODE_NUMTEVSTAGES_MASK (((1 << 4) - 1) << 31 - 21) + /* local mask */ #define GX_BP_GENMODE_NUMTEVSTAGES_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_GENMODE_NUMTEVSTAGES_SHIFT 10 + + /* get value */ #define GX_BP_GET_GENMODE_NUMTEVSTAGES(reg) GX_BITGET((reg), 18, 4) + /* set value */ #define GX_BP_SET_GENMODE_NUMTEVSTAGES(reg, x) ((reg) = GX_BITSET((reg), 18, 4, x)) + +// CULLMODE [16:17] (2) + /* start bit */ #define GX_BP_GENMODE_CULLMODE_B 16 + /* end bit */ #define GX_BP_GENMODE_CULLMODE_E 17 + /* bit size */ #define GX_BP_GENMODE_CULLMODE_SZ 2 + + /* raw mask */ #define GX_BP_GENMODE_CULLMODE_MASK (((1 << 2) - 1) << 31 - 17) + /* local mask */ #define GX_BP_GENMODE_CULLMODE_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_GENMODE_CULLMODE_SHIFT 14 + + /* get value */ #define GX_BP_GET_GENMODE_CULLMODE(reg) GX_BITGET((reg), 16, 2) + /* set value */ #define GX_BP_SET_GENMODE_CULLMODE(reg, x) ((reg) = GX_BITSET((reg), 16, 2, x)) + +// NUMINDSTAGES [13:15] (3) + /* start bit */ #define GX_BP_GENMODE_NUMINDSTAGES_B 13 + /* end bit */ #define GX_BP_GENMODE_NUMINDSTAGES_E 15 + /* bit size */ #define GX_BP_GENMODE_NUMINDSTAGES_SZ 3 + + /* raw mask */ #define GX_BP_GENMODE_NUMINDSTAGES_MASK (((1 << 3) - 1) << 31 - 15) + /* local mask */ #define GX_BP_GENMODE_NUMINDSTAGES_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_GENMODE_NUMINDSTAGES_SHIFT 16 + + /* get value */ #define GX_BP_GET_GENMODE_NUMINDSTAGES(reg) GX_BITGET((reg), 13, 3) + /* set value */ #define GX_BP_SET_GENMODE_NUMINDSTAGES(reg, x) ((reg) = GX_BITSET((reg), 13, 3, x)) + +// COPLANAR [12:12] (1) - Toggle co-planar ("Z freeze" according to Dolphin) + /* start bit */ #define GX_BP_GENMODE_COPLANAR_B 12 + /* end bit */ #define GX_BP_GENMODE_COPLANAR_E 12 + /* bit size */ #define GX_BP_GENMODE_COPLANAR_SZ 1 + + /* raw mask */ #define GX_BP_GENMODE_COPLANAR_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_GENMODE_COPLANAR_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_GENMODE_COPLANAR_SHIFT 19 + + /* get value */ #define GX_BP_GET_GENMODE_COPLANAR(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_GENMODE_COPLANAR(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + + +/****************************************************************************** + * BP structure - IndMtxA + *****************************************************************************/ +// M00 [21:31] (11) - Texture offset matrix #0 [0][0] + /* start bit */ #define GX_BP_INDMTXA_M00_B 21 + /* end bit */ #define GX_BP_INDMTXA_M00_E 31 + /* bit size */ #define GX_BP_INDMTXA_M00_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXA_M00_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_INDMTXA_M00_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXA_M00_SHIFT 0 + + /* get value */ #define GX_BP_GET_INDMTXA_M00(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_INDMTXA_M00(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// M10 [10:20] (11) - Texture offset matrix #0 [1][0] + /* start bit */ #define GX_BP_INDMTXA_M10_B 10 + /* end bit */ #define GX_BP_INDMTXA_M10_E 20 + /* bit size */ #define GX_BP_INDMTXA_M10_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXA_M10_MASK (((1 << 11) - 1) << 31 - 20) + /* local mask */ #define GX_BP_INDMTXA_M10_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXA_M10_SHIFT 11 + + /* get value */ #define GX_BP_GET_INDMTXA_M10(reg) GX_BITGET((reg), 10, 11) + /* set value */ #define GX_BP_SET_INDMTXA_M10(reg, x) ((reg) = GX_BITSET((reg), 10, 11, x)) + +// EXP [8:9] (2) - Bits 0-1 of scaling exponent #0 (2^x) + /* start bit */ #define GX_BP_INDMTXA_EXP_B 8 + /* end bit */ #define GX_BP_INDMTXA_EXP_E 9 + /* bit size */ #define GX_BP_INDMTXA_EXP_SZ 2 + + /* raw mask */ #define GX_BP_INDMTXA_EXP_MASK (((1 << 2) - 1) << 31 - 9) + /* local mask */ #define GX_BP_INDMTXA_EXP_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDMTXA_EXP_SHIFT 22 + + /* get value */ #define GX_BP_GET_INDMTXA_EXP(reg) GX_BITGET((reg), 8, 2) + /* set value */ #define GX_BP_SET_INDMTXA_EXP(reg, x) ((reg) = GX_BITSET((reg), 8, 2, x)) + + +/****************************************************************************** + * BP structure - IndMtxB + *****************************************************************************/ +// M01 [21:31] (11) - Texture offset matrix #0 [0][1] + /* start bit */ #define GX_BP_INDMTXB_M01_B 21 + /* end bit */ #define GX_BP_INDMTXB_M01_E 31 + /* bit size */ #define GX_BP_INDMTXB_M01_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXB_M01_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_INDMTXB_M01_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXB_M01_SHIFT 0 + + /* get value */ #define GX_BP_GET_INDMTXB_M01(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_INDMTXB_M01(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// M11 [10:20] (11) - Texture offset matrix #0 [1][1] + /* start bit */ #define GX_BP_INDMTXB_M11_B 10 + /* end bit */ #define GX_BP_INDMTXB_M11_E 20 + /* bit size */ #define GX_BP_INDMTXB_M11_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXB_M11_MASK (((1 << 11) - 1) << 31 - 20) + /* local mask */ #define GX_BP_INDMTXB_M11_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXB_M11_SHIFT 11 + + /* get value */ #define GX_BP_GET_INDMTXB_M11(reg) GX_BITGET((reg), 10, 11) + /* set value */ #define GX_BP_SET_INDMTXB_M11(reg, x) ((reg) = GX_BITSET((reg), 10, 11, x)) + +// EXP [8:9] (2) - Bits 2-3 of scaling exponent #0 (2^x) + /* start bit */ #define GX_BP_INDMTXB_EXP_B 8 + /* end bit */ #define GX_BP_INDMTXB_EXP_E 9 + /* bit size */ #define GX_BP_INDMTXB_EXP_SZ 2 + + /* raw mask */ #define GX_BP_INDMTXB_EXP_MASK (((1 << 2) - 1) << 31 - 9) + /* local mask */ #define GX_BP_INDMTXB_EXP_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDMTXB_EXP_SHIFT 22 + + /* get value */ #define GX_BP_GET_INDMTXB_EXP(reg) GX_BITGET((reg), 8, 2) + /* set value */ #define GX_BP_SET_INDMTXB_EXP(reg, x) ((reg) = GX_BITSET((reg), 8, 2, x)) + + +/****************************************************************************** + * BP structure - IndMtxC + *****************************************************************************/ +// M02 [21:31] (11) - Texture offset matrix #0 [0][2] + /* start bit */ #define GX_BP_INDMTXC_M02_B 21 + /* end bit */ #define GX_BP_INDMTXC_M02_E 31 + /* bit size */ #define GX_BP_INDMTXC_M02_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXC_M02_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_INDMTXC_M02_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXC_M02_SHIFT 0 + + /* get value */ #define GX_BP_GET_INDMTXC_M02(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_INDMTXC_M02(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// M12 [10:20] (11) - Texture offset matrix #0 [1][2] + /* start bit */ #define GX_BP_INDMTXC_M12_B 10 + /* end bit */ #define GX_BP_INDMTXC_M12_E 20 + /* bit size */ #define GX_BP_INDMTXC_M12_SZ 11 + + /* raw mask */ #define GX_BP_INDMTXC_M12_MASK (((1 << 11) - 1) << 31 - 20) + /* local mask */ #define GX_BP_INDMTXC_M12_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_INDMTXC_M12_SHIFT 11 + + /* get value */ #define GX_BP_GET_INDMTXC_M12(reg) GX_BITGET((reg), 10, 11) + /* set value */ #define GX_BP_SET_INDMTXC_M12(reg, x) ((reg) = GX_BITSET((reg), 10, 11, x)) + +// EXP [8:9] (2) - Bit 4 of scaling exponent #0 (2^x) + /* start bit */ #define GX_BP_INDMTXC_EXP_B 8 + /* end bit */ #define GX_BP_INDMTXC_EXP_E 9 + /* bit size */ #define GX_BP_INDMTXC_EXP_SZ 2 + + /* raw mask */ #define GX_BP_INDMTXC_EXP_MASK (((1 << 2) - 1) << 31 - 9) + /* local mask */ #define GX_BP_INDMTXC_EXP_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDMTXC_EXP_SHIFT 22 + + /* get value */ #define GX_BP_GET_INDMTXC_EXP(reg) GX_BITGET((reg), 8, 2) + /* set value */ #define GX_BP_SET_INDMTXC_EXP(reg, x) ((reg) = GX_BITSET((reg), 8, 2, x)) + + +/****************************************************************************** + * BP register 0xF - IndIMask + *****************************************************************************/ +// IMASK [24:31] (8) - Indirect mask for textures + /* start bit */ #define GX_BP_INDIMASK_IMASK_B 24 + /* end bit */ #define GX_BP_INDIMASK_IMASK_E 31 + /* bit size */ #define GX_BP_INDIMASK_IMASK_SZ 8 + + /* raw mask */ #define GX_BP_INDIMASK_IMASK_MASK (((1 << 8) - 1) << 31 - 31) + /* local mask */ #define GX_BP_INDIMASK_IMASK_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_INDIMASK_IMASK_SHIFT 0 + + /* get value */ #define GX_BP_GET_INDIMASK_IMASK(reg) GX_BITGET((reg), 24, 8) + /* set value */ #define GX_BP_SET_INDIMASK_IMASK(reg, x) ((reg) = GX_BITSET((reg), 24, 8, x)) + + +/****************************************************************************** + * BP structure - IndTevStage + *****************************************************************************/ +// STAGE [30:31] (2) - Indirect texture stage ID + /* start bit */ #define GX_BP_INDTEVSTAGE_STAGE_B 30 + /* end bit */ #define GX_BP_INDTEVSTAGE_STAGE_E 31 + /* bit size */ #define GX_BP_INDTEVSTAGE_STAGE_SZ 2 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_STAGE_MASK (((1 << 2) - 1) << 31 - 31) + /* local mask */ #define GX_BP_INDTEVSTAGE_STAGE_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_STAGE_SHIFT 0 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_STAGE(reg) GX_BITGET((reg), 30, 2) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_STAGE(reg, x) ((reg) = GX_BITSET((reg), 30, 2, x)) + +// FORMAT [28:29] (2) - Indirect texture format + /* start bit */ #define GX_BP_INDTEVSTAGE_FORMAT_B 28 + /* end bit */ #define GX_BP_INDTEVSTAGE_FORMAT_E 29 + /* bit size */ #define GX_BP_INDTEVSTAGE_FORMAT_SZ 2 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_FORMAT_MASK (((1 << 2) - 1) << 31 - 29) + /* local mask */ #define GX_BP_INDTEVSTAGE_FORMAT_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_FORMAT_SHIFT 2 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_FORMAT(reg) GX_BITGET((reg), 28, 2) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_FORMAT(reg, x) ((reg) = GX_BITSET((reg), 28, 2, x)) + +// BIAS [25:27] (3) - Indirect texture bias + /* start bit */ #define GX_BP_INDTEVSTAGE_BIAS_B 25 + /* end bit */ #define GX_BP_INDTEVSTAGE_BIAS_E 27 + /* bit size */ #define GX_BP_INDTEVSTAGE_BIAS_SZ 3 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_BIAS_MASK (((1 << 3) - 1) << 31 - 27) + /* local mask */ #define GX_BP_INDTEVSTAGE_BIAS_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_BIAS_SHIFT 4 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_BIAS(reg) GX_BITGET((reg), 25, 3) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_BIAS(reg, x) ((reg) = GX_BITSET((reg), 25, 3, x)) + +// ALPHA [23:24] (2) - Indirect texture alpha + /* start bit */ #define GX_BP_INDTEVSTAGE_ALPHA_B 23 + /* end bit */ #define GX_BP_INDTEVSTAGE_ALPHA_E 24 + /* bit size */ #define GX_BP_INDTEVSTAGE_ALPHA_SZ 2 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_ALPHA_MASK (((1 << 2) - 1) << 31 - 24) + /* local mask */ #define GX_BP_INDTEVSTAGE_ALPHA_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_ALPHA_SHIFT 7 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_ALPHA(reg) GX_BITGET((reg), 23, 2) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_ALPHA(reg, x) ((reg) = GX_BITSET((reg), 23, 2, x)) + +// MTX [19:22] (4) - Indirect texture matrix + /* start bit */ #define GX_BP_INDTEVSTAGE_MTX_B 19 + /* end bit */ #define GX_BP_INDTEVSTAGE_MTX_E 22 + /* bit size */ #define GX_BP_INDTEVSTAGE_MTX_SZ 4 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_MTX_MASK (((1 << 4) - 1) << 31 - 22) + /* local mask */ #define GX_BP_INDTEVSTAGE_MTX_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_MTX_SHIFT 9 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_MTX(reg) GX_BITGET((reg), 19, 4) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_MTX(reg, x) ((reg) = GX_BITSET((reg), 19, 4, x)) + +// WRAPS [16:18] (3) - S component wrap factor + /* start bit */ #define GX_BP_INDTEVSTAGE_WRAPS_B 16 + /* end bit */ #define GX_BP_INDTEVSTAGE_WRAPS_E 18 + /* bit size */ #define GX_BP_INDTEVSTAGE_WRAPS_SZ 3 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_WRAPS_MASK (((1 << 3) - 1) << 31 - 18) + /* local mask */ #define GX_BP_INDTEVSTAGE_WRAPS_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_WRAPS_SHIFT 13 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_WRAPS(reg) GX_BITGET((reg), 16, 3) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_WRAPS(reg, x) ((reg) = GX_BITSET((reg), 16, 3, x)) + +// WRAPT [13:15] (3) - T component wrap factor + /* start bit */ #define GX_BP_INDTEVSTAGE_WRAPT_B 13 + /* end bit */ #define GX_BP_INDTEVSTAGE_WRAPT_E 15 + /* bit size */ #define GX_BP_INDTEVSTAGE_WRAPT_SZ 3 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_WRAPT_MASK (((1 << 3) - 1) << 31 - 15) + /* local mask */ #define GX_BP_INDTEVSTAGE_WRAPT_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_WRAPT_SHIFT 16 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_WRAPT(reg) GX_BITGET((reg), 13, 3) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_WRAPT(reg, x) ((reg) = GX_BITSET((reg), 13, 3, x)) + +// UTCLOD [12:12] (1) - Whether to use unmodified texcoords for mipmaps + /* start bit */ #define GX_BP_INDTEVSTAGE_UTCLOD_B 12 + /* end bit */ #define GX_BP_INDTEVSTAGE_UTCLOD_E 12 + /* bit size */ #define GX_BP_INDTEVSTAGE_UTCLOD_SZ 1 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_UTCLOD_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_INDTEVSTAGE_UTCLOD_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_UTCLOD_SHIFT 19 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_UTCLOD(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_UTCLOD(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + +// ADDPREV [11:11] (1) - Whether to add in results from previous tev stage + /* start bit */ #define GX_BP_INDTEVSTAGE_ADDPREV_B 11 + /* end bit */ #define GX_BP_INDTEVSTAGE_ADDPREV_E 11 + /* bit size */ #define GX_BP_INDTEVSTAGE_ADDPREV_SZ 1 + + /* raw mask */ #define GX_BP_INDTEVSTAGE_ADDPREV_MASK (((1 << 1) - 1) << 31 - 11) + /* local mask */ #define GX_BP_INDTEVSTAGE_ADDPREV_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_INDTEVSTAGE_ADDPREV_SHIFT 20 + + /* get value */ #define GX_BP_GET_INDTEVSTAGE_ADDPREV(reg) GX_BITGET((reg), 11, 1) + /* set value */ #define GX_BP_SET_INDTEVSTAGE_ADDPREV(reg, x) ((reg) = GX_BITSET((reg), 11, 1, x)) + + +/****************************************************************************** + * BP register 0x20 - scissorTL + *****************************************************************************/ +// TOP [21:31] (11) - Top component + /* start bit */ #define GX_BP_SCISSORTL_TOP_B 21 + /* end bit */ #define GX_BP_SCISSORTL_TOP_E 31 + /* bit size */ #define GX_BP_SCISSORTL_TOP_SZ 11 + + /* raw mask */ #define GX_BP_SCISSORTL_TOP_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_SCISSORTL_TOP_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_SCISSORTL_TOP_SHIFT 0 + + /* get value */ #define GX_BP_GET_SCISSORTL_TOP(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_SCISSORTL_TOP(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// LEFT [9:19] (11) - Left component + /* start bit */ #define GX_BP_SCISSORTL_LEFT_B 9 + /* end bit */ #define GX_BP_SCISSORTL_LEFT_E 19 + /* bit size */ #define GX_BP_SCISSORTL_LEFT_SZ 11 + + /* raw mask */ #define GX_BP_SCISSORTL_LEFT_MASK (((1 << 11) - 1) << 31 - 19) + /* local mask */ #define GX_BP_SCISSORTL_LEFT_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_SCISSORTL_LEFT_SHIFT 12 + + /* get value */ #define GX_BP_GET_SCISSORTL_LEFT(reg) GX_BITGET((reg), 9, 11) + /* set value */ #define GX_BP_SET_SCISSORTL_LEFT(reg, x) ((reg) = GX_BITSET((reg), 9, 11, x)) + + +/****************************************************************************** + * BP register 0x21 - scissorBR + *****************************************************************************/ +// BOT [21:31] (11) - Bottom component + /* start bit */ #define GX_BP_SCISSORBR_BOT_B 21 + /* end bit */ #define GX_BP_SCISSORBR_BOT_E 31 + /* bit size */ #define GX_BP_SCISSORBR_BOT_SZ 11 + + /* raw mask */ #define GX_BP_SCISSORBR_BOT_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_SCISSORBR_BOT_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_SCISSORBR_BOT_SHIFT 0 + + /* get value */ #define GX_BP_GET_SCISSORBR_BOT(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_SCISSORBR_BOT(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// RIGHT [9:19] (11) - Right component + /* start bit */ #define GX_BP_SCISSORBR_RIGHT_B 9 + /* end bit */ #define GX_BP_SCISSORBR_RIGHT_E 19 + /* bit size */ #define GX_BP_SCISSORBR_RIGHT_SZ 11 + + /* raw mask */ #define GX_BP_SCISSORBR_RIGHT_MASK (((1 << 11) - 1) << 31 - 19) + /* local mask */ #define GX_BP_SCISSORBR_RIGHT_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_SCISSORBR_RIGHT_SHIFT 12 + + /* get value */ #define GX_BP_GET_SCISSORBR_RIGHT(reg) GX_BITGET((reg), 9, 11) + /* set value */ #define GX_BP_SET_SCISSORBR_RIGHT(reg, x) ((reg) = GX_BITSET((reg), 9, 11, x)) + + +/****************************************************************************** + * BP register 0x22 - linePtWidth + *****************************************************************************/ +// LINESZ [24:31] (8) - Line size/width + /* start bit */ #define GX_BP_LINEPTWIDTH_LINESZ_B 24 + /* end bit */ #define GX_BP_LINEPTWIDTH_LINESZ_E 31 + /* bit size */ #define GX_BP_LINEPTWIDTH_LINESZ_SZ 8 + + /* raw mask */ #define GX_BP_LINEPTWIDTH_LINESZ_MASK (((1 << 8) - 1) << 31 - 31) + /* local mask */ #define GX_BP_LINEPTWIDTH_LINESZ_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_LINEPTWIDTH_LINESZ_SHIFT 0 + + /* get value */ #define GX_BP_GET_LINEPTWIDTH_LINESZ(reg) GX_BITGET((reg), 24, 8) + /* set value */ #define GX_BP_SET_LINEPTWIDTH_LINESZ(reg, x) ((reg) = GX_BITSET((reg), 24, 8, x)) + +// POINTSZ [16:23] (8) - Point size + /* start bit */ #define GX_BP_LINEPTWIDTH_POINTSZ_B 16 + /* end bit */ #define GX_BP_LINEPTWIDTH_POINTSZ_E 23 + /* bit size */ #define GX_BP_LINEPTWIDTH_POINTSZ_SZ 8 + + /* raw mask */ #define GX_BP_LINEPTWIDTH_POINTSZ_MASK (((1 << 8) - 1) << 31 - 23) + /* local mask */ #define GX_BP_LINEPTWIDTH_POINTSZ_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_LINEPTWIDTH_POINTSZ_SHIFT 8 + + /* get value */ #define GX_BP_GET_LINEPTWIDTH_POINTSZ(reg) GX_BITGET((reg), 16, 8) + /* set value */ #define GX_BP_SET_LINEPTWIDTH_POINTSZ(reg, x) ((reg) = GX_BITSET((reg), 16, 8, x)) + +// LINEOFS [13:15] (3) - Line offset + /* start bit */ #define GX_BP_LINEPTWIDTH_LINEOFS_B 13 + /* end bit */ #define GX_BP_LINEPTWIDTH_LINEOFS_E 15 + /* bit size */ #define GX_BP_LINEPTWIDTH_LINEOFS_SZ 3 + + /* raw mask */ #define GX_BP_LINEPTWIDTH_LINEOFS_MASK (((1 << 3) - 1) << 31 - 15) + /* local mask */ #define GX_BP_LINEPTWIDTH_LINEOFS_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_LINEPTWIDTH_LINEOFS_SHIFT 16 + + /* get value */ #define GX_BP_GET_LINEPTWIDTH_LINEOFS(reg) GX_BITGET((reg), 13, 3) + /* set value */ #define GX_BP_SET_LINEPTWIDTH_LINEOFS(reg, x) ((reg) = GX_BITSET((reg), 13, 3, x)) + +// POINTOFS [10:12] (3) - Point offset + /* start bit */ #define GX_BP_LINEPTWIDTH_POINTOFS_B 10 + /* end bit */ #define GX_BP_LINEPTWIDTH_POINTOFS_E 12 + /* bit size */ #define GX_BP_LINEPTWIDTH_POINTOFS_SZ 3 + + /* raw mask */ #define GX_BP_LINEPTWIDTH_POINTOFS_MASK (((1 << 3) - 1) << 31 - 12) + /* local mask */ #define GX_BP_LINEPTWIDTH_POINTOFS_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_LINEPTWIDTH_POINTOFS_SHIFT 19 + + /* get value */ #define GX_BP_GET_LINEPTWIDTH_POINTOFS(reg) GX_BITGET((reg), 10, 3) + /* set value */ #define GX_BP_SET_LINEPTWIDTH_POINTOFS(reg, x) ((reg) = GX_BITSET((reg), 10, 3, x)) + +// ADJUST_AR [9:9] (1) - Interlacing: adjust for pixels having aspect ratio of 1/2 + /* start bit */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_B 9 + /* end bit */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_E 9 + /* bit size */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_SZ 1 + + /* raw mask */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_MASK (((1 << 1) - 1) << 31 - 9) + /* local mask */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_LINEPTWIDTH_ADJUST_AR_SHIFT 22 + + /* get value */ #define GX_BP_GET_LINEPTWIDTH_ADJUST_AR(reg) GX_BITGET((reg), 9, 1) + /* set value */ #define GX_BP_SET_LINEPTWIDTH_ADJUST_AR(reg, x) ((reg) = GX_BITSET((reg), 9, 1, x)) + + +/****************************************************************************** + * BP register 0x25 - ras1_ss0 + *****************************************************************************/ +// S0 [28:31] (4) - S-component scale (stage 0) + /* start bit */ #define GX_BP_RAS1_SS0_S0_B 28 + /* end bit */ #define GX_BP_RAS1_SS0_S0_E 31 + /* bit size */ #define GX_BP_RAS1_SS0_S0_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS0_S0_MASK (((1 << 4) - 1) << 31 - 31) + /* local mask */ #define GX_BP_RAS1_SS0_S0_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS0_S0_SHIFT 0 + + /* get value */ #define GX_BP_GET_RAS1_SS0_S0(reg) GX_BITGET((reg), 28, 4) + /* set value */ #define GX_BP_SET_RAS1_SS0_S0(reg, x) ((reg) = GX_BITSET((reg), 28, 4, x)) + +// T0 [24:27] (4) - T-component scale (stage 0) + /* start bit */ #define GX_BP_RAS1_SS0_T0_B 24 + /* end bit */ #define GX_BP_RAS1_SS0_T0_E 27 + /* bit size */ #define GX_BP_RAS1_SS0_T0_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS0_T0_MASK (((1 << 4) - 1) << 31 - 27) + /* local mask */ #define GX_BP_RAS1_SS0_T0_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS0_T0_SHIFT 4 + + /* get value */ #define GX_BP_GET_RAS1_SS0_T0(reg) GX_BITGET((reg), 24, 4) + /* set value */ #define GX_BP_SET_RAS1_SS0_T0(reg, x) ((reg) = GX_BITSET((reg), 24, 4, x)) + +// S1 [20:23] (4) - S-component scale (stage 1) + /* start bit */ #define GX_BP_RAS1_SS0_S1_B 20 + /* end bit */ #define GX_BP_RAS1_SS0_S1_E 23 + /* bit size */ #define GX_BP_RAS1_SS0_S1_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS0_S1_MASK (((1 << 4) - 1) << 31 - 23) + /* local mask */ #define GX_BP_RAS1_SS0_S1_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS0_S1_SHIFT 8 + + /* get value */ #define GX_BP_GET_RAS1_SS0_S1(reg) GX_BITGET((reg), 20, 4) + /* set value */ #define GX_BP_SET_RAS1_SS0_S1(reg, x) ((reg) = GX_BITSET((reg), 20, 4, x)) + +// T1 [16:19] (4) - T-component scale (stage 1) + /* start bit */ #define GX_BP_RAS1_SS0_T1_B 16 + /* end bit */ #define GX_BP_RAS1_SS0_T1_E 19 + /* bit size */ #define GX_BP_RAS1_SS0_T1_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS0_T1_MASK (((1 << 4) - 1) << 31 - 19) + /* local mask */ #define GX_BP_RAS1_SS0_T1_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS0_T1_SHIFT 12 + + /* get value */ #define GX_BP_GET_RAS1_SS0_T1(reg) GX_BITGET((reg), 16, 4) + /* set value */ #define GX_BP_SET_RAS1_SS0_T1(reg, x) ((reg) = GX_BITSET((reg), 16, 4, x)) + + +/****************************************************************************** + * BP register 0x26 - ras1_ss1 + *****************************************************************************/ +// S2 [28:31] (4) - S-component scale (stage 2) + /* start bit */ #define GX_BP_RAS1_SS1_S2_B 28 + /* end bit */ #define GX_BP_RAS1_SS1_S2_E 31 + /* bit size */ #define GX_BP_RAS1_SS1_S2_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS1_S2_MASK (((1 << 4) - 1) << 31 - 31) + /* local mask */ #define GX_BP_RAS1_SS1_S2_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS1_S2_SHIFT 0 + + /* get value */ #define GX_BP_GET_RAS1_SS1_S2(reg) GX_BITGET((reg), 28, 4) + /* set value */ #define GX_BP_SET_RAS1_SS1_S2(reg, x) ((reg) = GX_BITSET((reg), 28, 4, x)) + +// T2 [24:27] (4) - T-component scale (stage 2) + /* start bit */ #define GX_BP_RAS1_SS1_T2_B 24 + /* end bit */ #define GX_BP_RAS1_SS1_T2_E 27 + /* bit size */ #define GX_BP_RAS1_SS1_T2_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS1_T2_MASK (((1 << 4) - 1) << 31 - 27) + /* local mask */ #define GX_BP_RAS1_SS1_T2_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS1_T2_SHIFT 4 + + /* get value */ #define GX_BP_GET_RAS1_SS1_T2(reg) GX_BITGET((reg), 24, 4) + /* set value */ #define GX_BP_SET_RAS1_SS1_T2(reg, x) ((reg) = GX_BITSET((reg), 24, 4, x)) + +// S3 [20:23] (4) - S-component scale (stage 3) + /* start bit */ #define GX_BP_RAS1_SS1_S3_B 20 + /* end bit */ #define GX_BP_RAS1_SS1_S3_E 23 + /* bit size */ #define GX_BP_RAS1_SS1_S3_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS1_S3_MASK (((1 << 4) - 1) << 31 - 23) + /* local mask */ #define GX_BP_RAS1_SS1_S3_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS1_S3_SHIFT 8 + + /* get value */ #define GX_BP_GET_RAS1_SS1_S3(reg) GX_BITGET((reg), 20, 4) + /* set value */ #define GX_BP_SET_RAS1_SS1_S3(reg, x) ((reg) = GX_BITSET((reg), 20, 4, x)) + +// T3 [16:19] (4) - T-component scale (stage 3) + /* start bit */ #define GX_BP_RAS1_SS1_T3_B 16 + /* end bit */ #define GX_BP_RAS1_SS1_T3_E 19 + /* bit size */ #define GX_BP_RAS1_SS1_T3_SZ 4 + + /* raw mask */ #define GX_BP_RAS1_SS1_T3_MASK (((1 << 4) - 1) << 31 - 19) + /* local mask */ #define GX_BP_RAS1_SS1_T3_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_RAS1_SS1_T3_SHIFT 12 + + /* get value */ #define GX_BP_GET_RAS1_SS1_T3(reg) GX_BITGET((reg), 16, 4) + /* set value */ #define GX_BP_SET_RAS1_SS1_T3(reg, x) ((reg) = GX_BITSET((reg), 16, 4, x)) + + +/****************************************************************************** + * BP register 0x27 - ras1_iref + *****************************************************************************/ +// MAP0 [29:31] (3) - Texmap id (stage 0) + /* start bit */ #define GX_BP_RAS1_IREF_MAP0_B 29 + /* end bit */ #define GX_BP_RAS1_IREF_MAP0_E 31 + /* bit size */ #define GX_BP_RAS1_IREF_MAP0_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_MAP0_MASK (((1 << 3) - 1) << 31 - 31) + /* local mask */ #define GX_BP_RAS1_IREF_MAP0_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_MAP0_SHIFT 0 + + /* get value */ #define GX_BP_GET_RAS1_IREF_MAP0(reg) GX_BITGET((reg), 29, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_MAP0(reg, x) ((reg) = GX_BITSET((reg), 29, 3, x)) + +// TXC0 [26:28] (3) - Texcoord ID (stage 0) + /* start bit */ #define GX_BP_RAS1_IREF_TXC0_B 26 + /* end bit */ #define GX_BP_RAS1_IREF_TXC0_E 28 + /* bit size */ #define GX_BP_RAS1_IREF_TXC0_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_TXC0_MASK (((1 << 3) - 1) << 31 - 28) + /* local mask */ #define GX_BP_RAS1_IREF_TXC0_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_TXC0_SHIFT 3 + + /* get value */ #define GX_BP_GET_RAS1_IREF_TXC0(reg) GX_BITGET((reg), 26, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_TXC0(reg, x) ((reg) = GX_BITSET((reg), 26, 3, x)) + +// MAP1 [23:25] (3) - Texmap id (stage 1) + /* start bit */ #define GX_BP_RAS1_IREF_MAP1_B 23 + /* end bit */ #define GX_BP_RAS1_IREF_MAP1_E 25 + /* bit size */ #define GX_BP_RAS1_IREF_MAP1_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_MAP1_MASK (((1 << 3) - 1) << 31 - 25) + /* local mask */ #define GX_BP_RAS1_IREF_MAP1_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_MAP1_SHIFT 6 + + /* get value */ #define GX_BP_GET_RAS1_IREF_MAP1(reg) GX_BITGET((reg), 23, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_MAP1(reg, x) ((reg) = GX_BITSET((reg), 23, 3, x)) + +// TXC1 [20:22] (3) - Texcoord ID (stage 1) + /* start bit */ #define GX_BP_RAS1_IREF_TXC1_B 20 + /* end bit */ #define GX_BP_RAS1_IREF_TXC1_E 22 + /* bit size */ #define GX_BP_RAS1_IREF_TXC1_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_TXC1_MASK (((1 << 3) - 1) << 31 - 22) + /* local mask */ #define GX_BP_RAS1_IREF_TXC1_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_TXC1_SHIFT 9 + + /* get value */ #define GX_BP_GET_RAS1_IREF_TXC1(reg) GX_BITGET((reg), 20, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_TXC1(reg, x) ((reg) = GX_BITSET((reg), 20, 3, x)) + +// MAP2 [17:19] (3) - Texmap id (stage 2) + /* start bit */ #define GX_BP_RAS1_IREF_MAP2_B 17 + /* end bit */ #define GX_BP_RAS1_IREF_MAP2_E 19 + /* bit size */ #define GX_BP_RAS1_IREF_MAP2_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_MAP2_MASK (((1 << 3) - 1) << 31 - 19) + /* local mask */ #define GX_BP_RAS1_IREF_MAP2_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_MAP2_SHIFT 12 + + /* get value */ #define GX_BP_GET_RAS1_IREF_MAP2(reg) GX_BITGET((reg), 17, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_MAP2(reg, x) ((reg) = GX_BITSET((reg), 17, 3, x)) + +// TXC2 [14:16] (3) - Texcoord ID (stage 2) + /* start bit */ #define GX_BP_RAS1_IREF_TXC2_B 14 + /* end bit */ #define GX_BP_RAS1_IREF_TXC2_E 16 + /* bit size */ #define GX_BP_RAS1_IREF_TXC2_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_TXC2_MASK (((1 << 3) - 1) << 31 - 16) + /* local mask */ #define GX_BP_RAS1_IREF_TXC2_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_TXC2_SHIFT 15 + + /* get value */ #define GX_BP_GET_RAS1_IREF_TXC2(reg) GX_BITGET((reg), 14, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_TXC2(reg, x) ((reg) = GX_BITSET((reg), 14, 3, x)) + +// MAP3 [11:13] (3) - Texmap id (stage 3) + /* start bit */ #define GX_BP_RAS1_IREF_MAP3_B 11 + /* end bit */ #define GX_BP_RAS1_IREF_MAP3_E 13 + /* bit size */ #define GX_BP_RAS1_IREF_MAP3_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_MAP3_MASK (((1 << 3) - 1) << 31 - 13) + /* local mask */ #define GX_BP_RAS1_IREF_MAP3_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_MAP3_SHIFT 18 + + /* get value */ #define GX_BP_GET_RAS1_IREF_MAP3(reg) GX_BITGET((reg), 11, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_MAP3(reg, x) ((reg) = GX_BITSET((reg), 11, 3, x)) + +// TXC3 [8:10] (3) - Texcoord ID (stage 3) + /* start bit */ #define GX_BP_RAS1_IREF_TXC3_B 8 + /* end bit */ #define GX_BP_RAS1_IREF_TXC3_E 10 + /* bit size */ #define GX_BP_RAS1_IREF_TXC3_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_IREF_TXC3_MASK (((1 << 3) - 1) << 31 - 10) + /* local mask */ #define GX_BP_RAS1_IREF_TXC3_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_IREF_TXC3_SHIFT 21 + + /* get value */ #define GX_BP_GET_RAS1_IREF_TXC3(reg) GX_BITGET((reg), 8, 3) + /* set value */ #define GX_BP_SET_RAS1_IREF_TXC3(reg, x) ((reg) = GX_BITSET((reg), 8, 3, x)) + + +/****************************************************************************** + * BP structure - ras1_tref + *****************************************************************************/ +// TEXMAP_EVEN [29:31] (3) + /* start bit */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_B 29 + /* end bit */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_E 31 + /* bit size */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_MASK (((1 << 3) - 1) << 31 - 31) + /* local mask */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_TEXMAP_EVEN_SHIFT 0 + + /* get value */ #define GX_BP_GET_RAS1_TREF_TEXMAP_EVEN(reg) GX_BITGET((reg), 29, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_TEXMAP_EVEN(reg, x) ((reg) = GX_BITSET((reg), 29, 3, x)) + +// TEXCOORD_EVEN [26:28] (3) + /* start bit */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_B 26 + /* end bit */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_E 28 + /* bit size */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_MASK (((1 << 3) - 1) << 31 - 28) + /* local mask */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_TEXCOORD_EVEN_SHIFT 3 + + /* get value */ #define GX_BP_GET_RAS1_TREF_TEXCOORD_EVEN(reg) GX_BITGET((reg), 26, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_TEXCOORD_EVEN(reg, x) ((reg) = GX_BITSET((reg), 26, 3, x)) + +// ENABLE_TEX_EVEN [25:25] (1) + /* start bit */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_B 25 + /* end bit */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_E 25 + /* bit size */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_SZ 1 + + /* raw mask */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_MASK (((1 << 1) - 1) << 31 - 25) + /* local mask */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_ENABLE_TEX_EVEN_SHIFT 6 + + /* get value */ #define GX_BP_GET_RAS1_TREF_ENABLE_TEX_EVEN(reg) GX_BITGET((reg), 25, 1) + /* set value */ #define GX_BP_SET_RAS1_TREF_ENABLE_TEX_EVEN(reg, x) ((reg) = GX_BITSET((reg), 25, 1, x)) + +// COLORCHAN_EVEN [22:24] (3) + /* start bit */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_B 22 + /* end bit */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_E 24 + /* bit size */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_MASK (((1 << 3) - 1) << 31 - 24) + /* local mask */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_COLORCHAN_EVEN_SHIFT 7 + + /* get value */ #define GX_BP_GET_RAS1_TREF_COLORCHAN_EVEN(reg) GX_BITGET((reg), 22, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_COLORCHAN_EVEN(reg, x) ((reg) = GX_BITSET((reg), 22, 3, x)) + +// TEXMAP_ODD [17:19] (3) + /* start bit */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_B 17 + /* end bit */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_E 19 + /* bit size */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_MASK (((1 << 3) - 1) << 31 - 19) + /* local mask */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_TEXMAP_ODD_SHIFT 12 + + /* get value */ #define GX_BP_GET_RAS1_TREF_TEXMAP_ODD(reg) GX_BITGET((reg), 17, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_TEXMAP_ODD(reg, x) ((reg) = GX_BITSET((reg), 17, 3, x)) + +// TEXCOORD_ODD [14:16] (3) + /* start bit */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_B 14 + /* end bit */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_E 16 + /* bit size */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_MASK (((1 << 3) - 1) << 31 - 16) + /* local mask */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_TEXCOORD_ODD_SHIFT 15 + + /* get value */ #define GX_BP_GET_RAS1_TREF_TEXCOORD_ODD(reg) GX_BITGET((reg), 14, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_TEXCOORD_ODD(reg, x) ((reg) = GX_BITSET((reg), 14, 3, x)) + +// ENABLE_TEX_ODD [13:13] (1) + /* start bit */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_B 13 + /* end bit */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_E 13 + /* bit size */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_SZ 1 + + /* raw mask */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_MASK (((1 << 1) - 1) << 31 - 13) + /* local mask */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_ENABLE_TEX_ODD_SHIFT 18 + + /* get value */ #define GX_BP_GET_RAS1_TREF_ENABLE_TEX_ODD(reg) GX_BITGET((reg), 13, 1) + /* set value */ #define GX_BP_SET_RAS1_TREF_ENABLE_TEX_ODD(reg, x) ((reg) = GX_BITSET((reg), 13, 1, x)) + +// COLORCHAN_ODD [10:12] (3) + /* start bit */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_B 10 + /* end bit */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_E 12 + /* bit size */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_SZ 3 + + /* raw mask */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_MASK (((1 << 3) - 1) << 31 - 12) + /* local mask */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_RAS1_TREF_COLORCHAN_ODD_SHIFT 19 + + /* get value */ #define GX_BP_GET_RAS1_TREF_COLORCHAN_ODD(reg) GX_BITGET((reg), 10, 3) + /* set value */ #define GX_BP_SET_RAS1_TREF_COLORCHAN_ODD(reg, x) ((reg) = GX_BITSET((reg), 10, 3, x)) + + +/****************************************************************************** + * BP structure - su_size + *****************************************************************************/ +// SCALE [16:31] (16) + /* start bit */ #define GX_BP_SU_SIZE_SCALE_B 16 + /* end bit */ #define GX_BP_SU_SIZE_SCALE_E 31 + /* bit size */ #define GX_BP_SU_SIZE_SCALE_SZ 16 + + /* raw mask */ #define GX_BP_SU_SIZE_SCALE_MASK (((1 << 16) - 1) << 31 - 31) + /* local mask */ #define GX_BP_SU_SIZE_SCALE_LMASK ((1 << 16) - 1) + /* bit shift */ #define GX_BP_SU_SIZE_SCALE_SHIFT 0 + + /* get value */ #define GX_BP_GET_SU_SIZE_SCALE(reg) GX_BITGET((reg), 16, 16) + /* set value */ #define GX_BP_SET_SU_SIZE_SCALE(reg, x) ((reg) = GX_BITSET((reg), 16, 16, x)) + +// RANGEBIAS [15:15] (1) + /* start bit */ #define GX_BP_SU_SIZE_RANGEBIAS_B 15 + /* end bit */ #define GX_BP_SU_SIZE_RANGEBIAS_E 15 + /* bit size */ #define GX_BP_SU_SIZE_RANGEBIAS_SZ 1 + + /* raw mask */ #define GX_BP_SU_SIZE_RANGEBIAS_MASK (((1 << 1) - 1) << 31 - 15) + /* local mask */ #define GX_BP_SU_SIZE_RANGEBIAS_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_SU_SIZE_RANGEBIAS_SHIFT 16 + + /* get value */ #define GX_BP_GET_SU_SIZE_RANGEBIAS(reg) GX_BITGET((reg), 15, 1) + /* set value */ #define GX_BP_SET_SU_SIZE_RANGEBIAS(reg, x) ((reg) = GX_BITSET((reg), 15, 1, x)) + +// CYLINDRICWRAP [14:14] (1) + /* start bit */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_B 14 + /* end bit */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_E 14 + /* bit size */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_SZ 1 + + /* raw mask */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_MASK (((1 << 1) - 1) << 31 - 14) + /* local mask */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_SU_SIZE_CYLINDRICWRAP_SHIFT 17 + + /* get value */ #define GX_BP_GET_SU_SIZE_CYLINDRICWRAP(reg) GX_BITGET((reg), 14, 1) + /* set value */ #define GX_BP_SET_SU_SIZE_CYLINDRICWRAP(reg, x) ((reg) = GX_BITSET((reg), 14, 1, x)) + +// USELINEOFS [13:13] (1) + /* start bit */ #define GX_BP_SU_SIZE_USELINEOFS_B 13 + /* end bit */ #define GX_BP_SU_SIZE_USELINEOFS_E 13 + /* bit size */ #define GX_BP_SU_SIZE_USELINEOFS_SZ 1 + + /* raw mask */ #define GX_BP_SU_SIZE_USELINEOFS_MASK (((1 << 1) - 1) << 31 - 13) + /* local mask */ #define GX_BP_SU_SIZE_USELINEOFS_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_SU_SIZE_USELINEOFS_SHIFT 18 + + /* get value */ #define GX_BP_GET_SU_SIZE_USELINEOFS(reg) GX_BITGET((reg), 13, 1) + /* set value */ #define GX_BP_SET_SU_SIZE_USELINEOFS(reg, x) ((reg) = GX_BITSET((reg), 13, 1, x)) + +// USEPOINTOFS [12:12] (1) + /* start bit */ #define GX_BP_SU_SIZE_USEPOINTOFS_B 12 + /* end bit */ #define GX_BP_SU_SIZE_USEPOINTOFS_E 12 + /* bit size */ #define GX_BP_SU_SIZE_USEPOINTOFS_SZ 1 + + /* raw mask */ #define GX_BP_SU_SIZE_USEPOINTOFS_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_SU_SIZE_USEPOINTOFS_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_SU_SIZE_USEPOINTOFS_SHIFT 19 + + /* get value */ #define GX_BP_GET_SU_SIZE_USEPOINTOFS(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_SU_SIZE_USEPOINTOFS(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + + +/****************************************************************************** + * BP register 0x40 - ZMode + *****************************************************************************/ +// TEST_ENABLE [31:31] (1) + /* start bit */ #define GX_BP_ZMODE_TEST_ENABLE_B 31 + /* end bit */ #define GX_BP_ZMODE_TEST_ENABLE_E 31 + /* bit size */ #define GX_BP_ZMODE_TEST_ENABLE_SZ 1 + + /* raw mask */ #define GX_BP_ZMODE_TEST_ENABLE_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_BP_ZMODE_TEST_ENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_ZMODE_TEST_ENABLE_SHIFT 0 + + /* get value */ #define GX_BP_GET_ZMODE_TEST_ENABLE(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_BP_SET_ZMODE_TEST_ENABLE(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// COMPARE [28:30] (3) + /* start bit */ #define GX_BP_ZMODE_COMPARE_B 28 + /* end bit */ #define GX_BP_ZMODE_COMPARE_E 30 + /* bit size */ #define GX_BP_ZMODE_COMPARE_SZ 3 + + /* raw mask */ #define GX_BP_ZMODE_COMPARE_MASK (((1 << 3) - 1) << 31 - 30) + /* local mask */ #define GX_BP_ZMODE_COMPARE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_ZMODE_COMPARE_SHIFT 1 + + /* get value */ #define GX_BP_GET_ZMODE_COMPARE(reg) GX_BITGET((reg), 28, 3) + /* set value */ #define GX_BP_SET_ZMODE_COMPARE(reg, x) ((reg) = GX_BITSET((reg), 28, 3, x)) + +// UPDATE_ENABLE [27:27] (1) + /* start bit */ #define GX_BP_ZMODE_UPDATE_ENABLE_B 27 + /* end bit */ #define GX_BP_ZMODE_UPDATE_ENABLE_E 27 + /* bit size */ #define GX_BP_ZMODE_UPDATE_ENABLE_SZ 1 + + /* raw mask */ #define GX_BP_ZMODE_UPDATE_ENABLE_MASK (((1 << 1) - 1) << 31 - 27) + /* local mask */ #define GX_BP_ZMODE_UPDATE_ENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_ZMODE_UPDATE_ENABLE_SHIFT 4 + + /* get value */ #define GX_BP_GET_ZMODE_UPDATE_ENABLE(reg) GX_BITGET((reg), 27, 1) + /* set value */ #define GX_BP_SET_ZMODE_UPDATE_ENABLE(reg, x) ((reg) = GX_BITSET((reg), 27, 1, x)) + + +/****************************************************************************** + * BP register 0x41 - BlendMode + *****************************************************************************/ +// BLEND_ENABLE [31:31] (1) + /* start bit */ #define GX_BP_BLENDMODE_BLEND_ENABLE_B 31 + /* end bit */ #define GX_BP_BLENDMODE_BLEND_ENABLE_E 31 + /* bit size */ #define GX_BP_BLENDMODE_BLEND_ENABLE_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_BLEND_ENABLE_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_BP_BLENDMODE_BLEND_ENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_BLEND_ENABLE_SHIFT 0 + + /* get value */ #define GX_BP_GET_BLENDMODE_BLEND_ENABLE(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_BLEND_ENABLE(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// LOGIC_OP_ENABLE [30:30] (1) + /* start bit */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_B 30 + /* end bit */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_E 30 + /* bit size */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_LOGIC_OP_ENABLE_SHIFT 1 + + /* get value */ #define GX_BP_GET_BLENDMODE_LOGIC_OP_ENABLE(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_LOGIC_OP_ENABLE(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + +// DITHER [29:29] (1) + /* start bit */ #define GX_BP_BLENDMODE_DITHER_B 29 + /* end bit */ #define GX_BP_BLENDMODE_DITHER_E 29 + /* bit size */ #define GX_BP_BLENDMODE_DITHER_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_DITHER_MASK (((1 << 1) - 1) << 31 - 29) + /* local mask */ #define GX_BP_BLENDMODE_DITHER_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_DITHER_SHIFT 2 + + /* get value */ #define GX_BP_GET_BLENDMODE_DITHER(reg) GX_BITGET((reg), 29, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_DITHER(reg, x) ((reg) = GX_BITSET((reg), 29, 1, x)) + +// COLOR_UPDATE [28:28] (1) + /* start bit */ #define GX_BP_BLENDMODE_COLOR_UPDATE_B 28 + /* end bit */ #define GX_BP_BLENDMODE_COLOR_UPDATE_E 28 + /* bit size */ #define GX_BP_BLENDMODE_COLOR_UPDATE_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_COLOR_UPDATE_MASK (((1 << 1) - 1) << 31 - 28) + /* local mask */ #define GX_BP_BLENDMODE_COLOR_UPDATE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_COLOR_UPDATE_SHIFT 3 + + /* get value */ #define GX_BP_GET_BLENDMODE_COLOR_UPDATE(reg) GX_BITGET((reg), 28, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_COLOR_UPDATE(reg, x) ((reg) = GX_BITSET((reg), 28, 1, x)) + +// ALPHA_UPDATE [27:27] (1) + /* start bit */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_B 27 + /* end bit */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_E 27 + /* bit size */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_MASK (((1 << 1) - 1) << 31 - 27) + /* local mask */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_ALPHA_UPDATE_SHIFT 4 + + /* get value */ #define GX_BP_GET_BLENDMODE_ALPHA_UPDATE(reg) GX_BITGET((reg), 27, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_ALPHA_UPDATE(reg, x) ((reg) = GX_BITSET((reg), 27, 1, x)) + +// DST_FACTOR [24:26] (3) + /* start bit */ #define GX_BP_BLENDMODE_DST_FACTOR_B 24 + /* end bit */ #define GX_BP_BLENDMODE_DST_FACTOR_E 26 + /* bit size */ #define GX_BP_BLENDMODE_DST_FACTOR_SZ 3 + + /* raw mask */ #define GX_BP_BLENDMODE_DST_FACTOR_MASK (((1 << 3) - 1) << 31 - 26) + /* local mask */ #define GX_BP_BLENDMODE_DST_FACTOR_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_DST_FACTOR_SHIFT 5 + + /* get value */ #define GX_BP_GET_BLENDMODE_DST_FACTOR(reg) GX_BITGET((reg), 24, 3) + /* set value */ #define GX_BP_SET_BLENDMODE_DST_FACTOR(reg, x) ((reg) = GX_BITSET((reg), 24, 3, x)) + +// SRC_FACTOR [21:23] (3) + /* start bit */ #define GX_BP_BLENDMODE_SRC_FACTOR_B 21 + /* end bit */ #define GX_BP_BLENDMODE_SRC_FACTOR_E 23 + /* bit size */ #define GX_BP_BLENDMODE_SRC_FACTOR_SZ 3 + + /* raw mask */ #define GX_BP_BLENDMODE_SRC_FACTOR_MASK (((1 << 3) - 1) << 31 - 23) + /* local mask */ #define GX_BP_BLENDMODE_SRC_FACTOR_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_SRC_FACTOR_SHIFT 8 + + /* get value */ #define GX_BP_GET_BLENDMODE_SRC_FACTOR(reg) GX_BITGET((reg), 21, 3) + /* set value */ #define GX_BP_SET_BLENDMODE_SRC_FACTOR(reg, x) ((reg) = GX_BITSET((reg), 21, 3, x)) + +// SUBTRACT [20:20] (1) + /* start bit */ #define GX_BP_BLENDMODE_SUBTRACT_B 20 + /* end bit */ #define GX_BP_BLENDMODE_SUBTRACT_E 20 + /* bit size */ #define GX_BP_BLENDMODE_SUBTRACT_SZ 1 + + /* raw mask */ #define GX_BP_BLENDMODE_SUBTRACT_MASK (((1 << 1) - 1) << 31 - 20) + /* local mask */ #define GX_BP_BLENDMODE_SUBTRACT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_SUBTRACT_SHIFT 11 + + /* get value */ #define GX_BP_GET_BLENDMODE_SUBTRACT(reg) GX_BITGET((reg), 20, 1) + /* set value */ #define GX_BP_SET_BLENDMODE_SUBTRACT(reg, x) ((reg) = GX_BITSET((reg), 20, 1, x)) + +// LOGIC_MODE [16:19] (4) + /* start bit */ #define GX_BP_BLENDMODE_LOGIC_MODE_B 16 + /* end bit */ #define GX_BP_BLENDMODE_LOGIC_MODE_E 19 + /* bit size */ #define GX_BP_BLENDMODE_LOGIC_MODE_SZ 4 + + /* raw mask */ #define GX_BP_BLENDMODE_LOGIC_MODE_MASK (((1 << 4) - 1) << 31 - 19) + /* local mask */ #define GX_BP_BLENDMODE_LOGIC_MODE_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_BLENDMODE_LOGIC_MODE_SHIFT 12 + + /* get value */ #define GX_BP_GET_BLENDMODE_LOGIC_MODE(reg) GX_BITGET((reg), 16, 4) + /* set value */ #define GX_BP_SET_BLENDMODE_LOGIC_MODE(reg, x) ((reg) = GX_BITSET((reg), 16, 4, x)) + + +/****************************************************************************** + * BP register 0x42 - DstAlpha + *****************************************************************************/ +// ALPHA [24:31] (8) + /* start bit */ #define GX_BP_DSTALPHA_ALPHA_B 24 + /* end bit */ #define GX_BP_DSTALPHA_ALPHA_E 31 + /* bit size */ #define GX_BP_DSTALPHA_ALPHA_SZ 8 + + /* raw mask */ #define GX_BP_DSTALPHA_ALPHA_MASK (((1 << 8) - 1) << 31 - 31) + /* local mask */ #define GX_BP_DSTALPHA_ALPHA_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_DSTALPHA_ALPHA_SHIFT 0 + + /* get value */ #define GX_BP_GET_DSTALPHA_ALPHA(reg) GX_BITGET((reg), 24, 8) + /* set value */ #define GX_BP_SET_DSTALPHA_ALPHA(reg, x) ((reg) = GX_BITSET((reg), 24, 8, x)) + +// ENABLE [23:23] (1) + /* start bit */ #define GX_BP_DSTALPHA_ENABLE_B 23 + /* end bit */ #define GX_BP_DSTALPHA_ENABLE_E 23 + /* bit size */ #define GX_BP_DSTALPHA_ENABLE_SZ 1 + + /* raw mask */ #define GX_BP_DSTALPHA_ENABLE_MASK (((1 << 1) - 1) << 31 - 23) + /* local mask */ #define GX_BP_DSTALPHA_ENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_DSTALPHA_ENABLE_SHIFT 8 + + /* get value */ #define GX_BP_GET_DSTALPHA_ENABLE(reg) GX_BITGET((reg), 23, 1) + /* set value */ #define GX_BP_SET_DSTALPHA_ENABLE(reg, x) ((reg) = GX_BITSET((reg), 23, 1, x)) + +// YUV_FMT [21:22] (2) + /* start bit */ #define GX_BP_DSTALPHA_YUV_FMT_B 21 + /* end bit */ #define GX_BP_DSTALPHA_YUV_FMT_E 22 + /* bit size */ #define GX_BP_DSTALPHA_YUV_FMT_SZ 2 + + /* raw mask */ #define GX_BP_DSTALPHA_YUV_FMT_MASK (((1 << 2) - 1) << 31 - 22) + /* local mask */ #define GX_BP_DSTALPHA_YUV_FMT_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_DSTALPHA_YUV_FMT_SHIFT 9 + + /* get value */ #define GX_BP_GET_DSTALPHA_YUV_FMT(reg) GX_BITGET((reg), 21, 2) + /* set value */ #define GX_BP_SET_DSTALPHA_YUV_FMT(reg, x) ((reg) = GX_BITSET((reg), 21, 2, x)) + + +/****************************************************************************** + * BP register 0x43 - ZControl + *****************************************************************************/ +// PIXEL_FMT [29:31] (3) + /* start bit */ #define GX_BP_ZCONTROL_PIXEL_FMT_B 29 + /* end bit */ #define GX_BP_ZCONTROL_PIXEL_FMT_E 31 + /* bit size */ #define GX_BP_ZCONTROL_PIXEL_FMT_SZ 3 + + /* raw mask */ #define GX_BP_ZCONTROL_PIXEL_FMT_MASK (((1 << 3) - 1) << 31 - 31) + /* local mask */ #define GX_BP_ZCONTROL_PIXEL_FMT_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_ZCONTROL_PIXEL_FMT_SHIFT 0 + + /* get value */ #define GX_BP_GET_ZCONTROL_PIXEL_FMT(reg) GX_BITGET((reg), 29, 3) + /* set value */ #define GX_BP_SET_ZCONTROL_PIXEL_FMT(reg, x) ((reg) = GX_BITSET((reg), 29, 3, x)) + +// Z_FMT [26:28] (3) + /* start bit */ #define GX_BP_ZCONTROL_Z_FMT_B 26 + /* end bit */ #define GX_BP_ZCONTROL_Z_FMT_E 28 + /* bit size */ #define GX_BP_ZCONTROL_Z_FMT_SZ 3 + + /* raw mask */ #define GX_BP_ZCONTROL_Z_FMT_MASK (((1 << 3) - 1) << 31 - 28) + /* local mask */ #define GX_BP_ZCONTROL_Z_FMT_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_ZCONTROL_Z_FMT_SHIFT 3 + + /* get value */ #define GX_BP_GET_ZCONTROL_Z_FMT(reg) GX_BITGET((reg), 26, 3) + /* set value */ #define GX_BP_SET_ZCONTROL_Z_FMT(reg, x) ((reg) = GX_BITSET((reg), 26, 3, x)) + +// BEFORE_TEX [25:25] (1) - Determines whether Z-buffering occurs before or after texturing + /* start bit */ #define GX_BP_ZCONTROL_BEFORE_TEX_B 25 + /* end bit */ #define GX_BP_ZCONTROL_BEFORE_TEX_E 25 + /* bit size */ #define GX_BP_ZCONTROL_BEFORE_TEX_SZ 1 + + /* raw mask */ #define GX_BP_ZCONTROL_BEFORE_TEX_MASK (((1 << 1) - 1) << 31 - 25) + /* local mask */ #define GX_BP_ZCONTROL_BEFORE_TEX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_ZCONTROL_BEFORE_TEX_SHIFT 6 + + /* get value */ #define GX_BP_GET_ZCONTROL_BEFORE_TEX(reg) GX_BITGET((reg), 25, 1) + /* set value */ #define GX_BP_SET_ZCONTROL_BEFORE_TEX(reg, x) ((reg) = GX_BITSET((reg), 25, 1, x)) + + +/****************************************************************************** + * BP register 0x44 - FieldMask + *****************************************************************************/ +// ODD [31:31] (1) - Whether to write odd fields to the EFB + /* start bit */ #define GX_BP_FIELDMASK_ODD_B 31 + /* end bit */ #define GX_BP_FIELDMASK_ODD_E 31 + /* bit size */ #define GX_BP_FIELDMASK_ODD_SZ 1 + + /* raw mask */ #define GX_BP_FIELDMASK_ODD_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FIELDMASK_ODD_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FIELDMASK_ODD_SHIFT 0 + + /* get value */ #define GX_BP_GET_FIELDMASK_ODD(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_BP_SET_FIELDMASK_ODD(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// EVEN [30:30] (1) - Whether to write even fields to the EFB + /* start bit */ #define GX_BP_FIELDMASK_EVEN_B 30 + /* end bit */ #define GX_BP_FIELDMASK_EVEN_E 30 + /* bit size */ #define GX_BP_FIELDMASK_EVEN_SZ 1 + + /* raw mask */ #define GX_BP_FIELDMASK_EVEN_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_BP_FIELDMASK_EVEN_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FIELDMASK_EVEN_SHIFT 1 + + /* get value */ #define GX_BP_GET_FIELDMASK_EVEN(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_BP_SET_FIELDMASK_EVEN(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + + +/****************************************************************************** + * BP register 0x59 - ScissorOffset + *****************************************************************************/ +// OX [22:31] (10) + /* start bit */ #define GX_BP_SCISSOROFFSET_OX_B 22 + /* end bit */ #define GX_BP_SCISSOROFFSET_OX_E 31 + /* bit size */ #define GX_BP_SCISSOROFFSET_OX_SZ 10 + + /* raw mask */ #define GX_BP_SCISSOROFFSET_OX_MASK (((1 << 10) - 1) << 31 - 31) + /* local mask */ #define GX_BP_SCISSOROFFSET_OX_LMASK ((1 << 10) - 1) + /* bit shift */ #define GX_BP_SCISSOROFFSET_OX_SHIFT 0 + + /* get value */ #define GX_BP_GET_SCISSOROFFSET_OX(reg) GX_BITGET((reg), 22, 10) + /* set value */ #define GX_BP_SET_SCISSOROFFSET_OX(reg, x) ((reg) = GX_BITSET((reg), 22, 10, x)) + +// OY [12:21] (10) + /* start bit */ #define GX_BP_SCISSOROFFSET_OY_B 12 + /* end bit */ #define GX_BP_SCISSOROFFSET_OY_E 21 + /* bit size */ #define GX_BP_SCISSOROFFSET_OY_SZ 10 + + /* raw mask */ #define GX_BP_SCISSOROFFSET_OY_MASK (((1 << 10) - 1) << 31 - 21) + /* local mask */ #define GX_BP_SCISSOROFFSET_OY_LMASK ((1 << 10) - 1) + /* bit shift */ #define GX_BP_SCISSOROFFSET_OY_SHIFT 10 + + /* get value */ #define GX_BP_GET_SCISSOROFFSET_OY(reg) GX_BITGET((reg), 12, 10) + /* set value */ #define GX_BP_SET_SCISSOROFFSET_OY(reg, x) ((reg) = GX_BITSET((reg), 12, 10, x)) + + +/****************************************************************************** + * BP register 0x68 - FieldMode + *****************************************************************************/ +// TEX_LOD [31:31] (1) - Adjust vertex tex LOD computation to account for interlacing + /* start bit */ #define GX_BP_FIELDMODE_TEX_LOD_B 31 + /* end bit */ #define GX_BP_FIELDMODE_TEX_LOD_E 31 + /* bit size */ #define GX_BP_FIELDMODE_TEX_LOD_SZ 1 + + /* raw mask */ #define GX_BP_FIELDMODE_TEX_LOD_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FIELDMODE_TEX_LOD_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FIELDMODE_TEX_LOD_SHIFT 0 + + /* get value */ #define GX_BP_GET_FIELDMODE_TEX_LOD(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_BP_SET_FIELDMODE_TEX_LOD(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + + +/****************************************************************************** + * BP structure - TevColorCombiner + *****************************************************************************/ +// D [28:31] (4) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_D_B 28 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_D_E 31 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_D_SZ 4 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_D_MASK (((1 << 4) - 1) << 31 - 31) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_D_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_D_SHIFT 0 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_D(reg) GX_BITGET((reg), 28, 4) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_D(reg, x) ((reg) = GX_BITSET((reg), 28, 4, x)) + +// C [24:27] (4) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_C_B 24 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_C_E 27 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_C_SZ 4 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_C_MASK (((1 << 4) - 1) << 31 - 27) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_C_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_C_SHIFT 4 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_C(reg) GX_BITGET((reg), 24, 4) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_C(reg, x) ((reg) = GX_BITSET((reg), 24, 4, x)) + +// B [20:23] (4) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_B_B 20 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_B_E 23 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_B_SZ 4 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_B_MASK (((1 << 4) - 1) << 31 - 23) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_B_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_B_SHIFT 8 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_B(reg) GX_BITGET((reg), 20, 4) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_B(reg, x) ((reg) = GX_BITSET((reg), 20, 4, x)) + +// A [16:19] (4) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_A_B 16 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_A_E 19 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_A_SZ 4 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_A_MASK (((1 << 4) - 1) << 31 - 19) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_A_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_A_SHIFT 12 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_A(reg) GX_BITGET((reg), 16, 4) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_A(reg, x) ((reg) = GX_BITSET((reg), 16, 4, x)) + +// BIAS [14:15] (2) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_BIAS_B 14 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_BIAS_E 15 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_BIAS_SZ 2 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_BIAS_MASK (((1 << 2) - 1) << 31 - 15) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_BIAS_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_BIAS_SHIFT 16 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_BIAS(reg) GX_BITGET((reg), 14, 2) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_BIAS(reg, x) ((reg) = GX_BITSET((reg), 14, 2, x)) + +// OP_OR_COMPARISON [13:13] (1) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_B 13 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_E 13 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_SZ 1 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_MASK (((1 << 1) - 1) << 31 - 13) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_OP_OR_COMPARISON_SHIFT 18 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_OP_OR_COMPARISON(reg) GX_BITGET((reg), 13, 1) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_OP_OR_COMPARISON(reg, x) ((reg) = GX_BITSET((reg), 13, 1, x)) + +// CLAMP [12:12] (1) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_B 12 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_E 12 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_SZ 1 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_CLAMP_SHIFT 19 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_CLAMP(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_CLAMP(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + +// SCALE_OR_COMPARE_MODE [10:11] (2) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_B 10 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_E 11 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_SZ 2 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_MASK (((1 << 2) - 1) << 31 - 11) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE_SHIFT 20 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE(reg) GX_BITGET((reg), 10, 2) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_SCALE_OR_COMPARE_MODE(reg, x) ((reg) = GX_BITSET((reg), 10, 2, x)) + +// DEST [8:9] (2) + /* start bit */ #define GX_BP_TEVCOLORCOMBINER_DEST_B 8 + /* end bit */ #define GX_BP_TEVCOLORCOMBINER_DEST_E 9 + /* bit size */ #define GX_BP_TEVCOLORCOMBINER_DEST_SZ 2 + + /* raw mask */ #define GX_BP_TEVCOLORCOMBINER_DEST_MASK (((1 << 2) - 1) << 31 - 9) + /* local mask */ #define GX_BP_TEVCOLORCOMBINER_DEST_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_TEVCOLORCOMBINER_DEST_SHIFT 22 + + /* get value */ #define GX_BP_GET_TEVCOLORCOMBINER_DEST(reg) GX_BITGET((reg), 8, 2) + /* set value */ #define GX_BP_SET_TEVCOLORCOMBINER_DEST(reg, x) ((reg) = GX_BITSET((reg), 8, 2, x)) + + +/****************************************************************************** + * BP structure - TevRegLo + *****************************************************************************/ +// RED [21:31] (11) + /* start bit */ #define GX_BP_TEVREGLO_RED_B 21 + /* end bit */ #define GX_BP_TEVREGLO_RED_E 31 + /* bit size */ #define GX_BP_TEVREGLO_RED_SZ 11 + + /* raw mask */ #define GX_BP_TEVREGLO_RED_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_TEVREGLO_RED_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_TEVREGLO_RED_SHIFT 0 + + /* get value */ #define GX_BP_GET_TEVREGLO_RED(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_TEVREGLO_RED(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// ALPHA [9:19] (11) + /* start bit */ #define GX_BP_TEVREGLO_ALPHA_B 9 + /* end bit */ #define GX_BP_TEVREGLO_ALPHA_E 19 + /* bit size */ #define GX_BP_TEVREGLO_ALPHA_SZ 11 + + /* raw mask */ #define GX_BP_TEVREGLO_ALPHA_MASK (((1 << 11) - 1) << 31 - 19) + /* local mask */ #define GX_BP_TEVREGLO_ALPHA_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_TEVREGLO_ALPHA_SHIFT 12 + + /* get value */ #define GX_BP_GET_TEVREGLO_ALPHA(reg) GX_BITGET((reg), 9, 11) + /* set value */ #define GX_BP_SET_TEVREGLO_ALPHA(reg, x) ((reg) = GX_BITSET((reg), 9, 11, x)) + +// TYPE [8:8] (1) + /* start bit */ #define GX_BP_TEVREGLO_TYPE_B 8 + /* end bit */ #define GX_BP_TEVREGLO_TYPE_E 8 + /* bit size */ #define GX_BP_TEVREGLO_TYPE_SZ 1 + + /* raw mask */ #define GX_BP_TEVREGLO_TYPE_MASK (((1 << 1) - 1) << 31 - 8) + /* local mask */ #define GX_BP_TEVREGLO_TYPE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_TEVREGLO_TYPE_SHIFT 23 + + /* get value */ #define GX_BP_GET_TEVREGLO_TYPE(reg) GX_BITGET((reg), 8, 1) + /* set value */ #define GX_BP_SET_TEVREGLO_TYPE(reg, x) ((reg) = GX_BITSET((reg), 8, 1, x)) + + +/****************************************************************************** + * BP structure - TevRegHi + *****************************************************************************/ +// BLUE [21:31] (11) + /* start bit */ #define GX_BP_TEVREGHI_BLUE_B 21 + /* end bit */ #define GX_BP_TEVREGHI_BLUE_E 31 + /* bit size */ #define GX_BP_TEVREGHI_BLUE_SZ 11 + + /* raw mask */ #define GX_BP_TEVREGHI_BLUE_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_TEVREGHI_BLUE_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_TEVREGHI_BLUE_SHIFT 0 + + /* get value */ #define GX_BP_GET_TEVREGHI_BLUE(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_TEVREGHI_BLUE(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// GREEN [9:19] (11) + /* start bit */ #define GX_BP_TEVREGHI_GREEN_B 9 + /* end bit */ #define GX_BP_TEVREGHI_GREEN_E 19 + /* bit size */ #define GX_BP_TEVREGHI_GREEN_SZ 11 + + /* raw mask */ #define GX_BP_TEVREGHI_GREEN_MASK (((1 << 11) - 1) << 31 - 19) + /* local mask */ #define GX_BP_TEVREGHI_GREEN_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_TEVREGHI_GREEN_SHIFT 12 + + /* get value */ #define GX_BP_GET_TEVREGHI_GREEN(reg) GX_BITGET((reg), 9, 11) + /* set value */ #define GX_BP_SET_TEVREGHI_GREEN(reg, x) ((reg) = GX_BITSET((reg), 9, 11, x)) + +// TYPE [8:8] (1) + /* start bit */ #define GX_BP_TEVREGHI_TYPE_B 8 + /* end bit */ #define GX_BP_TEVREGHI_TYPE_E 8 + /* bit size */ #define GX_BP_TEVREGHI_TYPE_SZ 1 + + /* raw mask */ #define GX_BP_TEVREGHI_TYPE_MASK (((1 << 1) - 1) << 31 - 8) + /* local mask */ #define GX_BP_TEVREGHI_TYPE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_TEVREGHI_TYPE_SHIFT 23 + + /* get value */ #define GX_BP_GET_TEVREGHI_TYPE(reg) GX_BITGET((reg), 8, 1) + /* set value */ #define GX_BP_SET_TEVREGHI_TYPE(reg, x) ((reg) = GX_BITSET((reg), 8, 1, x)) + + +/****************************************************************************** + * BP register 0xE8 - FogRange + *****************************************************************************/ +// CENTER [22:31] (10) + /* start bit */ #define GX_BP_FOGRANGE_CENTER_B 22 + /* end bit */ #define GX_BP_FOGRANGE_CENTER_E 31 + /* bit size */ #define GX_BP_FOGRANGE_CENTER_SZ 10 + + /* raw mask */ #define GX_BP_FOGRANGE_CENTER_MASK (((1 << 10) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGRANGE_CENTER_LMASK ((1 << 10) - 1) + /* bit shift */ #define GX_BP_FOGRANGE_CENTER_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGRANGE_CENTER(reg) GX_BITGET((reg), 22, 10) + /* set value */ #define GX_BP_SET_FOGRANGE_CENTER(reg, x) ((reg) = GX_BITSET((reg), 22, 10, x)) + +// ENABLED [21:21] (1) + /* start bit */ #define GX_BP_FOGRANGE_ENABLED_B 21 + /* end bit */ #define GX_BP_FOGRANGE_ENABLED_E 21 + /* bit size */ #define GX_BP_FOGRANGE_ENABLED_SZ 1 + + /* raw mask */ #define GX_BP_FOGRANGE_ENABLED_MASK (((1 << 1) - 1) << 31 - 21) + /* local mask */ #define GX_BP_FOGRANGE_ENABLED_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FOGRANGE_ENABLED_SHIFT 10 + + /* get value */ #define GX_BP_GET_FOGRANGE_ENABLED(reg) GX_BITGET((reg), 21, 1) + /* set value */ #define GX_BP_SET_FOGRANGE_ENABLED(reg, x) ((reg) = GX_BITSET((reg), 21, 1, x)) + + +/****************************************************************************** + * BP structure - FogRangeK + *****************************************************************************/ +// HI [20:31] (12) + /* start bit */ #define GX_BP_FOGRANGEK_HI_B 20 + /* end bit */ #define GX_BP_FOGRANGEK_HI_E 31 + /* bit size */ #define GX_BP_FOGRANGEK_HI_SZ 12 + + /* raw mask */ #define GX_BP_FOGRANGEK_HI_MASK (((1 << 12) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGRANGEK_HI_LMASK ((1 << 12) - 1) + /* bit shift */ #define GX_BP_FOGRANGEK_HI_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGRANGEK_HI(reg) GX_BITGET((reg), 20, 12) + /* set value */ #define GX_BP_SET_FOGRANGEK_HI(reg, x) ((reg) = GX_BITSET((reg), 20, 12, x)) + +// LO [8:19] (12) + /* start bit */ #define GX_BP_FOGRANGEK_LO_B 8 + /* end bit */ #define GX_BP_FOGRANGEK_LO_E 19 + /* bit size */ #define GX_BP_FOGRANGEK_LO_SZ 12 + + /* raw mask */ #define GX_BP_FOGRANGEK_LO_MASK (((1 << 12) - 1) << 31 - 19) + /* local mask */ #define GX_BP_FOGRANGEK_LO_LMASK ((1 << 12) - 1) + /* bit shift */ #define GX_BP_FOGRANGEK_LO_SHIFT 12 + + /* get value */ #define GX_BP_GET_FOGRANGEK_LO(reg) GX_BITGET((reg), 8, 12) + /* set value */ #define GX_BP_SET_FOGRANGEK_LO(reg, x) ((reg) = GX_BITSET((reg), 8, 12, x)) + + +/****************************************************************************** + * BP register 0xEE - FogParam0 + *****************************************************************************/ +// A_MANT [21:31] (11) + /* start bit */ #define GX_BP_FOGPARAM0_A_MANT_B 21 + /* end bit */ #define GX_BP_FOGPARAM0_A_MANT_E 31 + /* bit size */ #define GX_BP_FOGPARAM0_A_MANT_SZ 11 + + /* raw mask */ #define GX_BP_FOGPARAM0_A_MANT_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGPARAM0_A_MANT_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_FOGPARAM0_A_MANT_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGPARAM0_A_MANT(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_FOGPARAM0_A_MANT(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// A_EXP [13:20] (8) + /* start bit */ #define GX_BP_FOGPARAM0_A_EXP_B 13 + /* end bit */ #define GX_BP_FOGPARAM0_A_EXP_E 20 + /* bit size */ #define GX_BP_FOGPARAM0_A_EXP_SZ 8 + + /* raw mask */ #define GX_BP_FOGPARAM0_A_EXP_MASK (((1 << 8) - 1) << 31 - 20) + /* local mask */ #define GX_BP_FOGPARAM0_A_EXP_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_FOGPARAM0_A_EXP_SHIFT 11 + + /* get value */ #define GX_BP_GET_FOGPARAM0_A_EXP(reg) GX_BITGET((reg), 13, 8) + /* set value */ #define GX_BP_SET_FOGPARAM0_A_EXP(reg, x) ((reg) = GX_BITSET((reg), 13, 8, x)) + +// A_SIGN [12:12] (1) + /* start bit */ #define GX_BP_FOGPARAM0_A_SIGN_B 12 + /* end bit */ #define GX_BP_FOGPARAM0_A_SIGN_E 12 + /* bit size */ #define GX_BP_FOGPARAM0_A_SIGN_SZ 1 + + /* raw mask */ #define GX_BP_FOGPARAM0_A_SIGN_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_FOGPARAM0_A_SIGN_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FOGPARAM0_A_SIGN_SHIFT 19 + + /* get value */ #define GX_BP_GET_FOGPARAM0_A_SIGN(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_FOGPARAM0_A_SIGN(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + + +/****************************************************************************** + * BP register 0xEF - FogParam1 + *****************************************************************************/ +// B_MAG [8:31] (24) + /* start bit */ #define GX_BP_FOGPARAM1_B_MAG_B 8 + /* end bit */ #define GX_BP_FOGPARAM1_B_MAG_E 31 + /* bit size */ #define GX_BP_FOGPARAM1_B_MAG_SZ 24 + + /* raw mask */ #define GX_BP_FOGPARAM1_B_MAG_MASK (((1 << 24) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGPARAM1_B_MAG_LMASK ((1 << 24) - 1) + /* bit shift */ #define GX_BP_FOGPARAM1_B_MAG_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGPARAM1_B_MAG(reg) GX_BITGET((reg), 8, 24) + /* set value */ #define GX_BP_SET_FOGPARAM1_B_MAG(reg, x) ((reg) = GX_BITSET((reg), 8, 24, x)) + + +/****************************************************************************** + * BP register 0xF0 - FogParam2 + *****************************************************************************/ +// B_SHIFT [27:31] (5) + /* start bit */ #define GX_BP_FOGPARAM2_B_SHIFT_B 27 + /* end bit */ #define GX_BP_FOGPARAM2_B_SHIFT_E 31 + /* bit size */ #define GX_BP_FOGPARAM2_B_SHIFT_SZ 5 + + /* raw mask */ #define GX_BP_FOGPARAM2_B_SHIFT_MASK (((1 << 5) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGPARAM2_B_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_BP_FOGPARAM2_B_SHIFT_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGPARAM2_B_SHIFT(reg) GX_BITGET((reg), 27, 5) + /* set value */ #define GX_BP_SET_FOGPARAM2_B_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 27, 5, x)) + + +/****************************************************************************** + * BP register 0xF1 - FogParam3 + *****************************************************************************/ +// C_MANT [21:31] (11) + /* start bit */ #define GX_BP_FOGPARAM3_C_MANT_B 21 + /* end bit */ #define GX_BP_FOGPARAM3_C_MANT_E 31 + /* bit size */ #define GX_BP_FOGPARAM3_C_MANT_SZ 11 + + /* raw mask */ #define GX_BP_FOGPARAM3_C_MANT_MASK (((1 << 11) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGPARAM3_C_MANT_LMASK ((1 << 11) - 1) + /* bit shift */ #define GX_BP_FOGPARAM3_C_MANT_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGPARAM3_C_MANT(reg) GX_BITGET((reg), 21, 11) + /* set value */ #define GX_BP_SET_FOGPARAM3_C_MANT(reg, x) ((reg) = GX_BITSET((reg), 21, 11, x)) + +// C_EXP [13:20] (8) + /* start bit */ #define GX_BP_FOGPARAM3_C_EXP_B 13 + /* end bit */ #define GX_BP_FOGPARAM3_C_EXP_E 20 + /* bit size */ #define GX_BP_FOGPARAM3_C_EXP_SZ 8 + + /* raw mask */ #define GX_BP_FOGPARAM3_C_EXP_MASK (((1 << 8) - 1) << 31 - 20) + /* local mask */ #define GX_BP_FOGPARAM3_C_EXP_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_FOGPARAM3_C_EXP_SHIFT 11 + + /* get value */ #define GX_BP_GET_FOGPARAM3_C_EXP(reg) GX_BITGET((reg), 13, 8) + /* set value */ #define GX_BP_SET_FOGPARAM3_C_EXP(reg, x) ((reg) = GX_BITSET((reg), 13, 8, x)) + +// C_SIGN [12:12] (1) + /* start bit */ #define GX_BP_FOGPARAM3_C_SIGN_B 12 + /* end bit */ #define GX_BP_FOGPARAM3_C_SIGN_E 12 + /* bit size */ #define GX_BP_FOGPARAM3_C_SIGN_SZ 1 + + /* raw mask */ #define GX_BP_FOGPARAM3_C_SIGN_MASK (((1 << 1) - 1) << 31 - 12) + /* local mask */ #define GX_BP_FOGPARAM3_C_SIGN_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FOGPARAM3_C_SIGN_SHIFT 19 + + /* get value */ #define GX_BP_GET_FOGPARAM3_C_SIGN(reg) GX_BITGET((reg), 12, 1) + /* set value */ #define GX_BP_SET_FOGPARAM3_C_SIGN(reg, x) ((reg) = GX_BITSET((reg), 12, 1, x)) + +// PROJ [11:11] (1) + /* start bit */ #define GX_BP_FOGPARAM3_PROJ_B 11 + /* end bit */ #define GX_BP_FOGPARAM3_PROJ_E 11 + /* bit size */ #define GX_BP_FOGPARAM3_PROJ_SZ 1 + + /* raw mask */ #define GX_BP_FOGPARAM3_PROJ_MASK (((1 << 1) - 1) << 31 - 11) + /* local mask */ #define GX_BP_FOGPARAM3_PROJ_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_BP_FOGPARAM3_PROJ_SHIFT 20 + + /* get value */ #define GX_BP_GET_FOGPARAM3_PROJ(reg) GX_BITGET((reg), 11, 1) + /* set value */ #define GX_BP_SET_FOGPARAM3_PROJ(reg, x) ((reg) = GX_BITSET((reg), 11, 1, x)) + +// FSEL [8:10] (3) + /* start bit */ #define GX_BP_FOGPARAM3_FSEL_B 8 + /* end bit */ #define GX_BP_FOGPARAM3_FSEL_E 10 + /* bit size */ #define GX_BP_FOGPARAM3_FSEL_SZ 3 + + /* raw mask */ #define GX_BP_FOGPARAM3_FSEL_MASK (((1 << 3) - 1) << 31 - 10) + /* local mask */ #define GX_BP_FOGPARAM3_FSEL_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_FOGPARAM3_FSEL_SHIFT 21 + + /* get value */ #define GX_BP_GET_FOGPARAM3_FSEL(reg) GX_BITGET((reg), 8, 3) + /* set value */ #define GX_BP_SET_FOGPARAM3_FSEL(reg, x) ((reg) = GX_BITSET((reg), 8, 3, x)) + + +/****************************************************************************** + * BP register 0xF2 - FogColor + *****************************************************************************/ +// RGB [8:31] (24) + /* start bit */ #define GX_BP_FOGCOLOR_RGB_B 8 + /* end bit */ #define GX_BP_FOGCOLOR_RGB_E 31 + /* bit size */ #define GX_BP_FOGCOLOR_RGB_SZ 24 + + /* raw mask */ #define GX_BP_FOGCOLOR_RGB_MASK (((1 << 24) - 1) << 31 - 31) + /* local mask */ #define GX_BP_FOGCOLOR_RGB_LMASK ((1 << 24) - 1) + /* bit shift */ #define GX_BP_FOGCOLOR_RGB_SHIFT 0 + + /* get value */ #define GX_BP_GET_FOGCOLOR_RGB(reg) GX_BITGET((reg), 8, 24) + /* set value */ #define GX_BP_SET_FOGCOLOR_RGB(reg, x) ((reg) = GX_BITSET((reg), 8, 24, x)) + + +/****************************************************************************** + * BP register 0xF3 - AlphaCompare + *****************************************************************************/ +// REF0 [24:31] (8) + /* start bit */ #define GX_BP_ALPHACOMPARE_REF0_B 24 + /* end bit */ #define GX_BP_ALPHACOMPARE_REF0_E 31 + /* bit size */ #define GX_BP_ALPHACOMPARE_REF0_SZ 8 + + /* raw mask */ #define GX_BP_ALPHACOMPARE_REF0_MASK (((1 << 8) - 1) << 31 - 31) + /* local mask */ #define GX_BP_ALPHACOMPARE_REF0_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_ALPHACOMPARE_REF0_SHIFT 0 + + /* get value */ #define GX_BP_GET_ALPHACOMPARE_REF0(reg) GX_BITGET((reg), 24, 8) + /* set value */ #define GX_BP_SET_ALPHACOMPARE_REF0(reg, x) ((reg) = GX_BITSET((reg), 24, 8, x)) + +// REF1 [16:23] (8) + /* start bit */ #define GX_BP_ALPHACOMPARE_REF1_B 16 + /* end bit */ #define GX_BP_ALPHACOMPARE_REF1_E 23 + /* bit size */ #define GX_BP_ALPHACOMPARE_REF1_SZ 8 + + /* raw mask */ #define GX_BP_ALPHACOMPARE_REF1_MASK (((1 << 8) - 1) << 31 - 23) + /* local mask */ #define GX_BP_ALPHACOMPARE_REF1_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_BP_ALPHACOMPARE_REF1_SHIFT 8 + + /* get value */ #define GX_BP_GET_ALPHACOMPARE_REF1(reg) GX_BITGET((reg), 16, 8) + /* set value */ #define GX_BP_SET_ALPHACOMPARE_REF1(reg, x) ((reg) = GX_BITSET((reg), 16, 8, x)) + +// COMP0 [13:15] (3) + /* start bit */ #define GX_BP_ALPHACOMPARE_COMP0_B 13 + /* end bit */ #define GX_BP_ALPHACOMPARE_COMP0_E 15 + /* bit size */ #define GX_BP_ALPHACOMPARE_COMP0_SZ 3 + + /* raw mask */ #define GX_BP_ALPHACOMPARE_COMP0_MASK (((1 << 3) - 1) << 31 - 15) + /* local mask */ #define GX_BP_ALPHACOMPARE_COMP0_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_ALPHACOMPARE_COMP0_SHIFT 16 + + /* get value */ #define GX_BP_GET_ALPHACOMPARE_COMP0(reg) GX_BITGET((reg), 13, 3) + /* set value */ #define GX_BP_SET_ALPHACOMPARE_COMP0(reg, x) ((reg) = GX_BITSET((reg), 13, 3, x)) + +// COMP1 [10:12] (3) + /* start bit */ #define GX_BP_ALPHACOMPARE_COMP1_B 10 + /* end bit */ #define GX_BP_ALPHACOMPARE_COMP1_E 12 + /* bit size */ #define GX_BP_ALPHACOMPARE_COMP1_SZ 3 + + /* raw mask */ #define GX_BP_ALPHACOMPARE_COMP1_MASK (((1 << 3) - 1) << 31 - 12) + /* local mask */ #define GX_BP_ALPHACOMPARE_COMP1_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_BP_ALPHACOMPARE_COMP1_SHIFT 19 + + /* get value */ #define GX_BP_GET_ALPHACOMPARE_COMP1(reg) GX_BITGET((reg), 10, 3) + /* set value */ #define GX_BP_SET_ALPHACOMPARE_COMP1(reg, x) ((reg) = GX_BITSET((reg), 10, 3, x)) + +// LOGIC [8:9] (2) + /* start bit */ #define GX_BP_ALPHACOMPARE_LOGIC_B 8 + /* end bit */ #define GX_BP_ALPHACOMPARE_LOGIC_E 9 + /* bit size */ #define GX_BP_ALPHACOMPARE_LOGIC_SZ 2 + + /* raw mask */ #define GX_BP_ALPHACOMPARE_LOGIC_MASK (((1 << 2) - 1) << 31 - 9) + /* local mask */ #define GX_BP_ALPHACOMPARE_LOGIC_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_ALPHACOMPARE_LOGIC_SHIFT 22 + + /* get value */ #define GX_BP_GET_ALPHACOMPARE_LOGIC(reg) GX_BITGET((reg), 8, 2) + /* set value */ #define GX_BP_SET_ALPHACOMPARE_LOGIC(reg, x) ((reg) = GX_BITSET((reg), 8, 2, x)) + + +/****************************************************************************** + * BP structure - TevKSel + *****************************************************************************/ +// SWAP_RB [30:31] (2) - Odd ksel number: red; even: blue + /* start bit */ #define GX_BP_TEVKSEL_SWAP_RB_B 30 + /* end bit */ #define GX_BP_TEVKSEL_SWAP_RB_E 31 + /* bit size */ #define GX_BP_TEVKSEL_SWAP_RB_SZ 2 + + /* raw mask */ #define GX_BP_TEVKSEL_SWAP_RB_MASK (((1 << 2) - 1) << 31 - 31) + /* local mask */ #define GX_BP_TEVKSEL_SWAP_RB_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_SWAP_RB_SHIFT 0 + + /* get value */ #define GX_BP_GET_TEVKSEL_SWAP_RB(reg) GX_BITGET((reg), 30, 2) + /* set value */ #define GX_BP_SET_TEVKSEL_SWAP_RB(reg, x) ((reg) = GX_BITSET((reg), 30, 2, x)) + +// SWAP_GA [28:29] (2) - Odd ksel number: green; even: alpha + /* start bit */ #define GX_BP_TEVKSEL_SWAP_GA_B 28 + /* end bit */ #define GX_BP_TEVKSEL_SWAP_GA_E 29 + /* bit size */ #define GX_BP_TEVKSEL_SWAP_GA_SZ 2 + + /* raw mask */ #define GX_BP_TEVKSEL_SWAP_GA_MASK (((1 << 2) - 1) << 31 - 29) + /* local mask */ #define GX_BP_TEVKSEL_SWAP_GA_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_SWAP_GA_SHIFT 2 + + /* get value */ #define GX_BP_GET_TEVKSEL_SWAP_GA(reg) GX_BITGET((reg), 28, 2) + /* set value */ #define GX_BP_SET_TEVKSEL_SWAP_GA(reg, x) ((reg) = GX_BITSET((reg), 28, 2, x)) + +// KCSEL_EVEN [23:27] (5) + /* start bit */ #define GX_BP_TEVKSEL_KCSEL_EVEN_B 23 + /* end bit */ #define GX_BP_TEVKSEL_KCSEL_EVEN_E 27 + /* bit size */ #define GX_BP_TEVKSEL_KCSEL_EVEN_SZ 5 + + /* raw mask */ #define GX_BP_TEVKSEL_KCSEL_EVEN_MASK (((1 << 5) - 1) << 31 - 27) + /* local mask */ #define GX_BP_TEVKSEL_KCSEL_EVEN_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_KCSEL_EVEN_SHIFT 4 + + /* get value */ #define GX_BP_GET_TEVKSEL_KCSEL_EVEN(reg) GX_BITGET((reg), 23, 5) + /* set value */ #define GX_BP_SET_TEVKSEL_KCSEL_EVEN(reg, x) ((reg) = GX_BITSET((reg), 23, 5, x)) + +// KASEL_EVEN [18:22] (5) + /* start bit */ #define GX_BP_TEVKSEL_KASEL_EVEN_B 18 + /* end bit */ #define GX_BP_TEVKSEL_KASEL_EVEN_E 22 + /* bit size */ #define GX_BP_TEVKSEL_KASEL_EVEN_SZ 5 + + /* raw mask */ #define GX_BP_TEVKSEL_KASEL_EVEN_MASK (((1 << 5) - 1) << 31 - 22) + /* local mask */ #define GX_BP_TEVKSEL_KASEL_EVEN_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_KASEL_EVEN_SHIFT 9 + + /* get value */ #define GX_BP_GET_TEVKSEL_KASEL_EVEN(reg) GX_BITGET((reg), 18, 5) + /* set value */ #define GX_BP_SET_TEVKSEL_KASEL_EVEN(reg, x) ((reg) = GX_BITSET((reg), 18, 5, x)) + +// KCSEL_ODD [13:17] (5) + /* start bit */ #define GX_BP_TEVKSEL_KCSEL_ODD_B 13 + /* end bit */ #define GX_BP_TEVKSEL_KCSEL_ODD_E 17 + /* bit size */ #define GX_BP_TEVKSEL_KCSEL_ODD_SZ 5 + + /* raw mask */ #define GX_BP_TEVKSEL_KCSEL_ODD_MASK (((1 << 5) - 1) << 31 - 17) + /* local mask */ #define GX_BP_TEVKSEL_KCSEL_ODD_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_KCSEL_ODD_SHIFT 14 + + /* get value */ #define GX_BP_GET_TEVKSEL_KCSEL_ODD(reg) GX_BITGET((reg), 13, 5) + /* set value */ #define GX_BP_SET_TEVKSEL_KCSEL_ODD(reg, x) ((reg) = GX_BITSET((reg), 13, 5, x)) + +// KASEL_ODD [8:12] (5) + /* start bit */ #define GX_BP_TEVKSEL_KASEL_ODD_B 8 + /* end bit */ #define GX_BP_TEVKSEL_KASEL_ODD_E 12 + /* bit size */ #define GX_BP_TEVKSEL_KASEL_ODD_SZ 5 + + /* raw mask */ #define GX_BP_TEVKSEL_KASEL_ODD_MASK (((1 << 5) - 1) << 31 - 12) + /* local mask */ #define GX_BP_TEVKSEL_KASEL_ODD_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_BP_TEVKSEL_KASEL_ODD_SHIFT 19 + + /* get value */ #define GX_BP_GET_TEVKSEL_KASEL_ODD(reg) GX_BITGET((reg), 8, 5) + /* set value */ #define GX_BP_SET_TEVKSEL_KASEL_ODD(reg, x) ((reg) = GX_BITSET((reg), 8, 5, x)) + + + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareCP.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareCP.h new file mode 100644 index 0000000000..8c7a7092ec --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareCP.h @@ -0,0 +1,876 @@ +#ifndef RVL_SDK_GX_HARDWARE_CP_H +#define RVL_SDK_GX_HARDWARE_CP_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * + * + * GX Command Processor (CP) + * + * + *****************************************************************************/ + +/** + * CP registers + */ +typedef enum { + GX_CP_REG_MATRIXINDEXA = 0x30, + GX_CP_REG_MATRIXINDEXB = 0x40, + GX_CP_REG_VCD_LO = 0x50, + GX_CP_REG_VCD_HI = 0x60, + GX_CP_REG_VAT_GROUP0 = 0x70, + GX_CP_REG_VAT_GROUP1 = 0x80, + GX_CP_REG_VAT_GROUP2 = 0x90, + GX_CP_REG_ARRAYBASE = 0xA0, + GX_CP_REG_ARRAYSTRIDE = 0xB0, +} GX_CP_REG; + +/****************************************************************************** + * CP register 0x30 - MatrixIndexA + *****************************************************************************/ +// TEX3 [2:7] (6) + /* start bit */ #define GX_CP_MATRIXINDEXA_TEX3_B 2 + /* end bit */ #define GX_CP_MATRIXINDEXA_TEX3_E 7 + /* bit size */ #define GX_CP_MATRIXINDEXA_TEX3_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXA_TEX3_MASK (((1 << 6) - 1) << 31 - 7) + /* local mask */ #define GX_CP_MATRIXINDEXA_TEX3_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXA_TEX3_SHIFT 24 + + /* get value */ #define GX_CP_GET_MATRIXINDEXA_TEX3(reg) GX_BITGET((reg), 2, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXA_TEX3(reg, x) ((reg) = GX_BITSET((reg), 2, 6, x)) + +// TEX2 [8:13] (6) + /* start bit */ #define GX_CP_MATRIXINDEXA_TEX2_B 8 + /* end bit */ #define GX_CP_MATRIXINDEXA_TEX2_E 13 + /* bit size */ #define GX_CP_MATRIXINDEXA_TEX2_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXA_TEX2_MASK (((1 << 6) - 1) << 31 - 13) + /* local mask */ #define GX_CP_MATRIXINDEXA_TEX2_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXA_TEX2_SHIFT 18 + + /* get value */ #define GX_CP_GET_MATRIXINDEXA_TEX2(reg) GX_BITGET((reg), 8, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXA_TEX2(reg, x) ((reg) = GX_BITSET((reg), 8, 6, x)) + +// TEX1 [14:19] (6) + /* start bit */ #define GX_CP_MATRIXINDEXA_TEX1_B 14 + /* end bit */ #define GX_CP_MATRIXINDEXA_TEX1_E 19 + /* bit size */ #define GX_CP_MATRIXINDEXA_TEX1_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXA_TEX1_MASK (((1 << 6) - 1) << 31 - 19) + /* local mask */ #define GX_CP_MATRIXINDEXA_TEX1_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXA_TEX1_SHIFT 12 + + /* get value */ #define GX_CP_GET_MATRIXINDEXA_TEX1(reg) GX_BITGET((reg), 14, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXA_TEX1(reg, x) ((reg) = GX_BITSET((reg), 14, 6, x)) + +// TEX0 [20:25] (6) + /* start bit */ #define GX_CP_MATRIXINDEXA_TEX0_B 20 + /* end bit */ #define GX_CP_MATRIXINDEXA_TEX0_E 25 + /* bit size */ #define GX_CP_MATRIXINDEXA_TEX0_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXA_TEX0_MASK (((1 << 6) - 1) << 31 - 25) + /* local mask */ #define GX_CP_MATRIXINDEXA_TEX0_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXA_TEX0_SHIFT 6 + + /* get value */ #define GX_CP_GET_MATRIXINDEXA_TEX0(reg) GX_BITGET((reg), 20, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXA_TEX0(reg, x) ((reg) = GX_BITSET((reg), 20, 6, x)) + +// POSNRM [26:31] (6) + /* start bit */ #define GX_CP_MATRIXINDEXA_POSNRM_B 26 + /* end bit */ #define GX_CP_MATRIXINDEXA_POSNRM_E 31 + /* bit size */ #define GX_CP_MATRIXINDEXA_POSNRM_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXA_POSNRM_MASK (((1 << 6) - 1) << 31 - 31) + /* local mask */ #define GX_CP_MATRIXINDEXA_POSNRM_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXA_POSNRM_SHIFT 0 + + /* get value */ #define GX_CP_GET_MATRIXINDEXA_POSNRM(reg) GX_BITGET((reg), 26, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXA_POSNRM(reg, x) ((reg) = GX_BITSET((reg), 26, 6, x)) + + +/****************************************************************************** + * CP register 0x40 - MatrixIndexB + *****************************************************************************/ +// TEX7 [8:13] (6) + /* start bit */ #define GX_CP_MATRIXINDEXB_TEX7_B 8 + /* end bit */ #define GX_CP_MATRIXINDEXB_TEX7_E 13 + /* bit size */ #define GX_CP_MATRIXINDEXB_TEX7_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXB_TEX7_MASK (((1 << 6) - 1) << 31 - 13) + /* local mask */ #define GX_CP_MATRIXINDEXB_TEX7_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXB_TEX7_SHIFT 18 + + /* get value */ #define GX_CP_GET_MATRIXINDEXB_TEX7(reg) GX_BITGET((reg), 8, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXB_TEX7(reg, x) ((reg) = GX_BITSET((reg), 8, 6, x)) + +// TEX6 [14:19] (6) + /* start bit */ #define GX_CP_MATRIXINDEXB_TEX6_B 14 + /* end bit */ #define GX_CP_MATRIXINDEXB_TEX6_E 19 + /* bit size */ #define GX_CP_MATRIXINDEXB_TEX6_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXB_TEX6_MASK (((1 << 6) - 1) << 31 - 19) + /* local mask */ #define GX_CP_MATRIXINDEXB_TEX6_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXB_TEX6_SHIFT 12 + + /* get value */ #define GX_CP_GET_MATRIXINDEXB_TEX6(reg) GX_BITGET((reg), 14, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXB_TEX6(reg, x) ((reg) = GX_BITSET((reg), 14, 6, x)) + +// TEX5 [20:25] (6) + /* start bit */ #define GX_CP_MATRIXINDEXB_TEX5_B 20 + /* end bit */ #define GX_CP_MATRIXINDEXB_TEX5_E 25 + /* bit size */ #define GX_CP_MATRIXINDEXB_TEX5_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXB_TEX5_MASK (((1 << 6) - 1) << 31 - 25) + /* local mask */ #define GX_CP_MATRIXINDEXB_TEX5_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXB_TEX5_SHIFT 6 + + /* get value */ #define GX_CP_GET_MATRIXINDEXB_TEX5(reg) GX_BITGET((reg), 20, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXB_TEX5(reg, x) ((reg) = GX_BITSET((reg), 20, 6, x)) + +// TEX4 [26:31] (6) + /* start bit */ #define GX_CP_MATRIXINDEXB_TEX4_B 26 + /* end bit */ #define GX_CP_MATRIXINDEXB_TEX4_E 31 + /* bit size */ #define GX_CP_MATRIXINDEXB_TEX4_SZ 6 + + /* raw mask */ #define GX_CP_MATRIXINDEXB_TEX4_MASK (((1 << 6) - 1) << 31 - 31) + /* local mask */ #define GX_CP_MATRIXINDEXB_TEX4_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_CP_MATRIXINDEXB_TEX4_SHIFT 0 + + /* get value */ #define GX_CP_GET_MATRIXINDEXB_TEX4(reg) GX_BITGET((reg), 26, 6) + /* set value */ #define GX_CP_SET_MATRIXINDEXB_TEX4(reg, x) ((reg) = GX_BITSET((reg), 26, 6, x)) + + +/****************************************************************************** + * CP register 0x50 - VCD_Lo + *****************************************************************************/ +// POSMATIDX [31:31] (1) + /* start bit */ #define GX_CP_VCD_LO_POSMATIDX_B 31 + /* end bit */ #define GX_CP_VCD_LO_POSMATIDX_E 31 + /* bit size */ #define GX_CP_VCD_LO_POSMATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_POSMATIDX_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_CP_VCD_LO_POSMATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_POSMATIDX_SHIFT 0 + + /* get value */ #define GX_CP_GET_VCD_LO_POSMATIDX(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_CP_SET_VCD_LO_POSMATIDX(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// TEX0MATIDX [30:30] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX0MATIDX_B 30 + /* end bit */ #define GX_CP_VCD_LO_TEX0MATIDX_E 30 + /* bit size */ #define GX_CP_VCD_LO_TEX0MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX0MATIDX_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_CP_VCD_LO_TEX0MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX0MATIDX_SHIFT 1 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX0MATIDX(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX0MATIDX(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + +// TEX1MATIDX [29:29] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX1MATIDX_B 29 + /* end bit */ #define GX_CP_VCD_LO_TEX1MATIDX_E 29 + /* bit size */ #define GX_CP_VCD_LO_TEX1MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX1MATIDX_MASK (((1 << 1) - 1) << 31 - 29) + /* local mask */ #define GX_CP_VCD_LO_TEX1MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX1MATIDX_SHIFT 2 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX1MATIDX(reg) GX_BITGET((reg), 29, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX1MATIDX(reg, x) ((reg) = GX_BITSET((reg), 29, 1, x)) + +// TEX2MATIDX [28:28] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX2MATIDX_B 28 + /* end bit */ #define GX_CP_VCD_LO_TEX2MATIDX_E 28 + /* bit size */ #define GX_CP_VCD_LO_TEX2MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX2MATIDX_MASK (((1 << 1) - 1) << 31 - 28) + /* local mask */ #define GX_CP_VCD_LO_TEX2MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX2MATIDX_SHIFT 3 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX2MATIDX(reg) GX_BITGET((reg), 28, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX2MATIDX(reg, x) ((reg) = GX_BITSET((reg), 28, 1, x)) + +// TEX3MATIDX [27:27] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX3MATIDX_B 27 + /* end bit */ #define GX_CP_VCD_LO_TEX3MATIDX_E 27 + /* bit size */ #define GX_CP_VCD_LO_TEX3MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX3MATIDX_MASK (((1 << 1) - 1) << 31 - 27) + /* local mask */ #define GX_CP_VCD_LO_TEX3MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX3MATIDX_SHIFT 4 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX3MATIDX(reg) GX_BITGET((reg), 27, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX3MATIDX(reg, x) ((reg) = GX_BITSET((reg), 27, 1, x)) + +// TEX4MATIDX [26:26] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX4MATIDX_B 26 + /* end bit */ #define GX_CP_VCD_LO_TEX4MATIDX_E 26 + /* bit size */ #define GX_CP_VCD_LO_TEX4MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX4MATIDX_MASK (((1 << 1) - 1) << 31 - 26) + /* local mask */ #define GX_CP_VCD_LO_TEX4MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX4MATIDX_SHIFT 5 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX4MATIDX(reg) GX_BITGET((reg), 26, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX4MATIDX(reg, x) ((reg) = GX_BITSET((reg), 26, 1, x)) + +// TEX5MATIDX [25:25] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX5MATIDX_B 25 + /* end bit */ #define GX_CP_VCD_LO_TEX5MATIDX_E 25 + /* bit size */ #define GX_CP_VCD_LO_TEX5MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX5MATIDX_MASK (((1 << 1) - 1) << 31 - 25) + /* local mask */ #define GX_CP_VCD_LO_TEX5MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX5MATIDX_SHIFT 6 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX5MATIDX(reg) GX_BITGET((reg), 25, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX5MATIDX(reg, x) ((reg) = GX_BITSET((reg), 25, 1, x)) + +// TEX6MATIDX [24:24] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX6MATIDX_B 24 + /* end bit */ #define GX_CP_VCD_LO_TEX6MATIDX_E 24 + /* bit size */ #define GX_CP_VCD_LO_TEX6MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX6MATIDX_MASK (((1 << 1) - 1) << 31 - 24) + /* local mask */ #define GX_CP_VCD_LO_TEX6MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX6MATIDX_SHIFT 7 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX6MATIDX(reg) GX_BITGET((reg), 24, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX6MATIDX(reg, x) ((reg) = GX_BITSET((reg), 24, 1, x)) + +// TEX7MATIDX [23:23] (1) + /* start bit */ #define GX_CP_VCD_LO_TEX7MATIDX_B 23 + /* end bit */ #define GX_CP_VCD_LO_TEX7MATIDX_E 23 + /* bit size */ #define GX_CP_VCD_LO_TEX7MATIDX_SZ 1 + + /* raw mask */ #define GX_CP_VCD_LO_TEX7MATIDX_MASK (((1 << 1) - 1) << 31 - 23) + /* local mask */ #define GX_CP_VCD_LO_TEX7MATIDX_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VCD_LO_TEX7MATIDX_SHIFT 8 + + /* get value */ #define GX_CP_GET_VCD_LO_TEX7MATIDX(reg) GX_BITGET((reg), 23, 1) + /* set value */ #define GX_CP_SET_VCD_LO_TEX7MATIDX(reg, x) ((reg) = GX_BITSET((reg), 23, 1, x)) + +// POSITION [21:22] (2) + /* start bit */ #define GX_CP_VCD_LO_POSITION_B 21 + /* end bit */ #define GX_CP_VCD_LO_POSITION_E 22 + /* bit size */ #define GX_CP_VCD_LO_POSITION_SZ 2 + + /* raw mask */ #define GX_CP_VCD_LO_POSITION_MASK (((1 << 2) - 1) << 31 - 22) + /* local mask */ #define GX_CP_VCD_LO_POSITION_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_LO_POSITION_SHIFT 9 + + /* get value */ #define GX_CP_GET_VCD_LO_POSITION(reg) GX_BITGET((reg), 21, 2) + /* set value */ #define GX_CP_SET_VCD_LO_POSITION(reg, x) ((reg) = GX_BITSET((reg), 21, 2, x)) + +// NORMAL [19:20] (2) + /* start bit */ #define GX_CP_VCD_LO_NORMAL_B 19 + /* end bit */ #define GX_CP_VCD_LO_NORMAL_E 20 + /* bit size */ #define GX_CP_VCD_LO_NORMAL_SZ 2 + + /* raw mask */ #define GX_CP_VCD_LO_NORMAL_MASK (((1 << 2) - 1) << 31 - 20) + /* local mask */ #define GX_CP_VCD_LO_NORMAL_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_LO_NORMAL_SHIFT 11 + + /* get value */ #define GX_CP_GET_VCD_LO_NORMAL(reg) GX_BITGET((reg), 19, 2) + /* set value */ #define GX_CP_SET_VCD_LO_NORMAL(reg, x) ((reg) = GX_BITSET((reg), 19, 2, x)) + +// COLORDIFFUSED [17:18] (2) + /* start bit */ #define GX_CP_VCD_LO_COLORDIFFUSED_B 17 + /* end bit */ #define GX_CP_VCD_LO_COLORDIFFUSED_E 18 + /* bit size */ #define GX_CP_VCD_LO_COLORDIFFUSED_SZ 2 + + /* raw mask */ #define GX_CP_VCD_LO_COLORDIFFUSED_MASK (((1 << 2) - 1) << 31 - 18) + /* local mask */ #define GX_CP_VCD_LO_COLORDIFFUSED_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_LO_COLORDIFFUSED_SHIFT 13 + + /* get value */ #define GX_CP_GET_VCD_LO_COLORDIFFUSED(reg) GX_BITGET((reg), 17, 2) + /* set value */ #define GX_CP_SET_VCD_LO_COLORDIFFUSED(reg, x) ((reg) = GX_BITSET((reg), 17, 2, x)) + +// COLORSPECULAR [15:16] (2) + /* start bit */ #define GX_CP_VCD_LO_COLORSPECULAR_B 15 + /* end bit */ #define GX_CP_VCD_LO_COLORSPECULAR_E 16 + /* bit size */ #define GX_CP_VCD_LO_COLORSPECULAR_SZ 2 + + /* raw mask */ #define GX_CP_VCD_LO_COLORSPECULAR_MASK (((1 << 2) - 1) << 31 - 16) + /* local mask */ #define GX_CP_VCD_LO_COLORSPECULAR_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_LO_COLORSPECULAR_SHIFT 15 + + /* get value */ #define GX_CP_GET_VCD_LO_COLORSPECULAR(reg) GX_BITGET((reg), 15, 2) + /* set value */ #define GX_CP_SET_VCD_LO_COLORSPECULAR(reg, x) ((reg) = GX_BITSET((reg), 15, 2, x)) + + +/****************************************************************************** + * CP register 0x60 - VCD_Hi + *****************************************************************************/ +// TEX0COORD [30:31] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX0COORD_B 30 + /* end bit */ #define GX_CP_VCD_HI_TEX0COORD_E 31 + /* bit size */ #define GX_CP_VCD_HI_TEX0COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX0COORD_MASK (((1 << 2) - 1) << 31 - 31) + /* local mask */ #define GX_CP_VCD_HI_TEX0COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX0COORD_SHIFT 0 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX0COORD(reg) GX_BITGET((reg), 30, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX0COORD(reg, x) ((reg) = GX_BITSET((reg), 30, 2, x)) + +// TEX1COORD [28:29] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX1COORD_B 28 + /* end bit */ #define GX_CP_VCD_HI_TEX1COORD_E 29 + /* bit size */ #define GX_CP_VCD_HI_TEX1COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX1COORD_MASK (((1 << 2) - 1) << 31 - 29) + /* local mask */ #define GX_CP_VCD_HI_TEX1COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX1COORD_SHIFT 2 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX1COORD(reg) GX_BITGET((reg), 28, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX1COORD(reg, x) ((reg) = GX_BITSET((reg), 28, 2, x)) + +// TEX2COORD [26:27] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX2COORD_B 26 + /* end bit */ #define GX_CP_VCD_HI_TEX2COORD_E 27 + /* bit size */ #define GX_CP_VCD_HI_TEX2COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX2COORD_MASK (((1 << 2) - 1) << 31 - 27) + /* local mask */ #define GX_CP_VCD_HI_TEX2COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX2COORD_SHIFT 4 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX2COORD(reg) GX_BITGET((reg), 26, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX2COORD(reg, x) ((reg) = GX_BITSET((reg), 26, 2, x)) + +// TEX3COORD [24:25] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX3COORD_B 24 + /* end bit */ #define GX_CP_VCD_HI_TEX3COORD_E 25 + /* bit size */ #define GX_CP_VCD_HI_TEX3COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX3COORD_MASK (((1 << 2) - 1) << 31 - 25) + /* local mask */ #define GX_CP_VCD_HI_TEX3COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX3COORD_SHIFT 6 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX3COORD(reg) GX_BITGET((reg), 24, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX3COORD(reg, x) ((reg) = GX_BITSET((reg), 24, 2, x)) + +// TEX4COORD [22:23] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX4COORD_B 22 + /* end bit */ #define GX_CP_VCD_HI_TEX4COORD_E 23 + /* bit size */ #define GX_CP_VCD_HI_TEX4COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX4COORD_MASK (((1 << 2) - 1) << 31 - 23) + /* local mask */ #define GX_CP_VCD_HI_TEX4COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX4COORD_SHIFT 8 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX4COORD(reg) GX_BITGET((reg), 22, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX4COORD(reg, x) ((reg) = GX_BITSET((reg), 22, 2, x)) + +// TEX5COORD [20:21] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX5COORD_B 20 + /* end bit */ #define GX_CP_VCD_HI_TEX5COORD_E 21 + /* bit size */ #define GX_CP_VCD_HI_TEX5COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX5COORD_MASK (((1 << 2) - 1) << 31 - 21) + /* local mask */ #define GX_CP_VCD_HI_TEX5COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX5COORD_SHIFT 10 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX5COORD(reg) GX_BITGET((reg), 20, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX5COORD(reg, x) ((reg) = GX_BITSET((reg), 20, 2, x)) + +// TEX6COORD [18:19] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX6COORD_B 18 + /* end bit */ #define GX_CP_VCD_HI_TEX6COORD_E 19 + /* bit size */ #define GX_CP_VCD_HI_TEX6COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX6COORD_MASK (((1 << 2) - 1) << 31 - 19) + /* local mask */ #define GX_CP_VCD_HI_TEX6COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX6COORD_SHIFT 12 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX6COORD(reg) GX_BITGET((reg), 18, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX6COORD(reg, x) ((reg) = GX_BITSET((reg), 18, 2, x)) + +// TEX7COORD [16:17] (2) + /* start bit */ #define GX_CP_VCD_HI_TEX7COORD_B 16 + /* end bit */ #define GX_CP_VCD_HI_TEX7COORD_E 17 + /* bit size */ #define GX_CP_VCD_HI_TEX7COORD_SZ 2 + + /* raw mask */ #define GX_CP_VCD_HI_TEX7COORD_MASK (((1 << 2) - 1) << 31 - 17) + /* local mask */ #define GX_CP_VCD_HI_TEX7COORD_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_CP_VCD_HI_TEX7COORD_SHIFT 14 + + /* get value */ #define GX_CP_GET_VCD_HI_TEX7COORD(reg) GX_BITGET((reg), 16, 2) + /* set value */ #define GX_CP_SET_VCD_HI_TEX7COORD(reg, x) ((reg) = GX_BITSET((reg), 16, 2, x)) + + +/****************************************************************************** + * CP register 0x70 - VAT_group0 + *****************************************************************************/ +// POS_CNT [31:31] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_POS_CNT_B 31 + /* end bit */ #define GX_CP_VAT_GROUP0_POS_CNT_E 31 + /* bit size */ #define GX_CP_VAT_GROUP0_POS_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_POS_CNT_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_CP_VAT_GROUP0_POS_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_POS_CNT_SHIFT 0 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_POS_CNT(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_POS_CNT(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// POS_TYPE [28:30] (3) + /* start bit */ #define GX_CP_VAT_GROUP0_POS_TYPE_B 28 + /* end bit */ #define GX_CP_VAT_GROUP0_POS_TYPE_E 30 + /* bit size */ #define GX_CP_VAT_GROUP0_POS_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP0_POS_TYPE_MASK (((1 << 3) - 1) << 31 - 30) + /* local mask */ #define GX_CP_VAT_GROUP0_POS_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_POS_TYPE_SHIFT 1 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_POS_TYPE(reg) GX_BITGET((reg), 28, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP0_POS_TYPE(reg, x) ((reg) = GX_BITSET((reg), 28, 3, x)) + +// POS_SHIFT [23:27] (5) + /* start bit */ #define GX_CP_VAT_GROUP0_POS_SHIFT_B 23 + /* end bit */ #define GX_CP_VAT_GROUP0_POS_SHIFT_E 27 + /* bit size */ #define GX_CP_VAT_GROUP0_POS_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP0_POS_SHIFT_MASK (((1 << 5) - 1) << 31 - 27) + /* local mask */ #define GX_CP_VAT_GROUP0_POS_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_POS_SHIFT_SHIFT 4 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_POS_SHIFT(reg) GX_BITGET((reg), 23, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP0_POS_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 23, 5, x)) + +// NRM_CNT [22:22] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_NRM_CNT_B 22 + /* end bit */ #define GX_CP_VAT_GROUP0_NRM_CNT_E 22 + /* bit size */ #define GX_CP_VAT_GROUP0_NRM_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_NRM_CNT_MASK (((1 << 1) - 1) << 31 - 22) + /* local mask */ #define GX_CP_VAT_GROUP0_NRM_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_NRM_CNT_SHIFT 9 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_NRM_CNT(reg) GX_BITGET((reg), 22, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_NRM_CNT(reg, x) ((reg) = GX_BITSET((reg), 22, 1, x)) + +// NRM_TYPE [19:21] (3) + /* start bit */ #define GX_CP_VAT_GROUP0_NRM_TYPE_B 19 + /* end bit */ #define GX_CP_VAT_GROUP0_NRM_TYPE_E 21 + /* bit size */ #define GX_CP_VAT_GROUP0_NRM_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP0_NRM_TYPE_MASK (((1 << 3) - 1) << 31 - 21) + /* local mask */ #define GX_CP_VAT_GROUP0_NRM_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_NRM_TYPE_SHIFT 10 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_NRM_TYPE(reg) GX_BITGET((reg), 19, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP0_NRM_TYPE(reg, x) ((reg) = GX_BITSET((reg), 19, 3, x)) + +// COLORDIFF_CNT [18:18] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_B 18 + /* end bit */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_E 18 + /* bit size */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_MASK (((1 << 1) - 1) << 31 - 18) + /* local mask */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_COLORDIFF_CNT_SHIFT 13 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_COLORDIFF_CNT(reg) GX_BITGET((reg), 18, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_COLORDIFF_CNT(reg, x) ((reg) = GX_BITSET((reg), 18, 1, x)) + +// COLORDIFF_TYPE [15:17] (3) + /* start bit */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_B 15 + /* end bit */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_E 17 + /* bit size */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_MASK (((1 << 3) - 1) << 31 - 17) + /* local mask */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_COLORDIFF_TYPE_SHIFT 14 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_COLORDIFF_TYPE(reg) GX_BITGET((reg), 15, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP0_COLORDIFF_TYPE(reg, x) ((reg) = GX_BITSET((reg), 15, 3, x)) + +// COLORSPEC_CNT [14:14] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_B 14 + /* end bit */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_E 14 + /* bit size */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_MASK (((1 << 1) - 1) << 31 - 14) + /* local mask */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_COLORSPEC_CNT_SHIFT 17 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_COLORSPEC_CNT(reg) GX_BITGET((reg), 14, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_COLORSPEC_CNT(reg, x) ((reg) = GX_BITSET((reg), 14, 1, x)) + +// COLORSPEC_TYPE [11:13] (3) + /* start bit */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_B 11 + /* end bit */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_E 13 + /* bit size */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_MASK (((1 << 3) - 1) << 31 - 13) + /* local mask */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_COLORSPEC_TYPE_SHIFT 18 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_COLORSPEC_TYPE(reg) GX_BITGET((reg), 11, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP0_COLORSPEC_TYPE(reg, x) ((reg) = GX_BITSET((reg), 11, 3, x)) + +// TXC0_CNT [10:10] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_TXC0_CNT_B 10 + /* end bit */ #define GX_CP_VAT_GROUP0_TXC0_CNT_E 10 + /* bit size */ #define GX_CP_VAT_GROUP0_TXC0_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_TXC0_CNT_MASK (((1 << 1) - 1) << 31 - 10) + /* local mask */ #define GX_CP_VAT_GROUP0_TXC0_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_TXC0_CNT_SHIFT 21 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_TXC0_CNT(reg) GX_BITGET((reg), 10, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_TXC0_CNT(reg, x) ((reg) = GX_BITSET((reg), 10, 1, x)) + +// TXC0_TYPE [7:9] (3) + /* start bit */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_B 7 + /* end bit */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_E 9 + /* bit size */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_MASK (((1 << 3) - 1) << 31 - 9) + /* local mask */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_TXC0_TYPE_SHIFT 22 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_TXC0_TYPE(reg) GX_BITGET((reg), 7, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP0_TXC0_TYPE(reg, x) ((reg) = GX_BITSET((reg), 7, 3, x)) + +// TXC0_SHIFT [2:6] (5) + /* start bit */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_B 2 + /* end bit */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_E 6 + /* bit size */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_MASK (((1 << 5) - 1) << 31 - 6) + /* local mask */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_TXC0_SHIFT_SHIFT 25 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_TXC0_SHIFT(reg) GX_BITGET((reg), 2, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP0_TXC0_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 2, 5, x)) + +// BYTEDEQUANT [1:1] (1) + /* start bit */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_B 1 + /* end bit */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_E 1 + /* bit size */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_MASK (((1 << 1) - 1) << 31 - 1) + /* local mask */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_BYTEDEQUANT_SHIFT 30 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_BYTEDEQUANT(reg) GX_BITGET((reg), 1, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_BYTEDEQUANT(reg, x) ((reg) = GX_BITSET((reg), 1, 1, x)) + +// NORMALINDEX3 [0:0] (1) - Input will be treated as three staggered indices (one per triple biased by component size) into normal table + /* start bit */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_B 0 + /* end bit */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_E 0 + /* bit size */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_MASK (((1 << 1) - 1) << 31 - 0) + /* local mask */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP0_NORMALINDEX3_SHIFT 31 + + /* get value */ #define GX_CP_GET_VAT_GROUP0_NORMALINDEX3(reg) GX_BITGET((reg), 0, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP0_NORMALINDEX3(reg, x) ((reg) = GX_BITSET((reg), 0, 1, x)) + + +/****************************************************************************** + * CP register 0x80 - VAT_group1 + *****************************************************************************/ +// TXC1_CNT [31:31] (1) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC1_CNT_B 31 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC1_CNT_E 31 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC1_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC1_CNT_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC1_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC1_CNT_SHIFT 0 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC1_CNT(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC1_CNT(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// TXC1_TYPE [28:30] (3) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_B 28 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_E 30 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_MASK (((1 << 3) - 1) << 31 - 30) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC1_TYPE_SHIFT 1 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC1_TYPE(reg) GX_BITGET((reg), 28, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC1_TYPE(reg, x) ((reg) = GX_BITSET((reg), 28, 3, x)) + +// TXC1_SHIFT [23:27] (5) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_B 23 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_E 27 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_MASK (((1 << 5) - 1) << 31 - 27) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC1_SHIFT_SHIFT 4 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC1_SHIFT(reg) GX_BITGET((reg), 23, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC1_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 23, 5, x)) + +// TXC2_CNT [22:22] (1) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC2_CNT_B 22 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC2_CNT_E 22 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC2_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC2_CNT_MASK (((1 << 1) - 1) << 31 - 22) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC2_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC2_CNT_SHIFT 9 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC2_CNT(reg) GX_BITGET((reg), 22, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC2_CNT(reg, x) ((reg) = GX_BITSET((reg), 22, 1, x)) + +// TXC2_TYPE [19:21] (3) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_B 19 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_E 21 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_MASK (((1 << 3) - 1) << 31 - 21) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC2_TYPE_SHIFT 10 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC2_TYPE(reg) GX_BITGET((reg), 19, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC2_TYPE(reg, x) ((reg) = GX_BITSET((reg), 19, 3, x)) + +// TXC2_SHIFT [14:18] (5) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_B 14 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_E 18 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_MASK (((1 << 5) - 1) << 31 - 18) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC2_SHIFT_SHIFT 13 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC2_SHIFT(reg) GX_BITGET((reg), 14, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC2_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 14, 5, x)) + +// TXC3_CNT [13:13] (1) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC3_CNT_B 13 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC3_CNT_E 13 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC3_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC3_CNT_MASK (((1 << 1) - 1) << 31 - 13) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC3_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC3_CNT_SHIFT 18 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC3_CNT(reg) GX_BITGET((reg), 13, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC3_CNT(reg, x) ((reg) = GX_BITSET((reg), 13, 1, x)) + +// TXC3_TYPE [10:12] (3) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_B 10 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_E 12 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_MASK (((1 << 3) - 1) << 31 - 12) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC3_TYPE_SHIFT 19 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC3_TYPE(reg) GX_BITGET((reg), 10, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC3_TYPE(reg, x) ((reg) = GX_BITSET((reg), 10, 3, x)) + +// TXC3_SHIFT [5:9] (5) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_B 5 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_E 9 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_MASK (((1 << 5) - 1) << 31 - 9) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC3_SHIFT_SHIFT 22 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC3_SHIFT(reg) GX_BITGET((reg), 5, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC3_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 5, 5, x)) + +// TXC4_CNT [4:4] (1) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC4_CNT_B 4 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC4_CNT_E 4 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC4_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC4_CNT_MASK (((1 << 1) - 1) << 31 - 4) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC4_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC4_CNT_SHIFT 27 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC4_CNT(reg) GX_BITGET((reg), 4, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC4_CNT(reg, x) ((reg) = GX_BITSET((reg), 4, 1, x)) + +// TXC4_TYPE [1:3] (3) + /* start bit */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_B 1 + /* end bit */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_E 3 + /* bit size */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_MASK (((1 << 3) - 1) << 31 - 3) + /* local mask */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP1_TXC4_TYPE_SHIFT 28 + + /* get value */ #define GX_CP_GET_VAT_GROUP1_TXC4_TYPE(reg) GX_BITGET((reg), 1, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP1_TXC4_TYPE(reg, x) ((reg) = GX_BITSET((reg), 1, 3, x)) + + +/****************************************************************************** + * CP register 0x90 - VAT_group2 + *****************************************************************************/ +// TXC4_SHIFT [27:31] (5) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_B 27 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_E 31 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_MASK (((1 << 5) - 1) << 31 - 31) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC4_SHIFT_SHIFT 0 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC4_SHIFT(reg) GX_BITGET((reg), 27, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC4_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 27, 5, x)) + +// TXC5_CNT [26:26] (1) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC5_CNT_B 26 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC5_CNT_E 26 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC5_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC5_CNT_MASK (((1 << 1) - 1) << 31 - 26) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC5_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC5_CNT_SHIFT 5 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC5_CNT(reg) GX_BITGET((reg), 26, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC5_CNT(reg, x) ((reg) = GX_BITSET((reg), 26, 1, x)) + +// TXC5_TYPE [23:25] (3) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_B 23 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_E 25 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_MASK (((1 << 3) - 1) << 31 - 25) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC5_TYPE_SHIFT 6 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC5_TYPE(reg) GX_BITGET((reg), 23, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC5_TYPE(reg, x) ((reg) = GX_BITSET((reg), 23, 3, x)) + +// TXC5_SHIFT [18:22] (5) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_B 18 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_E 22 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_MASK (((1 << 5) - 1) << 31 - 22) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC5_SHIFT_SHIFT 9 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC5_SHIFT(reg) GX_BITGET((reg), 18, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC5_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 18, 5, x)) + +// TXC6_CNT [17:17] (1) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC6_CNT_B 17 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC6_CNT_E 17 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC6_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC6_CNT_MASK (((1 << 1) - 1) << 31 - 17) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC6_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC6_CNT_SHIFT 14 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC6_CNT(reg) GX_BITGET((reg), 17, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC6_CNT(reg, x) ((reg) = GX_BITSET((reg), 17, 1, x)) + +// TXC6_TYPE [14:16] (3) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_B 14 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_E 16 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_MASK (((1 << 3) - 1) << 31 - 16) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC6_TYPE_SHIFT 15 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC6_TYPE(reg) GX_BITGET((reg), 14, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC6_TYPE(reg, x) ((reg) = GX_BITSET((reg), 14, 3, x)) + +// TXC6_SHIFT [9:13] (5) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_B 9 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_E 13 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_MASK (((1 << 5) - 1) << 31 - 13) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC6_SHIFT_SHIFT 18 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC6_SHIFT(reg) GX_BITGET((reg), 9, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC6_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 9, 5, x)) + +// TXC7_CNT [8:8] (1) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC7_CNT_B 8 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC7_CNT_E 8 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC7_CNT_SZ 1 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC7_CNT_MASK (((1 << 1) - 1) << 31 - 8) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC7_CNT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC7_CNT_SHIFT 23 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC7_CNT(reg) GX_BITGET((reg), 8, 1) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC7_CNT(reg, x) ((reg) = GX_BITSET((reg), 8, 1, x)) + +// TXC7_TYPE [5:7] (3) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_B 5 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_E 7 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_SZ 3 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_MASK (((1 << 3) - 1) << 31 - 7) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC7_TYPE_SHIFT 24 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC7_TYPE(reg) GX_BITGET((reg), 5, 3) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC7_TYPE(reg, x) ((reg) = GX_BITSET((reg), 5, 3, x)) + +// TXC7_SHIFT [0:4] (5) + /* start bit */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_B 0 + /* end bit */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_E 4 + /* bit size */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_SZ 5 + + /* raw mask */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_MASK (((1 << 5) - 1) << 31 - 4) + /* local mask */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_CP_VAT_GROUP2_TXC7_SHIFT_SHIFT 27 + + /* get value */ #define GX_CP_GET_VAT_GROUP2_TXC7_SHIFT(reg) GX_BITGET((reg), 0, 5) + /* set value */ #define GX_CP_SET_VAT_GROUP2_TXC7_SHIFT(reg, x) ((reg) = GX_BITSET((reg), 0, 5, x)) + + +/****************************************************************************** + * CP register 0xA0 - ArrayBase + *****************************************************************************/ +// BASE [6:31] (26) + /* start bit */ #define GX_CP_ARRAYBASE_BASE_B 6 + /* end bit */ #define GX_CP_ARRAYBASE_BASE_E 31 + /* bit size */ #define GX_CP_ARRAYBASE_BASE_SZ 26 + + /* raw mask */ #define GX_CP_ARRAYBASE_BASE_MASK (((1 << 26) - 1) << 31 - 31) + /* local mask */ #define GX_CP_ARRAYBASE_BASE_LMASK ((1 << 26) - 1) + /* bit shift */ #define GX_CP_ARRAYBASE_BASE_SHIFT 0 + + /* get value */ #define GX_CP_GET_ARRAYBASE_BASE(reg) GX_BITGET((reg), 6, 26) + /* set value */ #define GX_CP_SET_ARRAYBASE_BASE(reg, x) ((reg) = GX_BITSET((reg), 6, 26, x)) + + +/****************************************************************************** + * CP register 0xB0 - ArrayStride + *****************************************************************************/ +// STRIDE [24:31] (8) + /* start bit */ #define GX_CP_ARRAYSTRIDE_STRIDE_B 24 + /* end bit */ #define GX_CP_ARRAYSTRIDE_STRIDE_E 31 + /* bit size */ #define GX_CP_ARRAYSTRIDE_STRIDE_SZ 8 + + /* raw mask */ #define GX_CP_ARRAYSTRIDE_STRIDE_MASK (((1 << 8) - 1) << 31 - 31) + /* local mask */ #define GX_CP_ARRAYSTRIDE_STRIDE_LMASK ((1 << 8) - 1) + /* bit shift */ #define GX_CP_ARRAYSTRIDE_STRIDE_SHIFT 0 + + /* get value */ #define GX_CP_GET_ARRAYSTRIDE_STRIDE(reg) GX_BITGET((reg), 24, 8) + /* set value */ #define GX_CP_SET_ARRAYSTRIDE_STRIDE(reg, x) ((reg) = GX_BITSET((reg), 24, 8, x)) + + + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareXF.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareXF.h new file mode 100644 index 0000000000..988627dfb8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXHardwareXF.h @@ -0,0 +1,494 @@ +#ifndef RVL_SDK_GX_HARDWARE_XF_H +#define RVL_SDK_GX_HARDWARE_XF_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * + * + * GX Transform Unit (XF) + * + * + *****************************************************************************/ + +/** + * XF registers + */ +typedef enum { + GX_XF_REG_ERROR = 0x1000, + GX_XF_REG_DIAGNOSTICS = 0x1001, + GX_XF_REG_STATE0 = 0x1002, + GX_XF_REG_STATE1 = 0x1003, + GX_XF_REG_CLOCK = 0x1004, + GX_XF_REG_CLIPDISABLE = 0x1005, + GX_XF_REG_PERF0 = 0x1006, + GX_XF_REG_PERF1 = 0x1007, + GX_XF_REG_INVERTEXSPEC = 0x1008, + GX_XF_REG_NUMCOLORS = 0x1009, + GX_XF_REG_AMBIENT0 = 0x100A, + GX_XF_REG_AMBIENT1 = 0x100B, + GX_XF_REG_MATERIAL0 = 0x100C, + GX_XF_REG_MATERIAL1 = 0x100D, + GX_XF_REG_COLOR0CNTRL = 0x100E, + GX_XF_REG_COLOR1CNTRL = 0x100F, + GX_XF_REG_ALPHA0CNTRL = 0x1010, + GX_XF_REG_ALPHA1CNTRL = 0x1011, + GX_XF_REG_DUALTEXTRAN = 0x1012, + GX_XF_REG_MATRIXINDEX0 = 0x1018, + GX_XF_REG_MATRIXINDEX1 = 0x1019, + GX_XF_REG_SCALEX = 0x101A, + GX_XF_REG_SCALEY = 0x101B, + GX_XF_REG_SCALEZ = 0x101C, + GX_XF_REG_OFFSETX = 0x101D, + GX_XF_REG_OFFSETY = 0x101E, + GX_XF_REG_OFFSETZ = 0x101F, + GX_XF_REG_PROJECTIONA = 0x1020, + GX_XF_REG_PROJECTIONB = 0x1021, + GX_XF_REG_PROJECTIONC = 0x1022, + GX_XF_REG_PROJECTIOND = 0x1023, + GX_XF_REG_PROJECTIONE = 0x1024, + GX_XF_REG_PROJECTIONF = 0x1025, + GX_XF_REG_PROJECTORTHO = 0x1026, + GX_XF_REG_NUMTEX = 0x103F, + GX_XF_REG_TEX0 = 0x1040, + GX_XF_REG_TEX1 = 0x1041, + GX_XF_REG_TEX2 = 0x1042, + GX_XF_REG_TEX3 = 0x1043, + GX_XF_REG_TEX4 = 0x1044, + GX_XF_REG_TEX5 = 0x1045, + GX_XF_REG_TEX6 = 0x1046, + GX_XF_REG_TEX7 = 0x1047, + GX_XF_REG_DUALTEX0 = 0x1050, + GX_XF_REG_DUALTEX1 = 0x1051, + GX_XF_REG_DUALTEX2 = 0x1052, + GX_XF_REG_DUALTEX3 = 0x1053, + GX_XF_REG_DUALTEX4 = 0x1054, + GX_XF_REG_DUALTEX5 = 0x1055, + GX_XF_REG_DUALTEX6 = 0x1056, + GX_XF_REG_DUALTEX7 = 0x1057, +} GX_XF_REG; + +/****************************************************************************** + * XF register 0x1005 - ClipDisable + *****************************************************************************/ +// DETECT [31:31] (1) - Disable clipping detection + /* start bit */ #define GX_XF_CLIPDISABLE_DETECT_B 31 + /* end bit */ #define GX_XF_CLIPDISABLE_DETECT_E 31 + /* bit size */ #define GX_XF_CLIPDISABLE_DETECT_SZ 1 + + /* raw mask */ #define GX_XF_CLIPDISABLE_DETECT_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_XF_CLIPDISABLE_DETECT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_CLIPDISABLE_DETECT_SHIFT 0 + + /* get value */ #define GX_XF_GET_CLIPDISABLE_DETECT(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_XF_SET_CLIPDISABLE_DETECT(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// REJECT [30:30] (1) - Disable trivial rejection + /* start bit */ #define GX_XF_CLIPDISABLE_REJECT_B 30 + /* end bit */ #define GX_XF_CLIPDISABLE_REJECT_E 30 + /* bit size */ #define GX_XF_CLIPDISABLE_REJECT_SZ 1 + + /* raw mask */ #define GX_XF_CLIPDISABLE_REJECT_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_XF_CLIPDISABLE_REJECT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_CLIPDISABLE_REJECT_SHIFT 1 + + /* get value */ #define GX_XF_GET_CLIPDISABLE_REJECT(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_XF_SET_CLIPDISABLE_REJECT(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + +// ACCEL [29:29] (1) - Disable cpoly clipping acceleration + /* start bit */ #define GX_XF_CLIPDISABLE_ACCEL_B 29 + /* end bit */ #define GX_XF_CLIPDISABLE_ACCEL_E 29 + /* bit size */ #define GX_XF_CLIPDISABLE_ACCEL_SZ 1 + + /* raw mask */ #define GX_XF_CLIPDISABLE_ACCEL_MASK (((1 << 1) - 1) << 31 - 29) + /* local mask */ #define GX_XF_CLIPDISABLE_ACCEL_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_CLIPDISABLE_ACCEL_SHIFT 2 + + /* get value */ #define GX_XF_GET_CLIPDISABLE_ACCEL(reg) GX_BITGET((reg), 29, 1) + /* set value */ #define GX_XF_SET_CLIPDISABLE_ACCEL(reg, x) ((reg) = GX_BITSET((reg), 29, 1, x)) + + +/****************************************************************************** + * XF register 0x1007 - Perf1 + *****************************************************************************/ +// TARGET [25:31] (7) - Target performance (Cycles/vertex) + /* start bit */ #define GX_XF_PERF1_TARGET_B 25 + /* end bit */ #define GX_XF_PERF1_TARGET_E 31 + /* bit size */ #define GX_XF_PERF1_TARGET_SZ 7 + + /* raw mask */ #define GX_XF_PERF1_TARGET_MASK (((1 << 7) - 1) << 31 - 31) + /* local mask */ #define GX_XF_PERF1_TARGET_LMASK ((1 << 7) - 1) + /* bit shift */ #define GX_XF_PERF1_TARGET_SHIFT 0 + + /* get value */ #define GX_XF_GET_PERF1_TARGET(reg) GX_BITGET((reg), 25, 7) + /* set value */ #define GX_XF_SET_PERF1_TARGET(reg, x) ((reg) = GX_BITSET((reg), 25, 7, x)) + + +/****************************************************************************** + * XF register 0x1008 - InVertexSpec + *****************************************************************************/ +// CLR [30:31] (2) + /* start bit */ #define GX_XF_INVERTEXSPEC_CLR_B 30 + /* end bit */ #define GX_XF_INVERTEXSPEC_CLR_E 31 + /* bit size */ #define GX_XF_INVERTEXSPEC_CLR_SZ 2 + + /* raw mask */ #define GX_XF_INVERTEXSPEC_CLR_MASK (((1 << 2) - 1) << 31 - 31) + /* local mask */ #define GX_XF_INVERTEXSPEC_CLR_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_XF_INVERTEXSPEC_CLR_SHIFT 0 + + /* get value */ #define GX_XF_GET_INVERTEXSPEC_CLR(reg) GX_BITGET((reg), 30, 2) + /* set value */ #define GX_XF_SET_INVERTEXSPEC_CLR(reg, x) ((reg) = GX_BITSET((reg), 30, 2, x)) + +// NRM [28:29] (2) + /* start bit */ #define GX_XF_INVERTEXSPEC_NRM_B 28 + /* end bit */ #define GX_XF_INVERTEXSPEC_NRM_E 29 + /* bit size */ #define GX_XF_INVERTEXSPEC_NRM_SZ 2 + + /* raw mask */ #define GX_XF_INVERTEXSPEC_NRM_MASK (((1 << 2) - 1) << 31 - 29) + /* local mask */ #define GX_XF_INVERTEXSPEC_NRM_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_XF_INVERTEXSPEC_NRM_SHIFT 2 + + /* get value */ #define GX_XF_GET_INVERTEXSPEC_NRM(reg) GX_BITGET((reg), 28, 2) + /* set value */ #define GX_XF_SET_INVERTEXSPEC_NRM(reg, x) ((reg) = GX_BITSET((reg), 28, 2, x)) + +// TXC [24:27] (4) + /* start bit */ #define GX_XF_INVERTEXSPEC_TXC_B 24 + /* end bit */ #define GX_XF_INVERTEXSPEC_TXC_E 27 + /* bit size */ #define GX_XF_INVERTEXSPEC_TXC_SZ 4 + + /* raw mask */ #define GX_XF_INVERTEXSPEC_TXC_MASK (((1 << 4) - 1) << 31 - 27) + /* local mask */ #define GX_XF_INVERTEXSPEC_TXC_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_XF_INVERTEXSPEC_TXC_SHIFT 4 + + /* get value */ #define GX_XF_GET_INVERTEXSPEC_TXC(reg) GX_BITGET((reg), 24, 4) + /* set value */ #define GX_XF_SET_INVERTEXSPEC_TXC(reg, x) ((reg) = GX_BITSET((reg), 24, 4, x)) + + +/****************************************************************************** + * XF register 0x100E - Color0Cntrl + *****************************************************************************/ +// MATSRC [31:31] (1) + /* start bit */ #define GX_XF_COLOR0CNTRL_MATSRC_B 31 + /* end bit */ #define GX_XF_COLOR0CNTRL_MATSRC_E 31 + /* bit size */ #define GX_XF_COLOR0CNTRL_MATSRC_SZ 1 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_MATSRC_MASK (((1 << 1) - 1) << 31 - 31) + /* local mask */ #define GX_XF_COLOR0CNTRL_MATSRC_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_MATSRC_SHIFT 0 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_MATSRC(reg) GX_BITGET((reg), 31, 1) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_MATSRC(reg, x) ((reg) = GX_BITSET((reg), 31, 1, x)) + +// LIGHT [30:30] (1) + /* start bit */ #define GX_XF_COLOR0CNTRL_LIGHT_B 30 + /* end bit */ #define GX_XF_COLOR0CNTRL_LIGHT_E 30 + /* bit size */ #define GX_XF_COLOR0CNTRL_LIGHT_SZ 1 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_LIGHT_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_XF_COLOR0CNTRL_LIGHT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_LIGHT_SHIFT 1 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_LIGHT(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_LIGHT(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + +// LMASKLO [26:29] (4) + /* start bit */ #define GX_XF_COLOR0CNTRL_LMASKLO_B 26 + /* end bit */ #define GX_XF_COLOR0CNTRL_LMASKLO_E 29 + /* bit size */ #define GX_XF_COLOR0CNTRL_LMASKLO_SZ 4 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_LMASKLO_MASK (((1 << 4) - 1) << 31 - 29) + /* local mask */ #define GX_XF_COLOR0CNTRL_LMASKLO_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_LMASKLO_SHIFT 2 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_LMASKLO(reg) GX_BITGET((reg), 26, 4) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_LMASKLO(reg, x) ((reg) = GX_BITSET((reg), 26, 4, x)) + +// AMBSRC [25:25] (1) + /* start bit */ #define GX_XF_COLOR0CNTRL_AMBSRC_B 25 + /* end bit */ #define GX_XF_COLOR0CNTRL_AMBSRC_E 25 + /* bit size */ #define GX_XF_COLOR0CNTRL_AMBSRC_SZ 1 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_AMBSRC_MASK (((1 << 1) - 1) << 31 - 25) + /* local mask */ #define GX_XF_COLOR0CNTRL_AMBSRC_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_AMBSRC_SHIFT 6 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_AMBSRC(reg) GX_BITGET((reg), 25, 1) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_AMBSRC(reg, x) ((reg) = GX_BITSET((reg), 25, 1, x)) + +// DIFFUSEATTN [23:24] (2) + /* start bit */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_B 23 + /* end bit */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_E 24 + /* bit size */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_SZ 2 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_MASK (((1 << 2) - 1) << 31 - 24) + /* local mask */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_LMASK ((1 << 2) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_DIFFUSEATTN_SHIFT 7 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_DIFFUSEATTN(reg) GX_BITGET((reg), 23, 2) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_DIFFUSEATTN(reg, x) ((reg) = GX_BITSET((reg), 23, 2, x)) + +// ATTNENABLE [22:22] (1) + /* start bit */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_B 22 + /* end bit */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_E 22 + /* bit size */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_SZ 1 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_MASK (((1 << 1) - 1) << 31 - 22) + /* local mask */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_ATTNENABLE_SHIFT 9 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_ATTNENABLE(reg) GX_BITGET((reg), 22, 1) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_ATTNENABLE(reg, x) ((reg) = GX_BITSET((reg), 22, 1, x)) + +// ATTNSELECT [21:21] (1) + /* start bit */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_B 21 + /* end bit */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_E 21 + /* bit size */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_SZ 1 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_MASK (((1 << 1) - 1) << 31 - 21) + /* local mask */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_ATTNSELECT_SHIFT 10 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_ATTNSELECT(reg) GX_BITGET((reg), 21, 1) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_ATTNSELECT(reg, x) ((reg) = GX_BITSET((reg), 21, 1, x)) + +// LMASKHI [17:20] (4) + /* start bit */ #define GX_XF_COLOR0CNTRL_LMASKHI_B 17 + /* end bit */ #define GX_XF_COLOR0CNTRL_LMASKHI_E 20 + /* bit size */ #define GX_XF_COLOR0CNTRL_LMASKHI_SZ 4 + + /* raw mask */ #define GX_XF_COLOR0CNTRL_LMASKHI_MASK (((1 << 4) - 1) << 31 - 20) + /* local mask */ #define GX_XF_COLOR0CNTRL_LMASKHI_LMASK ((1 << 4) - 1) + /* bit shift */ #define GX_XF_COLOR0CNTRL_LMASKHI_SHIFT 11 + + /* get value */ #define GX_XF_GET_COLOR0CNTRL_LMASKHI(reg) GX_BITGET((reg), 17, 4) + /* set value */ #define GX_XF_SET_COLOR0CNTRL_LMASKHI(reg, x) ((reg) = GX_BITSET((reg), 17, 4, x)) + + +/****************************************************************************** + * XF register 0x1018 - MatrixIndex0 + *****************************************************************************/ +// GEOM [26:31] (6) + /* start bit */ #define GX_XF_MATRIXINDEX0_GEOM_B 26 + /* end bit */ #define GX_XF_MATRIXINDEX0_GEOM_E 31 + /* bit size */ #define GX_XF_MATRIXINDEX0_GEOM_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX0_GEOM_MASK (((1 << 6) - 1) << 31 - 31) + /* local mask */ #define GX_XF_MATRIXINDEX0_GEOM_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX0_GEOM_SHIFT 0 + + /* get value */ #define GX_XF_GET_MATRIXINDEX0_GEOM(reg) GX_BITGET((reg), 26, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX0_GEOM(reg, x) ((reg) = GX_BITSET((reg), 26, 6, x)) + +// TEX0 [20:25] (6) + /* start bit */ #define GX_XF_MATRIXINDEX0_TEX0_B 20 + /* end bit */ #define GX_XF_MATRIXINDEX0_TEX0_E 25 + /* bit size */ #define GX_XF_MATRIXINDEX0_TEX0_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX0_TEX0_MASK (((1 << 6) - 1) << 31 - 25) + /* local mask */ #define GX_XF_MATRIXINDEX0_TEX0_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX0_TEX0_SHIFT 6 + + /* get value */ #define GX_XF_GET_MATRIXINDEX0_TEX0(reg) GX_BITGET((reg), 20, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX0_TEX0(reg, x) ((reg) = GX_BITSET((reg), 20, 6, x)) + +// TEX1 [14:19] (6) + /* start bit */ #define GX_XF_MATRIXINDEX0_TEX1_B 14 + /* end bit */ #define GX_XF_MATRIXINDEX0_TEX1_E 19 + /* bit size */ #define GX_XF_MATRIXINDEX0_TEX1_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX0_TEX1_MASK (((1 << 6) - 1) << 31 - 19) + /* local mask */ #define GX_XF_MATRIXINDEX0_TEX1_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX0_TEX1_SHIFT 12 + + /* get value */ #define GX_XF_GET_MATRIXINDEX0_TEX1(reg) GX_BITGET((reg), 14, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX0_TEX1(reg, x) ((reg) = GX_BITSET((reg), 14, 6, x)) + +// TEX2 [8:13] (6) + /* start bit */ #define GX_XF_MATRIXINDEX0_TEX2_B 8 + /* end bit */ #define GX_XF_MATRIXINDEX0_TEX2_E 13 + /* bit size */ #define GX_XF_MATRIXINDEX0_TEX2_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX0_TEX2_MASK (((1 << 6) - 1) << 31 - 13) + /* local mask */ #define GX_XF_MATRIXINDEX0_TEX2_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX0_TEX2_SHIFT 18 + + /* get value */ #define GX_XF_GET_MATRIXINDEX0_TEX2(reg) GX_BITGET((reg), 8, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX0_TEX2(reg, x) ((reg) = GX_BITSET((reg), 8, 6, x)) + +// TEX3 [2:7] (6) + /* start bit */ #define GX_XF_MATRIXINDEX0_TEX3_B 2 + /* end bit */ #define GX_XF_MATRIXINDEX0_TEX3_E 7 + /* bit size */ #define GX_XF_MATRIXINDEX0_TEX3_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX0_TEX3_MASK (((1 << 6) - 1) << 31 - 7) + /* local mask */ #define GX_XF_MATRIXINDEX0_TEX3_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX0_TEX3_SHIFT 24 + + /* get value */ #define GX_XF_GET_MATRIXINDEX0_TEX3(reg) GX_BITGET((reg), 2, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX0_TEX3(reg, x) ((reg) = GX_BITSET((reg), 2, 6, x)) + + +/****************************************************************************** + * XF register 0x1019 - MatrixIndex1 + *****************************************************************************/ +// TEX4 [26:31] (6) + /* start bit */ #define GX_XF_MATRIXINDEX1_TEX4_B 26 + /* end bit */ #define GX_XF_MATRIXINDEX1_TEX4_E 31 + /* bit size */ #define GX_XF_MATRIXINDEX1_TEX4_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX1_TEX4_MASK (((1 << 6) - 1) << 31 - 31) + /* local mask */ #define GX_XF_MATRIXINDEX1_TEX4_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX1_TEX4_SHIFT 0 + + /* get value */ #define GX_XF_GET_MATRIXINDEX1_TEX4(reg) GX_BITGET((reg), 26, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX1_TEX4(reg, x) ((reg) = GX_BITSET((reg), 26, 6, x)) + +// TEX5 [20:25] (6) + /* start bit */ #define GX_XF_MATRIXINDEX1_TEX5_B 20 + /* end bit */ #define GX_XF_MATRIXINDEX1_TEX5_E 25 + /* bit size */ #define GX_XF_MATRIXINDEX1_TEX5_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX1_TEX5_MASK (((1 << 6) - 1) << 31 - 25) + /* local mask */ #define GX_XF_MATRIXINDEX1_TEX5_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX1_TEX5_SHIFT 6 + + /* get value */ #define GX_XF_GET_MATRIXINDEX1_TEX5(reg) GX_BITGET((reg), 20, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX1_TEX5(reg, x) ((reg) = GX_BITSET((reg), 20, 6, x)) + +// TEX6 [14:19] (6) + /* start bit */ #define GX_XF_MATRIXINDEX1_TEX6_B 14 + /* end bit */ #define GX_XF_MATRIXINDEX1_TEX6_E 19 + /* bit size */ #define GX_XF_MATRIXINDEX1_TEX6_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX1_TEX6_MASK (((1 << 6) - 1) << 31 - 19) + /* local mask */ #define GX_XF_MATRIXINDEX1_TEX6_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX1_TEX6_SHIFT 12 + + /* get value */ #define GX_XF_GET_MATRIXINDEX1_TEX6(reg) GX_BITGET((reg), 14, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX1_TEX6(reg, x) ((reg) = GX_BITSET((reg), 14, 6, x)) + +// TEX7 [8:13] (6) + /* start bit */ #define GX_XF_MATRIXINDEX1_TEX7_B 8 + /* end bit */ #define GX_XF_MATRIXINDEX1_TEX7_E 13 + /* bit size */ #define GX_XF_MATRIXINDEX1_TEX7_SZ 6 + + /* raw mask */ #define GX_XF_MATRIXINDEX1_TEX7_MASK (((1 << 6) - 1) << 31 - 13) + /* local mask */ #define GX_XF_MATRIXINDEX1_TEX7_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_MATRIXINDEX1_TEX7_SHIFT 18 + + /* get value */ #define GX_XF_GET_MATRIXINDEX1_TEX7(reg) GX_BITGET((reg), 8, 6) + /* set value */ #define GX_XF_SET_MATRIXINDEX1_TEX7(reg, x) ((reg) = GX_BITSET((reg), 8, 6, x)) + + +/****************************************************************************** + * XF structure - Tex + *****************************************************************************/ +// PROJTYPE [30:30] (1) + /* start bit */ #define GX_XF_TEX_PROJTYPE_B 30 + /* end bit */ #define GX_XF_TEX_PROJTYPE_E 30 + /* bit size */ #define GX_XF_TEX_PROJTYPE_SZ 1 + + /* raw mask */ #define GX_XF_TEX_PROJTYPE_MASK (((1 << 1) - 1) << 31 - 30) + /* local mask */ #define GX_XF_TEX_PROJTYPE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_TEX_PROJTYPE_SHIFT 1 + + /* get value */ #define GX_XF_GET_TEX_PROJTYPE(reg) GX_BITGET((reg), 30, 1) + /* set value */ #define GX_XF_SET_TEX_PROJTYPE(reg, x) ((reg) = GX_BITSET((reg), 30, 1, x)) + +// INPUTFORM [29:29] (1) + /* start bit */ #define GX_XF_TEX_INPUTFORM_B 29 + /* end bit */ #define GX_XF_TEX_INPUTFORM_E 29 + /* bit size */ #define GX_XF_TEX_INPUTFORM_SZ 1 + + /* raw mask */ #define GX_XF_TEX_INPUTFORM_MASK (((1 << 1) - 1) << 31 - 29) + /* local mask */ #define GX_XF_TEX_INPUTFORM_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_TEX_INPUTFORM_SHIFT 2 + + /* get value */ #define GX_XF_GET_TEX_INPUTFORM(reg) GX_BITGET((reg), 29, 1) + /* set value */ #define GX_XF_SET_TEX_INPUTFORM(reg, x) ((reg) = GX_BITSET((reg), 29, 1, x)) + +// TEXGENTYPE [25:27] (3) + /* start bit */ #define GX_XF_TEX_TEXGENTYPE_B 25 + /* end bit */ #define GX_XF_TEX_TEXGENTYPE_E 27 + /* bit size */ #define GX_XF_TEX_TEXGENTYPE_SZ 3 + + /* raw mask */ #define GX_XF_TEX_TEXGENTYPE_MASK (((1 << 3) - 1) << 31 - 27) + /* local mask */ #define GX_XF_TEX_TEXGENTYPE_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_XF_TEX_TEXGENTYPE_SHIFT 4 + + /* get value */ #define GX_XF_GET_TEX_TEXGENTYPE(reg) GX_BITGET((reg), 25, 3) + /* set value */ #define GX_XF_SET_TEX_TEXGENTYPE(reg, x) ((reg) = GX_BITSET((reg), 25, 3, x)) + +// SRCROW [20:24] (5) + /* start bit */ #define GX_XF_TEX_SRCROW_B 20 + /* end bit */ #define GX_XF_TEX_SRCROW_E 24 + /* bit size */ #define GX_XF_TEX_SRCROW_SZ 5 + + /* raw mask */ #define GX_XF_TEX_SRCROW_MASK (((1 << 5) - 1) << 31 - 24) + /* local mask */ #define GX_XF_TEX_SRCROW_LMASK ((1 << 5) - 1) + /* bit shift */ #define GX_XF_TEX_SRCROW_SHIFT 7 + + /* get value */ #define GX_XF_GET_TEX_SRCROW(reg) GX_BITGET((reg), 20, 5) + /* set value */ #define GX_XF_SET_TEX_SRCROW(reg, x) ((reg) = GX_BITSET((reg), 20, 5, x)) + +// BUMPSRCTEX [17:19] (3) + /* start bit */ #define GX_XF_TEX_BUMPSRCTEX_B 17 + /* end bit */ #define GX_XF_TEX_BUMPSRCTEX_E 19 + /* bit size */ #define GX_XF_TEX_BUMPSRCTEX_SZ 3 + + /* raw mask */ #define GX_XF_TEX_BUMPSRCTEX_MASK (((1 << 3) - 1) << 31 - 19) + /* local mask */ #define GX_XF_TEX_BUMPSRCTEX_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_XF_TEX_BUMPSRCTEX_SHIFT 12 + + /* get value */ #define GX_XF_GET_TEX_BUMPSRCTEX(reg) GX_BITGET((reg), 17, 3) + /* set value */ #define GX_XF_SET_TEX_BUMPSRCTEX(reg, x) ((reg) = GX_BITSET((reg), 17, 3, x)) + +// BUMPSRCLIGHT [14:16] (3) + /* start bit */ #define GX_XF_TEX_BUMPSRCLIGHT_B 14 + /* end bit */ #define GX_XF_TEX_BUMPSRCLIGHT_E 16 + /* bit size */ #define GX_XF_TEX_BUMPSRCLIGHT_SZ 3 + + /* raw mask */ #define GX_XF_TEX_BUMPSRCLIGHT_MASK (((1 << 3) - 1) << 31 - 16) + /* local mask */ #define GX_XF_TEX_BUMPSRCLIGHT_LMASK ((1 << 3) - 1) + /* bit shift */ #define GX_XF_TEX_BUMPSRCLIGHT_SHIFT 15 + + /* get value */ #define GX_XF_GET_TEX_BUMPSRCLIGHT(reg) GX_BITGET((reg), 14, 3) + /* set value */ #define GX_XF_SET_TEX_BUMPSRCLIGHT(reg, x) ((reg) = GX_BITSET((reg), 14, 3, x)) + + +/****************************************************************************** + * XF structure - DualTex + *****************************************************************************/ +// BASEROW [26:31] (6) - Indicates which is the base row of the transform matrix + /* start bit */ #define GX_XF_DUALTEX_BASEROW_B 26 + /* end bit */ #define GX_XF_DUALTEX_BASEROW_E 31 + /* bit size */ #define GX_XF_DUALTEX_BASEROW_SZ 6 + + /* raw mask */ #define GX_XF_DUALTEX_BASEROW_MASK (((1 << 6) - 1) << 31 - 31) + /* local mask */ #define GX_XF_DUALTEX_BASEROW_LMASK ((1 << 6) - 1) + /* bit shift */ #define GX_XF_DUALTEX_BASEROW_SHIFT 0 + + /* get value */ #define GX_XF_GET_DUALTEX_BASEROW(reg) GX_BITGET((reg), 26, 6) + /* set value */ #define GX_XF_SET_DUALTEX_BASEROW(reg, x) ((reg) = GX_BITSET((reg), 26, 6, x)) + +// NORMALIZE [23:23] (1) - Normalize texcoord before sending transform + /* start bit */ #define GX_XF_DUALTEX_NORMALIZE_B 23 + /* end bit */ #define GX_XF_DUALTEX_NORMALIZE_E 23 + /* bit size */ #define GX_XF_DUALTEX_NORMALIZE_SZ 1 + + /* raw mask */ #define GX_XF_DUALTEX_NORMALIZE_MASK (((1 << 1) - 1) << 31 - 23) + /* local mask */ #define GX_XF_DUALTEX_NORMALIZE_LMASK ((1 << 1) - 1) + /* bit shift */ #define GX_XF_DUALTEX_NORMALIZE_SHIFT 8 + + /* get value */ #define GX_XF_GET_DUALTEX_NORMALIZE(reg) GX_BITGET((reg), 23, 1) + /* set value */ #define GX_XF_SET_DUALTEX_NORMALIZE(reg, x) ((reg) = GX_BITSET((reg), 23, 1, x)) + + + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInit.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInit.h new file mode 100644 index 0000000000..743a35bb85 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInit.h @@ -0,0 +1,89 @@ +#ifndef RVL_SDK_GX_INIT_H +#define RVL_SDK_GX_INIT_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GXData { + union { + UNKWORD WORD_0x0; + struct { + u16 SHORT_0x0; // at 0x0 + u16 lastWriteWasXF; // at 0x2 + }; + }; // at 0x0 + u16 SHORT_0x4; + u16 vlim; // at 0x6 + u32 cpCtrlReg; // at 0x8 + u32 cpStatReg; // at 0xC + char UNK_0x10[0x4]; + u32 vcdLoReg; // at 0x14 + u32 vcdHiReg; // at 0x18 + u32 vatA[GX_MAX_VTXFMT]; // at 0x1C + u32 vatB[GX_MAX_VTXFMT]; // at 0x3C + u32 vatC[GX_MAX_VTXFMT]; // at 0x5C + u32 linePtWidth; // at 0x7C + u32 matrixIndex0; // at 0x80 + u32 matrixIndex1; // at 0x84 + char UNK_0x88[0xA8 - 0x88]; + GXColor ambColors[2]; // at 0xA8 + GXColor matColors[2]; // at 0xB0 + u32 colorControl[4]; // at 0xB8 + u32 texRegs[GX_MAX_TEXCOORD]; // at 0xC8 + u32 dualTexRegs[GX_MAX_TEXCOORD]; // at 0xE8 + u32 txcRegs[GX_MAX_TEXCOORD]; // at 0x108 + char UNK_0x128[0x148 - 0x128]; + u32 scissorTL; // at 0x148 + u32 scissorBR; // at 0x14C + char UNK_0x150[0x170 - 0x150]; + u32 ras1_iref; // at 0x170 + u32 ind_imask; // at 0x174 + u32 ras1_ss0; // at 0x178 + u32 ras1_ss1; // at 0x17C + char UNK_0x180[0x220 - 0x180]; + u32 blendMode; // at 0x220 + u32 dstAlpha; // at 0x224 + u32 zMode; // at 0x228 + u32 zControl; // at 0x22C + char UNK_0x230[0x254 - 0x230]; + u32 genMode; // at 0x254 + char UNK_0x258[0x520 - 0x258]; + GXAttrType normalType; // at 0x520 + GXBool normal; // at 0x524 + GXBool binormal; // at 0x525 + GXProjectionType projType; // at 0x528 + f32 proj[6]; // at 0x52C + union { + struct { + f32 vpOx; // at 0x544 + f32 vpOy; // at 0x548 + f32 vpSx; // at 0x54C + f32 vpSy; // at 0x550 + f32 vpNear; // at 0x554 + f32 vpFar; // at 0x558 + }; + f32 view[6]; + }; // at 0x544 + f32 offsetZ; // at 0x55C + f32 scaleZ; // at 0x560 + char UNK_0x564[0x5F8 - 0x564]; + GXBool dlistActive; // at 0x5F8 + GXBool dlistSave; // at 0x5F9 + u8 BYTE_0x5FA; + u8 vatDirtyFlags; // at 0x5FB + u32 gxDirtyFlags; // at 0x5FC +} GXData; + +extern GXData* const __GXData; + +// I hate typing this name out +#define gxdt __GXData + +GXFifoObj* GXInit(void*, u32); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInternal.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInternal.h new file mode 100644 index 0000000000..6ec11a2499 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXInternal.h @@ -0,0 +1,79 @@ +#ifndef RVL_SDK_GX_INTERNAL_H +#define RVL_SDK_GX_INTERNAL_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * GX internal structures. + * + * Wouldn't be necessary if the public ones didn't include padding; but they do, + * so there has to be different structure definitions. + * + * These internal structures are implemented like the RFL ones since we don't + * have DWARF info for most GX structures. + */ + +/** + * Declare a public structure from the corresponding internal structure. + * (Implementation size is included to require that such a structure already + * exists.) + */ +#define GX_PUBLIC_STRUCT_DECL(name, size) \ + typedef struct _##name { \ + u32 dummy[((size) - sizeof(name##Impl) + sizeof(name##Impl)) / \ + sizeof(u32)]; \ + } name; + +typedef struct _GXFifoObjImpl { + void* base; // at 0x0 + void* end; // at 0x4 + u32 size; // at 0x8 + void* hiWatermark; // at 0xC + void* loWatermark; // at 0x10 + void* readPtr; // at 0x14 + void* writePtr; // at 0x18 + u32 count; // at 0x1C + u8 wrap; // at 0x20 +} GXFifoObjImpl; + +typedef struct _GXLightObjImpl { + char UNK_0x0[0xC]; + GXColor color; // at 0xC + f32 aa; // at 0x10 + f32 ab; // at 0x14 + f32 ac; // at 0x18 + f32 ka; // at 0x1C + f32 kb; // at 0x20 + f32 kc; // at 0x24 + f32 posX; // at 0x28 + f32 posY; // at 0x2C + f32 posZ; // at 0x30 + f32 dirX; // at 0x34 + f32 dirY; // at 0x38 + f32 dirZ; // at 0x3C +} GXLightObjImpl; + +typedef struct _GXTexObjImpl { + u8 todo; +} GXTexObjImpl; + +typedef struct _GXTlutObjImpl { + u8 todo; +} GXTlutObjImpl; + +typedef struct _GXTexRegionImpl { + u8 todo; +} GXTexRegionImpl; + +typedef struct _GXTlutRegionImpl { + u8 todo; +} GXTlutRegionImpl; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXLight.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXLight.h new file mode 100644 index 0000000000..4b42953989 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXLight.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_GX_LIGHT_H +#define RVL_SDK_GX_LIGHT_H +#include + +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +GX_PUBLIC_STRUCT_DECL(GXLightObj, 64); + +void GXInitLightAttn(GXLightObj* light, f32 aa, f32 ab, f32 ac, f32 ka, f32 kb, + f32 kc); +void GXInitLightAttnA(GXLightObj* light, f32 a, f32 b, f32 c); +void GXInitLightAttnK(GXLightObj* light, f32 a, f32 b, f32 c); +void GXInitLightSpot(GXLightObj* light, f32 angle, GXSpotFn fn); +void GXInitLightDistAttn(GXLightObj* light, f32 distance, f32 brightness, + GXDistAttnFn fn); +void GXInitLightPos(GXLightObj* light, f32 x, f32 y, f32 z); +void GXGetLightPos(const GXLightObj* light, f32* x, f32* y, f32* z); +void GXInitLightDir(GXLightObj* light, f32 x, f32 y, f32 z); +void GXGetLightDir(const GXLightObj* light, f32* x, f32* y, f32* z); +void GXInitSpecularDir(GXLightObj* light, f32 x, f32 y, f32 z); +void GXInitLightColor(GXLightObj* light, GXColor color); +void GXLoadLightObjImm(const GXLightObj* light, GXLightID id); +void GXLoadLightObjIndx(u16 index, GXLightID id); +void GXSetChanAmbColor(GXChannelID chan, GXColor color); +void GXSetChanMatColor(GXChannelID chan, GXColor color); +void GXSetNumChans(u8 num); +void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc ambSrc, + GXColorSrc matSrc, GXLightID lightMask, GXDiffuseFn diffFn, + GXAttnFn attnFn); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXMisc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXMisc.h new file mode 100644 index 0000000000..4c4dc2e396 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXMisc.h @@ -0,0 +1,27 @@ +#ifndef RVL_SDK_GX_MISC_H +#define RVL_SDK_GX_MISC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*GXDrawDoneCallback)(void); + +void GXSetMisc(UNKWORD token, UNKWORD val); +void GXFlush(void); +void GXResetWriteGatherPipe(void); + +void GXAbortFrame(void); + +void GXDrawDone(void); +void GXPixModeSync(void); + +u16 GXReadDrawSync(void); + +void GXSetDrawDone(void); +GXDrawDoneCallback GXSetDrawDoneCallback(GXDrawDoneCallback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXPixel.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXPixel.h new file mode 100644 index 0000000000..9f17efb5a6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXPixel.h @@ -0,0 +1,37 @@ +#ifndef RVL_SDK_GX_PIXEL_H +#define RVL_SDK_GX_PIXEL_H +#include + +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _GXFogAdjTable { + u16 r[10]; // at 0x0 +} GXFogAdjTable; + +#define GX_FOG_ADJ_TABLE_SZ 10 + +void GXSetFog(GXFogType type, GXColor color, f32 start, f32 end, f32 near, + f32 far); +void GXInitFogAdjTable(GXFogAdjTable* table, u16 width, const Mtx44 proj); +void GXSetFogRangeAdj(GXBool enable, u16 center, const GXFogAdjTable* table); +void GXSetBlendMode(GXBlendMode mode, GXBlendFactor src, GXBlendFactor dst, + GXLogicOp op); +void GXSetColorUpdate(GXBool enable); +void GXSetAlphaUpdate(GXBool enable); +void GXSetZMode(GXBool enableTest, GXCompare func, GXBool enableUpdate); +void GXSetZCompLoc(GXBool beforeTex); +void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt); +void GXSetDither(GXBool enable); +void GXSetDstAlpha(GXBool enable, u8 alpha); +void GXSetFieldMask(GXBool enableEven, GXBool enableOdd); +void GXSetFieldMode(GXBool texLOD, GXBool adjustAR); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTev.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTev.h new file mode 100644 index 0000000000..bf3300d406 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTev.h @@ -0,0 +1,36 @@ +#ifndef RVL_SDK_GX_TEV_H +#define RVL_SDK_GX_TEV_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void GXSetTevOp(GXTevStageID, GXTevMode); +void GXSetTevColorIn(GXTevStageID, GXTevColorArg, GXTevColorArg, GXTevColorArg, + GXTevColorArg); +void GXSetTevAlphaIn(GXTevStageID, GXTevAlphaArg, GXTevAlphaArg, GXTevAlphaArg, + GXTevAlphaArg); +void GXSetTevColorOp(GXTevStageID, GXTevOp, GXTevBias, GXTevScale, GXBool, + GXTevRegID); +void GXSetTevAlphaOp(GXTevStageID, GXTevOp, GXTevBias, GXTevScale, GXBool, + GXTevRegID); + +void GXSetTevColor(GXTevRegID, GXColor); + +void GXSetTevKColor(GXTevKColorID, GXColor); +void GXSetTevKColorSel(GXTevStageID, GXTevKColorSel); +void GXSetTevKAlphaSel(GXTevStageID, GXTevKAlphaSel); +void GXSetTevSwapMode(GXTevStageID, GXTevSwapSel, GXTevSwapSel); +void GXSetTevSwapModeTable(GXTevSwapSel, GXTevColorChan, GXTevColorChan, + GXTevColorChan, GXTevColorChan); + +void GXSetAlphaCompare(GXCompare, u8, GXAlphaOp, GXCompare, u8); +void GXSetZTexture(GXZTexOp, GXTexFmt, u32); +void GXSetTevOrder(GXTevStageID, GXTexCoordID, GXTexMapID, GXChannelID); +void GXSetNumTevStages(u8); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTexture.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTexture.h new file mode 100644 index 0000000000..cd42600881 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTexture.h @@ -0,0 +1,73 @@ +#ifndef RVL_SDK_GX_TEXTURE_H +#define RVL_SDK_GX_TEXTURE_H +#include + +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +GX_PUBLIC_STRUCT_DECL(GXTexObj, 32); +GX_PUBLIC_STRUCT_DECL(GXTlutObj, 0x0C); + +GX_PUBLIC_STRUCT_DECL(GXTexRegion, 16); +GX_PUBLIC_STRUCT_DECL(GXTlutRegion, 16); + +typedef GXTexRegion* (*GXTexRegionCallback)(const GXTexObj* pObj, + GXTexMapID map); + +typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 id); + +void __GXSetSUTexRegs(void); + +void GXInitTexObj(GXTexObj* obj, void* image, u16 w, u16 h, GXTexFmt fmt, + GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, GXBool mipmap); +void GXInitTexObjCI(GXTexObj*, void*, u16, u16, GXTexFmt, GXTexWrapMode, + GXTexWrapMode, GXBool, u32); +void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, + f32 min_lod, f32 max_lod, f32 lod_bias, GXBool bias_clamp, + GXBool do_edge_lod, GXAnisotropy max_aniso); + +void GXGetTexObjLODAll(GXTexObj* obj, GXTexFilter* min_filt, + GXTexFilter* mag_filt, f32* minLod, f32* maxLod, + f32* lodBias, GXBool* biasClampEnable, + GXBool* edgeLodEnable, GXAnisotropy* anisotropy); + +GXTexWrapMode GXGetTexObjWrapS(GXTexObj* obj); +GXTexWrapMode GXGetTexObjWrapT(GXTexObj* obj); + +u16 GXGetTexObjWidth(const GXTexObj* obj); +u16 GXGetTexObjHeight(const GXTexObj* obj); +GXTexFmt GXGetTexObjFmt(const GXTexObj* obj); +GXBool GXGetTexObjMipMap(const GXTexObj* obj); + +void GXLoadTexObj(const GXTexObj*, GXTexMapID); + +u32 GXGetTexObjTlut(GXTexObj*); + +void GXInitTlutObj(GXTlutObj*, void*, GXTlutFmt, u16); + +void GXLoadTlut(GXTlutObj*, GXTlut); + +void GXInvalidateTexAll(void); + +void GXInitTexCacheRegion(GXTexRegion* pRegion, GXBool r4, u32 addrTMemEven, + u32 sizeTMemEven, u32 addrTMemOdd, u32 sizeTMemOdd); + +void GXInitTlutRegion(GXTlutRegion* pRegion, u32 addrTMem, u32 sizeTMem); + +GXTexRegionCallback GXSetTexRegionCallback(GXTexRegionCallback callback); +GXTlutRegionCallback GXSetTlutRegionCallback(GXTlutRegionCallback callback); + +u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, + u8 max_lod); + +// TODO +UNKTYPE GXSetTexCoordScaleManually(UNKWORD, UNKWORD, UNKWORD, UNKWORD); +UNKTYPE GXSetTexCoordCylWrap(UNKWORD, UNKWORD, UNKWORD); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTransform.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTransform.h new file mode 100644 index 0000000000..a121fe39a0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTransform.h @@ -0,0 +1,48 @@ +#ifndef RVL_SDK_GX_TRANSFORM_H +#define RVL_SDK_GX_TRANSFORM_H +#include + +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + GX_FIELD_EVEN, + GX_FIELD_ODD, +} GXInterlaceField; + +void GXSetProjection(const Mtx44 proj, GXProjectionType type); +void GXSetProjectionv(const f32 proj[7]); +void GXGetProjectionv(f32 proj[7]); +void GXLoadPosMtxImm(const Mtx mtx, u32 id); +void GXLoadPosMtxIndx(u16 index, u32 id); +void GXLoadNrmMtxImm(const Mtx mtx, u32 id); +void GXLoadNrmMtxIndx3x3(u16 index, u32 id); +void GXSetCurrentMtx(u32 id); +void GXLoadTexMtxImm(const Mtx mtx, u32 id, GXMtxType type); +void GXSetViewportJitter(f32 ox, f32 oy, f32 sx, f32 sy, f32 near, f32 far, + u32 nextField); +void GXSetViewport(f32 ox, f32 oy, f32 sx, f32 sy, f32 near, f32 far); +void GXGetViewportv(f32 view[6]); +void GXSetZScaleOffset(f32 scale, f32 offset); +void GXSetScissor(u32 x, u32 y, u32 w, u32 h); +void GXGetScissor(u32* x, u32* y, u32* w, u32* h); +void GXSetScissorBoxOffset(u32 ox, u32 oy); +void GXSetClipMode(GXClipMode mode); + +void __GXSetProjection(void); +void __GXSetViewport(void); +void __GXSetMatrixIndex(GXAttr index); + +inline void GXSetViewportv(const f32* vp) +{ + GXSetViewport(vp[0], vp[1], vp[2], vp[3], vp[4], vp[5]); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTypes.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTypes.h new file mode 100644 index 0000000000..3ced6f2cfb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXTypes.h @@ -0,0 +1,912 @@ +#ifndef RVL_SDK_GX_TYPES_H +#define RVL_SDK_GX_TYPES_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Pack value into bitfield. + * Value is shifted to the specified bit position. + * (Bit indices are LSB) + */ +#define GX_BITSET(field, pos, size, value) \ + __rlwimi((field), (value), 31 - (pos) - (size) + 1, (pos), \ + (pos) + (size) - 1) + +/** + * Compose value from bitfield. + * Value is shifted after masking. + * (Bit indices are LSB) + */ +#define GX_BITGET(field, pos, size) \ + ((field) >> (31 - (pos) - (size) + 1) & ((1 << (size)) - 1)) + +/** + * Pack value into bitfield. + * Value is not shifted, only masked. + * (Bit indices are LSB) + */ +#define GX_BITSET_TRUNC(field, pos, size, value) \ + __rlwimi((field), (value), 0, (pos), (pos) + (size) - 1) + +/** + * Compose value from bitfield. + * Value is not shifted, only masked. + * (Bit indices are LSB) + */ +#define GX_BITGET_TRUNC(field, pos, size) \ + ((field) & (((1 << (size)) - 1) << (32 - (pos) - (size)))) + +/** + * Common types used throughout many GX files. + * To avoid circular depencies, common structures and all enums have been moved + * here. Everything is organized in alphabetical order. + */ + +// Differentiate between 8-byte and boolean values +// Real name! (from patent) +typedef unsigned char GXBool; + +/** + * Common structs + */ + +typedef struct _GXColor { + u8 r, g, b, a; +} GXColor; + +typedef struct _GXColorS10 { + s16 r, g, b, a; +} GXColorS10; + +/** + * Common enums + */ + +typedef enum _GXAlphaOp { + GX_AOP_AND, + GX_AOP_OR, + GX_AOP_XOR, + GX_AOP_XNOR, + + GX_MAX_ALPHAOP +} GXAlphaOp; + +typedef enum _GXAnisotropy { + GX_ANISO_1, + GX_ANISO_2, + GX_ANISO_4, + + GX_MAX_ANISOTROPY +} GXAnisotropy; + +typedef enum _GXAttnFn { + GX_AF_SPEC, + GX_AF_SPOT, + GX_AF_NONE, +} GXAttnFn; + +typedef enum _GXAttr { + GX_VA_PNMTXIDX, // Position/Normal matrix index + GX_VA_TEX0MTXIDX, // GX_TEXCOORD0 matrix index + GX_VA_TEX1MTXIDX, // GX_TEXCOORD1 matrix index + GX_VA_TEX2MTXIDX, // GX_TEXCOORD2 matrix index + GX_VA_TEX3MTXIDX, // GX_TEXCOORD3 matrix index + GX_VA_TEX4MTXIDX, // GX_TEXCOORD4 matrix index + GX_VA_TEX5MTXIDX, // GX_TEXCOORD5 matrix index + GX_VA_TEX6MTXIDX, // GX_TEXCOORD6 matrix index + GX_VA_TEX7MTXIDX, // GX_TEXCOORD7 matrix index + + GX_VA_POS, // Position + GX_VA_NRM, // Normal + + GX_VA_CLR0, // Color 0 + GX_VA_CLR1, // Color 1 + + GX_VA_TEX0, // Texture Coordinate 0 + GX_VA_TEX1, // Texture Coordinate 1 + GX_VA_TEX2, // Texture Coordinate 2 + GX_VA_TEX3, // Texture Coordinate 3 + GX_VA_TEX4, // Texture Coordinate 4 + GX_VA_TEX5, // Texture Coordinate 5 + GX_VA_TEX6, // Texture Coordinate 6 + GX_VA_TEX7, // Texture Coordinate 7 + + GX_POS_MTX_ARRAY, + GX_NRM_MTX_ARRAY, + GX_TEX_MTX_ARRAY, + GX_LIGHT_ARRAY, + + GX_VA_NBT, // All three normal elements (normal/binormal/tangent) + + GX_VA_MAX_ATTR, + GX_VA_NULL = 255 +} GXAttr; + +typedef enum _GXAttrType { + GX_NONE, // No data sent + GX_DIRECT, // Data sent directly to FIFO + GX_INDEX8, // 8-bit index sent to FIFO + GX_INDEX16 // 16-bit index sent to FIFO +} GXAttrType; + +typedef enum _GXBlendFactor { + GX_BL_ZERO, + GX_BL_ONE, + GX_BL_SRCCLR, + GX_BL_INVSRCCLR, + GX_BL_SRCALPHA, + GX_BL_INVSRCALPHA, + GX_BL_DSTALPHA, + GX_BL_INVDSTALPHA, + + GX_BL_DSTCLR = GX_BL_SRCCLR, + GX_BL_INVDSTCLR = GX_BL_INVSRCCLR +} GXBlendFactor; + +typedef enum _GXBlendMode { + GX_BM_NONE, + GX_BM_BLEND, + GX_BM_LOGIC, + GX_BM_SUBTRACT, + + GX_MAX_BLENDMODE +} GXBlendMode; + +typedef enum _GXChannelID { + GX_COLOR0, + GX_COLOR1, + GX_ALPHA0, + GX_ALPHA1, + GX_COLOR0A0, + GX_COLOR1A1, + GX_COLOR_ZERO, + GX_ALPHA_BUMP, + GX_ALPHA_BUMPN, + + GX_COLOR_NULL = 255 +} GXChannelID; + +typedef enum _GXCITexFmt { + GX_TF_C4 = 8, + GX_TF_C8, + GX_TF_C14X2, +} GXCITexFmt; + +typedef enum _GXClearZ { + GX_CLEAR_Z_MIN = 0, + GX_CLEAR_Z_MAX = (1 << 24) - 1, +} GXClearZ; + +typedef enum _GXClipMode { + // "ClipDisable" in XF mem, so 0 = enable + GX_CLIP_ENABLE, + GX_CLIP_DISABLE, +} GXClipMode; + +typedef enum _GXColorSrc { GX_SRC_REG, GX_SRC_VTX } GXColorSrc; + +typedef enum _GXCompare { + GX_NEVER, + GX_LESS, + GX_EQUAL, + GX_LEQUAL, + GX_GREATER, + GX_NEQUAL, + GX_GEQUAL, + GX_ALWAYS +} GXCompare; + +typedef enum _GXCompCnt { + GX_POS_XY = 0, + GX_POS_XYZ, + + GX_NRM_XYZ = 0, + GX_NRM_NBT, + GX_NRM_NBT3, + + GX_CLR_RGB = 0, + GX_CLR_RGBA, + + GX_TEX_S = 0, + GX_TEX_ST +} GXCompCnt; + +typedef enum _GXCompType { + GX_U8, + GX_S8, + GX_U16, + GX_S16, + GX_F32, + + GX_RGB565 = 0, + GX_RGB8, + GX_RGBX8, + GX_RGBA4, + GX_RGBA6, + GX_RGBA8 +} GXCompType; + +typedef enum _GXCopyClamp { + GX_CLAMP_NONE, + GX_CLAMP_TOP, + GX_CLAMP_BOTTOM, + GX_CLAMP_ALL, +} GXCopyClamp; + +typedef enum _GXCullMode { + GX_CULL_NONE, + GX_CULL_FRONT, + GX_CULL_BACK, + GX_CULL_ALL +} GXCullMode; + +typedef enum _GXDiffuseFn { GX_DF_NONE, GX_DF_SIGN, GX_DF_CLAMP } GXDiffuseFn; + +typedef enum _GXDirtyFlag { + GX_DIRTY_SU_TEX = (1 << 0), + GX_DIRTY_BP_MASK = (1 << 1), + GX_DIRTY_GEN_MODE = (1 << 2), + GX_DIRTY_VCD = (1 << 3), + GX_DIRTY_VAT = (1 << 4), + // . . . + GX_DIRTY_AMB_COLOR0 = (1 << 8), + GX_DIRTY_AMB_COLOR1 = (1 << 9), + GX_DIRTY_MAT_COLOR0 = (1 << 10), + GX_DIRTY_MAT_COLOR1 = (1 << 11), + GX_DIRTY_CHAN_COLOR0 = (1 << 12), + GX_DIRTY_CHAN_COLOR1 = (1 << 13), + GX_DIRTY_CHAN_ALPHA0 = (1 << 14), + GX_DIRTY_CHAN_ALPHA1 = (1 << 15), + GX_DIRTY_TEX0 = (1 << 16), + GX_DIRTY_TEX1 = (1 << 17), + GX_DIRTY_TEX2 = (1 << 18), + GX_DIRTY_TEX3 = (1 << 19), + GX_DIRTY_TEX4 = (1 << 20), + GX_DIRTY_TEX5 = (1 << 21), + GX_DIRTY_TEX6 = (1 << 22), + GX_DIRTY_TEX7 = (1 << 23), + GX_DIRTY_NUM_COLORS = (1 << 24), + GX_DIRTY_NUM_TEX = (1 << 25), + GX_DIRTY_MTX_IDX = (1 << 26), + GX_DIRTY_PROJECTION = (1 << 27), + GX_DIRTY_VIEWPORT = (1 << 28), + + GX_AMB_MAT_MASK = GX_DIRTY_AMB_COLOR0 | GX_DIRTY_AMB_COLOR1 | + GX_DIRTY_MAT_COLOR0 | GX_DIRTY_MAT_COLOR1, + + GX_LIGHT_CHAN_MASK = GX_DIRTY_CHAN_COLOR0 | GX_DIRTY_CHAN_COLOR1 | + GX_DIRTY_CHAN_ALPHA0 | GX_DIRTY_CHAN_ALPHA1 | + GX_DIRTY_NUM_COLORS, + + GX_TEX_GEN_MASK = 0x2FF0000, +} GXDirtyFlag; + +typedef enum _GXDistAttnFn { + GX_DA_OFF, + GX_DA_GENTLE, + GX_DA_MEDIUM, + GX_DA_STEEP +} GXDistAttnFn; + +typedef enum _GXFogType { + GX_FOG_NONE, + + GX_FOG_PERSP_LIN = 2, + GX_FOG_PERSP_EXP = 4, + GX_FOG_PERSP_EXP2 = 5, + GX_FOG_PERSP_REVEXP = 6, + GX_FOG_PERSP_REVEXP2 = 7, + + // Fourth bit is set to mark orthographic + GX_FOG_ORTHO_LIN = 1 << 3 | GX_FOG_PERSP_LIN, + GX_FOG_ORTHO_EXP = 1 << 3 | GX_FOG_PERSP_EXP, + GX_FOG_ORTHO_EXP2 = 1 << 3 | GX_FOG_PERSP_EXP2, + GX_FOG_ORTHO_REVEXP = 1 << 3 | GX_FOG_PERSP_REVEXP, + GX_FOG_ORTHO_REVEXP2 = 1 << 3 | GX_FOG_PERSP_REVEXP2 +} GXFogType; + +// Access components of the fog type +#define GX_FOG_GET_PROJ(x) ((x) >> 3 & 1) +#define GX_FOG_GET_FSEL(x) ((x) & 7) + +typedef enum _GXIndTexAlphaSel { + GX_ITBA_OFF, + GX_ITBA_S, + GX_ITBA_T, + GX_ITBA_U, + + GX_MAX_ITBALPHA +} GXIndTexAlphaSel; + +typedef enum _GXIndTexBiasSel { + GX_ITB_NONE, + GX_ITB_S, + GX_ITB_T, + GX_ITB_ST, + GX_ITB_U, + GX_ITB_SU, + GX_ITB_TU, + GX_ITB_STU, + + GX_MAX_ITBIAS +} GXIndTexBiasSel; + +typedef enum _GXIndTexFormat { + GX_ITF_8, + GX_ITF_5, + GX_ITF_4, + GX_ITF_3, + + GX_MAX_ITFORMAT +} GXIndTexFormat; + +typedef enum _GXIndTexMtxID { + GX_ITM_OFF, + GX_ITM_0, + GX_ITM_1, + GX_ITM_2, + + GX_ITM_S0 = 5, + GX_ITM_S1, + GX_ITM_S2, + + GX_ITM_T0 = 9, + GX_ITM_T1, + GX_ITM_T2, +} GXIndTexMtxID; + +typedef enum _GXIndTexScale { + GX_ITS_1, + GX_ITS_2, + GX_ITS_4, + GX_ITS_8, + GX_ITS_16, + GX_ITS_32, + GX_ITS_64, + GX_ITS_128, + GX_ITS_256, + + GX_MAX_ITSCALE +} GXIndTexScale; + +typedef enum _GXIndTexStageID { + GX_INDTEXSTAGE0, + GX_INDTEXSTAGE1, + GX_INDTEXSTAGE2, + GX_INDTEXSTAGE3, + + GX_MAX_INDTEXSTAGE +} GXIndTexStageID; + +typedef enum _GXIndTexWrap { + GX_ITW_OFF, + GX_ITW_256, + GX_ITW_128, + GX_ITW_64, + GX_ITW_32, + GX_ITW_16, + GX_ITW_0, + + GX_MAX_ITWRAP, +} GXIndTexWrap; + +typedef enum _GXLightID { + GX_LIGHT0 = (1 << 0), + GX_LIGHT1 = (1 << 1), + GX_LIGHT2 = (1 << 2), + GX_LIGHT3 = (1 << 3), + GX_LIGHT4 = (1 << 4), + GX_LIGHT5 = (1 << 5), + GX_LIGHT6 = (1 << 6), + GX_LIGHT7 = (1 << 7), + + GX_MAX_LIGHT = (1 << 8), + GX_LIGHT_NULL = 0 +} GXLightID; + +typedef enum _GXLogicOp { + GX_LO_CLEAR, + GX_LO_AND, + GX_LO_REVAND, + GX_LO_COPY, + GX_LO_INVAND, + GX_LO_NOOP, + GX_LO_XOR, + GX_LO_OR, + GX_LO_NOR, + GX_LO_EQUIV, + GX_LO_INV, + GX_LO_REVOR, + GX_LO_INVCOPY, + GX_LO_INVOR, + GX_LO_NAND, + GX_LO_SET +} GXLogicOp; + +typedef enum _GXMtxType { + GX_MTX_3x4, + GX_MTX_2x4, +} GXMtxType; + +typedef enum _GXPixelFmt { + GX_PF_RGB8_Z24, // from Dolphin + GX_PF_RGBA6_Z24, // from EGG + GX_PF_RGBA565_Z16, // from Dolphin + GX_PF_Z24, // from Dolphin + GX_PF_Y8, // from Dolphin + GX_PF_U8, // from Dolphin + GX_PF_V8, // from Dolphin + GX_PF_YUV420, // from Dolphin + + GX_MAX_PIXELFMT +} GXPixelFmt; + +/** + * Matrix column index into XF memory. + * (Multiply by row dimension to get XF mem offset) + */ +typedef enum _GXPosNrmMtx { + GX_PNMTX0 = 0, + GX_PNMTX1 = 3, + GX_PNMTX2 = 6, + GX_PNMTX3 = 9, + GX_PNMTX4 = 12, + GX_PNMTX5 = 15, + GX_PNMTX6 = 18, + GX_PNMTX7 = 21, + GX_PNMTX8 = 24, + GX_PNMTX9 = 27 +} GXPosNrmMtx; + +typedef enum _GXPrimitive { + GX_POINTS = 0xB8, + GX_LINES = 0xA8, + GX_LINESTRIP = 0xB0, + GX_TRIANGLES = 0x90, + GX_TRIANGLESTRIP = 0x98, + GX_TRIANGLEFAN = 0xA0, + GX_QUADS = 0x80, +} GXPrimitive; + +typedef enum _GXProjectionType { + GX_PERSPECTIVE, + GX_ORTHOGRAPHIC +} GXProjectionType; + +typedef enum _GXSpotFn { + GX_SP_OFF, + GX_SP_FLAT, + GX_SP_COS, + GX_SP_COS2, + GX_SP_SHARP, + GX_SP_RING1, + GX_SP_RING2 +} GXSpotFn; + +typedef enum _GXTevAlphaArg { + GX_CA_APREV, + GX_CA_A0, + GX_CA_A1, + GX_CA_A2, + GX_CA_TEXA, + GX_CA_RASA, + GX_CA_KONST, + GX_CA_ZERO, + GX_CA_ONE +} GXTevAlphaArg; + +typedef enum _GXTevBias { + GX_TB_ZERO, + GX_TB_ADDHALF, + GX_TB_SUBHALF, + + GX_MAX_TEVBIAS +} GXTevBias; + +typedef enum _GXTevColorArg { + GX_CC_CPREV, + GX_CC_APREV, + GX_CC_C0, + GX_CC_A0, + GX_CC_C1, + GX_CC_A1, + GX_CC_C2, + GX_CC_A2, + GX_CC_TEXC, + GX_CC_TEXA, + GX_CC_RASC, + GX_CC_RASA, + GX_CC_ONE, + GX_CC_HALF, + GX_CC_KONST, + GX_CC_ZERO, + GX_CC_TEXRRR, + GX_CC_TEXGGG, + GX_CC_TEXBBB, + + GX_CC_QUARTER = GX_CC_KONST +} GXTevColorArg; + +typedef enum _GXTevColorChan { + GX_CH_RED, + GX_CH_GREEN, + GX_CH_BLUE, + GX_CH_ALPHA +} GXTevColorChan; + +typedef enum _GXTevOp { + GX_TEV_ADD, + GX_TEV_SUB, + + GX_TEV_COMP_R8_GT = 8, + GX_TEV_COMP_R8_EQ, + GX_TEV_COMP_GR16_GT, + GX_TEV_COMP_GR16_EQ, + GX_TEV_COMP_BGR24_GT, + GX_TEV_COMP_BGR24_EQ, + GX_TEV_COMP_RGB8_GT, + GX_TEV_COMP_RGB8_EQ, + + GX_TEV_COMP_A8_GT = GX_TEV_COMP_RGB8_GT, + GX_TEV_COMP_A8_EQ = GX_TEV_COMP_RGB8_EQ +} GXTevOp; + +typedef enum _GXTevRegID { + GX_TEVPREV, + GX_TEVREG0, + GX_TEVREG1, + GX_TEVREG2, + + GX_MAX_TEVREG +} GXTevRegID; + +typedef enum _GXTevScale { + GX_CS_SCALE_1, + GX_CS_SCALE_2, + GX_CS_SCALE_4, + GX_CS_DIVIDE_2, + + GX_MAX_TEVSCALE +} GXTevScale; + +typedef enum _GXTevStageID { + GX_TEVSTAGE0, + GX_TEVSTAGE1, + GX_TEVSTAGE2, + GX_TEVSTAGE3, + GX_TEVSTAGE4, + GX_TEVSTAGE5, + GX_TEVSTAGE6, + GX_TEVSTAGE7, + GX_TEVSTAGE8, + GX_TEVSTAGE9, + GX_TEVSTAGE10, + GX_TEVSTAGE11, + GX_TEVSTAGE12, + GX_TEVSTAGE13, + GX_TEVSTAGE14, + GX_TEVSTAGE15, + + GX_MAX_TEVSTAGE +} GXTevStageID; + +typedef enum _GXTevSwapSel { + GX_TEV_SWAP0, + GX_TEV_SWAP1, + GX_TEV_SWAP2, + GX_TEV_SWAP3, + + GX_MAX_TEVSWAP +} GXTevSwapSel; + +typedef enum _GXTevKAlphaSel { + GX_TEV_KASEL_8_8, + GX_TEV_KASEL_7_8, + GX_TEV_KASEL_6_8, + GX_TEV_KASEL_5_8, + GX_TEV_KASEL_4_8, + GX_TEV_KASEL_3_8, + GX_TEV_KASEL_2_8, + GX_TEV_KASEL_1_8, + + GX_TEV_KASEL_1 = 0, + GX_TEV_KASEL_3_4 = 2, + GX_TEV_KASEL_1_2 = 4, + GX_TEV_KASEL_1_4 = 6, + + GX_TEV_KASEL_K0_R = 16, + GX_TEV_KASEL_K1_R, + GX_TEV_KASEL_K2_R, + GX_TEV_KASEL_K3_R, + GX_TEV_KASEL_K0_G, + GX_TEV_KASEL_K1_G, + GX_TEV_KASEL_K2_G, + GX_TEV_KASEL_K3_G, + GX_TEV_KASEL_K0_B, + GX_TEV_KASEL_K1_B, + GX_TEV_KASEL_K2_B, + GX_TEV_KASEL_K3_B, + GX_TEV_KASEL_K0_A, + GX_TEV_KASEL_K1_A, + GX_TEV_KASEL_K2_A, + GX_TEV_KASEL_K3_A +} GXTevKAlphaSel; + +typedef enum _GXTevKColorID { + GX_KCOLOR0, + GX_KCOLOR1, + GX_KCOLOR2, + GX_KCOLOR3, + + GX_MAX_KCOLOR +} GXTevKColorID; + +typedef enum _GXTevKColorSel { + GX_TEV_KCSEL_8_8, + GX_TEV_KCSEL_7_8, + GX_TEV_KCSEL_6_8, + GX_TEV_KCSEL_5_8, + GX_TEV_KCSEL_4_8, + GX_TEV_KCSEL_3_8, + GX_TEV_KCSEL_2_8, + GX_TEV_KCSEL_1_8, + + GX_TEV_KCSEL_1 = 0, + GX_TEV_KCSEL_3_4 = 2, + GX_TEV_KCSEL_1_2 = 4, + GX_TEV_KCSEL_1_4 = 6, + + GX_TEV_KCSEL_K0 = 12, + GX_TEV_KCSEL_K1, + GX_TEV_KCSEL_K2, + GX_TEV_KCSEL_K3, + GX_TEV_KCSEL_K0_R, + GX_TEV_KCSEL_K1_R, + GX_TEV_KCSEL_K2_R, + GX_TEV_KCSEL_K3_R, + GX_TEV_KCSEL_K0_G, + GX_TEV_KCSEL_K1_G, + GX_TEV_KCSEL_K2_G, + GX_TEV_KCSEL_K3_G, + GX_TEV_KCSEL_K0_B, + GX_TEV_KCSEL_K1_B, + GX_TEV_KCSEL_K2_B, + GX_TEV_KCSEL_K3_B, + GX_TEV_KCSEL_K0_A, + GX_TEV_KCSEL_K1_A, + GX_TEV_KCSEL_K2_A, + GX_TEV_KCSEL_K3_A +} GXTevKColorSel; + +typedef enum _GXTevMode { + GX_MODULATE, + GX_DECAL, + GX_REPLACE, + GX_PASSCLR, + GX_BLEND +} GXTevMode; + +typedef enum _GXTexCoordID { + GX_TEXCOORD0, + GX_TEXCOORD1, + GX_TEXCOORD2, + GX_TEXCOORD3, + GX_TEXCOORD4, + GX_TEXCOORD5, + GX_TEXCOORD6, + GX_TEXCOORD7, + + GX_MAX_TEXCOORD, + GX_TEXCOORD_NULL = 255 +} GXTexCoordID; + +typedef enum _GXTexFilter { + GX_NEAR, + GX_LINEAR, + GX_NEAR_MIP_NEAR, + GX_LIN_MIP_NEAR, + GX_NEAR_MIP_LIN, + GX_LIN_MIP_LIN, +} GXTexFilter; + +typedef enum _GXTexFmt { + GX_TF_I4, + GX_TF_I8, + GX_TF_IA4, + GX_TF_IA8, + GX_TF_RGB565, + GX_TF_RGB5A3, + GX_TF_RGBA8, + GX_TF_CMPR = 14, + + GX_CTF_R4 = 32, + GX_CTF_RA4 = 34, + GX_CTF_RA8 = 35, + GX_CTF_YUVA8 = 38, + GX_CTF_A8 = 39, + GX_CTF_R8 = 40, + GX_CTF_G8 = 41, + GX_CTF_B8 = 42, + GX_CTF_RG8 = 43, + GX_CTF_GB8 = 44, + + GX_TF_Z8 = 17, + GX_TF_Z16 = 19, + GX_TF_Z24X8 = 22, + + GX_CTF_Z4 = 48, + GX_CTF_Z8M = 57, + GX_CTF_Z8L = 58, + GX_CTF_Z16L = 60, + + GX_TF_A8 = GX_CTF_YUVA8 +} GXTexFmt; + +typedef enum _GXTexGenSrc { + GX_TG_POS, + GX_TG_NRM, + GX_TG_BINRM, + GX_TG_TANGENT, + GX_TG_TEX0, + GX_TG_TEX1, + GX_TG_TEX2, + GX_TG_TEX3, + GX_TG_TEX4, + GX_TG_TEX5, + GX_TG_TEX6, + GX_TG_TEX7, + GX_TG_TEXCOORD0, + GX_TG_TEXCOORD1, + GX_TG_TEXCOORD2, + GX_TG_TEXCOORD3, + GX_TG_TEXCOORD4, + GX_TG_TEXCOORD5, + GX_TG_TEXCOORD6, + GX_TG_COLOR0, + GX_TG_COLOR1, +} GXTexGenSrc; + +typedef enum _GXTexGenType { + GX_TG_MTX3x4, + GX_TG_MTX2x4, + GX_TG_BUMP0, + GX_TG_BUMP1, + GX_TG_BUMP2, + GX_TG_BUMP3, + GX_TG_BUMP4, + GX_TG_BUMP5, + GX_TG_BUMP6, + GX_TG_BUMP7, + GX_TG_SRTG +} GXTexGenType; + +typedef enum _GXTexMapID { + GX_TEXMAP0, + GX_TEXMAP1, + GX_TEXMAP2, + GX_TEXMAP3, + GX_TEXMAP4, + GX_TEXMAP5, + GX_TEXMAP6, + GX_TEXMAP7, + GX_MAX_TEXMAP, + + GX_TEXMAP_NULL = 255, + GX_TEX_DISABLE +} GXTexMapID; + +typedef enum _GXTexMtx { + // Any dimension (in standard XF matrix memory) + // Enum represents base row of matrix + GX_TEXMTX0 = 30, + GX_TEXMTX1 = 33, + GX_TEXMTX2 = 36, + GX_TEXMTX3 = 39, + GX_TEXMTX4 = 42, + GX_TEXMTX5 = 45, + GX_TEXMTX6 = 48, + GX_TEXMTX7 = 51, + GX_TEXMTX8 = 54, + GX_TEXMTX9 = 57, + GX_TEXMTX_IDENT = 60, + + // 3x4 matrices (in dual-tex XF matrix memory) + // Enum represents base row of matrix + GX_DUALMTX0 = 64, + GX_DUALMTX1 = 67, + GX_DUALMTX2 = 70, + GX_DUALMTX3 = 73, + GX_DUALMTX4 = 76, + GX_DUALMTX5 = 79, + GX_DUALMTX6 = 82, + GX_DUALMTX7 = 85, + GX_DUALMTX8 = 88, + GX_DUALMTX9 = 91, + GX_DUALMTX10 = 94, + GX_DUALMTX11 = 97, + GX_DUALMTX12 = 100, + GX_DUALMTX13 = 103, + GX_DUALMTX14 = 106, + GX_DUALMTX15 = 109, + GX_DUALMTX16 = 112, + GX_DUALMTX17 = 115, + GX_DUALMTX18 = 118, + GX_DUALMTX19 = 121, + GX_DUALMTX_IDENT = 125, +} GXTexMtx; + +typedef enum _GXTexWrapMode { + GX_CLAMP, + GX_REPEAT, + GX_MIRROR, + + GX_MAX_TEXWRAPMODE +} GXTexWrapMode; + +typedef enum _GXTlut { + GX_TLUT0, + GX_TLUT1, + GX_TLUT2, + GX_TLUT3, + GX_TLUT4, + GX_TLUT5, + GX_TLUT6, + GX_TLUT7, + GX_TLUT8, + GX_TLUT9, + GX_TLUT10, + GX_TLUT11, + GX_TLUT12, + GX_TLUT13, + GX_TLUT14, + GX_TLUT15, + + GX_BIGTLUT0, + GX_BIGTLUT1, + GX_BIGTLUT2, + GX_BIGTLUT3, +} GXTlut; + +typedef enum _GXTlutFmt { + GX_TL_IA8, + GX_TL_RGB565, + GX_TL_RGB5A3, + + GX_MAX_TLUTFMT +} GXTlutFmt; + +typedef enum _GXVtxFmt { + GX_VTXFMT0, + GX_VTXFMT1, + GX_VTXFMT2, + GX_VTXFMT3, + GX_VTXFMT4, + GX_VTXFMT5, + GX_VTXFMT6, + GX_VTXFMT7, + + GX_MAX_VTXFMT +} GXVtxFmt; + +typedef enum _GXZFmt16 { + GX_ZC_LINEAR, + GX_ZC_NEAR, + GX_ZC_MID, + GX_ZC_FAR, +} GXZFmt16; + +// From patent +typedef enum _GXZTexOp { + GX_ZT_DISABLE, + GX_ZT_ADD, + GZ_ZT_REPLACE, + + GX_MAX_ZTEXOP +} GXZTexOp; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXVert.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXVert.h new file mode 100644 index 0000000000..8706f64ff4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/GX/GXVert.h @@ -0,0 +1,195 @@ +#ifndef RVL_SDK_GX_VERT_H +#define RVL_SDK_GX_VERT_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +static inline void GXCmd1u8(u8 uc) { + WGPIPE.uc = uc; +} + +static inline void GXCmd1u16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXCmd1u32(u32 ul) { + WGPIPE.ui = ul; +} + +static inline void GXPosition3f32(f32 x, f32 y, f32 z) { + WGPIPE.f = x; + WGPIPE.f = y; + WGPIPE.f = z; +} + +static inline void GXPosition3u8(u8 x, u8 y, u8 z) { + WGPIPE.uc = x; + WGPIPE.uc = y; + WGPIPE.uc = z; +} + +static inline void GXPosition3s8(s8 x, s8 y, s8 z) { + WGPIPE.c = x; + WGPIPE.c = y; + WGPIPE.c = z; +} + +static inline void GXPosition3u16(u16 x, u16 y, u16 z) { + WGPIPE.us = x; + WGPIPE.us = y; + WGPIPE.us = z; +} + +static inline void GXPosition3s16(s16 x, s16 y, s16 z) { + WGPIPE.s = x; + WGPIPE.s = y; + WGPIPE.s = z; +} + +static inline void GXPosition2f32(f32 x, f32 y) { + WGPIPE.f = x; + WGPIPE.f = y; +} + +static inline void GXPosition2u8(u8 x, u8 y) { + WGPIPE.uc = x; + WGPIPE.uc = y; +} + +static inline void GXPosition2s8(s8 x, s8 y) { + WGPIPE.c = x; + WGPIPE.c = y; +} + +static inline void GXPosition2u16(u16 x, u16 y) { + WGPIPE.us = x; + WGPIPE.us = y; +} + +static inline void GXPosition2s16(s16 x, s16 y) { + WGPIPE.s = x; + WGPIPE.s = y; +} + +static inline void GXPosition1x16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXPosition1x8(u8 uc) { + WGPIPE.uc = uc; +} + +static inline void GXNormal3f32(f32 x, f32 y, f32 z) { + WGPIPE.f = x; + WGPIPE.f = y; + WGPIPE.f = z; +} + +static inline void GXNormal3s16(s16 x, s16 y, s16 z) { + WGPIPE.s = x; + WGPIPE.s = y; + WGPIPE.s = z; +} + +static inline void GXNormal3s8(s8 x, s8 y, s8 z) { + WGPIPE.c = x; + WGPIPE.c = y; + WGPIPE.c = z; +} + +static inline void GXNormal1x16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXNormal1x8(u8 uc) { + WGPIPE.uc = uc; +} + +static inline void GXColor4u8(u8 r, u8 g, u8 b, u8 a) { + WGPIPE.uc = r; + WGPIPE.uc = g; + WGPIPE.uc = b; + WGPIPE.uc = a; +} + +static inline void GXColor1u32(u32 color) { + WGPIPE.ui = color; +} + +static inline void GXColor3u8(u8 r, u8 g, u8 b) { + WGPIPE.uc = r; + WGPIPE.uc = g; + WGPIPE.uc = b; +} + +static inline void GXColor1u16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXColor1x16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXColor1x8(u8 uc) { + WGPIPE.uc = uc; +} + +static inline void GXTexCoord2f32(f32 x, f32 y) { + WGPIPE.f = x; + WGPIPE.f = y; +} + +static inline void GXTexCoord2s16(s16 x, s16 y) { + WGPIPE.s = x; + WGPIPE.s = y; +} + +static inline void GXTexCoord2u16(u16 x, u16 y) { + WGPIPE.us = x; + WGPIPE.us = y; +} + +static inline void GXTexCoord2s8(s8 x, s8 y) { + WGPIPE.c = x; + WGPIPE.c = y; +} + +static inline void GXTexCoord2u8(u8 x, u8 y) { + WGPIPE.uc = x; + WGPIPE.uc = y; +} + +static inline void GXTexCoord1f32(f32 f) { + WGPIPE.f = f; +} + +static inline void GXTexCoord1s16(s16 s) { + WGPIPE.s = s; +} + +static inline void GXTexCoord1u16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXTexCoord1s8(s8 c) { + WGPIPE.c = c; +} + +static inline void GXTexCoord1u8(u8 uc) { + WGPIPE.uc = uc; +} + +static inline void GXTexCoord1x16(u16 us) { + WGPIPE.us = us; +} + +static inline void GXTexCoord1x8(u8 uc) { + WGPIPE.uc = uc; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC.h new file mode 100644 index 0000000000..637360ba57 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC.h @@ -0,0 +1,19 @@ +/** + * References: WiiBrew, Dolphin Emulator + */ + +#ifndef RVL_SDK_PUBLIC_IPC_H +#define RVL_SDK_PUBLIC_IPC_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcMain.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcMain.h new file mode 100644 index 0000000000..352cad9dde --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcMain.h @@ -0,0 +1,32 @@ +#ifndef RVL_SDK_IPC_MAIN_H +#define RVL_SDK_IPC_MAIN_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +u32 IPC_HW_REGS[] +#ifdef __MWERKS__ +: 0xCD000000 +#endif +; + +inline u32 ACRReadReg(u32 reg) { + return IPC_HW_REGS[reg / 4]; +} + +inline void ACRWriteReg(u32 reg, u32 val) { + IPC_HW_REGS[reg / 4] = val; +} + +void IPCInit(void); +u32 IPCReadReg(s32 index); +void IPCWriteReg(s32 index, u32 value); +void* IPCGetBufferHi(void); +void* IPCGetBufferLo(void); +void IPCSetBufferLo(void* lo); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcProfile.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcProfile.h new file mode 100644 index 0000000000..95f2bf03ab --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcProfile.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_IPC_PROFILE_H +#define RVL_SDK_IPC_PROFILE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void IPCiProfInit(void); +void IPCiProfQueueReq(IPCRequestEx* req, s32 fd); +void IPCiProfAck(void); +void IPCiProfReply(IPCRequestEx* req, s32 fd); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcclt.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcclt.h new file mode 100644 index 0000000000..f73e9166e0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/ipcclt.h @@ -0,0 +1,148 @@ +#ifndef RVL_SDK_IPC_CLT_H +#define RVL_SDK_IPC_CLT_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + IPC_RESULT_FATAL_ERROR = -119, + IPC_RESULT_BUSY, + IPC_RESULT_NOTEMPTY = -115, + IPC_RESULT_ECC_CRIT, + IPC_RESULT_OPENFD = -111, + IPC_RESULT_MAXFD = -109, + IPC_RESULT_MAXBLOCKS, + IPC_RESULT_MAXFILES, + IPC_RESULT_NOEXISTS, + IPC_RESULT_EXISTS, + IPC_RESULT_CORRUPT = -103, + IPC_RESULT_ACCESS, + IPC_RESULT_INVALID, + + IPC_RESULT_ALLOC_FAILED = -22, + IPC_RESULT_ECC_CRIT_INTERNAL = -12, + IPC_RESULT_BUSY_INTERNAL = -8, + IPC_RESULT_NOEXISTS_INTERNAL = -6, + IPC_RESULT_CONN_MAX_INTERNAL = -5, + IPC_RESULT_INVALID_INTERNAL = -4, + IPC_RESULT_EXISTS_INTERNAL = -2, + IPC_RESULT_ACCESS_INTERNAL = -1, + + IPC_RESULT_OK = 0 +} IPCResult; + +typedef enum { + IPC_REQ_NONE, + IPC_REQ_OPEN, + IPC_REQ_CLOSE, + IPC_REQ_READ, + IPC_REQ_WRITE, + IPC_REQ_SEEK, + IPC_REQ_IOCTL, + IPC_REQ_IOCTLV +} IPCRequestType; + +typedef enum { + IPC_OPEN_NONE = 0, + IPC_OPEN_READ = (1 << 0), + IPC_OPEN_WRITE = (1 << 1), + IPC_OPEN_RW = IPC_OPEN_READ | IPC_OPEN_WRITE +} IPCOpenMode; + +typedef enum { + IPC_SEEK_BEG, + IPC_SEEK_CUR, + IPC_SEEK_END, +} IPCSeekMode; + +typedef s32 (*IPCAsyncCallback)(s32 result, void* arg); + +typedef struct IPCIOVector { + void* base; // at 0x0 + u32 length; // at 0x4 +} IPCIOVector; + +typedef struct IPCOpenArgs { + const char* path; // at 0x0 + IPCOpenMode mode; // at 0x4 +} IPCOpenArgs; + +typedef struct IPCReadWriteArgs { + void* data; // at 0x0 + u32 length; // at 0x4 +} IPCReadWriteArgs; + +typedef struct IPCSeekArgs { + s32 offset; // at 0x0 + IPCSeekMode mode; // at 0x4 +} IPCSeekArgs; + +typedef struct IPCIoctlArgs { + s32 type; // at 0x0 + void* in; // at 0x4 + s32 inSize; // at 0x8 + void* out; // at 0xC + s32 outSize; // at 0x10 +} IPCIoctlArgs; + +typedef struct IPCIoctlvArgs { + s32 type; // at 0x0 + u32 inCount; // at 0x4 + u32 outCount; // at 0x8 + IPCIOVector* vectors; // at 0xC +} IPCIoctlvArgs; + +typedef struct IPCRequest { + IPCRequestType type; // at 0x0 + s32 ret; // at 0x4 + s32 fd; // at 0x8 + union { + IPCOpenArgs open; + IPCReadWriteArgs rw; + IPCSeekArgs seek; + IPCIoctlArgs ioctl; + IPCIoctlvArgs ioctlv; + }; // at 0xC +} IPCRequest; + +typedef struct IPCRequestEx { + IPCRequest base; // at 0x0 + IPCAsyncCallback callback; // at 0x20 + void* callbackArg; // at 0x24 + BOOL reboot; // at 0x28 + OSThreadQueue queue; // at 0x2C + char padding[64 - 0x34]; +} IPCRequestEx; + +s32 IPCCltInit(void); +s32 IOS_OpenAsync(const char* path, IPCOpenMode mode, IPCAsyncCallback callback, + void* callbackArg); +s32 IOS_Open(const char* path, IPCOpenMode mode); +s32 IOS_CloseAsync(s32 fd, IPCAsyncCallback callback, void* callbackArg); +s32 IOS_Close(s32 fd); +s32 IOS_ReadAsync(s32 fd, void* buf, s32 len, IPCAsyncCallback callback, + void* callbackArg); +s32 IOS_Read(s32 fd, void* buf, s32 len); +s32 IOS_WriteAsync(s32 fd, const void* buf, s32 len, IPCAsyncCallback callback, + void* callbackArg); +s32 IOS_Write(s32 fd, const void* buf, s32 len); +s32 IOS_SeekAsync(s32 fd, s32 offset, IPCSeekMode mode, + IPCAsyncCallback callback, void* callbackArg); +s32 IOS_Seek(s32 fd, s32 offset, IPCSeekMode mode); +s32 IOS_IoctlAsync(s32 fd, s32 type, void* in, s32 inSize, void* out, + s32 outSize, IPCAsyncCallback callback, void* callbackArg); +s32 IOS_Ioctl(s32 fd, s32 type, void* in, s32 inSize, void* out, s32 outSize); +s32 IOS_IoctlvAsync(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors, IPCAsyncCallback callback, + void* callbackArg); +s32 IOS_Ioctlv(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors); +s32 IOS_IoctlvReboot(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/memory.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/memory.h new file mode 100644 index 0000000000..9dcee9a688 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/IPC/memory.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_IPC_MEMORY_H +#define RVL_SDK_IPC_MEMORY_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +s32 iosCreateHeap(void* base, u32 size); +void* iosAllocAligned(s32 handle, u32 size, u32 align); +s32 iosFree(s32 handle, void* block); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/KPAD/KPAD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/KPAD/KPAD.h new file mode 100644 index 0000000000..53889fb57f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/KPAD/KPAD.h @@ -0,0 +1,15 @@ +#ifndef REVOSDK_KPAD_H +#define REVOSDK_KPAD_H +#ifdef __cplusplus +#include +extern "C" { +#endif + +typedef struct { + +} KPADStatus; + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM.h new file mode 100644 index 0000000000..0f9f507fb5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_PUBLIC_MEM_H +#define RVL_SDK_PUBLIC_MEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_allocator.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_allocator.h new file mode 100644 index 0000000000..07fc238968 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_allocator.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_MEM_ALLOCATOR_H +#define RVL_SDK_MEM_ALLOCATOR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct MEMAllocator MEMAllocator; +typedef struct MEMiHeapHead MEMiHeapHead; + +typedef void* (*MEMAllocatorAllocFunc)(MEMAllocator* allocator, u32 size); +typedef void (*MEMAllocatorFreeFunc)(MEMAllocator* allocator, void* block); + +typedef struct MEMAllocatorFuncs { + MEMAllocatorAllocFunc allocFunc; // at 0x0 + MEMAllocatorFreeFunc freeFunc; // at 0x4 +} MEMAllocatorFuncs; + +typedef struct MEMAllocator { + const MEMAllocatorFuncs* funcs; // at 0x0 + MEMiHeapHead* heap; // at 0x4 + u32 heapParam1; // at 0x8 + u32 heapParam2; // at 0xC +} MEMAllocator; + +void* MEMAllocFromAllocator(MEMAllocator* allocator, u32 size); +void MEMFreeToAllocator(MEMAllocator* allocator, void* block); + +void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMiHeapHead* heap, + s32 align); +void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, MEMiHeapHead* heap, + s32 align); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_expHeap.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_expHeap.h new file mode 100644 index 0000000000..a80bb29186 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_expHeap.h @@ -0,0 +1,81 @@ +#ifndef RVL_SDK_MEM_EXP_HEAP_H +#define RVL_SDK_MEM_EXP_HEAP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MEM_EXP_HEAP_MIN_SIZE \ + (sizeof(MEMiHeapHead) + sizeof(MEMiExpHeapHead) + \ + sizeof(MEMiExpHeapMBlock) + 4) + +// Forward declarations +typedef struct MEMiHeapHead MEMiHeapHead; + +typedef enum { + MEM_EXP_HEAP_ALLOC_FAST, //!< When allocating memory blocks, take the first + //!< usable found block rather than trying to + //!< find a more optimal block +} MEMiExpHeapAllocMode; + +typedef struct MEMiExpHeapMBlock { + u16 state; // at 0x0 + union { + u16 settings; + struct { + u16 allocDir : 1; + u16 align : 7; + u16 group : 8; + }; + }; // at 0x2 + u32 size; // at 0x4 + struct MEMiExpHeapMBlock* prev; // at 0x8 + struct MEMiExpHeapMBlock* next; // at 0xC +} MEMiExpHeapMBlock; + +typedef struct MEMiExpHeapMBlockList { + MEMiExpHeapMBlock* head; // at 0x0 + MEMiExpHeapMBlock* tail; // at 0x4 +} MEMiExpHeapMBlockList; + +// Placed in heap after base heap head +typedef struct MEMiExpHeapHead { + MEMiExpHeapMBlockList freeMBlocks; // at 0x0 + MEMiExpHeapMBlockList usedMBlocks; // at 0x8 + u16 group; // at 0x10 + union { + u16 SHORT_0x12; + struct { + u16 SHORT_0x12_0_15 : 15; + u16 allocMode : 1; + }; + }; // at 0x12 +} MEMiExpHeapHead; + +MEMiHeapHead* MEMCreateExpHeapEx(void* start, u32 size, u16 opt); +MEMiHeapHead* MEMDestroyExpHeap(MEMiHeapHead* heap); +void* MEMAllocFromExpHeapEx(MEMiHeapHead* heap, u32 size, s32 align); +u32 MEMResizeForMBlockExpHeap(MEMiHeapHead* heap, void* memBlock, u32 size); +void MEMFreeToExpHeap(MEMiHeapHead* heap, void* memBlock); +u32 MEMGetAllocatableSizeForExpHeapEx(MEMiHeapHead* heap, s32 align); +u32 MEMAdjustExpHeap(MEMiHeapHead* heap); + +inline MEMiHeapHead* MEMCreateExpHeap(void* start, u32 size) +{ + return MEMCreateExpHeapEx(start, size, 0); +} + +inline void* MEMAllocFromExpHeap(MEMiHeapHead* heap, u32 size) +{ + return MEMAllocFromExpHeapEx(heap, size, 4); +} + +inline u32 MEMGetAllocatableSizeForExpHeap(MEMiHeapHead* heap) +{ + return MEMGetAllocatableSizeForExpHeapEx(heap, 4); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_frameHeap.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_frameHeap.h new file mode 100644 index 0000000000..cba2fabe74 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_frameHeap.h @@ -0,0 +1,63 @@ +#ifndef RVL_SDK_MEM_FRAME_HEAP_H +#define RVL_SDK_MEM_FRAME_HEAP_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define MEM_FRM_HEAP_MIN_SIZE (sizeof(MEMiHeapHead) + sizeof(MEMiFrmHeapHead)) + +// Forward declarations +typedef struct MEMiHeapHead MEMiHeapHead; + +// Specify how to free memory +typedef enum { + MEM_FRM_HEAP_FREE_TO_HEAD = (1 << 0), + MEM_FRM_HEAP_FREE_TO_TAIL = (1 << 1), + MEM_FRM_HEAP_FREE_ALL = + MEM_FRM_HEAP_FREE_TO_HEAD | MEM_FRM_HEAP_FREE_TO_TAIL +} MEMiFrmFreeFlag; + +typedef struct MEMiFrmHeapState { + u32 id; // at 0x0 + u8* head; // at 0x4 + u8* tail; // at 0x8 + struct MEMiFrmHeapState* next; // at 0xC +} MEMiFrmHeapState; + +// Placed in heap after base heap head +typedef struct MEMiFrmHeapHead { + u8* head; // at 0x0 + u8* tail; // at 0x4 + MEMiFrmHeapState* states; // at 0x8 +} MEMiFrmHeapHead; + +MEMiHeapHead* MEMCreateFrmHeapEx(void* start, u32 size, u16 opt); +MEMiHeapHead* MEMDestroyFrmHeap(MEMiHeapHead* heap); +void* MEMAllocFromFrmHeapEx(MEMiHeapHead* heap, u32 size, s32 align); +void MEMFreeToFrmHeap(MEMiHeapHead* heap, u32 flags); +u32 MEMGetAllocatableSizeForFrmHeapEx(MEMiHeapHead* heap, s32 align); +BOOL MEMRecordStateForFrmHeap(MEMiHeapHead* heap, u32 id); +BOOL MEMFreeByStateToFrmHeap(MEMiHeapHead* heap, u32 id); +u32 MEMAdjustFrmHeap(MEMiHeapHead* heap); +u32 MEMResizeForMBlockFrmHeap(MEMiHeapHead* heap, void* memBlock, u32 size); + +inline MEMiHeapHead* MEMCreateFrmHeap(void* start, u32 size) +{ + return MEMCreateFrmHeapEx(start, size, 0); +} + +inline void* MEMAllocFromFrmHeap(MEMiHeapHead* heap, u32 size) +{ + return MEMAllocFromFrmHeapEx(heap, size, 4); +} + +inline u32 MEMGetAllocatableSizeForFrmHeap(MEMiHeapHead* heap) +{ + return MEMGetAllocatableSizeForFrmHeapEx(heap, 4); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_heapCommon.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_heapCommon.h new file mode 100644 index 0000000000..58d934015c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_heapCommon.h @@ -0,0 +1,93 @@ +#ifndef RVL_SDK_MEM_HEAP_COMMON_H +#define RVL_SDK_MEM_HEAP_COMMON_H +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + MEM_HEAP_OPT_CLEAR_ALLOC = (1 << 0), + MEM_HEAP_OPT_DEBUG_FILL = (1 << 1), + MEM_HEAP_OPT_CAN_LOCK = (1 << 2) +} MEMHeapOpt; + +typedef struct MEMiHeapHead { + u32 magic; // at 0x0 + MEMLink link; // at 0x4 + MEMList list; // at 0xC + u8* start; // at 0x18 + u8* end; // at 0x1C + OSMutex mutex; // at 0x20 + + union { + u32 attribute; + struct { + u32 attribute_0_24 : 24; + u32 opt : 8; + }; + }; // at 0x38 +} MEMiHeapHead; + +void MEMiInitHeapHead(MEMiHeapHead* heap, u32 magic, void* start, void* end, + u16 opt); +void MEMiFinalizeHeap(MEMiHeapHead* heap); +MEMiHeapHead* MEMFindContainHeap(const void* memBlock); + +static inline uintptr_t GetUIntPtr(const void* p) { return (uintptr_t)p; } + +static inline void* AddU32ToPtr(const void* p, u32 ofs) { + return (void*)(GetUIntPtr(p) + ofs); +} + +static inline void* SubU32ToPtr(const void* p, u32 ofs) { + return (void*)(GetUIntPtr(p) - ofs); +} + +static inline const void* AddU32ToCPtr(const void* p, u32 ofs) { + return (const void*)(GetUIntPtr(p) + ofs); +} + +static inline const void* SubU32ToCPtr(const void* p, u32 ofs) { + return (const void*)(GetUIntPtr(p) - ofs); +} + +static inline s32 GetOffsetFromPtr(const void* start, const void* end) { + return GetUIntPtr(end) - GetUIntPtr(start); +} + +static inline u16 GetOptForHeap(const MEMiHeapHead* heap) { return heap->opt; } + +static inline void SetOptForHeap(MEMiHeapHead* heap, u16 opt) { + heap->opt = (u8)opt; +} + +static inline void LockHeap(MEMiHeapHead* heap) { + if (GetOptForHeap(heap) & MEM_HEAP_OPT_CAN_LOCK) { + OSLockMutex(&heap->mutex); + } +} + +static inline void UnlockHeap(MEMiHeapHead* heap) { + if (GetOptForHeap(heap) & MEM_HEAP_OPT_CAN_LOCK) { + OSUnlockMutex(&heap->mutex); + } +} + +static inline void FillAllocMemory(MEMiHeapHead* heap, void* memBlock, + u32 size) { + if (GetOptForHeap(heap) & MEM_HEAP_OPT_CLEAR_ALLOC) { + memset(memBlock, 0, size); + } +} + +static inline s32 MEMGetHeapTotalSize(MEMiHeapHead* heap) { + return GetOffsetFromPtr(heap, heap->end); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_list.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_list.h new file mode 100644 index 0000000000..27a1f9fdf1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MEM/mem_list.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_MEM_LIST_H +#define RVL_SDK_MEM_LIST_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct MEMList { + void* head; // at 0x0 + void* tail; // at 0x4 + u16 length; // at 0x8 + u16 offset; // at 0xA +} MEMList; + +typedef struct MEMLink { + void* prev; // at 0x0 + void* next; // at 0x4 +} MEMLink; + +void MEMInitList(MEMList* list, u16 offset); +void MEMAppendListObject(MEMList* list, void* object); +void MEMRemoveListObject(MEMList* list, void* object); +void* MEMGetNextListObject(MEMList* list, void* object); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX.h new file mode 100644 index 0000000000..3c1fe2f5c6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_PUBLIC_MTX_H +#define RVL_SDK_PUBLIC_MTX_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx.h new file mode 100644 index 0000000000..8c8ec31da0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx.h @@ -0,0 +1,43 @@ +#ifndef RVL_SDK_MTX_MTX_H +#define RVL_SDK_MTX_MTX_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef f32 Mtx[3][4]; +typedef f32 Mtx44[4][4]; + +typedef struct Vec { + f32 x, y, z; +} Vec; + +typedef struct Quaternion { + f32 x, y, z, w; +} Quaternion; + +void PSMTXIdentity(Mtx); +void PSMTXCopy(const Mtx, Mtx); +void PSMTXConcat(const Mtx, const Mtx, Mtx); +void PSMTXConcatArray(const Mtx, const Mtx, Mtx, u32); +void PSMTXTranspose(const Mtx, Mtx); +u32 PSMTXInverse(const Mtx, Mtx); +u32 PSMTXInvXpose(const Mtx, Mtx); +void PSMTXRotRad(Mtx, f32, char); +void PSMTXRotTrig(Mtx, f32, f32, char); +void PSMTXRotAxisRad(Mtx, const Vec*, f32); +void PSMTXTrans(Mtx, f32, f32, f32); +void PSMTXTransApply(const Mtx, Mtx, f32, f32, f32); +void PSMTXScale(Mtx, f32, f32, f32); +void PSMTXScaleApply(const Mtx, Mtx, f32, f32, f32); +void PSMTXQuat(Mtx, const Quaternion*); + +void C_MTXLookAt(Mtx, const Vec*, const Vec*, const Vec*); +void C_MTXLightFrustum(Mtx, f32, f32, f32, f32, f32, f32, f32, f32, f32); +void C_MTXLightPerspective(Mtx, f32, f32, f32, f32, f32, f32); +void C_MTXLightOrtho(Mtx, f32, f32, f32, f32, f32, f32, f32, f32); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx44.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx44.h new file mode 100644 index 0000000000..47f498f6c5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtx44.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_MTX_MTX44_H +#define RVL_SDK_MTX_MTX44_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void C_MTXFrustum(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); +void C_MTXPerspective(Mtx44 mtx, f32 fovy, f32 aspect, f32 n, f32 f); +void C_MTXOrtho(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtxvec.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtxvec.h new file mode 100644 index 0000000000..7d5e2bbde0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/mtxvec.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_MTX_MTXVEC_H +#define RVL_SDK_MTX_MTXVEC_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void PSMTXMultVec(const Mtx mtx, const Vec* vec, Vec* out); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/quat.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/quat.h new file mode 100644 index 0000000000..d3853a7234 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/quat.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_MTX_QUAT_H +#define RVL_SDK_MTX_QUAT_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void PSQUATMultiply(const Quaternion* a, const Quaternion* b, Quaternion* prod); +void PSQUATNormalize(const Quaternion* in, Quaternion* out); +void C_QUATMtx(Quaternion* quat, const Mtx mtx); +void C_QUATSlerp(const Quaternion* a, const Quaternion* b, Quaternion* out, + f32 t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/vec.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/vec.h new file mode 100644 index 0000000000..23c1f6d680 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/MTX/vec.h @@ -0,0 +1,21 @@ +#ifndef RVL_SDK_MTX_VEC_H +#define RVL_SDK_MTX_VEC_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void PSVECAdd(const Vec* a, const Vec* b, Vec* sum); +void PSVECScale(const Vec* in, Vec* out, f32 scale); +void PSVECNormalize(const Vec* in, Vec* out); +f32 PSVECMag(const Vec* v); +f32 PSVECDotProduct(const Vec* a, const Vec* b); +void PSVECCrossProduct(const Vec* a, const Vec* b, Vec* prod); +f32 PSVECSquareDistance(const Vec* a, const Vec* b); +void C_VECHalfAngle(const Vec* a, const Vec* b, Vec* half); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND.h new file mode 100644 index 0000000000..81e69fb1f7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND.h @@ -0,0 +1,19 @@ +/** + * References: WiiBrew + */ + +#ifndef RVL_SDK_PUBLIC_NAND_H +#define RVL_SDK_PUBLIC_NAND_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCheck.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCheck.h new file mode 100644 index 0000000000..400b60fdaf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCheck.h @@ -0,0 +1,21 @@ +#ifndef RVL_SDK_NAND_CHECK_H +#define RVL_SDK_NAND_CHECK_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NAND_CHECK_TOO_MANY_APP_BLOCKS = (1 << 0), + NAND_CHECK_TOO_MANY_APP_FILES = (1 << 1), + NAND_CHECK_TOO_MANY_USER_BLOCKS = (1 << 2), + NAND_CHECK_TOO_MANY_USER_FILES = (1 << 3), +} NANDCheckFlags; + +s32 NANDCheck(u32 neededBlocks, u32 neededFiles, u32* answer); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCore.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCore.h new file mode 100644 index 0000000000..893bff1574 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDCore.h @@ -0,0 +1,37 @@ +#ifndef RVL_SDK_NAND_CORE_H +#define RVL_SDK_NAND_CORE_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +void nandRemoveTailToken(char* newp, const char* oldp); +void nandGetHeadToken(char* head, char* rest, const char* path); +void nandGetRelativeName(char* name, const char* path); +void nandConvertPath(char* abs, const char* dir, const char* rel); +BOOL nandIsRelativePath(const char* path); +BOOL nandIsPrivatePath(const char* path); +BOOL nandIsUnderPrivatePath(const char* path); +BOOL nandIsInitialized(void); +void nandReportErrorCode(s32 result) DECOMP_DONT_INLINE; +s32 nandConvertErrorCode(s32 result); +void nandGenerateAbsPath(char* abs, const char* rel); +void nandGetParentDirectory(char* dir, const char* path); +s32 NANDInit(void); +s32 NANDGetCurrentDir(char* out); +s32 NANDGetHomeDir(char* out); +void nandCallback(s32 result, void* arg); +s32 NANDGetType(const char* path, u8* type); +s32 NANDPrivateGetTypeAsync(const char* path, u8* type, + NANDAsyncCallback callback, + NANDCommandBlock* block); +const char* nandGetHomeDir(void); +void NANDInitBanner(NANDBanner* banner, u32 flags, const wchar_t* title, + const wchar_t* subtitle); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDOpenClose.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDOpenClose.h new file mode 100644 index 0000000000..cdbd43bea1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/NANDOpenClose.h @@ -0,0 +1,30 @@ +#ifndef RVL_SDK_NAND_OPEN_CLOSE_H +#define RVL_SDK_NAND_OPEN_CLOSE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +s32 NANDOpen(const char* path, NANDFileInfo* info, u8 mode); +s32 NANDPrivateOpen(const char* path, NANDFileInfo* info, u8 mode); +s32 NANDOpenAsync(const char* path, NANDFileInfo* info, u8 mode, + NANDAsyncCallback callback, NANDCommandBlock* block); +s32 NANDPrivateOpenAsync(const char* path, NANDFileInfo* info, u8 mode, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDClose(NANDFileInfo* info); +s32 NANDCloseAsync(NANDFileInfo* info, NANDAsyncCallback callback, + NANDCommandBlock* block); + +s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 access, + void* buffer, u32 bufferSize, + NANDAsyncCallback callback, + NANDCommandBlock* block); +s32 NANDSafeCloseAsync(NANDFileInfo* info, NANDAsyncCallback callback, + NANDCommandBlock* block); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/nand.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/nand.h new file mode 100644 index 0000000000..f4aa675a01 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NAND/nand.h @@ -0,0 +1,184 @@ +#ifndef RVL_SDK_NAND_H +#define RVL_SDK_NAND_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define NAND_BANNER_TITLE_MAX 32 +#define NAND_BANNER_ICON_MAX_FRAME 8 + +// Forward declarations +typedef struct NANDCommandBlock NANDCommandBlock; + +typedef enum { + NAND_RESULT_FATAL_ERROR = -128, + NAND_RESULT_UNKNOWN = -64, + + NAND_RESULT_MAXDEPTH = -16, + NAND_RESULT_AUTHENTICATION, + NAND_RESULT_OPENFD, + NAND_RESULT_NOTEMPTY, + NAND_RESULT_NOEXISTS, + NAND_RESULT_MAXFILES, + NAND_RESULT_MAXFD, + NAND_RESULT_MAXBLOCKS, + NAND_RESULT_INVALID, + + NAND_RESULT_EXISTS = -6, + NAND_RESULT_ECC_CRIT, + NAND_RESULT_CORRUPT, + NAND_RESULT_BUSY, + NAND_RESULT_ALLOC_FAILED, + NAND_RESULT_ACCESS, + + NAND_RESULT_OK, +} NANDResult; + +typedef enum { + NAND_SEEK_BEG, + NAND_SEEK_CUR, + NAND_SEEK_END, +} NANDSeekMode; + +typedef enum { + NAND_ACCESS_NONE, + NAND_ACCESS_READ, + NAND_ACCESS_WRITE, + NAND_ACCESS_RW +} NANDAccessType; + +typedef enum { + NAND_FILE_TYPE_NONE, + NAND_FILE_TYPE_FILE, + NAND_FILE_TYPE_DIR, +} NANDFileType; + +typedef enum { + // Read/write by owner + NAND_PERM_RUSR = (NAND_ACCESS_READ << 4), + NAND_PERM_WUSR = (NAND_ACCESS_WRITE << 4), + // Read/write by group + NAND_PERM_RGRP = (NAND_ACCESS_READ << 2), + NAND_PERM_WGRP = (NAND_ACCESS_WRITE << 2), + // Read/write by other + NAND_PERM_ROTH = (NAND_ACCESS_READ << 0), + NAND_PERM_WOTH = (NAND_ACCESS_WRITE << 0), + // Read/write by all + NAND_PERM_RALL = NAND_PERM_RUSR | NAND_PERM_RGRP | NAND_PERM_ROTH, + NAND_PERM_WALL = NAND_PERM_WUSR | NAND_PERM_WGRP | NAND_PERM_WOTH, + NAND_PERM_RWALL = NAND_PERM_RALL | NAND_PERM_WALL +} NANDPermission; + +typedef void (*NANDAsyncCallback)(s32 result, NANDCommandBlock* block); + +typedef struct NANDStatus { + u32 ownerId; // at 0x0 + u16 groupId; // at 0x4 + u8 attr; // at 0x6 + u8 perm; // at 0x7 +} NANDStatus; + +typedef struct NANDFileInfo { + s32 fd; // at 0x0 + s32 tempFd; // at 0x4 + char openPath[FS_MAX_PATH]; // at 0x8 + char tempPath[FS_MAX_PATH]; // at 0x48 + u8 access; // at 0x88 + u8 stage; // at 0x89 + u8 mark; // at 0x8A +} NANDFileInfo; + +typedef struct NANDCommandBlock { + void* userData; // at 0x0 + NANDAsyncCallback callback; // at 0x4 + NANDFileInfo* info; // at 0x8 + void* bytes; // at 0xC + void* inodes; // at 0x10 + NANDStatus* status; // at 0x14 + u32 ownerId; // at 0x18 + u16 groupId; // at 0x1C + u8 nextStage; // at 0x1E + u32 attr; // at 0x20 + u32 ownerPerm; // at 0x24 + u32 groupPerm; // at 0x28 + u32 otherPerm; // at 0x2C + u32 dirFileCount; // at 0x30 + char path[FS_MAX_PATH]; // at 0x34 + u32* length; // at 0x74 + u32* position; // at 0x78 + s32 state; // at 0x7C + void* buffer; // at 0x80 + u32 bufferSize; // at 0x84 + u8* type; // at 0x88 + u32 uniqueNo; // at 0x8C + u32 reqBlocks; // at 0x90 + u32 reqInodes; // at 0x94 + u32* answer; // at 0x98 + u32 homeBlocks; // at 0x9C + u32 homeInodes; // at 0xA0 + u32 userBlocks; // at 0xA4 + u32 userInodes; // at 0xA8 + u32 workBlocks; // at 0xAC + u32 workInodes; // at 0xB0 + const char** dir; // at 0xB4 +} NANDCommandBlock; + +typedef struct NANDBanner { + u32 magic; // at 0x0 + u32 flags; // at 0x4 + u16 iconSpeed; // at 0x8 + u8 reserved[0x20 - 0xA]; // at 0xA + wchar_t title[NAND_BANNER_TITLE_MAX]; // at 0x20 + wchar_t subtitle[NAND_BANNER_TITLE_MAX]; // at 0x60 + u8 bannerTexture[0x6000]; // at 0xA0 + u8 iconTexture[0x1200][NAND_BANNER_ICON_MAX_FRAME]; // at 0x60A0 +} NANDBanner; + +s32 NANDCreate(const char* path, u8 perm, u8 attr); +s32 NANDPrivateCreate(const char* path, u8 perm, u8 attr); +s32 NANDPrivateCreateAsync(const char* path, u8 perm, u8 attr, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDDelete(const char* path); +s32 NANDPrivateDelete(const char* path); +s32 NANDPrivateDeleteAsync(const char* path, NANDAsyncCallback callback, + NANDCommandBlock* block); + +s32 NANDRead(NANDFileInfo* info, void* buf, u32 len); +s32 NANDReadAsync(NANDFileInfo* info, void* buf, u32 len, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDWrite(NANDFileInfo* info, const void* buf, u32 len); +s32 NANDWriteAsync(NANDFileInfo* info, const void* buf, u32 len, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDSeek(NANDFileInfo* info, s32 offset, NANDSeekMode whence); +s32 NANDSeekAsync(NANDFileInfo* info, s32 offset, NANDSeekMode whence, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDPrivateCreateDir(const char* path, u8 perm, u8 attr); +s32 NANDPrivateCreateDirAsync(const char* path, u8 perm, u8 attr, + NANDAsyncCallback callback, + NANDCommandBlock* block); + +s32 NANDMove(const char* from, const char* to); + +s32 NANDGetLength(NANDFileInfo* info, u32* length); +s32 NANDGetLengthAsync(NANDFileInfo* info, u32* lengthOut, + NANDAsyncCallback callback, NANDCommandBlock* block); + +s32 NANDGetStatus(const char* path, NANDStatus* status); +s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status, + NANDAsyncCallback callback, + NANDCommandBlock* block); + +void NANDSetUserData(NANDCommandBlock* block, void* data); +void* NANDGetUserData(NANDCommandBlock* block); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET.h new file mode 100644 index 0000000000..cf1626be8c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_NET_H +#define RVL_SDK_NET_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif + +#endif // RVL_SDK_NET_H diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET/crc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET/crc.h new file mode 100644 index 0000000000..c285907da2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NET/crc.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_CRC_H +#define RVL_SDK_CRC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +u16 NETCalcCRC16(const char* src, u32 size); + +#ifdef __cplusplus +} +#endif + +#endif // RVL_SDK_CRC_H diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP.h new file mode 100644 index 0000000000..49de3c92c0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_PUBLIC_NHTTP_H +#define RVL_SDK_PUBLIC_NHTTP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP/d_nhttp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP/d_nhttp.h new file mode 100644 index 0000000000..3e37311259 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NHTTP/d_nhttp.h @@ -0,0 +1,57 @@ +#ifndef RVL_SDK_D_NHTTP_H +#define RVL_SDK_D_NHTTP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NHTTP_ERROR_SYSTEM = -1, + NHTTP_ERROR_NONE = 0, + NHTTP_ERROR_ALLOC = 1, + NHTTP_ERROR_TOOMANYREQ = 2, + NHTTP_ERROR_SOCKET = 3, + NHTTP_ERROR_DNS = 4, + NHTTP_ERROR_CONNECT = 5, + NHTTP_ERROR_BUFFULL = 6, + NHTTP_ERROR_HTTPPARSE = 7, + NHTTP_ERROR_CANCELED = 8, + NHTTP_ERROR_REVOLUTIONSDK = 9, + NHTTP_ERROR_REVOLUTIONWIFI = 10, + NHTTP_ERROR_UNKNOWN = 11, + NHTTP_ERROR_DNS_PROXY = 12, + NHTTP_ERROR_CONNECT_PROXY = 13, + NHTTP_ERROR_SSL = 14, + NHTTP_ERROR_BUSY = 15, + NHTTP_ERROR_SSL_ROOTCA = 16, + NHTTP_ERROR_SSL_CLIENTCERT = 17 +} NHTTPError; + +typedef enum { + NHTTP_REQMETHOD_GET = 0, + NHTTP_REQMETHOD_POST = 1, + NHTTP_REQMETHOD_HEAD = 2, +} NHTTPReqMethod; + +typedef void* NHTTPRequestHandle; +typedef void* NHTTPResponseHandle; + +typedef void* (*NHTTPAlloc)(size_t size, int align); +typedef void (*NHTTPFree)(void*); +typedef void (*NHTTPReqCallback)(NHTTPError, NHTTPResponseHandle, void*); + +int NHTTPStartup(NHTTPAlloc, NHTTPFree, u32); +NHTTPRequestHandle* NHTTPCreateRequest(const char* url, NHTTPReqMethod, char* buffer, size_t bufferSize, NHTTPReqCallback, void*); +int NHTTPSendRequestAsync(NHTTPRequestHandle); + +void NHTTPDestroyResponse(NHTTPResponseHandle); +int NHTTPGetResultCode(NHTTPResponseHandle); +int NHTTPGetBodyAll(NHTTPResponseHandle, char**); +//int NHTTPGetHeaderField(NHTTPResponseHandle, const char*, char**); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24.h new file mode 100644 index 0000000000..4ea91a90c4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24.h @@ -0,0 +1,34 @@ +/** + * References: WiiBrew, Dolphin Emulator + */ + +#ifndef RVL_SDK_PUBLIC_NWC24_H +#define RVL_SDK_PUBLIC_NWC24_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Config.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Config.h new file mode 100644 index 0000000000..eaf845f95f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Config.h @@ -0,0 +1,47 @@ +#ifndef RVL_SDK_NWC24_CONFIG_H +#define RVL_SDK_NWC24_CONFIG_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NWC24_IDCS_INITIAL, + NWC24_IDCS_GENERATED, + NWC24_IDCS_REGISTERED +} NWC24IDCreationStage; + +typedef struct NWC24Config { + u32 magic; // at 0x0 + u32 version; // at 0x4 + u64 userId; // at 0x8 + u32 createCount; // at 0x10 + NWC24IDCreationStage createStage; // at 0x14 + char acctDomain[64]; // at 0x18 + char password[32]; // at 0x58 + char mailchkId[36]; // at 0x78 + char acctUrl[128]; // at 0x9C + char mailchkUrl[128]; // at 0x11C + char mailrecvUrl[128]; // at 0x19C + char maildeleteUrl[128]; // at 0x21C + char mailsendUrl[128]; // at 0x29C + char UNK_0x31C[0x3F8 - 0x31C]; + BOOL allowTitleBoot; // at 0x3F8 + u32 checksum; // at 0x3FC +} NWC24Config; + +NWC24Err NWC24GetMyUserId(u64* idOut); +NWC24Err NWC24GenerateNewUserId(u64* idOut); +NWC24Err NWC24iConfigOpen(void); +NWC24Err NWC24iConfigReload(void); +NWC24Err NWC24iConfigFlush(void); +const char* NWC24GetAccountDomain(void); +const char* NWC24GetMBoxDir(void); +u32 NWC24GetAppId(void); +u16 NWC24GetGroupId(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24DateParser.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24DateParser.h new file mode 100644 index 0000000000..26af9d1bd3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24DateParser.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_NWC24_DATE_PARSER_H +#define RVL_SDK_NWC24_DATE_PARSER_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +NWC24Err NWC24iIsValidDate(u16 year, u8 month, u8 day); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Download.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Download.h new file mode 100644 index 0000000000..4f1e842f92 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Download.h @@ -0,0 +1,103 @@ +#ifndef RVL_SDK_NWC24_DOWNLOAD_H +#define RVL_SDK_NWC24_DOWNLOAD_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define NWC24_DL_TASK_MAX 120 +#define NWC24_DL_SUBTASK_MAX 32 + +typedef enum { + NWC24_DLTYPE_MULTIPART_V1, + NWC24_DLTYPE_OCTETSTREAM_V1, + NWC24_DLTYPE_MULTIPART_V2, + NWC24_DLTYPE_OCTETSTREAM_V2 +} NWC24DlType; + +typedef enum { + NWC24_DL_STTYPE_NONE, + NWC24_DL_STTYPE_INCREMENT, + NWC24_DL_STTYPE_TIME_HOUR, + NWC24_DL_STTYPE_TIME_DAYOFWEEK, + NWC24_DL_STTYPE_TIME_DAY +} NWC24DlSubTaskType; + +typedef enum { + NWC24_DL_STFLAG_TRAILING_FILENAME = (1 << 0), + NWC24_DL_STFLAG_TRAILING_URL = (1 << 1), + NWC24_DL_STFLAG_INTELLIGENT_UPDATE = (1 << 8), + NWC24_DL_STFLAG_RETICENT_UPDATE = (1 << 9) +} NWC24DlSubTaskFlags; + +typedef struct NWC24DlEntry { + u32 app; // at 0x0 + u32 nextTime; // at 0x4 + u32 lastAccess; // at 0x8 + u8 flags; // at 0xC + char UNK_0xD[0x10 - 0xD]; +} NWC24DlEntry; + +#pragma pack(push, 1) +typedef struct NWC24DlHeader { + u32 magic; // at 0x0 + u32 version; // at 0x4 + char UNK_0x8[0x10 - 0x8]; + u16 maxSubTasks; // at 0x10 + u16 privateTasks; // at 0x12 + u16 maxTasks; // at 0x14 + char UNK_0x16[0x80 - 0x16]; + NWC24DlEntry entries[NWC24_DL_TASK_MAX]; // at 0x80 +} NWC24DlHeader; +#pragma pack(pop) + +#pragma pack(push, 1) +typedef struct NWC24DlTask { + u16 id; // at 0x0 + u8 type; // at 0x2 + u8 priority; // at 0x3 + u32 flags; // at 0x4 + u32 appId; // at 0x8 + u32 titleIdHi; // at 0xC + u32 titleIdLo; // at 0x10 + u16 groupId; // at 0x14 + char UNK_0x16[0x2]; + s16 count; // at 0x18 + s16 errorCount; // at 0x1A + u16 interval; // at 0x1C + u16 margin; // at 0x1E + u32 lastError; // at 0x20 + u8 subTaskCounter; // at 0x24 + u8 subTaskType; // at 0x25 + u8 subTaskFlags; // at 0x26 + char UNK_0x27[0x1]; + u32 subTaskMask; // at 0x28 + u32 serverInterval; // at 0x2C + u32 lastUpdate; // at 0x30 + u32 lastUpdateSubTask[NWC24_DL_SUBTASK_MAX]; // at 0x34 + char url[236]; // at 0xB4 + char fileName[FS_MAX_PATH]; // at 0x1A0 + char UNK_0x1E0[0x1F8 - 0x1E0]; + u32 userParam; // at 0x1F8 + u8 optFlags; // at 0x1FC + u8 rootCaId; // at 0x1FD + char UNK_0x1FE[0x200 - 0x1FE]; +} NWC24DlTask; +#pragma pack(pop) + +NWC24Err NWC24CheckDlTask(NWC24DlTask* task); +NWC24Err NWC24DeleteDlTaskForced(NWC24DlTask* task); +NWC24Err NWC24GetDlTask(NWC24DlTask* task, u16 i); +NWC24Err NWC24iOpenDlTaskList(void); +NWC24Err NWC24iCloseDlTaskList(void); +NWC24DlHeader* NWC24iGetCachedDlHeader(void); +NWC24Err NWC24iCheckHeaderConsistency(NWC24DlHeader* header, + BOOL clear) DECOMP_DONT_INLINE; +NWC24Err NWC24iLoadDlHeader(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FileApi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FileApi.h new file mode 100644 index 0000000000..82c9e96503 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FileApi.h @@ -0,0 +1,76 @@ +#ifndef RVL_SDK_NWC24_FILE_API_H +#define RVL_SDK_NWC24_FILE_API_H +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + // Access + NWC24_OPEN_WRITE = (1 << 0), + NWC24_OPEN_READ = (1 << 1), + NWC24_OPEN_RW = (1 << 2), + + // Domain + NWC24_OPEN_BUFF = (1 << 3), + NWC24_OPEN_VF = (1 << 8), + + // NAND presets + NWC24_OPEN_NAND_W = NWC24_OPEN_WRITE, + NWC24_OPEN_NAND_R = NWC24_OPEN_READ, + NWC24_OPEN_NAND_RW = NWC24_OPEN_RW, + + // VF presets + NWC24_OPEN_VF_W = NWC24_OPEN_WRITE | NWC24_OPEN_VF, + NWC24_OPEN_VF_R = NWC24_OPEN_READ | NWC24_OPEN_VF, + NWC24_OPEN_VF_RW = NWC24_OPEN_RW | NWC24_OPEN_VF, + + // NAND (buffered) presets + NWC24_OPEN_NAND_WBUFF = NWC24_OPEN_NAND_W | NWC24_OPEN_BUFF, + NWC24_OPEN_NAND_RBUFF = NWC24_OPEN_NAND_R | NWC24_OPEN_BUFF, + NWC24_OPEN_NAND_RWBUFF = NWC24_OPEN_NAND_RW | NWC24_OPEN_BUFF, + + // VF (buffered) presets + NWC24_OPEN_VF_WBUFF = NWC24_OPEN_VF_W | NWC24_OPEN_BUFF, + NWC24_OPEN_VF_RBUFF = NWC24_OPEN_VF_R | NWC24_OPEN_BUFF, + NWC24_OPEN_VF_RWBUFF = NWC24_OPEN_VF_RW | NWC24_OPEN_BUFF, +} NWC24OpenMode; + +typedef enum { + NWC24_SEEK_BEG, + NWC24_SEEK_CUR, + NWC24_SEEK_END, +} NWC24SeekMode; + +typedef struct NWC24File { + u32 id; // at 0x0 + u32 mode; // at 0x4 + u32 align; // at 0x8 + NANDFileInfo nandf; // at 0xC + VFFile vff; // at 0x98 +} NWC24File; + +NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode); +NWC24Err NWC24iFOpenNand(NWC24File* file, const char* path, u32 mode); +NWC24Err NWC24iFOpenVF(NWC24File* file, const char* path, u32 mode); + +NWC24Err NWC24FClose(NWC24File* file); +NWC24Err NWC24iFCloseNand(NWC24File* file) DECOMP_DONT_INLINE; +NWC24Err NWC24iFCloseVF(NWC24File* file); + +NWC24Err NWC24FSeek(NWC24File* file, s32 offset, NWC24SeekMode whence); +NWC24Err NWC24FRead(void* dst, s32 size, NWC24File* file); +NWC24Err NWC24FWrite(const void* src, s32 size, NWC24File* file); +NWC24Err NWC24FGetLength(NWC24File* file, u32* lengthOut); +NWC24Err NWC24FDeleteVF(const char* path); +NWC24Err NWC24MountVF(const char* drive, const char* filename); +NWC24Err NWC24UnmountVF(const char* drive); +NWC24Err NWC24CheckSizeVF(const char* drive, u32* sizeOut); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FriendList.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FriendList.h new file mode 100644 index 0000000000..345c79911f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24FriendList.h @@ -0,0 +1,25 @@ +#ifndef RVL_SDK_NWC24_FRIEND_LIST_H +#define RVL_SDK_NWC24_FRIEND_LIST_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define NWC24_FRIEND_LIST_CAPACITY 100 + +typedef struct NWC24FLHeader { + u32 magic; // at 0x0 + u32 version; // at 0x4 + u32 capacity; // at 0x8 + u32 size; // at 0xC + char UNK_0x10[0x40 - 0x10]; + u64 friendCodes[NWC24_FRIEND_LIST_CAPACITY]; // at 0x40 +} NWC24FLHeader; + +NWC24Err NWC24iOpenFriendList(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Ipc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Ipc.h new file mode 100644 index 0000000000..32429c89c2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Ipc.h @@ -0,0 +1,46 @@ +#ifndef RVL_SDK_NWC24_IPC_H +#define RVL_SDK_NWC24_IPC_H +#include + +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +NWC24Err NWC24iOpenResourceManager(const char* user, const char* name, + s32* fdOut, IPCOpenMode mode); +NWC24Err NWC24iCloseResourceManager(const char* user, s32 fd); + +NWC24Err NWC24iIoctlResourceManager(const char* user, s32 fd, s32 type, + void* in, s32 inSize, void* out, + s32 outSize); +NWC24Err NWC24iIoctlResourceManagerAsync(const char* user, s32 fd, s32 type, + void* in, s32 inSize, void* out, + s32 outSize, void* callbackArg); + +BOOL NWC24iIsAsyncRequestPending(void); + +/** + * Macros to supply name of caller + */ + +// clang-format off +#define NWC24_OPEN_DEVICE(name, fdOut, mode) \ + NWC24iOpenResourceManager(__FUNCTION__, name, fdOut, mode) + +#define NWC24_CLOSE_DEVICE(fd) \ + NWC24iCloseResourceManager(__FUNCTION__, fd) + +#define NWC24_IOCTL_DEVICE(fd, type, in, inSize, out, outSize) \ + NWC24iIoctlResourceManager(__FUNCTION__, fd, type, in, inSize, out, outSize) + +#define NWC24_IOCTL_DEVICE_ASYNC(fd, type, in, inSize, out, outSize, callbackArg) \ + NWC24iIoctlResourceManagerAsync(__FUNCTION__, fd, type, in, inSize, out, outSize, callbackArg) +// clang-format on + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MBoxCtrl.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MBoxCtrl.h new file mode 100644 index 0000000000..f8c65d09b3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MBoxCtrl.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_NWC24_MBOX_CTRL_H +#define RVL_SDK_NWC24_MBOX_CTRL_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +NWC24Err NWC24iOpenMBox(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Manage.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Manage.h new file mode 100644 index 0000000000..06693ef04f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Manage.h @@ -0,0 +1,52 @@ +#ifndef RVL_SDK_NWC24_MANAGE_H +#define RVL_SDK_NWC24_MANAGE_H +#include +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define NWC24_IO_BUFFER_SIZE 512 + +#define WORK_SIZE(x) (ROUND_UP(sizeof(x), 0x100)) +typedef struct NWC24Work { + char stringWork[1024]; // at 0x0 + char WORK_0x400[0x800 - 0x400]; + char pathWork[128]; // at 0x800 + char WORK_0x880[0x900 - 0x880]; + u8 readBuffer[NWC24_IO_BUFFER_SIZE]; // at 0x900 + u8 writeBuffer[NWC24_IO_BUFFER_SIZE]; // at 0xB00 + u8 config[WORK_SIZE(NWC24Config)]; // at 0xD00 + char WORK_0x1100[128]; + char WORK_0x1180[128]; + char WORK_0x1200[128]; + char WORK_0x1280[128]; + u8 base64Work[256]; // at 0x1300 + char WORK_0x1400[0x2400 - 0x1400]; + u8 flHeader[WORK_SIZE(NWC24FLHeader)]; // at 0x2800 + u8 secretFlHeader[WORK_SIZE(NWC24SecretFLHeader)]; // at 0x2800 + u8 dlHeader[WORK_SIZE(NWC24DlHeader)]; // at 0x3000 + u8 dlTask[WORK_SIZE(NWC24DlTask)]; // at 0x3800 +} NWC24Work; +#undef WORK_SIZE + +extern NWC24Work* NWC24WorkP; + +void NWC24iRegister(void); +NWC24Err NWC24OpenLib(NWC24Work* work); +NWC24Err NWC24CloseLib(void); +BOOL NWC24IsMsgLibOpened(void); +BOOL NWC24IsMsgLibOpenedByTool(void); +BOOL NWC24IsMsgLibOpenBlocking(void); +NWC24Err NWC24BlockOpenMsgLib(BOOL block); +NWC24Err NWC24iSetNewMsgArrived(u32 flags); +void NWC24iSetErrorCode(u32 code); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Mime.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Mime.h new file mode 100644 index 0000000000..dbbc3bd603 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Mime.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_NWC24_MIME_H +#define RVL_SDK_NWC24_MIME_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void NWC24InitBase64Table(u8* table); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgCommit.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgCommit.h new file mode 100644 index 0000000000..200908d9e0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgCommit.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_NWC24_MSG_COMMIT_H +#define RVL_SDK_NWC24_MSG_COMMIT_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct NWC24MsgObj NWC24MsgObj; + +NWC24Err NWC24CommitMsg(NWC24MsgObj*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgObj.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgObj.h new file mode 100644 index 0000000000..a49cfd9684 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24MsgObj.h @@ -0,0 +1,88 @@ +#ifndef RVL_SDK_NWC24_MSG_OBJ_H +#define RVL_SDK_NWC24_MSG_OBJ_H +#include + +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define NWC24_MSG_RECIPIENT_MAX 8 +#define NWC24_MSG_ATTACHMENT_MAX 2 + +// Forward declarations +typedef struct RFLCharData RFLCharData; + +typedef enum { + NWC24_MSGTYPE_RVL_MENU_SHARED, + + NWC24_MSGTYPE_RVL, + NWC24_MSGTYPE_RVL_APP = NWC24_MSGTYPE_RVL, + + NWC24_MSGTYPE_RVL_MENU, + + NWC24_MSGTYPE_RVL_HIDDEN, + NWC24_MSGTYPE_RVL_APP_HIDDEN = NWC24_MSGTYPE_RVL_HIDDEN, + + NWC24_MSGTYPE_PUBLIC +} NWC24MsgType; + +typedef struct NWC24MsgObj { + u32 id; // at 0x0 + u32 flags; // at 0x4 + u32 length; // at 0x8 + u32 appId; // at 0xC + char UNK_0x10[0x4]; + u32 tag; // at 0x14 + u32 ledPattern; // at 0x18 + u64 fromId; // at 0x20 + u32 WORD_0x28; + u32 WORD_0x2C; + NWC24Data DATA_0x30; + NWC24Data DATA_0x38; + NWC24Data subject; // at 0x40 + NWC24Data text; // at 0x48 + NWC24Data DATA_0x50; + NWC24Data DATA_0x58; + NWC24Charset charset; // at 0x60 + NWC24Encoding encoding; // at 0x64 + NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX]; // at 0x68 + u32 attachedSize[NWC24_MSG_ATTACHMENT_MAX]; // at 0x78 + NWC24MIMEType attachedType[NWC24_MSG_ATTACHMENT_MAX]; // at 0x80 + union { + u64 toIds[NWC24_MSG_RECIPIENT_MAX]; + NWC24Data toAddrs[NWC24_MSG_RECIPIENT_MAX]; + }; // at 0x88 + u8 numTo; // at 0xC8 + u8 numAttached; // at 0xC9 + u16 groupId; // at 0xCA + union { + struct { + u32 noreply : 1; + u32 unknown : 7; + u32 delay : 8; + u32 regdate : 16; + }; + + u32 raw; + } mb; // at 0xCC + NWC24Data DATA_0xD0; + NWC24Data face; // at 0xD8 + NWC24Data alt; // at 0xE0 + char UNK_0xE8[0x100 - 0xE8]; +} NWC24MsgObj; + +NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type); +NWC24Err NWC24SetMsgToId(NWC24MsgObj* msg, u64 id); +NWC24Err NWC24SetMsgText(NWC24MsgObj* msg, const char* text, u32 len, + NWC24Charset charset, NWC24Encoding encoding); +NWC24Err NWC24SetMsgFaceData(NWC24MsgObj* msg, const RFLCharData* data); +NWC24Err NWC24SetMsgAltName(NWC24MsgObj* msg, const wchar_t* name, u32 len); +NWC24Err NWC24SetMsgMBNoReply(NWC24MsgObj* msg, BOOL enable); +NWC24Err NWC24SetMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Parser.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Parser.h new file mode 100644 index 0000000000..2b9e0e3e09 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Parser.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_NWC24_PARSER_H +#define RVL_SDK_NWC24_PARSER_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +const char* NWC24GetMIMETypeStr(NWC24MIMEType type); +const char* NWC24iGetMIMETypeSuffix(NWC24MIMEType type); +const char* NWC24GetCharsetStr(NWC24Charset set); +const char* NWC24GetEncodingStr(NWC24Encoding enc); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Schedule.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Schedule.h new file mode 100644 index 0000000000..e06716edfa --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Schedule.h @@ -0,0 +1,19 @@ +#ifndef RVL_SDK_NWC24_SCHEDULE_H +#define RVL_SDK_NWC24_SCHEDULE_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +s32 NWC24SuspendScheduler(void); +s32 NWC24ResumeScheduler(void); +NWC24Err NWC24iRequestGenerateUserId(u64* idOut, u32* arg1); +NWC24Err NWC24iTrySuspendForOpenLib(void); +NWC24Err NWC24iResumeForCloseLib(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24SecretFList.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24SecretFList.h new file mode 100644 index 0000000000..9cffe8b4ab --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24SecretFList.h @@ -0,0 +1,20 @@ +#ifndef RVL_SDK_NWC24_SECRET_FRIEND_LIST_H +#define RVL_SDK_NWC24_SECRET_FRIEND_LIST_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct NWC24SecretFLHeader { + u32 magic; // at 0x0 + u32 version; // at 0x4 + u8 UNK_0x8[0x800 - 0x8]; +} NWC24SecretFLHeader; + +NWC24Err NWC24iOpenSecretFriendList(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24StdApi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24StdApi.h new file mode 100644 index 0000000000..b67d0e6556 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24StdApi.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_NWC24_STD_API_H +#define RVL_SDK_NWC24_STD_API_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void* Mail_memset(void* dst, int ch, size_t n); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24System.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24System.h new file mode 100644 index 0000000000..0b53abe1c3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24System.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_NWC24_SYSTEM_H +#define RVL_SDK_NWC24_SYSTEM_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +NWC24Err NWC24EnableLedNotification(BOOL enable); +NWC24Err NWC24iPrepareShutdown(void); +NWC24Err NWC24iRequestShutdown(u32 event, NWC24Err* resultOut); +BOOL NWC24Shutdown(BOOL final, u32 event); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Time.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Time.h new file mode 100644 index 0000000000..6f380d8c64 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Time.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_NWC24_TIME_H +#define RVL_SDK_NWC24_TIME_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +NWC24Err NWC24iGetUniversalTime(s64* timeOut); +NWC24Err NWC24iGetTimeDifference(s64* diffOut); +NWC24Err NWC24iSetRtcCounter(u32 rtc, u32 flags); +NWC24Err NWC24iSynchronizeRtcCounter(BOOL forceSave); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Types.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Types.h new file mode 100644 index 0000000000..fd2ca5d015 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Types.h @@ -0,0 +1,108 @@ +#ifndef RVL_SDK_NWC24_TYPES_H +#define RVL_SDK_NWC24_TYPES_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NWC24_ERR_OTHER_REGION = -52, + NWC24_ERR_GIVE_UP, + NWC24_ERR_SCRIPT_VERSION, + NWC24_ERR_OLD_SYSTEM, + NWC24_ERR_CANCELLED, + NWC24_ERR_INVALID_CHAR, + NWC24_ERR_FILE_BROKEN, + NWC24_ERR_VERIFY_SIGNATURE, + NWC24_ERR_ID_NOT_REGISTERED, + NWC24_ERR_INTERNAL_VF, + NWC24_ERR_INTERNAL_IPC, + NWC24_ERR_FILE_EXISTS, + NWC24_ERR_INVALID_OPERATION, + NWC24_ERR_DISABLED, + NWC24_ERR_NAND_CORRUPT, + NWC24_ERR_ID_CRC, + NWC24_ERR_ID_REGISTERED, + NWC24_ERR_ID_GENERATED, + NWC24_ERR_ID_NOEXISTS, + NWC24_ERR_CONFIG_NETWORK, + NWC24_ERR_SERVER, + NWC24_ERR_NETWORK, + NWC24_ERR_NOT_READY, + NWC24_ERR_INPROGRESS, + NWC24_ERR_HIDDEN, + NWC24_ERR_VER_MISMATCH, + NWC24_ERR_BUSY, + NWC24_ERR_STRING_END, + NWC24_ERR_FORMAT, + NWC24_ERR_ALIGNMENT, + NWC24_ERR_MUTEX, + NWC24_ERR_FILE_OTHER, + NWC24_ERR_FILE_NOEXISTS, + NWC24_ERR_FILE_WRITE, + NWC24_ERR_FILE_READ, + NWC24_ERR_FILE_CLOSE, + NWC24_ERR_FILE_OPEN, + NWC24_ERR_DONE, + NWC24_ERR_BROKEN, + NWC24_ERR_NOT_FOUND, + NWC24_ERR_CONFIG, + NWC24_ERR_NOMEM, + NWC24_ERR_LIB_OPENED, + NWC24_ERR_LIB_NOT_OPENED, + NWC24_ERR_OVERFLOW, + NWC24_ERR_PROTECTED, + NWC24_ERR_FULL, + NWC24_ERR_NULL, + NWC24_ERR_NOT_SUPPORTED, + NWC24_ERR_INVALID_VALUE, + NWC24_ERR_FAILED, + NWC24_ERR_FATAL, + NWC24_OK +} NWC24Err; + +typedef enum { + NWC24_APPLICATION_OCTET_STREAM = 0x00030000, + NWC24_X_WII_MINIDATA = 0x00030002, + NWC24_X_WII_MSGBOARD = 0x00030001, + NWC24_IMAGE_JPEG = 0x00020000, + NWC24_X_WII_PICTURE = 0x00020001, + NWC24_MULTIPART_ALTERNATIVE = 0x000F0001, + NWC24_MULTIPART_MIXED = 0x000F0000, + NWC24_MULTIPART_RELATED = 0x000F0002, + NWC24_TEXT_HTML = 0x00010001, + NWC24_TEXT_PLAIN = 0x00010000 +} NWC24MIMEType; + +typedef enum { + NWC24_EUC_JP = 0x00020002, + NWC24_ISO_2022_JP = 0x00020000, + NWC24_ISO_8859_1 = 0x00080001, + NWC24_ISO_8859_10 = 0x0008000A, + NWC24_ISO_8859_15 = 0x0008000F, + NWC24_ISO_8859_2 = 0x00080002, + NWC24_ISO_8859_3 = 0x00080003, + NWC24_ISO_8859_5 = 0x00080005, + NWC24_ISO_8859_7 = 0x00080007, + NWC24_ISO_8859_9 = 0x00080009, + NWC24_SHIFT_JIS = 0x00020001, + NWC24_US_ASCII = 0x00000000, + NWC24_UTF_16BE = 0x00010010, + NWC24_UTF_32BE = 0x00010020, + NWC24_UTF_8 = 0x00010008, + NWC24_WINDOWS_1252 = 0x000F1252, + NWC24_CHARSET_UNKNOWN = 0xFFFFFFFF +} NWC24Charset; + +typedef enum { + NWC24_ENC_7BIT, + NWC24_ENC_8BIT, + NWC24_ENC_BASE64, + NWC24_ENC_QUOTED_PRINTABLE, + NWC24_MAX_ENCODINGS +} NWC24Encoding; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Utils.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Utils.h new file mode 100644 index 0000000000..bfaad36320 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NWC24/NWC24Utils.h @@ -0,0 +1,31 @@ +#ifndef RVL_SDK_NWC24_UTILS_H +#define RVL_SDK_NWC24_UTILS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct NWC24Data { + const void* ptr; // at 0x0 + u32 size; // at 0x4 +} NWC24Data; + +typedef struct NWC24Date { + u16 year; // at 0x0 + u8 month; // at 0x2 + u8 day; // at 0x3 + u8 hour; // at 0x4 + u8 sec; // at 0x5 + u8 min; // at 0x6 + u8 BYTE_0x7; +} NWC24Date; + +void NWC24Data_Init(NWC24Data* data); +void NWC24Data_SetDataP(NWC24Data* data, const void* ptr, u32 size); +void NWC24Date_Init(NWC24Date* date); +void NWC24iConvIdToStr(u64 addr, char* out); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD.h new file mode 100644 index 0000000000..308d5d8ba5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_PUBLIC_NDEV_EXI2_AD_H +#define RVL_SDK_PUBLIC_NDEV_EXI2_AD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/DebuggerDriver.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/DebuggerDriver.h new file mode 100644 index 0000000000..c9f3bd5b35 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/DebuggerDriver.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_NDEV_EXI2_AD_DEBUGGER_DRIVER_H +#define RVL_SDK_NDEV_EXI2_AD_DEBUGGER_DRIVER_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void DBInitComm(u8** flagOut, OSInterruptHandler handler); +void DBInitInterrupts(void); +u32 DBQueryData(void); +BOOL DBRead(void* dst, u32 size); +BOOL DBWrite(const void* src, u32 size); +void DBOpen(void); +void DBClose(void); + +static BOOL __DBReadMailbox(u32* mailOut) { + return __DBEXIReadReg(0x34000200, mailOut, sizeof(*mailOut)); +} + +static BOOL __DBRead(u32 ofs, void* dest, u32 size) { + return __DBEXIReadRam(((ofs + 0xD10000) * 0x40) & 0x3FFFFF00, dest, size); +} + +static BOOL __DBWriteMailbox(u32 mail) { + return __DBEXIWriteReg(0xB4000100, &mail, sizeof(mail)); +} + +static BOOL __DBWrite(u32 ofs, const void* src, u32 size) { + return __DBEXIWriteRam( + (((ofs + 0xD10000) * 0x40) & 0x3FFFFF00) | 0x80000000, src, size); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/ODEMU.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/ODEMU.h new file mode 100644 index 0000000000..05064cf7cf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/ODEMU.h @@ -0,0 +1,35 @@ +#ifndef RVL_SDK_NDEV_EXI2_AD_ODEMU_H +#define RVL_SDK_NDEV_EXI2_AD_ODEMU_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +static u32 ODEMUGenMailData(u32 ofs, u32 size) { + return (ofs & 0xff) << 0x10 | 0x1f000000 | size & 0x1fff; +} + +static u32 ODEMUGetPage(u32 mail) { + return (mail & 0xFF0000) >> 16; +} + +static u32 ODEMUGetPc2NngcOffset(u32 mail) { + if (!(ODEMUGetPage(mail) & 0x1)) { + return 0; + } + + return 0x800; +} + +static BOOL ODEMUIsValidMail(u32 mail) { + return (mail & 0x1F000000) == 0x1F000000; +} + +static u32 ODEMUGetSize(u32 mail) { + return mail & 0x1FFF; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/exi2.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/exi2.h new file mode 100644 index 0000000000..f8ca1d5cac --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/NdevExi2AD/exi2.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_NDEV_EXI2_AD_EXI2_H +#define RVL_SDK_NDEV_EXI2_AD_EXI2_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +BOOL __EXI2Imm(void* mem, s32 size, u32 type); +void __DBEXIInit(void); +BOOL __DBEXIReadReg(u32 cmd, void* mem, s32 size); +BOOL __DBEXIWriteReg(u32 cmd, const void* mem, s32 size); +BOOL __DBEXIReadRam(u32 cmd, void* mem, s32 size); +BOOL __DBEXIWriteRam(u32 cmd, const void* mem, s32 size); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS.h new file mode 100644 index 0000000000..ee337e7aca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS.h @@ -0,0 +1,46 @@ +/** + * References: YAGCD, WiiBrew, Dolphin Emulator + */ + +#ifndef RVL_SDK_PUBLIC_OS_H +#define RVL_SDK_PUBLIC_OS_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OS.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OS.h new file mode 100644 index 0000000000..aa54084815 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OS.h @@ -0,0 +1,89 @@ +#ifndef RVL_SDK_OS_H +#define RVL_SDK_OS_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + OS_CONSOLE_MASK = 0xF0000000, + OS_CONSOLE_MASK_RVL = 0x00000000, + OS_CONSOLE_MASK_EMU = 0x10000000, + OS_CONSOLE_MASK_TDEV = 0x20000000, + + OS_CONSOLE_RVL_PP_1 = 0x00000011, + OS_CONSOLE_RVL_PP_2_1 = 0x00000012, + OS_CONSOLE_RVL_PP_2_2 = 0x00000020, + + OS_CONSOLE_RVL_EMU = 0x10000008, + OS_CONSOLE_NDEV_1_0 = 0x10000010, + OS_CONSOLE_NDEV_1_1 = 0x10000011, + OS_CONSOLE_NDEV_1_2 = 0x10000012, + OS_CONSOLE_NDEV_2_0 = 0x10000020, + OS_CONSOLE_NDEV_2_1 = 0x10000021, +} OSConsoleType; + +typedef enum { + OS_APP_TYPE_IPL = 0x40, + OS_APP_TYPE_DVD = 0x80, + OS_APP_TYPE_CHANNEL = 0x81, +} OSAppType; + +typedef enum { + OS_EXC_SYSTEM_RESET, + OS_EXC_MACHINE_CHECK, + OS_EXC_DSI, + OS_EXC_ISI, + OS_EXC_EXT_INTERRUPT, + OS_EXC_ALIGNMENT, + OS_EXC_PROGRAM, + OS_EXC_FP_UNAVAIL, + OS_EXC_DECREMENTER, + OS_EXC_SYSTEM_CALL, + OS_EXC_TRACE, + OS_EXC_PERF_MONITOR, + OS_EXC_IABR, + OS_EXC_SMI, + OS_EXC_THERMAL_INT, + + OS_EXC_MAX +} OSExceptionType; + +typedef struct OSIOSRev { + u8 idHi; // at 0x0 + u8 idLo; // at 0x1 + u8 verMajor; // at 0x2 + u8 verMinor; // at 0x3 + u8 buildMon; // at 0x4 + u8 buildDay; // at 0x5 + u16 buildYear; // at 0x6 +} OSIOSRev; + +typedef void (*OSExceptionHandler)(u8 type, OSContext* ctx); + +extern BOOL __OSInIPL; +extern BOOL __OSInNandBoot; +extern BOOL __OSIsGcam; +extern s64 __OSStartTime; +extern OSExecParams __OSRebootParams; + +void __OSFPRInit(void); +u32 __OSGetHollywoodRev(void); +void __OSGetIOSRev(OSIOSRev* rev); +u32 OSGetConsoleType(void); +void OSInit(void); +OSExceptionHandler __OSSetExceptionHandler(u8 type, OSExceptionHandler handler); +OSExceptionHandler __OSGetExceptionHandler(u8 type); +void OSDefaultExceptionHandler(u8 type, OSContext* ctx); +void __OSPSInit(void); +u32 __OSGetDIConfig(void); +void OSRegisterVersion(const char* ver); +const char* OSGetAppGamename(void); +u8 OSGetAppType(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAddress.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAddress.h new file mode 100644 index 0000000000..1c22b717de --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAddress.h @@ -0,0 +1,23 @@ +#ifndef RVL_SDK_OS_ADDRESS_H +#define RVL_SDK_OS_ADDRESS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +static inline void* OSPhysicalToCached(u32 ofs) { + return (void*)(ofs + 0x80000000); +} + +static inline void* OSPhysicalToUncached(u32 ofs) { + return (void*)(ofs + 0xC0000000); +} + +static inline void* OSCachedToPhysical(const void* ofs) { + return (u8*)ofs - 0x80000000; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlarm.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlarm.h new file mode 100644 index 0000000000..16979643c7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlarm.h @@ -0,0 +1,43 @@ +#ifndef RVL_SDK_OS_ALARM_H +#define RVL_SDK_OS_ALARM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSAlarm OSAlarm; +typedef struct OSContext OSContext; + +typedef void (*OSAlarmHandler)(OSAlarm* alarm, OSContext* ctx); + +typedef struct OSAlarm { + OSAlarmHandler handler; // at 0x0 + u32 tag; // at 0x4 + s64 end; // at 0x8 + OSAlarm* prev; // at 0x10 + OSAlarm* next; // at 0x14 + s64 period; // at 0x18 + s64 start; // at 0x20 + void* userData; // at 0x28 +} OSAlarm; + +typedef struct OSAlarmQueue { + OSAlarm* head; // at 0x0 + OSAlarm* tail; // at 0x4 +} OSAlarmQueue; + +void __OSInitAlarm(void); +void OSCreateAlarm(OSAlarm* alarm); +void OSSetAlarm(OSAlarm* alarm, s64 tick, OSAlarmHandler handler); +void OSSetPeriodicAlarm(OSAlarm* alarm, s64 tick, s64 period, + OSAlarmHandler handler); +void OSCancelAlarm(OSAlarm* alarm); +void OSSetAlarmTag(OSAlarm* alarm, u32 tag); +void OSSetAlarmUserData(OSAlarm* alarm, void* userData); +void* OSGetAlarmUserData(const OSAlarm* alarm); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlloc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlloc.h new file mode 100644 index 0000000000..608cc2653e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAlloc.h @@ -0,0 +1,19 @@ +#ifndef RVL_SDK_OS_ALLOC_H +#define RVL_SDK_OS_ALLOC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern volatile s32 __OSCurrHeap; + +void* OSAllocFromHeap(s32 handle, s32 size); +void OSFreeToHeap(s32 handle, void* p); +s32 OSSetCurrentHeap(s32 handle); +void* OSInitAlloc(void* start, void* end, s32 numHeaps); +s32 OSCreateHeap(void* start, void* end); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSArena.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSArena.h new file mode 100644 index 0000000000..18f5ea3fc0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSArena.h @@ -0,0 +1,29 @@ +#ifndef RVL_SDK_OS_ARENA_H +#define RVL_SDK_OS_ARENA_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void* OSGetMEM1ArenaHi(void); +void* OSGetMEM2ArenaHi(void); +void* OSGetArenaHi(void); + +void* OSGetMEM1ArenaLo(void); +void* OSGetMEM2ArenaLo(void); +void* OSGetArenaLo(void); + +void OSSetMEM1ArenaHi(void* hi); +void OSSetMEM2ArenaHi(void* hi); +void OSSetArenaHi(void* hi); + +void OSSetMEM1ArenaLo(void* lo); +void OSSetMEM2ArenaLo(void* lo); +void OSSetArenaLo(void* lo); + +void* OSAllocFromMEM1ArenaLo(size_t size, u32 align); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAudioSystem.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAudioSystem.h new file mode 100644 index 0000000000..0e4356174f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSAudioSystem.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_OS_AUDIOSYSTEM_H +#define RVL_SDK_OS_AUDIOSYSTEM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __OSInitAudioSystem(void); +void __OSStopAudioSystem(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSCache.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSCache.h new file mode 100644 index 0000000000..71d46691a4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSCache.h @@ -0,0 +1,44 @@ +#ifndef RVL_SDK_OS_CACHE_H +#define RVL_SDK_OS_CACHE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_CACHE_BASE 0xE0000000 + +// Forward declarations +typedef struct OSContext OSContext; + +void DCEnable(void); +void DCInvalidateRange(const void* buf, u32 len); +void DCFlushRange(const void* buf, u32 len); +void DCStoreRange(const void* buf, u32 len); +void DCFlushRangeNoSync(const void* buf, u32 len); +void DCStoreRangeNoSync(const void* buf, u32 len); +void DCZeroRange(const void* buf, u32 len); + +void ICInvalidateRange(const void* buf, u32 len); +void ICFlashInvalidate(void); +void ICEnable(void); + +void LCEnable(void); +void LCDisable(void); +void LCLoadBlocks(void* dst, const void* src, u32 blocks); +void LCStoreBlocks(void* dst, const void* src, u32 blocks); +u32 LCStoreData(void* dst, const void* src, u32 len); +u32 LCQueueLength(void); +void LCQueueWait(u32 n); + +void L2Enable(void); +void L2Disable(void); +void L2GlobalInvalidate(void); + +void DMAErrorHandler(u8 error, OSContext* ctx, u32 dsisr, u32 dar, ...); + +void __OSCacheInit(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSContext.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSContext.h new file mode 100644 index 0000000000..8214400cb5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSContext.h @@ -0,0 +1,46 @@ +#ifndef RVL_SDK_OS_CONTEXT_H +#define RVL_SDK_OS_CONTEXT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + OS_CONTEXT_STATE_FP_SAVED = (1 << 0), +} OSContextState; + +typedef struct OSContext { + u32 gprs[32]; // at 0x0 + u32 cr; // at 0x80 + u32 lr; // at 0x84 + u32 ctr; // at 0x88 + u32 xer; // at 0x8C + f64 fprs[32]; // at 0x90 + u32 fpscr_pad; // at 0x190 + u32 fpscr; // at 0x194 + u32 srr0; // at 0x198 + u32 srr1; // at 0x19C + u16 mode; // at 0x1A0 + u16 state; // at 0x1A2 + u32 gqrs[8]; // at 0x1A4 + u32 psf_pad; // at 0x1C4 + f64 psfs[32]; // at 0x1C8 +} OSContext; + +void OSSaveFPUContext(OSContext* ctx); +void OSSetCurrentContext(OSContext* ctx); +OSContext* OSGetCurrentContext(void); +BOOL OSSaveContext(OSContext* ctx); +void OSLoadContext(OSContext* ctx); +void* OSGetStackPointer(void); +void OSSwitchFiber(void* func, void* stack); +void OSSwitchFiberEx(u32 r3, u32 r4, u32 r5, u32 r6, void* func, void* stack); +void OSClearContext(OSContext* ctx); +void OSInitContext(OSContext* ctx, void* _srr0, void* stack); +void OSDumpContext(const OSContext* ctx); +void __OSContextInit(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSError.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSError.h new file mode 100644 index 0000000000..6b1cb4b0b3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSError.h @@ -0,0 +1,54 @@ +#ifndef RVL_SDK_OS_ERROR_H +#define RVL_SDK_OS_ERROR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSContext OSContext; + +#define OSError(...) OSPanic(__FILE__, __LINE__, __VA_ARGS__) + +#define OS_ASSERT(exp, ...) \ + if (!(exp)) \ + OSPanic(__FILE__, __LINE__, __VA_ARGS__) + +typedef enum { + OS_ERR_SYSTEM_RESET, + OS_ERR_MACHINE_CHECK, + OS_ERR_DSI, + OS_ERR_ISI, + OS_ERR_EXT_INTERRUPT, + OS_ERR_ALIGNMENT, + OS_ERR_PROGRAM, + OS_ERR_FP_UNAVAIL, + OS_ERR_DECREMENTER, + OS_ERR_SYSTEM_CALL, + OS_ERR_TRACE, + OS_ERR_PERF_MONITOR, + OS_ERR_IABR, + OS_ERR_SMI, + OS_ERR_THERMAL_INT, + OS_ERR_PROTECTION, + OS_ERR_FP_EXCEPTION, + + OS_ERR_MAX +} OSErrorType; + +typedef void (*OSErrorHandler)(u8 error, OSContext* ctx, u32 dsisr, u32 dar, + ...); + +extern OSErrorHandler __OSErrorTable[OS_ERR_MAX]; +extern u32 __OSFpscrEnableBits; + +DECL_WEAK void OSReport(const char* msg, ...); +DECL_WEAK void OSPanic(const char* file, int line, const char* msg, ...); + +OSErrorHandler OSSetErrorHandler(u16 error, OSErrorHandler handler); +void __OSUnhandledException(u8 error, OSContext* ctx, u32 dsisr, u32 dar); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSExec.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSExec.h new file mode 100644 index 0000000000..9854f62658 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSExec.h @@ -0,0 +1,25 @@ +#ifndef RVL_SDK_OS_EXEC_H +#define RVL_SDK_OS_EXEC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSExecParams { + UNKWORD WORD_0x0; + UNKWORD WORD_0x4; + char UNK_0x8[0x4]; + void* regionStart; // at 0xC + void* regionEnd; // at 0x10 + char UNK_0x14[0x1C - 0x14]; +} OSExecParams; + +extern BOOL __OSInReboot; + +void __OSGetExecParams(OSExecParams* out); +void __OSLaunchMenu(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFastCast.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFastCast.h new file mode 100644 index 0000000000..c54b796d03 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFastCast.h @@ -0,0 +1,183 @@ +#ifndef RVL_SDK_OS_FAST_CAST_H +#define RVL_SDK_OS_FAST_CAST_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_GQR_TYPE_U8 4 +#define OS_GQR_TYPE_U16 5 +#define OS_GQR_TYPE_S8 6 +#define OS_GQR_TYPE_S16 7 + +static inline void OSInitFastCast(void) { + // clang-format off + asm { + li r3, 4 + oris r3, r3, 4 + mtspr 0x392, r3 + + li r3, 5 + oris r3, r3, 5 + mtspr 0x393, r3 + + li r3, 6 + oris r3, r3, 6 + mtspr 0x394, r3 + + li r3, 7 + oris r3, r3, 7 + mtspr 0x395, r3 + } + // clang-format on +} + +static inline void OSSetGQR6(register u32 type, register u32 scale) { + register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type); + + // clang-format off + asm { + mtspr 0x396, val + } + // clang-format on +} + +static inline void OSSetGQR7(register u32 type, register u32 scale) { + register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type); + + // clang-format off + asm { + mtspr 0x397, val + } + // clang-format on +} + +/****************************************************************************** + * + * Convert from U8 + * + ******************************************************************************/ +static inline f32 __OSu8tof32(register u8* in) { + register f32 ret; + + // clang-format off + asm { + psq_l ret, 0(in), 1, 2 + } + // clang-format on + + return ret; +} + +static inline void OSu8tof32(u8* in, volatile f32* out) { + *out = __OSu8tof32(in); +} + +/****************************************************************************** + * + * Convert from U16 + * + ******************************************************************************/ +static inline f32 __OSu16tof32(register u16* arg) { + register f32 ret; + + // clang-format off + asm { + psq_l ret, 0(arg), 1, 3 + } + // clang-format on + + return ret; +} + +static inline void OSu16tof32(u16* in, volatile f32* out) { + *out = __OSu16tof32(in); +} + +/****************************************************************************** + * + * Convert from S16 + * + ******************************************************************************/ +static inline f32 __OSs16tof32(register s16* arg) { + register f32 ret; + + // clang-format off + asm { + psq_l ret, 0(arg), 1, 5 + } + // clang-format on + + return ret; +} + +static inline void OSs16tof32(s16* in, volatile f32* out) { + *out = __OSs16tof32(in); +} + +/****************************************************************************** + * + * Convert from F32 + * + ******************************************************************************/ +static inline u8 __OSf32tou8(register f32 arg) { + f32 a; + register f32* ptr = &a; + u8 r; + + // clang-format off + asm { + psq_st arg, 0(ptr), 1, 2 + } + // clang-format on + + r = *(u8*)ptr; + return r; +} + +static inline void OSf32tou8(f32* in, volatile u8* out) { + *out = __OSf32tou8(*in); +} + +static inline u16 __OSf32tou16(register f32 arg) { + f32 a; + register f32* ptr = &a; + u16 r; + + // clang-format off + asm { + psq_st arg, 0(ptr), 1, 3 + } + // clang-format on + + r = *(u16*)ptr; + return r; +} + +static inline void OSf32tou16(f32* in, volatile u16* out) { + *out = __OSf32tou16(*in); +} + +static inline s16 __OSf32tos16(register f32 arg) { + f32 a; + register f32* ptr = &a; + s16 r; + + // clang-format off + asm { + psq_st arg, 0(ptr), 1, 5 + } + // clang-format on + + r = *(s16*)ptr; + return r; +} + +static inline void OSf32tos16(f32* in, volatile s16* out) { + *out = __OSf32tos16(*in); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFatal.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFatal.h new file mode 100644 index 0000000000..e1c6a6f35e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFatal.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_OS_FATAL_H +#define RVL_SDK_OS_FATAL_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +void OSFatal(GXColor textColor, GXColor bgColor, const char* msg); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFont.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFont.h new file mode 100644 index 0000000000..cb11f885dd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSFont.h @@ -0,0 +1,57 @@ +#ifndef RVL_SDK_OS_FONT_H +#define RVL_SDK_OS_FONT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + OS_FONT_ENCODE_ANSI, + OS_FONT_ENCODE_SJIS, + OS_FONT_ENCODE_2, + OS_FONT_ENCODE_UTF8, + OS_FONT_ENCODE_UTF16, + OS_FONT_ENCODE_UTF32, + OS_FONT_ENCODE_MAX +} OSFontEncode; + +typedef struct OSFontHeader { + u16 type; // at 0x0 + u16 firstChar; // at 0x2 + u16 lastChar; // at 0x4 + u16 invalidChar; // at 0x6 + u16 ascent; // at 0x8 + u16 descent; // at 0xA + u16 width; // at 0xC + u16 leading; // at 0xE + u16 cellWidth; // at 0x10 + u16 cellHeight; // at 0x12 + u32 sheetSize; // at 0x14 + u16 sheetFormat; // at 0x18 + u16 sheetNumCol; // at 0x1A + u16 sheetNumRow; // at 0x1C + u16 sheetWidth; // at 0x1E + u16 sheetHeight; // at 0x20 + u16 widthTableOfs; // at 0x22 + u32 sheetImageOfs; // at 0x24 + u32 sheetFullSize; // at 0x28 + u8 c0; // at 0x2C + u8 c1; // at 0x2D + u8 c2; // at 0x2E + u8 c3; // at 0x2F +} OSFontHeader; + +u16 OSGetFontEncode(void); +u16 OSSetFontEncode(u16 encode); +u32 OSLoadFont(OSFontHeader* font, void* dst); +const char* OSGetFontTexel(const char* str, void* dst, s32 xOfs, s32 arg3, + u32* widthOut); +BOOL OSInitFont(OSFontHeader* font); +const char* OSGetFontTexture(const char* str, void** texOut, u32* xOut, + u32* yOut, u32* widthOut); +const char* OSGetFontWidth(const char* str, u32* widthOut); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSHardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSHardware.h new file mode 100644 index 0000000000..1f5fb991e9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSHardware.h @@ -0,0 +1,295 @@ +/** + * For more details, see: + * https://www.gc-forever.com/yagcd/chap4.html#sec4 + * https://www.gc-forever.com/yagcd/chap13.html#sec13 + * https://wiibrew.org/wiki/Memory_map + */ + +#ifndef RVL_SDK_OS_HARDWARE_H +#define RVL_SDK_OS_HARDWARE_H +#include + +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSContext OSContext; +typedef struct OSExecParams OSExecParams; + +// Derive offsets for use with OSAddress functions +#define __DEF_ADDR_OFFSETS(name, addr) \ + static const u32 OS_PHYS_##name = (addr) - 0x80000000; \ + static const u32 OS_CACHED_##name = (addr); \ + static const u32 OS_UNCACHED_##name = (addr) + (0xC0000000 - 0x80000000); + +// MWCC compiler extension to map global variables to particular +// memory addresses. Unsupported compilers must not include this +#ifdef __MWERKS__ +#define MEMORY_MAP_EXT(addr) : (addr) +#else +#define MEMORY_MAP_EXT(addr) +#endif + +// Define a global variable in *CACHED* MEM1. +// Can be accessed directly or with OSAddress functions. +#define OS_DEF_GLOBAL_VAR(type, name, addr) \ + /* Memory-mapped value for direct access */ \ + type OS_##name MEMORY_MAP_EXT(addr); \ + __DEF_ADDR_OFFSETS(name, addr) + +// Define a global array in *CACHED* MEM1. +// Can be accessed directly or with OSAddress functions. +#define OS_DEF_GLOBAL_ARR(type, name, arr, addr) \ + /* Memory-mapped value for direct access */ \ + type OS_##name arr MEMORY_MAP_EXT(addr); \ + __DEF_ADDR_OFFSETS(name, addr) + +// Define an global variable in the hardware-register range. +#define OS_DEF_HW_REG(type, name, addr) \ + /* Memory-mapped value for direct access */ \ + type OS_##name MEMORY_MAP_EXT(addr); + +typedef enum { + OS_BOOT_MAGIC_BOOTROM = 0xD15EA5E, + OS_BOOT_MAGIC_JTAG = 0xE5207C22, +} OSBootMagic; + +typedef struct OSBootInfo { + DVDDiskID diskID; // at 0x0 + u32 bootMagic; // at 0x20 + u32 aplVersion; // at 0x24 + u32 physMemSize; // at 0x28 + u32 consoleType; // at 0x2C + void* arenaLo; // at 0x30 + void* arenaHi; // at 0x34 + void* fstStart; // at 0x38 + u32 fstSize; // at 0x3C +} OSBootInfo; + +typedef struct OSDebugInterface { + BOOL usingDebugger; // at 0x0 + u32 exceptionMask; // at 0x4 + void* exceptionHook; // at 0x8 + void* exceptionHookLR; // at 0xC +} OSDebugInterface; + +typedef struct OSBI2 { + u32 dbgMonitorSize; // at 0x0 + u32 simulatedMemSize; // at 0x4 + u32 argumentOfs; // at 0x8 + u32 debugFlag; // at 0xC + u32 trackLocation; // at 0x10 + u32 trackSize; // at 0x14 + u32 countryCode; // at 0x18 + u32 WORD_0x1C; + u32 lastInsert; + u32 padSpec; // at 0x24 + u32 totalTextDataLimit; // at 0x28 + u32 simulatedMem2Size; // at 0x2C +} OSBI2; + +/** + * 0x80000000 - 0x80000100 + */ +// clang-format off +OS_DEF_GLOBAL_VAR(OSBootInfo, BOOT_INFO, 0x80000000); +OS_DEF_GLOBAL_VAR(OSDebugInterface, DEBUG_INTERFACE, 0x80000040); +OS_DEF_GLOBAL_ARR(u8, DB_INTEGRATOR_HOOK, [0x24], 0x80000060); +OS_DEF_GLOBAL_VAR(OSContext*, CURRENT_CONTEXT_PHYS, 0x800000C0); +OS_DEF_GLOBAL_VAR(u32, PREV_INTR_MASK, 0x800000C4); +OS_DEF_GLOBAL_VAR(u32, CURRENT_INTR_MASK, 0x800000C8); +OS_DEF_GLOBAL_VAR(u32, TV_FORMAT, 0x800000CC); +OS_DEF_GLOBAL_VAR(u32, ARAM_SIZE, 0x800000D0); +OS_DEF_GLOBAL_VAR(OSContext*, CURRENT_CONTEXT, 0x800000D4); +OS_DEF_GLOBAL_VAR(OSContext*, CURRENT_FPU_CONTEXT, 0x800000D8); +OS_DEF_GLOBAL_VAR(OSThreadQueue, THREAD_QUEUE, 0x800000DC); +OS_DEF_GLOBAL_VAR(OSThread*, CURRENT_THREAD, 0x800000E4); +OS_DEF_GLOBAL_VAR(u32, DEBUG_MONITOR_SIZE, 0x800000E8); +OS_DEF_GLOBAL_VAR(void*, DEBUG_MONITOR, 0x800000EC); +OS_DEF_GLOBAL_VAR(u32, SIMULATED_MEM_SIZE, 0x800000F0); +OS_DEF_GLOBAL_VAR(OSBI2*, DVD_BI2, 0x800000F4); +OS_DEF_GLOBAL_VAR(u32, BUS_CLOCK_SPEED, 0x800000F8); +OS_DEF_GLOBAL_VAR(u32, CPU_CLOCK_SPEED, 0x800000FC); +// clang-format on + +/** + * 0x80003000 - 0x80003F00 + */ +// clang-format off +OS_DEF_GLOBAL_ARR(void*, EXCEPTION_TABLE, [15], 0x80003000); +OS_DEF_GLOBAL_VAR(void*, INTR_HANDLER_TABLE, 0x80003040); +OS_DEF_GLOBAL_ARR(volatile s32, EXI_LAST_INSERT, [], 0x800030C0); +OS_DEF_GLOBAL_VAR(void*, FIRST_REL, 0x800030C8); +OS_DEF_GLOBAL_VAR(void*, LAST_REL, 0x800030CC); +OS_DEF_GLOBAL_VAR(void*, REL_NAME_TABLE, 0x800030D0); +OS_DEF_GLOBAL_VAR(u32, DOL_TOTAL_TEXT_DATA, 0x800030D4); +OS_DEF_GLOBAL_VAR(s64, SYSTEM_TIME, 0x800030D8); +OS_DEF_GLOBAL_VAR(u8, PAD_FLAGS, 0x800030E3); +OS_DEF_GLOBAL_VAR(u16, GC_PAD_3_BTN, 0x800030E4); +OS_DEF_GLOBAL_VAR(volatile u16, DVD_DEVICE_CODE, 0x800030E6); +OS_DEF_GLOBAL_VAR(u8, BI2_DEBUG_FLAG, 0x800030E8); +OS_DEF_GLOBAL_VAR(u8, PAD_SPEC, 0x800030E9); +OS_DEF_GLOBAL_VAR(OSExecParams*, DOL_EXEC_PARAMS, 0x800030F0); +OS_DEF_GLOBAL_VAR(u32, PHYSICAL_MEM1_SIZE, 0x80003100); +OS_DEF_GLOBAL_VAR(u32, SIMULATED_MEM1_SIZE, 0x80003104); +OS_DEF_GLOBAL_VAR(void*, USABLE_MEM1_START, 0x8000310C); +OS_DEF_GLOBAL_VAR(void*, USABLE_MEM1_END, 0x80003110); +OS_DEF_GLOBAL_VAR(u32, PHYSICAL_MEM2_SIZE, 0x80003118); +OS_DEF_GLOBAL_VAR(u32, SIMULATED_MEM2_SIZE, 0x8000311C); +OS_DEF_GLOBAL_VAR(void*, ACCESSIBLE_MEM2_END, 0x80003120); +OS_DEF_GLOBAL_VAR(void*, USABLE_MEM2_START, 0x80003124); +OS_DEF_GLOBAL_VAR(void*, USABLE_MEM2_END, 0x80003128); +OS_DEF_GLOBAL_VAR(void*, IPC_BUFFER_START, 0x80003130); +OS_DEF_GLOBAL_VAR(void*, IPC_BUFFER_END, 0x80003134); +OS_DEF_GLOBAL_VAR(u32, HOLLYWOOD_REV, 0x80003138); +OS_DEF_GLOBAL_VAR(u32, IOS_VERSION, 0x80003140); +OS_DEF_GLOBAL_VAR(u32, IOS_BUILD_DATE, 0x80003144); +OS_DEF_GLOBAL_VAR(void*, IOS_HEAP_START, 0x80003148); +OS_DEF_GLOBAL_VAR(void*, IOS_HEAP_END, 0x8000314C); +OS_DEF_GLOBAL_VAR(u32, GDDR_VENDOR_CODE, 0x80003158); +OS_DEF_GLOBAL_VAR(u8, BOOT_PROGRAM_TARGET, 0x8000315C); +OS_DEF_GLOBAL_VAR(u8, APPLOADER_TARGET, 0x8000315D); +OS_DEF_GLOBAL_VAR(BOOL, MIOS_SHUTDOWN_FLAG, 0x80003164); +OS_DEF_GLOBAL_VAR(u32, CURRENT_APP_NAME, 0x80003180); +OS_DEF_GLOBAL_VAR(u8, CURRENT_APP_TYPE, 0x80003184); +OS_DEF_GLOBAL_VAR(u32, MINIMUM_IOS_VERSION, 0x80003188); +OS_DEF_GLOBAL_VAR(u32, NAND_TITLE_LAUNCH_CODE, 0x8000318C); +OS_DEF_GLOBAL_VAR(u32, NAND_TITLE_RETURN_CODE, 0x80003190); +OS_DEF_GLOBAL_VAR(u32, BOOT_PARTITION_TYPE, 0x80003194); +OS_DEF_GLOBAL_VAR(u32, BOOT_PARTITION_OFFSET, 0x80003198); +OS_DEF_GLOBAL_ARR(u8, NWC24_USER_ID_BUFFER, [32], 0x800031C0); +OS_DEF_GLOBAL_VAR(u64, NWC24_USER_ID, 0x800031C0); +OS_DEF_GLOBAL_ARR(u8, SC_PRDINFO, [0x100], 0x80003800); +// clang-format on + +/** + * PI hardware globals + */ +volatile u32 PI_HW_REGS[] +#ifdef __MWERKS__ +: 0xCC003000 +#endif +; + +typedef enum { + PI_INTSR, //!< 0xCC003000 + PI_INTMR, //!< 0xCC003004 + PI_REG_0x8, //!< 0xCC003008 + PI_REG_0xC, //!< 0xCC00300C + PI_REG_0x10, //!< 0xCC003010 + PI_REG_0x14, //!< 0xCC003014 + PI_REG_0x18, //!< 0xCC003018 + PI_REG_0x1C, //!< 0xCC00301C + PI_REG_0x20, //!< 0xCC003020 + PI_RESET, //!< 0xCC003024 + // . . . +} PIHwReg; + +// INTSR - Interrupt Cause Register +#define PI_INTSR_ERROR (1 << 0) +#define PI_INTSR_RSW (1 << 1) +#define PI_INTSR_DI (1 << 2) +#define PI_INTSR_SI (1 << 3) +#define PI_INTSR_EXI (1 << 4) +#define PI_INTSR_AI (1 << 5) +#define PI_INTSR_DSP (1 << 6) +#define PI_INTSR_MEM (1 << 7) +#define PI_INTSR_VI (1 << 8) +#define PI_INTSR_PE_TOKEN (1 << 9) +#define PI_INTSR_PE_FINISH (1 << 10) +#define PI_INTSR_CP (1 << 11) +#define PI_INTSR_DEBUG (1 << 12) +#define PI_INTSR_HSP (1 << 13) +#define PI_INTSR_ACR (1 << 14) +#define PI_INTSR_RSWST (1 << 16) + +// INTMR - Interrupt Mask Register +#define PI_INTMR_ERROR (1 << 0) +#define PI_INTMR_RSW (1 << 1) +#define PI_INTMR_DI (1 << 2) +#define PI_INTMR_SI (1 << 3) +#define PI_INTMR_EXI (1 << 4) +#define PI_INTMR_AI (1 << 5) +#define PI_INTMR_DSP (1 << 6) +#define PI_INTMR_MEM (1 << 7) +#define PI_INTMR_VI (1 << 8) +#define PI_INTMR_PE_TOKEN (1 << 9) +#define PI_INTMR_PE_FINISH (1 << 10) +#define PI_INTMR_CP (1 << 11) +#define PI_INTMR_DEBUG (1 << 12) +#define PI_INTMR_HSP (1 << 13) +#define PI_INTMR_ACR (1 << 14) + +/** + * MI hardware registers + */ +volatile u16 MI_HW_REGS[] +#ifdef __MWERKS__ +: 0xCC004000 +#endif +; +typedef enum { + MI_PAGE_MEM0_H, //!< 0xCC004000 + MI_PAGE_MEM0_L, //!< 0xCC004002 + MI_PAGE_MEM1_H, //!< 0xCC004004 + MI_PAGE_MEM1_L, //!< 0xCC004006 + MI_PAGE_MEM2_H, //!< 0xCC004008 + MI_PAGE_MEM2_L, //!< 0xCC00400A + MI_PAGE_MEM3_H, //!< 0xCC00400C + MI_PAGE_MEM3_L, //!< 0xCC00400E + MI_PROT_MEM0, //!< 0xCC004010 + MI_PROT_MEM1, //!< 0xCC004012 + MI_PROT_MEM2, //!< 0xCC004014 + MI_PROT_MEM3, //!< 0xCC004016 + MI_REG_0x18, //!< 0xCC004018 + MI_REG_0x1A, //!< 0xCC00401A + MI_INTMR, //!< 0xCC00401C + MI_INTSR, //!< 0xCC00401E + MI_REG_0x20, //!< 0xCC004020 + MI_ADDRLO, //!< 0xCC004022 + MI_ADDRHI, //!< 0xCC004024 + MI_REG_0x26, //!< 0xCC004026 + MI_REG_0x28, //!< 0xCC004028 + // . . . +} MIHwReg; + +// INTMR - Interrupt Mask Register +#define MI_INTMR_MEM0 (1 << 0) +#define MI_INTMR_MEM1 (1 << 1) +#define MI_INTMR_MEM2 (1 << 2) +#define MI_INTMR_MEM3 (1 << 3) +#define MI_INTMR_ADDR (1 << 4) + +// INTSR - Interrupt Cause Register +#define MI_INTSR_MEM0 (1 << 0) +#define MI_INTSR_MEM1 (1 << 1) +#define MI_INTSR_MEM2 (1 << 2) +#define MI_INTSR_MEM3 (1 << 3) +#define MI_INTSR_ADDR (1 << 4) + +/** + * DI hardware globals + */ +// clang-format off +OS_DEF_HW_REG(volatile u32, DI_DMA_ADDR, 0xCD006014); +OS_DEF_HW_REG(volatile u32, DI_CONFIG, 0xCD006024); +// clang-format on + +/** + * Misc/unknown globals + */ +// clang-format off +OS_DEF_HW_REG(volatile u32, UNK_CD000034, 0xCD000034); +OS_DEF_HW_REG(volatile u32, UNK_CD800180, 0xCD800180); +OS_DEF_HW_REG(volatile u32, UNK_CD8001CC, 0xCD8001CC); +OS_DEF_HW_REG(volatile u32, UNK_CD8001D0, 0xCD8001D0); +// clang-format on + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSInterrupt.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSInterrupt.h new file mode 100644 index 0000000000..fb8daef13e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSInterrupt.h @@ -0,0 +1,77 @@ +#ifndef RVL_SDK_OS_INTERRUPT_H +#define RVL_SDK_OS_INTERRUPT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declarations +typedef struct OSContext OSContext; + +// Create mask from interrupt ID +#define OS_INTR_MASK(intr) (1 << (31 - intr)) + +typedef enum { + OS_INTR_MEM_0, + OS_INTR_MEM_1, + OS_INTR_MEM_2, + OS_INTR_MEM_3, + OS_INTR_MEM_ADDRESS, + OS_INTR_DSP_AI, + OS_INTR_DSP_ARAM, + OS_INTR_DSP_DSP, + OS_INTR_AI_AI, + OS_INTR_EXI_0_EXI, + OS_INTR_EXI_0_TC, + OS_INTR_EXI_0_EXT, + OS_INTR_EXI_1_EXI, + OS_INTR_EXI_1_TC, + OS_INTR_EXI_1_EXT, + OS_INTR_EXI_2_EXI, + OS_INTR_EXI_2_TC, + OS_INTR_PI_CP, + OS_INTR_PI_PE_TOKEN, + OS_INTR_PI_PE_FINISH, + OS_INTR_PI_SI, + OS_INTR_PI_DI, + OS_INTR_PI_RSW, + OS_INTR_PI_ERROR, + OS_INTR_PI_VI, + OS_INTR_PI_DEBUG, + OS_INTR_PI_HSP, + OS_INTR_PI_ACR, + OS_INTR_28, + OS_INTR_29, + OS_INTR_30, + OS_INTR_31, + + OS_INTR_MAX +} OSInterruptType; + +typedef void (*OSInterruptHandler)(s16 intr, OSContext* ctx); + +extern u32 __OSLastInterruptSrr0; +extern s16 __OSLastInterrupt; +extern s64 __OSLastInterruptTime; + +BOOL OSDisableInterrupts(void); +BOOL OSEnableInterrupts(void); +BOOL OSRestoreInterrupts(BOOL status); + +OSInterruptHandler __OSSetInterruptHandler(OSInterruptType type, + OSInterruptHandler handler); +OSInterruptHandler __OSGetInterruptHandler(OSInterruptType type); + +void __OSInterruptInit(void); + +u32 __OSMaskInterrupts(u32 userMask); +u32 __OSUnmaskInterrupts(u32 userMask); +void __OSDispatchInterrupt(u8 intr, OSContext* ctx); + +void __RAS_OSDisableInterrupts_begin(void); +void __RAS_OSDisableInterrupts_end(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSIpc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSIpc.h new file mode 100644 index 0000000000..c21406a46b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSIpc.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_OS_IPC_H +#define RVL_SDK_OS_IPC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void* __OSGetIPCBufferHi(void); +void* __OSGetIPCBufferLo(void); +void __OSInitIPCBuffer(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSLink.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSLink.h new file mode 100644 index 0000000000..dfb7e82ffb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSLink.h @@ -0,0 +1,45 @@ +#ifndef RVL_SDK_OS_LINK_H +#define RVL_SDK_OS_LINK_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +struct OSModuleHeader { + u32 id; + u32 linkNext; + u32 linkPrev; + u32 numSections; + u32 sectionInfoOffset; + u32 nameOffset; + u32 nameSize; + u32 version; + + u32 bssSize; + u32 relOffset; + u32 impOffset; + u32 impSize; + + char prologSection; + char epilogSection; + char unresolvedSection; + char bssSection; + + u32 prologOffset; + u32 epilogOffset; + u32 unresolvedOffset; + + u32 moduleAlign; + u32 bssAlign; + + u32 commandOffset; +}; + +void __OSModuleInit(void); + +bool OSUnlink(OSModuleHeader* module); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMemory.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMemory.h new file mode 100644 index 0000000000..e0a7b579b2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMemory.h @@ -0,0 +1,23 @@ +#ifndef RVL_SDK_OS_MEMORY_H +#define RVL_SDK_OS_MEMORY_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_MEM_MB_TO_B(mb) ((mb)*1024 * 1024) +#define OS_MEM_B_TO_MB(mb) ((mb) / 1024 / 1024) + +#define OSIsMEM1Region(addr) (((u32)(addr)&0x30000000) == 0) +#define OSIsMEM2Region(addr) (((u32)(addr)&0x30000000) == 0x10000000) + +u32 OSGetPhysicalMem1Size(void); +u32 OSGetPhysicalMem2Size(void); +u32 OSGetConsoleSimulatedMem1Size(void); +u32 OSGetConsoleSimulatedMem2Size(void); +void __OSInitMemoryProtection(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMessage.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMessage.h new file mode 100644 index 0000000000..b4318fadc2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMessage.h @@ -0,0 +1,31 @@ +#ifndef RVL_SDK_OS_MESSAGE_H +#define RVL_SDK_OS_MESSAGE_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// General-purpose typedef +typedef void* OSMessage; + +typedef enum { OS_MSG_BLOCKING = (1 << 0) } OSMessageFlags; + +typedef struct OSMessageQueue { + OSThreadQueue sendQueue; // at 0x0 + OSThreadQueue recvQueue; // at 0x8 + OSMessage* buffer; // at 0x10 + s32 capacity; // at 0x14 + s32 front; // at 0x18 + s32 size; // at 0x1C +} OSMessageQueue; + +void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* buffer, s32 capacity); +BOOL OSSendMessage(OSMessageQueue* queue, OSMessage mesg, u32 flags); +BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* mesg, u32 flags); +BOOL OSJamMessage(OSMessageQueue* queue, OSMessage mesg, u32 flags); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMutex.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMutex.h new file mode 100644 index 0000000000..4e91e09eaf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSMutex.h @@ -0,0 +1,33 @@ +#ifndef RVL_SDK_OS_MUTEX_H +#define RVL_SDK_OS_MUTEX_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSMutex { + OSThreadQueue queue; // at 0x0 + OSThread* thread; // at 0x8 + s32 lock; // at 0xC + struct OSMutex* next; // at 0x10 + struct OSMutex* prev; // at 0x14 +} OSMutex; + +typedef struct OSCond { + OSThreadQueue queue; // at 0x0 +} OSCond; + +void OSInitMutex(OSMutex* mutex); +void OSLockMutex(OSMutex* mutex); +void OSUnlockMutex(OSMutex* mutex); +void __OSUnlockAllMutex(OSThread* thread); +BOOL OSTryLockMutex(OSMutex* mutex); +void OSInitCond(OSCond* cond); +void OSWaitCond(OSCond* cond, OSMutex* mutex); +void OSSignalCond(OSCond* cond); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSNet.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSNet.h new file mode 100644 index 0000000000..1dfe6df3c2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSNet.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_OS_NET_H +#define RVL_SDK_OS_NET_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __OSInitNet(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSPlayRecord.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSPlayRecord.h new file mode 100644 index 0000000000..5f6f8298fa --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSPlayRecord.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_OS_PLAY_RECORD_H +#define RVL_SDK_OS_PLAY_RECORD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __OSStartPlayRecord(void); +void __OSStopPlayRecord(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSReset.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSReset.h new file mode 100644 index 0000000000..6186dbc79a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSReset.h @@ -0,0 +1,41 @@ +#ifndef RVL_SDK_OS_RESET_H +#define RVL_SDK_OS_RESET_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef BOOL (*OSShutdownFunction)(BOOL final, u32 event); + +typedef enum { + OS_SD_EVENT_SHUTDOWN = 2, + OS_SD_EVENT_RESTART = 4, + OS_SD_EVENT_RETURN_TO_MENU = 5, + OS_SD_EVENT_LAUNCH_APP = 6, +} OSShutdownEvent; + +typedef struct OSShutdownFunctionInfo { + OSShutdownFunction func; // at 0x0 + u32 prio; // at 0x4 + struct OSShutdownFunctionInfo* next; // at 0x8 + struct OSShutdownFunctionInfo* prev; // at 0xC +} OSShutdownFunctionInfo; + +typedef struct OSShutdownFunctionQueue { + OSShutdownFunctionInfo* head; // at 0x0 + OSShutdownFunctionInfo* tail; // at 0x4 +} OSShutdownFunctionQueue; + +void OSRegisterShutdownFunction(OSShutdownFunctionInfo* info); +BOOL __OSCallShutdownFunctions(u32 pass, u32 event); +void __OSShutdownDevices(u32 event); +void __OSGetDiscState(u8* out); +void OSShutdownSystem(void); +void OSReturnToMenu(void); +u32 OSGetResetCode(void); +void OSResetSystem(u32 arg0, u32 arg1, u32 arg2); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSRtc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSRtc.h new file mode 100644 index 0000000000..efc334bd34 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSRtc.h @@ -0,0 +1,43 @@ +#ifndef RVL_SDK_OS_RTC_H +#define RVL_SDK_OS_RTC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSSram { + u16 checksum; // at 0x0 + u16 invchecksum; // at 0x2 + u32 ead0; // at 0x4 + u32 ead1; // at 0x8 + u32 counterBias; // at 0xC + u8 dispOfsH; // at 0x10 + u8 ntd; // at 0x11 + u8 lang; // at 0x12 + u8 flags; // at 0x13 +} OSSram; + +typedef struct OSSramEx { + char UNK_0x0[0x1C]; + u16 wirelessPadId[4]; // at 0x1C + char UNK_0x38[0x3C - 0x38]; + u16 gbs; // at 0x3C + char UNK_0x3E[0x40 - 0x3E]; +} OSSramEx; + +void __OSInitSram(void); +OSSramEx* __OSLockSramEx(void); +BOOL __OSUnlockSramEx(BOOL save); +BOOL __OSSyncSram(void); +BOOL __OSReadROM(void* dst, s32 size, const void* src); +u16 OSGetWirelessID(s32 pad); +void OSSetWirelessID(s32 pad, u16 id); +u16 OSGetGbsMode(void); +void OSSetGbsMode(u16 gbs); +BOOL __OSGetRTCFlags(u32* out); +BOOL __OSClearRTCFlags(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateFlags.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateFlags.h new file mode 100644 index 0000000000..4e5e43561d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateFlags.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_OS_STATE_FLAGS_H +#define RVL_SDK_OS_STATE_FLAGS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OSStateFlags { + u32 checksum; // at 0x0 + u8 BYTE_0x4; + u8 BYTE_0x5; // at 0x5 + u8 discState; // at 0x6 + u8 BYTE_0x7; + u32 WORD_0x8; + u32 WORD_0xC; + u32 WORD_0x10; + u32 WORD_0x14; + u32 WORD_0x18; + u32 WORD_0x1C; +} OSStateFlags; + +BOOL __OSWriteStateFlags(const OSStateFlags* state); +BOOL __OSReadStateFlags(OSStateFlags* state); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateTM.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateTM.h new file mode 100644 index 0000000000..11a6a1e8f0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSStateTM.h @@ -0,0 +1,23 @@ +#ifndef RVL_SDK_OS_STATETM_H +#define RVL_SDK_OS_STATETM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*OSStateCallback)(void); + +OSStateCallback OSSetResetCallback(OSStateCallback callback); +OSStateCallback OSSetPowerCallback(OSStateCallback callback); +BOOL __OSInitSTM(void); +void __OSShutdownToSBY(void); +void __OSHotReset(void); +BOOL __OSGetResetButtonStateRaw(void); +s32 __OSSetVIForceDimming(u32 arg0, u32 arg1, u32 arg2); +s32 __OSSetIdleLEDMode(u32 mode); +s32 __OSUnRegisterStateEvent(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSSync.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSSync.h new file mode 100644 index 0000000000..ec9dd171d1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSSync.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_OS_SYNC_H +#define RVL_SDK_OS_SYNC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __OSInitSystemCall(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSThread.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSThread.h new file mode 100644 index 0000000000..413fad0f5e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSThread.h @@ -0,0 +1,91 @@ +#ifndef RVL_SDK_OS_THREAD_H +#define RVL_SDK_OS_THREAD_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define OS_PRIORITY_MIN 0 +#define OS_PRIORITY_MAX 31 + +#define OS_THREAD_STACK_MAGIC 0xDEADBABE + +typedef enum { + OS_THREAD_STATE_EXITED = 0, + OS_THREAD_STATE_READY = 1, + OS_THREAD_STATE_RUNNING = 2, + OS_THREAD_STATE_SLEEPING = 4, + OS_THREAD_STATE_MORIBUND = 8 +} OSThreadState; + +typedef enum { OS_THREAD_DETACHED = (1 << 0) } OSThreadFlag; + +typedef struct OSThreadQueue { + struct OSThread* head; // at 0x0 + struct OSThread* tail; // at 0x4 +} OSThreadQueue; + +typedef struct OSMutexQueue { + struct OSMutex* head; // at 0x0 + struct OSMutex* tail; // at 0x4 +} OSMutexQueue; + +typedef struct OSThread { + OSContext context; + u16 state; // at 0x2C8 + u16 flags; // at 0x2CA + s32 suspend; // at 0x2CC + s32 priority; // at 0x2D0 + s32 base; // at 0x2D4 + u32 val; // at 0x2D8 + OSThreadQueue* queue; // at 0x2DC + struct OSThread* next; // at 0x2E0 + struct OSThread* prev; // at 0x2E4 + OSThreadQueue joinQueue; // at 0x2E8 + struct OSMutex* mutex; // at 0x2F0 + OSMutexQueue mutexQueue; // at 0x2F4 + struct OSThread* nextActive; // at 0x2FC + struct OSThread* prevActive; // at 0x300 + u32* stackBegin; // at 0x304 + u32* stackEnd; // at 0x308 + s32 error; // at 0x30C + void* specific[2]; // at 0x310 +} OSThread; + +typedef void (*OSSwitchThreadCallback)(OSThread* currThread, + OSThread* newThread); +typedef void* (*OSThreadFunc)(void* arg); + +OSSwitchThreadCallback +OSSetSwitchThreadCallback(OSSwitchThreadCallback callback); +void __OSThreadInit(void); +void OSSetCurrentThread(OSThread* thread); +void OSInitMutexQueue(OSMutexQueue* queue); +void OSInitThreadQueue(OSThreadQueue* queue); +OSThread* OSGetCurrentThread(void); +BOOL OSIsThreadTerminated(OSThread* thread); +s32 OSDisableScheduler(void); +s32 OSEnableScheduler(void); +s32 __OSGetEffectivePriority(OSThread* thread); +void __OSPromoteThread(OSThread* thread, s32 prio); +void __OSReschedule(void); +void OSYieldThread(void); +BOOL OSCreateThread(OSThread* thread, OSThreadFunc func, void* funcArg, + void* stackBegin, u32 stackSize, s32 prio, u16 flags); +void OSExitThread(OSThread* thread); +void OSCancelThread(OSThread* thread); +BOOL OSJoinThread(OSThread* thread, void* val); +void OSDetachThread(OSThread* thread); +s32 OSResumeThread(OSThread* thread); +s32 OSSuspendThread(OSThread* thread); +void OSSleepThread(OSThreadQueue* queue); +void OSWakeupThread(OSThreadQueue* queue); +BOOL OSSetThreadPriority(OSThread* thread, s32 prio); +void OSClearStack(u8 val); +void OSSleepTicks(s64 ticks); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSTime.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSTime.h new file mode 100644 index 0000000000..e91ab02ebd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSTime.h @@ -0,0 +1,52 @@ +#ifndef RVL_SDK_OS_TIME_H +#define RVL_SDK_OS_TIME_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Time base frequency = 1/4 bus clock +#define OS_TIME_SPEED (OS_BUS_CLOCK_SPEED / 4) + +// OS time -> Real time +#define OS_TICKS_TO_SEC(x) ((x) / (OS_TIME_SPEED)) +#define OS_TICKS_TO_MSEC(x) ((x) / (OS_TIME_SPEED / 1000)) +#define OS_TICKS_TO_USEC(x) (((x) * 8) / (OS_TIME_SPEED / 125000)) +#define OS_TICKS_TO_NSEC(x) (((x) * 8000) / (OS_TIME_SPEED / 125000)) + +// Real time -> OS time +#define OS_SEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED)) +#define OS_MSEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 1000)) +#define OS_USEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 125000) / 8) +#define OS_NSEC_TO_TICKS(x) ((x) * (OS_TIME_SPEED / 125000) / 8000) + +// Interpret as signed to find tick delta +#define OS_TICKS_DELTA(x, y) ((s32)x - (s32)y) + +typedef struct OSCalendarTime { + s32 sec; // at 0x0 + s32 min; // at 0x4 + s32 hour; // at 0x8 + s32 mday; // at 0xC + s32 month; // at 0x10 + s32 year; // at 0x14 + s32 wday; // at 0x18 + s32 yday; // at 0x1C + s32 msec; // at 0x20 + s32 usec; // at 0x24 +} OSCalendarTime; + +s64 OSGetTime(void); +u32 OSGetTick(void); + +s64 __OSGetSystemTime(void); +s64 __OSTimeToSystemTime(s64 time); + +void OSTicksToCalendarTime(s64 time, OSCalendarTime* cal); +s64 OSCalendarTimeToTicks(const OSCalendarTime* cal); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSUtf.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSUtf.h new file mode 100644 index 0000000000..9ea8ce6f15 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/OSUtf.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_OS_UTF_H +#define RVL_SDK_OS_UTF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +const u8* OSUTF8to32(const u8* utf8, u32* utf32); +const wchar_t* OSUTF16to32(const wchar_t* utf16, u32* utf32); +u8 OSUTF32toANSI(u32 utf32); +wchar_t OSUTF32toSJIS(u32 utf32); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/__ppc_eabi_init.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/__ppc_eabi_init.h new file mode 100644 index 0000000000..d2fab66ef0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/OS/__ppc_eabi_init.h @@ -0,0 +1,92 @@ +#ifndef RVL_SDK_OS_PPC_EABI_INIT_H +#define RVL_SDK_OS_PPC_EABI_INIT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#pragma section ".init" +DECL_SECTION(".init") void __init_hardware(void); +DECL_SECTION(".init") void __flush_cache(void*, size_t); + +void __init_user(void); +void __init_cpp(void); +void __fini_cpp(void); +DECL_WEAK void exit(void); +void _ExitProcess(void); + +/** + * Linker Generated Symbols + */ + +// Declare linker symbols for a section in the ROM +#define DECL_ROM_SECTION(x) \ + extern u8 _f##x[]; \ + extern u8 _f##x##_rom[]; \ + extern u8 _e##x[]; + +// Declare linker symbols for a BSS section +#define DECL_BSS_SECTION(x) \ + extern u8 _f##x[]; \ + extern u8 _e##x[]; + +// Debugger stack +extern u8 _db_stack_addr[]; +extern u8 _db_stack_end[]; + +// Program arena +extern u8 __ArenaLo[]; +extern u8 __ArenaHi[]; + +// Program stack +extern u8 _stack_addr[]; +extern u8 _stack_end[]; + +// Small data bases +extern u8 _SDA_BASE_[]; +extern u8 _SDA2_BASE_[]; + +// ROM sections +DECL_ROM_SECTION(_init); +DECL_ROM_SECTION(extab); +DECL_ROM_SECTION(extabindex); +DECL_ROM_SECTION(_text); +DECL_ROM_SECTION(_ctors); +DECL_ROM_SECTION(_dtors); +DECL_ROM_SECTION(_rodata); +DECL_ROM_SECTION(_data); +DECL_ROM_SECTION(_sdata); +DECL_ROM_SECTION(_sdata2); +DECL_ROM_SECTION(_stack); + +// BSS sections +DECL_BSS_SECTION(_bss); +DECL_BSS_SECTION(_sbss); +DECL_BSS_SECTION(_sbss2); + +typedef struct RomSection { + void* phys; // at 0x4 + void* virt; // at 0x0 + size_t size; // at 0x8 +} RomSection; + +typedef struct BssSection { + void* virt; // at 0x0 + size_t size; // at 0x8 +} BssSection; + +typedef struct ExtabIndexInfo { + void* section; // at 0x0 + struct ExtabIndexInfo* extab; // at 0x4 + void* codeStart; // at 0x8 + u32 codeSize; // at 0xC +} ExtabIndexInfo; + +DECL_SECTION(".init") extern const RomSection _rom_copy_info[]; +DECL_SECTION(".init") extern const BssSection _bss_init_info[]; +DECL_SECTION(".init") extern const ExtabIndexInfo _eti_init_info[]; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD.h new file mode 100644 index 0000000000..07e3a8b864 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_PAD_H +#define RVL_SDK_PUBLIC_PAD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD/Pad.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD/Pad.h new file mode 100644 index 0000000000..3d9c253d3c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/PAD/Pad.h @@ -0,0 +1,19 @@ +#ifndef RVL_SDK_PAD_H +#define RVL_SDK_PAD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern u32 __PADSpec; + +typedef enum { + PAD_FLAG_NO_RECALIBRATE = (1 << 6), +} PADFlag; + +BOOL __PADDisableRecalibration(BOOL disable); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC.h new file mode 100644 index 0000000000..75137be3b9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC.h @@ -0,0 +1,18 @@ +/** + * References: WiiBrew + */ + +#ifndef RVL_SDK_PUBLIC_SC_H +#define RVL_SDK_PUBLIC_SC_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi.h new file mode 100644 index 0000000000..0650dd9dd7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi.h @@ -0,0 +1,66 @@ +#ifndef RVL_SDK_SC_SCAPI_H +#define RVL_SDK_SC_SCAPI_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { SC_ASPECT_STD, SC_ASPECT_WIDE } SCAspectRatio; + +typedef enum { SC_EURGB_50_HZ, SC_EURGB_60_HZ } SCEuRgb60Mode; + +typedef enum { + SC_LANG_JP, + SC_LANG_EN, + SC_LANG_DE, + SC_LANG_FR, + SC_LANG_SP, + SC_LANG_IT, + SC_LANG_NL, + SC_LANG_ZH_S, + SC_LANG_ZH_T, + SC_LANG_KR, +} SCLanguage; + +typedef enum { SC_SND_MONO, SC_SND_STEREO, SC_SND_SURROUND } SCSoundMode; + +typedef enum { SC_SENSOR_BAR_BOTTOM, SC_SENSOR_BAR_TOP } SCSensorBarPos; + +typedef struct SCIdleModeInfo { + u8 wc24; // at 0x0 + u8 slotLight; // at 0x1 +} SCIdleModeInfo; + +typedef struct SCBtDeviceInfo { + u8 mac[6]; // at 0x0 + char name[64]; // at 0x6 +} SCBtDeviceInfo; + +typedef struct SCBtDeviceInfoArray { + u8 numRegist; // at 0x0 + SCBtDeviceInfo regist[10]; // at 0x1 + SCBtDeviceInfo active[6]; // at 0x2BD +} SCBtDeviceInfoArray; + +u8 SCGetAspectRatio(void); +s8 SCGetDisplayOffsetH(void); +u8 SCGetEuRgb60Mode(void); +void SCGetIdleMode(SCIdleModeInfo* mode); +u8 SCGetLanguage(void); +u8 SCGetProgressiveMode(void); +u8 SCGetScreenSaverMode(void); +u8 SCGetSoundMode(void); +u32 SCGetCounterBias(void); +void SCGetBtDeviceInfoArray(SCBtDeviceInfoArray* info); +void SCSetBtDeviceInfoArray(const SCBtDeviceInfoArray* info); +u32 SCGetBtDpdSensibility(void); +u8 SCGetWpadMotorMode(void); +void SCSetWpadMotorMode(u8 mode); +u8 SCGetWpadSensorBarPosition(void); +u8 SCGetWpadSpeakerVolume(void); +void SCSetWpadSpeakerVolume(u8 vol); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi_prdinfo.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi_prdinfo.h new file mode 100644 index 0000000000..52da42c50c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scapi_prdinfo.h @@ -0,0 +1,31 @@ +#ifndef RVL_SDK_SC_SCAPI_PRDINFO_H +#define RVL_SDK_SC_SCAPI_PRDINFO_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define SC_PRDINFO_SIZE 0x100 + +typedef enum { + SC_AREA_JPN, + SC_AREA_USA, + SC_AREA_EUR, + SC_AREA_AUS, + SC_AREA_BRA, + SC_AREA_TWN, + SC_AREA_KOR, + SC_AREA_HKG, + SC_AREA_ASI, + SC_AREA_LTN, + SC_AREA_SAF, +} SCProductArea; + +BOOL __SCF1(const char* type, char* buf, u32 sz); +BOOL SCGetProductAreaString(char* buf, u32 sz); +s8 SCGetProductArea(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scsystem.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scsystem.h new file mode 100644 index 0000000000..23a1566ab5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SC/scsystem.h @@ -0,0 +1,83 @@ +#ifndef RVL_SDK_SC_SCSYSTEM_H +#define RVL_SDK_SC_SCSYSTEM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SC_STATUS_OK, + SC_STATUS_BUSY, + SC_STATUS_FATAL, + SC_STATUS_PARSE +} SCStatus; + +typedef enum { + // IPL settings + SC_ITEM_IPL_CB, // Counter bias + SC_ITEM_IPL_AR, // Aspect ratio + SC_ITEM_IPL_ARN, // Autorun mode + SC_ITEM_IPL_CD, // Config done flag + SC_ITEM_IPL_CD2, // Config done flag 2 + SC_ITEM_IPL_DH, // Display horizontal offset + SC_ITEM_IPL_E60, // EuRgb60 mode + SC_ITEM_IPL_EULA, // EULA + SC_ITEM_IPL_FRC, // Free channel app count + SC_ITEM_IPL_IDL, // Idle mode + SC_ITEM_IPL_INC, // Installed channel app count + SC_ITEM_IPL_LNG, // Language + SC_ITEM_IPL_NIK, // Owner nickname + SC_ITEM_IPL_PC, // Parental controls + SC_ITEM_IPL_PGS, // Progressive mode + SC_ITEM_IPL_SSV, // Screen saver mode + SC_ITEM_IPL_SADR, // Simple address + SC_ITEM_IPL_SND, // Sound mode + SC_ITEM_IPL_UPT, // Update type + + // Network settings + SC_ITEM_NET_CNF, // Network config + SC_ITEM_NET_CTPC, // Network content restrictions + SC_ITEM_NET_PROF, // Network profile + SC_ITEM_NET_WCPC, // WC24 parental controls + SC_ITEM_NET_WCFG, // WC24 flags + + // Development settings + SC_ITEM_DEV_BTM, // Boot mode + SC_ITEM_DEV_VIM, // Video mode + SC_ITEM_DEV_CTC, // Country code + SC_ITEM_DEV_DSM, // Drive-saving mode + + // Bluetooth settings + SC_ITEM_BT_DINF, // Bluetooth device info + SC_ITEM_BT_SENS, // Remote sensitivity + SC_ITEM_BT_SPKV, // WPAD speaker volume + SC_ITEM_BT_MOT, // WPAD motor mode + SC_ITEM_BT_BAR, // WPAD sensor bar position + + // Miscellaneous settings + SC_ITEM_DVD_CNF, // DVD config + SC_ITEM_WWW_RST, // WWW restriction + + SC_ITEM_MAX +} SCItemID; + +typedef void (*SCFlushCallback)(SCStatus status); + +void SCInit(void); +u32 SCCheckStatus(void); + +BOOL SCFindByteArrayItem(void* dst, u32 len, SCItemID id); +BOOL SCReplaceByteArrayItem(const void* src, u32 len, SCItemID id); + +BOOL SCFindU8Item(u8* dst, SCItemID id); +BOOL SCFindS8Item(s8* dst, SCItemID id); +BOOL SCFindU32Item(u32* dst, SCItemID id); + +BOOL SCReplaceU8Item(u8 data, SCItemID id); + +void SCFlushAsync(SCFlushCallback callback); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI.h new file mode 100644 index 0000000000..9da7f3c0dc --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI.h @@ -0,0 +1,18 @@ +/** + * References: YAGCD, publicly available patents + */ + +#ifndef RVL_SDK_PUBLIC_SI_H +#define RVL_SDK_PUBLIC_SI_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIBios.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIBios.h new file mode 100644 index 0000000000..e310161ae0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIBios.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_SI_SIBIOS_H +#define RVL_SDK_SI_SIBIOS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SI_CHAN_0, + SI_CHAN_1, + SI_CHAN_2, + SI_CHAN_3, + + SI_MAX_CHAN, + SI_CHAN_NONE = -1, +} SIChannel; + +typedef enum { + SI_TYPE_0, + SI_TYPE_1, + SI_TYPE_2, + SI_TYPE_3, + + SI_MAX_TYPE +} SIType; + +typedef void (*SICallback)(s32 chan, u32 status); + +void SIInit(void); +u32 SISetXY(u32 lines, u32 times); +BOOL SITransfer(s32 chan, void* outAddr, u32 outSize, void* inAddr, u32 inSize, + SICallback callback, s64 wait); +u32 SIGetType(s32 chan); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIHardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIHardware.h new file mode 100644 index 0000000000..a3ecb558d9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SIHardware.h @@ -0,0 +1,92 @@ +#ifndef RVL_SDK_SI_HARDWARE_H +#define RVL_SDK_SI_HARDWARE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * SI hardware registers + */ +volatile u32 SI_HW_REGS[] : 0xCD006400; + +/** + * Hardware register indexes + */ +typedef enum { + SI_SIC0OUTBUF, //!< 0xCD006400 + SI_SIC0INBUFH, //!< 0xCD006404 + SI_SIC0INBUFL, //!< 0xCD006408 + SI_SIC1OUTBUF, //!< 0xCD00640C + SI_SIC1INBUFH, //!< 0xCD006410 + SI_SIC1INBUFL, //!< 0xCD006414 + SI_SIC2OUTBUF, //!< 0xCD006418 + SI_SIC2INBUFH, //!< 0xCD00641C + SI_SIC2INBUFL, //!< 0xCD006420 + SI_SIC3OUTBUF, //!< 0xCD006424 + SI_SIC3INBUFH, //!< 0xCD006428 + SI_SIC3INBUFL, //!< 0xCD00642C + SI_SIPOLL, //!< 0xCD006430 + SI_SICOMSCR, //!< 0xCD006434 + SI_SISR, //!< 0xCD006438 + SI_SIEXILK, //!< 0xCD00643C + + // SI communication RAM + SI_RAM_BASE = (0xCD006480 - 0xCD006400) / sizeof(u32) //!< 0xCD006480 +}; + +// SIPOLL - SI Poll Register +#define SI_SIPOLL_X (0b1111111111 << 16) +#define SI_SIPOLL_Y (0b11111111 << 8) + +// SICOMCSR - SI Communication Control Status Register +#define SI_SICOMCSR_TCINT (1 << 31) +#define SI_SICOMCSR_TCINTMSK (1 << 30) +#define SI_SICOMCSR_COMERR (1 << 29) +#define SI_SICOMCSR_RDSTINT (1 << 28) +#define SI_SICOMCSR_RDSTINTMSK (1 << 27) +#define SI_SICOMCSR_OUTLNGTH (0b1111111 << 16) +#define SI_SICOMCSR_INLNGTH (0b1111111 << 8) +#define SI_SICOMCSR_CHANNEL (0b11 << 1) +#define SI_SICOMCSR_TSTART (1 << 0) + +// SISR - SI Status Register +#define SI_SISR_WR (1 << 31) +#define SI_SISR_RDST0 (1 << 29) +#define SI_SISR_WRST0 (1 << 28) +#define SI_SISR_NOREP0 (1 << 27) +#define SI_SISR_COLL0 (1 << 26) +#define SI_SISR_OVRUN0 (1 << 25) +#define SI_SISR_UNRUN0 (1 << 24) +#define SI_SISR_RDST1 (1 << 21) +#define SI_SISR_WRST1 (1 << 20) +#define SI_SISR_NOREP1 (1 << 19) +#define SI_SISR_COLL1 (1 << 18) +#define SI_SISR_OVRUN1 (1 << 17) +#define SI_SISR_UNRUN1 (1 << 16) +#define SI_SISR_RDST2 (1 << 13) +#define SI_SISR_WRST2 (1 << 12) +#define SI_SISR_NOREP2 (1 << 11) +#define SI_SISR_COLL2 (1 << 10) +#define SI_SISR_OVRUN2 (1 << 9) +#define SI_SISR_UNRUN2 (1 << 8) +#define SI_SISR_RDST3 (1 << 5) +#define SI_SISR_WRST3 (1 << 4) +#define SI_SISR_NOREP3 (1 << 3) +#define SI_SISR_COLL3 (1 << 2) +#define SI_SISR_OVRUN3 (1 << 1) +#define SI_SISR_UNRUN3 (1 << 0) + +// SISR flags by channel +// Ex: (SISR >> ((SI_MAX_CHAN-1) - chan) * 8) +#define SI_RDST SI_SISR_RDST3 +#define SI_WRST SI_SISR_WRST3 +#define SI_NOREP SI_SISR_NOREP3 +#define SI_COLL SI_SISR_COLL3 +#define SI_OVRUN SI_SISR_OVRUN3 +#define SI_UNRUN SI_SISR_UNRUN3 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SISamplingRate.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SISamplingRate.h new file mode 100644 index 0000000000..72bd34a445 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SI/SISamplingRate.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_SI_SISAMPLINGRATE_H +#define RVL_SDK_SI_SISAMPLINGRATE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define SI_MAX_SAMPLE_RATE 11 + +void SISetSamplingRate(u32 msec); +void SIRefreshSamplingRate(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO.h new file mode 100644 index 0000000000..5c915631c1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_SO_H +#define RVL_SDK_PUBLIC_SO_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO/SOBasic.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO/SOBasic.h new file mode 100644 index 0000000000..61db3ff6bb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/SO/SOBasic.h @@ -0,0 +1,41 @@ +#ifndef RVL_SDK_SO_BASIC_H +#define RVL_SDK_SO_BASIC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* (*alloc_t)(int, size_t); +typedef void (*free_t)(int, void*); +typedef struct SOInitInfo { + alloc_t allocator; + free_t dealloc; +} SOInitInfo; + +void SOFree(int, void*); +void* SOAlloc(int, size_t); + +int SOInit(SOInitInfo* info); +int SOStartupEx(u32); +int SOSocket(int domain, int type, int protocal); +int SOBind(int socket, const struct sockaddr* address, int address_len); +int SOConnect(int socket, const struct sockaddr* address, int address_len); +int SOClose(int socket); +u32 SORecvFrom(int socket, void* buffer, u32 length, int flags, struct sockaddr* address, u32* address_len); +u32 SOSendTo(int socket, const void* message, u32 length, int flags, const struct sockaddr* dest_addr, u32 dest_len); +int SOCleanup(void); +int SOFinish(void); + +char* SOInetNtoA(struct in_addr in); +u32 SOHtoNl(u32 hostlong); +u32 SOHtoNs(u32 hostshort); +u32 SOHtoHl(u32 netlong); +u32 SOHtoHs(u32 netshort); +u32 SONtoHs(short); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/decapi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/decapi.h new file mode 100644 index 0000000000..0c6704fc12 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/decapi.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_TMCC_JPEG_DECAPI_H +#define RVL_SDK_TMCC_JPEG_DECAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +void TMCCJPEGDecGetSize(void); +void TMCCJPEGDecDecode(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/encapi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/encapi.h new file mode 100644 index 0000000000..d1485803a2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TMCC_JPEG/encapi.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_TMCC_JPEG_ENCAPI_H +#define RVL_SDK_TMCC_JPEG_ENCAPI_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void TMCCJPEGEncGetQFactor(void* p1, u32 p2, u16 p3, u16 p4, s32 p5, u32 p6, u32* p7, s32* p8); +void TMCCJPEGEncEncode(void* p1, s32 p2, s32 p3, u16 p4, s32 p5, s32 p6, s32 p7, u32 p8, void* p9); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL.h new file mode 100644 index 0000000000..8481ae6093 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL.h @@ -0,0 +1,16 @@ +/** + * References: YAGCD, BrawlBox + */ + +#ifndef RVL_SDK_PUBLIC_TPL_H +#define RVL_SDK_PUBLIC_TPL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL/TPL.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL/TPL.h new file mode 100644 index 0000000000..144971209e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/TPL/TPL.h @@ -0,0 +1,50 @@ +#ifndef RVL_SDK_TPL_H +#define RVL_SDK_TPL_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct TPLHeader { + u16 height; // at 0x0 + u16 width; // at 0x2 + u32 format; // at 0x4 + char* data; // at 0x8 + GXTexWrapMode wrapS; // at 0xC + GXTexWrapMode wrapT; // at 0x10 + GXTexFilter minFilt; // at 0x14 + GXTexFilter magFilt; // at 0x18 + f32 lodBias; // at 0x1C + u8 edgeLodEnable; // at 0x20 + u8 minLod; // at 0x21 + u8 maxLod; // at 0x22 + u8 unpacked; // at 0x23 +} TPLHeader; + +typedef struct TPLClutHeader { + u16 numEntries; // at 0x0 + u8 unpacked; // at 0x1 + u8 padding; // at 0x2 + GXTlutFmt format; // at 0x4 + char* data; // at 0x8 +} TPLClutHeader; + +typedef struct TPLDescriptor { + TPLHeader* texHeader; // at 0x0 + TPLClutHeader* clutHeader; // at 0x4 +} TPLDescriptor; + +typedef struct TPLPalette { + u32 version; // at 0x0 + u32 numImages; // at 0x4 + TPLDescriptor* descriptors; // at 0x8 +} TPLPalette; + +void TPLBind(TPLPalette* pal); +TPLDescriptor* TPLGet(TPLPalette* pal, u32 id); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB.h new file mode 100644 index 0000000000..95aa0ed63e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB.h @@ -0,0 +1,16 @@ +/** + * References: WiiBrew + */ + +#ifndef RVL_SDK_PUBLIC_USB_H +#define RVL_SDK_PUBLIC_USB_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB/usb.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB/usb.h new file mode 100644 index 0000000000..e502eaac53 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/USB/usb.h @@ -0,0 +1,31 @@ +#ifndef RVL_SDK_USB_H +#define RVL_SDK_USB_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*USBCallback)(IPCResult result, void* arg); + +IPCResult IUSB_OpenLib(void); +IPCResult IUSB_CloseLib(void); +IPCResult IUSB_OpenDeviceIds(const char* interface, u16 vid, u16 pid, + IPCResult* resultOut); +IPCResult IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, + void* callbackArg); +IPCResult IUSB_ReadIntrMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, + USBCallback callback, void* callbackArg); +IPCResult IUSB_ReadBlkMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, + USBCallback callback, void* callbackArg); +IPCResult IUSB_WriteBlkMsgAsync(s32 fd, u32 endpoint, u32 length, + const void* buffer, USBCallback callback, + void* callbackArg); +IPCResult IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, + u16 index, u16 length, void* buffer, + USBCallback callback, void* callbackArg); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF.h new file mode 100644 index 0000000000..e82915ccbd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF.h @@ -0,0 +1,29 @@ +#ifndef RVL_SDK_PUBLIC_VF_H +#define RVL_SDK_PUBLIC_VF_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/d_vf.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/d_vf.h new file mode 100644 index 0000000000..207061b1d3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/d_vf.h @@ -0,0 +1,38 @@ +#ifndef RVL_SDK_VF_D_VF_H +#define RVL_SDK_VF_D_VF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* VFFile; + +typedef enum { + VF_OK = 0x0000, + VF_ERROR_0002 = 0x0002, + VF_ERROR_0005 = 0x0005, + VF_ERROR_B001 = 0xB001, +} VFError; + +// Sync and async? +typedef enum { VF_SYNC_MODE_0, VF_SYNC_MODE_1 } VFSyncMode; + +s32 VFIsAvailable(void); +s32 VFMountDriveNANDFlashEx(const char* i_drive, const char* i_sys_file_name_p); +s32 VFUnmountDrive(const char* i_drive); +VFFile VFOpenFile(const char* i_path_p, const char* i_mode, u32 i_attr); +s32 VFCloseFile(VFFile i_file_p); +s32 VFSeekFile(VFFile i_file_p, s32 i_offset, s32 i_origin); +s32 VFReadFile(VFFile i_file_p, void* o_buf_p, u32 i_size, u32* o_read_size_p); +s32 VFWriteFile(VFFile i_file_p, const void* i_buf_p, u32 i_size); +s32 VFDeleteFile(const char* i_path_p); +s32 VFGetFileSizeByFd(VFFile i_file_p); +s32 VFGetLastError(void); +s32 VFGetDriveFreeSize(const char* i_drive); +s32 VFGetLastDeviceError(const char* i_drive); +s32 VFSetSyncMode(const char* i_drive, u32 i_mode); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf.h new file mode 100644 index 0000000000..bc48eb4661 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf.h @@ -0,0 +1,34 @@ +#ifndef RVL_SDK_VF_PF_H +#define RVL_SDK_VF_PF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PF_RESULT_OK = 0, + PF_RESULT_INVALID = 10, +} PFResult; + +typedef struct PF_ENT_ITER { + char _0x0[0x8]; + u32 _0x8; + char _0xC[0x2c]; + void* unk; + char _0x3c[0x31]; +} PF_ENT_ITER; + +typedef struct PF_DIR_ENT { + char _0x0[0x228]; + u32 _0x228; + void* cache; + char _0x230[4]; + u32 _0x234; + int sector; + short offset; +} PF_DIR_ENT; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_api_util.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_api_util.h new file mode 100644 index 0000000000..1c3f127dbc --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_api_util.h @@ -0,0 +1,13 @@ +#ifndef RVL_SDK_VF_PF_API_UTIL_H +#define RVL_SDK_VF_PF_API_UTIL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int PFAPI_convertReturnValue(int); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_cache.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_cache.h new file mode 100644 index 0000000000..429cabec53 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_cache.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_CACHE_H +#define RVL_SDK_VF_PF_CACHE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int PFCACHE_FlushFATCache(PF_VOLUME* vol); +int PFCACHE_FlushDataCacheSpecific(PF_VOLUME* vol, int unk); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_clib.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_clib.h new file mode 100644 index 0000000000..4e61512df9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_clib.h @@ -0,0 +1,19 @@ +#ifndef RVL_SDK_VF_PF_CLIB_H +#define RVL_SDK_VF_PF_CLIB_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int VFipf_toupper(int c); +void* VFipf_memcpy(void* dst, const void* src, size_t n); +void* VFipf_memset(void* dst, int ch, size_t n); +size_t VFipf_strlen(const char* str); +char* VFipf_strcpy(char* dst, const char* src); +int VFipf_strcmp(const char* s1, const char* s2); +int VFipf_strncmp(const char* s1, const char* s2, size_t n); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_code.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_code.h new file mode 100644 index 0000000000..d4f5cf35ce --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_code.h @@ -0,0 +1,41 @@ +#ifndef RVL_SDK_VF_PF_CODE_H +#define RVL_SDK_VF_PF_CODE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define VF_FN_MIN_CHAR 0x20 // (Space) +#define VF_FN_MAX_CHAR 0x80 // (DEL) + +typedef enum { + PFCODE_FN_INVALID = 0, + PFCODE_FN_VALID_LONG = (1 << 0), + PFCODE_FN_VALID_SHORT = (1 << 1), +} PFCODE_FnValidity; + +typedef s32 (*PF_OEM_2_UNICODE)(char* src, u16* dst); +typedef s32 (*PF_UNICODE_2_OEM)(u16* src, char* dst); +typedef s32 (*PF_OEM_CHAR_WIDTH)(char* ch); +typedef s32 (*PF_UNICODE_CHAR_WIDH)(wchar_t* ch); +typedef u32 (*PF_IS_OEM_MB_CHAR)(char ch, u32 target); +typedef u32 (*PF_IS_UNICODE_MB_CHAR)(wchar_t ch, u32 target); + +typedef struct { + PF_OEM_2_UNICODE oem2unicode; // at 0x0 + PF_UNICODE_2_OEM unicode2oem; // at 0x4 + PF_OEM_CHAR_WIDTH oem_char_width; // at 0x8 + PF_IS_OEM_MB_CHAR is_oem_mb_char; // at 0xC + PF_UNICODE_CHAR_WIDH unicode_char_width; // at 0x10 + PF_IS_UNICODE_MB_CHAR is_unicode_mb_char; // at 0x14 +} PF_CHARCODE; + +extern const u8 VFipf_valid_fn_char[VF_FN_MAX_CHAR - VF_FN_MIN_CHAR]; + +int VFiPFCODE_Combine_Width(s16 oem_width, s16 uni_width); +void VFiPFCODE_Divide_Width(u32 width, s16* oem_width, s16* uni_width); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_critical.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_critical.h new file mode 100644 index 0000000000..3f516a2fea --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_critical.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_VF_PF_CRITICAL_H +#define RVL_SDK_VF_PF_CRITICAL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void PF_enterCritical(void* unk); +void PF_exitCritical(void* unk); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_dir.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_dir.h new file mode 100644 index 0000000000..d74e9bd7c5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_dir.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_DIR_H +#define RVL_SDK_VF_PF_DIR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +int PFDIR_p_mkdir(PF_VOLUME* vol, PF_STR* path, int unk1, int unk2); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry.h new file mode 100644 index 0000000000..1a1ad96df7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry.h @@ -0,0 +1,18 @@ +#ifndef RVL_SDK_VF_PF_ENTRY_H +#define RVL_SDK_VF_PF_ENTRY_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +int PFENT_RemoveEntry(PF_DIR_ENT* entry, PF_ENT_ITER* iter); +int PFENT_getcurrentDateTimeForEnt(u16* date, u16* time); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry_iterator.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry_iterator.h new file mode 100644 index 0000000000..c2b70a6d3e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_entry_iterator.h @@ -0,0 +1,17 @@ +#ifndef RVL_SDK_VF_PF_ENTRY_ITERATOR_H +#define RVL_SDK_VF_PF_ENTRY_ITERATOR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +int PFENT_ITER_GetEntryOfPath(PF_ENT_ITER* iter, PF_DIR_ENT* entry, PF_VOLUME* vol, PF_STR* str, int unk); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_fat.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_fat.h new file mode 100644 index 0000000000..e5a2762249 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_fat.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_FAT_H +#define RVL_SDK_VF_PF_FAT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +int PFFAT_FreeChain(void*, u32, u32, u32); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_file.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_file.h new file mode 100644 index 0000000000..908daba848 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_file.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_FILE_H +#define RVL_SDK_VF_PF_FILE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +int PFFILE_p_remove(PF_VOLUME* vol, PF_STR* str); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_path.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_path.h new file mode 100644 index 0000000000..6e7e22ddc3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_path.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_PATH_H +#define RVL_SDK_VF_PF_PATH_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +PF_VOLUME* PFPATH_GetVolumeFromPath(PF_STR* str); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_sector.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_sector.h new file mode 100644 index 0000000000..b01731cba0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_sector.h @@ -0,0 +1,16 @@ +#ifndef RVL_SDK_VF_PF_SECTOR_H +#define RVL_SDK_VF_PF_SECTOR_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int PFSEC_ReadData(void* cache, void* buffer, int sector, int offset, int len, int* success, int unk); +int PFSEC_WriteData(void* cache, void* buffer, int sector, int offset, int len, int* success, int unk); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_service.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_service.h new file mode 100644 index 0000000000..d68f0d0249 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_service.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_VF_PF_SERVICE_H +#define RVL_SDK_VF_PF_SERVICE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +u16 VFiPF_GET_LE_U16(const u8* buf); +void VFiPF_LE16_TO_U16_STR(u8* str, u32 n); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_str.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_str.h new file mode 100644 index 0000000000..7e7b010592 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_str.h @@ -0,0 +1,42 @@ +#ifndef RVL_SDK_VF_PF_STRING_H +#define RVL_SDK_VF_PF_STRING_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PFSTR_CODEMODE_NONE, + PFSTR_CODEMODE_OEM, + PFSTR_CODEMODE_UNICODE, + PFSTR_CODEMODE_LOCAL, +} PFSTR_CodeMode; + +typedef struct PF_STR { + const char* head; // at 0x0 + const char* tail; // at 0x4 + const char* local; // at 0x8 + u32 mode; // at 0xC +} PF_STR; + +void VFiPFSTR_SetCodeMode(PF_STR* str, u32 mode); +u32 VFiPFSTR_GetCodeMode(PF_STR* str); +void VFiPFSTR_SetLocalStr(PF_STR* str, char* local); +char* VFiPFSTR_GetStrPos(PF_STR* str, u32 target); +void VFiPFSTR_MoveStrPos(PF_STR* str, s16 n); +s32 VFiPFSTR_InitStr(PF_STR* str, const char* s, u32 mode); +u16 VFiPFSTR_StrLen(PF_STR* str); +u16 VFiPFSTR_StrNumChar(PF_STR* str, u32 target); +s32 VFiPFSTR_StrCmp(const PF_STR* str, const char* cmp); +int VFiPFSTR_StrNCmp(PF_STR* str, const char* cmp, u32 target, s16 offset, + u16 n); +void VFiPFSTR_ToUpperNStr(PF_STR* str, u16 n, char* out); + +s32 PFSTR_InitStr(PF_STR* str, const char* s, u32 mode); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_volume.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_volume.h new file mode 100644 index 0000000000..9fe0d358f8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_volume.h @@ -0,0 +1,53 @@ +#ifndef RVL_SDK_VF_PF_VOLUME_H +#define RVL_SDK_VF_PF_VOLUME_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// TODO: 0x37b91e + +//typedef struct PF_VOLUME { +// u8 dummy[0x1898]; +//} PF_VOLUME; +typedef struct PF_VOLUME { + char _0x0[0x1640]; + u32 _0x1640; + u32 _0x1644; + char _0x1648[0x948]; + u32 _0x1f90; + char _0x1f94[0x34]; +} PF_VOLUME; + +typedef struct PF_CUR_VOLUME { + u32 stat; // at 0x0 + s32 context_id; // at 0x4 + PF_VOLUME* p_vol; // at 0x8 +} PF_CUR_VOLUME; + +typedef struct PF_CONTEXT { + u32 stat; // at 0x0 + s32 context_id; // at 0x4 +} PF_CONTEXT; + +typedef struct PF_VOLUME_SET { + PF_CUR_VOLUME current_vol[1]; // at 0x0 + s32 num_attached_drives; // at 0xC + s32 num_mounted_volumes; // at 0x10 + u32 config; // at 0x14 + void* param; // at 0x18 + s32 last_error; // at 0x1C + s32 last_driver_error; // at 0x20 + PF_CHARCODE codeset; // at 0x24 + u32 setting; // at 0x3C + PF_CONTEXT context[1]; // at 0x40 + PF_VOLUME volumes[26]; // at 0x48 +} PF_VOLUME_SET; + +extern PF_VOLUME_SET VFipf_vol_set; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_w_clib.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_w_clib.h new file mode 100644 index 0000000000..8619b71a08 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VF/pf_w_clib.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_VF_PF_W_CLIB_H +#define RVL_SDK_VF_PF_W_CLIB_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +size_t VFipf_w_strlen(const wchar_t* str); +wchar_t* VFipf_w_strcpy(wchar_t* dst, const wchar_t* src); +int VFipf_w_strncmp(const wchar_t* s1, const wchar_t* s2, size_t n); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI.h new file mode 100644 index 0000000000..b3fdd8f67e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI.h @@ -0,0 +1,14 @@ +#ifndef RVL_SDK_PUBLIC_VI_H +#define RVL_SDK_PUBLIC_VI_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi.h new file mode 100644 index 0000000000..c2b8507f8f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi.h @@ -0,0 +1,64 @@ +#ifndef RVL_SDK_VI_H +#define RVL_SDK_VI_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +// Merge format/mode to one value for TV info (see GXRenderModeObj) +#define VI_TV_INFO(format, mode) (((format) << 2) + (mode)) +// Get TV format from TV info +#define VI_TV_INFO_FMT(info) ((info) >> 2) +// Get TV scan mode from TV info +#define VI_TV_INFO_MODE(info) ((info)&0b00000011) + +typedef enum { + VI_TV_FMT_NTSC, + VI_TV_FMT_PAL, + VI_TV_FMT_MPAL, + VI_TV_FMT_DEBUG, + VI_TV_FMT_DEBUG_PAL, + VI_TV_FMT_EURGB60, + VI_TV_FMT_6, + VI_TV_FMT_7, + VI_TV_FMT_8, +} VITvFormat; + +typedef enum VIScanMode { + VI_SCAN_MODE_INT, + VI_SCAN_MODE_DS, + VI_SCAN_MODE_PROG +} VIScanMode; + +typedef enum VIXfbMode { + VI_XFB_MODE_SF, + VI_XFB_MODE_DF, +} VIXfbMode; + +typedef void (*VIRetraceCallback)(u32 retraceCount); +typedef void (*VIPositionCallback)(s16 displayX, s16 displayY); + +VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback callback); +VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback callback); + +void VIInit(void); +void VIWaitForRetrace(void); + +void VIConfigure(const GXRenderModeObj* rmo); +void VIConfigurePan(u16 x, u16 y, u16 w, u16 h); +void VIFlush(void); + +void VISetNextFrameBuffer(void* fb); +void* VIGetCurrentFrameBuffer(void); + +void VISetBlack(BOOL black); +s32 VIGetRetraceCount(void); + +VITvFormat VIGetTvFormat(void); +VIScanMode VIGetScanMode(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi3in1.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi3in1.h new file mode 100644 index 0000000000..9eafc9f9d6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vi3in1.h @@ -0,0 +1,15 @@ +#ifndef RVL_SDK_VI_VI3IN1_H +#define RVL_SDK_VI_VI3IN1_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void __VISetRGBModeImm(void); + +void __VISetRevolutionModeSimple(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vihardware.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vihardware.h new file mode 100644 index 0000000000..1992aee17b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/VI/vihardware.h @@ -0,0 +1,106 @@ +#ifndef RVL_SDK_VI_HARDWARE_H +#define RVL_SDK_VI_HARDWARE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * VI hardware registers + */ +volatile u16 VI_HW_REGS[] +#ifdef __MWERKS__ +: 0xCC002000 +#endif +; + +/** + * Hardware register indexes + */ +typedef enum { + VI_VTR, //!< 0xCC002000 + VI_DCR, //!< 0xCC002002 + VI_HTR0_H, //!< 0xCC002004 + VI_HTR0_L, //!< 0xCC002006 + VI_HTR1_H, //!< 0xCC002008 + VI_HTR1_L, //!< 0xCC00200A + VI_VTO_H, //!< 0xCC00200C + VI_VTO_L, //!< 0xCC00200E + VI_VTE_H, //!< 0xCC002010 + VI_VTE_L, //!< 0xCC002012 + VI_BBEI_H, //!< 0xCC002014 + VI_BBEI_L, //!< 0xCC002016 + VI_BBOI_H, //!< 0xCC002018 + VI_BBOI_L, //!< 0xCC00201A + VI_TFBL_H, //!< 0xCC00201C + VI_TFBL_L, //!< 0xCC00201E + VI_TFBR_H, //!< 0xCC002020 + VI_TFBR_L, //!< 0xCC002022 + VI_BFBL_H, //!< 0xCC002024 + VI_BFBL_L, //!< 0xCC002026 + VI_BFBR_H, //!< 0xCC002028 + VI_BFBR_L, //!< 0xCC00202A + VI_DPV, //!< 0xCC00202C + VI_DPH, //!< 0xCC00202E + VI_DI0_H, //!< 0xCC002030 + VI_DI0_L, //!< 0xCC002032 + VI_DI1_H, //!< 0xCC002034 + VI_DI1_L, //!< 0xCC002036 + VI_DI2_H, //!< 0xCC002038 + VI_DI2_L, //!< 0xCC00203A + VI_DI3_H, //!< 0xCC00203C + VI_DI3_L, //!< 0xCC00203E + VI_DL0_H, //!< 0xCC002040 + VI_DL0_L, //!< 0xCC002042 + VI_DL1_H, //!< 0xCC002044 + VI_DL1_L, //!< 0xCC002046 + VI_HSW, //!< 0xCC002048 + VI_HSR, //!< 0xCC00204A + VI_FCT0_H, //!< 0xCC00204C + VI_FCT0_L, //!< 0xCC00204E + VI_FCT1_H, //!< 0xCC002050 + VI_FCT1_L, //!< 0xCC002052 + VI_FCT2_H, //!< 0xCC002054 + VI_FCT2_L, //!< 0xCC002056 + VI_FCT3_H, //!< 0xCC002058 + VI_FCT3_L, //!< 0xCC00205A + VI_FCT4_H, //!< 0xCC00205C + VI_FCT4_L, //!< 0xCC00205E + VI_FCT5_H, //!< 0xCC002060 + VI_FCT5_L, //!< 0xCC002062 + VI_FCT6_H, //!< 0xCC002064 + VI_FCT6_L, //!< 0xCC002066 + VI_0x68, //!< 0xCC002068 + VI_0x6A, //!< 0xCC00206A + VI_VICLK, //!< 0xCC00206C + VI_VISEL, //!< 0xCC00206E + VI_0x70, //!< 0xCC002070 + VI_HBE, //!< 0xCC002072 + VI_HBS, //!< 0xCC002074 + VI_0x76, //!< 0xCC002076 + VI_0x78, //!< 0xCC002078 + VI_0x7A, //!< 0xCC00207A + VI_0x7C, //!< 0xCC00207C +} VIHwReg; + +// DCR - Display Configuration Register +#define VI_DCR_ENB (1 << 0) +#define VI_DCR_RST (1 << 1) +#define VI_DCR_NIN (1 << 2) +#define VI_DCR_FMT (0b11 << 8) + +// DI{n} - Display Interrupt Register N +#define VI_DI_INT (1 << 15) +#define VI_DI_ENB (1 << 12) + +// VICLK - VI Clock Select Register +#define VI_VICLK_SPEED (1 << 0) +typedef enum { VI_VICLK_27MHZ, VI_VICLK_54MHZ } VIClkSpeed; + +// HBE - Border HBE +#define VI_HBE_BRDR_EN (1 << 15) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC.h new file mode 100644 index 0000000000..31684483f1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_WENC_H +#define RVL_SDK_PUBLIC_WENC_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC/wenc.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC/wenc.h new file mode 100644 index 0000000000..cc111d2240 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WENC/wenc.h @@ -0,0 +1,28 @@ +#ifndef RVL_SDK_WENC_H +#define RVL_SDK_WENC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + WENC_FLAG_USER_INFO = (1 << 0), +} WENCFlag; + +typedef struct WENCInfo { + s32 xn; // at 0x0 + s32 dl; // at 0x4 + s32 qn; // at 0x8 + s32 dn; // at 0xC + s32 dlh; // at 0x10 + s32 dlq; // at 0x14 + u8 padding[8]; // at 0x18 +} WENCInfo; + +s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pcmData, s32 samples, + u8* adpcmData); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD.h new file mode 100644 index 0000000000..408e4a9809 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD.h @@ -0,0 +1,12 @@ +#ifndef RVL_SDK_PUBLIC_WPAD_H +#define RVL_SDK_PUBLIC_WPAD_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD/WPAD.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD/WPAD.h new file mode 100644 index 0000000000..19fc3c3495 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/WPAD/WPAD.h @@ -0,0 +1,47 @@ +#ifndef REVOSDK_WPAD_H +#define REVOSDK_WPAD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*WPADCallback)(s32 chan, s32 result); + +typedef enum { + WPAD_CHAN_0, + WPAD_CHAN_1, + WPAD_CHAN_2, + WPAD_CHAN_3, + WPAD_MAX_CONTROLLERS +} WPADChan; + +typedef enum { + WPAD_ERR_CORRUPTED = -7, + WPAD_ERR_6, + WPAD_ERR_5, + WPAD_ERR_INVALID, + WPAD_ERR_TRANSFER, + WPAD_ERR_BUSY, + WPAD_ERR_NO_CONTROLLER, + + WPAD_ERR_OK = 0, +} WPADResult; + +typedef enum { + WPAD_SPEAKER_OFF, + WPAD_SPEAKER_ON, + + WPAD_SPEAKER_PLAY = 4, +} WPADSpeakerCommand; + +s32 WPADControlSpeaker(s32, UNKWORD, WPADCallback); +BOOL WPADCanSendStreamData(s32); +s32 WPADSendStreamData(s32, UNKTYPE*, UNKWORD); + +s32 WPADProbe(s32 chan, u32* type); +s32 WPADReadFaceData(s32 chan, void* dst, u32 size, u32 src, WPADCallback cb); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/decomp.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/decomp.h new file mode 100644 index 0000000000..516088c63b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/decomp.h @@ -0,0 +1,48 @@ +/** + * Codewarrior tricks for matching decomp + * (Macros generate prototypes to satisfy -requireprotos) + */ + +#ifndef DECOMP_H +#define DECOMP_H + +#define __CONCAT(x, y) x##y +#define CONCAT(x, y) __CONCAT(x, y) + +// Compile without matching hacks. +#ifdef __DECOMP_NON_MATCHING +#define DECOMP_FORCEACTIVE(module, ...) +#define DECOMP_FORCELITERAL(module, x) +#define DECOMP_FORCEACTIVE_DTOR(module, cls) +#define DECOMP_INLINE +#define DECOMP_DONT_INLINE +// Compile with matching hacks. +// (This version of CW does not support pragmas inside macros.) +#else +// Force reference specific data +#define DECOMP_FORCEACTIVE(module, ...) \ + void fake_function(...); \ + void CONCAT(FORCEACTIVE##module, __LINE__)(void); \ + void CONCAT(FORCEACTIVE##module, __LINE__)(void) { \ + fake_function(__VA_ARGS__); \ + } + +// Force literal ordering, such as floats in sdata2 +#define DECOMP_FORCELITERAL(module, ...) \ + void CONCAT(FORCELITERAL##module, __LINE__)(void); \ + void CONCAT(FORCELITERAL##module, __LINE__)(void) { \ + (__VA_ARGS__); \ + } + +// Force reference destructor +#define DECOMP_FORCEACTIVE_DTOR(module, cls) \ + void CONCAT(FORCEDTOR##module##cls, __LINE__)(void); \ + void CONCAT(FORCEDTOR##module##cls, __LINE__)(void) { \ + cls dummy; \ + dummy.~cls(); \ + } +#define DECOMP_INLINE inline +#define DECOMP_DONT_INLINE __attribute__((never_inline)) +#endif + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/macros.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/macros.h new file mode 100644 index 0000000000..56fae71927 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/macros.h @@ -0,0 +1,53 @@ +#ifndef MACROS_H +#define MACROS_H + +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#define MIN(x, y) ((x) < (y) ? (x) : (y)) + +#define CLAMP(low, high, x) \ + ((x) > (high) ? (high) : ((x) < (low) ? (low) : (x))) + +#define ROUND_UP(x, align) (((x) + (align) - 1) & (-(align))) +#define ROUND_UP_PTR(x, align) \ + ((void*)((((u32)(x)) + (align) - 1) & (~((align) - 1)))) + +#define ROUND_DOWN(x, align) ((x) & (-(align))) +#define ROUND_DOWN_PTR(x, align) ((void*)(((u32)(x)) & (~((align) - 1)))) + +#define LENGTHOF(x) (sizeof((x)) / sizeof((x)[0])) + +#define MEMCLR(x) __memclr((x), sizeof(*(x))) + +#define ALIGN(x) __attribute__((aligned(x))) + +#define DECL_SECTION(x) __declspec(section x) +#define DECL_WEAK __declspec(weak) + +#define DECLTYPE(x) __decltype__(x) + +// Codewarrior tricks for matching decomp +// (Functions are given prototypes for -requireprotos) +#ifdef __MWERKS__ +// Force BSS order +#define CW_FORCE_BSS(module, ...) \ + void fake_function(...); \ + void FORCE_BSS##module##x(void); \ + void FORCE_BSS##module##x(void) { fake_function(__VA_ARGS__); } +// Force strings into pool +#define CW_FORCE_STRINGS(module, ...) \ + void fake_function(...); \ + void FORCE_STRINGS##module(void); \ + void FORCE_STRINGS##module(void) { fake_function(__VA_ARGS__); } +#else +#define CW_FORCE_BSS(module, ...) +#define CW_FORCE_STRINGS(module, ...) +#endif + +// For VSCode +#ifdef __INTELLISENSE__ +#define asm +#define __attribute__(x) +#define __declspec(x) +#endif + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/revolution/types.h b/include/lib/BrawlHeaders/OpenRVL/include/revolution/types.h new file mode 100644 index 0000000000..7c71ec8fec --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/revolution/types.h @@ -0,0 +1,76 @@ +#ifndef TYPES_H +#define TYPES_H + +#ifdef __cplusplus +#include +#include +#include +#else +#include +#include +#endif + +#include +#include + +typedef unsigned long long u64; +typedef signed long long s64; + +typedef unsigned long u32; +typedef signed long s32; + +typedef unsigned short u16; +typedef signed short s16; + +typedef unsigned char u8; +typedef signed char s8; + +typedef float f32; +typedef double f64; + +typedef int UNKWORD; +typedef void UNKTYPE; + +enum { FALSE, TRUE }; +typedef int BOOL; + +typedef void (*funcptr_t)(void); + +#if defined(__cplusplus) && __cplusplus < 201103L +namespace std { +class nullptr_t { + void operator&() const; +public: + template + operator T*() const { return 0; } + + template + operator T C::*() const { return 0; } +}; +} + +#ifdef __MWERKS__ + +#define ENUM_U8(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 1") enum name { __VA_ARGS__ } _Pragma("pop") +#define ENUM_U16(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 2") enum name { __VA_ARGS__ } _Pragma("pop") +#define ENUM_U32(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 4") enum name { __VA_ARGS__ } _Pragma("pop") + +#define ENUM_S8(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 1") enum name { _##name = -1, __VA_ARGS__ } _Pragma("pop") +#define ENUM_S16(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 2") enum name { _##name = -1, __VA_ARGS__ } _Pragma("pop") +#define ENUM_S32(name, ...) _Pragma("push") _Pragma("enumsalwaysint off") _Pragma("min_enum_size 4") enum name { _##name = -1, __VA_ARGS__ } _Pragma("pop") + +#else +#define ENUM_U8(name, ...) enum name : u8 { __VA_ARGS__ } +#define ENUM_U16(name, ...) enum name : u16 { __VA_ARGS__ } +#define ENUM_U32(name, ...) enum name : u32 { __VA_ARGS__ } + +#define ENUM_S8(name, ...) enum name : s8 { __VA_ARGS__ } +#define ENUM_S16(name, ...) enum name : s16 { __VA_ARGS__ } +#define ENUM_S32(name, ...) enum name : s32 { __VA_ARGS__ } + +#endif + +const std::nullptr_t nullptr = {}; +#endif + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/algorithm b/include/lib/BrawlHeaders/OpenRVL/include/stl/algorithm new file mode 100644 index 0000000000..aa6ec1d277 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/algorithm @@ -0,0 +1,220 @@ +#ifndef MSL_CPP_ALGORITHM_H +#define MSL_CPP_ALGORITHM_H +#include + +namespace std { + +template inline const T& max(const T& a, const T& b) { + return (a < b) ? b : a; +} + +template inline const T& min(const T& a, const T& b) { + return (b < a) ? b : a; +} + +template +inline TPtr find(TPtr first, TPtr last, const T& value) { + while (first != last && *first != value) { + ++first; + } + + return first; +} + +template inline long distance(TPtr first, TPtr last) { + random_access_iterator_tag tag; + return __distance(first, last, tag); +} + +template +inline long __distance(TPtr first, TPtr last, + random_access_iterator_tag /* tag */) { + return static_cast(last - first); +} + +template inline T& move(T& x) { + return x; +} + +template inline void swap(T& a, T& b) { + T tmp = move(a); + a = move(b); + b = move(tmp); +} + +template +inline TIt min_element(TIt first, TIt last, TCompare compare) { + TIt it = first; + + if (first != last) { + for (++first; first != last; ++first) { + if (compare(*first, *it)) { + it = first; + } + } + } + + return it; +} + +template +inline void __selection_sort(TIt first, TIt last, TCompare compare) { + if (first == last) { + return; + } + + TIt j = last; + for (--j; first != j; ++first) { + TIt i = min_element(first, last, compare); + + if (i != first) { + swap(*i, *first); + } + } +} + +template +void __sort132(TIt a1, TIt a2, TIt a3, TCompare compare) + __attribute__((never_inline)) { + bool b1 = !compare(*a3, *a1); + bool b2 = !compare(*a2, *a3); + + if (!b1 || !b2) { + if (!b1 && !b2) { + swap(*a1, *a2); + return; + } + + if (compare(*a2, *a1)) { + swap(*a1, *a2); + } + + if (b1) { + swap(*a2, *a3); + return; + } + + swap(*a1, *a3); + } +} + +template +void sort(TIt first, TIt last, TCompare compare) { + static const int SHUFFLE_MIN = -4; + static const int SHUFFLE_MAX = 5; + static const int SELECTION_SORT_MIN = 20; + + while (true) { + long len = static_cast(last - first); + if (len <= 1) { + return; + } + + if (len <= SELECTION_SORT_MIN) { + __selection_sort(first, last, compare); + return; + } + + static int shuffle = -4; + TIt m = first + + (len / static_cast(sizeof(TIt)) + shuffle % SHUFFLE_MAX); + + if (++shuffle >= SHUFFLE_MAX) { + shuffle = SHUFFLE_MIN; + } + + TIt i1 = first + (len * static_cast(sizeof(TIt) - 1) / + static_cast(sizeof(TIt)) + + shuffle % SHUFFLE_MAX); + + if (++shuffle >= SHUFFLE_MAX) { + shuffle = SHUFFLE_MIN; + } + + TIt j = last - 1; + __sort132(m, i1, j, compare); + + m = first; + i1 = j; + while (compare(*m, *j)) { + m++; + } + + do { + i1--; + + if (m == i1) { + break; + } + } while (!compare(*i1, *j)); + + if (m < i1) { + swap(*m, *i1); + m++; + + while (true) { + while (compare(*m, *j)) { + m++; + } + + while (!compare(*--i1, *j)) { + ; + } + + if (m < i1) { + swap(*m, *i1); + m++; + } else { + break; + } + } + } + + if (m == first) { + swap(*m, *j); + m++; + + i1 = last; + if (!compare(*first, *--i1)) { + while (m != last && !compare(*first, *m)) { + m++; + } + + if (m < i1) { + swap(*m, *i1); + } + } + + if (m < i1) { + while (true) { + while (!compare(*first, *m)) { + m++; + } + + while (compare(*first, *--i1)) { + ; + } + + if (m < i1) { + swap(*m, *i1); + m++; + } else { + break; + } + } + } + + first = m; + } else if (m - first < last - m) { + sort(first, m, compare); + first = m; + } else { + sort(m, last, compare); + last = m; + } + } +} + +} // namespace std + +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/arith.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/arith.h new file mode 100644 index 0000000000..ad5ed6b80a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/arith.h @@ -0,0 +1,13 @@ +#ifndef MSL_ARITH_H +#define MSL_ARITH_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int abs(int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/bitset b/include/lib/BrawlHeaders/OpenRVL/include/stl/bitset new file mode 100644 index 0000000000..192d00aacf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/bitset @@ -0,0 +1,74 @@ +#ifndef MSL_CPP_BITSET_H +#define MSL_CPP_BITSET_H + +#include +#include + +template +struct bit_width { + u8 bits[1 + sizeof(bit_width)]; +}; + +template <> +struct bit_width<1> { + u8 bits[1]; +}; + + +namespace std { + template + class bitset { + u32 m_bits[N / (sizeof(u32)*8) + 1]; + + public: + bitset() {}; + bitset(unsigned long val) { + __memfill(this, -val, sizeof(*this)); + }; + + bitset& operator&=(const bitset& rhs); + bitset& operator|=(const bitset& rhs); + bitset& operator^=(const bitset& rhs); + bitset& operator<<=(size_t pos); + bitset& operator>>=(size_t pos); + bitset& set() { + __memfill(this, 0xFF, sizeof(this)); + }; + bitset& set(size_t pos, int val = 1); + bitset& reset() { + __memfill(this, 0, sizeof(this)); + }; + bitset& reset(size_t pos); + bitset operator~() const; + bitset& flip(); + bitset& flip(size_t pos); + unsigned long to_ulong() const; + //to_string() + size_t count() const; + size_t size() const; + bool operator==(const bitset& rhs) const; + bool operator!=(const bitset& rhs) const; + bool test(size_t pos) const; + bool any() const; + bool none() const; + bitset operator<<(size_t pos) const; + bitset operator>>(size_t pos) const; + + }; + + template + bitset operator&(const bitset& lhs, const bitset& rhs); + + template + bitset operator|(const bitset& lhs, const bitset& rhs); + + template + bitset operator^(const bitset& lhs, const bitset& rhs); +// >> +// << +} + + + + +#endif //MSL_CPP_BITSET_H diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cctype b/include/lib/BrawlHeaders/OpenRVL/include/stl/cctype new file mode 100644 index 0000000000..a4fa1ede5f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cctype @@ -0,0 +1,12 @@ +#ifndef MSL_CPP_CCTYPE_H +#define MSL_CPP_CCTYPE_H +#include +#ifdef __cplusplus + +namespace std { +using ::tolower; +using ::toupper; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cerrno b/include/lib/BrawlHeaders/OpenRVL/include/stl/cerrno new file mode 100644 index 0000000000..f371e9b989 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cerrno @@ -0,0 +1,4 @@ +#ifndef MSL_CPP_CERRNO_H +#define MSL_CPP_CERRNO_H +#include +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/climits b/include/lib/BrawlHeaders/OpenRVL/include/stl/climits new file mode 100644 index 0000000000..0740fc201c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/climits @@ -0,0 +1,4 @@ +#ifndef MSL_CPP_CLIMITS_H +#define MSL_CPP_CLIMITS_H +#include +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/clocale b/include/lib/BrawlHeaders/OpenRVL/include/stl/clocale new file mode 100644 index 0000000000..d5e5999941 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/clocale @@ -0,0 +1,11 @@ +#ifndef MSL_CPP_CLOCALE_H +#define MSL_CPP_CLOCALE_H +#include +#ifdef __cplusplus + +namespace std { +using ::lconv; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cmath b/include/lib/BrawlHeaders/OpenRVL/include/stl/cmath new file mode 100644 index 0000000000..0fde38ad83 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cmath @@ -0,0 +1,41 @@ +#ifndef MSL_CPP_CMATH_H +#define MSL_CPP_CMATH_H +#include +#ifdef __cplusplus + +namespace std { +using ::acos; +using ::acosf; +using ::asin; +using ::asinf; +using ::atan; +using ::atan2; +using ::atan2f; +using ::ceil; +using ::ceilf; +using ::copysign; +using ::cos; +using ::cosf; +using ::fabsf; +using ::floor; +using ::floorf; +using ::fmod; +using ::fmodf; +using ::frexp; +using ::ldexp; +using ::ldexpf; +using ::modf; +using ::modff; +using ::nan; +using ::pow; +using ::scalbn; +using ::sin; +using ::sinf; +using ::sqrt; +using ::sqrtf; +using ::tan; +using ::tanf; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdarg b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdarg new file mode 100644 index 0000000000..ed1cfdc051 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdarg @@ -0,0 +1,11 @@ +#ifndef MSL_CPP_CSTDARG_H +#define MSL_CPP_CSTDARG_H +#include +#ifdef __cplusplus + +namespace std { +using ::va_list; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cstddef b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstddef new file mode 100644 index 0000000000..c853dd85fb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstddef @@ -0,0 +1,14 @@ +#ifndef MSL_CPP_CSTDDEF_H +#define MSL_CPP_CSTDDEF_H +#include +#ifdef __cplusplus + +namespace std { +using ::intptr_t; +using ::ptrdiff_t; +using ::size_t; +using ::uintptr_t; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdio b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdio new file mode 100644 index 0000000000..bd1e1a5cbe --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdio @@ -0,0 +1,21 @@ +#ifndef MSL_CPP_CSTDIO_H +#define MSL_CPP_CSTDIO_H +#include +#ifdef __cplusplus + +namespace std { +using ::fclose; +using ::fflush; +using ::FILE; +using ::ftell; +using ::fwide; +using ::snprintf; +using ::sprintf; +using ::sscanf; +using ::vprintf; +using ::vsnprintf; +using ::vsprintf; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdlib b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdlib new file mode 100644 index 0000000000..9accb98d79 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstdlib @@ -0,0 +1,16 @@ +#ifndef MSL_CPP_CSTDLIB_H +#define MSL_CPP_CSTDLIB_H +#include +#ifdef __cplusplus + +namespace std { +using ::abs; +using ::atof; +using ::mbstowcs; +using ::mbtowc; +using ::rand; +using ::wcstombs; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cstring b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstring new file mode 100644 index 0000000000..0373e65448 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cstring @@ -0,0 +1,26 @@ +#ifndef MSL_CPP_CSTRING_H +#define MSL_CPP_CSTRING_H +#include +#ifdef __cplusplus + +namespace std { +using ::__memrchr; +using ::memchr; +using ::memcmp; +using ::memcpy; +using ::memmove; +using ::memset; +using ::strcat; +using ::strchr; +using ::strcmp; +using ::strcpy; +using ::stricmp; +using ::strlen; +using ::strncat; +using ::strncmp; +using ::strncpy; +using ::strstr; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/ctype.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/ctype.h new file mode 100644 index 0000000000..1a3d98076b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/ctype.h @@ -0,0 +1,37 @@ +#ifndef MSL_CTYPE_H +#define MSL_CTYPE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct __CMap { + char UNK_0x0[0x10]; + const u8* to_lower_table; // at 0x10 + const u8* to_upper_table; // at 0x14 +} __CMap; + +typedef struct __Locale { + char UNK_0x0[0x38]; + struct __CMap* cmap; // at 0x38 + char UNK_0x3C[0x44 - 0x3C]; +} __Locale; + +extern __Locale _current_locale; + +inline int tolower(int x) { + return (x < 0 || x >= 256) + ? x + : (int)(&_current_locale)->cmap->to_lower_table[x]; +} + +inline int toupper(int x) { + return (x < 0 || x >= 256) + ? x + : (int)(&_current_locale)->cmap->to_upper_table[x]; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/cwchar b/include/lib/BrawlHeaders/OpenRVL/include/stl/cwchar new file mode 100644 index 0000000000..7191d7a0d4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/cwchar @@ -0,0 +1,21 @@ +#ifndef MSL_CPP_CWCHAR_H +#define MSL_CPP_CWCHAR_H +#include +#ifdef __cplusplus + +namespace std { +using ::mbstowcs; +using ::mbtowc; +using ::swprintf; +using ::vswprintf; +using ::wcscat; +using ::wcschr; +using ::wcscmp; +using ::wcscpy; +using ::wcslen; +using ::wcsncpy; +using ::wcstombs; +} // namespace std + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/errno.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/errno.h new file mode 100644 index 0000000000..c901fcca47 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/errno.h @@ -0,0 +1,15 @@ +#ifndef MSL_ERRNO_H +#define MSL_ERRNO_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern int errno; + +#define EDOM 33 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/extras.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/extras.h new file mode 100644 index 0000000000..c6a7b645b0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/extras.h @@ -0,0 +1,14 @@ +#ifndef MSL_EXTRAS_H +#define MSL_EXTRAS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int stricmp(const char*, const char*); +char* itoa(int value, char* str, int base); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/FILE_POS.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/FILE_POS.h new file mode 100644 index 0000000000..fa85a0955a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/FILE_POS.h @@ -0,0 +1,14 @@ +#ifndef MSL_FILE_POS_H +#define MSL_FILE_POS_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +long int ftell(FILE*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm.h new file mode 100644 index 0000000000..8124fbb588 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm.h @@ -0,0 +1,216 @@ + +/* @(#)fdlibm.h 1.5 04/04/22 */ +/* + * ==================================================== + * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. + * + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly + but these catch some common cases. */ + +#if defined(i386) || defined(i486) || \ + defined(intel) || defined(x86) || defined(i86pc) || \ + defined(__alpha) || defined(__osf__) +#define __LITTLE_ENDIAN +#endif + +#ifdef __LITTLE_ENDIAN +#define __HI(x) *(1+(int*)&x) +#define __LO(x) *(int*)&x +#define __HIp(x) *(1+(int*)x) +#define __LOp(x) *(int*)x +#else +#define __HI(x) *(int*)&x +#define __LO(x) *(1+(int*)&x) +#define __HIp(x) *(int*)x +#define __LOp(x) *(1+(int*)x) +#endif + +#ifdef __STDC__ +#define __P(p) p +#else +#define __P(p) () +#endif + +/* + * ANSI/POSIX + */ + +extern int signgam; + +#define MAXFLOAT ((float)3.40282346638528860e+38) + +enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; + +#define _LIB_VERSION_TYPE enum fdversion +#define _LIB_VERSION _fdlib_version + +/* if global variable _LIB_VERSION is not desirable, one may + * change the following to be a constant by: + * #define _LIB_VERSION_TYPE const enum version + * In that case, after one initializes the value _LIB_VERSION (see + * s_lib_version.c) during compile time, it cannot be modified + * in the middle of a program + */ +extern _LIB_VERSION_TYPE _LIB_VERSION; + +#define _IEEE_ fdlibm_ieee +#define _SVID_ fdlibm_svid +#define _XOPEN_ fdlibm_xopen +#define _POSIX_ fdlibm_posix + +struct exception { + int type; + char *name; + double arg1; + double arg2; + double retval; +}; + +#define HUGE MAXFLOAT + +/* + * set X_TLOSS = pi*2**52, which is possibly defined in + * (one may replace the following line by "#include ") + */ + +#define X_TLOSS 1.41484755040568800000e+16 + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +/* + * ANSI/POSIX + */ +extern double acos __P((double)); +extern double asin __P((double)); +extern double atan __P((double)); +extern double atan2 __P((double, double)); +extern double cos __P((double)); +extern double sin __P((double)); +extern double tan __P((double)); + +extern double cosh __P((double)); +extern double sinh __P((double)); +extern double tanh __P((double)); + +extern double exp __P((double)); +extern double frexp __P((double, int *)); +extern double ldexp __P((double, int)); +extern double log __P((double)); +extern double log10 __P((double)); +extern double modf __P((double, double *)); + +extern double pow __P((double, double)); +extern double sqrt __P((double)); + +extern double ceil __P((double)); +extern double fabs __P((double)); +extern double floor __P((double)); +extern double fmod __P((double, double)); + +extern double erf __P((double)); +extern double erfc __P((double)); +extern double gamma __P((double)); +extern double hypot __P((double, double)); +extern int isnan __P((double)); +extern int finite __P((double)); +extern double j0 __P((double)); +extern double j1 __P((double)); +extern double jn __P((int, double)); +extern double lgamma __P((double)); +extern double y0 __P((double)); +extern double y1 __P((double)); +extern double yn __P((int, double)); + +extern double acosh __P((double)); +extern double asinh __P((double)); +extern double atanh __P((double)); +extern double cbrt __P((double)); +extern double logb __P((double)); +extern double nextafter __P((double, double)); +extern double remainder __P((double, double)); +#ifdef _SCALB_INT +extern double scalb __P((double, int)); +#else +extern double scalb __P((double, double)); +#endif + +extern int matherr __P((struct exception *)); + +/* + * IEEE Test Vector + */ +extern double significand __P((double)); + +/* + * Functions callable from C, intended to support IEEE arithmetic. + */ +extern double copysign __P((double, double)); +extern int ilogb __P((double)); +extern double rint __P((double)); +extern double scalbn __P((double, int)); + +/* + * BSD math library entry points + */ +extern double expm1 __P((double)); +extern double log1p __P((double)); + +/* + * Reentrant version of gamma & lgamma; passes signgam back by reference + * as the second argument; user must allocate space for signgam. + */ +#ifdef _REENTRANT +extern double gamma_r __P((double, int *)); +extern double lgamma_r __P((double, int *)); +#endif /* _REENTRANT */ + +/* ieee style elementary functions */ +extern double __ieee754_sqrt __P((double)); +extern double __ieee754_acos __P((double)); +extern double __ieee754_acosh __P((double)); +extern double __ieee754_log __P((double)); +extern double __ieee754_atanh __P((double)); +extern double __ieee754_asin __P((double)); +extern double __ieee754_atan2 __P((double,double)); +extern double __ieee754_exp __P((double)); +extern double __ieee754_cosh __P((double)); +extern double __ieee754_fmod __P((double,double)); +extern double __ieee754_pow __P((double,double)); +extern double __ieee754_lgamma_r __P((double,int *)); +extern double __ieee754_gamma_r __P((double,int *)); +extern double __ieee754_lgamma __P((double)); +extern double __ieee754_gamma __P((double)); +extern double __ieee754_log10 __P((double)); +extern double __ieee754_sinh __P((double)); +extern double __ieee754_hypot __P((double,double)); +extern double __ieee754_j0 __P((double)); +extern double __ieee754_j1 __P((double)); +extern double __ieee754_y0 __P((double)); +extern double __ieee754_y1 __P((double)); +extern double __ieee754_jn __P((int,double)); +extern double __ieee754_yn __P((int,double)); +extern double __ieee754_remainder __P((double,double)); +extern int __ieee754_rem_pio2 __P((double,double*)); +#ifdef _SCALB_INT +extern double __ieee754_scalb __P((double,int)); +#else +extern double __ieee754_scalb __P((double,double)); +#endif + +/* fdlibm kernel function */ +extern double __kernel_standard __P((double,double,int)); +extern double __kernel_sin __P((double,double,int)); +extern double __kernel_cos __P((double,double)); +extern double __kernel_tan __P((double,double,int)); +extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*)); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm_public.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm_public.h new file mode 100644 index 0000000000..1258fe38c5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/fdlibm_public.h @@ -0,0 +1,32 @@ +#ifndef MSL_FDLIBM_PUBLIC_H +#define MSL_FDLIBM_PUBLIC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * For including FDLIBM declarations without also including its many macros. + */ + +double atan(double x); +double ceil(double x); +double copysign(double x, double y); +double cos(double x); +double floor(double x); +double frexp(double x, int* eptr); +double ldexp(double value, int exp); +double modf(double x, double* iptr); +double sin(double x); +double tan(double x); +double acos(double x); +double asin(double x); +double atan2(double y, double x); +double fmod(double x, double y); +double pow(double x, double y); +double sqrt(double x); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/file_io.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/file_io.h new file mode 100644 index 0000000000..40ec5785a5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/file_io.h @@ -0,0 +1,18 @@ +#ifndef MSL_FILE_IO_H +#define MSL_FILE_IO_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct FILE { + u8 dummy; +} FILE; + +int fclose(FILE*); +int fflush(FILE*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/float.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/float.h new file mode 100644 index 0000000000..14dd0c0457 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/float.h @@ -0,0 +1,15 @@ +#ifndef MSL_FLOAT_H +#define MSL_FLOAT_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +extern unsigned long __float_nan[]; +extern unsigned long __float_huge[]; +extern unsigned long __double_huge[]; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_api.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_api.h new file mode 100644 index 0000000000..a8b168c485 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_api.h @@ -0,0 +1,15 @@ +#ifndef MSL_MATH_API_H +#define MSL_MATH_API_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int __fpclassify(long double); +int __fpclassifyd(double); +int __fpclassifyf(float); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_double.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_double.h new file mode 100644 index 0000000000..90f0d3ec1d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_double.h @@ -0,0 +1,60 @@ +#ifndef MSL_MATH_DOUBLE_H +#define MSL_MATH_DOUBLE_H +#include + +#include +#ifdef __cplusplus +extern "C" { +#endif + +inline float acosf(float x) { + return acos(x); +} +inline float asinf(float x) { + return asin(x); +} +inline float atan2f(float x, float y) { + return atan2(x, y); +} +inline float ceilf(float x) { + return ceil(x); +} +inline float cosf(float x) { + return cos(x); +} +inline float sinf(float x) { + return sin(x); +} +inline float sqrtf(float x) { + return sqrt(x); +} +inline float tanf(float x) { + return tan(x); +} +inline float floorf(float x) { + return floor(x); +} +inline float fmodf(float x, float y) { + return fmod(x, y); +} + +inline float ldexpf(float value, int exp) { + return ldexp(value, exp); +} + +inline float modff(float x, float* iptr) { + float frac; + double intg; + + frac = modf(x, &intg); + *iptr = intg; + + return frac; +} + +float fabsf(float); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_ppc.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_ppc.h new file mode 100644 index 0000000000..6b71b266ad --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_ppc.h @@ -0,0 +1,13 @@ +#ifndef MSL_MATH_PPC_H +#define MSL_MATH_PPC_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +double nan(const char* arg); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_sun.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_sun.h new file mode 100644 index 0000000000..cc7833afd1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/math_sun.h @@ -0,0 +1,13 @@ +#ifndef MSL_MATH_SUN_H +#define MSL_MATH_SUN_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +double scalbn(double, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mbstring.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mbstring.h new file mode 100644 index 0000000000..e0cb5d5ff9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mbstring.h @@ -0,0 +1,15 @@ +#ifndef MSL_MBSTRING_H +#define MSL_MBSTRING_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int mbtowc(wchar_t*, const char*, size_t); +size_t mbstowcs(wchar_t*, const char*, size_t); +size_t wcstombs(char*, const wchar_t*, size_t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mem.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mem.h new file mode 100644 index 0000000000..1c13f3d540 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/mem.h @@ -0,0 +1,20 @@ +#ifndef MSL_MEM_H +#define MSL_MEM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void* memcpy(void*, const void*, size_t); +void* memset(void*, int, size_t); +void* memfill(const void*, int, size_t); +void* __memfill(const void*, int, size_t); +void* memmove(void*, const void*, size_t); +void* memchr(const void*, int, size_t); +void* __memrchr(const void*, int, size_t); +int memcmp(const void*, const void*, size_t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/printf.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/printf.h new file mode 100644 index 0000000000..c70a77aa04 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/printf.h @@ -0,0 +1,18 @@ +#ifndef MSL_PRINTF_H +#define MSL_PRINTF_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +int vprintf(const char*, va_list); +int sprintf(char*, const char*, ...); +int snprintf(char*, size_t, const char*, ...); +int vsprintf(char*, const char*, va_list); +int vsnprintf(char*, size_t, const char*, va_list); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/rand.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/rand.h new file mode 100644 index 0000000000..823b832162 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/rand.h @@ -0,0 +1,13 @@ +#ifndef MSL_RAND_H +#define MSL_RAND_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int rand(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/scanf.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/scanf.h new file mode 100644 index 0000000000..5700e0c21a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/scanf.h @@ -0,0 +1,14 @@ +#ifndef MSL_SCANF_H +#define MSL_SCANF_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +int sscanf(const char*, const char*, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtold.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtold.h new file mode 100644 index 0000000000..3145d9abe4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtold.h @@ -0,0 +1,13 @@ +#ifndef MSL_STRTOLD_H +#define MSL_STRTOLD_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +double atof(const char*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtoul.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtoul.h new file mode 100644 index 0000000000..adff5b5c7d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/strtoul.h @@ -0,0 +1,13 @@ +#ifndef MSL_STRTOUL_H +#define MSL_STRTOUL_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int atoi(const char* str); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wchar_io.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wchar_io.h new file mode 100644 index 0000000000..0af1afaa68 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wchar_io.h @@ -0,0 +1,14 @@ +#ifndef MSL_WCHAR_IO_H +#define MSL_WCHAR_IO_H +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +int fwide(FILE*, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wmem.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wmem.h new file mode 100644 index 0000000000..903e666ed5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wmem.h @@ -0,0 +1,14 @@ +#ifndef MSL_WMEM_H +#define MSL_WMEM_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +void* wmemcpy(void*, const void*, size_t); +void* wmemchr(const void*, int, size_t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wprintf.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wprintf.h new file mode 100644 index 0000000000..481499e1c9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wprintf.h @@ -0,0 +1,14 @@ +#ifndef MSL_WPRINTF_H +#define MSL_WPRINTF_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +int vswprintf(wchar_t*, size_t, const wchar_t*, va_list); +int swprintf(wchar_t*, size_t, const wchar_t*, ...); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wstring.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wstring.h new file mode 100644 index 0000000000..bc977897eb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/internal/wstring.h @@ -0,0 +1,18 @@ +#ifndef MSL_WSTRING_H +#define MSL_WSTRING_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +size_t wcslen(const wchar_t*); +wchar_t* wcscpy(wchar_t*, const wchar_t*); +wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t); +wchar_t* wcscat(wchar_t*, const wchar_t*); +int wcscmp(const wchar_t*, const wchar_t*); +wchar_t* wcschr(const wchar_t*, wchar_t); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/iterator b/include/lib/BrawlHeaders/OpenRVL/include/stl/iterator new file mode 100644 index 0000000000..cc303806f5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/iterator @@ -0,0 +1,10 @@ +#ifndef MSL_CPP_ITERATOR_H +#define MSL_CPP_ITERATOR_H + +namespace std { + +struct random_access_iterator_tag {}; + +} // namespace std + +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/limits.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/limits.h new file mode 100644 index 0000000000..3524bf95f3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/limits.h @@ -0,0 +1,31 @@ +#ifndef MSL_LIMITS_H +#define MSL_LIMITS_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define CHAR_BIT 8 + +#define SCHAR_MIN -127 +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 + +#define CHAR_MIN 0 +#define CHAR_MAX SCHAR_MAX + +#define SHRT_MIN -32767 +#define SHRT_MAX 32767 +#define USHRT_MAX 65535 + +#define INT_MIN -2147483647 +#define INT_MAX 2147483647 + +#define LONG_MIN INT_MIN +#define LONG_MAX INT_MAX +#define ULONG_MAX 4294967295 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/locale.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/locale.h new file mode 100644 index 0000000000..b0fb693e2e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/locale.h @@ -0,0 +1,38 @@ +#ifndef MSL_LOCALE_H +#define MSL_LOCALE_H +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lconv { + char* decimal_point; // at 0x0 + char* thousands_sep; // at 0x4 + char* grouping; // at 0x8 + char* currency_symbol; // at 0xC + char* mon_decimal_point; // at 0x10 + char* mon_thousands_sep; // at 0x14 + char* mon_grouping; // at 0x18 + char* positive_sign; // at 0x1C + char* negative_sign; // at 0x20 + char int_frac_digits; // at 0x24 + char frac_digits; // at 0x25 + char p_cs_precedes; // at 0x26 + char p_sep_by_space; // at 0x27 + char n_cs_precedes; // at 0x28 + char n_sep_by_space; // at 0x29 + char p_sign_posn; // at 0x2A + char n_sign_posn; // at 0x2B + char* int_curr_symbol; // at 0x2C + char int_p_cs_precedes; // at 0x30 + char int_n_cs_precedes; // at 0x31 + char int_p_sep_by_space; // at 0x32 + char int_n_sep_by_space; // at 0x33 + char int_p_sign_posn; // at 0x34 + char int_n_sign_posn; // at 0x35 +} lconv; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/math.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/math.h new file mode 100644 index 0000000000..cd592d3fd9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/math.h @@ -0,0 +1,46 @@ +#ifndef MSL_MATH_H +#define MSL_MATH_H +#include + +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __MWERKS__ +#define fabs(x) __fabs(x) +#endif + +#define NAN (*(float*)&__float_nan) +#define HUGE_VALF (*(float*)&__float_huge) +#define HUGE_VAL (*(float*)&__double_huge) + +#define FP_NAN 1 +#define FP_INFINITE 2 +#define FP_ZERO 3 +#define FP_NORMAL 4 +#define FP_SUBNORMAL 5 + +#define M_PI 3.141592653589793f +#define M_SQRT3 1.73205f + +#define FLT_EPSILON 1.19209289550781e-7f + +#define fpclassify(x) \ + (sizeof(x) == sizeof(float) \ + ? __fpclassifyf(x) \ + : (sizeof(x) == sizeof(double) ? __fpclassifyd(x) : __fpclassify(x))) + +#define isfinite(x) (fpclassify(x) > FP_INFINITE) +#define isinfinite(x) (fpclassify(x) == FP_INFINITE) +#define isnan(x) (fpclassify(x) == FP_NAN) +#define isnormal(x) (fpclassify(x) == FP_NORMAL) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/new b/include/lib/BrawlHeaders/OpenRVL/include/stl/new new file mode 100644 index 0000000000..e651548f2f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/new @@ -0,0 +1,12 @@ +#ifndef MSL_CPP_NEW_H +#define MSL_CPP_NEW_H +#include +#ifdef __cplusplus + +inline void* operator new(size_t size, void* ptr) { +#pragma unused(size) + return ptr; +} + +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/stdarg.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdarg.h new file mode 100644 index 0000000000..a2af176504 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdarg.h @@ -0,0 +1,35 @@ +#ifndef MSL_STDARG_H +#define MSL_STDARG_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum _va_arg_type { + arg_ARGPOINTER, + arg_WORD, + arg_DOUBLEWORD, + arg_ARGREAL +} _va_arg_type; + +typedef struct __va_list_struct { + char gpr; + char fpr; + char* input_arg_area; + char* reg_save_area; +} va_list[1]; + +void* __va_arg(va_list argp, int type); + +#ifdef __MWERKS__ +#define va_start(VA_LIST, ARG) ((void)ARG, __builtin_va_info(&VA_LIST)) +#else +#define va_start(VA_LIST, ARG) +#endif +#define va_end(VA_LIST) ((void)VA_LIST) +#define va_arg(VA_LIST, ARG_TYPE) \ + (*(ARG_TYPE*)__va_arg(VA_LIST, _var_arg_typeof(ARG_TYPE))) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/stddef.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/stddef.h new file mode 100644 index 0000000000..399d593226 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/stddef.h @@ -0,0 +1,26 @@ +#ifndef MSL_STDDEF_H +#define MSL_STDDEF_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif // NULL + +#define offsetof(ST, M) ((size_t) & (((ST*)0)->M)) + +typedef signed long intptr_t; +typedef unsigned long uintptr_t; +typedef intptr_t ptrdiff_t; + +typedef unsigned long size_t; + +#ifndef __cplusplus +typedef unsigned short wchar_t; +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/stdio.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdio.h new file mode 100644 index 0000000000..538fb215ef --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdio.h @@ -0,0 +1,8 @@ +#ifndef MSL_STDIO_H +#define MSL_STDIO_H +#include +#include +#include +#include +#include +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/stdlib.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdlib.h new file mode 100644 index 0000000000..885f193dc2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/stdlib.h @@ -0,0 +1,8 @@ +#ifndef MSL_STDLIB_H +#define MSL_STDLIB_H +#include +#include +#include +#include +#include +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/string.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/string.h new file mode 100644 index 0000000000..74b4e26d3c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/string.h @@ -0,0 +1,27 @@ +#ifndef MSL_STRING_H +#define MSL_STRING_H +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +char* strcpy(char*, const char*); +char* strncpy(char*, const char*, size_t); + +char* strcat(char*, const char*); +char* strncat(char*, const char*, size_t); + +int strcmp(const char*, const char*); +int strncmp(const char*, const char*, size_t); + +char* strchr(const char*, int); +char* strstr(const char*, const char*); + +size_t strlen(const char*); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/type_traits b/include/lib/BrawlHeaders/OpenRVL/include/stl/type_traits new file mode 100644 index 0000000000..565a4597c9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/type_traits @@ -0,0 +1,33 @@ + +#ifndef STL_TYPE_TRAITS_H +#define STL_TYPE_TRAITS_H + +namespace std { + template + struct remove_pointer { + typedef T type; + }; + + // Specializations for pointer types + template + struct remove_pointer { + typedef T type; + }; + + template + struct remove_pointer { + typedef T type; + }; + + template + struct remove_pointer { + typedef T type; + }; + + template + struct remove_pointer { + typedef T type; + }; +} + +#endif //STL_TYPE_TRAITS_H \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/include/stl/wchar.h b/include/lib/BrawlHeaders/OpenRVL/include/stl/wchar.h new file mode 100644 index 0000000000..5bfd82ee94 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/include/stl/wchar.h @@ -0,0 +1,18 @@ +#ifndef MSL_WCHAR_H +#define MSL_WCHAR_H +#include +#include +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define WCHAR_MIN SHRT_MIN +#define WCHAR_MAX USHRT_MAX + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Icon.c b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Icon.c new file mode 100644 index 0000000000..7fdd1a785b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Icon.c @@ -0,0 +1,5 @@ +#include + +void RFLSetIconDrawDoneCallback(RFLIconDrawDoneCallback callback) { + RFLiGetManager()->iconDrawCb = callback; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Model.c b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Model.c new file mode 100644 index 0000000000..83b67e2830 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_Model.c @@ -0,0 +1,1141 @@ +#include +#include +#include + +#define NON_MATCHING + +#define NUM_VTX_POS(size) ((size) / VTX_POS_SIZE) +#define SIZE_VTX_POS(count) ((count)*VTX_POS_SIZE) + +#define NUM_VTX_NRM(size) ((size) / VTX_NRM_SIZE) +#define SIZE_VTX_NRM(count) ((count)*VTX_NRM_SIZE) + +#define NUM_VTX_TXC(size) ((size) / VTX_TXC_SIZE) +#define SIZE_VTX_TXC(count) ((count)*VTX_TXC_SIZE) + +const RFLDrawCoreSetting cDefaultDrawCoreSetting2Tev = { + 1, GX_TEXCOORD0, GX_TEXMAP0, 2, GX_TEV_SWAP0, + GX_KCOLOR0, GX_TEVPREV, GX_PNMTX0, FALSE}; + +const RFLDrawCoreSetting cDefaultDrawCoreSetting1Tev = { + 1, GX_TEXCOORD0, GX_TEXMAP0, 1, GX_TEV_SWAP0, + GX_KCOLOR0, GX_TEVPREV, GX_PNMTX0, FALSE}; + +static const GXColor cFacelineColor[] = { + // clang-format off + {240, 216, 196, 255}, + {255, 188, 128, 255}, + {216, 136, 80, 255}, + {255, 176, 144, 255}, + {152, 80, 48, 255}, + {82, 46, 28, 255}, + // clang-format on +}; + +static const GXColor cHairColor[] = { + // clang-format off + {30, 26, 24, 255}, + {56, 32, 21, 255}, + {85, 38, 23, 255}, + {112, 64, 36, 255}, + {114, 114, 120, 255}, + {73, 54, 26, 255}, + {122, 89, 40, 255}, + {193, 159, 100, 255}, + // clang-format on +}; + +static const GXColor cBeardColor[] = { + // clang-format off + {30, 26, 24, 255}, + {56, 32, 21, 255}, + {85, 38, 23, 255}, + {112, 64, 36, 255}, + {114, 114, 120, 255}, + {73, 54, 26, 255}, + {122, 89, 40, 255}, + {193, 159, 100, 255}, + // clang-format on +}; + +static const GXColor cGlassColor[] = { + // clang-format off + {16, 16, 16, 255}, + {96, 56, 16, 255}, + {152, 24, 16, 255}, + {32, 48, 96, 255}, + {144, 88, 0, 255}, + {96, 88, 80, 255}, + // clang-format on +}; + +static const GXColor cFavoriteColor[RFLFavoriteColor_Max] = { + // clang-format off + {184, 64, 48, 255}, //!< RFLFavoriteColor_Red + {240, 120, 40, 255}, //!< RFLFavoriteColor_Orange + {248, 216, 32, 255}, //!< RFLFavoriteColor_Yellow + {128, 200, 40, 255}, //!< RFLFavoriteColor_YellowGreen + {0, 116, 40, 255}, //!< RFLFavoriteColor_Green + {32, 72, 152, 255}, //!< RFLFavoriteColor_Blue + {64, 160, 216, 255}, //!< RFLFavoriteColor_SkyBlue + {232, 96, 120, 255}, //!< RFLFavoriteColor_Pink + {112, 44, 168, 255}, //!< RFLFavoriteColor_Purple + {72, 56, 24, 255}, //!< RFLFavoriteColor_Brown + {224, 224, 224, 255}, //!< RFLFavoriteColor_White + {24, 24, 20, 255}, //!< RFLFavoriteColor_Black + // clang-format on +}; + +static const GXColor cWhite = {255, 255, 255, 255}; + +#ifndef NON_MATCHING +#error RFLSetCoordinate has not yet been matched. (https://decomp.me/scratch/hwzcs) +#endif +void RFLSetCoordinate(RFLCoordinateType u, RFLCoordinateType f) { + RFLCoordinateType r; + u8 bu[3]; + u8 bf[3]; + u8 br[3]; + + *((RFLCoordinateType*)bu) = u; + *((RFLCoordinateType*)bf) = f; + + br[0] = (bu[2] * bf[1]) - (bu[1] * bf[2]); + br[1] = (bu[0] * bf[2]) - (bu[2] * bf[0]); + br[2] = (bu[1] * bf[0]) - (bu[0] * bf[1]); + + r = *((RFLCoordinateType*)br); + + if (u & RFLCoordinateType_X) { + coordinateData.uOff = 0; // U -> X + } else if (u & RFLCoordinateType_Y) { + coordinateData.uOff = 1; // U -> Y + } else { + coordinateData.uOff = 2; // U -> Z + } + + if (f & RFLCoordinateType_X) { + coordinateData.fOff = 0; // F -> X + } else if (f & RFLCoordinateType_Y) { + coordinateData.fOff = 1; // F -> Y + } else { + coordinateData.fOff = 2; // F -> Z + } + + if (r & RFLCoordinateType_X) { + coordinateData.rOff = 0; // R -> X + } else if (r & RFLCoordinateType_Y) { + coordinateData.rOff = 1; // R -> Y + } else { + coordinateData.rOff = 2; // R -> Z + } + + coordinateData.uRev = (u & RFLCoordinateType_RevMask) != 0; + coordinateData.fRev = (f & RFLCoordinateType_RevMask) != 0; + coordinateData.rRev = (r & RFLCoordinateType_RevMask) != 0; +} + +u32 RFLiGetExpressionNum(u32 exprFlags) { + int i; + u32 num = 0; + + for (i = 0; i < RFLExp_Max; i++) { + if (exprFlags & (1 << i)) { + num++; + } + } + + return num; +} + +u32 RFLGetModelBufferSize(RFLResolution res, u32 exprFlags) { + const u32 exprNum = RFLiGetExpressionNum(exprFlags); + const s32 texSize = RFLiGetMaskBufSize(res); + + return ROUND_UP(exprNum * sizeof(GXTexObj), 32) + + ROUND_UP(sizeof(RFLiCharModelRes), 32) + + ROUND_UP(texSize * exprNum, 32); +} + +RFLErrcode RFLInitCharModel(RFLCharModel* model, RFLDataSource src, + RFLMiddleDB* db, u16 id, void* work, + RFLResolution res, u32 exprFlags) { + RFLiCharInfo info; + + RFLErrcode err = RFLiPickupCharInfo(&info, src, db, id); + if (err == RFLErrcode_Success) { + RFLiInitCharModel(model, &info, work, res, exprFlags); + } + + return err; +} + +void RFLiInitCharModel(RFLCharModel* model, RFLiCharInfo* info, void* work, + RFLResolution res, u32 exprFlags) { + RFLiCharModel* model_; + u32 maskSize; + u8* maskImages[RFLExp_Max]; + u32 maskRes; + GXTexObj* exprTexObj; + u8* image; + BOOL setExpr; + f32 maxLod; + u8 mipmap; + int i; + + model_ = (RFLiCharModel*)model; + + model_->resolution = res; + maskSize = RFLiGetMaskBufSize(res); + maskRes = RFLiGetMaxMaskRsl(res); + model_->res = work; + + // Expression texobjs + exprTexObj = + (GXTexObj*)ROUND_UP_PTR((u8*)work + sizeof(RFLiCharModelRes), 32); + for (i = 0; i < RFLExp_Max; i++) { + if (exprFlags & (1 << i)) { + model_->maskTexObj[i] = exprTexObj; + exprTexObj++; + } else { + model_->maskTexObj[i] = NULL; + } + } + + // Expression images + image = (u8*)ROUND_UP_PTR(exprTexObj, 32); + for (i = 0; i < RFLExp_Max; i++) { + if (exprFlags & (1 << i)) { + maskImages[i] = image; + image = (u8*)image + maskSize; + } else { + maskImages[i] = NULL; + } + } + + RFLiInitCharModelRes(model_->res, info); + + setExpr = FALSE; + mipmap = FALSE; + maxLod = 0.0f; + + switch (res) { + case RFLResolution_64M: + maxLod = 1.0f; + mipmap = TRUE; + break; + case RFLResolution_128M: + maxLod = 2.0f; + mipmap = TRUE; + break; + case RFLResolution_256M: + maxLod = 3.0f; + mipmap = TRUE; + break; + } + + for (i = 0; i < RFLExp_Max; i++) { + if (model_->maskTexObj[i] != NULL) { + GXInitTexObj(model_->maskTexObj[i], maskImages[i], maskRes, maskRes, + GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, mipmap); + + if (mipmap) { + GXInitTexObjLOD(model_->maskTexObj[i], GX_LIN_MIP_LIN, + GX_LINEAR, 0.0f, maxLod, 0.0f, 0, 0, + GX_ANISO_1); + } else { + GXInitTexObjLOD(model_->maskTexObj[i], GX_LINEAR, GX_LINEAR, + 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1); + } + + if (!setExpr) { + model_->expression = (RFLExpression)i; + setExpr = TRUE; + } + } + } + + RFLiMakeTexture(info, maskImages, res); +} + +void RFLSetMtx(RFLCharModel* model, const Mtx mvMtx) { + RFLiCharModel* model_ = (RFLiCharModel*)model; + PSMTXCopy(mvMtx, model_->posMtx); + PSMTXInvXpose(mvMtx, model_->nrmMtx); +} + +void RFLSetExpression(RFLCharModel* model, RFLExpression expr) { + RFLiCharModel* model_ = (RFLiCharModel*)model; + model_->expression = expr; +} + +RFLExpression RFLGetExpression(RFLCharModel* model) { + RFLiCharModel* model_ = (RFLiCharModel*)model; + return model_->expression; +} + +GXColor RFLGetFavoriteColor(RFLFavoriteColor color) { + return cFavoriteColor[color]; +} + +GXColor RFLiGetFacelineColor(RFLiCharInfo* info) { + s32 color = 0; + + if (info->faceline.color < ARRAY_LENGTH(cFacelineColor)) { + color = info->faceline.color; + } + + return cFacelineColor[color]; +} + +void RFLLoadDrawSetting(const RFLDrawSetting* setting) { + GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_NEVER, 0); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_COPY); + GXSetZMode(1, GX_LEQUAL, 1); + GXSetZCompLoc(setting->compLoc); + GXSetColorUpdate(1); + GXSetAlphaUpdate(1); + GXSetDither(0); + GXSetDstAlpha(0, 0); + + if (setting->lightEnable) { + GXSetTevDirect(GX_TEVSTAGE1); + GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0); + GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, + GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, + GX_CC_ZERO); + GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_0, 1, + GX_TEVPREV); + GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, + GX_CA_APREV); + GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_0, 1, + GX_TEVPREV); + + RFLLoadMaterialSetting(&cDefaultDrawCoreSetting2Tev); + RFLLoadVertexSetting(&cDefaultDrawCoreSetting2Tev); + GXSetNumChans(1); + + GXSetChanCtrl(GX_COLOR0, 1, GX_SRC_REG, GX_SRC_REG, setting->lightMask, + setting->diffuse, setting->attn); + GXSetChanCtrl(GX_ALPHA0, 0, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, + GX_DF_NONE, GX_AF_NONE); + GXSetChanAmbColor(GX_COLOR0, setting->ambColor); + GXSetChanMatColor(GX_COLOR0, cWhite); + } else { + RFLLoadMaterialSetting(&cDefaultDrawCoreSetting1Tev); + RFLLoadVertexSetting(&cDefaultDrawCoreSetting1Tev); + GXSetNumChans(0); + } +} + +void RFLDrawOpa(const RFLCharModel* model) { + RFLDrawOpaCore(model, &cDefaultDrawCoreSetting2Tev); +} + +void RFLDrawXlu(const RFLCharModel* model) { + RFLDrawXluCore(model, &cDefaultDrawCoreSetting2Tev); +} + +void RFLLoadVertexSetting(const RFLDrawCoreSetting* setting) { + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_VA_TEX1MTXIDX); + GXSetVtxDesc(GX_VA_NRM, GX_VA_TEX1MTXIDX); + GXSetVtxDesc(GX_VA_TEX0, GX_VA_TEX1MTXIDX); + GXSetVtxAttrFmt(0, GX_VA_POS, 1, 3, 8); + GXSetVtxAttrFmt(0, GX_VA_NRM, 0, 3, 14); + GXSetVtxAttrFmt(0, GX_VA_TEX0, 1, 3, 13); + GXSetNumTexGens(setting->txcGenNum); +} + +void RFLLoadMaterialSetting(const RFLDrawCoreSetting* setting) { + GXSetTevSwapModeTable(setting->tevSwapTable, GX_CH_RED, GX_CH_GREEN, + GX_CH_BLUE, GX_CH_ALPHA); + GXSetTevSwapModeTable(setting->tevSwapTable + 1, GX_CH_RED, GX_CH_ALPHA, + GX_CH_BLUE, GX_CH_GREEN); + GXSetNumTevStages(setting->tevStageNum); + GXSetTevDirect(GX_TEVSTAGE0); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_0, 1, + setting->tevOutRegID); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_0, 1, + setting->tevOutRegID); + GXSetTevKColorSel(GX_TEVSTAGE0, + (GXTevKColorSel)(setting->tevKColorID + GX_TEV_KCSEL_K0)); + GXSetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_8_8); +} + +void RFLDrawOpaCore(const RFLCharModel* model, + const RFLDrawCoreSetting* setting) { + RFLiCharModel* model_ = (RFLiCharModel*)model; + RFLiCharModelRes* res = model_->res; + + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, + GX_CA_KONST); + + // @bug Copy-paste error(?) + GXSetTevSwapMode(GX_TEVSTAGE0, setting->tevSwapTable, + setting->tevSwapTable); + GXSetTevSwapMode(GX_TEVSTAGE0, setting->tevSwapTable, + setting->tevSwapTable); + + GXSetCullMode(setting->reverseCulling ? GX_CULL_FRONT : GX_CULL_BACK); + + GXLoadPosMtxImm(model_->posMtx, setting->posNrmMtxID); + GXLoadNrmMtxImm(model_->nrmMtx, setting->posNrmMtxID); + GXSetCurrentMtx(setting->posNrmMtxID); + + GXSetTexCoordGen(setting->txcID, GX_TG_MTX2x4, GX_TG_POS, 0x3C); + GXSetVtxDesc(GX_VA_TEX0, GX_VA_PNMTXIDX); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, + GX_COLOR_NULL); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, + GX_CC_KONST); + + if (res->beardDlSize > 0) { + GXSetTevKColor(setting->tevKColorID, cBeardColor[res->beardColor]); + GXSetArray(GX_VA_POS, res->beardVtxPos, 6); + GXSetArray(GX_VA_NRM, res->beardVtxNrm, 6); + GXCallDisplayList(res->beardDl, res->beardDlSize); + } + + GXSetTevKColor(setting->tevKColorID, cFacelineColor[res->facelineColor]); + + if (res->noseDlSize > 0) { + GXSetArray(GX_VA_POS, res->noseVtxPos, 6); + GXSetArray(GX_VA_NRM, res->noseVtxNrm, 6); + GXCallDisplayList(res->noseDl, res->noseDlSize); + } + + if (res->flipHair) { + GXSetCullMode(setting->reverseCulling ? GX_CULL_BACK : GX_CULL_FRONT); + } + + if (res->foreheadDlSize > 0) { + GXSetArray(GX_VA_POS, res->foreheadVtxPos, 6); + GXSetArray(GX_VA_NRM, res->foreheadVtxNrm, 6); + GXCallDisplayList(res->foreheadDl, res->foreheadDlSize); + } + + if (res->hairDlSize > 0) { + GXSetTevKColor(setting->tevKColorID, cHairColor[res->hairColor]); + GXSetArray(GX_VA_POS, res->hairVtxPos, 6); + GXSetArray(GX_VA_NRM, res->hairVtxNrm, 6); + GXCallDisplayList(res->hairDl, res->hairDlSize); + } + + GXSetTevOrder(GX_TEVSTAGE0, setting->txcID, setting->texMapID, + GX_COLOR_NULL); + GXSetTexCoordGen(setting->txcID, GX_TG_MTX2x4, GX_TG_TEX0, 0x3C); + GXSetVtxDesc(GX_VA_TEX0, GX_VA_TEX1MTXIDX); + + if (res->capDlSize > 0) { + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_KONST, GX_CC_TEXC, + GX_CC_KONST); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_3, 1, + setting->tevOutRegID); + GXSetTevKColor(setting->tevKColorID, + cFavoriteColor[res->favoriteColor]); + + GXLoadTexObj(&res->capTexObj, setting->texMapID); + GXSetArray(GX_VA_POS, res->capVtxPos, 6); + GXSetArray(GX_VA_NRM, res->capVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->capVtxTxc, 4); + GXCallDisplayList(res->capDl, res->capDlSize); + + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_TEV_SCALE_0, 1, + setting->tevOutRegID); + } + + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_KONST, GX_CC_TEXC, GX_CC_TEXA, + GX_CC_ZERO); + GXSetTevKColor(setting->tevKColorID, cFacelineColor[res->facelineColor]); + GXSetTevSwapMode(GX_TEVSTAGE0, setting->tevSwapTable, + (GXTevSwapSel)(setting->tevSwapTable + 1)); + + if (res->flipHair) { + GXSetCullMode(setting->reverseCulling ? GX_CULL_FRONT : GX_CULL_BACK); + } + + GXLoadTexObj(&res->faceTexObj, setting->texMapID); + GXSetArray(GX_VA_POS, res->faceVtxPos, 6); + GXSetArray(GX_VA_NRM, res->faceVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->faceVtxTxc, 4); + GXCallDisplayList(res->faceDl, res->faceDlSize); +} + +void RFLDrawXluCore(const RFLCharModel* model, + const RFLDrawCoreSetting* setting) { + RFLiCharModel* model_ = (RFLiCharModel*)model; + RFLiCharModelRes* res = model_->res; + + GXSetTevOrder(GX_TEVSTAGE0, setting->txcID, setting->texMapID, + GX_COLOR_NULL); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, + GX_CA_TEXA); + GXSetTevSwapMode(GX_TEVSTAGE0, setting->tevSwapTable, + setting->tevSwapTable); + + GXLoadPosMtxImm(model_->posMtx, setting->posNrmMtxID); + GXLoadNrmMtxImm(model_->nrmMtx, setting->posNrmMtxID); + GXSetCurrentMtx(setting->posNrmMtxID); + + GXSetTexCoordGen(setting->txcID, GX_TG_MTX2x4, GX_TG_TEX0, 0x3C); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, + GX_CC_TEXC); + GXSetCullMode(setting->reverseCulling ? GX_CULL_FRONT : GX_CULL_BACK); + + GXLoadTexObj(model_->maskTexObj[model_->expression], setting->texMapID); + GXSetArray(GX_VA_POS, res->maskVtxPos, 6); + GXSetArray(GX_VA_NRM, res->maskVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->maskVtxTxc, 4); + GXCallDisplayList(res->maskDl, res->maskDlSize); + + if (res->noselineDlSize > 0) { + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, + GX_CC_ZERO); + GXLoadTexObj(&res->noseTexObj, setting->texMapID); + GXSetArray(GX_VA_POS, res->noselineVtxPos, 6); + GXSetArray(GX_VA_NRM, res->noselineVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->noselineVtxTxc, 4); + GXCallDisplayList(res->noselineDl, res->noselineDlSize); + } + + if (res->glassesDlSize > 0) { + GXSetTevKColor(setting->tevKColorID, cGlassColor[res->glassesColor]); + GXSetCullMode(GX_CULL_NONE); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_KONST, GX_CC_TEXC, + GX_CC_ZERO); + GXLoadTexObj(&res->glassesTexObj, setting->texMapID); + GXSetArray(GX_VA_POS, res->glassesVtxPos, 6); + GXSetArray(GX_VA_NRM, res->glassesVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->glassesVtxTxc, 4); + GXCallDisplayList(res->glassesDl, res->glassesDlSize); + } +} + +#ifndef NON_MATCHING +#error RFLiInitCharModelRes has not yet been matched. (https://decomp.me/scratch/ykVdn) +#endif +void RFLiInitCharModelRes(RFLiCharModelRes* res, const RFLiCharInfo* info) { + Vec noseTrans; + Vec beardTrans; + Vec hairTrans; + + GXSetMisc(1, 0); + GXSetMisc(2, 1); + + /** + * Faceline shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Faceline; + arg.file = info->faceline.type; + arg.vtxPosBuf = res->faceVtxPos; + arg.vtxNrmBuf = res->faceVtxNrm; + arg.vtxTxcBuf = res->faceVtxTxc; + arg.dlBuf = res->faceDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->faceVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->faceVtxNrm)); + arg.vtxTxcBufSize = NUM_VTX_TXC(sizeof(res->faceVtxTxc)); + arg.dlBufSize = sizeof(res->faceDl); + arg.noseTrans = &noseTrans; + arg.beardTrans = &beardTrans; + arg.hairTrans = &hairTrans; + arg.flipX = FALSE; + arg.transform = FALSE; + RFLiInitShapeRes(&arg); + + res->faceDlSize = arg.dlSize; + } + + /** + * Cap shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Cap; + arg.file = info->hair.type; + arg.vtxPosBuf = res->capVtxPos; + arg.vtxNrmBuf = res->capVtxNrm; + arg.vtxTxcBuf = res->capVtxTxc; + arg.dlBuf = res->capDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->capVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->capVtxNrm)); + arg.vtxTxcBufSize = NUM_VTX_TXC(sizeof(res->capVtxTxc)); + arg.dlBufSize = sizeof(res->capDl); + arg.flipX = info->hair.flip; + arg.transform = TRUE; + arg.posScale = 1.0f; + arg.posTrans = &hairTrans; + RFLiInitShapeRes(&arg); + + res->capDlSize = arg.dlSize; + + res->hairVtxPos = (s16*)((u8*)res->capVtxPos + + (arg.numVtxPos * 4 - arg.numVtxPos) * 2); + res->hairVtxNrm = (s16*)((u8*)res->capVtxNrm + + (arg.numVtxNrm * 4 - arg.numVtxNrm) * 2); + + res->hairDl = res->noseDl + ROUND_UP(arg.dlSize, 32) + + offsetof(RFLiCharModelRes, capDl); + } + + /** + * Hair shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Hair; + arg.file = info->hair.type; + arg.vtxPosBuf = res->hairVtxPos; + arg.vtxNrmBuf = res->hairVtxNrm; + arg.dlBuf = res->hairDl; + + arg.vtxPosBufSize = + NUM_VTX_POS(sizeof(res->capVtxPos)) - + (((uintptr_t)res->hairVtxPos - (uintptr_t)res->capVtxPos) / + VTX_COORD_SIZE) / + VTX_COORDS_IN_POS; + + arg.vtxNrmBufSize = + NUM_VTX_POS(sizeof(res->capVtxNrm)) - + (((uintptr_t)res->hairVtxNrm - (uintptr_t)res->capVtxNrm) / + VTX_COORD_SIZE) / + VTX_COORDS_IN_NRM; + + arg.dlBufSize = sizeof(res->capDl) - + ((uintptr_t)res->hairDl - (uintptr_t)res->capDl); + + arg.flipX = info->hair.flip; + arg.transform = TRUE; + arg.posScale = 1.0f; + arg.posTrans = &hairTrans; + RFLiInitShapeRes(&arg); + + res->hairDlSize = arg.dlSize; + + res->foreheadVtxPos = (s16*)((u8*)res->hairVtxPos + + (arg.numVtxPos * 4 - arg.numVtxPos) * 2); + + res->foreheadVtxNrm = (s16*)((u8*)res->hairVtxNrm + + (arg.numVtxNrm * 4 - arg.numVtxNrm) * 2); + + res->foreheadDl = res->hairDl + ROUND_UP(arg.dlSize, 32); + + res->flipHair = info->hair.flip; + } + + /** + * Forehead shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Forehead; + arg.file = info->hair.type; + arg.vtxPosBuf = res->foreheadVtxPos; + arg.vtxNrmBuf = res->foreheadVtxNrm; + arg.dlBuf = res->foreheadDl; + + arg.vtxPosBufSize = + NUM_VTX_POS(sizeof(res->capVtxPos)) - + (((uintptr_t)res->foreheadVtxPos - (uintptr_t)res->capVtxPos) / + VTX_COORD_SIZE) / + VTX_COORDS_IN_POS; + + arg.vtxNrmBufSize = + NUM_VTX_POS(sizeof(res->capVtxNrm)) - + (((uintptr_t)res->foreheadVtxNrm - (uintptr_t)res->capVtxNrm) / + VTX_COORD_SIZE) / + VTX_COORDS_IN_NRM; + + arg.dlBufSize = sizeof(res->capDl) - + ((uintptr_t)res->foreheadDl - (uintptr_t)res->capDl); + + arg.flipX = info->hair.flip; + arg.transform = TRUE; + arg.posScale = 1.0f; + arg.posTrans = &hairTrans; + RFLiInitShapeRes(&arg); + + res->foreheadDlSize = arg.dlSize; + } + + /** + * Beard shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Beard; + arg.file = info->beard.type; + arg.vtxPosBuf = res->beardVtxPos; + arg.vtxNrmBuf = res->beardVtxNrm; + arg.dlBuf = res->beardDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->beardVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->beardVtxNrm)); + arg.dlBufSize = sizeof(res->beardDl); + arg.flipX = FALSE; + arg.transform = TRUE; + arg.posScale = 1.0f; + arg.posTrans = &beardTrans; + RFLiInitShapeRes(&arg); + + res->beardDlSize = arg.dlSize; + } + + { + f32 scale; + Vec trans; + + /** + * Nose shape + */ + { + RFLiShapeRes arg; + + scale = 0.4f + 0.175f * info->nose.scale; + + trans.x = noseTrans.x; + trans.y = +noseTrans.y + -1.5f * (info->nose.y - 8); + trans.z = noseTrans.z; + + arg.part = RFLiPartsShp_Nose; + arg.file = info->nose.type; + arg.vtxPosBuf = res->noseVtxPos; + arg.vtxNrmBuf = res->noseVtxNrm; + arg.dlBuf = res->noseDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->noseVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->noseVtxNrm)); + arg.dlBufSize = sizeof(res->noseDl); + arg.flipX = FALSE; + arg.transform = TRUE; + arg.posScale = scale; + arg.posTrans = &trans; + RFLiInitShapeRes(&arg); + + res->noseDlSize = arg.dlSize; + } + + /** + * Noseline shape + */ + { + RFLiShapeRes arg; + + arg.part = RFLiPartsShp_Noseline; + arg.file = info->nose.type; + arg.vtxPosBuf = res->noselineVtxPos; + arg.vtxNrmBuf = res->noselineVtxNrm; + arg.vtxTxcBuf = res->noselineVtxTxc; + arg.dlBuf = res->noselineDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->noselineVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->noselineVtxNrm)); + arg.vtxTxcBufSize = NUM_VTX_TXC(sizeof(res->noselineVtxTxc)); + arg.dlBufSize = sizeof(res->noselineDl); + arg.flipX = FALSE; + arg.transform = TRUE; + arg.posScale = scale; + arg.posTrans = &trans; + RFLiInitShapeRes(&arg); + + res->noselineDlSize = arg.dlSize; + } + } + + /** + * Mask shape + */ + { + RFLiShapeRes arg; + arg.part = RFLiPartsShp_Mask; + arg.file = info->faceline.type; + arg.vtxPosBuf = res->maskVtxPos; + arg.vtxNrmBuf = res->maskVtxNrm; + arg.vtxTxcBuf = res->maskVtxTxc; + arg.dlBuf = res->maskDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->maskVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->maskVtxNrm)); + arg.vtxTxcBufSize = NUM_VTX_TXC(sizeof(res->maskVtxTxc)); + arg.dlBufSize = sizeof(res->maskDl); + arg.flipX = FALSE; + arg.transform = FALSE; + RFLiInitShapeRes(&arg); + + res->maskDlSize = arg.dlSize; + } + + /** + * Glasses shape + */ + { + RFLiShapeRes arg; + f32 scale; + Vec trans; + + scale = 0.15f * info->glass.scale + 0.4f; + + trans.x = noseTrans.x; + trans.y = 5.0f + noseTrans.y + -1.5f * (info->glass.y - 11); + trans.z = 2.0f + noseTrans.z; + + arg.part = RFLiPartsShp_Glass; + arg.file = 0; + arg.vtxPosBuf = res->glassesVtxPos; + arg.vtxNrmBuf = res->glassesVtxNrm; + arg.vtxTxcBuf = res->glassesVtxTxc; + arg.dlBuf = res->glassesDl; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(res->glassesVtxPos)); + arg.vtxNrmBufSize = NUM_VTX_NRM(sizeof(res->glassesVtxNrm)); + arg.vtxTxcBufSize = NUM_VTX_TXC(sizeof(res->glassesVtxTxc)); + arg.dlBufSize = sizeof(res->glassesDl); + arg.flipX = FALSE; + arg.transform = TRUE; + arg.posScale = scale; + arg.posTrans = &trans; + RFLiInitShapeRes(&arg); + + res->glassesDlSize = arg.dlSize; + } + + RFLiInitTexRes(&res->faceTexObj, RFLiPartsShpTex_Face, + info->faceline.texture, res->faceTex); + + if (res->capDlSize > 0) { + RFLiInitTexRes(&res->capTexObj, RFLiPartsShpTex_Cap, info->hair.type, + res->capTex); + } + + if (res->noselineDlSize > 0) { + RFLiInitTexRes(&res->noseTexObj, RFLiPartsShpTex_Noseline, + info->nose.type, res->noseTex); + } + + RFLiInitTexRes(&res->glassesTexObj, RFLiPartsShpTex_Glass, info->glass.type, + res->glassesTex); + + res->facelineColor = info->faceline.color; + res->hairColor = info->hair.color; + res->beardColor = info->beard.color; + res->glassesColor = info->glass.color; + res->favoriteColor = info->personal.color; + + DCFlushRange(res, sizeof(RFLiCharModelRes)); +} + +#ifndef NON_MATCHING +#error RFLiInitShapeRes has not yet been matched. (https://decomp.me/scratch/eYP1o) +#endif +void RFLiInitShapeRes(RFLiShapeRes* shape) { + // TODO: Keep this from being stripped + static const u32 csHeader[RFLiPartsShp_Max] = { + 'nose', 'frhd', 'face', 'hair', 'cap_', 'berd', 'nsln', 'mask', 'glas'}; + + void* res; + u8* ptr8; + BOOL skipTxc; + u32 fileSize; + + // Not all shapes have tex coords + skipTxc = shape->part == RFLiPartsShp_Forehead || + shape->part == RFLiPartsShp_Hair || + shape->part == RFLiPartsShp_Beard || + shape->part == RFLiPartsShp_Nose; + + fileSize = RFLiGetShapeSize(shape->part, shape->file); + res = RFLiAlloc32(fileSize); + RFLiLoadShape(shape->part, shape->file, res); + + ptr8 = (u8*)res; + ptr8 += sizeof(u32); + + // Faceline extra data + if (shape->part == RFLiPartsShp_Faceline) { + memcpy(shape->noseTrans, ptr8, sizeof(Vec)); + ptr8 += sizeof(Vec); + memcpy(shape->beardTrans, ptr8, sizeof(Vec)); + ptr8 += sizeof(Vec); + memcpy(shape->hairTrans, ptr8, sizeof(Vec)); + ptr8 += sizeof(Vec); + } + + /** + * Vertex positions + */ + + if (*(u16*)ptr8 == 0) { + shape->numVtxPos = 0; + shape->numVtxNrm = 0; + shape->numVtxTxc = 0; + shape->dlSize = 0; + RFLiFree(ptr8); + return; + } + + shape->numVtxPos = *(u16*)ptr8; + ptr8 += sizeof(u16); + + { + u32 byteSize; + s16* ptr16; + int i; + + ptr16 = (s16*)ptr8; + byteSize = SIZE_VTX_POS(shape->numVtxPos); + + if (shape->transform) { + s32 s, tx, ty, tz; + + s = 256.0f * shape->posScale; + tx = 256.0f * shape->posTrans->x; + ty = 256.0f * shape->posTrans->y; + tz = 256.0f * shape->posTrans->z; + + for (i = 0; i < shape->numVtxPos; i++) { + s16 temp[3]; + + if (shape->flipX) { + temp[0] = ((-ptr16[0] * s) >> 8) + tx; + } else { + temp[0] = ((ptr16[0] * s) >> 8) + tx; + } + + temp[1] = ((ptr16[1] * s) >> 8) + ty; + temp[2] = ((ptr16[2] * s) >> 8) + tz; + + RFLiTransformCoordinate( + &shape->vtxPosBuf[i * VTX_COORDS_IN_POS], temp); + ptr16 += VTX_COORDS_IN_POS; + } + + } else if (shape->flipX != 0) { + for (i = 0; i < shape->numVtxPos; i++) { + s16 temp[3]; + + temp[0] = -ptr16[0]; + temp[1] = ptr16[1]; + temp[2] = ptr16[2]; + + RFLiTransformCoordinate( + &shape->vtxPosBuf[i * VTX_COORDS_IN_POS], temp); + ptr16 += VTX_COORDS_IN_POS; + } + } else { + for (i = 0; i < shape->numVtxPos; i++) { + RFLiTransformCoordinate( + &shape->vtxPosBuf[i * VTX_COORDS_IN_POS], ptr16); + ptr16 += VTX_COORDS_IN_POS; + } + } + + ptr8 += byteSize; + } + + /** + * Vertex normals + */ + + shape->numVtxNrm = *(u16*)ptr8; + ptr8 += sizeof(u16); + + { + int i; + u32 byteSize; + s16* ptr16; + + ptr16 = (s16*)ptr8; + byteSize = SIZE_VTX_NRM(shape->numVtxNrm); + + if (shape->flipX != 0) { + for (i = 0; i < shape->numVtxNrm; i++) { + s16 temp[3]; + + temp[0] = -ptr16[0]; + temp[1] = ptr16[1]; + temp[2] = ptr16[2]; + + RFLiTransformCoordinate( + &shape->vtxNrmBuf[i * VTX_COORDS_IN_NRM], temp); + ptr16 += VTX_COORDS_IN_NRM; + } + } else { + for (i = 0; i < shape->numVtxNrm; i++) { + RFLiTransformCoordinate( + &shape->vtxNrmBuf[i * VTX_COORDS_IN_NRM], ptr16); + ptr16 += VTX_COORDS_IN_NRM; + } + } + + ptr8 += byteSize; + } + + /** + * Vertex texcoords + */ + + { + u32 byteSize; + + if (skipTxc) { + shape->numVtxTxc = 0; + } else { + shape->numVtxTxc = *(u16*)ptr8; + ptr8 += sizeof(u16); + + byteSize = SIZE_VTX_TXC(shape->numVtxTxc); + memcpy(shape->vtxTxcBuf, ptr8, byteSize); + ptr8 += byteSize; + } + } + + /** + * Display list + */ + + { + int i; + s32 primitiveNum; + + primitiveNum = *ptr8; + ptr8 += sizeof(u8); + + DCInvalidateRange(shape->dlBuf, shape->dlBufSize); + GXBeginDisplayList(shape->dlBuf, shape->dlBufSize); + + for (i = 0; i < primitiveNum; i++) { + int j; + u16 vtxNum; + GXPrimitive prim; + + vtxNum = *ptr8++; + prim = (GXPrimitive)*ptr8++; + + GXBegin(prim, 0, vtxNum); + { + for (j = 0; j < vtxNum; j++) { + GXPosition1x8(*ptr8++); + GXNormal1x8(*ptr8++); + + if (!skipTxc) { + GXTexCoord1x8(*ptr8++); + } + } + } + GXEnd(); + } + } + + shape->dlSize = GXEndDisplayList(); + RFLiFree(ptr8); +} + +void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex part, u16 file, + void* buffer) { + u32 texSize; + RFLiTexture* tex; + + tex = (RFLiTexture*)RFLiAlloc32(RFLiGetShpTexSize(part, file)); + RFLiLoadShpTexture(part, file, tex); + + switch (part) { + case RFLiPartsShpTex_Face: + texSize = tex->height * tex->width * 2; + break; + case RFLiPartsShpTex_Cap: + case RFLiPartsShpTex_Noseline: + texSize = tex->height * tex->width / 2; + break; + case RFLiPartsShpTex_Glass: + texSize = tex->height * tex->width; + break; + } + + memcpy(buffer, RFLiGetTexImage(tex), texSize); + GXInitTexObj(texObj, buffer, tex->width, tex->height, tex->format, + tex->wrapS, tex->wrapT, 0); + GXInitTexObjLOD(texObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0, 0, + GX_ANISO_1); + RFLiFree(tex); +} + +void RFLiTransformCoordinate(s16* to, const s16* from) { + to[coordinateData.rOff] = coordinateData.rRev ? -from[0] : from[0]; + to[coordinateData.uOff] = coordinateData.uRev ? -from[1] : from[1]; + to[coordinateData.fOff] = coordinateData.fRev ? -from[2] : from[2]; +} + +void RFLDrawShape(const RFLCharModel* model) { + GXCullMode cullMode; + RFLiCharModel* model_ = (RFLiCharModel*)model; + RFLiCharModelRes* res = model_->res; + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_VA_TEX1MTXIDX); + GXSetVtxDesc(GX_VA_NRM, GX_VA_TEX1MTXIDX); + GXSetVtxAttrFmt(0, GX_VA_POS, 1, 3, 8); + GXSetVtxAttrFmt(0, GX_VA_NRM, 0, 3, 14); + GXSetVtxAttrFmt(0, GX_VA_TEX0, 1, 3, 13); + + GXLoadPosMtxImm(model_->posMtx, 0); + GXLoadNrmMtxImm(model_->nrmMtx, 0); + GXSetCurrentMtx(0); + + if (res->beardDlSize > 0) { + GXSetArray(GX_VA_POS, res->beardVtxPos, 6); + GXSetArray(GX_VA_NRM, res->beardVtxNrm, 6); + GXCallDisplayList(res->beardDl, res->beardDlSize); + } + + if (res->noseDlSize > 0) { + GXSetArray(GX_VA_POS, res->noseVtxPos, 6); + GXSetArray(GX_VA_NRM, res->noseVtxNrm, 6); + GXCallDisplayList(res->noseDl, res->noseDlSize); + } + + if (res->flipHair) { + GXGetCullMode(&cullMode); + switch (cullMode) { + case GX_CULL_BACK: + GXSetCullMode(GX_CULL_FRONT); + break; + case GX_CULL_FRONT: + GXSetCullMode(GX_CULL_BACK); + break; + } + } + + if (res->foreheadDlSize > 0) { + GXSetArray(GX_VA_POS, res->foreheadVtxPos, 6); + GXSetArray(GX_VA_NRM, res->foreheadVtxNrm, 6); + GXCallDisplayList(res->foreheadDl, res->foreheadDlSize); + } + + if (res->hairDlSize > 0) { + GXSetArray(GX_VA_POS, res->hairVtxPos, 6); + GXSetArray(GX_VA_NRM, res->hairVtxNrm, 6); + GXCallDisplayList(res->hairDl, res->hairDlSize); + } + + GXSetVtxDesc(GX_VA_TEX0, GX_VA_TEX1MTXIDX); + if (res->capDlSize > 0) { + GXSetArray(GX_VA_POS, res->capVtxPos, 6); + GXSetArray(GX_VA_NRM, res->capVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->capVtxTxc, 4); + GXCallDisplayList(res->capDl, res->capDlSize); + } + + if (res->flipHair) { + switch (cullMode) { + case GX_CULL_BACK: + GXSetCullMode(GX_CULL_BACK); + break; + case GX_CULL_FRONT: + GXSetCullMode(GX_CULL_FRONT); + break; + } + } + + GXSetArray(GX_VA_POS, res->faceVtxPos, 6); + GXSetArray(GX_VA_NRM, res->faceVtxNrm, 6); + GXSetArray(GX_VA_TEX0, res->faceVtxTxc, 4); + GXCallDisplayList(res->faceDl, res->faceDlSize); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDAccess.c b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDAccess.c new file mode 100644 index 0000000000..5c0800d5e7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDAccess.c @@ -0,0 +1,1134 @@ +#include +#include +#include +#include + +#define ACC_SAFE_BUFFER_SIZE 0x2000 +#define MAX_RETRY_COUNT 30 + +static const char* scFileNames[RFLiFileType_Max] = { + "/shared2/menu/FaceLib/RFL_DB.dat", //!< RFLiFileType_Database + "/shared2/menu/FaceLib/RFL_Res.dat" //!< RFLiFileType_Resource +}; + +static const char* scFirstDirectory = "/shared2/menu"; +static const char* scSecondDirectory = "/shared2/menu/FaceLib"; + +static const u8 scFilePermissions[RFLiFileType_Max] = { + NAND_PERM_RWALL, //!< RFLiFileType_Database + NAND_PERM_RALL //!< RFLiFileType_Resource +}; + +static const u8 scFileAttributes[RFLiFileType_Max] = { + 0, //!< RFLiFileType_Database + 0 //!< RFLiFileType_Resource +}; + +static void opencallback_(s32 result, NANDCommandBlock* block); +static void createcallback_(s32 result, NANDCommandBlock* block); +static void close2opencallback_(s32 result, NANDCommandBlock* block); +static void readcallback_(s32 result, NANDCommandBlock* block); +static void writecallback_(s32 result, NANDCommandBlock* block); +static void readseekcallback_(s32 result, NANDCommandBlock* block); +static void writecallback_(s32 result, NANDCommandBlock* block); +static void writeseekcallback_(s32 result, NANDCommandBlock* block); +static void closecallback_(s32 result, NANDCommandBlock* block); +static void getlengthcallback_(s32 result, NANDCommandBlock* block); +static void deletecallback_(s32 result, NANDCommandBlock* block); +static void createdircallback1_(s32 result, NANDCommandBlock* block); +static void createdircallback2_(s32 result, + NANDCommandBlock* block) DECOMP_DONT_INLINE; + +void RFLiInitAccessInfo(MEMiHeapHead* heap) { + u16 i; + + for (i = 0; i < RFLiFileType_Max; i++) { + RFLiAccessInfo* info = RFLiGetAccInfo((RFLiFileType)i); + memset(info, 0, sizeof(RFLiAccessInfo)); + info->safeBuffer = + MEMAllocFromExpHeapEx(heap, ACC_SAFE_BUFFER_SIZE, 32); + OSCreateAlarm(&info->alarm); + } +} + +void RFLiExitAccessInfo(void) { + u16 i; + + for (i = 0; i < RFLiFileType_Max; i++) { + RFLiAccessInfo* info = RFLiGetAccInfo((RFLiFileType)i); + OSCancelAlarm(&info->alarm); + } +} + +BOOL RFLiIsWorking(void) { return RFLiGetWorking(); } + +void RFLiStartWorking(void) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + RFLiSetWorking(TRUE); + RFLiGetManager()->lastErrCode = RFLErrcode_Busy; + + OSRestoreInterrupts(enabled); +} + +static void startWorkingClose_(void) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + RFLiSetWorking(TRUE); + RFLiGetManager()->beforeCloseErr = RFLiGetManager()->lastErrCode; + RFLiGetManager()->beforeCloseReason = RFLiGetManager()->lastReason; + RFLiGetManager()->lastErrCode = RFLErrcode_Busy; + + OSRestoreInterrupts(enabled); +} + +static void endWorkingCloseReason_(RFLErrcode err, s32 reason) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + RFLiSetWorking(FALSE); + if (err == RFLErrcode_Success) { + RFLiGetManager()->lastErrCode = RFLiGetManager()->beforeCloseErr; + // @bug Reason (NAND code) set to RFLErrcode + RFLiGetManager()->lastReason = RFLiGetManager()->beforeCloseErr; + } else { + RFLiGetManager()->lastErrCode = err; + RFLiGetManager()->lastReason = reason; + } + + OSRestoreInterrupts(enabled); +} + +static void endWorkingClose_(RFLErrcode err) { + endWorkingCloseReason_(err, NAND_RESULT_OK); +} + +void RFLiEndWorkingReason(RFLErrcode err, s32 reason) { + BOOL enabled; + + switch (RFLiGetManager()->lastErrCode) { + case RFLErrcode_Busy: + case RFLErrcode_Success: + enabled = OSDisableInterrupts(); + + RFLiSetWorking(FALSE); + RFLiGetManager()->lastErrCode = err; + RFLiGetManager()->lastReason = reason; + + OSRestoreInterrupts(enabled); + break; + default: + break; + } +} + +void RFLiEndWorking(RFLErrcode err) { + RFLiEndWorkingReason(err, NAND_RESULT_OK); +} + +NANDCommandBlock* RFLiSetCommandBlock(RFLiFileType type, RFLiAsyncTag tag) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + RFLiCallbackTag* data; + + block = &RFLiGetAccInfo(type)->block; + info = RFLiGetAccInfo(type); + + data = &info->tag; + data->tag = tag; + data->type = type; + + NANDSetUserData(block, data); + return block; +} + +RFLiFileType RFLiGetType(NANDCommandBlock* block) { + const RFLiCallbackTag* data; + data = (const RFLiCallbackTag*)NANDGetUserData(block); + + return data->type; +} + +NANDFileInfo* RFLiGetWorkingFile(RFLiFileType type) { + return RFLAvailable() ? &RFLiGetAccInfo(type)->file : NULL; +} + +static void alarmCallback_(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(ctx) + + const RFLiFileType* userData; + userData = (const RFLiFileType*)OSGetAlarmUserData(alarm); + + if (RFLAvailable()) { + const RFLiAlarmCallback alarmCallback = + RFLiGetAccInfo(*userData)->retryCallback; + alarmCallback(*userData); + } +} + +static void retry_(RFLiFileType type, u8 retryCount, + RFLiAlarmCallback callback) { + RFLiAccessInfo* info; + + if (retryCount < MAX_RETRY_COUNT) { + info = RFLiGetAccInfo(type); + info->retryCallback = callback; + info->alarmData = type; + info->retryCount = retryCount; + + OSCancelAlarm(&info->alarm); + OSSetAlarmUserData(&info->alarm, &info->alarmData); + OSSetAlarm(&info->alarm, OS_MSEC_TO_TICKS(50), alarmCallback_); + } else { + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, NAND_RESULT_BUSY); + } +} + +static void opencallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + BOOL doCallback; + + doCallback = TRUE; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + info->opened = TRUE; + RFLiEndWorking(RFLErrcode_Success); + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_MAXFD: + case NAND_RESULT_MAXBLOCKS: + case NAND_RESULT_AUTHENTICATION: + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ACCESS: + info->opened = FALSE; + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_NOEXISTS: + info->opened = FALSE; + if (info->openInfo.openMode == NAND_ACCESS_READ) { + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + } else { + result = NANDPrivateCreateAsync( + info->openInfo.path, info->openInfo.perm, info->openInfo.attr, + createcallback_, + RFLiSetCommandBlock(type, RFLiAsyncTag_CreateAsync)); + + switch (result) { + case NAND_RESULT_OK: + doCallback = FALSE; + break; + default: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + } + } + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_INVALID: + default: + info->opened = FALSE; + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (doCallback && info->callback != NULL) { + info->callback(); + } +} + +static void createcallback_(s32 result, NANDCommandBlock* block) { + NANDCommandBlock* openBlock; + RFLiAccessInfo* info; + RFLiFileType type; + BOOL doCallback; + s32 reason; + + doCallback = TRUE; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + case NAND_RESULT_EXISTS: + openBlock = RFLiSetCommandBlock(type, RFLiAsyncTag_OpenAsync); + memset(info->safeBuffer, 0, ACC_SAFE_BUFFER_SIZE); + + reason = NANDPrivateSafeOpenAsync( + info->openInfo.path, RFLiGetWorkingFile(type), + info->openInfo.openMode, info->safeBuffer, ACC_SAFE_BUFFER_SIZE, + opencallback_, openBlock); + + switch (reason) { + case NAND_RESULT_OK: + doCallback = FALSE; + break; + case NAND_RESULT_NOEXISTS: + case NAND_RESULT_MAXFD: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + case NAND_RESULT_ECC_CRIT: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (doCallback && info->callback != NULL) { + info->callback(); + } +} + +static void close2opencallback_(s32 result, NANDCommandBlock* block) { + NANDCommandBlock* openBlock; + RFLiAccessInfo* info; + RFLiFileType type; + BOOL doCallback; + s32 reason; + + doCallback = TRUE; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + openBlock = RFLiSetCommandBlock(type, RFLiAsyncTag_OpenAsync); + memset(info->safeBuffer, 0, ACC_SAFE_BUFFER_SIZE); + + reason = NANDPrivateSafeOpenAsync( + info->openInfo.path, RFLiGetWorkingFile(type), + info->openInfo.openMode, info->safeBuffer, ACC_SAFE_BUFFER_SIZE, + opencallback_, openBlock); + + switch (reason) { + case NAND_RESULT_OK: + doCallback = FALSE; + break; + case NAND_RESULT_NOEXISTS: + case NAND_RESULT_MAXFD: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (doCallback && info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openMode, + RFLiAccessCallback callback) { + NANDCommandBlock* block; + const char* filename; + NANDFileInfo* file; + RFLiAccessInfo* info; + s32 reason; + + file = RFLiGetWorkingFile(type); + RFLiStartWorking(); + info = RFLiGetAccInfo(type); + filename = scFileNames[type]; + + info->callback = callback; + strncpy(info->openInfo.path, filename, FS_MAX_PATH); + info->openInfo.path[FS_MAX_PATH] = '\0'; + info->openInfo.openMode = openMode; + info->openInfo.perm = scFilePermissions[type]; + info->openInfo.attr = scFileAttributes[type]; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_OpenAsync); + if (info->opened) { + reason = NANDSafeCloseAsync(file, close2opencallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + } + } else { + memset(info->safeBuffer, 0, ACC_SAFE_BUFFER_SIZE); + reason = NANDPrivateSafeOpenAsync( + filename, file, openMode, info->safeBuffer, ACC_SAFE_BUFFER_SIZE, + opencallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_NOEXISTS: + if (openMode == NAND_ACCESS_READ) { + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + } else { + block = RFLiSetCommandBlock(type, RFLiAsyncTag_CreateAsync); + reason = NANDPrivateCreateAsync(filename, info->openInfo.perm, + info->openInfo.attr, + createcallback_, block); + if (reason != NAND_RESULT_OK) { + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + } + } + break; + case NAND_RESULT_MAXFD: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + } + + return RFLGetAsyncStatus(); +} + +static void readcallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + BOOL error; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + error = FALSE; + + // Non-error result = buffer size + if (result >= NAND_RESULT_OK) { + if (result > info->readInfo.size) { + error = TRUE; + RFLiEndWorking(RFLErrcode_Loadfail); + } else if (result == info->readInfo.size) { + RFLiEndWorking(RFLErrcode_Success); + } else { + error = TRUE; + RFLiEndWorking(RFLErrcode_Loadfail); + } + } else { + error = TRUE; + + switch (result) { + case NAND_RESULT_ACCESS: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_BUSY: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_AUTHENTICATION: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + } + + if (error) { + memset(info->readInfo.dst, 0, info->readInfo.size); + } + + if (info->callback != NULL) { + info->callback(); + } +} + +static void readseekcallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + BOOL doCallback; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + doCallback = TRUE; + + // Non-error result = Seek offset + if (result == info->readInfo.offset) { + NANDCommandBlock* block; + NANDFileInfo* file; + s32 reason; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_ReadAsync); + file = RFLiGetWorkingFile(type); + reason = NANDReadAsync(file, info->readInfo.dst, + ROUND_UP(info->readInfo.size, 32), readcallback_, + block); + switch (reason) { + case NAND_RESULT_OK: + doCallback = FALSE; + break; + case NAND_RESULT_ACCESS: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_BUSY: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ECC_CRIT: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + } else if (result >= NAND_RESULT_OK) { + RFLiEndWorking(RFLErrcode_Loadfail); + } else { + switch (result) { + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + } + + if (doCallback && info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiReadAsync(RFLiFileType type, void* dst, u32 size, + RFLiAccessCallback callback, s32 offset) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + NANDFileInfo* file; + s32 reason; + + file = RFLiGetWorkingFile(type); + info = RFLiGetAccInfo(type); + + RFLiStartWorking(); + + info->callback = callback; + info->readInfo.dst = dst; + info->readInfo.size = size; + info->readInfo.offset = offset; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_SeekAsync); + reason = + NANDSeekAsync(file, offset, NAND_SEEK_BEG, readseekcallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + return RFLGetAsyncStatus(); +} + +static void retryWrite_(RFLiFileType type) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + NANDFileInfo* file; + s32 reason; + + info = RFLiGetAccInfo(type); + block = RFLiSetCommandBlock(type, RFLiAsyncTag_WriteAsync); + file = RFLiGetWorkingFile(type); + + reason = NANDWriteAsync(file, info->writeInfo.src, info->writeInfo.size, + writecallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, info->retryCount + 1, retryWrite_); + break; + case NAND_RESULT_MAXBLOCKS: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + if (!RFLiIsWorking() && info->callback != NULL) { + info->callback(); + } +} + +static void writecallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + if (result == info->writeInfo.size) { + RFLiEndWorking(RFLErrcode_Success); + } else if (result >= NAND_RESULT_OK) { + RFLiEndWorking(RFLErrcode_Savefail); + } else { + switch (result) { + case NAND_RESULT_MAXBLOCKS: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, info->retryCount + 1, retryWrite_); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + } + + if (info->callback != NULL) { + info->callback(); + } +} + +static void retryWriteSeek_(RFLiFileType type) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + NANDFileInfo* file; + s32 reason; + + info = RFLiGetAccInfo(type); + block = RFLiSetCommandBlock(type, RFLiAsyncTag_SeekAsync); + file = RFLiGetWorkingFile(type); + + reason = NANDSeekAsync(file, info->writeInfo.offset, NAND_SEEK_BEG, + writeseekcallback_, block); + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, info->retryCount + 1, retryWriteSeek_); + break; + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } +} + +static void writeseekcallback_inline(RFLiFileType type) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + NANDFileInfo* file; + s32 reason; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_WriteAsync); + info = RFLiGetAccInfo(type); + file = RFLiGetWorkingFile(type); + reason = NANDWriteAsync(file, info->writeInfo.src, info->writeInfo.size, + writecallback_, block); + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, 0, retryWrite_); + break; + case NAND_RESULT_MAXBLOCKS: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } +} + +static void writeseekcallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + BOOL doCallback; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + doCallback = TRUE; + + if (result == info->writeInfo.offset) { + writeseekcallback_inline(type); + if (RFLiIsWorking()) { + doCallback = FALSE; + } + } else if (result >= NAND_RESULT_OK) { + RFLiEndWorking(RFLErrcode_Savefail); + } else { + switch (result) { + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, 0, retryWriteSeek_); + break; + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + } + + if (doCallback && info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiWriteAsync(RFLiFileType type, const void* src, u32 size, + RFLiAccessCallback callback, s32 offset) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + NANDFileInfo* file; + s32 reason; + + info = RFLiGetAccInfo(type); + file = RFLiGetWorkingFile(type); + + RFLiStartWorking(); + + info->callback = callback; + info->writeInfo.src = src; + info->writeInfo.size = size; + info->writeInfo.offset = offset; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_SeekAsync); + reason = + NANDSeekAsync(file, offset, NAND_SEEK_BEG, writeseekcallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + retry_(type, 0, retryWriteSeek_); + break; + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + return RFLGetAsyncStatus(); +} + +static s32 closecore_(RFLiFileType type) { + NANDCommandBlock* block; + NANDFileInfo* info; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_CloseAsync); + info = RFLiGetWorkingFile(type); + + return NANDSafeCloseAsync(info, closecallback_, block); +} + +static void closecallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + info->opened = FALSE; + endWorkingClose_(RFLErrcode_Success); + break; + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (!RFLiIsWorking() && info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiCloseAsync(RFLiFileType type, RFLiAccessCallback callback) { + RFLiAccessInfo* info; + s32 reason; + + info = RFLiGetAccInfo(type); + startWorkingClose_(); + info->callback = callback; + reason = closecore_(type); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + return RFLGetAsyncStatus(); +} + +static void getlengthcallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + RFLiEndWorking(RFLErrcode_Success); + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* out, + RFLiAccessCallback callback) { + NANDCommandBlock* block; + NANDFileInfo* file; + RFLiAccessInfo* info; + s32 reason; + + info = RFLiGetAccInfo(type); + RFLiStartWorking(); + info->callback = callback; + info->getLengthInfo.dst = out; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_GetLengthAsync); + file = RFLiGetWorkingFile(type); + reason = NANDGetLengthAsync(file, out, getlengthcallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + return RFLGetAsyncStatus(); +} + +static void deletecallback_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + case NAND_RESULT_NOEXISTS: + RFLiEndWorking(RFLErrcode_Success); + break; + case NAND_RESULT_OPENFD: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiDeleteAsync(RFLiFileType type, RFLiAccessCallback callback) { + NANDCommandBlock* block; + RFLiAccessInfo* info; + s32 reason; + + info = RFLiGetAccInfo(type); + RFLiStartWorking(); + info->callback = callback; + + block = RFLiSetCommandBlock(type, RFLiAsyncTag_DeleteAsync); + reason = NANDPrivateDeleteAsync(scFileNames[type], deletecallback_, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_NOEXISTS: + RFLiEndWorking(RFLErrcode_Success); + break; + case NAND_RESULT_OPENFD: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + case NAND_RESULT_ACCESS: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } + + return RFLGetAsyncStatus(); +} + +static void createDirCommon_(const char* dir, NANDAsyncCallback callback) { + NANDCommandBlock* block; + s32 reason; + + block = + RFLiSetCommandBlock(RFLiFileType_Database, RFLiAsyncTag_CreateDirAsync); + reason = + NANDPrivateCreateDirAsync(dir, NAND_PERM_RWALL, 0, callback, block); + + switch (reason) { + case NAND_RESULT_OK: + break; + case NAND_RESULT_EXISTS: + callback(NAND_RESULT_EXISTS, block); + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, reason); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, reason); + break; + } +} + +static void createdircallback2_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + case NAND_RESULT_EXISTS: + RFLiEndWorking(RFLErrcode_Success); + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (RFLGetAsyncStatus() != RFLErrcode_Busy && info->callback != NULL) { + info->callback(); + } +} + +static void createdircallback1_(s32 result, NANDCommandBlock* block) { + RFLiAccessInfo* info; + RFLiFileType type; + + type = RFLiGetType(block); + info = RFLiGetAccInfo(type); + + switch (result) { + case NAND_RESULT_OK: + case NAND_RESULT_EXISTS: + createDirCommon_(scSecondDirectory, createdircallback2_); + break; + case NAND_RESULT_MAXFILES: + case NAND_RESULT_CORRUPT: + case NAND_RESULT_BUSY: + case NAND_RESULT_ALLOC_FAILED: + RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); + break; + case NAND_RESULT_FATAL_ERROR: + case NAND_RESULT_UNKNOWN: + case NAND_RESULT_INVALID: + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_ACCESS: + default: + RFLiEndWorkingReason(RFLErrcode_Fatal, result); + break; + } + + if (RFLGetAsyncStatus() != RFLErrcode_Busy && info->callback != NULL) { + info->callback(); + } +} + +RFLErrcode RFLiCreateSaveDirAsync(RFLiAccessCallback callback) { + RFLiAccessInfo* info; + + info = RFLiGetAccInfo(RFLiFileType_Database); + RFLiStartWorking(); + info->callback = callback; + + createDirCommon_(scFirstDirectory, createdircallback1_); + + return RFLGetAsyncStatus(); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDLoader.c b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDLoader.c new file mode 100644 index 0000000000..dbac93c10a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_NANDLoader.c @@ -0,0 +1,440 @@ +#include +#include +#include + +#define LOADER_HEADER_BUF_1_SIZE 0x100 +#define LOADER_HEADER_BUF_2_SIZE 0x20 +#define TEMP_BUF_SIZE 0x400 + +static const char* scResFileFullPathName = "/shared2/FaceLib/RFL_Res.dat"; + +void RFLiInitLoader(void) { + RFLiLoader* loader; + int i; + + loader = RFLiGetLoader(); + for (i = 0; i < RFLiArcID_Max; i++) { + loader->archives[i].numFiles = 0; + loader->archives[i].biggestSize = 0; + loader->archives[i].offset = 0; + } + + loader->cacheSize = 0; + loader->cache = NULL; + loader->cached = FALSE; + loader->version = 0; + loader->headerBuf1 = NULL; + loader->headerBuf2 = NULL; +} + +/** + * RFL_Res.dat documentation from: + * https://wiki.tockdom.com/wiki/RFL_Res.dat_(File_Format) + */ +static void parseOnmemoryRes_(void) DECOMP_DONT_INLINE { + RFLiLoader* loader; + int i; + + loader = RFLiGetLoader(); + loader->version = *(u16*)((u8*)loader->cache + 2); + for (i = 0; i < RFLiArcID_Max; i++) { + // Pointer to section offset in header + u32* offset = (u32*)((u8*)loader->cache + ((i + 1) * 4)); + // Pointer to section + u32* p_section = (u32*)((u8*)loader->cache + *offset); + // Load archive + loader->archives[i].numFiles = ((u16*)p_section)[0]; + loader->archives[i].biggestSize = ((u16*)p_section)[1]; + loader->archives[i].offset = *offset + 4; + } +} + +static void loadResRead2ndcallback_(void) { + RFLiLoader* loader; + BOOL free; + RFLiAccessCallback cb; + u32* headerBuf1; + u32* headerBuf2; + + loader = RFLiGetLoader(); + free = FALSE; + cb = NULL; + if (RFLGetAsyncStatus() == RFLErrcode_Success) { + const u16 arc = loader->numResources; + headerBuf1 = (u32*)loader->headerBuf1; + if (arc < RFLiArcID_Max) { + headerBuf2 = (u32*)loader->headerBuf2; + headerBuf1 = &headerBuf1[arc + 1]; + loader->archives[arc].numFiles = ((u16*)headerBuf2)[0]; + loader->archives[arc].biggestSize = ((u16*)headerBuf2)[1]; + loader->archives[arc].offset = *headerBuf1 + 4; + loader->numResources++; + switch (RFLiReadAsync(RFLiFileType_Resource, loader->headerBuf2, 32, + loadResRead2ndcallback_, *(headerBuf1 + 1))) { + case RFLErrcode_Busy: + break; + case RFLErrcode_Success: + break; + default: + free = TRUE; + } + } else { + free = TRUE; + cb = NULL; + } + } else { + free = TRUE; + RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); + } + + if (free) { + RFLiFree(loader->headerBuf1); + loader->headerBuf1 = NULL; + RFLiFree(loader->headerBuf2); + loader->headerBuf2 = NULL; + RFLiCloseAsync(RFLiFileType_Resource, cb); + } +} + +static void errclosecallback_(void) { RFLExit(); } + +static void loadResRead1stcallback_(void) { + RFLiLoader* loader; + BOOL free; + u32* headerBuf1; + void* headerBuf2; + + loader = RFLiGetLoader(); + free = FALSE; + if (RFLGetAsyncStatus() == RFLErrcode_Success) { + headerBuf1 = (u32*)loader->headerBuf1; + loader->version = *(u16*)((u8*)headerBuf1 + 2); + + headerBuf2 = RFLiAlloc32(LOADER_HEADER_BUF_2_SIZE); + loader->headerBuf2 = headerBuf2; + loader->numResources = 0; + + switch (RFLiReadAsync(RFLiFileType_Resource, headerBuf2, + LOADER_HEADER_BUF_2_SIZE, loadResRead2ndcallback_, + *(headerBuf1 + 1))) { + case RFLErrcode_Busy: + break; + case RFLErrcode_Success: + break; + default: + free = TRUE; + } + } else { + free = TRUE; + RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); + } + + if (free) { + RFLiFree(loader->headerBuf1); + loader->headerBuf1 = NULL; + + if (loader->headerBuf2 != NULL) { + RFLiFree(loader->headerBuf2); + loader->headerBuf2 = NULL; + } + + RFLiCloseAsync(RFLiFileType_Resource, errclosecallback_); + } +} + +static void loadResGetlengthcallback_(void) { + RFLiLoader* loader; + void* headerBuf1; + + loader = RFLiGetLoader(); + if (RFLGetAsyncStatus() == RFLErrcode_Success) { + headerBuf1 = RFLiAlloc32(LOADER_HEADER_BUF_1_SIZE); + loader->headerBuf1 = headerBuf1; + switch (RFLiReadAsync(RFLiFileType_Resource, headerBuf1, + LOADER_HEADER_BUF_1_SIZE, loadResRead1stcallback_, + 0)) { + case RFLErrcode_Busy: + break; + case RFLErrcode_Success: + break; + default: + RFLiFree(loader->headerBuf1); + loader->headerBuf1 = NULL; + RFLiCloseAsync(RFLiFileType_Resource, NULL); + } + } else { + RFLiCloseAsync(RFLiFileType_Resource, errclosecallback_); + } +} + +static void loadResOpencallback_(void) { + RFLiLoader* loader; + + if (RFLGetAsyncStatus() == RFLErrcode_Success) { + loader = RFLiGetLoader(); + loader->cacheSize = 0; + switch (RFLiGetLengthAsync(RFLiFileType_Resource, &loader->cacheSize, + loadResGetlengthcallback_)) { + case RFLErrcode_Busy: + break; + case RFLErrcode_Success: + break; + default: + RFLiCloseAsync(RFLiFileType_Resource, NULL); + } + } else { + RFLExit(); + } +} + +RFLErrcode RFLiLoadResourceHeaderAsync(void) { + RFLiLoader* loader; + + loader = RFLiGetLoader(); + if (loader == NULL) { + RFLiEndWorking(RFLErrcode_Fatal); + return RFLErrcode_Fatal; + } + + if (RFLIsResourceCached()) { + parseOnmemoryRes_(); + RFLiEndWorking(RFLErrcode_Success); + return RFLErrcode_Busy; + } + + return RFLiOpenAsync(RFLiFileType_Resource, NAND_ACCESS_READ, + loadResOpencallback_); +} + +static u32 getCachedLength_(RFLiLoader* loader, u32 arcIdx, u16 fileIdx) { + RFLiArchive* arc = &loader->archives[arcIdx]; + const void* arcBuf = (u8*)loader->cache + arc->offset; + const u32 next = ((u32*)arcBuf)[fileIdx + 1]; + const u32 self = ((u32*)arcBuf)[fileIdx]; + return next - self; +} + +static u32 getNANDLength_(RFLiLoader* loader, u32 arcIdx, u16 fileIdx) { + NANDFileInfo file; + RFLiArchive* arc; + void* tmpBuf; + u32 length = 0; + + tmpBuf = RFLiAlloc32(TEMP_BUF_SIZE); + arc = &loader->archives[arcIdx]; + + if (NANDPrivateOpen(scResFileFullPathName, &file, NAND_ACCESS_READ) == + NAND_RESULT_OK) { + const u32 readSize = ROUND_UP(arc->numFiles * 4 + 4, 32); + NANDSeek(&file, arc->offset, NAND_SEEK_BEG); + + if (NANDRead(&file, tmpBuf, readSize) == readSize) { + const u32 self = ((u32*)tmpBuf)[fileIdx]; + const u32 next = ((u32*)tmpBuf)[fileIdx + 1]; + length = next - self; + } + + NANDClose(&file); + } + + RFLiFree(tmpBuf); + return length; +} + +static u32 getLength_(u32 arcIdx, u16 fileIdx) { + RFLiLoader* loader; + + loader = RFLiGetLoader(); + if (loader == NULL) { + return 0; + } + + if (fileIdx >= loader->archives[arcIdx].numFiles) { + return 0; + } + + if (RFLIsResourceCached()) { + return getCachedLength_(loader, arcIdx, fileIdx); + } else { + return getNANDLength_(loader, arcIdx, fileIdx); + } +} + +static void* getCachedFile_(void* dst, RFLiLoader* loader, u32 arcIdx, + u16 fileIdx) { + const u8* cache = (u8*)loader->cache; + RFLiArchive* arc = &loader->archives[arcIdx]; + const void* arcBuf = cache + arc->offset; + const u32 self = ((u32*)arcBuf)[fileIdx]; + const u32 next = ((u32*)arcBuf)[fileIdx + 1]; + const u32 size = next - self; + const u32 src = arc->offset + self + (arc->numFiles * 4); + + memcpy(dst, src + 4 + cache, size); + return dst; +} + +static void* getNANDFile_(void* dst, RFLiLoader* loader, u32 arcIdx, + u16 fileIdx) { + NANDFileInfo file; + RFLiArchive* arc; + void* tmpBuf; + void* arcBuf; + void* ret; + u32 readSize; + + ret = NULL; + arc = &loader->archives[arcIdx]; + tmpBuf = RFLiAlloc32(TEMP_BUF_SIZE); + + if (NANDPrivateOpen(scResFileFullPathName, &file, NAND_ACCESS_READ) == + NAND_RESULT_OK) { + u32 arcBufSize; + s32 seekOffset; + u32 arcSize; + u32 arcOffset; + + readSize = ROUND_UP(arc->numFiles * 4 + 4, 32); + arcSize = 0; + arcOffset = 0; + + NANDSeek(&file, arc->offset, NAND_SEEK_BEG); + + if (NANDRead(&file, tmpBuf, readSize) == readSize) { + const u32 next = ((u32*)tmpBuf)[fileIdx + 1]; + const u32 self = ((u32*)tmpBuf)[fileIdx]; + arcSize = next - self; + arcOffset = self; + } else { + RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); + RFLiFree(tmpBuf); + return NULL; + } + + seekOffset = arc->offset + arc->numFiles * 4 + 4 + arcOffset; + arcBufSize = ROUND_UP(arcSize, 32); + + arcBuf = RFLiAlloc32(arcBufSize); + NANDSeek(&file, seekOffset, NAND_SEEK_BEG); + + if (NANDRead(&file, arcBuf, arcBufSize) == arcBufSize) { + memcpy(dst, arcBuf, arcSize); + ret = dst; + } else { + RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); + RFLiFree(tmpBuf); + RFLiFree(arcBuf); + return NULL; + } + + RFLiFree(arcBuf); + NANDClose(&file); + } else { + RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); + } + + RFLiFree(tmpBuf); + return ret; +} + +static void* getFile_(void* dst, u32 arcIdx, u16 fileIdx) { + RFLiLoader* loader; + + if (!RFLAvailable()) { + return NULL; + } + + loader = RFLiGetLoader(); + if (loader == NULL) { + return NULL; + } + + if (fileIdx >= loader->archives[arcIdx].numFiles) { + return NULL; + } + + if (RFLIsResourceCached()) { + return getCachedFile_(dst, loader, arcIdx, fileIdx); + } else { + return getNANDFile_(dst, loader, arcIdx, fileIdx); + } +} + +u32 RFLiGetTexSize(RFLiPartsTex part, u16 file) { + static const u32 scParts2Arc[] = {RFLiArcID_Eye, RFLiArcID_Eyebrow, + RFLiArcID_Mouth, RFLiArcID_Mustache, + RFLiArcID_Mole}; + return getLength_(scParts2Arc[part], file); +} + +RFLiTexture* RFLiLoadTexture(RFLiPartsTex part, u16 file, void* dst) { + static const u32 scParts2Arc[] = {RFLiArcID_Eye, RFLiArcID_Eyebrow, + RFLiArcID_Mouth, RFLiArcID_Mustache, + RFLiArcID_Mole}; + return (RFLiTexture*)getFile_(dst, scParts2Arc[part], file); +} + +u32 RFLiGetShpTexSize(RFLiPartsShpTex part, u16 file) { + static const u32 scParts2Arc[] = {RFLiArcID_FaceTex, RFLiArcID_CapTex, + RFLiArcID_NlineTex, RFLiArcID_GlassTex}; + return getLength_(scParts2Arc[part], file); +} + +RFLiTexture* RFLiLoadShpTexture(RFLiPartsShpTex part, u16 file, void* dst) { + static const u32 scParts2Arc[] = {RFLiArcID_FaceTex, RFLiArcID_CapTex, + RFLiArcID_NlineTex, RFLiArcID_GlassTex}; + return (RFLiTexture*)getFile_(dst, scParts2Arc[part], file); +} + +u32 RFLiGetShapeSize(RFLiPartsShp part, u16 file) { + static const u32 scParts2Arc[] = { + RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, + RFLiArcID_Hair, RFLiArcID_Cap, RFLiArcID_Beard, + RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass}; + return getLength_(scParts2Arc[part], file); +} + +void* RFLiLoadShape(RFLiPartsShp part, u16 file, void* dst) { + static const u32 scParts2Arc[] = { + RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, + RFLiArcID_Hair, RFLiArcID_Cap, RFLiArcID_Beard, + RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass}; + return getFile_(dst, scParts2Arc[part], file); +} + +BOOL RFLFreeCachedResource(void) { + RFLiLoader* loader; + + if (!RFLAvailable()) { + return TRUE; + } + + if (RFLiIsWorking()) { + return TRUE; + } + + loader = RFLiGetLoader(); + if (loader == NULL) { + return TRUE; + } + + loader->cached = FALSE; + loader->cache = NULL; + loader->cacheSize = 0; + return FALSE; +} + +BOOL RFLIsResourceCached(void) { + RFLiLoader* loader; + + if (!RFLAvailable()) { + return FALSE; + } + + loader = RFLiGetLoader(); + if (loader == NULL) { + return FALSE; + } + + return loader->cached; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_System.c b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_System.c new file mode 100644 index 0000000000..fe5edd619d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/RVLFaceLib/RFL_System.c @@ -0,0 +1,267 @@ +#include +#include +#include + +#define RFL_SYSTEM_HEAP_SIZE 0x24800 +#define RFL_WORK_SIZE 0x4B000 +#define RFL_DELUXE_WORK_SIZE 0x64000 + +/** + * These functions are inlined, but with their conditions inverted(?) from the + * actual functions. To avoid manually inlining them, these defines will hide + * the fake inlines. + */ +#define RFLiGetLoader_() (RFLAvailable() ? &RFLiGetManager()->loader : NULL) +#define RFLiGetLastReason_() \ + (RFLAvailable() ? RFLiGetManager()->lastReason : NAND_RESULT_OK) +#define RFLGetLastReason_() \ + RFLAvailable() ? RFLiGetLastReason_() : sRFLLastReason; + +static const char* __RFLVersion = + "<< RVL_SDK - RFL \trelease build: Jun 9 2007 17:25:33 (0x4199_60831) >>"; + +static const RFLiCoordinateData scCoordinate = {1, 2, 0, FALSE, FALSE, FALSE}; + +static RFLiManager* sRFLiManager = NULL; +static RFLErrcode sRFLLastErrCode = RFLErrcode_NotAvailable; +static u8 sRFLiFileBrokenType; +static s32 sRFLLastReason; + +u32 RFLGetWorkSize(BOOL deluxeTex) { + return deluxeTex ? RFL_DELUXE_WORK_SIZE + sizeof(RFLiManager) + : RFL_WORK_SIZE + sizeof(RFLiManager); +} + +RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, + BOOL deluxeTex) { + u32 workSize; + u32 heapSize; + void* heapBuffer; + RFLErrcode error; + + if (resBuffer == NULL) { + return RFLErrcode_Fatal; + } + + if (RFLiGetManager() == NULL) { + OSRegisterVersion(__RFLVersion); + + workSize = deluxeTex ? RFL_DELUXE_WORK_SIZE : RFL_WORK_SIZE; + memset(workBuffer, 0, workSize); + + sRFLiManager = (RFLiManager*)workBuffer; + sRFLLastErrCode = RFLErrcode_NotAvailable; + sRFLLastReason = NAND_RESULT_OK; + sRFLiFileBrokenType = RFLiFileBrokenType_DBNotFound; + sRFLiManager->workBuffer = (u8*)workBuffer + sizeof(RFLiManager); + + heapSize = deluxeTex ? RFL_DELUXE_WORK_SIZE - sizeof(RFLiManager) + : RFL_WORK_SIZE - sizeof(RFLiManager); + + RFLiGetManager()->rootHeap = MEMCreateExpHeapEx( + RFLiGetManager()->workBuffer, heapSize, MEM_HEAP_OPT_CLEAR_ALLOC); + + heapBuffer = MEMAllocFromExpHeapEx(RFLiGetManager()->rootHeap, + RFL_SYSTEM_HEAP_SIZE, 32); + RFLiGetManager()->systemHeap = MEMCreateExpHeapEx( + heapBuffer, RFL_SYSTEM_HEAP_SIZE, MEM_HEAP_OPT_CLEAR_ALLOC); + + heapSize = MEMGetAllocatableSizeForExpHeap(RFLiGetManager()->rootHeap); + heapBuffer = + MEMAllocFromExpHeapEx(RFLiGetManager()->rootHeap, heapSize, 8); + RFLiGetManager()->tmpHeap = + MEMCreateExpHeapEx(heapBuffer, heapSize, MEM_HEAP_OPT_CLEAR_ALLOC); + + RFLiGetManager()->lastErrCode = RFLErrcode_Success; + RFLiGetManager()->beforeCloseErr = RFLErrcode_Success; + RFLiGetManager()->lastReason = NAND_RESULT_OK; + RFLiGetManager()->beforeCloseReason = NAND_RESULT_OK; + RFLiGetManager()->deluxeTex = deluxeTex; + RFLiGetManager()->brokenType = RFLiFileBrokenType_DBNotFound; + + RFLSetIconDrawDoneCallback(NULL); + RFLiSetWorking(FALSE); + RFLiInitDatabase(RFLiGetManager()->systemHeap); + RFLiInitLoader(); + RFLiInitCtrlBuf(RFLiGetManager()->systemHeap); + RFLiInitHiddenDatabase(); + RFLiInitAccessInfo(RFLiGetManager()->systemHeap); + RFLiSetCoordinateData(&scCoordinate); + + if (resBuffer != NULL) { + RFLiLoader* loader = RFLiGetLoader_(); + loader->cached = TRUE; + loader->cacheSize = resSize; + loader->cache = resBuffer; + } + + error = RFLiBootLoadAsync(); + if (error != RFLErrcode_Busy && error != RFLErrcode_Success) { + RFLExit(); + } + } else { + error = RFLErrcode_Success; + } + + return error; +} + +RFLErrcode RFLInitRes(void* workBuffer, void* resBuffer, u32 resSize, + BOOL deluxeTex) { + RFLInitResAsync(workBuffer, resBuffer, resSize, deluxeTex); + return RFLWaitAsync(); +} + +void RFLExit(void) { + if (RFLiGetManager() == NULL) { + return; + } + + RFLWaitAsync(); + + sRFLLastErrCode = RFLGetAsyncStatus(); + sRFLLastReason = RFLGetLastReason_(); + sRFLiFileBrokenType = RFLiGetManager()->brokenType; + + if (RFLIsResourceCached()) { + RFLFreeCachedResource(); + } + + RFLiExitAccessInfo(); + + MEMDestroyExpHeap(RFLiGetManager()->tmpHeap); + MEMDestroyExpHeap(RFLiGetManager()->systemHeap); + MEMDestroyExpHeap(RFLiGetManager()->rootHeap); + + sRFLiManager = NULL; +} + +static void bootloadDB2Res_(void) { + RFLiLoadResourceHeaderAsync(); + + switch (RFLWaitAsync()) { + case RFLErrcode_Loadfail: + case RFLErrcode_Success: + case RFLErrcode_Busy: + break; + default: + RFLExit(); + } +} + +RFLErrcode RFLiBootLoadAsync(void) { + return RFLiBootLoadDatabaseAsync(bootloadDB2Res_); +} + +BOOL RFLAvailable(void) { return sRFLiManager != NULL; } + +static void* allocal_(u32 size, s32 align) { + return MEMAllocFromExpHeapEx(RFLiGetManager()->tmpHeap, size, align); +} + +void* RFLiAlloc(u32 size) { return allocal_(size, 8); } + +void* RFLiAlloc32(u32 size) { return allocal_(size, 32); } + +void RFLiFree(void* block) { + MEMFreeToExpHeap(RFLiGetManager()->tmpHeap, block); +} + +RFLiDBManager* RFLiGetDBManager(void) { + return !RFLAvailable() ? NULL : &RFLiGetManager()->dbMgr; +} + +RFLiHDBManager* RFLiGetHDBManager(void) { + return !RFLAvailable() ? NULL : &RFLiGetManager()->hdbMgr; +} + +RFLiLoader* RFLiGetLoader(void) { + return !RFLAvailable() ? NULL : &RFLiGetManager()->loader; +} + +BOOL RFLiGetWorking(void) { + return !RFLAvailable() ? NULL : RFLiGetManager()->working; +} + +void RFLiSetWorking(BOOL working) { RFLiGetManager()->working = working; } + +RFLiManager* RFLiGetManager(void) { return sRFLiManager; } + +RFLErrcode RFLGetAsyncStatus(void) { + if (!RFLAvailable()) { + return sRFLLastErrCode; + } + + if (RFLiIsWorking()) { + return RFLErrcode_Busy; + } + + if (RFLiCriticalError()) { + return RFLErrcode_Fatal; + } + + return RFLiGetManager()->lastErrCode; +} + +s32 RFLGetLastReason(void) { + return !RFLAvailable() ? sRFLLastReason : RFLiGetLastReason_(); +} + +RFLErrcode RFLWaitAsync(void) { + volatile RFLErrcode status; + + do { + status = RFLGetAsyncStatus(); + } while (status == RFLErrcode_Busy); + + return status; +} + +RFLiAccessInfo* RFLiGetAccInfo(RFLiFileType type) { + return !RFLAvailable() ? NULL : &RFLiGetManager()->info[type]; +} + +RFLiCtrlBufManager* RFLiGetCtrlBufManager(void) { + return !RFLAvailable() ? NULL : &RFLiGetManager()->ctrlMgr; +} + +s32 RFLiGetLastReason(void) { + return !RFLAvailable() ? NAND_RESULT_OK : RFLiGetManager()->lastReason; +} + +void RFLiSetFileBroken(RFLiFileBrokenType type) { + if (RFLAvailable()) { + RFLiGetManager()->brokenType |= (1 << type) & 0xFF; + } +} + +BOOL RFLiNotFoundError(void) { + u8* broken = &sRFLiFileBrokenType; + + if (RFLAvailable()) { + broken = &RFLiGetManager()->brokenType; + } + + return *broken >> RFLiFileBrokenType_DBNotFound & 1; +} + +BOOL RFLiNeedRepairError(void) { + u8* broken = &sRFLiFileBrokenType; + + if (RFLAvailable()) { + broken = &RFLiGetManager()->brokenType; + } + + return *broken >> RFLiFileBrokenType_DBBroken & 1; +} + +BOOL RFLiCriticalError(void) { + u8* broken = &sRFLiFileBrokenType; + + if (RFLAvailable()) { + broken = &RFLiGetManager()->brokenType; + } + + return *broken & 1 << RFLiFileBrokenType_ResBroken || + *broken & 1 << RFLiFileBrokenType_Corrupt; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AI/ai.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AI/ai.c new file mode 100644 index 0000000000..531744a015 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AI/ai.c @@ -0,0 +1,231 @@ +#include +#include +#include + +const char* __AIVersion = + "<< RVL_SDK - AI \trelease build: Nov 30 2006 03:26:11 (0x4199_60831) >>"; + +static AIDMACallback __AID_Callback; + +static void* __CallbackStack; +static void* __OldStack; + +static s64 bound_32KHz; +static s64 bound_48KHz; + +static s64 min_wait; +static s64 max_wait; +static s64 buffer; + +static BOOL __AID_Active; +static BOOL __AI_init_flag; + +static void __AICallbackStackSwitch(AIDMACallback callback); +static void __AI_SRC_INIT(void); + +AIDMACallback AIRegisterDMACallback(AIDMACallback callback) { + BOOL enabled; + AIDMACallback old; + + old = __AID_Callback; + enabled = OSDisableInterrupts(); + + __AID_Callback = callback; + + OSRestoreInterrupts(enabled); + return old; +} + +void AIInitDMA(void* buffer, u32 length) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + DSP_HW_REGS[DSP_AI_DMA_START_H] = + (DSP_HW_REGS[DSP_AI_DMA_START_H] & ~0x1FFF) | + (((uintptr_t)buffer) >> 16 & 0xFFFF); + + DSP_HW_REGS[DSP_AI_DMA_START_L] = + (DSP_HW_REGS[DSP_AI_DMA_START_L] & ~0xFFE0) | + (((uintptr_t)buffer) & 0xFFFF); + + DSP_HW_REGS[DSP_AI_DMA_CSR] = + (DSP_HW_REGS[DSP_AI_DMA_CSR] & ~0x7FFF) | ((length / 32) & 0xFFFF); + + OSRestoreInterrupts(enabled); +} + +void AIStartDMA(void) { + DSP_HW_REGS[DSP_AI_DMA_CSR] |= DSP_AI_DMA_CSR_PLAY; +} + +u32 AIGetDMABytesLeft(void) { + return (DSP_HW_REGS[DSP_AI_DMA_BYTES_LEFT] & 0x7FFF) * 32; +} + +void AISetDSPSampleRate(u32 rate) { + BOOL enabled; + + if (rate != AIGetDSPSampleRate()) { + AI_HW_REGS[AI_AICR] &= ~AI_AICR_SAMPLERATE; + + if (rate == AI_DSP_32KHZ) { + enabled = OSDisableInterrupts(); + + __AI_SRC_INIT(); + AI_HW_REGS[AI_AICR] |= AI_AICR_SAMPLERATE; + + OSRestoreInterrupts(enabled); + } + } +} + +u32 AIGetDSPSampleRate(void) { + return ((AI_HW_REGS[AI_AICR] & AI_AICR_SAMPLERATE) >> 6) ^ 1; +} + +void AIInit(void* stack) { + if (__AI_init_flag != TRUE) { + OSRegisterVersion(__AIVersion); + + bound_32KHz = OS_NSEC_TO_TICKS(31524); + bound_48KHz = OS_NSEC_TO_TICKS(42024); + min_wait = OS_NSEC_TO_TICKS(42000); + max_wait = OS_NSEC_TO_TICKS(63000); + buffer = OS_NSEC_TO_TICKS(3000); + + AI_HW_REGS[AI_AICR] &= + ~(AI_AICR_PSTAT | AI_AICR_AIINTMSK | AI_AICR_AIINTVLD); + + AI_HW_REGS[AI_AIVR] = 0; + AI_HW_REGS[AI_AIIT] = 0; + + AI_HW_REGS[AI_AICR] = + (AI_HW_REGS[AI_AICR] & ~AI_AICR_SCRESET) | AI_AICR_SCRESET; + + AISetDSPSampleRate(AI_DSP_32KHZ); + + __AID_Callback = NULL; + __CallbackStack = stack; + + __OSSetInterruptHandler(OS_INTR_DSP_AI, __AIDHandler); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_DSP_AI)); + + __AI_init_flag = TRUE; + } +} + +void __AIDHandler(s16 intr, OSContext* ctx) { +#pragma unused(intr) + + OSContext tempCtx; + + DSP_HW_REGS[DSP_CSR] = + (DSP_HW_REGS[DSP_CSR] & ~(DSP_CSR_ARINT | DSP_CSR_DSPINT)) | + DSP_CSR_AIDINT; + + OSClearContext(&tempCtx); + OSSetCurrentContext(&tempCtx); + + if (__AID_Callback != NULL && !__AID_Active) { + __AID_Active = TRUE; + + if (__CallbackStack != NULL) { + __AICallbackStackSwitch(__AID_Callback); + } else { + __AID_Callback(); + } + + __AID_Active = FALSE; + } + + OSClearContext(&tempCtx); + OSSetCurrentContext(ctx); +} + +static asm void __AICallbackStackSwitch(register AIDMACallback callback) { + // clang-format off + + mr r31, callback + + lis r5, __OldStack@ha + addi r5, r5, __OldStack@l + stw r1, 0(r5) + + lis r5, __CallbackStack@ha + addi r5, r5, __CallbackStack@l + lwz r1, 0(r5) + + subi r1, r1, 0x8 + mtlr r31 + blrl + + lis r5, __OldStack@ha + addi r5, r5, __OldStack@l + lwz r1, 0(r5) + + frfree + blr + + // clang-format on +} + +static void __AI_SRC_INIT(void) { + s64 start = 0; + s64 end = 0; + BOOL exit = FALSE; + s64 diff = 0; + s64 wait = 0; + u32 samples = 0; + + while (!exit) { + AI_HW_REGS[AI_AICR] = + (AI_HW_REGS[AI_AICR] & ~AI_AICR_SCRESET) | AI_AICR_SCRESET; + + AI_HW_REGS[AI_AICR] &= ~AI_AICR_AFR; + + AI_HW_REGS[AI_AICR] = + (AI_HW_REGS[AI_AICR] & ~AI_AICR_PSTAT) | AI_AICR_PSTAT; + + // Waiting for one sample? + samples = AI_HW_REGS[AI_AISCNT] & ~0x80000000; + while (samples == (AI_HW_REGS[AI_AISCNT] & ~0x80000000)) { + ; + } + + start = OSGetTime(); + + AI_HW_REGS[AI_AICR] = + (AI_HW_REGS[AI_AICR] & ~AI_AICR_AFR) | AI_AICR_AFR; + + AI_HW_REGS[AI_AICR] = + (AI_HW_REGS[AI_AICR] & ~AI_AICR_PSTAT) | AI_AICR_PSTAT; + + // Waiting for one sample? + samples = AI_HW_REGS[AI_AISCNT] & ~0x80000000; + while (samples == (AI_HW_REGS[AI_AISCNT] & ~0x80000000)) { + ; + } + + end = OSGetTime(); + diff = end - start; + + AI_HW_REGS[AI_AICR] &= ~AI_AICR_AFR; + AI_HW_REGS[AI_AICR] &= ~AI_AICR_PSTAT; + + if (diff < bound_32KHz - buffer) { + wait = min_wait; + exit = TRUE; + } else if (diff >= bound_32KHz + buffer && + diff < bound_48KHz - buffer) { + wait = max_wait; + exit = TRUE; + } else { + exit = FALSE; + } + } + + while (end + wait > OSGetTime()) { + ; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/ARC/arc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/ARC/arc.c new file mode 100644 index 0000000000..b0ffeedc5c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/ARC/arc.c @@ -0,0 +1,345 @@ +#include +#include +#include + +/** + * Modified from decompilation by riidefi in WiiCore + */ + +#define ARC_FILE_MAGIC 0x55AA382D + +#define ARCNodeIsFolder(node) ((node).packed_type_name & 0xFF000000) +#define ARCNodeGetName(node) ((node).packed_type_name & 0x00FFFFFF) + +static u32 entryToPath(ARCHandle* handle, u32 entrynum, char* string, + u32 maxlen); + +static BOOL isSame(const char* lhs, const char* rhs) { + while (rhs[0] != '\0') { + if (tolower(*lhs++) != tolower(*rhs++)) + return FALSE; + } + + if (lhs[0] == '/' || lhs[0] == '\0') { + return TRUE; + } + + return FALSE; +} + +static u32 myStrncpy(char* dst, char* src, u32 maxlen) { + u32 i; + for (i = maxlen; i != 0 && src[0] != '\0'; --i) { + *dst++ = *src++; + } + + return maxlen - i; +} + +static BOOL ARCConvertEntrynumToPath(ARCHandle* handle, s32 entrynum, + char* string, u32 maxlen) { + ARCNode* nodes = handle->nodes; + u32 written = entryToPath(handle, entrynum, string, maxlen); + + if (written == maxlen) { + string[maxlen - 1] = '\0'; + return FALSE; + } + + if (ARCNodeIsFolder(nodes[entrynum])) { + if (written == maxlen - 1) { + string[written] = '\0'; + return FALSE; + } + + string[written++] = '/'; + } + + string[written] = '\0'; + return TRUE; +} + +BOOL ARCGetCurrentDir(ARCHandle* handle, char* string, u32 maxlen) { + return ARCConvertEntrynumToPath(handle, handle->entrynum, string, maxlen); +} + +BOOL ARCInitHandle(void* bin, ARCHandle* handle) { + ARCNode* nodes; + ARCHeader* header = (ARCHeader*)bin; + + // clang-format off +#line 74 + OS_ASSERT(header->magic == ARC_FILE_MAGIC, "ARCInitHandle: bad archive format"); + // clang-format on + + handle->header = header; + + nodes = (ARCNode*)((u8*)header + header->nodes.offset); + handle->nodes = nodes; + + handle->file = ((u8*)header + header->files.offset); + // The right bound of the root node is the number of nodes + handle->count = nodes[0].folder.sibling_next; + // Strings exist directly after the last node. + handle->strings = (const char*)(nodes + handle->count); + handle->fstSize = header->nodes.size; + handle->entrynum = 0; + + return TRUE; +} + +BOOL ARCOpen(ARCHandle* handle, const char* path, ARCFileInfo* info) { + ARCNode* nodes = handle->nodes; + s32 entrynum = ARCConvertPathToEntrynum(handle, path); + + if (entrynum < 0) { + char dir[128]; + ARCGetCurrentDir(handle, dir, sizeof(dir)); + + OSReport("Warning: ARCOpen(): file '%s' was not found under %s in the " + "archive.\n", + path, dir); + + return FALSE; + } + + if (entrynum < 0 || ARCNodeIsFolder(nodes[entrynum])) { + return FALSE; + } + + info->handle = handle; + info->offset = nodes[entrynum].file.offset; + info->size = nodes[entrynum].file.size; + return TRUE; +} + +BOOL ARCFastOpen(ARCHandle* handle, s32 entrynum, ARCFileInfo* info) { + ARCNode* nodes = handle->nodes; + + if (entrynum < 0 || entrynum >= handle->count || + ARCNodeIsFolder(nodes[entrynum])) { + return FALSE; + } + + info->handle = handle; + info->offset = nodes[entrynum].file.offset; + info->size = nodes[entrynum].file.size; + + return TRUE; +} + +s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) { + const char* name_end; + BOOL name_delimited_by_slash; + s32 name_length; + u32 anchor; + u32 it = handle->entrynum; + ARCNode* nodes = handle->nodes; + + while (TRUE) { + // End of string -> return what we have + if (path[0] == '\0') { + return it; + } + + // Ignore initial slash: /Path/File vs Path/File + if (path[0] == '/') { + it = 0; + ++path; + continue; + } + + // Handle special cases: + // -../-, -.., -./-, -. + if (path[0] == '.') { + if (path[1] == '.') { + // Seek to parent ../ + if (path[2] == '/') { + it = nodes[it].folder.parent; + path += 3; + continue; + } + // Return parent folder immediately + if (path[2] == '\0') { + return nodes[it].folder.parent; + } + // Malformed: fall through, causing infinite loop + goto compare; + } + + // "." directory does nothing + if (path[1] == '/') { + path += 2; + continue; + } + + // Ignore trailing dot + if (path[1] == '\0') { + return it; + } + } + + compare: + // We've ensured the directory is not special. + // Isolate the name of the current item in the path string. + name_end = path; + while (name_end[0] != '\0' && name_end[0] != '/') { + ++name_end; + } + + // If the name was delimited by a '/' rather than truncated. + // This must be expressed as a ternary, and an enum cannot be used.. + name_delimited_by_slash = (name_end[0] != '\0') ? 1 : 0; + name_length = name_end - path; + + // Traverse all children of the parent. + anchor = it; + ++it; + while (it < nodes[anchor].folder.sibling_next) { + while (TRUE) { + if (ARCNodeIsFolder(nodes[it]) || + name_delimited_by_slash != TRUE) { + char* name_of_it = + ((char*)handle->strings) + ARCNodeGetName(nodes[it]); + + // Skip empty directories + if (name_of_it[0] == '.' && name_of_it[1] == '\0') { + ++it; + continue; + } + + // Advance to the next item in the path + if (isSame(path, name_of_it) == TRUE) { + goto descend; + } + } + + if (ARCNodeIsFolder(nodes[it])) { + it = nodes[it].folder.sibling_next; + break; + } + + ++it; + break; + } + } + + return -1; + + descend: + // If the path was truncated, there is nowhere else to go + // These basic blocks have to go here right at the end, accessed via a + // goto. An odd choice. + if (!name_delimited_by_slash) { + return it; + } + + path += name_length + 1; + } +} + +static u32 entryToPath(ARCHandle* handle, u32 entrynum, char* string, + u32 maxlen) { + char* name; + u32 written; + ARCNode* nodes = handle->nodes; + + if (entrynum == 0) { + return 0; + } + + name = ((char*)handle->strings) + nodes[entrynum].name; + + written = + entryToPath(handle, nodes[entrynum].folder.parent, string, maxlen); + if (written == maxlen) { + return written; + } + + string[written++] = '/'; + return written + myStrncpy(string + written, name, maxlen - written); +} + +void* ARCGetStartAddrInMem(ARCFileInfo* info) { + return (u8*)info->handle->header + info->offset; +} + +s32 ARCGetStartOffset(ARCFileInfo* info) { + return info->offset; +} + +u32 ARCGetLength(ARCFileInfo* info) { + return info->size; +} + +BOOL ARCClose(ARCFileInfo* info) { +#pragma unused(info) + + return TRUE; +} + +BOOL ARCChangeDir(ARCHandle* info, const char* path) { + s32 entrynum = ARCConvertPathToEntrynum(info, path); + ARCNode* nodes = info->nodes; + + if (entrynum < 0 || !ARCNodeIsFolder(nodes[entrynum])) { + return FALSE; + } + + info->entrynum = entrynum; + return TRUE; +} + +BOOL ARCOpenDir(ARCHandle* info, const char* path, ARCDir* dir) { + s32 entrynum = ARCConvertPathToEntrynum(info, path); + ARCNode* nodes = info->nodes; + + if (entrynum < 0 || !ARCNodeIsFolder(nodes[entrynum])) { + return FALSE; + } + + dir->handle = info; + dir->path_begin = entrynum; + dir->path_it = entrynum + 1; + dir->path_end = nodes[entrynum].folder.sibling_next; + return TRUE; +} + +BOOL ARCReadDir(ARCDir* dir, ARCEntry* entry) { + u32 it; + ARCNode* nodes; + ARCHandle* arc = dir->handle; + + nodes = arc->nodes; + it = dir->path_it; + + while (TRUE) { + if (it <= dir->path_begin || dir->path_end <= it) { + return FALSE; + } + + entry->handle = arc; + entry->path = it; + // All non-file entries are folders. + // Collapse to one specific value. + entry->type = + ARCNodeIsFolder(nodes[it]) ? ARC_ENTRY_FOLDER : ARC_ENTRY_FILE; + entry->name = arc->strings + nodes[it].name; + + // skip '.' directories + if (entry->name[0] == '.' && entry->name[1] == '\0') { + ++it; + continue; + } + + dir->path_it = + ARCNodeIsFolder(nodes[it]) ? nodes[it].folder.sibling_next : it + 1; + return TRUE; + } +} + +BOOL ARCCloseDir(ARCDir* dir) { +#pragma unused(dir) + + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AX.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AX.c new file mode 100644 index 0000000000..c64bba97c2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AX.c @@ -0,0 +1,26 @@ +#include +#include + +const char* __AXVersion = + "<< RVL_SDK - AX \trelease build: Dec 18 2006 15:43:48 (0x4199_60831) >>"; + +static BOOL __init = FALSE; + +void AXInit(void) { + AXInitEx(0); +} + +void AXInitEx(u32 mode) { + if (!__init) { + OSRegisterVersion(__AXVersion); + + __AXAllocInit(); + __AXVPBInit(); + __AXSPBInit(); + __AXAuxInit(); + __AXClInit(); + __AXOutInit(mode); + + __init = TRUE; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAlloc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAlloc.c new file mode 100644 index 0000000000..61dacdfa7f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAlloc.c @@ -0,0 +1,188 @@ +#include +#include + +#define STACK_MAX (AX_PRIORITY_MAX + 1) + +static AXVPB* __AXStackHead[STACK_MAX]; +static AXVPB* __AXStackTail[STACK_MAX]; +static AXVPB* __AXCallbackStack = NULL; + +AXVPB* __AXGetStackHead(u32 prio) { + return __AXStackHead[prio]; +} + +void __AXServiceCallbackStack(void) { + AXVPB* it = __AXPopCallbackStack(); + + while (it != NULL) { + if (it->priority > AX_PRIORITY_FREE) { + if (it->callback != NULL) { + it->callback(it); + } + + __AXRemoveFromStack(it); + __AXPushFreeStack(it); + } + + it = __AXPopCallbackStack(); + } +} + +void __AXInitVoiceStacks(void) { + u32 prio; + + __AXCallbackStack = NULL; + + for (prio = 0; prio < STACK_MAX; prio++) { + __AXStackHead[prio] = __AXStackTail[prio] = NULL; + } +} + +void __AXAllocInit(void) { + __AXInitVoiceStacks(); +} + +void __AXPushFreeStack(AXVPB* vpb) { + vpb->next = __AXStackHead[AX_PRIORITY_FREE]; + __AXStackHead[AX_PRIORITY_FREE] = vpb; + vpb->priority = AX_PRIORITY_FREE; +} + +AXVPB* __AXPopFreeStack(void) { + AXVPB* head = __AXStackHead[AX_PRIORITY_FREE]; + + if (head != NULL) { + __AXStackHead[AX_PRIORITY_FREE] = head->next; + } + + return head; +} + +void __AXPushCallbackStack(AXVPB* vpb) { + vpb->next1 = __AXCallbackStack; + __AXCallbackStack = vpb; +} + +AXVPB* __AXPopCallbackStack(void) { + AXVPB* head = __AXCallbackStack; + + if (head != NULL) { + __AXCallbackStack = head->next1; + } + + return head; +} + +void __AXRemoveFromStack(AXVPB* vpb) { + u32 prio = vpb->priority; + AXVPB* head = __AXStackHead[prio]; + AXVPB* tail = __AXStackTail[prio]; + + if (head == tail) { + __AXStackTail[prio] = NULL; + __AXStackHead[prio] = NULL; + } else if (vpb == head) { + __AXStackHead[prio] = vpb->next; + __AXStackHead[prio]->prev = NULL; + } else if (vpb == tail) { + __AXStackTail[prio] = vpb->prev; + __AXStackTail[prio]->next = NULL; + } else { + head = vpb->prev; + tail = vpb->next; + head->next = tail; + tail->prev = head; + } +} + +void __AXPushStackHead(AXVPB* vpb, u32 prio) { + vpb->next = __AXStackHead[prio]; + vpb->prev = NULL; + + if (vpb->next != NULL) { + __AXStackHead[prio]->prev = vpb; + __AXStackHead[prio] = vpb; + } else { + __AXStackTail[prio] = vpb; + __AXStackHead[prio] = vpb; + } + + vpb->priority = prio; +} + +AXVPB* __AXPopStackFromBottom(u32 prio) { + AXVPB* vpb = NULL; + + if (__AXStackHead[prio] != NULL) { + if (__AXStackHead[prio] == __AXStackTail[prio]) { + vpb = __AXStackHead[prio]; + __AXStackTail[prio] = NULL; + __AXStackHead[prio] = NULL; + } else if (__AXStackTail[prio] != NULL) { + vpb = __AXStackTail[prio]; + __AXStackTail[prio] = vpb->prev; + __AXStackTail[prio]->next = NULL; + } + } + + return vpb; +} + +void AXFreeVoice(AXVPB* vpb) { + BOOL enabled = OSDisableInterrupts(); + + __AXRemoveFromStack(vpb); + + if (vpb->pb.state == AX_VOICE_RUN) { + vpb->depop = TRUE; + } + + __AXSetPBDefault(vpb); + __AXPushFreeStack(vpb); + + OSRestoreInterrupts(enabled); +} + +AXVPB* AXAcquireVoice(u32 prio, AXVoiceCallback callback, u32 userContext) { + BOOL enabled = OSDisableInterrupts(); + AXVPB* vpb = __AXPopFreeStack(); + + if (vpb == NULL) { + u32 i; + + for (i = AX_PRIORITY_MIN; i < prio; i++) { + vpb = __AXPopStackFromBottom(i); + + if (vpb != NULL) { + if (vpb->pb.state == AX_VOICE_RUN) { + vpb->depop = TRUE; + } + + if (vpb->callback != NULL) { + vpb->callback(vpb); + } + + break; + } + } + } + + if (vpb != NULL) { + __AXPushStackHead(vpb, prio); + vpb->callback = callback; + vpb->userContext = userContext; + __AXSetPBDefault(vpb); + } + + OSRestoreInterrupts(enabled); + return vpb; +} + +void AXSetVoicePriority(AXVPB* vpb, u32 prio) { + BOOL enabled = OSDisableInterrupts(); + + __AXRemoveFromStack(vpb); + __AXPushStackHead(vpb, prio); + + OSRestoreInterrupts(enabled); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAux.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAux.c new file mode 100644 index 0000000000..51624f2b15 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXAux.c @@ -0,0 +1,324 @@ +#include +#include +#include + +/** + * Ring buffers have three entries: + * 1. For DSP write + * 2. For DSP read + * 3. For CPU read/write + */ +#define AUX_RING_MAX 3 + +/** + * 96 samples per frame @ 32-bit depth + */ +#define AUX_CHAN_SIZE (AX_SAMPLE_DEPTH_BYTES * AX_SAMPLES_PER_FRAME) + +/** + * Stereo buffer size: (96 samples/frame, 3 channels) + * DPL2 buffer size: (96 samples/frame, 4 channels) + */ +#define STEREO_FRAME_SIZE (AUX_CHAN_SIZE * AX_STEREO_MAX) +#define DPL2_FRAME_SIZE (AUX_CHAN_SIZE * AX_DPL2_MAX) + +/** + * Sample indices for stereo + */ +#define STEREO_SAMPLE_L_BEGIN (AUX_CHAN_SIZE * 0) +#define STEREO_SAMPLE_R_BEGIN (AUX_CHAN_SIZE * 1) +#define STEREO_SAMPLE_S_BEGIN (AUX_CHAN_SIZE * 2) + +/** + * Sample indices for DPL2 + */ +#define DPL2_SAMPLE_I_BEGIN (AUX_CHAN_SIZE * 3) +#define DPL2_SAMPLE_L_BEGIN (AUX_CHAN_SIZE * 0) +#define DPL2_SAMPLE_R_BEGIN (AUX_CHAN_SIZE * 1) +#define DPL2_SAMPLE_LS_BEGIN (AUX_CHAN_SIZE * 2) +#define DPL2_SAMPLE_RS_BEGIN (AUX_CHAN_SIZE * 3) + +static u8 __AXBufferAuxA[AUX_RING_MAX][DPL2_FRAME_SIZE] ALIGN(32); +static u8 __AXBufferAuxB[AUX_RING_MAX][DPL2_FRAME_SIZE] ALIGN(32); +static u8 __AXBufferAuxC[AUX_RING_MAX][STEREO_FRAME_SIZE] ALIGN(32); + +static u8 __clearAuxA[AUX_RING_MAX]; +static u8 __clearAuxB[AUX_RING_MAX]; +static u8 __clearAuxC[AUX_RING_MAX]; + +static AXAuxCallback __AXCallbackAuxA; +static AXAuxCallback __AXCallbackAuxB; +static AXAuxCallback __AXCallbackAuxC; + +static void* __AXContextAuxA; +static void* __AXContextAuxB; +static void* __AXContextAuxC; + +static void* __AXAuxADspWrite; +static void* __AXAuxADspRead; + +static void* __AXAuxBDspWrite; +static void* __AXAuxBDspRead; + +static void* __AXAuxCDspWrite; +static void* __AXAuxCDspRead; + +static u32 __AXAuxDspWritePosition; +static u32 __AXAuxDspReadPosition; +static u32 __AXAuxCpuReadWritePosition; + +void __AXAuxInit(void) { + int i; + u32* bufferA = (u32*)__AXBufferAuxA; + u32* bufferB = (u32*)__AXBufferAuxB; + u32* bufferC = (u32*)__AXBufferAuxC; + + __AXCallbackAuxA = NULL; + __AXCallbackAuxB = NULL; + __AXCallbackAuxC = NULL; + + __AXContextAuxA = NULL; + __AXContextAuxB = NULL; + __AXContextAuxC = NULL; + + __AXAuxDspWritePosition = 0; + __AXAuxDspReadPosition = 1; + __AXAuxCpuReadWritePosition = 2; + + for (i = 0; i < STEREO_FRAME_SIZE / sizeof(u32); i++) { + *bufferA++ = 0; + *bufferB++ = 0; + *bufferC++ = 0; + } + + memset(__clearAuxA, FALSE, AUX_RING_MAX); + memset(__clearAuxB, FALSE, AUX_RING_MAX); + memset(__clearAuxC, FALSE, AUX_RING_MAX); +} + +void __AXGetAuxAInput(void** out) { + if (__AXCallbackAuxA != NULL) { + *out = __AXBufferAuxA[__AXAuxDspWritePosition]; + } else { + *out = NULL; + } +} + +void __AXGetAuxAOutput(void** out) { + *out = __AXBufferAuxA[__AXAuxDspReadPosition]; +} + +void __AXGetAuxAInputDpl2(void** out) { + *out = &__AXBufferAuxA[__AXAuxDspWritePosition][DPL2_SAMPLE_I_BEGIN]; +} + +void __AXGetAuxAOutputDpl2R(void** out) { + *out = &__AXBufferAuxA[__AXAuxDspReadPosition][DPL2_SAMPLE_R_BEGIN]; +} + +void __AXGetAuxAOutputDpl2Ls(void** out) { + *out = &__AXBufferAuxA[__AXAuxDspReadPosition][DPL2_SAMPLE_LS_BEGIN]; +} + +void __AXGetAuxAOutputDpl2Rs(void** out) { + *out = &__AXBufferAuxA[__AXAuxDspReadPosition][DPL2_SAMPLE_RS_BEGIN]; +} + +void __AXGetAuxBInput(void** out) { + if (__AXCallbackAuxB != NULL) { + *out = __AXBufferAuxB[__AXAuxDspWritePosition]; + } else { + *out = NULL; + } +} + +void __AXGetAuxBOutput(void** out) { + *out = __AXBufferAuxB[__AXAuxDspReadPosition]; +} + +void __AXGetAuxBInputDpl2(void** out) { + *out = &__AXBufferAuxB[__AXAuxDspWritePosition][DPL2_SAMPLE_I_BEGIN]; +} + +void __AXGetAuxBOutputDpl2R(void** out) { + *out = &__AXBufferAuxB[__AXAuxDspReadPosition][DPL2_SAMPLE_R_BEGIN]; +} + +void __AXGetAuxBOutputDpl2Ls(void** out) { + *out = &__AXBufferAuxB[__AXAuxDspReadPosition][DPL2_SAMPLE_LS_BEGIN]; +} + +void __AXGetAuxBOutputDpl2Rs(void** out) { + *out = &__AXBufferAuxB[__AXAuxDspReadPosition][DPL2_SAMPLE_RS_BEGIN]; +} + +void __AXGetAuxCInput(void** out) { + if (__AXCallbackAuxC != NULL) { + *out = __AXBufferAuxC[__AXAuxDspWritePosition]; + } else { + *out = NULL; + } +} + +void __AXGetAuxCOutput(void** out) { + *out = __AXBufferAuxC[__AXAuxDspReadPosition]; +} + +void __AXProcessAux(void) { + __AXAuxADspWrite = __AXBufferAuxA[__AXAuxDspWritePosition]; + __AXAuxADspRead = __AXBufferAuxA[__AXAuxDspReadPosition]; + + __AXAuxBDspWrite = __AXBufferAuxB[__AXAuxDspWritePosition]; + __AXAuxBDspRead = __AXBufferAuxB[__AXAuxDspReadPosition]; + + __AXAuxCDspWrite = __AXBufferAuxC[__AXAuxDspWritePosition]; + __AXAuxCDspRead = __AXBufferAuxC[__AXAuxDspReadPosition]; + + if (__AXCallbackAuxA != NULL) { + if (__AXClMode == AX_OUTPUT_DPL2) { + void* chans[AX_DPL2_MAX]; + // clang-format off + chans[AX_DPL2_L] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; + chans[AX_DPL2_R] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; + chans[AX_DPL2_LS] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_LS_BEGIN]; + chans[AX_DPL2_RS] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_RS_BEGIN]; + // clang-format on + + DCInvalidateRange(chans[0], DPL2_FRAME_SIZE); + __AXCallbackAuxA(chans, __AXContextAuxA); + DCFlushRangeNoSync(chans[0], DPL2_FRAME_SIZE); + } else { + void* chans[AX_STEREO_MAX]; + // clang-format off + chans[AX_STEREO_L] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_L_BEGIN]; + chans[AX_STEREO_R] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_R_BEGIN]; + chans[AX_STEREO_S] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_S_BEGIN]; + // clang-format on + + DCInvalidateRange(chans[0], STEREO_FRAME_SIZE); + __AXCallbackAuxA(chans, __AXContextAuxA); + DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); + } + } else if (__clearAuxA[__AXAuxCpuReadWritePosition]) { + void* chan = __AXBufferAuxA[__AXAuxCpuReadWritePosition]; + memset(chan, 0, DPL2_FRAME_SIZE); + DCFlushRange(chan, DPL2_FRAME_SIZE); + __clearAuxA[__AXAuxCpuReadWritePosition] = FALSE; + } + + if (__AXCallbackAuxB != NULL) { + if (__AXClMode == AX_OUTPUT_DPL2) { + void* chans[AX_DPL2_MAX]; + // clang-format off + chans[AX_DPL2_L] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; + chans[AX_DPL2_R] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; + chans[AX_DPL2_LS] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_LS_BEGIN]; + chans[AX_DPL2_RS] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_RS_BEGIN]; + // clang-format on + + DCInvalidateRange(chans[0], DPL2_FRAME_SIZE); + __AXCallbackAuxB(chans, __AXContextAuxB); + DCFlushRangeNoSync(chans[0], DPL2_FRAME_SIZE); + } else { + void* chans[AX_STEREO_MAX]; + // clang-format off + chans[AX_STEREO_L] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_L_BEGIN]; + chans[AX_STEREO_R] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_R_BEGIN]; + chans[AX_STEREO_S] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_S_BEGIN]; + // clang-format on + + DCInvalidateRange(chans[0], STEREO_FRAME_SIZE); + __AXCallbackAuxB(chans, __AXContextAuxB); + DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); + } + } else if (__clearAuxB[__AXAuxCpuReadWritePosition]) { + void* chan = __AXBufferAuxB[__AXAuxCpuReadWritePosition]; + memset(chan, 0, DPL2_FRAME_SIZE); + + DCFlushRange(chan, DPL2_FRAME_SIZE); + __clearAuxB[__AXAuxCpuReadWritePosition] = FALSE; + } + + if (__AXCallbackAuxC != NULL && __AXClMode != AX_OUTPUT_DPL2) { + void* chans[AX_STEREO_MAX]; + // clang-format off + chans[AX_STEREO_L] = &__AXBufferAuxC[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_L_BEGIN]; + chans[AX_STEREO_R] = &__AXBufferAuxC[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_R_BEGIN]; + chans[AX_STEREO_S] = &__AXBufferAuxC[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_S_BEGIN]; + // clang-format on + + DCInvalidateRange(chans[0], STEREO_FRAME_SIZE); + __AXCallbackAuxC(chans, __AXContextAuxC); + DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); + } else if (__AXCallbackAuxC == NULL && + __clearAuxC[__AXAuxCpuReadWritePosition]) { + void* chan = __AXBufferAuxC[__AXAuxCpuReadWritePosition]; + memset(chan, 0, STEREO_FRAME_SIZE); + + DCFlushRange(chan, STEREO_FRAME_SIZE); + __clearAuxC[__AXAuxCpuReadWritePosition] = FALSE; + } + + __AXAuxDspWritePosition++; + __AXAuxDspWritePosition %= AX_STEREO_MAX; + + __AXAuxDspReadPosition++; + __AXAuxDspReadPosition %= AX_STEREO_MAX; + + __AXAuxCpuReadWritePosition++; + __AXAuxCpuReadWritePosition %= AX_STEREO_MAX; +} + +void AXRegisterAuxACallback(AXAuxCallback callback, void* context) { + BOOL enabled = OSDisableInterrupts(); + + __AXCallbackAuxA = callback; + __AXContextAuxA = context; + + if (callback == NULL) { + memset(&__clearAuxA, TRUE, AX_STEREO_MAX); + } + + OSRestoreInterrupts(enabled); +} + +void AXRegisterAuxBCallback(AXAuxCallback callback, void* context) { + BOOL enabled = OSDisableInterrupts(); + + __AXCallbackAuxB = callback; + __AXContextAuxB = context; + + if (callback == NULL) { + memset(&__clearAuxB, TRUE, AX_STEREO_MAX); + } + + OSRestoreInterrupts(enabled); +} + +void AXRegisterAuxCCallback(AXAuxCallback callback, void* context) { + BOOL enabled = OSDisableInterrupts(); + + __AXCallbackAuxC = callback; + __AXContextAuxC = context; + + if (callback == NULL) { + memset(&__clearAuxC, TRUE, AX_STEREO_MAX); + } + + OSRestoreInterrupts(enabled); +} + +void AXGetAuxACallback(AXAuxCallback* callback, void** context) { + *callback = __AXCallbackAuxA; + *context = __AXContextAuxA; +} + +void AXGetAuxBCallback(AXAuxCallback* callback, void** context) { + *callback = __AXCallbackAuxB; + *context = __AXContextAuxB; +} + +void AXGetAuxCCallback(AXAuxCallback* callback, void** context) { + *callback = __AXCallbackAuxC; + *context = __AXContextAuxC; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXCL.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXCL.c new file mode 100644 index 0000000000..a0807fe9c5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXCL.c @@ -0,0 +1,282 @@ +#include +#include + +// Compression parameters. +// Later versions of AX have these as static vars +#define THRESHOLD 32768 +#define RELEASE_FRAMES 10 + +// Space is allocated for two commands lists +#define LIST_MAX 2 + +#define LIST_WRITE_16(x) \ + do { \ + __AXWriteToCommandList((x)); \ + } while (0) + +#define LIST_WRITE_32(x) \ + do { \ + __AXWriteToCommandList((x) >> 16); \ + __AXWriteToCommandList((x)); \ + } while (0) + +/** + * Command list opcodes (from Dolphin Emulator) + */ +typedef enum { + COMMAND_SETUP, + COMMAND_ADD_TO_LR, + COMMAND_SUB_TO_LR, + COMMAND_ADD_SUB_TO_LR, + COMMAND_PROCESS, + COMMAND_MIX_AUXA, + COMMAND_MIX_AUXB, + COMMAND_MIX_AUXC, + COMMAND_UPL_AUXA_MIX_LRSC, + COMMAND_UPL_AUXB_MIX_LRSC, + COMMAND_COMPRESSOR, + COMMAND_OUTPUT, + COMMAND_OUTPUT_DPL2, + COMMAND_WM_OUTPUT, + COMMAND_END +}; + +static u32 __AXCommandListPosition; + +static u16* __AXClWrite; +u32 __AXClMode; + +static u32 __AXCommandListCycles; +static u8 __AXCommandList[AX_CL_SIZE * LIST_MAX]; + +static BOOL __AXCompressor; + +static volatile u16 __AXMasterVolume; +static u16 __AXAuxAVolume; +static u16 __AXAuxBVolume; +static u16 __AXAuxCVolume; + +u32 __AXGetCommandListCycles(void) { + return __AXCommandListCycles; +} + +void* __AXGetCommandListAddress(void) { + void* list = __AXCommandList + __AXCommandListPosition * AX_CL_SIZE; + + __AXCommandListPosition++; + __AXCommandListPosition %= LIST_MAX; + __AXClWrite = + (u16*)(__AXCommandList + __AXCommandListPosition * AX_CL_SIZE); + + return list; +} + +void __AXWriteToCommandList(u16 cmd) { + *__AXClWrite = cmd; + __AXClWrite++; +} + +void __AXNextFrame(void* surround, void* lr, void* rmt) { + void* imm; + void* backup; + + __AXCommandListCycles = 7811; + backup = __AXClWrite; + imm = __AXGetStudio(); + + LIST_WRITE_16(COMMAND_SETUP); + LIST_WRITE_32((uintptr_t)imm); + __AXCommandListCycles += 4126; + + switch (__AXClMode) { + case AX_OUTPUT_STEREO: + LIST_WRITE_16(COMMAND_ADD_TO_LR); + LIST_WRITE_32((uintptr_t)surround); + __AXCommandListCycles += 733; + break; + case AX_OUTPUT_SURROUND: + LIST_WRITE_16(COMMAND_SUB_TO_LR); + LIST_WRITE_32((uintptr_t)surround); + __AXCommandListCycles += 829; + break; + case AX_OUTPUT_DPL2: + LIST_WRITE_16(COMMAND_ADD_SUB_TO_LR); + LIST_WRITE_32((uintptr_t)surround); + __AXCommandListCycles += 925; + break; + } + + imm = __AXGetPBs(); + LIST_WRITE_16(COMMAND_PROCESS); + LIST_WRITE_32((uintptr_t)imm); + + if (__AXClMode == AX_OUTPUT_DPL2) { + __AXGetAuxAInput(&imm); + if (imm != NULL) { + LIST_WRITE_16(COMMAND_UPL_AUXA_MIX_LRSC); + LIST_WRITE_16(__AXAuxAVolume); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAInputDpl2(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAOutput(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAOutputDpl2R(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAOutputDpl2Ls(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAOutputDpl2Rs(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXCommandListCycles += 3036; + } + + __AXGetAuxBInput(&imm); + if (imm != NULL) { + LIST_WRITE_16(COMMAND_UPL_AUXB_MIX_LRSC); + LIST_WRITE_16(__AXAuxBVolume); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBInputDpl2(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBOutput(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBOutputDpl2R(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBOutputDpl2Ls(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBOutputDpl2Rs(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXCommandListCycles += 3036; + } + } else { + __AXGetAuxAInput(&imm); + if (imm != NULL) { + LIST_WRITE_16(COMMAND_MIX_AUXA); + LIST_WRITE_16(__AXAuxAVolume); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxAOutput(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXCommandListCycles += 2235; + } + + __AXGetAuxBInput(&imm); + if (imm != NULL) { + LIST_WRITE_16(COMMAND_MIX_AUXB); + LIST_WRITE_16(__AXAuxBVolume); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxBOutput(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXCommandListCycles += 2235; + } + + __AXGetAuxCInput(&imm); + if (imm != NULL) { + LIST_WRITE_16(COMMAND_MIX_AUXC); + LIST_WRITE_16(__AXAuxCVolume); + LIST_WRITE_32((uintptr_t)imm); + + __AXGetAuxCOutput(&imm); + LIST_WRITE_32((uintptr_t)imm); + + __AXCommandListCycles += 2235; + } + } + + if (__AXCompressor) { + LIST_WRITE_16(COMMAND_COMPRESSOR); + LIST_WRITE_16(THRESHOLD); + LIST_WRITE_16(RELEASE_FRAMES); + LIST_WRITE_32((uintptr_t)__AXCompressorTable); + __AXCommandListCycles += 1850; + } + + LIST_WRITE_16(COMMAND_WM_OUTPUT); + LIST_WRITE_32(((u32*)rmt)[0]); + LIST_WRITE_32(((u32*)rmt)[1]); + LIST_WRITE_32(((u32*)rmt)[2]); + LIST_WRITE_32(((u32*)rmt)[3]); + __AXCommandListCycles += 409; + + if (__AXClMode == AX_OUTPUT_DPL2) { + LIST_WRITE_16(COMMAND_OUTPUT_DPL2); + LIST_WRITE_16(__AXMasterVolume); + LIST_WRITE_32((uintptr_t)surround); + LIST_WRITE_32((uintptr_t)lr); + __AXCommandListCycles += 1195; + } else { + LIST_WRITE_16(COMMAND_OUTPUT); + LIST_WRITE_16(__AXMasterVolume); + LIST_WRITE_32((uintptr_t)surround); + LIST_WRITE_32((uintptr_t)lr); + __AXCommandListCycles += 1172; + } + + LIST_WRITE_16(COMMAND_END); + __AXCommandListCycles += 30; + + DCFlushRange(backup, AX_CL_SIZE); +} + +void __AXClInit(void) { + __AXClMode = AX_OUTPUT_STEREO; + __AXCommandListPosition = 0; + __AXClWrite = (u16*)__AXCommandList; + __AXCompressor = TRUE; + + __AXAuxCVolume = __AXAuxBVolume = __AXAuxAVolume = __AXMasterVolume = + AX_MAX_VOLUME; +} + +void AXSetMode(u32 mode) { + __AXClMode = mode; +} + +u32 AXGetMode(void) { + return __AXClMode; +} + +u16 AXGetAuxAReturnVolume(void) { + return __AXAuxAVolume; +} + +u16 AXGetAuxBReturnVolume(void) { + return __AXAuxBVolume; +} + +u16 AXGetAuxCReturnVolume(void) { + return __AXAuxCVolume; +} + +void AXSetMasterVolume(u16 volume) { + if (volume > AX_MAX_VOLUME) { + volume = AX_MAX_VOLUME; + } + + __AXMasterVolume = volume; +} + +void AXSetAuxAReturnVolume(u16 volume) { + __AXAuxAVolume = volume; +} + +void AXSetAuxBReturnVolume(u16 volume) { + __AXAuxBVolume = volume; +} + +void AXSetAuxCReturnVolume(u16 volume) { + __AXAuxCVolume = volume; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXComp.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXComp.c new file mode 100644 index 0000000000..d8edc02ecf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXComp.c @@ -0,0 +1,187 @@ +#include + +u16 __AXCompressorTable[] ALIGN(32) = { + 32611, 32455, 32299, 32145, 31991, 31838, 31685, 31534, 31383, 31233, 31083, + 30934, 30786, 30639, 30492, 30347, 30201, 30057, 29913, 29770, 29627, 29486, + 29344, 29204, 29064, 28925, 28787, 28649, 28512, 28375, 28240, 28104, 27970, + 27836, 27703, 27570, 27438, 27307, 27176, 27046, 26917, 26788, 26660, 26532, + 26405, 26279, 26153, 26028, 25903, 25780, 25656, 25533, 25411, 25290, 25169, + 25048, 24928, 24809, 24690, 24572, 24454, 24337, 24221, 24105, 23990, 23875, + 23761, 23647, 23534, 23421, 23309, 23197, 23086, 22976, 22866, 22757, 22648, + 22539, 22431, 22324, 22217, 22111, 22005, 21900, 21795, 21691, 21587, 21484, + 21381, 21278, 21177, 21075, 20974, 20874, 20774, 20675, 31158, 31024, 30890, + 30757, 30624, 30492, 30361, 30230, 30100, 29970, 29841, 29713, 29585, 29457, + 29330, 29204, 29078, 28953, 28828, 28704, 28580, 28457, 28335, 28213, 28091, + 27970, 27849, 27730, 27610, 27491, 27373, 27255, 27137, 27020, 26904, 26788, + 26673, 26558, 26443, 26329, 26216, 26103, 25991, 25879, 25767, 25656, 25546, + 25436, 25326, 25217, 25108, 25000, 24892, 24785, 24678, 24572, 24466, 24361, + 24256, 24151, 24047, 23944, 23841, 23738, 23636, 23534, 23432, 23331, 23231, + 23131, 23031, 22932, 22833, 22735, 22637, 22539, 22442, 22346, 22249, 22153, + 22058, 21963, 21868, 21774, 21680, 21587, 21494, 21401, 21309, 21217, 21126, + 21035, 20944, 20854, 20764, 20675, 29770, 29656, 29542, 29429, 29316, 29204, + 29092, 28981, 28870, 28759, 28649, 28539, 28430, 28321, 28213, 28104, 27997, + 27890, 27783, 27676, 27570, 27465, 27360, 27255, 27150, 27046, 26943, 26840, + 26737, 26634, 26532, 26431, 26329, 26229, 26128, 26028, 25928, 25829, 25730, + 25632, 25533, 25436, 25338, 25241, 25144, 25048, 24952, 24857, 24761, 24667, + 24572, 24478, 24384, 24291, 24198, 24105, 24013, 23921, 23829, 23738, 23647, + 23556, 23466, 23376, 23287, 23197, 23109, 23020, 22932, 22844, 22757, 22669, + 22583, 22496, 22410, 22324, 22239, 22153, 22069, 21984, 21900, 21816, 21732, + 21649, 21566, 21484, 21401, 21319, 21238, 21156, 21075, 20995, 20914, 20834, + 20754, 20675, 28444, 28348, 28253, 28158, 28064, 27970, 27876, 27783, 27690, + 27597, 27504, 27412, 27320, 27229, 27137, 27046, 26956, 26865, 26775, 26685, + 26596, 26507, 26418, 26329, 26241, 26153, 26066, 25978, 25891, 25804, 25718, + 25632, 25546, 25460, 25375, 25290, 25205, 25120, 25036, 24952, 24868, 24785, + 24702, 24619, 24537, 24454, 24372, 24291, 24209, 24128, 24047, 23967, 23886, + 23806, 23726, 23647, 23568, 23489, 23410, 23331, 23253, 23175, 23098, 23020, + 22943, 22866, 22789, 22713, 22637, 22561, 22485, 22410, 22335, 22260, 22185, + 22111, 22037, 21963, 21889, 21816, 21743, 21670, 21597, 21525, 21453, 21381, + 21309, 21238, 21166, 21095, 21025, 20954, 20884, 20814, 20744, 20675, 27176, + 27098, 27020, 26943, 26865, 26788, 26711, 26634, 26558, 26481, 26405, 26329, + 26254, 26178, 26103, 26028, 25953, 25879, 25804, 25730, 25656, 25582, 25509, + 25436, 25362, 25290, 25217, 25144, 25072, 25000, 24928, 24857, 24785, 24714, + 24643, 24572, 24501, 24431, 24361, 24291, 24221, 24151, 24082, 24013, 23944, + 23875, 23806, 23738, 23670, 23602, 23534, 23466, 23399, 23331, 23264, 23197, + 23131, 23064, 22998, 22932, 22866, 22800, 22735, 22669, 22604, 22539, 22475, + 22410, 22346, 22281, 22217, 22153, 22090, 22026, 21963, 21900, 21837, 21774, + 21712, 21649, 21587, 21525, 21463, 21401, 21340, 21278, 21217, 21156, 21095, + 21035, 20974, 20914, 20854, 20794, 20734, 20675, 25966, 25903, 25841, 25780, + 25718, 25656, 25595, 25533, 25472, 25411, 25350, 25290, 25229, 25169, 25108, + 25048, 24988, 24928, 24868, 24809, 24749, 24690, 24631, 24572, 24513, 24454, + 24396, 24337, 24279, 24221, 24163, 24105, 24047, 23990, 23932, 23875, 23818, + 23761, 23704, 23647, 23590, 23534, 23477, 23421, 23365, 23309, 23253, 23197, + 23142, 23086, 23031, 22976, 22921, 22866, 22811, 22757, 22702, 22648, 22593, + 22539, 22485, 22431, 22378, 22324, 22271, 22217, 22164, 22111, 22058, 22005, + 21952, 21900, 21847, 21795, 21743, 21691, 21639, 21587, 21535, 21484, 21432, + 21381, 21330, 21278, 21227, 21177, 21126, 21075, 21025, 20974, 20924, 20874, + 20824, 20774, 20724, 20675, 24809, 24761, 24714, 24667, 24619, 24572, 24525, + 24478, 24431, 24384, 24337, 24291, 24244, 24198, 24151, 24105, 24059, 24013, + 23967, 23921, 23875, 23829, 23783, 23738, 23692, 23647, 23602, 23556, 23511, + 23466, 23421, 23376, 23331, 23287, 23242, 23197, 23153, 23109, 23064, 23020, + 22976, 22932, 22888, 22844, 22800, 22757, 22713, 22669, 22626, 22583, 22539, + 22496, 22453, 22410, 22367, 22324, 22281, 22239, 22196, 22153, 22111, 22069, + 22026, 21984, 21942, 21900, 21858, 21816, 21774, 21732, 21691, 21649, 21608, + 21566, 21525, 21484, 21442, 21401, 21360, 21319, 21278, 21238, 21197, 21156, + 21116, 21075, 21035, 20995, 20954, 20914, 20874, 20834, 20794, 20754, 20714, + 20675, 23704, 23670, 23636, 23602, 23568, 23534, 23500, 23466, 23432, 23399, + 23365, 23331, 23298, 23264, 23231, 23197, 23164, 23131, 23098, 23064, 23031, + 22998, 22965, 22932, 22899, 22866, 22833, 22800, 22768, 22735, 22702, 22669, + 22637, 22604, 22572, 22539, 22507, 22475, 22442, 22410, 22378, 22346, 22313, + 22281, 22249, 22217, 22185, 22153, 22122, 22090, 22058, 22026, 21995, 21963, + 21931, 21900, 21868, 21837, 21805, 21774, 21743, 21712, 21680, 21649, 21618, + 21587, 21556, 21525, 21494, 21463, 21432, 21401, 21371, 21340, 21309, 21278, + 21248, 21217, 21187, 21156, 21126, 21095, 21065, 21035, 21005, 20974, 20944, + 20914, 20884, 20854, 20824, 20794, 20764, 20734, 20704, 20675, 22648, 22626, + 22604, 22583, 22561, 22539, 22518, 22496, 22475, 22453, 22431, 22410, 22388, + 22367, 22346, 22324, 22303, 22281, 22260, 22239, 22217, 22196, 22175, 22153, + 22132, 22111, 22090, 22069, 22047, 22026, 22005, 21984, 21963, 21942, 21921, + 21900, 21879, 21858, 21837, 21816, 21795, 21774, 21753, 21732, 21712, 21691, + 21670, 21649, 21628, 21608, 21587, 21566, 21545, 21525, 21504, 21484, 21463, + 21442, 21422, 21401, 21381, 21360, 21340, 21319, 21299, 21278, 21258, 21238, + 21217, 21197, 21177, 21156, 21136, 21116, 21095, 21075, 21055, 21035, 21015, + 20995, 20974, 20954, 20934, 20914, 20894, 20874, 20854, 20834, 20814, 20794, + 20774, 20754, 20734, 20714, 20695, 20675, 21639, 21628, 21618, 21608, 21597, + 21587, 21577, 21566, 21556, 21545, 21535, 21525, 21515, 21504, 21494, 21484, + 21473, 21463, 21453, 21442, 21432, 21422, 21412, 21401, 21391, 21381, 21371, + 21360, 21350, 21340, 21330, 21319, 21309, 21299, 21289, 21278, 21268, 21258, + 21248, 21238, 21227, 21217, 21207, 21197, 21187, 21177, 21166, 21156, 21146, + 21136, 21126, 21116, 21106, 21095, 21085, 21075, 21065, 21055, 21045, 21035, + 21025, 21015, 21005, 20995, 20984, 20974, 20964, 20954, 20944, 20934, 20924, + 20914, 20904, 20894, 20884, 20874, 20864, 20854, 20844, 20834, 20824, 20814, + 20804, 20794, 20784, 20774, 20764, 20754, 20744, 20734, 20724, 20714, 20704, + 20695, 20685, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 31308, 31323, 31338, 31353, 31368, 31383, 31398, 31413, 31428, 31443, 31458, + 31473, 31488, 31504, 31519, 31534, 31549, 31564, 31579, 31594, 31609, 31625, + 31640, 31655, 31670, 31685, 31701, 31716, 31731, 31746, 31761, 31777, 31792, + 31807, 31822, 31838, 31853, 31868, 31884, 31899, 31914, 31930, 31945, 31960, + 31975, 31991, 32006, 32022, 32037, 32052, 32068, 32083, 32098, 32114, 32129, + 32145, 32160, 32176, 32191, 32206, 32222, 32237, 32253, 32268, 32284, 32299, + 32315, 32330, 32346, 32361, 32377, 32392, 32408, 32423, 32439, 32455, 32470, + 32486, 32501, 32517, 32532, 32548, 32564, 32579, 32595, 32611, 32626, 32642, + 32658, 32673, 32689, 32705, 32720, 32736, 32752, 32768, 29899, 29913, 29927, + 29942, 29956, 29970, 29985, 29999, 30014, 30028, 30042, 30057, 30071, 30086, + 30100, 30114, 30129, 30143, 30158, 30172, 30187, 30201, 30216, 30230, 30245, + 30259, 30274, 30288, 30303, 30317, 30332, 30346, 30361, 30376, 30390, 30405, + 30419, 30434, 30449, 30463, 30478, 30492, 30507, 30522, 30536, 30551, 30566, + 30580, 30595, 30610, 30624, 30639, 30654, 30668, 30683, 30698, 30713, 30727, + 30742, 30757, 30772, 30786, 30801, 30816, 30831, 30846, 30860, 30875, 30890, + 30905, 30920, 30934, 30949, 30964, 30979, 30994, 31009, 31024, 31038, 31053, + 31068, 31083, 31098, 31113, 31128, 31143, 31158, 31173, 31188, 31203, 31218, + 31233, 31248, 31263, 31278, 31293, 28553, 28567, 28580, 28594, 28608, 28621, + 28635, 28649, 28663, 28676, 28690, 28704, 28718, 28731, 28745, 28759, 28773, + 28787, 28800, 28814, 28828, 28842, 28856, 28870, 28884, 28897, 28911, 28925, + 28939, 28953, 28967, 28981, 28995, 29008, 29022, 29036, 29050, 29064, 29078, + 29092, 29106, 29120, 29134, 29148, 29162, 29176, 29190, 29204, 29218, 29232, + 29246, 29260, 29274, 29288, 29302, 29316, 29330, 29344, 29358, 29373, 29387, + 29401, 29415, 29429, 29443, 29457, 29471, 29485, 29500, 29514, 29528, 29542, + 29556, 29570, 29585, 29599, 29613, 29627, 29641, 29656, 29670, 29684, 29698, + 29713, 29727, 29741, 29755, 29770, 29784, 29798, 29813, 29827, 29841, 29856, + 29870, 29884, 27268, 27281, 27294, 27307, 27320, 27333, 27346, 27359, 27373, + 27386, 27399, 27412, 27425, 27438, 27451, 27465, 27478, 27491, 27504, 27517, + 27531, 27544, 27557, 27570, 27583, 27597, 27610, 27623, 27636, 27650, 27663, + 27676, 27690, 27703, 27716, 27729, 27743, 27756, 27769, 27783, 27796, 27809, + 27823, 27836, 27849, 27863, 27876, 27890, 27903, 27916, 27930, 27943, 27956, + 27970, 27983, 27997, 28010, 28024, 28037, 28051, 28064, 28077, 28091, 28104, + 28118, 28131, 28145, 28158, 28172, 28185, 28199, 28212, 28226, 28240, 28253, + 28267, 28280, 28294, 28307, 28321, 28335, 28348, 28362, 28375, 28389, 28403, + 28416, 28430, 28443, 28457, 28471, 28484, 28498, 28512, 28525, 28539, 26040, + 26053, 26065, 26078, 26090, 26103, 26116, 26128, 26141, 26153, 26166, 26178, + 26191, 26203, 26216, 26229, 26241, 26254, 26266, 26279, 26291, 26304, 26317, + 26329, 26342, 26355, 26367, 26380, 26393, 26405, 26418, 26431, 26443, 26456, + 26469, 26481, 26494, 26507, 26520, 26532, 26545, 26558, 26570, 26583, 26596, + 26609, 26621, 26634, 26647, 26660, 26673, 26685, 26698, 26711, 26724, 26737, + 26749, 26762, 26775, 26788, 26801, 26814, 26827, 26839, 26852, 26865, 26878, + 26891, 26904, 26917, 26930, 26943, 26956, 26969, 26981, 26994, 27007, 27020, + 27033, 27046, 27059, 27072, 27085, 27098, 27111, 27124, 27137, 27150, 27163, + 27176, 27189, 27202, 27215, 27229, 27242, 27255, 24868, 24880, 24892, 24904, + 24916, 24928, 24940, 24952, 24964, 24976, 24988, 25000, 25012, 25024, 25036, + 25048, 25060, 25072, 25084, 25096, 25108, 25120, 25132, 25144, 25156, 25168, + 25181, 25193, 25205, 25217, 25229, 25241, 25253, 25265, 25277, 25289, 25302, + 25314, 25326, 25338, 25350, 25362, 25375, 25387, 25399, 25411, 25423, 25435, + 25448, 25460, 25472, 25484, 25497, 25509, 25521, 25533, 25546, 25558, 25570, + 25582, 25595, 25607, 25619, 25631, 25644, 25656, 25668, 25681, 25693, 25705, + 25718, 25730, 25742, 25755, 25767, 25779, 25792, 25804, 25817, 25829, 25841, + 25854, 25866, 25879, 25891, 25903, 25916, 25928, 25941, 25953, 25966, 25978, + 25991, 26003, 26015, 26028, 23749, 23761, 23772, 23783, 23795, 23806, 23818, + 23829, 23840, 23852, 23863, 23875, 23886, 23898, 23909, 23921, 23932, 23944, + 23955, 23967, 23978, 23990, 24001, 24013, 24024, 24036, 24047, 24059, 24070, + 24082, 24093, 24105, 24117, 24128, 24140, 24151, 24163, 24174, 24186, 24198, + 24209, 24221, 24233, 24244, 24256, 24267, 24279, 24291, 24302, 24314, 24326, + 24337, 24349, 24361, 24372, 24384, 24396, 24407, 24419, 24431, 24443, 24454, + 24466, 24478, 24490, 24501, 24513, 24525, 24537, 24548, 24560, 24572, 24584, + 24596, 24607, 24619, 24631, 24643, 24655, 24666, 24678, 24690, 24702, 24714, + 24726, 24738, 24749, 24761, 24773, 24785, 24797, 24809, 24821, 24833, 24845, + 24857, 22680, 22691, 22702, 22713, 22724, 22735, 22746, 22757, 22767, 22778, + 22789, 22800, 22811, 22822, 22833, 22844, 22855, 22866, 22877, 22888, 22899, + 22910, 22921, 22932, 22943, 22954, 22965, 22976, 22987, 22998, 23009, 23020, + 23031, 23042, 23053, 23064, 23075, 23086, 23097, 23109, 23120, 23131, 23142, + 23153, 23164, 23175, 23186, 23197, 23209, 23220, 23231, 23242, 23253, 23264, + 23275, 23287, 23298, 23309, 23320, 23331, 23343, 23354, 23365, 23376, 23387, + 23399, 23410, 23421, 23432, 23444, 23455, 23466, 23477, 23489, 23500, 23511, + 23522, 23534, 23545, 23556, 23568, 23579, 23590, 23602, 23613, 23624, 23636, + 23647, 23658, 23670, 23681, 23692, 23704, 23715, 23726, 23738, 21659, 21670, + 21680, 21691, 21701, 21711, 21722, 21732, 21743, 21753, 21764, 21774, 21785, + 21795, 21805, 21816, 21826, 21837, 21847, 21858, 21868, 21879, 21889, 21900, + 21910, 21921, 21931, 21942, 21952, 21963, 21973, 21984, 21995, 22005, 22016, + 22026, 22037, 22047, 22058, 22069, 22079, 22090, 22100, 22111, 22122, 22132, + 22143, 22153, 22164, 22175, 22185, 22196, 22207, 22217, 22228, 22239, 22249, + 22260, 22271, 22281, 22292, 22303, 22313, 22324, 22335, 22345, 22356, 22367, + 22378, 22388, 22399, 22410, 22421, 22431, 22442, 22453, 22464, 22474, 22485, + 22496, 22507, 22518, 22528, 22539, 22550, 22561, 22572, 22583, 22593, 22604, + 22615, 22626, 22637, 22648, 22659, 22669, 20685, 20695, 20704, 20714, 20724, + 20734, 20744, 20754, 20764, 20774, 20784, 20794, 20804, 20814, 20824, 20834, + 20844, 20854, 20864, 20874, 20884, 20894, 20904, 20914, 20924, 20934, 20944, + 20954, 20964, 20974, 20984, 20995, 21005, 21015, 21025, 21035, 21045, 21055, + 21065, 21075, 21085, 21095, 21106, 21116, 21126, 21136, 21146, 21156, 21166, + 21177, 21187, 21197, 21207, 21217, 21227, 21238, 21248, 21258, 21268, 21278, + 21289, 21299, 21309, 21319, 21330, 21340, 21350, 21360, 21370, 21381, 21391, + 21401, 21412, 21422, 21432, 21442, 21453, 21463, 21473, 21484, 21494, 21504, + 21515, 21525, 21535, 21545, 21556, 21566, 21577, 21587, 21597, 21608, 21618, + 21628, 21639, 21649}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXOut.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXOut.c new file mode 100644 index 0000000000..0d84861b95 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXOut.c @@ -0,0 +1,347 @@ +#include +#include +#include +#include + +// Output uses a ring buffer +#define OUT_RING_MAX 3 +// Each remote output buffer contains 10 frames +// TODO: Not sure if these instances are actually "frames" +#define RMT_FRAME_MAX 10 + +// Form DSP mail for command list size +#define DSP_MAIL_CLSIZE(size) (0xBABE << 16 | (size)) +// DRAM image in DSP memory +// TODO: What does this represent? +#define DRAM_IMAGE_DSP_ADDR 0x0CD2 + +// Back again by popular demand! +#define FUNNY_COPY(dst, src, type, n) \ + do { \ + \ + type* __dst = (type*)dst; \ + type* __src = (type*)src; \ + int i; \ + \ + for (i = 0; i < n / sizeof(type); i++) { \ + *__dst = *__src; \ + __dst++; \ + __src++; \ + } \ + \ + } while (0) + +AXPROFILE __AXLocalProfile; + +static volatile u32 __AXOutFrame; +static u32 __AXAiDmaFrame; +static u32 __AXOutDspReady; +static AXOutCallback __AXUserFrameCallback; +static volatile BOOL __AXDSPInitFlag; +static volatile BOOL __AXDSPDoneFlag; +static BOOL __AXDebugSteppingMode; +static OSThreadQueue __AXOutThreadQueue; +static u32 __AXOutputBufferMode; +static s32 __AXRmtBuffLen; +static s32 __AXRmtDspPtr; +static s32 __AXRmtCpuPtr; +static AXExceedCallback __AXExceedCallback; + +static s16 __AXRmtOutBuffer[AX_RMT_MAX] + [AX_SAMPLES_PER_FRAME_RMT * RMT_FRAME_MAX] ALIGN(32); +// TODO: What is this number? +static u8 __AXOutSBuffer[768] ALIGN(32); +static u32 __AXOutBuffer[OUT_RING_MAX][AX_SAMPLES_PER_FRAME] ALIGN(32); + +static DSPTask __AXDSPTask ALIGN(32); +static u8 __AXDramImage[64] ALIGN(32); + +static void __AXDSPInitCallback(DSPTask* task); +static void __AXDSPResumeCallback(DSPTask* task); +static void __AXDSPDoneCallback(DSPTask* task); +static void __AXDSPRequestCallback(DSPTask* task); + +u32 __AXOutNewFrame(void) { + AXPROFILE* current; + u32 cycles; + void* list; + void* rmt[AX_RMT_MAX]; + s32 ptr; + + __AXLocalProfile.timeBegin = OSGetTime(); + + cycles = + (AX_SAMPLES_PER_FRAME - (AIGetDMABytesLeft() / AX_SAMPLE_DEPTH_BYTES)) * + 3797; + + if (__AXOutputBufferMode == 1) { + __AXSyncPBs(0); + } else { + __AXSyncPBs(24400); + } + + __AXPrintStudio(); + + list = __AXGetCommandListAddress(); + DSP_SEND_MAIL_SYNC(DSP_MAIL_CLSIZE(AX_CL_SIZE)); + DSP_SEND_MAIL_SYNC(list); + + __AXServiceCallbackStack(); + + __AXLocalProfile.timeProcessAuxBegin = OSGetTime(); + __AXProcessAux(); + __AXLocalProfile.timeProcessAuxEnd = OSGetTime(); + + __AXLocalProfile.timeUserFrameBegin = OSGetTime(); + if (__AXUserFrameCallback != NULL) { + __AXUserFrameCallback(); + } + __AXLocalProfile.timeUserFrameEnd = OSGetTime(); + + rmt[0] = &__AXRmtOutBuffer[0][__AXRmtDspPtr]; + rmt[1] = &__AXRmtOutBuffer[1][__AXRmtDspPtr]; + rmt[2] = &__AXRmtOutBuffer[2][__AXRmtDspPtr]; + rmt[3] = &__AXRmtOutBuffer[3][__AXRmtDspPtr]; + + ptr = __AXRmtDspPtr + AX_SAMPLES_PER_FRAME_RMT; + if (ptr >= __AXRmtBuffLen) { + ptr = 0; + } + + if (__AXRmtCpuPtr >= __AXRmtDspPtr && + __AXRmtCpuPtr < __AXRmtDspPtr + AX_SAMPLES_PER_FRAME_RMT) { + __AXRmtCpuPtr = ptr; + } + + __AXRmtDspPtr = ptr; + __AXNextFrame(__AXOutSBuffer, __AXOutBuffer[__AXOutFrame], rmt); + __AXOutFrame++; + + if (__AXOutputBufferMode == 1) { + __AXOutFrame %= OUT_RING_MAX; + } else { + __AXOutFrame &= 1; + AIInitDMA(__AXOutBuffer[__AXOutFrame], AX_FRAME_SIZE); + } + + __AXLocalProfile.timeEnd = OSGetTime(); + __AXLocalProfile.numVoices = __AXGetNumVoices(); + + current = __AXGetCurrentProfile(); + if (current != NULL) { + FUNNY_COPY(current, &__AXLocalProfile, u8, sizeof(AXPROFILE)); + } + + return cycles; +} + +void __AXOutAiCallback(void) { + u32 frame; + + if (__AXOutDspReady == 1) { + __AXOutDspReady = 0; + __AXOutNewFrame(); + } else { + __AXOutDspReady = 2; + DSPAssertTask(&__AXDSPTask); + } + + if (__AXOutputBufferMode == 1) { + AIInitDMA(__AXOutBuffer[__AXAiDmaFrame], AX_FRAME_SIZE); + + frame = __AXAiDmaFrame + 1; + frame %= OUT_RING_MAX; + + if (frame != __AXOutFrame) { + __AXAiDmaFrame = frame; + } + } +} + +static void __AXDSPInitCallback(DSPTask* task) { +#pragma unused(task) + + __AXDSPInitFlag = TRUE; +} + +static void __AXDSPResumeCallback(DSPTask* task) { +#pragma unused(task) + + u32 cycles; + + if (__AXOutDspReady == 2) { + __AXOutDspReady = 0; + + cycles = __AXOutNewFrame(); + + if (__AXExceedCallback != NULL) { + __AXExceedCallback(cycles); + } + + } else { + __AXOutDspReady = 1; + } +} + +static void __AXDSPDoneCallback(DSPTask* task) { +#pragma unused(task) + + __AXDSPDoneFlag = TRUE; + OSWakeupThread(&__AXOutThreadQueue); +} + +static void __AXDSPRequestCallback(DSPTask* task) { +#pragma unused(task) +} + +void __AXOutInitDSP(void) { + __AXDSPTask.iramMmemAddr = axDspSlave; + __AXDSPTask.iramMmemLen = axDspSlaveLength; + __AXDSPTask.iramDspAddr = NULL; + + __AXDSPTask.dramMmemAddr = __AXDramImage; + __AXDSPTask.dramMmemLen = sizeof(__AXDramImage); + __AXDSPTask.dramDspAddr = DRAM_IMAGE_DSP_ADDR; + + __AXDSPTask.startVector = axDspInitVector; + __AXDSPTask.resumeVector = axDspResumeVector; + + __AXDSPTask.initCallback = __AXDSPInitCallback; + __AXDSPTask.resumeCallback = __AXDSPResumeCallback; + __AXDSPTask.doneCallback = __AXDSPDoneCallback; + __AXDSPTask.requestCallback = __AXDSPRequestCallback; + + __AXDSPTask.prio = 0; + + __AXDSPInitFlag = FALSE; + __AXDSPDoneFlag = FALSE; + + OSInitThreadQueue(&__AXOutThreadQueue); + + if (!DSPCheckInit()) { + DSPInit(); + } + + DSPAddTask(&__AXDSPTask); + while (!__AXDSPInitFlag) { + ; + } +} + +void __AXOutInit(u32 mode) { + int i; + u32* dst; + u32* dst2; + void* rmt[AX_RMT_MAX]; + + __AXOutFrame = 0; + __AXAiDmaFrame = 0; + __AXOutputBufferMode = mode; + __AXDebugSteppingMode = 0; + + for (dst = (u32*)__AXOutBuffer, i = 0; + i < sizeof(__AXOutBuffer) / sizeof(u32); i++) { + *dst++ = 0; + } + DCFlushRange(__AXOutBuffer, sizeof(__AXOutBuffer)); + + for (dst2 = (u32*)__AXOutSBuffer, i = 0; + i < sizeof(__AXOutSBuffer) / sizeof(u32); i++) { + *dst2++ = 0; + } + DCFlushRange(__AXOutSBuffer, sizeof(__AXOutSBuffer)); + + for (dst2 = (u32*)__AXRmtOutBuffer, i = 0; + i < sizeof(__AXRmtOutBuffer) / sizeof(u32); i++) { + *dst2++ = 0; + } + DCFlushRange(__AXRmtOutBuffer, sizeof(__AXRmtOutBuffer)); + + __AXOutInitDSP(); + AIRegisterDMACallback(__AXOutAiCallback); + + rmt[0] = __AXRmtOutBuffer[0]; + rmt[1] = __AXRmtOutBuffer[1]; + rmt[2] = __AXRmtOutBuffer[2]; + rmt[3] = __AXRmtOutBuffer[3]; + + __AXRmtCpuPtr = AX_SAMPLES_PER_FRAME_RMT; + __AXRmtDspPtr = AX_SAMPLES_PER_FRAME_RMT; + __AXRmtBuffLen = AX_SAMPLES_PER_FRAME_RMT * RMT_FRAME_MAX; + + if (__AXOutputBufferMode == 1) { + __AXNextFrame(__AXOutSBuffer, __AXOutBuffer[2], rmt); + } else { + __AXNextFrame(__AXOutSBuffer, __AXOutBuffer[1], rmt); + } + + __AXOutDspReady = 1; + __AXUserFrameCallback = NULL; + + if (__AXOutputBufferMode == 1) { + AIInitDMA(__AXOutBuffer[__AXAiDmaFrame], AX_FRAME_SIZE); + __AXAiDmaFrame++; + } else { + AIInitDMA(__AXOutBuffer[__AXOutFrame], AX_FRAME_SIZE); + } + + AIStartDMA(); + __AXExceedCallback = NULL; +} + +AXOutCallback AXRegisterCallback(AXOutCallback callback) { + AXOutCallback old = __AXUserFrameCallback; + BOOL enabled = OSDisableInterrupts(); + + __AXUserFrameCallback = callback; + + OSRestoreInterrupts(enabled); + return old; +} + +s32 AXRmtGetSamplesLeft(void) { + s32 samples = __AXRmtDspPtr - (AX_SAMPLES_PER_FRAME_RMT * 2); + + if (samples < 0) { + samples += __AXRmtBuffLen; + } + + samples -= __AXRmtCpuPtr; + + if (samples < 0) { + samples += __AXRmtBuffLen; + } + + return samples; +} + +s32 AXRmtGetSamples(s32 chan, s16* out, s32 num) { + s32 avail = AXRmtGetSamplesLeft(); + s32 actual = num > avail ? avail : num; + s32 ptr = __AXRmtCpuPtr; + int i; + + for (i = 0; i < actual; i++) { + *out++ = __AXRmtOutBuffer[chan][ptr]; + + if (++ptr >= __AXRmtBuffLen) { + ptr = 0; + } + } + + DCInvalidateRange(__AXRmtOutBuffer[chan], __AXRmtBuffLen * sizeof(s16)); + return actual; +} + +s32 AXRmtAdvancePtr(s32 num) { + s32 avail = AXRmtGetSamplesLeft(); + s32 actual = num > avail ? avail : num; + + __AXRmtCpuPtr += actual; + + if (__AXRmtCpuPtr >= __AXRmtBuffLen) { + __AXRmtCpuPtr -= __AXRmtBuffLen; + } + + return actual; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXProf.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXProf.c new file mode 100644 index 0000000000..8c241edecf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXProf.c @@ -0,0 +1,19 @@ +#include + +static BOOL __AXProfileInitialized = FALSE; +static AXPROFILE* __AXProfile; +static u32 __AXMaxProfiles; +static u32 __AXCurrentProfile; + +AXPROFILE* __AXGetCurrentProfile(void) { + if (__AXProfileInitialized) { + AXPROFILE* prof = &__AXProfile[__AXCurrentProfile]; + + __AXCurrentProfile++; + __AXCurrentProfile %= __AXMaxProfiles; + + return prof; + } + + return NULL; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXSPB.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXSPB.c new file mode 100644 index 0000000000..c9012125ec --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXSPB.c @@ -0,0 +1,168 @@ +#include +#include + +#define DEPOP_MIN (-20) +#define DEPOP_MAX 20 + +static AXSTUDIO __AXStudio ALIGN(32); + +static s32 __AXSpbAux3 = 0; +static s32 __AXSpbAux2 = 0; +static s32 __AXSpbAux1 = 0; +static s32 __AXSpbAux0 = 0; + +static s32 __AXSpbMain3 = 0; +static s32 __AXSpbMain2 = 0; +static s32 __AXSpbMain1 = 0; +static s32 __AXSpbMain0 = 0; + +static s32 __AXSpbACS = 0; +static s32 __AXSpbACR = 0; +static s32 __AXSpbACL = 0; + +static s32 __AXSpbABS = 0; +static s32 __AXSpbABR = 0; +static s32 __AXSpbABL = 0; + +static s32 __AXSpbAAS = 0; +static s32 __AXSpbAAR = 0; +static s32 __AXSpbAAL = 0; + +static s32 __AXSpbAS = 0; +static s32 __AXSpbAR = 0; +static s32 __AXSpbAL = 0; + +AXSTUDIO* __AXGetStudio(void) { + return &__AXStudio; +} + +void __AXDepopFadeMain(s32* all, s32* value, s16* depop) { + if (*all / AX_SAMPLES_PER_FRAME != 0) { + // Average depop across the channel? + s32 avg = *all / AX_SAMPLES_PER_FRAME; + + if (avg > DEPOP_MAX) { + avg = DEPOP_MAX; + } + + if (avg < DEPOP_MIN) { + avg = DEPOP_MIN; + } + + *value = *all; + *all -= avg * AX_SAMPLES_PER_FRAME; + *depop = -avg; + } else { + *all = 0; + *value = 0; + *depop = 0; + } +} + +void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) { + if (*all / AX_SAMPLES_PER_FRAME_RMT != 0) { + // Average depop across the channel? + s32 avg = *all / AX_SAMPLES_PER_FRAME_RMT; + + if (avg > DEPOP_MAX) { + avg = DEPOP_MAX; + } + + if (avg < DEPOP_MIN) { + avg = DEPOP_MIN; + } + + *value = *all; + *all -= avg * AX_SAMPLES_PER_FRAME_RMT; + *depop = -avg; + } else { + *all = 0; + *value = 0; + *depop = 0; + } +} + +void __AXPrintStudio(void) { + __AXDepopFadeMain(&__AXSpbAL, &__AXStudio.L, &__AXStudio.dL); + __AXDepopFadeMain(&__AXSpbAR, &__AXStudio.R, &__AXStudio.dR); + __AXDepopFadeMain(&__AXSpbAS, &__AXStudio.S, &__AXStudio.dS); + + __AXDepopFadeMain(&__AXSpbAAL, &__AXStudio.AuxAL, &__AXStudio.dAuxAL); + __AXDepopFadeMain(&__AXSpbAAR, &__AXStudio.AuxAR, &__AXStudio.dAuxAR); + __AXDepopFadeMain(&__AXSpbAAS, &__AXStudio.AuxAS, &__AXStudio.dAuxAS); + + __AXDepopFadeMain(&__AXSpbABL, &__AXStudio.AuxBL, &__AXStudio.dAuxBL); + __AXDepopFadeMain(&__AXSpbABR, &__AXStudio.AuxBR, &__AXStudio.dAuxBR); + __AXDepopFadeMain(&__AXSpbABS, &__AXStudio.AuxBS, &__AXStudio.dAuxBS); + + __AXDepopFadeMain(&__AXSpbACL, &__AXStudio.AuxCL, &__AXStudio.dAuxCL); + __AXDepopFadeMain(&__AXSpbACR, &__AXStudio.AuxCR, &__AXStudio.dAuxCR); + __AXDepopFadeMain(&__AXSpbACS, &__AXStudio.AuxCS, &__AXStudio.dAuxCS); + + __AXDepopFadeRmt(&__AXSpbMain0, &__AXStudio.Main0, &__AXStudio.dMain0); + __AXDepopFadeRmt(&__AXSpbMain1, &__AXStudio.Main1, &__AXStudio.dMain1); + __AXDepopFadeRmt(&__AXSpbMain2, &__AXStudio.Main2, &__AXStudio.dMain2); + __AXDepopFadeRmt(&__AXSpbMain3, &__AXStudio.Main3, &__AXStudio.dMain3); + + __AXDepopFadeRmt(&__AXSpbAux0, &__AXStudio.Aux0, &__AXStudio.dAux0); + __AXDepopFadeRmt(&__AXSpbAux1, &__AXStudio.Aux1, &__AXStudio.dAux1); + __AXDepopFadeRmt(&__AXSpbAux2, &__AXStudio.Aux2, &__AXStudio.dAux2); + __AXDepopFadeRmt(&__AXSpbAux3, &__AXStudio.Aux3, &__AXStudio.dAux3); + + DCFlushRange(&__AXStudio, sizeof(AXSTUDIO)); +} + +void __AXSPBInit(void) { + __AXSpbAux3 = 0; + __AXSpbAux2 = 0; + __AXSpbAux1 = 0; + __AXSpbAux0 = 0; + + __AXSpbMain3 = 0; + __AXSpbMain2 = 0; + __AXSpbMain1 = 0; + __AXSpbMain0 = 0; + + __AXSpbACS = 0; + __AXSpbACR = 0; + __AXSpbACL = 0; + + __AXSpbABS = 0; + __AXSpbABR = 0; + __AXSpbABL = 0; + + __AXSpbAAS = 0; + __AXSpbAAR = 0; + __AXSpbAAL = 0; + + __AXSpbAS = 0; + __AXSpbAR = 0; + __AXSpbAL = 0; +} + +void __AXDepopVoice(AXPB* pb) { + __AXSpbAL += pb->dpop.aL; + __AXSpbAAL += pb->dpop.aAuxAL; + __AXSpbABL += pb->dpop.aAuxBL; + __AXSpbACL += pb->dpop.aAuxCL; + + __AXSpbAR += pb->dpop.aR; + __AXSpbAAR += pb->dpop.aAuxAR; + __AXSpbABR += pb->dpop.aAuxBR; + __AXSpbACR += pb->dpop.aAuxCR; + + __AXSpbAS += pb->dpop.aS; + __AXSpbAAS += pb->dpop.aAuxAS; + __AXSpbABS += pb->dpop.aAuxBS; + __AXSpbACS += pb->dpop.aAuxCS; + + __AXSpbMain0 += pb->rmtDpop.aMain0; + __AXSpbMain1 += pb->rmtDpop.aMain1; + __AXSpbMain2 += pb->rmtDpop.aMain2; + __AXSpbMain3 += pb->rmtDpop.aMain3; + + __AXSpbAux0 += pb->rmtDpop.aAux0; + __AXSpbAux1 += pb->rmtDpop.aAux1; + __AXSpbAux2 += pb->rmtDpop.aAux2; + __AXSpbAux3 += pb->rmtDpop.aAux3; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXVPB.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXVPB.c new file mode 100644 index 0000000000..237906d9be --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/AXVPB.c @@ -0,0 +1,536 @@ +#include +#include +#include +#include + +DECOMP_FORCELITERAL(AXVPB_c, 2.0f); + +/** + * It's really even worse than this: what appears to be manually unrolled + * copies. + * + * I hope that it's just some compiler pattern that I'm unaware of, but in the + * meantime I've managed to make a macro that still works. + * + * (If you compile for -O0 this will totally break functions) + */ +#define FUNNY_COPY(dst, src, type, n) \ + do { \ + \ + type* __dst = (type*)dst; \ + type* __src = (type*)src; \ + u16 i; \ + \ + for (i = 0; i < n / sizeof(type); i++) { \ + *__dst = *__src; \ + __dst++; \ + __src++; \ + } \ + \ + } while (0) + +#define ADDRHI(x) (((uintptr_t)x) >> 16 & 0xFFFF) +#define ADDRLO(x) (((uintptr_t)x) & 0xFFFF) + +typedef struct _AXITD { + u8 UNK_0x0[0x40]; +} AXITD; + +static AXPB* __AXPB = NULL; +static AXPB __s_AXPB[AX_VOICE_MAX] ALIGN(32); + +static AXITD* __AXITD = NULL; +static AXITD __s_AXITD[AX_VOICE_MAX] ALIGN(32); + +// Did they forget the alignment here? +static AXVPB* __AXVPB = NULL; +static AXVPB __s_AXVPB[AX_VOICE_MAX]; + +s32 __AXMaxVoices = 0; +static s32 __AXNumVoices = 0; + +static u32 __AXRecDspCycles = 0; +static u32 __AXMaxDspCycles = 0; + +static u32 __AXMixCycles[] = {2, 408, 408, 810, 1404, 1404, 1404, 1404, + 408, 816, 816, 1218, 1812, 1812, 1812, 1812, + 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111, + 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111}; + +static u32 __AXRmtMixCycles[] = {4, 86, 151, 151}; + +static void __AXVPBInitCommon(void); +static u32 __AXGetSrcCycles(u16 select, const AXPBSRC* src); + +s32 __AXGetNumVoices(void) { + return __AXNumVoices; +} + +void __AXServiceVPB(AXVPB* vpb) { + AXPB* dst; + AXPB* src; + u32 sync; + + __AXNumVoices++; + + dst = &__AXPB[vpb->index]; + src = &vpb->pb; + sync = vpb->sync; + + if (sync == 0) { + src->state = dst->state; + src->ve.currentVolume = dst->ve.currentVolume; + src->addr.currentAddressHi = dst->addr.currentAddressHi; + src->addr.currentAddressLo = dst->addr.currentAddressLo; + return; + } + + if (sync & AX_PBSYNC_ALL) { + memcpy(dst, src, sizeof(AXPB)); + return; + } + + if (sync & AX_PBSYNC_SELECT) { + dst->srcSelect = src->srcSelect; + dst->coefSelect = src->coefSelect; + } + + if (sync & AX_PBSYNC_MIXER_CTRL) { + dst->mixerCtrl = src->mixerCtrl; + } + + if (sync & AX_PBSYNC_STATE) { + dst->state = src->state; + } else { + src->state = dst->state; + } + + if (sync & AX_PBSYNC_TYPE) { + dst->type = src->type; + } + + if (sync & AX_PBSYNC_MIX) { + memcpy(&dst->mix, &src->mix, sizeof(AXPBMIX)); + } + + if (sync & AX_PBSYNC_ITD_SHIFT) { + dst->itd.targetShiftL = src->itd.targetShiftL; + dst->itd.targetShiftR = src->itd.targetShiftR; + } else if (sync & AX_PBSYNC_ITD) { + FUNNY_COPY(&dst->itd, &src->itd, u16, sizeof(AXPBITD)); + __memclr(vpb->itdBuffer, sizeof(AXITD)); + } + + if (sync & AX_PBSYNC_DPOP) { + memcpy(&dst->dpop, &src->dpop, sizeof(AXPBDPOP)); + } + + if (sync & AX_PBSYNC_VE_DELTA) { + src->ve.currentVolume = dst->ve.currentVolume; + dst->ve.currentDelta = src->ve.currentDelta; + } else if (sync & AX_PBSYNC_VE) { + dst->ve.currentVolume = src->ve.currentVolume; + dst->ve.currentDelta = src->ve.currentDelta; + } + + if (sync & (AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | AX_PBSYNC_END_ADDR | + AX_PBSYNC_CURR_ADDR)) { + if (sync & AX_PBSYNC_LOOP_FLAG) { + dst->addr.loopFlag = src->addr.loopFlag; + } + + if (sync & AX_PBSYNC_LOOP_ADDR) { + *(u32*)&dst->addr.loopAddressHi = *(u32*)&src->addr.loopAddressHi; + } + + if (sync & AX_PBSYNC_END_ADDR) { + *(u32*)&dst->addr.endAddressHi = *(u32*)&src->addr.endAddressHi; + } + + if (sync & AX_PBSYNC_CURR_ADDR) { + *(u32*)&dst->addr.currentAddressHi = + *(u32*)&src->addr.currentAddressHi; + } else { + *(u32*)&src->addr.currentAddressHi = + *(u32*)&dst->addr.currentAddressHi; + } + } else if (sync & AX_PBSYNC_ADDR) { + FUNNY_COPY(&dst->addr, &src->addr, u32, sizeof(AXPBADDR)); + } else { + src->addr.currentAddressHi = dst->addr.currentAddressHi; + src->addr.currentAddressLo = dst->addr.currentAddressLo; + } + + if (sync & AX_PBSYNC_ADPCM) { + FUNNY_COPY(&dst->adpcm, &src->adpcm, u32, sizeof(AXPBADPCM)); + } + + if (sync & AX_PBSYNC_SRC_RATIO) { + dst->src.ratioHi = src->src.ratioHi; + dst->src.ratioLo = src->src.ratioLo; + } else if (sync & AX_PBSYNC_SRC) { + FUNNY_COPY(&dst->src, &src->src, u16, sizeof(AXPBSRC)); + } + + if (sync & AX_PBSYNC_ADPCM_LOOP) { + FUNNY_COPY(&dst->adpcmLoop, &src->adpcmLoop, u16, + sizeof(AXPBADPCMLOOP)); + } + + if (sync & AX_PBSYNC_LPF_COEFS) { + dst->lpf.a0 = src->lpf.a0; + dst->lpf.b0 = src->lpf.b0; + } else if (sync & AX_PBSYNC_LPF) { + FUNNY_COPY(&dst->lpf, &src->lpf, u16, sizeof(AXPBLPF)); + } + + if (sync & AX_PBSYNC_BIQUAD_COEFS) { + dst->biquad.b0 = src->biquad.b0; + dst->biquad.b1 = src->biquad.b1; + dst->biquad.b2 = src->biquad.b2; + dst->biquad.a1 = src->biquad.a1; + dst->biquad.a2 = src->biquad.a2; + } else if (sync & AX_PBSYNC_BIQUAD) { + FUNNY_COPY(&dst->biquad, &src->biquad, u16, sizeof(AXPBBIQUAD)); + } + + if (sync & AX_PBSYNC_REMOTE) { + dst->remote = src->remote; + } + + if (sync & AX_PBSYNC_RMT_MIXER_CTRL) { + dst->rmtMixerCtrl = src->rmtMixerCtrl; + } + + if (sync & AX_PBSYNC_RMTMIX) { + memcpy(&dst->rmtMix, &src->rmtMix, sizeof(AXPBRMTMIX)); + } + + if (sync & AX_PBSYNC_RMTDPOP) { + memcpy(&dst->rmtDpop, &src->rmtDpop, sizeof(AXPBRMTDPOP)); + } + + if (sync & AX_PBSYNC_RMTSRC) { + memcpy(&dst->rmtSrc, &src->rmtSrc, sizeof(AXPBRMTSRC)); + } + + if (sync & AX_PBSYNC_RMTIIR_LPF_COEFS) { + dst->rmtIIR.lpf.a0 = src->rmtIIR.lpf.a0; + dst->rmtIIR.lpf.b0 = src->rmtIIR.lpf.b0; + } else if (sync & AX_PBSYNC_RMTIIR_BIQUAD_COEFS) { + dst->rmtIIR.biquad.b0 = src->rmtIIR.biquad.b0; + dst->rmtIIR.biquad.b1 = src->rmtIIR.biquad.b1; + dst->rmtIIR.biquad.b2 = src->rmtIIR.biquad.b2; + dst->rmtIIR.biquad.a1 = src->rmtIIR.biquad.a1; + dst->rmtIIR.biquad.a2 = src->rmtIIR.biquad.a2; + } else if (sync & AX_PBSYNC_RMTIIR) { + FUNNY_COPY(&dst->rmtIIR, &src->rmtIIR, u16, sizeof(AXPBRMTIIR)); + } +} + +void __AXDumpVPB(AXVPB* vpb) { + AXPB* pb = &__AXPB[vpb->index]; + + if (pb->state == AX_VOICE_RUN) { + __AXDepopVoice(pb); + } + + vpb->pb.state = AX_VOICE_STOP; + pb->state = AX_VOICE_STOP; + + __AXPushCallbackStack(vpb); +} + +void __AXSyncPBs(u32 baseCycles) { + u32 cycles; + u32 prio; + AXVPB* head; + + __AXNumVoices = 0; + + DCInvalidateRange(__AXPB, __AXMaxVoices * sizeof(AXPB)); + DCInvalidateRange(__AXITD, __AXMaxVoices * sizeof(AXITD)); + + cycles = 32 + __AXGetCommandListCycles() + __AXMaxVoices * 600 + baseCycles; + + for (prio = AX_PRIORITY_MAX; prio > AX_PRIORITY_FREE; prio--) { + for (head = __AXGetStackHead(prio); head != NULL; head = head->next) { + if (head->pb.itd.flag == 1) { + cycles += 129; + } + + if (head->depop) { + __AXDepopVoice(&__AXPB[head->index]); + } + + if (head->pb.state == AX_VOICE_RUN) { + cycles += 387; + + if (head->pb.lpf.on) { + cycles += 309; + } + + if (head->pb.biquad.on) { + cycles += 1024; + } + + if (head->pb.itd.flag == 1) { + cycles += 27; + } + + cycles += __AXGetSrcCycles(head->pb.srcSelect, &head->pb.src); + cycles += __AXMixCycles[head->pb.mixerCtrl >> 0 & 31] + + __AXMixCycles[head->pb.mixerCtrl >> 16 & 31] + + __AXMixCycles[head->pb.mixerCtrl >> 21 & 31] + + __AXMixCycles[head->pb.mixerCtrl >> 26 & 31]; + + if (head->pb.remote == TRUE) { + cycles += 613; + + if (head->pb.rmtIIR.lpf.on == AX_PB_LPF_ON) { + cycles += 118; + } else if (head->pb.rmtIIR.biquad.on == AX_PB_BIQUAD_ON) { + cycles += 834; + } + + cycles += + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 0 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 2 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 4 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 6 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 8 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 10 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 12 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 14 & 3]; + } + + if (__AXMaxDspCycles > cycles) { + __AXServiceVPB(head); + } else { + __AXDumpVPB(head); + } + + } else { + __AXServiceVPB(head); + } + + head->sync = 0; + head->depop = FALSE; + } + } + + __AXRecDspCycles = cycles; + + for (head = __AXGetStackHead(AX_PRIORITY_FREE); head != NULL; + head = head->next) { + if (head->depop) { + __AXDepopVoice(&__AXPB[head->index]); + } + + head->depop = FALSE; + __AXPB[head->index].state = AX_VOICE_STOP; + } + + DCFlushRange(__AXPB, __AXMaxVoices * sizeof(AXPB)); + DCFlushRange(__AXITD, __AXMaxVoices * sizeof(AXITD)); +} + +AXPB* __AXGetPBs(void) { + return __AXPB; +} + +void __AXSetPBDefault(AXVPB* vpb) { + vpb->pb.state = AX_VOICE_STOP; + vpb->pb.itd.flag = 0; + vpb->sync = AX_PBSYNC_STATE | AX_PBSYNC_ITD | AX_PBSYNC_LPF | + AX_PBSYNC_BIQUAD | AX_PBSYNC_REMOTE | AX_PBSYNC_RMTSRC | + AX_PBSYNC_RMTIIR; + vpb->pb.lpf.on = 0; + vpb->pb.biquad.on = 0; + vpb->pb.remote = 0; + vpb->pb.rmtIIR.lpf.on = 0; + vpb->pb.rmtSrc.currentAddressFrac = 0; + vpb->pb.rmtSrc.last_samples[0] = 0; + vpb->pb.rmtSrc.last_samples[1] = 0; + vpb->pb.rmtSrc.last_samples[2] = 0; + vpb->pb.rmtSrc.last_samples[3] = 0; +} + +void __AXVPBInit(void) { + __AXMaxVoices = AX_VOICE_MAX; + + __AXPB = __s_AXPB; + __AXITD = __s_AXITD; + __AXVPB = __s_AXVPB; + + __AXVPBInitCommon(); +} + +static void __AXVPBInitCommon(void) { + u32 i; + u32* dst; + + __AXMaxDspCycles = OS_BUS_CLOCK_SPEED / 667; + __AXRecDspCycles = 0; + + for (dst = (u32*)__AXPB, i = __AXMaxVoices * (sizeof(AXPB) / sizeof(u32)); + i > 0; i--) { + *dst++ = 0; + } + + for (dst = (u32*)__AXITD, i = __AXMaxVoices * (sizeof(AXITD) / sizeof(u32)); + i > 0; i--) { + *dst++ = 0; + } + + for (dst = (u32*)__AXVPB, i = __AXMaxVoices * (sizeof(AXVPB) / sizeof(u32)); + i > 0; i--) { + *dst++ = 0; + } + + for (i = 0; i < __AXMaxVoices; i++) { + AXPB* pb = &__AXPB[i]; + AXITD* itd = &__AXITD[i]; + AXVPB* vpb = &__AXVPB[i]; + + vpb->index = i; + vpb->itdBuffer = itd; + __AXSetPBDefault(vpb); + + if (i == __AXMaxVoices - 1) { + pb->nextHi = pb->nextLo = 0; + vpb->pb.nextHi = vpb->pb.nextLo = 0; + } else { + vpb->pb.nextHi = ADDRHI((uintptr_t)pb + 320); + vpb->pb.nextLo = ADDRLO((uintptr_t)pb + 320); + + pb->nextHi = ADDRHI((uintptr_t)pb + 320); + pb->nextLo = ADDRLO((uintptr_t)pb + 320); + } + + vpb->pb.currHi = ADDRHI(pb); + vpb->pb.currLo = ADDRLO(pb); + + pb->currHi = ADDRHI(pb); + pb->currLo = ADDRLO(pb); + + vpb->pb.itd.bufferHi = ADDRHI(itd); + vpb->pb.itd.bufferLo = ADDRLO(itd); + + pb->itd.bufferHi = ADDRHI(itd); + pb->itd.bufferLo = ADDRLO(itd); + + vpb->priority = AX_PRIORITY_MIN; + __AXPushFreeStack(vpb); + } + + DCFlushRange(__AXPB, __AXMaxVoices * sizeof(AXPB)); +} + +void AXSetVoiceState(AXVPB* vpb, u16 state) { + BOOL enabled = OSDisableInterrupts(); + + if (vpb->pb.state == state) { + OSRestoreInterrupts(enabled); + return; + } + + vpb->pb.state = state; + vpb->sync |= AX_PBSYNC_STATE; + + if (state == AX_VOICE_STOP) { + vpb->depop = TRUE; + } + + OSRestoreInterrupts(enabled); +} + +void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr) { + BOOL enabled = OSDisableInterrupts(); + + u32* dst = (u32*)&vpb->pb.addr; + const u32* src = (u32*)addr; + + // :( + *dst = *src; + dst++; + src++; + + *dst = *src; + dst++; + src++; + + *dst = *src; + dst++; + src++; + + *dst = *src; + + switch (addr->format) { + case AX_SAMPLE_FORMAT_PCM_S16: + dst++; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0x08000000; + *dst = 0; + break; + case AX_SAMPLE_FORMAT_PCM_S8: + dst++; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0; + *dst++ = 0x01000000; + *dst = 0; + break; + case AX_SAMPLE_FORMAT_DSP_ADPCM: + default: + break; + } + + vpb->sync &= ~(AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | + AX_PBSYNC_END_ADDR | AX_PBSYNC_CURR_ADDR); + vpb->sync |= AX_PBSYNC_ADDR | AX_PBSYNC_ADPCM; + + OSRestoreInterrupts(enabled); +} + +void AXGetLpfCoefs(u16 freq, u16* a, u16* b) { + f32 rf31 = 2.0f - cosf(2 * M_PI * freq / AX_SAMPLE_RATE); + f32 rf30 = sqrtf(rf31 * rf31 - 1.0f) - rf31; + + *b = 32768 * -rf30; + *a = 32767 - *b; +} + +void AXSetMaxDspCycles(u32 num) { + __AXMaxDspCycles = num; +} + +static u32 __AXGetSrcCycles(u16 select, const AXPBSRC* src) { + u32 ratio = src->ratioHi << 16 | src->ratioLo; + + if (select == 0) { + return (ratio * 512 + 32768) / 65536 + 1561; + } + + if (select == 1) { + return (ratio * 512 + 32768) / 65536 + 1466; + } + + return 605; +} + +s32 AXGetMaxVoices(void) { + return __AXMaxVoices; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/DSPCode.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/DSPCode.c new file mode 100644 index 0000000000..7408f4609d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AX/DSPCode.c @@ -0,0 +1,690 @@ +#include + +u8 axDspSlave[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x9F, 0x0F, 0x3C, 0x02, 0x9F, 0x0F, 0x48, + 0x02, 0x9F, 0x0F, 0x4D, 0x02, 0x9F, 0x0F, 0x5C, 0x02, 0x9F, 0x0F, 0x61, + 0x02, 0x9F, 0x0F, 0x8D, 0x02, 0x9F, 0x0F, 0x92, 0x13, 0x02, 0x13, 0x03, + 0x12, 0x04, 0x13, 0x05, 0x13, 0x06, 0x8E, 0x00, 0x8C, 0x00, 0x8B, 0x00, + 0x00, 0x92, 0x00, 0xFF, 0x00, 0x9E, 0x80, 0x00, 0x00, 0xFE, 0x0C, 0xE5, + 0x00, 0x9E, 0x80, 0x00, 0x00, 0xFE, 0x0C, 0xE6, 0x00, 0xFE, 0x0C, 0xE7, + 0x00, 0xFE, 0x0C, 0xE8, 0x81, 0x00, 0x00, 0xFE, 0x0C, 0xE9, 0x89, 0x00, + 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, + 0x26, 0xFC, 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x30, 0x02, 0x9F, + 0x00, 0x4C, 0x13, 0x02, 0x13, 0x03, 0x12, 0x04, 0x13, 0x05, 0x13, 0x06, + 0x8E, 0x00, 0x8C, 0x00, 0x8B, 0x00, 0x00, 0x92, 0x00, 0xFF, 0x16, 0xFC, + 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x01, 0x16, 0xFB, 0x00, 0x01, 0x26, 0xFC, + 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x47, 0x8E, 0x00, 0x81, 0x00, + 0x89, 0x00, 0x00, 0x9F, 0xBA, 0xBE, 0x26, 0xFE, 0x02, 0xC0, 0x80, 0x00, + 0x02, 0x9C, 0x00, 0x51, 0x82, 0x00, 0x02, 0x94, 0x00, 0x51, 0x23, 0xFF, + 0x81, 0x00, 0x26, 0xFE, 0x02, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x5B, + 0x27, 0xFF, 0x02, 0x40, 0x7F, 0xFF, 0x2E, 0xCE, 0x2F, 0xCF, 0x16, 0xCD, + 0x0C, 0x00, 0x81, 0x00, 0x2E, 0xC9, 0x1F, 0xFB, 0x2F, 0xCB, 0x02, 0xBF, + 0x00, 0x84, 0x00, 0x80, 0x0C, 0x00, 0x8E, 0x00, 0x81, 0x00, 0x89, 0x70, + 0xB1, 0x00, 0x02, 0x91, 0x00, 0x80, 0x0A, 0x0E, 0xC1, 0x00, 0x02, 0x92, + 0x00, 0x80, 0x00, 0x9F, 0x0D, 0x04, 0x4C, 0x00, 0x1C, 0x7E, 0x02, 0x13, + 0x1C, 0x7E, 0x17, 0x6F, 0x16, 0xFC, 0xBA, 0xAD, 0x2E, 0xFD, 0x00, 0x21, + 0x26, 0xC9, 0x02, 0xA0, 0x00, 0x04, 0x02, 0x9C, 0x00, 0x84, 0x02, 0xDF, + 0x81, 0x00, 0x89, 0x70, 0x8E, 0x78, 0x2E, 0xCE, 0x2F, 0xCF, 0x16, 0xCD, + 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x00, 0x78, 0x00, 0x81, + 0x0D, 0x08, 0x00, 0x82, 0x00, 0x00, 0x00, 0x9B, 0x00, 0x5F, 0x00, 0x9A, + 0x00, 0xC0, 0x81, 0x00, 0x89, 0x00, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x84, + 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x00, 0xAB, 0x00, 0x5A, + 0x1B, 0x5E, 0x02, 0x9F, 0x00, 0xB3, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x7B, 0x00, 0xB2, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, + 0x00, 0xC0, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x00, 0xBE, + 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x00, 0xC6, 0x99, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x7B, 0x00, 0xC5, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x82, 0x01, 0x80, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, + 0x00, 0xD1, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x00, 0xD9, 0x99, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x00, 0xD8, 0x4C, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x82, 0x04, 0x00, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, + 0x02, 0x94, 0x00, 0xE4, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x00, 0xEC, + 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x00, 0xEB, 0x4C, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x04, 0xC0, 0x19, 0x3E, 0x19, 0x3C, + 0xB1, 0x79, 0x02, 0x94, 0x00, 0xF7, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, + 0x00, 0xFF, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x00, 0xFE, + 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x05, 0x80, 0x19, 0x3E, + 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0x0A, 0x00, 0x5A, 0x1B, 0x5E, + 0x02, 0x9F, 0x01, 0x12, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, + 0x01, 0x11, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x06, 0x40, + 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0x1D, 0x00, 0x5A, + 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0x25, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x7B, 0x01, 0x24, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, + 0x07, 0x00, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0x30, + 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0x38, 0x99, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0x37, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x82, 0x07, 0xC0, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, + 0x01, 0x43, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0x4B, 0x99, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0x4A, 0x4C, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x82, 0x08, 0x80, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, + 0x02, 0x94, 0x01, 0x56, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0x5E, + 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0x5D, 0x4C, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x09, 0x40, 0x19, 0x3E, 0x19, 0x3C, + 0xB1, 0x79, 0x02, 0x94, 0x01, 0x69, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, + 0x01, 0x71, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0x70, + 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x0A, 0x00, 0x19, 0x3E, + 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0x7C, 0x00, 0x5A, 0x1B, 0x5E, + 0x02, 0x9F, 0x01, 0x84, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, + 0x01, 0x83, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x9B, 0x00, 0x11, + 0x00, 0x9A, 0x00, 0x24, 0x00, 0x82, 0x02, 0x40, 0x19, 0x3E, 0x19, 0x3C, + 0xB1, 0x79, 0x02, 0x94, 0x01, 0x93, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, + 0x01, 0x9B, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0x9A, + 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x0A, 0xC0, 0x19, 0x3E, + 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0xA6, 0x00, 0x5A, 0x1B, 0x5E, + 0x02, 0x9F, 0x01, 0xAE, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, + 0x01, 0xAD, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x02, 0x64, + 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0xB9, 0x00, 0x5A, + 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0xC1, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x7B, 0x01, 0xC0, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, + 0x0A, 0xE4, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x01, 0xCC, + 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0xD4, 0x99, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0xD3, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, + 0x00, 0x82, 0x02, 0x88, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, + 0x01, 0xDF, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0xE7, 0x99, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0xE6, 0x4C, 0x00, 0x1B, 0x5E, + 0x1B, 0x5C, 0x00, 0x82, 0x0B, 0x08, 0x19, 0x3E, 0x19, 0x3C, 0xB1, 0x79, + 0x02, 0x94, 0x01, 0xF2, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, 0x01, 0xFA, + 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x01, 0xF9, 0x4C, 0x00, + 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x02, 0xAC, 0x19, 0x3E, 0x19, 0x3C, + 0xB1, 0x79, 0x02, 0x94, 0x02, 0x05, 0x00, 0x5A, 0x1B, 0x5E, 0x02, 0x9F, + 0x02, 0x0D, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, 0x02, 0x0C, + 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x82, 0x0B, 0x2C, 0x19, 0x3E, + 0x19, 0x3C, 0xB1, 0x79, 0x02, 0x94, 0x02, 0x18, 0x00, 0x5A, 0x1B, 0x5E, + 0x02, 0x9F, 0x02, 0x20, 0x99, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x00, 0x7B, + 0x02, 0x1F, 0x4C, 0x00, 0x1B, 0x5E, 0x1B, 0x5C, 0x02, 0x9F, 0x00, 0x6F, + 0x81, 0x00, 0x89, 0x70, 0x8E, 0x60, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, + 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x01, 0x80, 0x1C, 0xC0, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x83, 0x00, 0xC0, 0x00, 0x81, 0x0D, 0x08, + 0x00, 0x84, 0xFF, 0xFF, 0x1C, 0xE4, 0x02, 0xBF, 0x00, 0x84, 0x8F, 0x00, + 0x80, 0xF1, 0x80, 0xC9, 0x68, 0x00, 0x4A, 0x00, 0x19, 0x1B, 0x69, 0x94, + 0x4B, 0x23, 0x11, 0x5F, 0x02, 0x49, 0x80, 0xF1, 0x80, 0xC9, 0x68, 0x38, + 0x4A, 0x28, 0x19, 0x1B, 0x69, 0x94, 0x4B, 0x23, 0x1B, 0x1F, 0x1B, 0x1D, + 0x1C, 0x06, 0x02, 0x9F, 0x00, 0x6F, 0x81, 0x00, 0x89, 0x70, 0x8E, 0x60, + 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, + 0x16, 0xCB, 0x01, 0x80, 0x1C, 0xC0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x83, + 0x00, 0xC0, 0x00, 0x81, 0x0D, 0x08, 0x00, 0x84, 0xFF, 0xFF, 0x1C, 0xE4, + 0x02, 0xBF, 0x00, 0x84, 0x8F, 0x00, 0x80, 0xF1, 0x80, 0xC9, 0x68, 0x00, + 0x4A, 0x00, 0x19, 0x1B, 0x69, 0x94, 0x7D, 0x00, 0x4B, 0x23, 0x11, 0x5F, + 0x02, 0x78, 0x80, 0xF1, 0x80, 0xC9, 0x68, 0x38, 0x4A, 0x28, 0x19, 0x1B, + 0x69, 0x94, 0x7D, 0x00, 0x4B, 0x23, 0x1B, 0x1F, 0x1B, 0x1D, 0x1C, 0x06, + 0x02, 0x9F, 0x00, 0x6F, 0x81, 0x00, 0x89, 0x70, 0x8E, 0x60, 0x00, 0xE0, + 0x0C, 0xD2, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, 0x02, 0xD0, 0x16, 0xC9, + 0x00, 0x00, 0x16, 0xCB, 0x01, 0x40, 0x02, 0xBF, 0x00, 0x84, 0x81, 0x00, + 0x89, 0x00, 0x00, 0xDE, 0x02, 0xD4, 0x00, 0x9F, 0x0D, 0xB7, 0x4C, 0x00, + 0x1C, 0x7E, 0x02, 0x13, 0x00, 0xFE, 0x0C, 0xDF, 0x00, 0xDE, 0x02, 0xD5, + 0x00, 0x9F, 0x0D, 0xBA, 0x4C, 0x00, 0x1C, 0x7E, 0x02, 0x13, 0x00, 0xFE, + 0x0C, 0xE0, 0x00, 0x9A, 0x00, 0x1F, 0x00, 0xDE, 0x02, 0xD7, 0x00, 0x9F, + 0x0D, 0x13, 0x34, 0x00, 0x4C, 0x00, 0x1C, 0x7E, 0x02, 0x13, 0x00, 0xFE, + 0x0C, 0xD3, 0x00, 0xDE, 0x02, 0xD6, 0x00, 0x9F, 0x0D, 0x33, 0x34, 0x00, + 0x4C, 0x00, 0x1C, 0x7E, 0x02, 0x13, 0x00, 0xFE, 0x0C, 0xD4, 0x00, 0xDE, + 0x02, 0xD6, 0x00, 0x9F, 0x0D, 0x53, 0x14, 0xFB, 0x34, 0x00, 0x4C, 0x00, + 0x1C, 0x7E, 0x02, 0x13, 0x00, 0xFE, 0x0C, 0xD5, 0x00, 0xDE, 0x02, 0xD6, + 0x00, 0x9F, 0x0D, 0x73, 0x14, 0xF6, 0x4C, 0x00, 0x1C, 0x7E, 0x02, 0x13, + 0x00, 0xFE, 0x0C, 0xD6, 0x81, 0x00, 0x00, 0xDE, 0x03, 0x3C, 0x00, 0x9A, + 0x00, 0x03, 0x00, 0x9B, 0x0D, 0xB3, 0x1F, 0xFE, 0x35, 0x00, 0x47, 0x00, + 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xD7, 0x14, 0x7E, 0x1F, 0xFE, + 0x35, 0x00, 0x47, 0x00, 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xD8, + 0x14, 0x7E, 0x1F, 0xFE, 0x35, 0x00, 0x47, 0x00, 0x1C, 0x7F, 0x03, 0x13, + 0x00, 0xFF, 0x0C, 0xD9, 0x14, 0x7E, 0x1F, 0xFE, 0x35, 0x00, 0x47, 0x00, + 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xDA, 0x14, 0x7E, 0x1F, 0xFE, + 0x35, 0x00, 0x47, 0x00, 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xDB, + 0x14, 0x7E, 0x1F, 0xFE, 0x35, 0x00, 0x47, 0x00, 0x1C, 0x7F, 0x03, 0x13, + 0x00, 0xFF, 0x0C, 0xDC, 0x14, 0x7E, 0x1F, 0xFE, 0x35, 0x00, 0x47, 0x00, + 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xDD, 0x14, 0x7E, 0x1F, 0xFE, + 0x35, 0x00, 0x47, 0x00, 0x1C, 0x7F, 0x03, 0x13, 0x00, 0xFF, 0x0C, 0xDE, + 0x81, 0x00, 0x00, 0xDE, 0x02, 0xF2, 0xB1, 0x00, 0x02, 0x95, 0x03, 0x39, + 0x89, 0x00, 0x00, 0xDF, 0x02, 0xF5, 0x03, 0x00, 0x0C, 0x40, 0x00, 0xFF, + 0x0C, 0xE2, 0x00, 0xDF, 0x02, 0xF6, 0x03, 0x00, 0x0C, 0x40, 0x00, 0xFF, + 0x0C, 0xE3, 0x00, 0x9F, 0x0C, 0x60, 0x00, 0xFF, 0x0C, 0xE1, 0x00, 0xDE, + 0x02, 0xF3, 0x2E, 0xCE, 0x00, 0xDE, 0x02, 0xF4, 0x2E, 0xCF, 0x16, 0xCD, + 0x0C, 0x40, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x00, 0x40, 0x02, 0xBF, + 0x00, 0x84, 0x02, 0x9F, 0x03, 0x41, 0x00, 0x9F, 0x0C, 0x60, 0x00, 0xFF, + 0x0C, 0xE2, 0x00, 0xFF, 0x0C, 0xE3, 0x00, 0xFF, 0x0C, 0xE1, 0x8C, 0x00, + 0x8B, 0x00, 0x81, 0x00, 0x00, 0xDE, 0x02, 0xD8, 0x06, 0x01, 0x02, 0x94, + 0x04, 0x6A, 0x00, 0xC3, 0x0C, 0xDF, 0x17, 0x7F, 0x8A, 0x00, 0x81, 0x00, + 0x89, 0x00, 0x00, 0xDE, 0x03, 0x06, 0x00, 0xDF, 0x03, 0x05, 0x1F, 0x1F, + 0x4D, 0x00, 0x14, 0x81, 0x8D, 0x1E, 0x1F, 0xD8, 0x00, 0x98, 0x80, 0x00, + 0x00, 0x80, 0x0D, 0x08, 0xA8, 0x30, 0x11, 0x2F, 0x03, 0x60, 0xAC, 0x38, + 0xAD, 0x30, 0xAC, 0x38, 0x00, 0xFE, 0x03, 0x05, 0x8F, 0x00, 0x00, 0x80, + 0x0D, 0x08, 0x00, 0xC1, 0x0C, 0xE1, 0x1C, 0x61, 0x19, 0x3A, 0x19, 0x19, + 0xB0, 0x51, 0x19, 0x19, 0x11, 0x5E, 0x03, 0x71, 0xB6, 0x51, 0x80, 0x90, + 0xB6, 0x00, 0x6E, 0x33, 0x1B, 0x7E, 0x00, 0xDE, 0x03, 0x2D, 0xB1, 0x00, + 0x02, 0x95, 0x03, 0x81, 0x00, 0xC0, 0x0C, 0xE1, 0x1C, 0x20, 0x00, 0x83, + 0x03, 0x2E, 0x02, 0xBF, 0x06, 0xAB, 0x00, 0xDE, 0x03, 0x31, 0xB1, 0x00, + 0x02, 0x95, 0x03, 0x8D, 0x00, 0x80, 0x03, 0x32, 0x00, 0xC1, 0x0C, 0xE1, + 0x1C, 0x41, 0x02, 0xBF, 0x06, 0xC3, 0x00, 0x80, 0x02, 0xF9, 0x81, 0x00, + 0x10, 0x0C, 0x1B, 0x1E, 0x00, 0x80, 0x03, 0x4D, 0x10, 0x08, 0x1B, 0x1E, + 0x00, 0xC3, 0x0C, 0xD3, 0x17, 0x7F, 0x00, 0xC3, 0x0C, 0xD4, 0x17, 0x7F, + 0x00, 0xC3, 0x0C, 0xD5, 0x17, 0x7F, 0x00, 0xC3, 0x0C, 0xD6, 0x17, 0x7F, + 0x00, 0xDE, 0x03, 0x3B, 0xB1, 0x00, 0x02, 0x95, 0x04, 0x47, 0x00, 0xDE, + 0x03, 0x5A, 0xB1, 0x00, 0x02, 0x95, 0x03, 0xC4, 0x0A, 0x02, 0xC1, 0x00, + 0x02, 0x94, 0x03, 0xBA, 0x00, 0x80, 0x03, 0x5B, 0x00, 0xC1, 0x0C, 0xE1, + 0x00, 0x82, 0x0D, 0x0C, 0x02, 0xBF, 0x06, 0xC3, 0x02, 0x9F, 0x03, 0xCC, + 0x00, 0x80, 0x0D, 0x0C, 0x00, 0xC1, 0x0C, 0xE1, 0x00, 0x83, 0x03, 0x5B, + 0x02, 0xBF, 0x06, 0xAB, 0x02, 0x9F, 0x03, 0xCC, 0x00, 0x80, 0x0D, 0x0C, + 0x00, 0xC1, 0x0C, 0xE1, 0x11, 0x60, 0x03, 0xCB, 0x19, 0x3F, 0x1B, 0x1F, + 0x00, 0x82, 0x03, 0x55, 0x8C, 0x00, 0x81, 0x00, 0x19, 0x5C, 0x00, 0x9B, + 0x00, 0x05, 0x00, 0x99, 0x55, 0x55, 0x00, 0x80, 0x0D, 0x08, 0x11, 0x04, + 0x03, 0xDA, 0x19, 0x5F, 0x1B, 0x1F, 0x00, 0x81, 0x0C, 0xC0, 0x00, 0x84, + 0x0D, 0x08, 0x00, 0x87, 0x10, 0x00, 0x11, 0x12, 0x03, 0xF2, 0x4A, 0x00, + 0x1C, 0x1E, 0x00, 0x10, 0x89, 0x00, 0x1F, 0xBC, 0x15, 0x77, 0x15, 0x12, + 0x1C, 0x7F, 0x00, 0x1F, 0x80, 0xC3, 0x90, 0xC3, 0x97, 0xC3, 0x95, 0xC3, + 0x95, 0x00, 0x4F, 0x00, 0x1B, 0x3F, 0x00, 0x04, 0x00, 0x06, 0x18, 0x9F, + 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, + 0x1A, 0xDF, 0x1A, 0xDC, 0x8D, 0x00, 0x00, 0x81, 0x03, 0x3D, 0x00, 0x82, + 0x02, 0x40, 0x00, 0xC3, 0x0C, 0xD7, 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x4D, + 0x00, 0x81, 0x03, 0x3F, 0x00, 0x82, 0x0A, 0xC0, 0x00, 0xC3, 0x0C, 0xD8, + 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x51, 0x00, 0x81, 0x03, 0x41, 0x00, 0x82, + 0x02, 0x64, 0x00, 0xC3, 0x0C, 0xD9, 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x4E, + 0x00, 0x81, 0x03, 0x43, 0x00, 0x82, 0x0A, 0xE4, 0x00, 0xC3, 0x0C, 0xDA, + 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x52, 0x00, 0x81, 0x03, 0x45, 0x00, 0x82, + 0x02, 0x88, 0x00, 0xC3, 0x0C, 0xDB, 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x4F, + 0x00, 0x81, 0x03, 0x47, 0x00, 0x82, 0x0B, 0x08, 0x00, 0xC3, 0x0C, 0xDC, + 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x53, 0x00, 0x81, 0x03, 0x49, 0x00, 0x82, + 0x02, 0xAC, 0x00, 0xC3, 0x0C, 0xDD, 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x50, + 0x00, 0x81, 0x03, 0x4B, 0x00, 0x82, 0x0B, 0x2C, 0x00, 0xC3, 0x0C, 0xDE, + 0x17, 0x7F, 0x00, 0xF8, 0x03, 0x54, 0x00, 0xDE, 0x02, 0xF2, 0xB1, 0x00, + 0x02, 0x95, 0x04, 0x6A, 0x00, 0xDE, 0x02, 0xF5, 0x00, 0xDF, 0x02, 0xF7, + 0x82, 0x00, 0x02, 0x93, 0x04, 0x56, 0x78, 0x00, 0x02, 0x9F, 0x04, 0x59, + 0x02, 0x95, 0x04, 0x59, 0x74, 0x00, 0x00, 0xFE, 0x02, 0xF5, 0x00, 0xDE, + 0x02, 0xF6, 0x00, 0xDF, 0x02, 0xF8, 0x82, 0x00, 0x02, 0x93, 0x04, 0x65, + 0x78, 0x00, 0x02, 0x9F, 0x04, 0x68, 0x02, 0x95, 0x04, 0x68, 0x74, 0x00, + 0x00, 0xFE, 0x02, 0xF6, 0x8E, 0x00, 0x81, 0x00, 0x00, 0xDE, 0x02, 0xF2, + 0xB1, 0x00, 0x02, 0x95, 0x04, 0x7F, 0x00, 0xDE, 0x02, 0xF3, 0x00, 0xDC, + 0x02, 0xF4, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, 0x0C, 0xA0, 0x16, 0xC9, + 0x00, 0x01, 0x16, 0xCB, 0x00, 0x40, 0x02, 0xBF, 0x00, 0x84, 0x81, 0x00, + 0x89, 0x00, 0x00, 0xDE, 0x02, 0xD2, 0x00, 0xDF, 0x02, 0xD3, 0x2E, 0xCE, + 0x2F, 0xCF, 0x16, 0xCD, 0x02, 0xD0, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, + 0x01, 0x40, 0x02, 0xBF, 0x00, 0x84, 0x81, 0x00, 0x00, 0xDE, 0x02, 0xD0, + 0x00, 0xDC, 0x02, 0xD1, 0xB1, 0x00, 0x02, 0x94, 0x02, 0x83, 0x00, 0xC0, + 0x0C, 0xD2, 0x02, 0x9F, 0x00, 0x6F, 0x8E, 0x00, 0x00, 0xC4, 0x0C, 0xE6, + 0x19, 0x05, 0x00, 0xE5, 0x0C, 0xE6, 0x00, 0x86, 0x04, 0x00, 0x81, 0x00, + 0x89, 0x70, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x1F, 0xC6, 0x2E, 0xCD, + 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x04, 0x80, 0x02, 0xBF, 0x00, 0x84, + 0x02, 0xBF, 0x04, 0xE6, 0x02, 0x9F, 0x00, 0x6F, 0x8E, 0x00, 0x00, 0xC4, + 0x0C, 0xE7, 0x19, 0x05, 0x00, 0xE5, 0x0C, 0xE7, 0x00, 0x86, 0x06, 0x40, + 0x81, 0x00, 0x89, 0x70, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x1F, 0xC6, + 0x2E, 0xCD, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x04, 0x80, 0x02, 0xBF, + 0x00, 0x84, 0x02, 0xBF, 0x04, 0xE6, 0x02, 0x9F, 0x00, 0x6F, 0x8E, 0x00, + 0x00, 0xC4, 0x0C, 0xE8, 0x19, 0x05, 0x00, 0xE5, 0x0C, 0xE8, 0x00, 0x86, + 0x08, 0x80, 0x81, 0x00, 0x89, 0x70, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, + 0x1F, 0xC6, 0x2E, 0xCD, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x04, 0x80, + 0x02, 0xBF, 0x00, 0x84, 0x02, 0xBF, 0x04, 0xE6, 0x02, 0x9F, 0x00, 0x6F, + 0x8B, 0x00, 0x81, 0x00, 0x1F, 0xC4, 0x1F, 0xE5, 0x5D, 0x00, 0x00, 0x9A, + 0x02, 0xAB, 0x00, 0x9B, 0x02, 0xAA, 0x00, 0x81, 0x0D, 0x08, 0xD0, 0x00, + 0xD4, 0x00, 0x11, 0x1F, 0x04, 0xF7, 0xDC, 0x31, 0xD4, 0x31, 0xD4, 0x31, + 0xDC, 0x31, 0x4E, 0x31, 0x1B, 0x25, 0x8E, 0x00, 0x19, 0x1F, 0x19, 0x1D, + 0x2F, 0xCE, 0x2D, 0xCF, 0x89, 0x00, 0x1F, 0xA6, 0x2D, 0xCD, 0x16, 0xC9, + 0x00, 0x00, 0x16, 0xCB, 0x04, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x00, 0xE0, + 0x0C, 0xD2, 0x8F, 0x00, 0x8D, 0x00, 0x8A, 0x00, 0x00, 0x80, 0x0D, 0x08, + 0x00, 0x81, 0x00, 0x00, 0x1C, 0x41, 0x1C, 0x66, 0x80, 0xF1, 0x80, 0xC0, + 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, 0x4E, 0x00, 0x48, 0x00, 0x11, 0x2F, + 0x05, 0x2A, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, + 0x4F, 0x32, 0x49, 0x22, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, + 0x91, 0x41, 0x4E, 0x3A, 0x48, 0x2A, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, + 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, 0x49, 0x22, 0x1B, 0x5F, 0x1B, 0x5D, + 0x00, 0x80, 0x0D, 0x08, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, + 0x91, 0x41, 0x4E, 0x00, 0x48, 0x00, 0x11, 0x2F, 0x05, 0x4C, 0x80, 0xF1, + 0x80, 0xC0, 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, 0x49, 0x22, + 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, 0x4E, 0x3A, + 0x48, 0x2A, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, + 0x4F, 0x32, 0x49, 0x22, 0x1B, 0x5F, 0x1B, 0x5D, 0x00, 0x80, 0x0D, 0x08, + 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, 0x4E, 0x00, + 0x48, 0x00, 0x11, 0x2F, 0x05, 0x6E, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, + 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, 0x49, 0x22, 0x80, 0xF1, 0x80, 0xC0, + 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, 0x4E, 0x3A, 0x48, 0x2A, 0x80, 0xF1, + 0x80, 0xC0, 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, 0x49, 0x22, + 0x1B, 0x5F, 0x1B, 0x5D, 0x00, 0xC0, 0x0C, 0xD2, 0x02, 0xDF, 0x8D, 0x00, + 0x8F, 0x00, 0x8A, 0x00, 0x89, 0x00, 0x81, 0x68, 0x00, 0x98, 0x00, 0x00, + 0x00, 0x99, 0x00, 0x01, 0x00, 0x81, 0x00, 0x00, 0x19, 0x3E, 0x19, 0x3C, + 0x11, 0x60, 0x05, 0x93, 0xA1, 0x00, 0x82, 0x71, 0x02, 0x77, 0x1F, 0x19, + 0x19, 0x3C, 0xA1, 0x00, 0x82, 0x71, 0x02, 0x77, 0x1F, 0x19, 0x19, 0x3C, + 0x1F, 0xD8, 0xB1, 0x00, 0x02, 0x94, 0x05, 0xC0, 0x00, 0xDE, 0x0C, 0xE4, + 0xB1, 0x00, 0x02, 0x94, 0x05, 0xA2, 0x19, 0x1C, 0x19, 0x1C, 0x19, 0x1C, + 0x02, 0x9F, 0x00, 0x6F, 0x8B, 0x00, 0x7A, 0x00, 0x00, 0xFE, 0x0C, 0xE4, + 0x84, 0x00, 0x00, 0x99, 0x00, 0xC0, 0x1F, 0x1E, 0xA0, 0x00, 0x19, 0x1E, + 0x19, 0x1E, 0x19, 0x1C, 0x00, 0xE0, 0x0C, 0xD2, 0x00, 0x9A, 0x00, 0x00, + 0x00, 0x98, 0x08, 0x40, 0x4E, 0x00, 0x48, 0x00, 0x2E, 0xCE, 0x2C, 0xCF, + 0x16, 0xCD, 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x00, 0xC0, + 0x02, 0x9F, 0x05, 0xD6, 0x8B, 0x00, 0x00, 0xD8, 0x0C, 0xE4, 0x00, 0x99, + 0x00, 0xC0, 0xA0, 0x00, 0x19, 0x1E, 0x00, 0xFE, 0x0C, 0xE4, 0x19, 0x1E, + 0x19, 0x1C, 0x00, 0xE0, 0x0C, 0xD2, 0x4E, 0x00, 0x2E, 0xCE, 0x2C, 0xCF, + 0x16, 0xCD, 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x00, 0xC0, + 0x02, 0xBF, 0x00, 0x84, 0x8A, 0x48, 0x00, 0x83, 0x0D, 0x08, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x19, 0x79, 0x19, 0x3A, 0xB0, 0x41, + 0xA6, 0x4B, 0xF0, 0x51, 0xB4, 0x41, 0x91, 0x00, 0x11, 0x30, 0x05, 0xEF, + 0xA7, 0x92, 0xF1, 0x51, 0xB5, 0x20, 0x99, 0x41, 0xA6, 0x93, 0xF0, 0x51, + 0xB4, 0x28, 0x91, 0x41, 0x00, 0x83, 0x0D, 0x08, 0x00, 0x80, 0x00, 0xC0, + 0x00, 0x81, 0x00, 0xC0, 0x19, 0x79, 0x19, 0x3A, 0xB0, 0x41, 0xA6, 0x4B, + 0xF0, 0x51, 0xB4, 0x41, 0x91, 0x00, 0x11, 0x30, 0x06, 0x06, 0xA7, 0x92, + 0xF1, 0x51, 0xB5, 0x20, 0x99, 0x41, 0xA6, 0x93, 0xF0, 0x51, 0xB4, 0x28, + 0x91, 0x41, 0x00, 0xC0, 0x0C, 0xD2, 0x02, 0x9F, 0x00, 0x6F, 0x8E, 0x48, + 0x8B, 0x70, 0x89, 0x60, 0x00, 0xE0, 0x0C, 0xD2, 0x2E, 0xCE, 0x2C, 0xCF, + 0x16, 0xCD, 0x01, 0x80, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, + 0x81, 0x00, 0x00, 0xDE, 0x0C, 0xE5, 0x1F, 0xF9, 0x5D, 0x00, 0x00, 0xF9, + 0x0C, 0xE5, 0x00, 0x9A, 0x02, 0xAB, 0x00, 0x9B, 0x02, 0xAA, 0x00, 0x81, + 0x0D, 0x08, 0xD0, 0x00, 0xD4, 0x00, 0x11, 0x1F, 0x06, 0x2B, 0xDC, 0x31, + 0xD4, 0x31, 0xD4, 0x31, 0xDC, 0x31, 0x4E, 0x31, 0x1B, 0x39, 0x02, 0xBF, + 0x00, 0x84, 0x8F, 0x00, 0x8D, 0x00, 0x8A, 0x00, 0x00, 0x80, 0x0D, 0x08, + 0x00, 0x81, 0x04, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0xC0, + 0x19, 0x18, 0x19, 0x5B, 0x19, 0x59, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x00, + 0x4E, 0x5B, 0xF0, 0x4B, 0x11, 0x5F, 0x06, 0x4F, 0xA0, 0x31, 0xAE, 0x00, + 0x91, 0x40, 0x4E, 0x5A, 0xF0, 0x4A, 0xA0, 0x31, 0xAE, 0x00, 0x91, 0x00, + 0x4E, 0x5B, 0xF0, 0x4B, 0xA0, 0x31, 0xAE, 0x00, 0x91, 0x00, 0x4E, 0x00, + 0xF0, 0x00, 0x1B, 0x3E, 0x8E, 0x00, 0x00, 0xC0, 0x0C, 0xD2, 0x19, 0x1E, + 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, 0x04, 0x00, 0x16, 0xC9, + 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x16, 0xFC, + 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x04, 0x16, 0xFB, 0x00, 0x01, 0x26, 0xFC, + 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x06, 0x6B, 0x02, 0x9F, 0x00, 0x6F, + 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x02, 0x16, 0xFB, 0x00, 0x01, + 0x02, 0x9F, 0x0F, 0x9B, 0x02, 0x9F, 0x00, 0x4C, 0x8C, 0x00, 0x8A, 0x00, + 0x8F, 0x00, 0x00, 0x81, 0x0A, 0xC0, 0x00, 0x82, 0x02, 0x40, 0x1F, 0xA1, + 0x11, 0x12, 0x06, 0x89, 0x19, 0x5E, 0x19, 0x5C, 0xF0, 0x00, 0x1B, 0x3E, + 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x2D, 0xCD, 0x11, 0x03, + 0x06, 0xA2, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x00, 0x24, 0x1F, 0xA1, + 0x11, 0x12, 0x06, 0x9B, 0x19, 0x5E, 0x19, 0x5C, 0xF0, 0x00, 0x1B, 0x3E, + 0x02, 0xBF, 0x00, 0x84, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, + 0x2D, 0xCD, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x00, 0x24, 0x02, 0xBF, + 0x00, 0x84, 0x02, 0x9F, 0x00, 0x6F, 0x00, 0x87, 0xFF, 0xFF, 0x1C, 0x83, + 0x19, 0x7E, 0x80, 0xE1, 0xB0, 0x4F, 0x1F, 0x5E, 0xE2, 0xE1, 0xB6, 0x4F, + 0x1F, 0x5E, 0xE2, 0xE1, 0x11, 0x2F, 0x06, 0xBD, 0xB7, 0x9A, 0x1F, 0x5F, + 0xE2, 0xE1, 0xB6, 0x9B, 0x1F, 0x5E, 0xE2, 0xE1, 0x6F, 0x30, 0x1B, 0x1F, + 0x1C, 0x64, 0x1B, 0x7F, 0x02, 0xDF, 0x8C, 0x00, 0x8B, 0x00, 0x1C, 0xA0, + 0x00, 0x83, 0x03, 0x70, 0x19, 0x1A, 0x19, 0x18, 0x1B, 0x7A, 0x1B, 0x78, + 0x19, 0x19, 0x19, 0x1B, 0x00, 0x83, 0x0D, 0x03, 0x11, 0x05, 0x06, 0xD3, + 0x19, 0x1A, 0x1B, 0x7A, 0x00, 0x80, 0x0D, 0x03, 0x00, 0x88, 0x00, 0x04, + 0x00, 0x83, 0x03, 0x70, 0x00, 0x8B, 0x00, 0x01, 0x00, 0x87, 0x00, 0x00, + 0x19, 0x3F, 0x19, 0x1A, 0xD0, 0xC3, 0xF2, 0xCB, 0xF2, 0xA9, 0xE2, 0x50, + 0xE3, 0x79, 0x6E, 0x50, 0x14, 0x82, 0xFC, 0x00, 0x1F, 0x7E, 0x1B, 0x5E, + 0x11, 0x2F, 0x06, 0xFF, 0xD0, 0xC3, 0xF2, 0xCB, 0xF2, 0xA9, 0xE3, 0x50, + 0xE2, 0x79, 0x6E, 0x50, 0x14, 0x82, 0xFC, 0x00, 0x1F, 0x3E, 0x1B, 0x5E, + 0xD0, 0xC3, 0xF2, 0xCB, 0xF2, 0xA9, 0xE2, 0x50, 0xE3, 0x79, 0x6E, 0x50, + 0x14, 0x82, 0xFC, 0x00, 0x1F, 0x7E, 0x1B, 0x5E, 0xD0, 0xC3, 0xF2, 0xCB, + 0xF2, 0xA9, 0xE3, 0x50, 0xE2, 0x00, 0x6E, 0x00, 0x14, 0x82, 0xFC, 0x00, + 0x1F, 0x3E, 0x1B, 0x5E, 0x00, 0x88, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, + 0x1C, 0x05, 0x00, 0x83, 0x03, 0x70, 0x19, 0x7A, 0x19, 0x78, 0x1B, 0x1A, + 0x1B, 0x18, 0x1B, 0x19, 0x1B, 0x1B, 0x8D, 0x00, 0x8A, 0x00, 0x02, 0xDF, + 0x02, 0xBF, 0x07, 0xE6, 0x8C, 0x00, 0x8A, 0x00, 0x8F, 0x00, 0x19, 0x5B, + 0x19, 0x59, 0x81, 0x00, 0x19, 0x5C, 0x00, 0x80, 0x0D, 0x08, 0x00, 0x88, + 0x00, 0x03, 0x19, 0x5F, 0x1B, 0x1F, 0x19, 0x5F, 0x1B, 0x1F, 0x19, 0x5F, + 0x1B, 0x1F, 0x19, 0x5F, 0x1B, 0x1F, 0x00, 0x81, 0x0C, 0x60, 0x00, 0x82, + 0xFF, 0xDD, 0x00, 0xC7, 0x0C, 0xE0, 0x4A, 0x00, 0x11, 0x60, 0x07, 0x4A, + 0x89, 0x12, 0x1F, 0xBC, 0x15, 0x77, 0x15, 0x12, 0x1C, 0x7F, 0x00, 0x1F, + 0x00, 0x78, 0x07, 0x43, 0x18, 0x5A, 0x1B, 0x1A, 0x50, 0x00, 0x1F, 0x1D, + 0x4A, 0xC3, 0x90, 0xC3, 0x97, 0xC3, 0x95, 0xC3, 0x95, 0x00, 0x4F, 0x00, + 0x1B, 0x3F, 0x5A, 0x00, 0x00, 0x04, 0x00, 0x82, 0x03, 0x29, 0x18, 0x9F, + 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, + 0x1A, 0xDF, 0x00, 0x88, 0xFF, 0xFF, 0x1A, 0xDC, 0x00, 0x82, 0x03, 0x22, + 0x27, 0xDC, 0x1A, 0xDF, 0x27, 0xDB, 0x1A, 0xDF, 0x27, 0xDA, 0x1A, 0xDF, + 0x00, 0x82, 0x03, 0x0E, 0x27, 0xD9, 0x1A, 0xDF, 0x27, 0xD8, 0x1A, 0xDF, + 0x8E, 0x00, 0x8B, 0x00, 0x02, 0xDF, 0x02, 0xBF, 0x07, 0xE6, 0x8D, 0x00, + 0x8B, 0x00, 0x8F, 0x00, 0x19, 0x5B, 0x19, 0x45, 0x81, 0x00, 0x19, 0x5C, + 0x00, 0x80, 0x0D, 0x08, 0x00, 0x88, 0x00, 0x03, 0x00, 0x84, 0x00, 0x03, + 0x19, 0x5F, 0x1B, 0x1F, 0x19, 0x5F, 0x1B, 0x1F, 0x19, 0x5F, 0x1B, 0x1F, + 0x19, 0x5F, 0x1B, 0x1F, 0x00, 0x81, 0x0C, 0x60, 0x00, 0x82, 0xFF, 0xDD, + 0x1F, 0x25, 0x4A, 0x00, 0x11, 0x60, 0x07, 0x9F, 0x89, 0x12, 0x00, 0x78, + 0x07, 0x90, 0x18, 0x5A, 0x1B, 0x1A, 0x50, 0x00, 0x1F, 0x1F, 0x7C, 0x00, + 0xB1, 0x14, 0x02, 0x94, 0x07, 0x99, 0x19, 0x1F, 0x00, 0x10, 0x02, 0x9F, + 0x07, 0x9E, 0x7C, 0x50, 0xB0, 0x14, 0x19, 0x9A, 0xB7, 0x00, 0x4F, 0x00, + 0x1F, 0x25, 0x4A, 0x39, 0x5A, 0x00, 0x00, 0x04, 0x00, 0x82, 0x03, 0x29, + 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, + 0x18, 0x9F, 0x1A, 0xDF, 0x00, 0x88, 0xFF, 0xFF, 0x1A, 0xDC, 0x00, 0x82, + 0x03, 0x22, 0x27, 0xDC, 0x1A, 0xDF, 0x27, 0xDB, 0x1A, 0xDF, 0x27, 0xDA, + 0x1A, 0xDF, 0x00, 0x82, 0x03, 0x0E, 0x27, 0xD9, 0x1A, 0xDF, 0x27, 0xD8, + 0x1A, 0xDF, 0x8E, 0x00, 0x8C, 0x00, 0x02, 0xDF, 0x02, 0xBF, 0x07, 0xE6, + 0x00, 0x80, 0x0C, 0x60, 0x00, 0x82, 0xFF, 0xDD, 0x11, 0x60, 0x07, 0xCB, + 0x18, 0x44, 0x1B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x82, + 0x03, 0x29, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x18, 0x9F, + 0x1A, 0xDF, 0x18, 0x9F, 0x1A, 0xDF, 0x00, 0x82, 0x03, 0x22, 0x27, 0xDC, + 0x1A, 0xDF, 0x27, 0xDB, 0x1A, 0xDF, 0x27, 0xDA, 0x1A, 0xDF, 0x00, 0x82, + 0x03, 0x0E, 0x27, 0xD9, 0x1A, 0xDF, 0x27, 0xD8, 0x1A, 0xDF, 0x02, 0xDF, + 0x00, 0x82, 0x03, 0x08, 0x19, 0x5E, 0x2E, 0xD1, 0x19, 0x5E, 0x2E, 0xD4, + 0x19, 0x5E, 0x2E, 0xD5, 0x19, 0x5E, 0x2E, 0xD6, 0x19, 0x5E, 0x2E, 0xD7, + 0x19, 0x5E, 0x2E, 0xD8, 0x19, 0x5E, 0x2E, 0xD9, 0x19, 0x5E, 0x2E, 0xA0, + 0x19, 0x5E, 0x2E, 0xA1, 0x19, 0x5E, 0x2E, 0xA2, 0x19, 0x5E, 0x2E, 0xA3, + 0x19, 0x5E, 0x2E, 0xA4, 0x19, 0x5E, 0x2E, 0xA5, 0x19, 0x5E, 0x2E, 0xA6, + 0x19, 0x5E, 0x2E, 0xA7, 0x19, 0x5E, 0x2E, 0xA8, 0x19, 0x5E, 0x2E, 0xA9, + 0x19, 0x5E, 0x2E, 0xAA, 0x19, 0x5E, 0x2E, 0xAB, 0x19, 0x5E, 0x2E, 0xAC, + 0x19, 0x5E, 0x2E, 0xAD, 0x19, 0x5E, 0x2E, 0xAE, 0x19, 0x5E, 0x2E, 0xAF, + 0x19, 0x5E, 0x2E, 0xDE, 0x19, 0x5E, 0x2E, 0xDA, 0x19, 0x5E, 0x2E, 0xDB, + 0x19, 0x5E, 0x2E, 0xDC, 0x02, 0xDF, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xDA, 0x00, 0x82, 0x00, 0x00, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xF9, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE3, + 0x00, 0x81, 0x02, 0xDC, 0x00, 0x82, 0x00, 0xC0, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xFD, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xDA, 0x00, 0x82, 0x00, 0x00, 0x1C, 0x62, 0x00, 0xC4, + 0x0C, 0xE3, 0x00, 0x85, 0x00, 0xC0, 0x02, 0xBF, 0x0B, 0xEB, 0x00, 0xF8, + 0x02, 0xF9, 0x00, 0xFB, 0x02, 0xFD, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xDA, 0x00, 0x82, 0x00, 0x00, 0x00, 0x83, 0x0D, 0x08, + 0x00, 0xC4, 0x0C, 0xE3, 0x00, 0x85, 0x00, 0xC0, 0x02, 0xBF, 0x0C, 0x51, + 0x00, 0xF8, 0x02, 0xF9, 0x00, 0xFB, 0x02, 0xFD, 0x02, 0xDF, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, 0x1C, 0x62, + 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x01, 0x02, 0xDF, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, 0x1C, 0x62, + 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x01, 0x02, 0x9F, 0x08, 0x20, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x01, 0x02, 0x9F, + 0x08, 0x2C, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, + 0x01, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x01, + 0x02, 0x9F, 0x08, 0x38, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, + 0x00, 0x82, 0x01, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x03, 0x01, 0x02, 0x9F, 0x08, 0x4A, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, + 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x01, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x01, 0x02, 0x9F, 0x08, 0x20, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, + 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x01, + 0x02, 0x9F, 0x08, 0x2C, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEA, + 0x00, 0x82, 0x01, 0x80, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, + 0x00, 0xF8, 0x03, 0x01, 0x02, 0x9F, 0x08, 0x38, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEA, 0x00, 0x82, 0x01, 0x80, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x01, 0x02, 0x9F, 0x08, 0x4A, + 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xDE, 0x00, 0x82, 0x04, 0x00, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xFA, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE3, 0x00, 0x81, 0x02, 0xE0, 0x00, 0x82, 0x04, 0xC0, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xFE, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xDE, 0x00, 0x82, 0x04, 0x00, + 0x1C, 0x62, 0x00, 0xC4, 0x0C, 0xE3, 0x00, 0x85, 0x04, 0xC0, 0x02, 0xBF, + 0x0B, 0xEB, 0x00, 0xF8, 0x02, 0xFA, 0x00, 0xFB, 0x02, 0xFE, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xDE, 0x00, 0x82, 0x04, 0x00, + 0x00, 0x83, 0x0D, 0x08, 0x00, 0xC4, 0x0C, 0xE3, 0x00, 0x85, 0x04, 0xC0, + 0x02, 0xBF, 0x0C, 0x51, 0x00, 0xF8, 0x02, 0xFA, 0x00, 0xFB, 0x02, 0xFE, + 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, + 0x05, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x02, + 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, + 0x05, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x02, + 0x02, 0x9F, 0x08, 0xE2, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, + 0x00, 0x82, 0x05, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x03, 0x02, 0x02, 0x9F, 0x08, 0xEE, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, + 0x00, 0xF8, 0x03, 0x02, 0x02, 0x9F, 0x08, 0xFA, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x02, 0x02, 0x9F, 0x09, 0x0C, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, 0x00, 0x83, + 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x02, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, + 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x02, + 0x02, 0x9F, 0x08, 0xE2, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, + 0x00, 0x82, 0x05, 0x80, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, + 0x00, 0xF8, 0x03, 0x02, 0x02, 0x9F, 0x08, 0xEE, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x02, 0x02, 0x9F, 0x08, 0xFA, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEC, 0x00, 0x82, 0x05, 0x80, + 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x02, + 0x02, 0x9F, 0x09, 0x0C, 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xE2, + 0x00, 0x82, 0x06, 0x40, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x02, 0xFB, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE3, 0x00, 0x81, 0x02, 0xE4, + 0x00, 0x82, 0x07, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x02, 0xFF, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xE2, + 0x00, 0x82, 0x06, 0x40, 0x1C, 0x62, 0x00, 0xC4, 0x0C, 0xE3, 0x00, 0x85, + 0x07, 0x00, 0x02, 0xBF, 0x0B, 0xEB, 0x00, 0xF8, 0x02, 0xFB, 0x00, 0xFB, + 0x02, 0xFF, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, 0x00, 0x81, 0x02, 0xE2, + 0x00, 0x82, 0x06, 0x40, 0x00, 0x83, 0x0D, 0x08, 0x00, 0xC4, 0x0C, 0xE3, + 0x00, 0x85, 0x07, 0x00, 0x02, 0xBF, 0x0C, 0x51, 0x00, 0xF8, 0x02, 0xFB, + 0x00, 0xFB, 0x02, 0xFF, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, + 0x00, 0xF8, 0x03, 0x03, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, + 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xA4, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xB0, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, 0x1C, 0x62, + 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xBC, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, + 0x09, 0xCE, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, + 0x07, 0xC0, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, + 0x03, 0x03, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, + 0x00, 0x82, 0x07, 0xC0, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, + 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xA4, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xB0, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, 0x00, 0x82, 0x07, 0xC0, + 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x03, + 0x02, 0x9F, 0x09, 0xBC, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xEE, + 0x00, 0x82, 0x07, 0xC0, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, + 0x00, 0xF8, 0x03, 0x03, 0x02, 0x9F, 0x09, 0xCE, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xFC, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE3, + 0x00, 0x81, 0x02, 0xE8, 0x00, 0x82, 0x09, 0x40, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x00, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, 0x1C, 0x62, 0x00, 0xC4, + 0x0C, 0xE3, 0x00, 0x85, 0x09, 0x40, 0x02, 0xBF, 0x0B, 0xEB, 0x00, 0xF8, + 0x02, 0xFC, 0x00, 0xFB, 0x03, 0x00, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE2, + 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, 0x00, 0x83, 0x0D, 0x08, + 0x00, 0xC4, 0x0C, 0xE3, 0x00, 0x85, 0x09, 0x40, 0x02, 0xBF, 0x0C, 0x51, + 0x00, 0xF8, 0x02, 0xFC, 0x00, 0xFB, 0x03, 0x00, 0x02, 0xDF, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, + 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, 0x02, 0xDF, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, + 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0A, 0x66, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, + 0x0A, 0x72, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, + 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, + 0x02, 0x9F, 0x0A, 0x7E, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, + 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x03, 0x04, 0x02, 0x9F, 0x0A, 0x90, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, + 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0A, 0x66, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, + 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, + 0x02, 0x9F, 0x0A, 0x72, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, + 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, + 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0A, 0x7E, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, + 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0A, 0x90, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x02, 0xFC, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xE8, 0x00, 0x82, 0x09, 0x40, + 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x00, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, + 0x1C, 0x62, 0x00, 0xC4, 0x0C, 0xE1, 0x00, 0x85, 0x09, 0x40, 0x02, 0xBF, + 0x0B, 0xEB, 0x00, 0xF8, 0x02, 0xFC, 0x00, 0xFB, 0x03, 0x00, 0x02, 0xDF, + 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xE6, 0x00, 0x82, 0x08, 0x80, + 0x00, 0x83, 0x0D, 0x08, 0x00, 0xC4, 0x0C, 0xE1, 0x00, 0x85, 0x09, 0x40, + 0x02, 0xBF, 0x0C, 0x51, 0x00, 0xF8, 0x02, 0xFC, 0x00, 0xFB, 0x03, 0x00, + 0x02, 0xDF, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, + 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, + 0x02, 0x9F, 0x0B, 0x28, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, + 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, 0x00, 0xF8, + 0x03, 0x04, 0x02, 0x9F, 0x0B, 0x34, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, 0x0B, 0xD1, + 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0B, 0x40, 0x00, 0xC0, 0x0C, 0xE1, + 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x1C, 0x62, 0x02, 0xBF, + 0x0B, 0xD1, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0B, 0x52, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, + 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, + 0x0B, 0x28, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, + 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, + 0x03, 0x04, 0x02, 0x9F, 0x0B, 0x34, 0x00, 0xC0, 0x0C, 0xE1, 0x00, 0x81, + 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, 0x0D, 0x08, 0x02, 0xBF, + 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, 0x0B, 0x40, 0x00, 0xC0, + 0x0C, 0xE1, 0x00, 0x81, 0x02, 0xF0, 0x00, 0x82, 0x0A, 0x00, 0x00, 0x83, + 0x0D, 0x08, 0x02, 0xBF, 0x0C, 0x21, 0x00, 0xF8, 0x03, 0x04, 0x02, 0x9F, + 0x0B, 0x52, 0x19, 0x1A, 0x19, 0x39, 0xB0, 0x72, 0x19, 0x5C, 0xF0, 0x7A, + 0x19, 0x1A, 0xB4, 0x6A, 0x91, 0x00, 0xF1, 0xA0, 0x11, 0x2F, 0x0B, 0xE3, + 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, 0xF0, 0xA1, 0xB4, 0x2B, 0x91, 0x7A, + 0x19, 0x5D, 0xF1, 0xA0, 0x1B, 0x7C, 0x6E, 0x00, 0x4F, 0x12, 0x99, 0x00, + 0x1B, 0x7F, 0x81, 0x2B, 0x02, 0xDF, 0x19, 0x1A, 0x19, 0x39, 0xB0, 0x72, + 0x19, 0x5C, 0xF0, 0x7A, 0x19, 0x1A, 0xB4, 0x6A, 0x91, 0x00, 0xF1, 0xA0, + 0x11, 0x2F, 0x0B, 0xFD, 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, 0xF0, 0xA1, + 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, 0xF1, 0xA0, 0x1B, 0x7C, 0x6E, 0x00, + 0x4F, 0x12, 0x99, 0x09, 0x1B, 0x7F, 0x1B, 0x7D, 0x1C, 0x04, 0x1C, 0x45, + 0x1C, 0x62, 0x19, 0x1A, 0x19, 0x39, 0xB0, 0x72, 0x19, 0x5C, 0xF0, 0x7A, + 0x19, 0x1A, 0xB4, 0x6A, 0x91, 0x00, 0xF1, 0xA0, 0x11, 0x2F, 0x0C, 0x19, + 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, 0xF0, 0xA1, 0xB4, 0x2B, 0x91, 0x7A, + 0x19, 0x5D, 0xF1, 0xA0, 0x1B, 0x7C, 0x6E, 0x00, 0x4F, 0x1E, 0x99, 0x00, + 0x1B, 0x7F, 0x1B, 0x7D, 0x02, 0xDF, 0x1C, 0xE3, 0x8E, 0x00, 0x81, 0x00, + 0x89, 0x71, 0x18, 0xBF, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x11, 0x2F, + 0x0C, 0x2E, 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, + 0x1B, 0x3E, 0x1C, 0x27, 0x1C, 0x62, 0x8F, 0x50, 0x19, 0x39, 0xB0, 0x72, + 0x19, 0x5C, 0xF0, 0x7A, 0x19, 0x1A, 0x19, 0x39, 0xB4, 0x6A, 0x91, 0x00, + 0xF1, 0xA0, 0x19, 0x39, 0x11, 0x2F, 0x0C, 0x49, 0xB5, 0x23, 0x99, 0x72, + 0x19, 0x5C, 0xF0, 0xA1, 0x19, 0x39, 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, + 0xF1, 0xA0, 0x19, 0x39, 0x1B, 0x7C, 0x6E, 0x00, 0x4F, 0x12, 0x99, 0x00, + 0x1B, 0x7F, 0x1B, 0x7D, 0x02, 0xDF, 0x1C, 0xE3, 0x8E, 0x00, 0x81, 0x00, + 0x89, 0x71, 0x18, 0xBF, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x11, 0x2F, + 0x0C, 0x5E, 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, + 0x1B, 0x3E, 0x00, 0x09, 0x81, 0x00, 0x89, 0x71, 0x18, 0xBF, 0x1B, 0x7E, + 0x4C, 0x00, 0x1B, 0x7E, 0x11, 0x2F, 0x0C, 0x6D, 0x4C, 0x00, 0x1B, 0x7E, + 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x3E, 0x1C, 0x27, 0x1C, 0x62, + 0x8F, 0x50, 0x19, 0x39, 0xB0, 0x72, 0x19, 0x5C, 0xF0, 0x7A, 0x19, 0x1A, + 0x19, 0x39, 0xB4, 0x6A, 0x91, 0x00, 0xF1, 0xA0, 0x19, 0x39, 0x11, 0x2F, + 0x0C, 0x88, 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, 0xF0, 0xA1, 0x19, 0x39, + 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, 0xF1, 0xA0, 0x19, 0x39, 0x1B, 0x7C, + 0x6E, 0x00, 0x4F, 0x12, 0x99, 0x05, 0x1B, 0x7F, 0x1B, 0x7D, 0x1C, 0x04, + 0x1C, 0x45, 0x1C, 0x62, 0x19, 0x1A, 0x19, 0x39, 0xB0, 0x72, 0x19, 0x5C, + 0xF0, 0x7A, 0x19, 0x1A, 0x19, 0x39, 0xB4, 0x6A, 0x91, 0x00, 0xF1, 0xA0, + 0x19, 0x39, 0x11, 0x2F, 0x0C, 0xA8, 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, + 0xF0, 0xA1, 0x19, 0x39, 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, 0xF1, 0xA0, + 0x19, 0x39, 0x1B, 0x7C, 0x6E, 0x00, 0x4F, 0x1E, 0x99, 0x00, 0x1B, 0x7F, + 0x1B, 0x7D, 0x02, 0xDF, 0x00, 0x98, 0x00, 0x00, 0x02, 0xDF, 0x00, 0x80, + 0x0C, 0xC0, 0x1C, 0x62, 0x19, 0x39, 0x19, 0x1A, 0xB0, 0x00, 0x19, 0x5E, + 0x19, 0x5C, 0xF0, 0x50, 0xB4, 0x00, 0x91, 0x7A, 0x19, 0x5D, 0xF1, 0xA0, + 0x11, 0x08, 0x0C, 0xC9, 0xB5, 0x23, 0x99, 0x72, 0x19, 0x5C, 0xF0, 0xA1, + 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, 0xF1, 0xA0, 0x4F, 0x23, 0x99, 0x00, + 0x1B, 0x7F, 0x6E, 0x2B, 0x1F, 0x1E, 0x02, 0xDF, 0x00, 0x80, 0x0C, 0xC0, + 0x00, 0x83, 0x0D, 0x08, 0x1C, 0xE3, 0x8E, 0x00, 0x81, 0x00, 0x89, 0x71, + 0x18, 0xBF, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x11, 0x08, 0x0C, 0xE1, + 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x7E, 0x4C, 0x00, 0x1B, 0x3E, + 0x1C, 0x27, 0x1C, 0x62, 0x8F, 0x50, 0x19, 0x39, 0xB0, 0x00, 0x19, 0x5E, + 0x19, 0x5C, 0xF0, 0x50, 0x19, 0x39, 0xB4, 0x00, 0x91, 0x7A, 0x19, 0x5D, + 0xF1, 0xA0, 0x19, 0x39, 0x11, 0x08, 0x0C, 0xFD, 0xB5, 0x23, 0x99, 0x72, + 0x19, 0x5C, 0xF0, 0xA1, 0x19, 0x39, 0xB4, 0x2B, 0x91, 0x7A, 0x19, 0x5D, + 0xF1, 0xA0, 0x19, 0x39, 0x4F, 0x23, 0x99, 0x00, 0x1B, 0x7F, 0x6E, 0x2B, + 0x1F, 0x1E, 0x02, 0xDF, 0x00, 0x8A, 0x02, 0x22, 0x02, 0x4F, 0x0E, 0x83, + 0x02, 0x7E, 0x04, 0x9B, 0x04, 0xB4, 0x04, 0xCD, 0x0D, 0xBD, 0x0D, 0xDF, + 0x05, 0x7B, 0x06, 0x0B, 0x0E, 0xC6, 0x06, 0x7C, 0x06, 0x72, 0x08, 0x1F, + 0x08, 0x20, 0x08, 0x2C, 0x08, 0x38, 0x08, 0x4A, 0x08, 0x4A, 0x08, 0x4A, + 0x08, 0x4A, 0x08, 0x5D, 0x08, 0x69, 0x08, 0x76, 0x08, 0x83, 0x08, 0x90, + 0x08, 0x90, 0x08, 0x90, 0x08, 0x90, 0x08, 0x9D, 0x08, 0xAA, 0x08, 0xB8, + 0x08, 0xC6, 0x08, 0xD4, 0x08, 0xD4, 0x08, 0xD4, 0x08, 0xD4, 0x08, 0x9D, + 0x08, 0xAA, 0x08, 0xB8, 0x08, 0xC6, 0x08, 0xD4, 0x08, 0xD4, 0x08, 0xD4, + 0x08, 0xD4, 0x08, 0x1F, 0x08, 0xE2, 0x08, 0xEE, 0x08, 0xFA, 0x09, 0x0C, + 0x09, 0x0C, 0x09, 0x0C, 0x09, 0x0C, 0x09, 0x1F, 0x09, 0x2B, 0x09, 0x38, + 0x09, 0x45, 0x09, 0x52, 0x09, 0x52, 0x09, 0x52, 0x09, 0x52, 0x09, 0x5F, + 0x09, 0x6C, 0x09, 0x7A, 0x09, 0x88, 0x09, 0x96, 0x09, 0x96, 0x09, 0x96, + 0x09, 0x96, 0x09, 0x5F, 0x09, 0x6C, 0x09, 0x7A, 0x09, 0x88, 0x09, 0x96, + 0x09, 0x96, 0x09, 0x96, 0x09, 0x96, 0x08, 0x1F, 0x09, 0xA4, 0x09, 0xB0, + 0x09, 0xBC, 0x09, 0xCE, 0x09, 0xCE, 0x09, 0xCE, 0x09, 0xCE, 0x09, 0xE1, + 0x09, 0xED, 0x09, 0xFA, 0x0A, 0x07, 0x0A, 0x14, 0x0A, 0x14, 0x0A, 0x14, + 0x0A, 0x14, 0x0A, 0x21, 0x0A, 0x2E, 0x0A, 0x3C, 0x0A, 0x4A, 0x0A, 0x58, + 0x0A, 0x58, 0x0A, 0x58, 0x0A, 0x58, 0x0A, 0x21, 0x0A, 0x2E, 0x0A, 0x3C, + 0x0A, 0x4A, 0x0A, 0x58, 0x0A, 0x58, 0x0A, 0x58, 0x0A, 0x58, 0x08, 0x1F, + 0x0A, 0x66, 0x0A, 0x72, 0x0A, 0x7E, 0x0A, 0x90, 0x0A, 0x90, 0x0A, 0x90, + 0x0A, 0x90, 0x0A, 0xA3, 0x0A, 0xAF, 0x0A, 0xBC, 0x0A, 0xC9, 0x0A, 0xD6, + 0x0A, 0xD6, 0x0A, 0xD6, 0x0A, 0xD6, 0x0A, 0xE3, 0x0A, 0xF0, 0x0A, 0xFE, + 0x0B, 0x0C, 0x0B, 0x1A, 0x0B, 0x1A, 0x0B, 0x1A, 0x0B, 0x1A, 0x0A, 0xE3, + 0x0A, 0xF0, 0x0A, 0xFE, 0x0B, 0x0C, 0x0B, 0x1A, 0x0B, 0x1A, 0x0B, 0x1A, + 0x0B, 0x1A, 0x08, 0x1F, 0x0B, 0x28, 0x0B, 0x34, 0x0B, 0x40, 0x0B, 0x52, + 0x0B, 0x52, 0x0B, 0x52, 0x0B, 0x52, 0x0A, 0xA3, 0x0B, 0x65, 0x0B, 0x72, + 0x0B, 0x7F, 0x0B, 0x8C, 0x0B, 0x8C, 0x0B, 0x8C, 0x0B, 0x8C, 0x0A, 0xE3, + 0x0B, 0x99, 0x0B, 0xA7, 0x0B, 0xB5, 0x0B, 0xC3, 0x0B, 0xC3, 0x0B, 0xC3, + 0x0B, 0xC3, 0x0A, 0xE3, 0x0B, 0x99, 0x0B, 0xA7, 0x0B, 0xB5, 0x0B, 0xC3, + 0x0B, 0xC3, 0x0B, 0xC3, 0x0B, 0xC3, 0x0C, 0xB0, 0x0C, 0xB3, 0x0C, 0xD0, + 0x0C, 0xD0, 0x07, 0x1A, 0x07, 0x6B, 0x07, 0xC0, 0x10, 0x00, 0x12, 0x00, + 0x14, 0x00, 0x8E, 0x00, 0x00, 0xC4, 0x0C, 0xE6, 0x19, 0x05, 0x00, 0xE5, + 0x0C, 0xE6, 0x00, 0x86, 0x04, 0x00, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, + 0x2C, 0xCF, 0x16, 0xCD, 0x04, 0x00, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, + 0x04, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, + 0x2C, 0xCF, 0x16, 0xCD, 0x09, 0x40, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, + 0x01, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x02, 0x9F, 0x0E, 0x01, 0x8E, 0x00, + 0x00, 0xC4, 0x0C, 0xE7, 0x19, 0x05, 0x00, 0xE5, 0x0C, 0xE7, 0x00, 0x86, + 0x06, 0x40, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, + 0x06, 0x40, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x04, 0x80, 0x02, 0xBF, + 0x00, 0x84, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, + 0x0A, 0x00, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, 0x02, 0xBF, + 0x00, 0x84, 0x02, 0x9F, 0x0E, 0x01, 0x8B, 0x00, 0x81, 0x00, 0x89, 0x00, + 0x1F, 0xC4, 0x1F, 0xE5, 0x5D, 0x00, 0x00, 0x9A, 0x02, 0xAB, 0x00, 0x9B, + 0x02, 0xAA, 0x00, 0x81, 0x0D, 0x08, 0xD0, 0x00, 0xD4, 0x00, 0x11, 0x1F, + 0x0E, 0x13, 0xDC, 0x31, 0xD4, 0x31, 0xD4, 0x31, 0xDC, 0x31, 0x4E, 0x31, + 0x1B, 0x25, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xE6, + 0xFF, 0xCD, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x01, 0x80, 0x00, 0x81, + 0x00, 0x00, 0x1C, 0x41, 0x02, 0xBF, 0x00, 0x84, 0x02, 0xBF, 0x0E, 0x57, + 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xE6, 0xFF, 0xCD, + 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x01, 0x80, 0x02, 0xBF, 0x00, 0x84, + 0x02, 0xBF, 0x0E, 0x57, 0x19, 0x1E, 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, + 0x00, 0xE6, 0xFF, 0xCD, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x01, 0x80, + 0x02, 0xBF, 0x00, 0x84, 0x02, 0xBF, 0x0E, 0x57, 0x19, 0x1E, 0x19, 0x1C, + 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xE6, 0xFF, 0xCD, 0x16, 0xC9, 0x00, 0x00, + 0x16, 0xCB, 0x01, 0x80, 0x00, 0x81, 0x08, 0x80, 0x1C, 0x41, 0x02, 0xBF, + 0x00, 0x84, 0x02, 0xBF, 0x0E, 0x57, 0x02, 0x9F, 0x00, 0x6F, 0x8F, 0x00, + 0x8D, 0x00, 0x8A, 0x00, 0x00, 0xE0, 0x0C, 0xD2, 0x00, 0x80, 0x0D, 0x08, + 0x1C, 0x66, 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, + 0x4E, 0x00, 0x48, 0x00, 0x11, 0x2F, 0x0E, 0x75, 0x80, 0xF1, 0x80, 0xC0, + 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, 0x49, 0x22, 0x80, 0xF1, + 0x80, 0xC0, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x41, 0x4E, 0x3A, 0x48, 0x2A, + 0x80, 0xF1, 0x80, 0xC0, 0xA0, 0x00, 0xAF, 0x00, 0x99, 0x41, 0x4F, 0x32, + 0x49, 0x22, 0x1B, 0x5F, 0x1B, 0x5D, 0x00, 0xC0, 0x0C, 0xD2, 0x8E, 0x00, + 0x02, 0xDF, 0x8E, 0x00, 0x19, 0x1F, 0x19, 0x1D, 0x2F, 0xCE, 0x2D, 0xCF, + 0x16, 0xCD, 0x0D, 0x08, 0x16, 0xC9, 0x00, 0x00, 0x16, 0xCB, 0x03, 0x00, + 0x02, 0xBF, 0x00, 0x84, 0x1C, 0x80, 0x8F, 0x00, 0x00, 0x80, 0x0D, 0x08, + 0x00, 0x83, 0x00, 0x00, 0x1C, 0x43, 0x80, 0xF0, 0x80, 0xC0, 0x6A, 0x00, + 0x48, 0x00, 0x11, 0x2F, 0x0E, 0xA4, 0x80, 0xF0, 0x80, 0xC0, 0x6B, 0x32, + 0x49, 0x22, 0x80, 0xF0, 0x80, 0xC0, 0x6A, 0x3A, 0x48, 0x2A, 0x80, 0xF0, + 0x80, 0xC0, 0x6B, 0x32, 0x49, 0x22, 0x1B, 0x5F, 0x1B, 0x5D, 0x80, 0xF0, + 0x80, 0xC0, 0x68, 0x00, 0x7C, 0x00, 0x4A, 0x00, 0x11, 0x2F, 0x0E, 0xBB, + 0x80, 0xF0, 0x80, 0xC0, 0x69, 0x32, 0x7D, 0x00, 0x4B, 0x22, 0x80, 0xF0, + 0x80, 0xC0, 0x68, 0x3A, 0x7C, 0x00, 0x4A, 0x2A, 0x80, 0xF0, 0x80, 0xC0, + 0x69, 0x32, 0x7D, 0x00, 0x4B, 0x22, 0x1B, 0x5F, 0x1B, 0x5D, 0x1C, 0x04, + 0x02, 0x9F, 0x00, 0x6F, 0x8E, 0x48, 0x8B, 0x78, 0x81, 0x68, 0x00, 0xE0, + 0x0C, 0xD2, 0x2F, 0xCE, 0x2D, 0xCF, 0x16, 0xCD, 0x01, 0x80, 0x16, 0xC9, + 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x81, 0x00, + 0x00, 0x9C, 0x01, 0x80, 0x4D, 0x00, 0x2F, 0xCE, 0x2D, 0xCF, 0x16, 0xCD, + 0x08, 0x80, 0x16, 0xC9, 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, 0x81, 0x00, + 0x89, 0x00, 0x00, 0xDE, 0x0C, 0xE5, 0x1F, 0xF9, 0x5D, 0x00, 0x00, 0xF9, + 0x0C, 0xE5, 0x00, 0x9A, 0x02, 0xAB, 0x00, 0x9B, 0x02, 0xAA, 0x00, 0x81, + 0x0D, 0x08, 0xD0, 0x00, 0xD4, 0x00, 0x11, 0x1F, 0x0E, 0xF5, 0xDC, 0x31, + 0xD4, 0x31, 0xD4, 0x31, 0xDC, 0x31, 0x4E, 0x31, 0x1B, 0x39, 0x02, 0xBF, + 0x00, 0x84, 0x8F, 0x00, 0x8D, 0x00, 0x8A, 0x00, 0x00, 0x80, 0x0D, 0x08, + 0x00, 0x81, 0x04, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0xC0, + 0x19, 0x18, 0x19, 0x5B, 0x19, 0x59, 0xA0, 0x00, 0xAE, 0x00, 0x91, 0x00, + 0x4E, 0x5B, 0xF0, 0x4B, 0x11, 0x5F, 0x0F, 0x19, 0xA0, 0x31, 0xAE, 0x00, + 0x91, 0x40, 0x4E, 0x5A, 0xF0, 0x4A, 0xA0, 0x31, 0xAE, 0x00, 0x91, 0x00, + 0x4E, 0x5B, 0xF0, 0x4B, 0xA0, 0x31, 0xAE, 0x00, 0x91, 0x00, 0x4E, 0x00, + 0xF0, 0x00, 0x1B, 0x3E, 0x8E, 0x00, 0x00, 0xC0, 0x0C, 0xD2, 0x19, 0x1E, + 0x19, 0x1C, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xCD, 0x04, 0x00, 0x16, 0xC9, + 0x00, 0x01, 0x16, 0xCB, 0x01, 0x80, 0x02, 0xBF, 0x00, 0x84, 0x16, 0xFC, + 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x04, 0x16, 0xFB, 0x00, 0x01, 0x26, 0xFC, + 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x0F, 0x35, 0x02, 0x9F, 0x00, 0x6F, + 0x8E, 0x00, 0x1F, 0xCC, 0x1D, 0x9E, 0x16, 0xFC, 0xEC, 0xC0, 0x2E, 0xFD, + 0x26, 0xFC, 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x0F, 0x42, 0x02, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x8E, 0x00, + 0x1D, 0xBC, 0x1D, 0xBE, 0x81, 0x00, 0x00, 0xDE, 0x03, 0x07, 0x06, 0x01, + 0x02, 0x95, 0x0F, 0x59, 0x0E, 0x00, 0x00, 0xFE, 0x02, 0xD8, 0x1F, 0xCD, + 0x1F, 0x8D, 0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0xFF, 0x8E, 0x00, 0x1D, 0xBC, 0x1D, 0xBE, 0x81, 0x00, 0x00, 0xDE, + 0x03, 0x07, 0x06, 0x01, 0x02, 0x95, 0x0F, 0x72, 0x0E, 0x00, 0x00, 0xFE, + 0x02, 0xD8, 0x00, 0x82, 0x0C, 0xE9, 0x1F, 0xCD, 0x1F, 0x8D, 0x02, 0xFF, + 0x00, 0xDE, 0x02, 0xD9, 0x06, 0x01, 0x02, 0x95, 0x0F, 0x83, 0x00, 0xDE, + 0x03, 0x2A, 0x2E, 0xDA, 0x00, 0xDE, 0x03, 0x2B, 0x2E, 0xDB, 0x00, 0xDE, + 0x03, 0x2C, 0x2E, 0xDC, 0x1F, 0xCD, 0x1F, 0x8D, 0x02, 0xFF, 0x00, 0xDE, + 0x03, 0x2A, 0x2E, 0xDA, 0x26, 0xDB, 0x2E, 0xDB, 0x26, 0xDC, 0x2E, 0xDC, + 0x1F, 0xCD, 0x1F, 0x8D, 0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0xFF, 0x0F, 0xA9, 0x0F, 0xAC, 0x0F, 0xE4, 0x0F, 0xE7, 0x8E, 0x00, + 0x81, 0x00, 0x89, 0x00, 0x02, 0xBF, 0x0F, 0xEA, 0x27, 0xFF, 0x00, 0x9E, + 0x0F, 0x97, 0x4C, 0x00, 0x1C, 0x7E, 0x03, 0x13, 0x1C, 0x7F, 0x17, 0x6F, + 0x00, 0x21, 0x02, 0x9F, 0x00, 0x37, 0x00, 0x21, 0x81, 0x00, 0x89, 0x00, + 0x02, 0xBF, 0x0F, 0xEA, 0x24, 0xFF, 0x02, 0xBF, 0x0F, 0xF0, 0x25, 0xFF, + 0x02, 0xBF, 0x0F, 0xF0, 0x27, 0xFF, 0x2E, 0xCE, 0x2C, 0xCF, 0x16, 0xC9, + 0x00, 0x01, 0x2F, 0xCD, 0x2D, 0xCB, 0x81, 0x00, 0x89, 0x00, 0x02, 0xBF, + 0x0F, 0xEA, 0x24, 0xFF, 0x1C, 0x9E, 0x1C, 0xBC, 0x02, 0xBF, 0x0F, 0xF0, + 0x25, 0xFF, 0x02, 0xBF, 0x0F, 0xF0, 0x27, 0xFF, 0x1C, 0xDF, 0x1C, 0xFD, + 0x81, 0x00, 0x02, 0xBF, 0x0F, 0xEA, 0x26, 0xFF, 0x1C, 0x1E, 0x89, 0x00, + 0x02, 0xBF, 0x0F, 0xF0, 0x20, 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x0F, 0xEA, + 0x21, 0xFF, 0x02, 0xBF, 0x0F, 0xEA, 0x23, 0xFF, 0x26, 0xC9, 0x02, 0xA0, + 0x00, 0x04, 0x02, 0x9C, 0x0F, 0xDC, 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21, + 0x02, 0x9F, 0x80, 0x00, 0x00, 0x21, 0x02, 0x9F, 0x00, 0x4C, 0x00, 0x21, + 0x26, 0xFE, 0x02, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x0F, 0xEA, 0x02, 0xDF, + 0x27, 0xFE, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x0F, 0xF0, 0x02, 0xDF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +u16 axDspInitVector = 0x0010; +u16 axDspResumeVector = 0x0037; +u16 axDspSlaveLength = LENGTHOF(axDspSlave); diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXChorus.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXChorus.c new file mode 100644 index 0000000000..54230dfc2e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXChorus.c @@ -0,0 +1,37 @@ +#include + +static void __ParamConvert(AXFX_CHORUS* fx); + +u32 AXFXChorusGetMemSize(const AXFX_CHORUS* fx) { + return AXFXChorusExpGetMemSize(&fx->exp); +} + +BOOL AXFXChorusInit(AXFX_CHORUS* fx) { + __ParamConvert(fx); + return AXFXChorusExpInit(&fx->exp); +} + +BOOL AXFXChorusShutdown(AXFX_CHORUS* fx) { + AXFXChorusExpShutdown(&fx->exp); + return TRUE; +} + +BOOL AXFXChorusSettings(AXFX_CHORUS* fx) { + __ParamConvert(fx); + return AXFXChorusExpSettings(&fx->exp); +} + +void AXFXChorusCallback(void* chans, void* context) { + AXFXChorusExpCallback((AXFX_BUFFERUPDATE*)chans, (AXFX_CHORUS_EXP*)context); +} + +static void __ParamConvert(AXFX_CHORUS* fx) { + fx->exp.delayTime = fx->baseDelay; + fx->exp.depth = fx->variation / fx->exp.delayTime; + fx->exp.rate = 1000.0f / fx->period; + fx->exp.feedback = 0.0f; + fx->exp.busIn = NULL; + fx->exp.busOut = NULL; + fx->exp.outGain = 1.0f; + fx->exp.sendGain = 0.0f; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXDelay.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXDelay.c new file mode 100644 index 0000000000..f41a5add83 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXDelay.c @@ -0,0 +1,182 @@ +#include +#include +#include +#include + +static BOOL __AllocDelayLine(AXFX_DELAY* fx); +static void __FreeDelayLine(AXFX_DELAY* fx); +static BOOL __InitParams(AXFX_DELAY* fx) DECOMP_DONT_INLINE; + +u32 AXFXDelayGetMemSize(const AXFX_DELAY* fx) { + u32 num = 0; + num += fx->delay[0]; + num += fx->delay[1]; + num += fx->delay[2]; + + return num * 128; +} + +BOOL AXFXDelayInit(AXFX_DELAY* fx) { + BOOL enabled; + int i; + + enabled = OSDisableInterrupts(); + fx->active = 1; + + for (i = 0; i < LENGTHOF(fx->delay); i++) { + if (fx->delay[i] == 0) { + AXFXDelayShutdown(fx); + OSRestoreInterrupts(enabled); + return FALSE; + } + + fx->length[i] = fx->delay[i] * 32; + } + + if (!__AllocDelayLine(fx)) { + AXFXDelayShutdown(fx); + OSRestoreInterrupts(enabled); + return FALSE; + } + + if (!__InitParams(fx)) { + AXFXDelayShutdown(fx); + OSRestoreInterrupts(enabled); + return FALSE; + } + + fx->active |= 2; + fx->active &= ~1; + OSRestoreInterrupts(enabled); + + return TRUE; +} + +BOOL AXFXDelaySettings(AXFX_DELAY* fx) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + fx->active |= 1; + AXFXDelayShutdown(fx); + + if (!AXFXDelayInit(fx)) { + AXFXDelayShutdown(fx); + OSRestoreInterrupts(enabled); + return FALSE; + } + + fx->active |= 2; + fx->active &= ~1; + OSRestoreInterrupts(enabled); + + return TRUE; +} + +void AXFXDelayShutdown(AXFX_DELAY* fx) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + fx->active |= 1; + __FreeDelayLine(fx); + + OSRestoreInterrupts(enabled); +} + +void AXFXDelayCallback(void* chans, void* context) { + AXFX_BUFFERUPDATE* buf; + AXFX_DELAY* fx; + s32* lp; + s32* rp; + s32* sp; + s32 lv, rv, sv; + int i; + + buf = (AXFX_BUFFERUPDATE*)chans; + fx = (AXFX_DELAY*)context; + + if (fx->active) { + fx->active &= ~2; + return; + } + + lp = buf->left; + rp = buf->right; + sp = buf->surround; + + for (i = 0; i < AX_SAMPLES_PER_FRAME; i++) { + lv = fx->line[0][fx->curPos[0]]; + rv = fx->line[1][fx->curPos[1]]; + sv = fx->line[2][fx->curPos[2]]; + + fx->line[0][fx->curPos[0]] = ((lv * fx->feedbackGain[0]) >> 7) + *lp; + fx->line[1][fx->curPos[1]] = ((rv * fx->feedbackGain[1]) >> 7) + *rp; + fx->line[2][fx->curPos[2]] = ((sv * fx->feedbackGain[2]) >> 7) + *sp; + + if (++fx->curPos[0] >= fx->length[0]) { + fx->curPos[0] = 0; + } + + if (++fx->curPos[1] >= fx->length[1]) { + fx->curPos[1] = 0; + } + + if (++fx->curPos[2] >= fx->length[2]) { + fx->curPos[2] = 0; + } + + *lp++ = (lv * fx->outGain[0]) >> 7; + *rp++ = (rv * fx->outGain[1]) >> 7; + *sp++ = (sv * fx->outGain[2]) >> 7; + } +} + +static BOOL __AllocDelayLine(AXFX_DELAY* fx) { + int i; + + for (i = 0; i < LENGTHOF(fx->line); i++) { + fx->line[i] = __AXFXAlloc(fx->length[i] * sizeof(s32)); + if (fx->line[i] == NULL) { + return FALSE; + } + } + + return TRUE; +} + +static void __FreeDelayLine(AXFX_DELAY* fx) { + int i; + + for (i = 0; i < LENGTHOF(fx->line); i++) { + if (fx->line[i] != NULL) { + __AXFXFree(fx->line[i]); + fx->line[i] = NULL; + } + } +} + +static BOOL __InitParams(AXFX_DELAY* fx) { + int i; + + for (i = 0; i < LENGTHOF(fx->line); i++) { + if (fx->feedback[i] >= 100) { + return FALSE; + } + + if (fx->output[i] > 100) { + return FALSE; + } + + if (fx->line[i] == NULL) { + return FALSE; + } + + memset(fx->line[i], 0, fx->length[i] * sizeof(s32)); + fx->curPos[i] = 0; + + fx->feedbackGain[i] = 128.0f * fx->feedback[i] / 100.0f; + fx->outGain[i] = 128.0f * fx->output[i] / 100.0f; + } + + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXHooks.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXHooks.c new file mode 100644 index 0000000000..ee2dd33da6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXHooks.c @@ -0,0 +1,26 @@ +#include +#include + +static void* __AXFXAllocFunction(size_t size); +static void __AXFXFreeFunction(void* block); + +AXFXAllocHook __AXFXAlloc = __AXFXAllocFunction; +AXFXFreeHook __AXFXFree = __AXFXFreeFunction; + +static void* __AXFXAllocFunction(size_t size) { + return OSAllocFromHeap(__OSCurrHeap, size); +} + +static void __AXFXFreeFunction(void* block) { + OSFreeToHeap(__OSCurrHeap, block); +} + +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free) { + __AXFXAlloc = alloc; + __AXFXFree = free; +} + +void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free) { + *alloc = __AXFXAlloc; + *free = __AXFXFree; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXLfoTable.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXLfoTable.c new file mode 100644 index 0000000000..d43c388118 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXLfoTable.c @@ -0,0 +1,28 @@ +#include + +extern s32 __SinTableFixedPoint[128]; + +s32* __AXFXGetLfoSinTable(void) { + return __SinTableFixedPoint; +} + +static s32 __SinTableFixedPoint[128] = { + 0, 411733, 823219, 1234208, 1644454, 2053710, 2461728, + 2868264, 3273072, 3675908, 4076531, 4474698, 4870168, 5262706, + 5652074, 6038037, 6420363, 6798821, 7173184, 7543226, 7908725, + 8269460, 8625213, 8975771, 9320922, 9660459, 9994176, 10321874, + 10643354, 10958422, 11266890, 11568571, 11863283, 12150850, 12431098, + 12703857, 12968963, 13226258, 13475586, 13716797, 13949746, 14174291, + 14390299, 14597637, 14796184, 14985817, 15166424, 15337895, 15500126, + 15653022, 15796488, 15930440, 16054795, 16169479, 16274424, 16369565, + 16454847, 16530216, 16595628, 16651044, 16696429, 16731757, 16757007, + 16772163, 16777216, 16772163, 16757007, 16731757, 16696429, 16651043, + 16595628, 16530216, 16454846, 16369565, 16274424, 16169479, 16054794, + 15930439, 15796488, 15653022, 15500126, 15337894, 15166424, 14985817, + 14796183, 14597638, 14390298, 14174290, 13949744, 13716797, 13475586, + 13226257, 12968964, 12703856, 12431096, 12150848, 11863283, 11568570, + 11266888, 10958422, 10643353, 10321872, 9994173, 9660458, 9320921, + 8975768, 8625213, 8269458, 7908723, 7543227, 7173183, 6798819, + 6420360, 6038037, 5652073, 5262704, 4870169, 4474697, 4076529, + 3675906, 3273072, 2868263, 2461726, 2053710, 1644454, 1234206, + 823215, 411733}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHi.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHi.c new file mode 100644 index 0000000000..12618f9f8f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHi.c @@ -0,0 +1,45 @@ +#include + +static void __ParamConvert(AXFX_REVERBHI* fx); + +u32 AXFXReverbHiGetMemSize(AXFX_REVERBHI* fx) { + fx->exp.preDelayTimeMax = fx->preDelay; + return AXFXReverbHiExpGetMemSize(&fx->exp); +} + +BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx) { + __ParamConvert(fx); + return AXFXReverbHiExpInit(&fx->exp); +} + +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx) { + AXFXReverbHiExpShutdown(&fx->exp); + return TRUE; +} + +BOOL AXFXReverbHiSettings(AXFX_REVERBHI* fx) { + __ParamConvert(fx); + return AXFXReverbHiExpSettings(&fx->exp); +} + +void AXFXReverbHiCallback(void* chans, void* context) { + AXFXReverbHiExpCallback((AXFX_BUFFERUPDATE*)chans, + (AXFX_REVERBHI_EXP*)context); +} + +static void __ParamConvert(AXFX_REVERBHI* fx) { + fx->exp.earlyMode = 5; + fx->exp.preDelayTimeMax = fx->preDelay; + fx->exp.preDelayTime = fx->preDelay; + fx->exp.fusedMode = 0; + fx->exp.fusedTime = fx->time; + fx->exp.coloration = fx->coloration; + fx->exp.damping = fx->damping; + fx->exp.crosstalk = fx->crosstalk; + fx->exp.earlyGain = 0.0f; + fx->exp.fusedGain = 1.0f; + fx->exp.busIn = NULL; + fx->exp.busOut = NULL; + fx->exp.outGain = fx->mix; + fx->exp.sendGain = 0.0f; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHiDpl2.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHiDpl2.c new file mode 100644 index 0000000000..96e68fbbc9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXReverbHiDpl2.c @@ -0,0 +1,50 @@ +#include +#include + +static void __ParamConvert(AXFX_REVERBHI_DPL2* fx); + +u32 AXFXReverbHiGetMemSizeDpl2(AXFX_REVERBHI_DPL2* fx) { + fx->exp.preDelayTimeMax = fx->preDelay; + return AXFXReverbHiExpGetMemSizeDpl2(&fx->exp); +} + +BOOL AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* fx) { + if (AXGetMode() != AX_OUTPUT_DPL2) { + return FALSE; + } + + __ParamConvert(fx); + return AXFXReverbHiExpInitDpl2(&fx->exp); +} + +BOOL AXFXReverbHiShutdownDpl2(AXFX_REVERBHI_DPL2* fx) { + AXFXReverbHiExpShutdownDpl2(&fx->exp); + return TRUE; +} + +BOOL AXFXReverbHiSettingsDpl2(AXFX_REVERBHI_DPL2* fx) { + __ParamConvert(fx); + return AXFXReverbHiExpSettingsDpl2(&fx->exp); +} + +void AXFXReverbHiCallbackDpl2(void* chans, void* context) { + AXFXReverbHiExpCallbackDpl2((AXFX_BUFFERUPDATE_DPL2*)chans, + (AXFX_REVERBHI_EXP_DPL2*)context); +} + +static void __ParamConvert(AXFX_REVERBHI_DPL2* fx) { + fx->exp.earlyMode = 5; + fx->exp.preDelayTimeMax = fx->preDelay; + fx->exp.preDelayTime = fx->preDelay; + fx->exp.fusedMode = 0; + fx->exp.fusedTime = fx->time; + fx->exp.coloration = fx->coloration; + fx->exp.damping = fx->damping; + fx->exp.crosstalk = fx->crosstalk; + fx->exp.earlyGain = 0.0f; + fx->exp.fusedGain = 1.0f; + fx->exp.busIn = NULL; + fx->exp.busOut = NULL; + fx->exp.outGain = fx->mix; + fx->exp.sendGain = 0.0f; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXSrcCoef.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXSrcCoef.c new file mode 100644 index 0000000000..c016c821bf --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/AXFX/AXFXSrcCoef.c @@ -0,0 +1,137 @@ +#include + +extern f32 __SrcTab12khz[128][4]; + +f32* __AXFXGetSrcCoef(u32 i) { + return __SrcTab12khz[i]; +} + +static f32 __SrcTab12khz[128][4] = { + {0.09750366211f, 0.80221557617f, 0.10159301758f, -0.00097656250f}, + {0.09350585938f, 0.80203247070f, 0.10580444336f, -0.00103759766f}, + {0.08959960938f, 0.80169677734f, 0.11010742188f, -0.00115966797f}, + {0.08578491211f, 0.80117797852f, 0.11447143555f, -0.00128173828f}, + {0.08203125000f, 0.80047607422f, 0.11892700195f, -0.00140380859f}, + {0.07836914062f, 0.79962158203f, 0.12347412109f, -0.00152587891f}, + {0.07479858398f, 0.79861450195f, 0.12814331055f, -0.00164794922f}, + {0.07135009766f, 0.79742431641f, 0.13287353516f, -0.00177001953f}, + {0.06796264648f, 0.79605102539f, 0.13769531250f, -0.00192260742f}, + {0.06469726562f, 0.79452514648f, 0.14260864258f, -0.00204467773f}, + {0.06149291992f, 0.79284667969f, 0.14761352539f, -0.00219726562f}, + {0.05834960938f, 0.79098510742f, 0.15270996094f, -0.00231933594f}, + {0.05532836914f, 0.78894042969f, 0.15789794922f, -0.00247192383f}, + {0.05236816406f, 0.78674316406f, 0.16317749023f, -0.00265502930f}, + {0.04949951172f, 0.78442382812f, 0.16851806641f, -0.00280761719f}, + {0.04672241211f, 0.78189086914f, 0.17398071289f, -0.00299072266f}, + {0.04400634766f, 0.77920532227f, 0.17950439453f, -0.00314331055f}, + {0.04141235352f, 0.77636718750f, 0.18511962891f, -0.00332641602f}, + {0.03887939453f, 0.77337646484f, 0.19082641602f, -0.00350952148f}, + {0.03640747070f, 0.77023315430f, 0.19659423828f, -0.00369262695f}, + {0.03402709961f, 0.76693725586f, 0.20248413086f, -0.00387573242f}, + {0.03173828125f, 0.76348876953f, 0.20843505859f, -0.00405883789f}, + {0.02951049805f, 0.75985717773f, 0.21444702148f, -0.00427246094f}, + {0.02737426758f, 0.75610351562f, 0.22055053711f, -0.00445556641f}, + {0.02529907227f, 0.75219726562f, 0.22674560547f, -0.00466918945f}, + {0.02331542969f, 0.74816894531f, 0.23300170898f, -0.00485229492f}, + {0.02139282227f, 0.74398803711f, 0.23931884766f, -0.00506591797f}, + {0.01956176758f, 0.73965454102f, 0.24572753906f, -0.00531005859f}, + {0.01779174805f, 0.73519897461f, 0.25219726562f, -0.00552368164f}, + {0.01605224609f, 0.73059082031f, 0.25872802734f, -0.00570678711f}, + {0.01440429688f, 0.72586059570f, 0.26535034180f, -0.00592041016f}, + {0.01281738281f, 0.72100830078f, 0.27203369141f, -0.00616455078f}, + {0.01132202148f, 0.71600341797f, 0.27877807617f, -0.00637817383f}, + {0.00988769531f, 0.71090698242f, 0.28558349609f, -0.00656127930f}, + {0.00851440430f, 0.70565795898f, 0.29244995117f, -0.00677490234f}, + {0.00720214844f, 0.70031738281f, 0.29934692383f, -0.00701904297f}, + {0.00592041016f, 0.69485473633f, 0.30633544922f, -0.00723266602f}, + {0.00469970703f, 0.68927001953f, 0.31338500977f, -0.00741577148f}, + {0.00357055664f, 0.68356323242f, 0.32046508789f, -0.00762939453f}, + {0.00247192383f, 0.67773437500f, 0.32760620117f, -0.00787353516f}, + {0.00143432617f, 0.67184448242f, 0.33477783203f, -0.00808715820f}, + {0.00045776367f, 0.66583251953f, 0.34197998047f, -0.00827026367f}, + {-0.00048828125f, 0.65972900391f, 0.34924316406f, -0.00845336914f}, + {-0.00134277344f, 0.65353393555f, 0.35656738281f, -0.00863647461f}, + {-0.00216674805f, 0.64721679688f, 0.36389160156f, -0.00885009766f}, + {-0.00296020508f, 0.64083862305f, 0.37127685547f, -0.00903320312f}, + {-0.00369262695f, 0.63433837891f, 0.37869262695f, -0.00921630859f}, + {-0.00436401367f, 0.62777709961f, 0.38613891602f, -0.00933837891f}, + {-0.00497436523f, 0.62115478516f, 0.39361572266f, -0.00949096680f}, + {-0.00558471680f, 0.61444091797f, 0.40109252930f, -0.00964355469f}, + {-0.00613403320f, 0.60763549805f, 0.40859985352f, -0.00979614258f}, + {-0.00665283203f, 0.60076904297f, 0.41610717773f, -0.00991821289f}, + {-0.00714111328f, 0.59384155273f, 0.42364501953f, -0.01000976562f}, + {-0.00756835938f, 0.58685302734f, 0.43121337891f, -0.01013183594f}, + {-0.00796508789f, 0.57977294922f, 0.43875122070f, -0.01022338867f}, + {-0.00833129883f, 0.57266235352f, 0.44631958008f, -0.01028442383f}, + {-0.00866699219f, 0.56552124023f, 0.45388793945f, -0.01034545898f}, + {-0.00897216797f, 0.55831909180f, 0.46145629883f, -0.01040649414f}, + {-0.00921630859f, 0.55105590820f, 0.46902465820f, -0.01040649414f}, + {-0.00946044922f, 0.54373168945f, 0.47659301758f, -0.01040649414f}, + {-0.00967407227f, 0.53640747070f, 0.48413085938f, -0.01037597656f}, + {-0.00985717773f, 0.52902221680f, 0.49166870117f, -0.01037597656f}, + {-0.01000976562f, 0.52160644531f, 0.49917602539f, -0.01031494141f}, + {-0.01013183594f, 0.51416015625f, 0.50668334961f, -0.01025390625f}, + {-0.01025390625f, 0.50668334961f, 0.51416015625f, -0.01013183594f}, + {-0.01031494141f, 0.49917602539f, 0.52160644531f, -0.01000976562f}, + {-0.01037597656f, 0.49166870117f, 0.52902221680f, -0.00985717773f}, + {-0.01037597656f, 0.48413085938f, 0.53640747070f, -0.00967407227f}, + {-0.01040649414f, 0.47659301758f, 0.54373168945f, -0.00946044922f}, + {-0.01040649414f, 0.46902465820f, 0.55105590820f, -0.00921630859f}, + {-0.01040649414f, 0.46145629883f, 0.55831909180f, -0.00897216797f}, + {-0.01034545898f, 0.45388793945f, 0.56552124023f, -0.00866699219f}, + {-0.01028442383f, 0.44631958008f, 0.57266235352f, -0.00833129883f}, + {-0.01022338867f, 0.43875122070f, 0.57977294922f, -0.00796508789f}, + {-0.01013183594f, 0.43121337891f, 0.58685302734f, -0.00756835938f}, + {-0.01000976562f, 0.42364501953f, 0.59384155273f, -0.00714111328f}, + {-0.00991821289f, 0.41610717773f, 0.60076904297f, -0.00665283203f}, + {-0.00979614258f, 0.40859985352f, 0.60763549805f, -0.00613403320f}, + {-0.00964355469f, 0.40109252930f, 0.61444091797f, -0.00558471680f}, + {-0.00949096680f, 0.39361572266f, 0.62115478516f, -0.00497436523f}, + {-0.00933837891f, 0.38613891602f, 0.62777709961f, -0.00436401367f}, + {-0.00921630859f, 0.37869262695f, 0.63433837891f, -0.00369262695f}, + {-0.00903320312f, 0.37127685547f, 0.64083862305f, -0.00296020508f}, + {-0.00885009766f, 0.36389160156f, 0.64721679688f, -0.00216674805f}, + {-0.00863647461f, 0.35656738281f, 0.65353393555f, -0.00134277344f}, + {-0.00845336914f, 0.34924316406f, 0.65972900391f, -0.00048828125f}, + {-0.00827026367f, 0.34197998047f, 0.66583251953f, 0.00045776367f}, + {-0.00808715820f, 0.33477783203f, 0.67184448242f, 0.00143432617f}, + {-0.00787353516f, 0.32760620117f, 0.67773437500f, 0.00247192383f}, + {-0.00762939453f, 0.32046508789f, 0.68356323242f, 0.00357055664f}, + {-0.00741577148f, 0.31338500977f, 0.68927001953f, 0.00469970703f}, + {-0.00723266602f, 0.30633544922f, 0.69485473633f, 0.00592041016f}, + {-0.00701904297f, 0.29934692383f, 0.70031738281f, 0.00720214844f}, + {-0.00677490234f, 0.29244995117f, 0.70565795898f, 0.00851440430f}, + {-0.00656127930f, 0.28558349609f, 0.71090698242f, 0.00988769531f}, + {-0.00637817383f, 0.27877807617f, 0.71600341797f, 0.01132202148f}, + {-0.00616455078f, 0.27203369141f, 0.72100830078f, 0.01281738281f}, + {-0.00592041016f, 0.26535034180f, 0.72586059570f, 0.01440429688f}, + {-0.00570678711f, 0.25872802734f, 0.73059082031f, 0.01605224609f}, + {-0.00552368164f, 0.25219726562f, 0.73519897461f, 0.01779174805f}, + {-0.00531005859f, 0.24572753906f, 0.73965454102f, 0.01956176758f}, + {-0.00506591797f, 0.23931884766f, 0.74398803711f, 0.02139282227f}, + {-0.00485229492f, 0.23300170898f, 0.74816894531f, 0.02331542969f}, + {-0.00466918945f, 0.22674560547f, 0.75219726562f, 0.02529907227f}, + {-0.00445556641f, 0.22055053711f, 0.75610351562f, 0.02737426758f}, + {-0.00427246094f, 0.21444702148f, 0.75985717773f, 0.02951049805f}, + {-0.00405883789f, 0.20843505859f, 0.76348876953f, 0.03173828125f}, + {-0.00387573242f, 0.20248413086f, 0.76693725586f, 0.03402709961f}, + {-0.00369262695f, 0.19659423828f, 0.77023315430f, 0.03640747070f}, + {-0.00350952148f, 0.19082641602f, 0.77337646484f, 0.03887939453f}, + {-0.00332641602f, 0.18511962891f, 0.77636718750f, 0.04141235352f}, + {-0.00314331055f, 0.17950439453f, 0.77920532227f, 0.04400634766f}, + {-0.00299072266f, 0.17398071289f, 0.78189086914f, 0.04672241211f}, + {-0.00280761719f, 0.16851806641f, 0.78442382812f, 0.04949951172f}, + {-0.00265502930f, 0.16317749023f, 0.78674316406f, 0.05236816406f}, + {-0.00247192383f, 0.15789794922f, 0.78894042969f, 0.05532836914f}, + {-0.00231933594f, 0.15270996094f, 0.79098510742f, 0.05834960938f}, + {-0.00219726562f, 0.14761352539f, 0.79284667969f, 0.06149291992f}, + {-0.00204467773f, 0.14260864258f, 0.79452514648f, 0.06469726562f}, + {-0.00192260742f, 0.13769531250f, 0.79605102539f, 0.06796264648f}, + {-0.00177001953f, 0.13287353516f, 0.79742431641f, 0.07135009766f}, + {-0.00164794922f, 0.12814331055f, 0.79861450195f, 0.07479858398f}, + {-0.00152587891f, 0.12347412109f, 0.79962158203f, 0.07836914062f}, + {-0.00140380859f, 0.11892700195f, 0.80047607422f, 0.08203125000f}, + {-0.00128173828f, 0.11447143555f, 0.80117797852f, 0.08578491211f}, + {-0.00115966797f, 0.11010742188f, 0.80169677734f, 0.08959960938f}, + {-0.00103759766f, 0.10580444336f, 0.80203247070f, 0.09350585938f}, + {-0.00097656250f, 0.10159301758f, 0.80221557617f, 0.09750366211f}}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/BASE/PPCArch.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/BASE/PPCArch.c new file mode 100644 index 0000000000..c076f2f16b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/BASE/PPCArch.c @@ -0,0 +1,219 @@ +#include +#include + +asm u32 PPCMfmsr(void) { + // clang-format off + nofralloc + mfmsr r3 + blr + // clang-format on +} + +asm void PPCMtmsr(register u32 val) { + // clang-format off + nofralloc + mtmsr val + blr + // clang-format on +} + +asm u32 PPCMfhid0(void) { + // clang-format off + nofralloc + mfhid0 r3 + blr + // clang-format on +} + +asm void PPCMthid0(register u32 val) { + // clang-format off + nofralloc + mthid0 val + blr + // clang-format on +} + +asm u32 PPCMfl2cr(void) { + // clang-format off + nofralloc + mfl2cr r3 + blr + // clang-format on +} + +asm void PPCMtl2cr(register u32 val) { + // clang-format off + nofralloc + mtl2cr val + blr + // clang-format on +} + +asm void PPCMtdec(register u32 val) { + // clang-format off + nofralloc + mtdec val + blr + // clang-format on +} + +asm void PPCSync(void) { + // clang-format off + nofralloc + sc + blr + // clang-format on +} + +asm void PPCHalt(void) { + // clang-format off + nofralloc + sync + +loop: + nop + li r3, 0 + nop + b loop + // clang-format on +} + +asm void PPCMtmmcr0(register u32 val) { + // clang-format off + nofralloc + mtmmcr0 val + blr + // clang-format on +} + +asm void PPCMtmmcr1(register u32 val) { + // clang-format off + nofralloc + mtmmcr1 val + blr + // clang-format on +} + +asm void PPCMtpmc1(register u32 val) { + // clang-format off + nofralloc + mtpmc1 val + blr + // clang-format on +} + +asm void PPCMtpmc2(register u32 val) { + // clang-format off + nofralloc + mtpmc2 val + blr + // clang-format on +} + +asm void PPCMtpmc3(register u32 val) { + // clang-format off + nofralloc + mtpmc3 val + blr + // clang-format on +} + +asm void PPCMtpmc4(register u32 val){ + // clang-format off + nofralloc + mtpmc4 val + blr + // clang-format on +} + +u32 PPCMffpscr(void) { + // clang-format off + register u64 fpscr; + asm { + mffs f31 + stfd f31, fpscr + } + + return fpscr; + // clang-format on +} + +void PPCMtfpscr(register u32 val) { + // clang-format off + register struct { + f32 tmp; + f32 data; + } fpscr; + + asm { + li r4, 0 + stw val, fpscr.data + stw r4, fpscr.tmp + lfd f31, fpscr.tmp + mtfs f31 + } + // clang-format on +} + +asm u32 PPCMfhid2(void) { + // clang-format off + nofralloc + mfspr r3, 0x398 + blr + // clang-format on +} + +asm void PPCMthid2(register u32 val) { + // clang-format off + nofralloc + mtspr 0x398, val + blr + // clang-format on +} + +asm u32 PPCMfwpar(void) { + // clang-format off + nofralloc + sync + mfwpar r3 + blr + // clang-format on +} + +asm void PPCMtwpar(register u32 val) { + // clang-format off + nofralloc + mtwpar r3 + blr + // clang-format on +} + +void PPCDisableSpeculation(void) { + PPCMthid0(PPCMfhid0() | HID0_SPD); +} + +asm void PPCSetFpNonIEEEMode(void) { + // clang-format off + nofralloc + mtfsb1 29 + blr + // clang-format on +} + +void PPCMthid4(register u32 val) { + if (val & HID4_H4A) { + // clang-format off + asm { + mtspr 0x3F3, val + } + // clang-format on + } else { + OSReport("H4A should not be cleared because of Broadway errata.\n"); + val |= HID4_H4A; + // clang-format off + asm { + mtspr 0x3F3, val + } + // clang-format on + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/CNT/cnt.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/CNT/cnt.c new file mode 100644 index 0000000000..9f9416dd7c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/CNT/cnt.c @@ -0,0 +1,90 @@ +#include +#include +#include + +static s32 __CNTConvertErrorCode(s32 error) { + int i; + + // TODO: Placed in the wrong ELF section + const s32 errorMap[] = { + 0x0000, 0x0000, -0x03E9, -0x13C7, -0x03EA, -0x13C7, -0x03EB, -0x13C7, + -0x03EC, -0x138A, -0x03ED, -0x13C7, -0x03EE, -0x13C7, -0x03EF, -0x13C7, + -0x03F0, -0x138A, -0x03F1, -0x138B, -0x03F2, -0x13C7, -0x03F3, -0x13C7, + -0x03F4, -0x13C7, -0x03F5, -0x13C7, -0x03F6, -0x13C7, -0x03F7, -0x13C7, + -0x03F8, -0x1388, -0x03F9, -0x1391, -0x03FA, -0x13C7, -0x03FB, -0x13C7, + -0x03FC, -0x13C7, -0x03FD, -0x13C7, -0x03FE, -0x13C7, -0x03FF, -0x13C7, + -0x0400, -0x1390, -0x0401, -0x13C7, -0x0402, -0x1392, -0x0403, -0x13C7, + -0x0404, -0x13C7, -0x0405, -0x13C7, -0x0406, -0x13C7, -0x0407, -0x13C7, + -0x0408, -0x13C7, -0x0409, -0x13C7, -0x040A, -0x13C7, -0x040B, -0x13C7, + -0x040C, -0x13C7, -0x040D, -0x13C7, -0x040E, -0x13C7, 0x0000, 0x0000, + -0x0066, -0x1392, -0x0067, -0x1393, -0x0072, -0x1394, -0x0069, -0x13C7, + -0x0074, -0x1395, -0x0065, -0x1391, -0x006C, -0x13C7, -0x006D, -0x1388, + -0x006B, -0x13C7, -0x006A, -0x1391, -0x0073, -0x13C7, -0x0068, -0x13C7, + -0x006F, -0x13C7, -0x0075, -0x13C7, -0x0076, -0x13C7, -0x0077, -0x1407, + -0x0001, -0x1392, -0x0002, -0x13C7, -0x0003, -0x13C7, -0x0004, -0x1391, + -0x0005, -0x13C7, -0x0006, -0x1391, -0x0007, -0x13C7, -0x0008, -0x13C7, + -0x0009, -0x13C7, -0x000A, -0x13C7, -0x000B, -0x13C7, -0x000C, -0x1394, + -0x000D, -0x13C7, -0x000E, -0x13C7, -0x000F, -0x13C7, -0x0010, -0x13C7, + -0x0011, -0x13C7, -0x0012, -0x13C7, -0x0013, -0x13C7, -0x0014, -0x13C7, + -0x0015, -0x13C7, -0x0016, -0x1389, -0x0017, -0x13C7, + }; + + i = 0; + + if (error >= 0) { + return error; + } + + for (; i < LENGTHOF(errorMap); i += 2) { + if (error == errorMap[i]) { + return errorMap[i + 1]; + } + } + + OSReport("CAUTION! Unexpected error code [%d] was found.\n", error); + return -0x13C7; +} + +s32 contentFastOpenNAND(CNTHandle* handle, s32 entrynum, CNTFileInfo* info) { + ARCFileInfo arcInfo; + + if (!ARCFastOpen(&handle->arcHandle, entrynum, &arcInfo)) { + return -0x138A; + } + + info->handle = handle; + info->offset = arcInfo.offset; + info->length = arcInfo.size; + info->position = 0; + + return 0; +} + +s32 contentConvertPathToEntrynumNAND(CNTHandle* handle, const char* path) { + return ARCConvertPathToEntrynum(&handle->arcHandle, path); +} + +u32 contentGetLengthNAND(const CNTFileInfo* info) { + return info->length; +} + +s32 contentReadNAND(CNTFileInfo* info, void* dst, u32 len, s32 offset) { + if (info->position + offset > info->length) { + return -0x1391; + } + + if (ESP_SeekContentFile(info->handle->fd, + info->offset + info->position + offset, + IPC_SEEK_BEG) < 0) { + return -0x138C; + } + + return __CNTConvertErrorCode( + ESP_ReadContentFile(info->handle->fd, dst, len)); +} + +s32 contentCloseNAND(CNTFileInfo* info) { +#pragma unused(info) + + return 0; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DB/db.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DB/db.c new file mode 100644 index 0000000000..b60d8257c8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DB/db.c @@ -0,0 +1,42 @@ +#include +#include +#include + +BOOL DBVerbose; +OSDebugInterface* __DBInterface; + +void DBInit(void) { + __DBInterface = + (OSDebugInterface*)OSPhysicalToCached(OS_PHYS_DEBUG_INTERFACE); + __DBInterface->exceptionHook = OSCachedToPhysical(__DBExceptionDestination); + DBVerbose = TRUE; +} + +void __DBExceptionDestinationAux(void) { + const void* physCtx = (void*)OS_PHYS_CURRENT_CONTEXT_PHYS; + OSContext* ctx = (OSContext*)OSPhysicalToCached(*(u32*)physCtx); + OSReport("DBExceptionDestination\n"); + OSDumpContext(ctx); + PPCHalt(); +} + +asm void __DBExceptionDestination(void){ + // clang-format off + nofralloc + + // Set up MMU + mfmsr r3 + ori r3, r3, (MSR_IR | MSR_DR) + mtmsr r3 + + b __DBExceptionDestinationAux + // clang-format on +} + +BOOL __DBIsExceptionMarked(u8 exc) { + return __DBInterface->exceptionMask & (1 << exc); +} + +void DBPrintf(const char* msg, ...) { +#pragma unused(msg) +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp.c new file mode 100644 index 0000000000..d25e0b21b4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp.c @@ -0,0 +1,123 @@ +#include +#include + +const char* __DSPVersion = + "<< RVL_SDK - DSP \trelease build: Nov 30 2006 03:26:46 (0x4199_60831) >>"; + +static BOOL __DSP_init_flag = FALSE; + +BOOL DSPCheckMailToDSP(void) { + return (DSP_HW_REGS[DSP_DSPMBOX_H] & DSP_DSPMBOX_H_STATUS) != 0; +} + +BOOL DSPCheckMailFromDSP(void) { + return (DSP_HW_REGS[DSP_CPUMBOX_H] & DSP_CPUMBOX_H_STATUS) != 0; +} + +DSPMail DSPReadMailFromDSP(void) { + return (DSPMail)(DSP_HW_REGS[DSP_CPUMBOX_H] << 16 | + DSP_HW_REGS[DSP_CPUMBOX_L]); +} + +void DSPSendMailToDSP(DSPMail mail) { + DSP_HW_REGS[DSP_DSPMBOX_H] = ((uintptr_t)mail) >> 16 & 0xFFFF; + DSP_HW_REGS[DSP_DSPMBOX_L] = ((uintptr_t)mail) & 0xFFFF; +} + +void DSPAssertInt(void) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + DSP_HW_REGS[DSP_CSR] = + (DSP_HW_REGS[DSP_CSR] & + ~(DSP_CSR_AIDINT | DSP_CSR_ARINT | DSP_CSR_DSPINT)) | + DSP_CSR_PIINT; + + OSRestoreInterrupts(enabled); +} + +void DSPInit(void) { + BOOL enabled; + + __DSP_debug_printf("DSPInit(): Build Date: %s %s\n", "Nov 30 2006", + "03:26:46"); + + if (__DSP_init_flag == TRUE) { + return; + } + + OSRegisterVersion(__DSPVersion); + + enabled = OSDisableInterrupts(); + + __OSSetInterruptHandler(OS_INTR_DSP_DSP, __DSPHandler); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_DSP_DSP)); + + DSP_HW_REGS[DSP_CSR] = + (DSP_HW_REGS[DSP_CSR] & + ~(DSP_CSR_AIDINT | DSP_CSR_ARINT | DSP_CSR_DSPINT)) | + DSP_CSR_RES; + + DSP_HW_REGS[DSP_CSR] &= + ~(DSP_CSR_HALT | DSP_CSR_AIDINT | DSP_CSR_ARINT | DSP_CSR_DSPINT); + + __DSP_tmp_task = NULL; + __DSP_curr_task = NULL; + __DSP_last_task = NULL; + __DSP_first_task = NULL; + + __DSP_init_flag = TRUE; + + OSRestoreInterrupts(enabled); +} + +BOOL DSPCheckInit(void) { + return __DSP_init_flag; +} + +DSPTask* DSPAddTask(DSPTask* task) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + __DSP_insert_task(task); + task->state = DSP_TASK_STATE_0; + task->flags = DSP_TASK_ACTIVE; + + OSRestoreInterrupts(enabled); + + if (task == __DSP_first_task) { + __DSP_boot_task(task); + } + + return task; +} + +DSPTask* DSPAssertTask(DSPTask* task) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + if (__DSP_curr_task == task) { + __DSP_rude_task_pending = TRUE; + __DSP_rude_task = task; + OSRestoreInterrupts(enabled); + return task; + } + + if (task->prio < __DSP_curr_task->prio) { + __DSP_rude_task_pending = TRUE; + __DSP_rude_task = task; + + if (__DSP_curr_task->state == DSP_TASK_STATE_1) { + DSPAssertInt(); + } + + OSRestoreInterrupts(enabled); + return task; + } + + OSRestoreInterrupts(enabled); + return NULL; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_debug.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_debug.c new file mode 100644 index 0000000000..cbf9e4eae7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_debug.c @@ -0,0 +1,6 @@ +#include + +// Stubbed for release +void __DSP_debug_printf(const char* fmt, ...) { +#pragma unused(fmt) +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_task.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_task.c new file mode 100644 index 0000000000..d957f4fe78 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DSP/dsp_task.c @@ -0,0 +1,333 @@ +#include +#include + +/** + * Commands to the DSP sent via the mailbox. + */ +typedef enum { + MAIL_SET_IRAM_MMEM_ADDR = 0x80F3A001, + MAIL_SET_IRAM_DSP_ADDR = 0x80F3C002, + MAIL_SET_IRAM_LENGTH = 0x80F3A002, + MAIL_SET_ARAM_MMEM_ADDR = 0x80F3B002, + MAIL_SET_START_VECTOR = 0x80F3D001 +} DSPMailCmd; + +/** + * DSP microcodes (from Dolphin Emulator) + */ +typedef enum { + TASK_MAIL_MASK = 0xFFFF0000, + TASK_MAIL_TO_CPU = 0xDCD10000, + TASK_MAIL_TO_DSP = 0xCDD10000, + + DSP_INIT = (TASK_MAIL_TO_CPU | 0x0000), + DSP_RESUME = (TASK_MAIL_TO_CPU | 0x0001), + DSP_YIELD = (TASK_MAIL_TO_CPU | 0x0002), + DSP_DONE = (TASK_MAIL_TO_CPU | 0x0003), + DSP_SYNC = (TASK_MAIL_TO_CPU | 0x0004), + DSP_FRAME_END = (TASK_MAIL_TO_CPU | 0x0005), + + MAIL_RESUME = (TASK_MAIL_TO_DSP | 0x0000), + MAIL_NEW_UCODE = (TASK_MAIL_TO_DSP | 0x0001), + MAIL_RESET = (TASK_MAIL_TO_DSP | 0x0002), + MAIL_CONTINUE = (TASK_MAIL_TO_DSP | 0x0003) +} DSPUCode; + +DSPTask* __DSP_curr_task; +DSPTask* __DSP_first_task; +DSPTask* __DSP_last_task; +DSPTask* __DSP_tmp_task; +DSPTask* __DSP_rude_task; +BOOL __DSP_rude_task_pending; + +void __DSPHandler(s16 intr, OSContext* ctx) { +#pragma unused(intr) + + OSContext tmpCtx; + u32 ucode; + + DSP_HW_REGS[DSP_CSR] = + (DSP_HW_REGS[DSP_CSR] & ~(DSP_CSR_AIDINT | DSP_CSR_ARINT)) | + DSP_CSR_DSPINT; + + OSClearContext(&tmpCtx); + OSSetCurrentContext(&tmpCtx); + + while (!DSPCheckMailFromDSP()) { + ; + } + ucode = (u32)DSPReadMailFromDSP(); + + if ((__DSP_curr_task->flags & DSP_TASK_CANCELED) && ucode == DSP_YIELD) { + ucode = DSP_DONE; + } + + switch (ucode) { + case DSP_INIT: + __DSP_curr_task->state = DSP_TASK_STATE_1; + if (__DSP_curr_task->initCallback != NULL) { + __DSP_curr_task->initCallback(__DSP_curr_task); + } + break; + case DSP_RESUME: + __DSP_curr_task->state = DSP_TASK_STATE_1; + if (__DSP_curr_task->resumeCallback != NULL) { + __DSP_curr_task->resumeCallback(__DSP_curr_task); + } + break; + case DSP_YIELD: + if (__DSP_rude_task_pending) { + if (__DSP_curr_task == __DSP_rude_task) { + DSP_SEND_MAIL_SYNC(MAIL_CONTINUE); + + __DSP_rude_task = NULL; + __DSP_rude_task_pending = FALSE; + + if (__DSP_curr_task->resumeCallback != NULL) { + __DSP_curr_task->resumeCallback(__DSP_curr_task); + } + } else { + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_exec_task(__DSP_curr_task, __DSP_rude_task); + + __DSP_curr_task->state = DSP_TASK_STATE_2; + __DSP_curr_task = __DSP_rude_task; + + __DSP_rude_task = NULL; + __DSP_rude_task_pending = FALSE; + } + } else if (__DSP_curr_task->next == NULL) { + if (__DSP_curr_task == __DSP_first_task) { + DSP_SEND_MAIL_SYNC(MAIL_CONTINUE); + + if (__DSP_curr_task->resumeCallback != NULL) { + __DSP_curr_task->resumeCallback(__DSP_curr_task); + } + } else { + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_exec_task(__DSP_curr_task, __DSP_first_task); + + __DSP_curr_task->state = DSP_TASK_STATE_2; + __DSP_curr_task = __DSP_first_task; + } + } else { + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_exec_task(__DSP_curr_task, __DSP_curr_task->next); + + __DSP_curr_task->state = DSP_TASK_STATE_2; + __DSP_curr_task = __DSP_curr_task->next; + } + break; + case DSP_DONE: + if (__DSP_rude_task_pending) { + if (__DSP_curr_task != __DSP_rude_task) { + if (__DSP_curr_task->doneCallback != NULL) { + __DSP_curr_task->doneCallback(__DSP_curr_task); + } + + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_exec_task(NULL, __DSP_rude_task); + __DSP_remove_task(__DSP_curr_task); + + __DSP_curr_task = __DSP_rude_task; + __DSP_rude_task = NULL; + __DSP_rude_task_pending = FALSE; + break; + } + + __DSP_rude_task = NULL; + __DSP_rude_task_pending = FALSE; + } + + if (__DSP_curr_task->next == NULL) { + if (__DSP_curr_task == __DSP_first_task) { + if (__DSP_curr_task->doneCallback != NULL) { + __DSP_curr_task->doneCallback(__DSP_curr_task); + } + + DSP_SEND_MAIL_SYNC(MAIL_RESET); + + __DSP_curr_task->state = DSP_TASK_STATE_3; + __DSP_remove_task(__DSP_curr_task); + + } else { + if (__DSP_curr_task->doneCallback != NULL) { + __DSP_curr_task->doneCallback(__DSP_curr_task); + } + + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_curr_task->state = DSP_TASK_STATE_3; + __DSP_exec_task(NULL, __DSP_first_task); + __DSP_curr_task = __DSP_first_task; + __DSP_remove_task(__DSP_last_task); + } + } else { + if (__DSP_curr_task->doneCallback != NULL) { + __DSP_curr_task->doneCallback(__DSP_curr_task); + } + + DSP_SEND_MAIL_SYNC(MAIL_NEW_UCODE); + + __DSP_curr_task->state = DSP_TASK_STATE_3; + __DSP_exec_task(NULL, __DSP_curr_task->next); + __DSP_curr_task = __DSP_curr_task->next; + __DSP_remove_task(__DSP_curr_task->prev); + } + break; + case DSP_SYNC: + if (__DSP_curr_task->requestCallback != NULL) { + __DSP_curr_task->requestCallback(__DSP_curr_task); + } + break; + } + + OSClearContext(&tmpCtx); + OSSetCurrentContext(ctx); +} + +void __DSP_exec_task(DSPTask* task1, DSPTask* task2) { + if (task1 != NULL) { + DSP_SEND_MAIL_SYNC(task1->dramMmemAddr); + DSP_SEND_MAIL_SYNC(task1->dramMmemLen); + DSP_SEND_MAIL_SYNC(task1->dramDspAddr); + } else { + DSP_SEND_MAIL_SYNC(0); + DSP_SEND_MAIL_SYNC(0); + DSP_SEND_MAIL_SYNC(0); + } + + DSP_SEND_MAIL_SYNC(task2->iramMmemAddr); + DSP_SEND_MAIL_SYNC(task2->iramMmemLen); + DSP_SEND_MAIL_SYNC(task2->iramDspAddr); + + if (task2->state == DSP_TASK_STATE_0) { + DSP_SEND_MAIL_SYNC(task2->startVector); + DSP_SEND_MAIL_SYNC(0); + DSP_SEND_MAIL_SYNC(0); + DSP_SEND_MAIL_SYNC(0); + } else { + DSP_SEND_MAIL_SYNC(task2->resumeVector); + DSP_SEND_MAIL_SYNC(task2->dramMmemAddr); + DSP_SEND_MAIL_SYNC(task2->dramMmemLen); + DSP_SEND_MAIL_SYNC(task2->dramDspAddr); + } +} + +void __DSP_boot_task(DSPTask* task) { + volatile DSPMail mail; + + // Sync with DSP + while (!DSPCheckMailFromDSP()) { + ; + } + mail = DSPReadMailFromDSP(); + + // Send IRAM MMEM address + DSP_SEND_MAIL_SYNC(MAIL_SET_IRAM_MMEM_ADDR); + DSP_SEND_MAIL_SYNC(task->iramMmemAddr); + + // Send IRAM DSP address + DSP_SEND_MAIL_SYNC(MAIL_SET_IRAM_DSP_ADDR); + DSP_SEND_MAIL_SYNC(task->iramDspAddr & 0xFFFF); + + // Send IRAM length + DSP_SEND_MAIL_SYNC(MAIL_SET_IRAM_LENGTH); + DSP_SEND_MAIL_SYNC(task->iramMmemLen); + + // Send ARAM MMEM address(?) + DSP_SEND_MAIL_SYNC(MAIL_SET_ARAM_MMEM_ADDR); + DSP_SEND_MAIL_SYNC(NULL); + + // Send start vector + DSP_SEND_MAIL_SYNC(MAIL_SET_START_VECTOR); + DSP_SEND_MAIL_SYNC(task->startVector); + + __DSP_debug_printf("DSP is booting task: 0x%08X\n", task); + __DSP_debug_printf("__DSP_boot_task() : IRAM MMEM ADDR: 0x%08X\n", + task->iramMmemAddr); + __DSP_debug_printf("__DSP_boot_task() : IRAM DSP ADDR : 0x%08X\n", + task->iramDspAddr); + __DSP_debug_printf("__DSP_boot_task() : IRAM LENGTH : 0x%08X\n", + task->iramMmemLen); + __DSP_debug_printf("__DSP_boot_task() : DRAM MMEM ADDR: 0x%08X\n", + task->dramMmemLen); + __DSP_debug_printf("__DSP_boot_task() : Start Vector : 0x%08X\n", + task->startVector); +} + +void __DSP_insert_task(DSPTask* task) { + DSPTask* it; + DSPTask* first; + DSPTask* prev; + + it = __DSP_first_task; + + if (__DSP_first_task == NULL) { + __DSP_first_task = __DSP_last_task = __DSP_curr_task = task; + task->next = task->prev = NULL; + return; + } + + first = __DSP_first_task; + + // Tasks sorted by priority + for (; it != NULL; it = it->next) { + if (task->prio < it->prio) { + task->prev = it->prev; + it->prev = task; + task->next = it; + + first = task; + prev = task->prev; + + if (prev == NULL) { + __DSP_first_task = first; + } else { + prev->next = task; + } + + break; + } + } + + if (it == NULL) { + __DSP_last_task->next = task; + task->next = NULL; + task->prev = __DSP_last_task; + __DSP_last_task = task; + } +} + +void __DSP_remove_task(DSPTask* task) { + task->flags = 0; + task->state = DSP_TASK_STATE_3; + + if (__DSP_first_task == task) { + if (task->next != NULL) { + __DSP_first_task = task->next; + task->next->prev = NULL; + } else { + __DSP_curr_task = NULL; + __DSP_last_task = NULL; + __DSP_first_task = NULL; + } + } else if (__DSP_last_task == task) { + __DSP_last_task = task->prev; + task->prev->next = NULL; + __DSP_curr_task = __DSP_first_task; + } else { + __DSP_curr_task = task->next; + task->prev->next = task->next; + task->next->prev = task->prev; + } +} + +// clang-format off +DECOMP_FORCEACTIVE(dsp_task_c, + "__DSP_add_task() : Added task : 0x%08X\n"); +// clang-format on diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd.c new file mode 100644 index 0000000000..e4877229ad --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd.c @@ -0,0 +1,2022 @@ +#include +#include +#include + +#include + +#define DISK_TOC_OFFSET 0x40000 +#define DISK_TOC_SIZE ROUND_UP(sizeof(DVDGameToc), 32) + +#define DISK_PART_OFFSET (DISK_TOC_OFFSET + DISK_TOC_SIZE) +#define DISK_PART_SIZE ROUND_UP(sizeof(DVDPartInfo), 32) + +#define MAX_TRANSFER_SIZE 0x80000 + +typedef void (*DVDOptionalCommandChecker)(DVDCommandBlock* block, + DVDLowCallback callback); + +typedef void (*DVDCommandState)(DVDCommandBlock* block); + +typedef enum { + NAND_ERROR_GENERIC = 0x01234567, + NAND_ERROR_TIMEOUT = 0x01234568, + NAND_ERROR_SECURITY = 0x01234569 +}; + +// High 8 bits of command result DIIMMVAL +typedef enum { + REQUEST_STATE_OK = (0 << 24), + REQUEST_STATE_COVER_OPENED = (1 << 24), + REQUEST_STATE_DISK_CHANGED = (2 << 24), + REQUEST_STATE_NO_DISK = (3 << 24), + REQUEST_STATE_MOTOR_STOPPED = (4 << 24), + REQUEST_STATE_DISK_ERROR = (5 << 24) +}; + +// Lower 24 bits of command result DIIMMVAL +typedef enum { + REQUEST_ERROR_OK = 0x000000, + REQUEST_ERROR_MOTOR_STOPPED = 0x020400, + REQUEST_ERROR_ID_NOT_READ = 0x020401, + REQUEST_ERROR_COVER_OPENED = 0x023A00, + REQUEST_ERROR_SEEK_FAIL = 0x030200, + REQUEST_ERROR_READ_FAIL = 0x031100, + REQUEST_ERROR_XFER_FAIL = 0x040800, + REQUEST_ERROR_BAD_OPCODE = 0x052000, + REQUEST_ERROR_BAD_AUDIO_BUF = 0x052001, + REQUEST_ERROR_OUT_OF_RANGE = 0x052100, + REQUEST_ERROR_BAD_FIELD = 0x052400, + REQUEST_ERROR_BAD_AUDIO_CMD = 0x052401, + REQUEST_ERROR_BAD_PERIOD = 0x052402, + REQUEST_ERROR_053000h = 0x053000, + REQUEST_ERROR_END_OF_USER = 0x056300, + REQUEST_ERROR_MEDIUM_CHANGED = 0x062800, + REQUEST_ERROR_MEDIUM_REMOVAL = 0x0B5A01 +}; + +typedef enum { + ERROR_TYPE_OK, + ERROR_TYPE_ERROR, + ERROR_TYPE_FATAL, + ERROR_TYPE_UNKNOWN +}; + +typedef enum { + COMMAND_NONE, + COMMAND_READ, + COMMAND_SEEK, + COMMAND_CHANGE_DISK, + COMMAND_BSREAD, + COMMAND_READID, + COMMAND_INITSTREAM, + COMMAND_CANCELSTREAM, + COMMAND_STOP_STREAM_AT_END, + COMMAND_REQUEST_AUDIO_ERROR, + COMMAND_REQUEST_PLAY_ADDR, + COMMAND_REQUEST_START_ADDR, + COMMAND_REQUEST_LENGTH, + COMMAND_AUDIO_BUFFER_CONFIG, + COMMAND_INQUIRY, + COMMAND_BS_CHANGE_DISK, + COMMAND_STOP_MOTOR, + + COMMAND_RESET = 32, + COMMAND_READ_UNENCRYPTED, + COMMAND_OPEN_PARTITION, + COMMAND_CLOSE_PARTITION, + COMMAND_GET_COVER_READY, + COMMAND_SET_MAX_ROTATION, + COMMAND_GET_COVER_STATUS, + COMMAND_REQUEST_ERROR, + COMMAND_GET_DISK_ID_VALID, + COMMAND_29h, + COMMAND_OPEN_PARTITION_WITH_TMD +}; + +typedef enum { + RESUME_POINT_NONE, + RESUME_POINT_WRONG_DISK_ID, + RESUME_POINT_DISK_ERROR, + RESUME_POINT_NO_DISK, + RESUME_POINT_COVER_OPENED, + RESUME_POINT_OK, + RESUME_POINT_DISK_CHANGED, + RESUME_POINT_7 // Waiting for motor to stop with no pending DVD tasks? +}; + +typedef enum { + MOTOR_STATE_WORKING, + MOTOR_STATE_PENDING_STOP, + MOTOR_STATE_STOPPED +}; + +typedef enum { PART_TYPE_DATA, PART_TYPE_UPDATE, PART_TYPE_CHANNEL }; + +typedef struct DVDBB2 { + u32 dolOffset; // at 0x0 + u32 fstOffset; // at 0x4 + u32 fstSize; // at 0x8 + u32 fstLimit; // at 0xC + char UNK_0x30[0x40 - 0x30]; +} DVDBB2; + +typedef struct DVDDiskHeader { + DVDDiskID diskID; // at 0x0 + char name[64]; // at 0x20 + u8 disableVerifyHash; // at 0x60 + u8 disableDiscEncrypt; // at 0x61 + char padding[0x400 - 0x62]; // at 0x62 + char UNK_0x400[0x20]; + DVDBB2 bb2; // at 0x420 +} DVDDiskHeader; + +typedef struct DVDPartInfo { + u32 offset; // at 0x0 + u32 type; // at 0x4 +} DVDPartInfo; + +typedef struct DVDGameToc { + u32 numPartition; // at 0x0 + u8 UNK_0x4[0x20 - 0x4]; +} DVDGameToc; + +static void defaultOptionalCommandChecker(DVDCommandBlock* block, + DVDLowCallback callback); + +const char* __DVDVersion = + "<< RVL_SDK - DVD \trelease build: Apr 24 2007 11:44:29 (0x4199_60831) >>"; + +static volatile u32 CommandInfoCounter = 0; +static volatile BOOL PauseFlag = FALSE; +static volatile BOOL PausingFlag = FALSE; +static BOOL FatalErrorFlag = FALSE; +static volatile BOOL Canceling = FALSE; +static volatile u32 ResumeFromHere = 0; +static volatile s32 NumInternalRetry = 0; +static BOOL FirstTimeInBootrom = FALSE; +static BOOL Breaking = FALSE; +static volatile BOOL WaitingForCoverOpen = FALSE; +static volatile BOOL WaitingForCoverClose = FALSE; +static BOOL MotorStopped = FALSE; +static BOOL ChangedDisc = FALSE; +static volatile BOOL PreparingCover = FALSE; +volatile u32 __DVDLayoutFormat = 0; +static BOOL DVDInitialized = FALSE; +static volatile u32 __BS2DVDLowIntType = FALSE; +static volatile BOOL Prepared = FALSE; +static DVDPartInfo* BootGameInfo = NULL; +static DVDPartInfo* PartInfo = NULL; +static DVDGameToc* GameToc = NULL; +static volatile s64 LastResetEnd = 0; +static u32 MotorState = 0; +static BOOL ResetRequired = FALSE; +static u32 LastError = 0; +static u32 CancelLastError = 0; +static DVDCommandCallback CancelCallback = NULL; +static volatile u32 CurrCommand = 0; +static OSBootInfo* bootInfo = NULL; +static DVDDiskID* IDShouldBe = NULL; +static DVDCommandBlock* executing = NULL; +DVDCommandState LastState = NULL; + +static BOOL autoInvalidation = TRUE; +static DVDOptionalCommandChecker checkOptionalCommand = + defaultOptionalCommandChecker; + +static DVDBB2 BB2 ALIGN(32); +static DVDDiskID CurrDiskID ALIGN(32); + +static OSAlarm FatalAlarm; +static OSAlarm CoverAlarm; +static OSAlarm ResetAlarm; + +static u8 GameTocBuffer[DISK_TOC_SIZE] ALIGN(32); +static u8 PartInfoBuffer[DISK_PART_SIZE] ALIGN(32); +static u8 TmdBuffer[ROUND_UP(sizeof(ESPTmd), 32)] ALIGN(64); + +static DVDCommandBlock DummyCommandBlock; +DVDCommandBlock __DVDStopMotorCommandBlock; +DVDCommandBlock __DVDRestartMotorCommandBlock; + +static void stateReadingFST(void); +static void stateError(u32 error); +static void stateTimeout(void); +static void stateSecurityError(void); +static void stateGettingError(void); +static void stateGoToRetry(void); +static void stateCheckID(void); +static void stateReadingTOC(DVDCommandBlock* block); +static void stateReadingPartitionInfo(DVDCommandBlock* block); +static void stateOpenPartition(DVDCommandBlock* block); +static void stateOpenPartition2(DVDCommandBlock* block); +static void stateCheckID2(DVDCommandBlock* block); +static void stateCoverClosed(void); +static void stateDownRotation(DVDCommandBlock* block); +static void stateCoverClosed_CMD(DVDCommandBlock* block); +static void stateMotorStopped(DVDCommandBlock* block); +static void stateReady(void); +static void stateBusy(DVDCommandBlock* block); + +static void cbForStateReadingFST(u32 intType); +static void cbForStateError(u32 intType); +static void cbForStoreErrorCode1(s32 result, s32 arg1); +static void cbForStoreErrorCode2(s32 result, s32 arg1); +static void cbForStoreErrorCode3(s32 result, s32 arg1); +static void cbForStateGettingError(u32 intType); +static void cbForUnrecoveredError(u32 intType); +static void cbForUnrecoveredErrorRetry(u32 intType); +static void cbForStateGoToRetry(u32 intType); +static void cbForStateReadingTOC(u32 intType); +static void cbForStateReadingPartitionInfo(u32 intType); +static void cbForStateOpenPartition(u32 intType); +static void cbForStateOpenPartition2(u32 intType); +static void cbForStateCheckID1(u32 intType); +static void cbForStateCheckID2(u32 intType); +static void cbForStateReset(u32 intType); +static void cbForStateDownRotation(u32 intType); +static void cbForStateCoverClosed(u32 intType); +static void cbForPrepareCoverRegister(u32 intType); +static void cbForStateMotorStopped(u32 intType); +static void cbForStateBusy(u32 intType); + +static void cbForCancelSync(s32 result, DVDCommandBlock* block); + +inline void StampCommand(u32 command, u32 param1, u32 param2) { + BOOL enabled = OSDisableInterrupts(); + + if (CommandInfoCounter >= DVD_ERROR_CMD_MAX) { + CommandInfoCounter = 0; + } + + __ErrorInfo.info[CommandInfoCounter].command = command; + __ErrorInfo.info[CommandInfoCounter].param1 = param1; + __ErrorInfo.info[CommandInfoCounter].param2 = param2; + __ErrorInfo.info[CommandInfoCounter].tick = OSGetTick(); + + CommandInfoCounter++; + OSRestoreInterrupts(enabled); +} + +DECOMP_FORCEACTIVE(dvd_c, StampCommand); + +inline void StampIntType(u32 intType) { + BOOL enabled = OSDisableInterrupts(); + + if (CommandInfoCounter <= 0) { + __ErrorInfo.info[DVD_ERROR_CMD_MAX - 1].intType = intType; + } else { + __ErrorInfo.info[CommandInfoCounter - 1].intType = intType; + } + + OSRestoreInterrupts(enabled); +} + +static void defaultOptionalCommandChecker(DVDCommandBlock* block, + DVDLowCallback callback) { +#pragma unused(block) +#pragma unused(callback) +} + +void DVDInit(void) { + DVDDiskID* diskID; + + if (!DVDInitialized) { + OSRegisterVersion(__DVDVersion); + DVDInitialized = TRUE; + + DVDLowInit(); + __DVDFSInit(); + __DVDClearWaitingQueue(); + + MotorState = MOTOR_STATE_WORKING; + bootInfo = (OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO); + IDShouldBe = &bootInfo->diskID; + + OSInitThreadQueue(&__DVDThreadQueue); + DVDLowUnmaskStatusInterrupts(); + DVDLowMaskCoverInterrupt(); + + if (bootInfo->bootMagic != OS_BOOT_MAGIC_JTAG && + bootInfo->bootMagic != OS_BOOT_MAGIC_BOOTROM) { + FirstTimeInBootrom = TRUE; + } + + memset(&__ErrorInfo, 0, sizeof(DVDErrorInfo)); + + diskID = &((OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO))->diskID; + memcpy(__ErrorInfo.game, &diskID->game, sizeof(__ErrorInfo.game)); + __ErrorInfo.disk = diskID->disk; + __ErrorInfo.version = diskID->version; + + __DVDLayoutFormat = 0; + DVDSetAutoFatalMessaging(TRUE); + } +} + +static void stateReadingFST(void) { + // UB if called? + LastState = (DVDCommandState)stateReadingFST; + + // clang-format off +#line 1035 + OS_ASSERT(bootInfo->fstSize >= BB2.fstSize, "DVDChangeDisk(): FST in the new disc is too big. "); + // clang-format on + + DVDLowClearCoverInterrupt(NULL); + + StampCommand(COMMAND_READ, BB2.fstOffset >> __DVDLayoutFormat, + ROUND_UP(BB2.fstSize << (~__DVDLayoutFormat & 2), 32)); + + DVDLowRead(bootInfo->fstStart, + ROUND_UP(BB2.fstSize << (~__DVDLayoutFormat & 2), 32), + BB2.fstOffset >> __DVDLayoutFormat, cbForStateReadingFST); +} + +static void cbForStateReadingFST(u32 intType) { + DVDCommandBlock* block; + + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + __DVDFSInit(); + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(DVD_RESULT_OK, block); + } + + stateReady(); + } else { + stateGettingError(); + } +} + +static void FatalAlarmHandler(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(alarm) +#pragma unused(ctx) + + __DVDPrintFatalMessage(); +} + +static void cbForStateError(u32 intType) { + DVDCommandBlock* block; + + if (__DVDGetAutoFatalMessaging()) { + OSCreateAlarm(&FatalAlarm); + OSSetAlarm(&FatalAlarm, 1, FatalAlarmHandler); + return; + } + + executing->state = DVD_STATE_FATAL; + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else { + FatalErrorFlag = TRUE; + + block = executing; + executing = &DummyCommandBlock; + + if (block->callback != NULL) { + block->callback(DVD_RESULT_FATAL, block); + } + + if (Canceling) { + Canceling = FALSE; + + if (CancelCallback != NULL) { + CancelCallback(DVD_RESULT_OK, block); + } + } + + stateReady(); + } +} + +static void cbForStoreErrorCode1(s32 result, s32 arg1) { +#pragma unused(result) +#pragma unused(arg1) + + DVDLowStopMotor(FALSE, FALSE, cbForStateError); +} + +static void stateError(u32 error) { + __DVDStoreErrorCode(error, cbForStoreErrorCode1); +} + +static void cbForStoreErrorCode2(s32 result, s32 arg1) { +#pragma unused(result) +#pragma unused(arg1) + + DVDLowSetSpinupFlag(FALSE); + DVDLowReset(cbForStateError); + ResetRequired = FALSE; + ResumeFromHere = RESUME_POINT_NONE; +} + +static void stateTimeout(void) { + __DVDStoreErrorCode(NAND_ERROR_TIMEOUT, cbForStoreErrorCode2); +} + +static void stateSecurityError(void) { + __DVDStoreErrorCode(NAND_ERROR_SECURITY, cbForStoreErrorCode2); +} + +static void stateGettingError(void) { + StampCommand(COMMAND_REQUEST_ERROR, 0, 0); + DVDLowRequestError(cbForStateGettingError); +} + +static u32 CategorizeError(u32 diimmval) { + if (diimmval == REQUEST_ERROR_MOTOR_STOPPED) { + LastError = diimmval; + return ERROR_TYPE_ERROR; + } + + // Mask out state bits + diimmval &= ~0xFF000000; + + if (diimmval == REQUEST_ERROR_MEDIUM_CHANGED || + diimmval == REQUEST_ERROR_COVER_OPENED || + diimmval == REQUEST_ERROR_053000h || + diimmval == REQUEST_ERROR_MEDIUM_REMOVAL) { + return ERROR_TYPE_OK; + } + + if (diimmval == REQUEST_ERROR_BAD_OPCODE && + (executing->command == COMMAND_SET_MAX_ROTATION || + LastState == stateDownRotation)) { + return ERROR_TYPE_OK; + } + + NumInternalRetry++; + + if (NumInternalRetry == 2) { + if (diimmval == LastError) { + LastError = diimmval; + return ERROR_TYPE_ERROR; + } + + LastError = diimmval; + return ERROR_TYPE_FATAL; + } + + LastError = diimmval; + + if (diimmval == REQUEST_ERROR_READ_FAIL || + executing->command == COMMAND_READID) { + return ERROR_TYPE_FATAL; + } + + return ERROR_TYPE_UNKNOWN; +} + +static BOOL CheckCancel(u32 resume) { + DVDCommandBlock* block; + + if (Canceling) { + ResumeFromHere = resume; + Canceling = FALSE; + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (CancelCallback != NULL) { + CancelCallback(DVD_RESULT_OK, block); + } + + stateReady(); + return TRUE; + } + + return FALSE; +} + +static void cbForStoreErrorCode3(s32 result, s32 arg1) { +#pragma unused(result) +#pragma unused(arg1) + + stateGoToRetry(); +} + +static void cbForStateGettingError(u32 intType) { + u32 diimmval; + u32 state; + u32 resume; + u32 category; + + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + return; + } + + if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + return; + } + + if (intType & DVD_INTTYPE_DE) { + stateError(NAND_ERROR_GENERIC); + return; + } + + diimmval = DVDLowGetImmBufferReg(); + state = diimmval & 0xFF000000; + category = CategorizeError(diimmval); + + if (category == ERROR_TYPE_ERROR) { + stateError(diimmval); + return; + } + + if (category == ERROR_TYPE_FATAL || category == ERROR_TYPE_UNKNOWN) { + resume = RESUME_POINT_NONE; + } else if (state == REQUEST_STATE_COVER_OPENED) { + resume = RESUME_POINT_COVER_OPENED; + } else if (state == REQUEST_STATE_DISK_CHANGED) { + resume = RESUME_POINT_DISK_CHANGED; + } else if (state == REQUEST_STATE_NO_DISK) { + resume = RESUME_POINT_NO_DISK; + } else if (state == REQUEST_STATE_OK) { + if (diimmval == REQUEST_ERROR_053000h) { + resume = RESUME_POINT_WRONG_DISK_ID; + } else { + resume = RESUME_POINT_OK; + } + } else { + resume = RESUME_POINT_OK; + } + + if (CheckCancel(resume)) { + return; + } + + if (category == ERROR_TYPE_FATAL) { + __DVDStoreErrorCode(diimmval, cbForStoreErrorCode3); + return; + } + + if (category == ERROR_TYPE_UNKNOWN) { + if ((diimmval & ~0xFF000000) == REQUEST_ERROR_READ_FAIL) { + StampCommand(COMMAND_SEEK, executing->offset, 0); + DVDLowSeek(executing->offset, cbForUnrecoveredError); + } else { + LastState(executing); + } + + return; + } + + if (state == REQUEST_STATE_COVER_OPENED) { + executing->state = DVD_STATE_COVER_OPENED; + stateMotorStopped(executing); + return; + } + + if (state == REQUEST_STATE_DISK_CHANGED) { + executing->state = DVD_STATE_COVER_CLOSED; + stateCoverClosed(); + return; + } + + if (state == REQUEST_STATE_NO_DISK) { + executing->state = DVD_STATE_NO_DISK; + stateMotorStopped(executing); + return; + } + + if (state == REQUEST_STATE_OK) { + if (diimmval == REQUEST_ERROR_053000h) { + StampCommand(COMMAND_STOP_MOTOR, 0, 0); + DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); + } else { + stateError(NAND_ERROR_GENERIC); + } + + return; + } + + stateError(NAND_ERROR_GENERIC); +} + +static void cbForUnrecoveredError(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + stateGoToRetry(); + } else { + StampCommand(COMMAND_REQUEST_ERROR, 0, 0); + DVDLowRequestError(cbForUnrecoveredErrorRetry); + } +} + +static void cbForUnrecoveredErrorRetry(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_DE) { + stateError(NAND_ERROR_GENERIC); + } else { + stateError(DVDLowGetImmBufferReg()); + } +} + +static void stateGoToRetry(void) { + StampCommand(COMMAND_STOP_MOTOR, 0, 0); + DVDLowStopMotor(FALSE, FALSE, cbForStateGoToRetry); +} + +static void cbForStateGoToRetry(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + return; + } + + if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + return; + } + + if (intType & DVD_INTTYPE_DE) { + stateError(NAND_ERROR_GENERIC); + return; + } + + NumInternalRetry = 0; + + if (CurrCommand == COMMAND_BSREAD || CurrCommand == COMMAND_READID || + CurrCommand == COMMAND_AUDIO_BUFFER_CONFIG || + CurrCommand == COMMAND_READ_UNENCRYPTED || + CurrCommand == COMMAND_OPEN_PARTITION || + CurrCommand == COMMAND_BS_CHANGE_DISK || + CurrCommand == COMMAND_SET_MAX_ROTATION) { + ResetRequired = TRUE; + } + + if (!CheckCancel(RESUME_POINT_DISK_ERROR)) { + executing->state = DVD_STATE_DISK_ERROR; + stateMotorStopped(executing); + } +} + +static void stateCheckID(void) { + switch (CurrCommand) { + case COMMAND_CHANGE_DISK: + ChangedDisc = FALSE; + + if (DVDCompareDiskID(&CurrDiskID, executing->id)) { + memcpy(IDShouldBe, &CurrDiskID, sizeof(DVDDiskID)); + executing->state = DVD_STATE_BUSY; + DCInvalidateRange(&BB2, sizeof(DVDBB2)); + + NumInternalRetry = 0; + stateReadingTOC(executing); + } else { + StampCommand(COMMAND_STOP_MOTOR, 0, 0); + DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); + } + break; + default: + if (memcmp(&CurrDiskID, IDShouldBe, sizeof(DVDDiskID)) != 0) { + StampCommand(COMMAND_STOP_MOTOR, 0, 0); + DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); + } else { + NumInternalRetry = 0; + stateReadingTOC(executing); + } + break; + } +} + +static void cbForStateReadingTOC(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + GameToc = (DVDGameToc*)GameTocBuffer; + stateReadingPartitionInfo(executing); + } else { + stateGettingError(); + } +} + +static void stateReadingTOC(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + + StampCommand(COMMAND_READ_UNENCRYPTED, DVD_LOW_OFFSET(DISK_TOC_OFFSET), + DISK_TOC_SIZE); + + DVDLowUnencryptedRead(GameTocBuffer, DISK_TOC_SIZE, + DVD_LOW_OFFSET(DISK_TOC_OFFSET), + cbForStateReadingTOC); +} + +static void cbForStateReadingPartitionInfo(u32 intType) { + s16 i; + + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + PartInfo = (DVDPartInfo*)PartInfoBuffer; + BootGameInfo = NULL; + + for (i = 0; i < GameToc->numPartition; PartInfo++, i++) { + if (PartInfo->type == PART_TYPE_DATA) { + BootGameInfo = PartInfo; + } + } + + if (BootGameInfo != NULL) { + switch (CurrCommand) { + case COMMAND_CHANGE_DISK: + NumInternalRetry = 0; + stateOpenPartition(executing); + break; + default: + NumInternalRetry = 0; + stateOpenPartition2(executing); + break; + } + } else if (!CheckCancel(RESUME_POINT_WRONG_DISK_ID)) { + executing->state = DVD_STATE_WRONG_DISK_ID; + stateMotorStopped(executing); + } + } else { + stateGettingError(); + } +} + +static void stateReadingPartitionInfo(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + + StampCommand(COMMAND_READ_UNENCRYPTED, DVD_LOW_OFFSET(DISK_PART_OFFSET), + DISK_PART_SIZE); + + DVDLowUnencryptedRead(PartInfoBuffer, DISK_PART_SIZE, + DVD_LOW_OFFSET(DISK_PART_OFFSET), + cbForStateReadingPartitionInfo); +} + +static void cbForStateOpenPartition(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + stateCheckID2(executing); + } else { + stateGettingError(); + } +} + +static void stateOpenPartition(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + StampCommand(COMMAND_OPEN_PARTITION, BootGameInfo->offset, 0); + DVDLowOpenPartition(BootGameInfo->offset, NULL, 0, NULL, (ESPTmd*)TmdBuffer, + cbForStateOpenPartition); +} + +static void cbForStateOpenPartition2(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + if (!CheckCancel(RESUME_POINT_NONE)) { + executing->state = DVD_STATE_BUSY; + stateBusy(executing); + } + } else { + stateGettingError(); + } +} + +static void stateOpenPartition2(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + StampCommand(COMMAND_OPEN_PARTITION, BootGameInfo->offset, 0); + DVDLowOpenPartition(BootGameInfo->offset, NULL, 0, NULL, (ESPTmd*)TmdBuffer, + cbForStateOpenPartition2); +} + +static void stateCheckID2(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + + StampCommand(COMMAND_READ, DVD_LOW_OFFSET(offsetof(DVDDiskHeader, bb2)), + sizeof(DVDBB2)); + + DVDLowRead(&BB2, sizeof(DVDBB2), + DVD_LOW_OFFSET(offsetof(DVDDiskHeader, bb2)), + cbForStateCheckID2); +} + +static void cbForStateCheckID1(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_DE) { + stateError(NAND_ERROR_GENERIC); + } else { + NumInternalRetry = 0; + if (!CheckCancel(RESUME_POINT_WRONG_DISK_ID)) { + executing->state = DVD_STATE_WRONG_DISK_ID; + stateMotorStopped(executing); + } + } +} + +static void cbForStateCheckID2(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + stateReadingFST(); + } else { + stateGettingError(); + } +} + +static void stateCoverClosed(void) { + DVDCommandBlock* block; + + MotorState = MOTOR_STATE_PENDING_STOP; + + switch (CurrCommand) { + case COMMAND_BSREAD: + case COMMAND_READID: + case COMMAND_AUDIO_BUFFER_CONFIG: + case COMMAND_BS_CHANGE_DISK: + case COMMAND_READ_UNENCRYPTED: + case COMMAND_OPEN_PARTITION: + case COMMAND_SET_MAX_ROTATION: + __DVDClearWaitingQueue(); + + block = executing; + executing = &DummyCommandBlock; + + if (block->callback != NULL) { + block->callback(DVD_RESULT_COVER_CLOSED, block); + } + + stateReady(); + break; + case COMMAND_RESET: + MotorState = MOTOR_STATE_WORKING; + // FALLTHROUGH + case COMMAND_CLOSE_PARTITION: + case COMMAND_GET_COVER_READY: + case COMMAND_GET_COVER_STATUS: + executing->state = DVD_STATE_BUSY; + stateBusy(executing); + break; + case COMMAND_READ: + case COMMAND_SEEK: + if (__OSInIPL) { + break; + } + // FALLTHROUGH + default: + MotorState = MOTOR_STATE_WORKING; + DVDLowSetSpinupFlag(TRUE); + DVDLowReset(cbForStateReset); + break; + } +} + +static void ResetAlarmHandler(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(alarm) +#pragma unused(ctx) + + if (OS_DVD_DEVICE_CODE == MAKE_DVD_DEVICE_CODE(0x0003)) { + LastState = stateDownRotation; + stateDownRotation(executing); + } else { + DCInvalidateRange(&CurrDiskID, sizeof(DVDDiskID)); + LastState = stateCoverClosed_CMD; + stateCoverClosed_CMD(executing); + } +} + +static void cbForStateReset(u32 intType) { + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + LastResetEnd = __OSGetSystemTime(); + ResetRequired = FALSE; + ResumeFromHere = RESUME_POINT_NONE; + OSCreateAlarm(&ResetAlarm); + OSSetAlarm(&ResetAlarm, OS_MSEC_TO_TICKS(100), ResetAlarmHandler); + } else { + stateGettingError(); + } +} + +static void stateDownRotation(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + StampCommand(COMMAND_SET_MAX_ROTATION, 0, 0); + DVDLowSetMaximumRotation(DVD_LOW_SPEED(2), cbForStateDownRotation); +} + +static void cbForStateDownRotation(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + DCInvalidateRange(&CurrDiskID, sizeof(DVDDiskID)); + LastState = stateCoverClosed_CMD; + stateCoverClosed_CMD(executing); + } else { + stateGettingError(); + } +} + +static void stateCoverClosed_CMD(DVDCommandBlock* block) { +#pragma unused(block) + + DVDLowClearCoverInterrupt(NULL); + + StampCommand(COMMAND_READID, + DVD_LOW_OFFSET(offsetof(DVDDiskHeader, diskID)), + sizeof(DVDDiskID)); + + DVDLowReadDiskID(&CurrDiskID, cbForStateCoverClosed); +} + +static void cbForStateCoverClosed(u32 intType) { + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + } else if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + } else if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + stateCheckID(); + } else { + stateGettingError(); + } +} + +static void cbForPrepareCoverRegister(u32 intType) { +#pragma unused(intType) + + PreparingCover = FALSE; + + if (WaitingForCoverClose) { + if ((DVDLowGetCoverRegister() & DVD_DICVR_CVR) == 0) { + OSCancelAlarm(&CoverAlarm); + WaitingForCoverClose = FALSE; + cbForStateMotorStopped(DVD_INTTYPE_CVR); + } + } else if (DVDLowGetCoverRegister() & DVD_DICVR_CVR) { + WaitingForCoverOpen = FALSE; + WaitingForCoverClose = TRUE; + + if (MotorState == MOTOR_STATE_STOPPED) { + executing->state = DVD_STATE_MOTOR_STOPPED; + } else { + executing->state = DVD_STATE_COVER_OPENED; + } + } else if (DVDLowGetCoverRegister() & DVD_DICVR_CVRINT) { + OSCancelAlarm(&CoverAlarm); + WaitingForCoverOpen = FALSE; + DVDLowClearCoverInterrupt(NULL); + cbForStateMotorStopped(DVD_INTTYPE_CVR); + } +} + +static void CoverAlarmHandler(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(alarm) +#pragma unused(ctx) + + if (!PreparingCover) { + PreparingCover = TRUE; + DVDLowPrepareCoverRegister(cbForPrepareCoverRegister); + } +} + +static void stateMotorStopped(DVDCommandBlock* block) { +#pragma unused(block) + + MotorState = MOTOR_STATE_PENDING_STOP; + + if (WaitingForCoverOpen || WaitingForCoverClose) { + return; + } + + WaitingForCoverOpen = TRUE; + + OSCreateAlarm(&CoverAlarm); + OSSetPeriodicAlarm(&CoverAlarm, OSGetTick(), OS_MSEC_TO_TICKS(100), + CoverAlarmHandler); +} + +static void cbForStateMotorStopped(u32 intType) { +#pragma unused(intType) + + WaitingForCoverClose = FALSE; + + if (CurrCommand == COMMAND_CHANGE_DISK) { + ChangedDisc = TRUE; + } + + if (MotorState == MOTOR_STATE_STOPPED) { + if (executing != NULL) { + executing->state = DVD_STATE_MOTOR_STOPPED; + } + } else { + DVDLowMaskCoverInterrupt(); + + if (executing != NULL) { + executing->state = DVD_STATE_COVER_CLOSED; + stateCoverClosed(); + } else { + ResumeFromHere = RESUME_POINT_7; + } + } +} + +static void stateReady(void) { + DVDCommandBlock* block; + + if (!__DVDCheckWaitingQueue()) { + executing = NULL; + return; + } + + if (PauseFlag) { + PausingFlag = TRUE; + executing = NULL; + return; + } + + executing = __DVDPopWaitingQueue(); + + if (FatalErrorFlag) { + executing->state = DVD_STATE_FATAL; + + block = executing; + executing = &DummyCommandBlock; + + if (block->callback != NULL) { + block->callback(DVD_RESULT_FATAL, block); + } + + stateReady(); + return; + } + + CurrCommand = executing->command; + + if (CurrCommand == COMMAND_RESET || CurrCommand == COMMAND_INQUIRY || + CurrCommand == COMMAND_CLOSE_PARTITION) { + ResumeFromHere = RESUME_POINT_NONE; + } + + if (ResumeFromHere != RESUME_POINT_NONE) { + switch (ResumeFromHere) { + case RESUME_POINT_DISK_ERROR: + executing->state = DVD_STATE_DISK_ERROR; + stateMotorStopped(executing); + break; + case RESUME_POINT_NO_DISK: + executing->state = DVD_STATE_NO_DISK; + stateMotorStopped(executing); + break; + case RESUME_POINT_COVER_OPENED: + executing->state = DVD_STATE_COVER_OPENED; + stateMotorStopped(executing); + break; + case RESUME_POINT_WRONG_DISK_ID: + case RESUME_POINT_DISK_CHANGED: + case RESUME_POINT_7: + executing->state = DVD_STATE_COVER_CLOSED; + stateCoverClosed(); + break; + case RESUME_POINT_OK: + stateError(CancelLastError); + break; + } + + ResumeFromHere = RESUME_POINT_NONE; + return; + } + + switch (MotorState) { + case MOTOR_STATE_STOPPED: + if (MotorStopped) { + executing->state = DVD_STATE_MOTOR_STOPPED; + } else { + executing->state = DVD_STATE_COVER_CLOSED; + stateCoverClosed(); + } + break; + case MOTOR_STATE_WORKING: + executing->state = DVD_STATE_BUSY; + stateBusy(executing); + break; + case MOTOR_STATE_PENDING_STOP: + default: + stateCoverClosed(); + break; + } +} + +static void stateBusy(DVDCommandBlock* block) { + DVDCommandBlock* current; + + LastState = stateBusy; + + switch (block->command) { + case COMMAND_SEEK: + case COMMAND_CHANGE_DISK: + case COMMAND_READID: + case COMMAND_AUDIO_BUFFER_CONFIG: + case COMMAND_INQUIRY: + case COMMAND_BS_CHANGE_DISK: + case COMMAND_STOP_MOTOR: + case COMMAND_OPEN_PARTITION: + case COMMAND_SET_MAX_ROTATION: + StampCommand(block->command, block->offset, block->length); + break; + default: + break; + } + + switch (block->command) { + case COMMAND_READID: + DVDLowClearCoverInterrupt(NULL); + block->transferSize = sizeof(DVDDiskID); + DVDLowReadDiskID(block->addr, cbForStateBusy); + break; + case COMMAND_READ: + case COMMAND_BSREAD: + if (block->length <= 0) { + current = executing; + executing = &DummyCommandBlock; + + current->state = DVD_STATE_IDLE; + if (current->callback != NULL) { + current->callback(DVD_RESULT_OK, current); + } + + stateReady(); + } else { + DVDLowClearCoverInterrupt(NULL); + + block->transferSize = + block->length - block->transferTotal > MAX_TRANSFER_SIZE + ? MAX_TRANSFER_SIZE + : block->length - block->transferTotal; + + StampCommand(block->command, + block->offset + DVD_LOW_OFFSET(block->transferTotal), + block->transferSize); + + DVDLowRead((char*)block->addr + block->transferTotal, + block->transferSize, + block->offset + DVD_LOW_OFFSET(block->transferTotal), + cbForStateBusy); + } + break; + case COMMAND_SEEK: + DVDLowClearCoverInterrupt(NULL); + DVDLowSeek(block->offset, cbForStateBusy); + break; + case COMMAND_CHANGE_DISK: + DVDLowStopMotor(FALSE, FALSE, cbForStateBusy); + break; + case COMMAND_BS_CHANGE_DISK: + DVDLowStopMotor(FALSE, FALSE, cbForStateBusy); + break; + case COMMAND_AUDIO_BUFFER_CONFIG: + DVDLowClearCoverInterrupt(NULL); + DVDLowAudioBufferConfig(block->offset, block->length, cbForStateBusy); + break; + case COMMAND_INQUIRY: + DVDLowClearCoverInterrupt(NULL); + block->transferSize = sizeof(DVDDriveInfo); + DVDLowInquiry(block->addr, cbForStateBusy); + break; + case COMMAND_STOP_MOTOR: + DVDLowClearCoverInterrupt(NULL); + DVDLowStopMotor(FALSE, FALSE, cbForStateBusy); + break; + case COMMAND_RESET: + DVDLowSetSpinupFlag(TRUE); + DVDLowReset(cbForStateBusy); + break; + case COMMAND_READ_UNENCRYPTED: + if (block->length <= 0) { + current = executing; + executing = &DummyCommandBlock; + + current->state = DVD_STATE_IDLE; + if (current->callback != NULL) { + current->callback(DVD_RESULT_OK, current); + } + + stateReady(); + } else { + DVDLowClearCoverInterrupt(NULL); + + block->transferSize = + block->length - block->transferTotal > MAX_TRANSFER_SIZE + ? MAX_TRANSFER_SIZE + : block->length - block->transferTotal; + + StampCommand(block->command, + block->offset + DVD_LOW_OFFSET(block->transferTotal), + block->transferSize); + + DVDLowUnencryptedRead( + (char*)block->addr + block->transferTotal, block->transferSize, + block->offset + DVD_LOW_OFFSET(block->transferTotal), + cbForStateBusy); + } + break; + case COMMAND_OPEN_PARTITION: + DVDLowClearCoverInterrupt(NULL); + DVDLowOpenPartition(block->offset, NULL, 0, NULL, block->addr, + cbForStateBusy); + break; + case COMMAND_CLOSE_PARTITION: + DVDLowClearCoverInterrupt(NULL); + DVDLowClosePartition(cbForStateBusy); + break; + case COMMAND_GET_COVER_STATUS: + DVDLowPrepareCoverRegister(cbForStateBusy); + break; + case COMMAND_GET_COVER_READY: + DVDLowPrepareCoverRegister(cbForStateBusy); + break; + case COMMAND_SET_MAX_ROTATION: + DVDLowClearCoverInterrupt(NULL); + DVDLowSetMaximumRotation(DVD_LOW_SPEED(2), cbForStateBusy); + break; + default: + checkOptionalCommand(block, cbForStateBusy); + break; + } +} + +static u32 ImmCommand[] = {-1, -1, -1}; +static BOOL IsImmCommandWithResult(u32 command) { + u32 i; + + if (command == COMMAND_REQUEST_AUDIO_ERROR || + command == COMMAND_REQUEST_PLAY_ADDR || + command == COMMAND_REQUEST_START_ADDR || + command == COMMAND_REQUEST_LENGTH) { + return TRUE; + } + + for (i = 0; i < LENGTHOF(ImmCommand); i++) { + if (command == ImmCommand[i]) { + return TRUE; + } + } + + return FALSE; +} + +static u32 DmaCommand[] = {-1}; +static BOOL IsDmaCommand(u32 command) { + u32 i; + + if (command == COMMAND_READ || command == COMMAND_BSREAD || + command == COMMAND_READID || command == COMMAND_READ_UNENCRYPTED || + command == COMMAND_INQUIRY) { + return TRUE; + } + + for (i = 0; i < LENGTHOF(DmaCommand); i++) { + if (command == DmaCommand[i]) { + return TRUE; + } + } + + return FALSE; +} + +static void cbForStateBusy(u32 intType) { + DVDCommandBlock* block; + + StampIntType(intType); + + if (intType == DVD_INTTYPE_TIME) { + stateTimeout(); + return; + } + + if (intType == DVD_INTTYPE_SERR) { + stateSecurityError(); + return; + } + + if (CurrCommand == COMMAND_CHANGE_DISK || + CurrCommand == COMMAND_BS_CHANGE_DISK) { + if (intType & DVD_INTTYPE_DE) { + stateError(NAND_ERROR_GENERIC); + } else { + NumInternalRetry = 0; + + if (CurrCommand == COMMAND_BS_CHANGE_DISK) { + ResetRequired = TRUE; + } + + if (!CheckCancel(RESUME_POINT_7) && + MotorState != MOTOR_STATE_STOPPED) { + executing->state = DVD_STATE_7; + stateMotorStopped(executing); + } + } + + return; + } + + if (IsDmaCommand(CurrCommand)) { + executing->transferTotal += intType & (DVD_INTTYPE_BR | DVD_INTTYPE_TC) + ? executing->transferSize + : 0; + } + + if (Breaking) { + Breaking = FALSE; + Canceling = FALSE; + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (CancelCallback != NULL) { + CancelCallback(DVD_RESULT_OK, block); + } + + stateReady(); + return; + } + + if (intType & DVD_INTTYPE_TC) { + NumInternalRetry = 0; + + if (CurrCommand == COMMAND_STOP_MOTOR) { + if (executing->offset > 0) { + MotorState = MOTOR_STATE_STOPPED; + } else { + MotorState = MOTOR_STATE_PENDING_STOP; + } + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(DVD_RESULT_OK, block); + } + + stateReady(); + } else if (CurrCommand == COMMAND_RESET) { + LastResetEnd = __OSGetSystemTime(); + ResetRequired = FALSE; + ResumeFromHere = RESUME_POINT_NONE; + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(DVD_RESULT_OK, block); + } + + stateReady(); + } else if (CheckCancel(RESUME_POINT_NONE)) { + return; + } else if (CurrCommand == COMMAND_GET_COVER_STATUS) { + u32 dicvr; + u32 status; + + dicvr = DVDLowGetCoverRegister(); + + if (__OSGetSystemTime() - LastResetEnd < OS_MSEC_TO_TICKS(100)) { + status = DVD_COVER_BUSY; + } else if (dicvr & DVD_DICVR_CVR) { + status = DVD_COVER_OPENED; + } else { + status = DVD_COVER_CLOSED; + } + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + block->offset = status; + + if (block->callback != NULL) { + block->callback(status, block); + } + + stateReady(); + } else if (CurrCommand == COMMAND_GET_COVER_READY) { + u32 dicvr; + BOOL busy; + + dicvr = DVDLowGetCoverRegister(); + + if ((dicvr & DVD_DICVR_CVRINT) >> 2 || (dicvr & DVD_DICVR_CVR)) { + busy = FALSE; + } else if (ResumeFromHere) { + busy = FALSE; + } else { + busy = TRUE; + } + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + block->offset = busy; + + if (block->callback != NULL) { + block->callback(busy, block); + } + + stateReady(); + } else if (IsDmaCommand(CurrCommand)) { + if (executing->transferTotal != executing->length) { + stateBusy(executing); + } else { + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(block->transferTotal, block); + } + + stateReady(); + } + } else if (IsImmCommandWithResult(CurrCommand)) { + u32 imm; + + if (CurrCommand == COMMAND_REQUEST_PLAY_ADDR || + CurrCommand == COMMAND_REQUEST_START_ADDR) { + imm = DVDLowGetImmBufferReg() << 2; + } else { + imm = DVDLowGetImmBufferReg(); + } + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(imm, block); + } + + stateReady(); + } else { + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(DVD_RESULT_OK, block); + } + + stateReady(); + } + + return; + } + + if (CurrCommand == COMMAND_INQUIRY) { + stateError(NAND_ERROR_GENERIC); + return; + } + + if ((CurrCommand == COMMAND_READ || CurrCommand == COMMAND_BSREAD || + CurrCommand == COMMAND_READID || + CurrCommand == COMMAND_READ_UNENCRYPTED || + CurrCommand == COMMAND_INQUIRY) && + executing->transferTotal == executing->length) { + if (CheckCancel(RESUME_POINT_NONE)) { + return; + } + + block = executing; + executing = &DummyCommandBlock; + + block->state = DVD_STATE_IDLE; + if (block->callback != NULL) { + block->callback(block->transferTotal, block); + } + + stateReady(); + return; + } + + stateGettingError(); +} + +static BOOL issueCommand(s32 prio, DVDCommandBlock* block) { + BOOL enabled; + BOOL success; + + if (autoInvalidation && + (block->command == COMMAND_READ || block->command == COMMAND_BSREAD || + block->command == COMMAND_READID || + block->command == COMMAND_READ_UNENCRYPTED || + block->command == COMMAND_INQUIRY)) { + DCInvalidateRange(block->addr, block->length); + } + + enabled = OSDisableInterrupts(); + + block->state = DVD_STATE_WAITING; + success = __DVDPushWaitingQueue(prio, block); + + if (executing == NULL && !PauseFlag) { + stateReady(); + } + + OSRestoreInterrupts(enabled); + return success; +} + +BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* dst, u32 size, + u32 offset, DVDCommandCallback callback, s32 prio) { + block->command = COMMAND_READ; + block->addr = dst; + block->length = size; + block->offset = offset; + block->transferTotal = 0; + block->callback = callback; + + return issueCommand(prio, block); +} + +BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info, + DVDCommandCallback callback) { + block->command = COMMAND_INQUIRY; + block->addr = info; + block->length = sizeof(DVDDriveInfo); + block->transferTotal = 0; + block->callback = callback; + + return issueCommand(DVD_PRIO_MEDIUM, block); +} + +s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) { + s32 state; + DVDCommandBlock* next; + BOOL enabled = OSDisableInterrupts(); + + if (block->state == DVD_STATE_COVER_CLOSED) { + state = DVD_STATE_BUSY; + } else if (block->state == DVD_STATE_COVER_OPENED) { + state = DVD_STATE_NO_DISK; + } else if (executing == &__DVDStopMotorCommandBlock) { + next = __DVDGetNextWaitingQueue(); + + if (next != NULL) { + if (block == next) { + state = DVD_STATE_BUSY; + } else { + state = block->state; + } + } else if (block == &__DVDStopMotorCommandBlock) { + state = DVD_STATE_IDLE; + } else { + state = block->state; + } + } else { + state = block->state; + } + + OSRestoreInterrupts(enabled); + return state; +} + +s32 DVDGetDriveStatus(void) { + BOOL enabled; + s32 state; + + enabled = OSDisableInterrupts(); + + if (FatalErrorFlag) { + state = DVD_STATE_FATAL; + } else if (PausingFlag) { + state = DVD_STATE_PAUSED; + } else if (executing == NULL) { + state = DVD_STATE_IDLE; + } else if (executing == &DummyCommandBlock) { + state = DVD_STATE_IDLE; + } else { + state = DVDGetCommandBlockStatus(executing); + } + + OSRestoreInterrupts(enabled); + return state; +} + +void DVDPause(void) { + BOOL enabled = OSDisableInterrupts(); + + PauseFlag = TRUE; + + if (executing == NULL) { + PausingFlag = TRUE; + } + + OSRestoreInterrupts(enabled); +} + +void DVDResume(void) { + BOOL enabled = OSDisableInterrupts(); + + PauseFlag = FALSE; + + if (PausingFlag) { + PausingFlag = FALSE; + stateReady(); + } + + OSRestoreInterrupts(enabled); +} + +BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback) { + BOOL enabled = OSDisableInterrupts(); + + switch (block->state) { + case DVD_STATE_FATAL: + case DVD_STATE_IDLE: + case DVD_STATE_CANCELED: + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + break; + case DVD_STATE_BUSY: + if (Canceling) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + Canceling = TRUE; + CancelCallback = callback; + + if (block->command == COMMAND_BSREAD || + block->command == COMMAND_READ_UNENCRYPTED || + block->command == COMMAND_OPEN_PARTITION || + block->command == COMMAND_READ) { + __DVDLowBreak(); + } + break; + case DVD_STATE_WAITING: + __DVDDequeueWaitingQueue(block); + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + break; + case DVD_STATE_COVER_CLOSED: + switch (block->command) { + case COMMAND_BSREAD: + case COMMAND_READID: + case COMMAND_AUDIO_BUFFER_CONFIG: + case COMMAND_BS_CHANGE_DISK: + case COMMAND_READ_UNENCRYPTED: + case COMMAND_OPEN_PARTITION: + case COMMAND_SET_MAX_ROTATION: + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + break; + case COMMAND_READ: + case COMMAND_SEEK: + if (__OSInIPL) { + executing = &DummyCommandBlock; + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + + stateReady(); + break; + } + // FALLTHROUGH + default: + if (Canceling) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + Canceling = TRUE; + CancelCallback = callback; + break; + } + break; + case DVD_STATE_NO_DISK: + case DVD_STATE_COVER_OPENED: + case DVD_STATE_WRONG_DISK_ID: + case DVD_STATE_7: + case DVD_STATE_DISK_ERROR: + if (!WaitingForCoverClose && !WaitingForCoverOpen) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + if (WaitingForCoverOpen) { + OSCancelAlarm(&CoverAlarm); + WaitingForCoverOpen = FALSE; + } + + if (block->state == DVD_STATE_NO_DISK) { + ResumeFromHere = RESUME_POINT_NO_DISK; + } + + if (block->state == DVD_STATE_COVER_OPENED) { + ResumeFromHere = RESUME_POINT_COVER_OPENED; + } + + if (block->state == DVD_STATE_WRONG_DISK_ID) { + ResumeFromHere = RESUME_POINT_WRONG_DISK_ID; + } + + if (block->state == DVD_STATE_DISK_ERROR) { + ResumeFromHere = RESUME_POINT_DISK_ERROR; + } + + if (block->state == DVD_STATE_7) { + ResumeFromHere = RESUME_POINT_7; + } + + executing = &DummyCommandBlock; + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + + stateReady(); + break; + case DVD_STATE_MOTOR_STOPPED: + executing = &DummyCommandBlock; + + block->state = DVD_STATE_CANCELED; + if (block->callback != NULL) { + block->callback(DVD_RESULT_CANCELED, block); + } + + if (callback != NULL) { + callback(DVD_RESULT_OK, block); + } + + stateReady(); + break; + } + + OSRestoreInterrupts(enabled); + return TRUE; +} + +s32 DVDCancel(DVDCommandBlock* block) { + BOOL enabled; + + if (!DVDCancelAsync(block, cbForCancelSync)) { + return DVD_RESULT_FATAL; + } + + enabled = OSDisableInterrupts(); + + while (TRUE) { + s32 state = block->state; + if (state == DVD_STATE_IDLE || state == DVD_STATE_FATAL || + state == DVD_STATE_CANCELED) { + break; + } + + if (state == DVD_STATE_COVER_CLOSED) { + u32 command = block->command; + if (command == COMMAND_BSREAD || command == COMMAND_READID || + command == COMMAND_AUDIO_BUFFER_CONFIG || + command == COMMAND_READ_UNENCRYPTED || + command == COMMAND_OPEN_PARTITION || + command == COMMAND_BS_CHANGE_DISK || + command == COMMAND_SET_MAX_ROTATION) { + break; + } + } + + OSSleepThread(&__DVDThreadQueue); + } + + OSRestoreInterrupts(enabled); + return DVD_RESULT_OK; +} + +static void cbForCancelSync(s32 result, DVDCommandBlock* block) { +#pragma unused(result) +#pragma unused(block) + + OSWakeupThread(&__DVDThreadQueue); +} + +BOOL DVDCancelAllAsync(DVDCommandCallback callback) { + BOOL success; + DVDCommandBlock* block; + BOOL enabled = OSDisableInterrupts(); + DVDPause(); + + while ((block = __DVDPopWaitingQueue()) != NULL) { + DVDCancelAsync(block, NULL); + } + + if (executing != NULL) { + success = DVDCancelAsync(executing, callback); + } else { + success = TRUE; + if (callback != NULL) { + callback(DVD_RESULT_OK, NULL); + } + } + + DVDResume(); + OSRestoreInterrupts(enabled); + return success; +} + +const DVDDiskID* DVDGetCurrentDiskID(void) { + return &((OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO))->diskID; +} + +static void __BS2DVDLowCallback(u32 intType) { + __BS2DVDLowIntType = intType; +} + +u32 __DVDGetCoverStatus(void) { + u32 dicvr; + + __BS2DVDLowIntType = 0; + DVDLowPrepareCoverRegister(__BS2DVDLowCallback); + + while (__BS2DVDLowIntType == 0) { + ; + } + + if ((__BS2DVDLowIntType & DVD_INTTYPE_TC) == 0) { + return DVD_COVER_BUSY; + } + + dicvr = DVDLowGetCoverRegister(); + + if (__OSGetSystemTime() - LastResetEnd < OS_MSEC_TO_TICKS(100)) { + return DVD_COVER_BUSY; + } + + if (dicvr & DVD_DICVR_CVR) { + return DVD_COVER_OPENED; + } + + return DVD_COVER_CLOSED; +} + +void __DVDPrepareResetAsync(DVDCommandCallback callback) { + BOOL enabled = OSDisableInterrupts(); + + __DVDClearWaitingQueue(); + + if (Canceling) { + CancelCallback = callback; + } else { + if (executing != NULL) { + executing->callback = NULL; + } + + DVDCancelAllAsync(callback); + } + + OSRestoreInterrupts(enabled); +} + +static void Callback(s32 result, DVDCommandBlock* block) { +#pragma unused(result) +#pragma unused(block) + + Prepared = TRUE; +} + +void __DVDPrepareReset(void) { + OSDisableInterrupts(); + Prepared = FALSE; + __DVDPrepareResetAsync(Callback); + OSEnableInterrupts(); + + while (Prepared != TRUE) { + ; + } +} + +BOOL __DVDTestAlarm(const OSAlarm* alarm) { + if (alarm == &ResetAlarm) { + return TRUE; + } + + return __DVDLowTestAlarm(alarm); +} + +BOOL __DVDLowBreak(void) { + Breaking = TRUE; + return TRUE; +} + +BOOL __DVDStopMotorAsync(DVDCommandBlock* block, DVDCommandCallback callback) { +#pragma unused(block) +#pragma unused(callback) + + return TRUE; +} + +void __DVDRestartMotor(void) {} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd_broadway.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd_broadway.c new file mode 100644 index 0000000000..6c9c8911b8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvd_broadway.c @@ -0,0 +1,790 @@ +#include +#include +#include +#include +#include + +#define DVD_LOW_CTX_MAX 4 +#define DVD_LOW_CMD_MAX 4 +#define DVD_LOW_CTX_MAGIC 0xFEEBDAED + +// Your guess is as good as mine +#define DVD_LOW_CTX_IN_USE(ctx) ((u8)((ctx).inUse != FALSE)) + +typedef enum { + DVD_IOCTL_INQUIRY = 0x12, + DVD_IOCTL_READ_DISK_ID = 0x70, + DVD_IOCTL_READ = 0x71, + DVD_IOCTL_PREPARE_COVER_REGISTER = 0x7A, + DVD_IOCTL_CLEAR_COVER_INTERRUPT = 0x86, + DVD_IOCTL_RESET = 0x8A, + DVD_IOCTL_CLOSE_PARTITION = 0x8C, + DVD_IOCTL_UNENCRYPTED_READ = 0x8D, + DVD_IOCTL_SEEK = 0xAB, + DVD_IOCTL_SET_MAX_ROTATION = 0xDD, + DVD_IOCTL_REQUEST_ERROR = 0xE0, + DVD_IOCTL_STOP_MOTOR = 0xE3, + DVD_IOCTL_AUDIO_BUFFER_CONFIG = 0xE4, +} DVDLowIoctl; + +typedef enum { + DVD_IOCTLV_OPEN_PARTITION = 0x8B, +} DVDLowIoctlv; + +typedef struct DVDLowContext { + DVDLowCallback callback; // at 0x0 + UNKWORD WORD_0x4; + u8 inUse; // at 0x8 + u32 magic; // at 0xC + u32 id; // at 0x10 + char padding[32 - 0x14]; +} DVDLowContext; + +typedef struct DVDLowDICommand { + u8 command; // at 0x0 + u32 arg1; // at 0x4 + u32 arg2; // at 0x8 + u32 arg3; // at 0xC + u32 arg4; // at 0x10 + u32 arg5; // at 0x14 + u32 arg6; // at 0x18 + u32 arg7; // at 0x1C +} DVDLowDICommand; + +typedef struct DVDLowDiRegs { + u32 diimmbuf; // at 0x0 + u32 dicvr; // at 0x4 + char padding[32 - 0x8]; +} DVDLowDiRegs; + +typedef struct DVDLowRegBuffer { + u32 reg; // at 0x0 + char padding[32 - 0x4]; +} DVDLowRegBuffer; + +static s32 DiFD = -1; + +static u8 breakRequested; +static DVDLowDICommand* diCommand; +static char* pathBuf; +static u32 readLength; +static BOOL spinUpValue; +static u8 DVDLowInitCalled; +static u8 dvdContextsInited; +static s32 freeDvdContext; +static s32 freeCommandBuf; +static u8 callbackInProgress; +static u8 requestInProgress; + +static DVDLowContext dvdContexts[DVD_LOW_CTX_MAX] ALIGN(32); +static DVDLowDiRegs diRegValCache ALIGN(32); +static DVDLowRegBuffer registerBuf ALIGN(32); +static IPCIOVector ioVec[5] ALIGN(32); +static u8 lastTicketError[32] ALIGN(32); + +DECOMP_FORCEACTIVE(dvd_broadway_c, dvdContexts); + +static void nextCommandBuf(void); +static DVDLowContext* newContext(DVDLowCallback callback, UNKWORD arg2); + +static void* ddrAllocAligned32(size_t size) { + u8* lo = IPCGetBufferLo(); + u8* hi = IPCGetBufferHi(); + + // @bug Incorrect rounding (& 31) results in pointer mod 32 + if ((u32)lo % 32 != 0) { + lo = (u8*)(((u32)lo + 31) & 31); + } + + if (lo + size > hi) { + OSReport("(ddrAllocAligned32) Not enough space to allocate %d bytes\n", + size); + } + + IPCSetBufferLo(lo + size); + return lo; +} + +static BOOL allocateStructures(void) { + diCommand = ddrAllocAligned32(sizeof(DVDLowDICommand) * DVD_LOW_CMD_MAX); + if (diCommand == NULL) { + OSReport("Allocation of diCommand blocks failed\n"); + return FALSE; + } + + pathBuf = ddrAllocAligned32(32); + if (pathBuf == NULL) { + OSReport("Allocation of pathBuf failed\n"); + return FALSE; + } + + return TRUE; +} + +static void initDvdContexts(void) { + int i; + for (i = 0; i < DVD_LOW_CTX_MAX; i++) { + dvdContexts[i].callback = NULL; + dvdContexts[i].WORD_0x4 = 0; + dvdContexts[i].inUse = FALSE; + dvdContexts[i].magic = DVD_LOW_CTX_MAGIC; + dvdContexts[i].id = i; + } + + freeDvdContext = 0; +} + +static s32 doTransactionCallback(s32 intType, void* arg) { + DVDLowContext* ctx = (DVDLowContext*)arg; + + if (ctx->magic != DVD_LOW_CTX_MAGIC) { + OSReport("(doTransactionCallback) Error - context mangled!\n"); + ctx->magic = DVD_LOW_CTX_MAGIC; + } else { + requestInProgress = FALSE; + + if (ctx->callback != NULL) { + callbackInProgress = TRUE; + + if (breakRequested == TRUE) { + breakRequested = FALSE; + intType |= DVD_INTTYPE_BR; + } + + if (intType & DVD_INTTYPE_TC) { + readLength = 0; + } + + ctx->callback(intType); + + callbackInProgress = FALSE; + } + } + + ctx->inUse = FALSE; + return IPC_RESULT_OK; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "(doCoverCallback) Error - context mangled!\n"); +// clang-format on + +static s32 doPrepareCoverRegisterCallback(s32 intType, void* arg) { + DVDLowContext* ctx = (DVDLowContext*)arg; + + requestInProgress = FALSE; + diRegValCache.dicvr = registerBuf.reg; + + if (ctx->magic != DVD_LOW_CTX_MAGIC) { + OSReport("(doTransactionCallback) Error - context mangled!\n"); + ctx->magic = DVD_LOW_CTX_MAGIC; + } else { + if (ctx->callback != NULL) { + callbackInProgress = TRUE; + + if (breakRequested == TRUE) { + breakRequested = FALSE; + intType |= DVD_INTTYPE_BR; + } + + ctx->callback(intType); + + callbackInProgress = FALSE; + } + } + + ctx->inUse = FALSE; + return IPC_RESULT_OK; +} + +BOOL DVDLowInit(void) { + IPCResult result; + + if (!DVDLowInitCalled) { + DVDLowInitCalled = TRUE; + + result = IPCCltInit(); + if (result != IPC_RESULT_OK) { + OSReport("IPCCltInit returned error: %d\n", result); + return FALSE; + } + + if (!allocateStructures()) { + return FALSE; + } + + if (!dvdContextsInited) { + initDvdContexts(); + dvdContextsInited = TRUE; + } + } + + strncpy(pathBuf, "/dev/di", 32); + DiFD = IOS_Open(pathBuf, IPC_OPEN_NONE); + + if (DiFD >= 0) { + return TRUE; + } + + switch (DiFD) { + case IPC_RESULT_NOEXISTS_INTERNAL: + OSReport("(DVDLowInit) Error: IOS_Open failed - pathname '/dev/di' " + "does not exist\n"); + return FALSE; + case IPC_RESULT_ACCESS_INTERNAL: + OSReport("(DVDLowInit) Error: IOS_Open failed - calling thread lacks " + "permission\n"); + return FALSE; + case IPC_RESULT_CONN_MAX_INTERNAL: + OSReport("(DVDLowInit) Error: IOS_Open failed - connection limit has " + "been reached\n"); + return FALSE; + default: + OSReport("(DVDLowInit) IOS_Open failed, errorcode = %d\n", DiFD); + return FALSE; + } +} + +BOOL DVDLowReadDiskID(DVDDiskID* out, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + if (out == NULL) { + OSReport("@@@@@@ WARNING - Calling DVDLowReadDiskId with NULL ptr\n"); + } + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_READ_DISK_ID; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_READ_DISK_ID, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + out, sizeof(DVDDiskID), doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowReadDiskID) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +static void nextCommandBuf(void) { + if (++freeCommandBuf >= DVD_LOW_CMD_MAX) { + freeCommandBuf = 0; + } +} + +static DECOMP_INLINE DVDLowContext* newContext(DVDLowCallback callback, + UNKWORD arg2) { + s32 id; + + // The last operation somehow did not complete + if (DVD_LOW_CTX_IN_USE(dvdContexts[freeDvdContext]) == TRUE) { + OSReport("(newContext) ERROR: freeDvdContext.inUse (#%d) is true\n", + freeDvdContext); + OSReport("(newContext) Now spinning in infinite loop\n"); + + while (TRUE) { + ; + } + } + + // Memory corruption + if (dvdContexts[freeDvdContext].magic != DVD_LOW_CTX_MAGIC) { + OSReport( + "(newContext) Something overwrote the context magic - spinning \n"); + + while (TRUE) { + ; + } + } + + dvdContexts[freeDvdContext].callback = callback; + dvdContexts[freeDvdContext].WORD_0x4 = arg2; + dvdContexts[freeDvdContext].inUse = TRUE; + + id = freeDvdContext; + + if (++freeDvdContext >= DVD_LOW_CTX_MAX) { + freeDvdContext = 0; + } + + return &dvdContexts[id]; +} + +BOOL DVDLowOpenPartition(u32 offset, const ESPTicket* ticket, u32 certsSize, + const void* certs, ESPTmd* tmd, + DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + if (ticket != NULL && (u32)ticket % 32 != 0) { + OSReport("(DVDLowOpenPartition) eTicket memory is unaligned\n"); + return FALSE; + } + + if (certs != NULL && (u32)certs % 32 != 0) { + OSReport("(DVDLowOpenPartition) certificates memory is unaligned\n"); + return FALSE; + } + + if (tmd != NULL && (u32)tmd % 32 != 0) { + OSReport("(DVDLowOpenPartition) certificates memory is unaligned\n"); + return FALSE; + } + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTLV_OPEN_PARTITION; + diCommand[freeCommandBuf].arg1 = offset; + + // Input vector 1: DI command + ioVec[0].base = &diCommand[freeCommandBuf]; + ioVec[0].length = sizeof(DVDLowDICommand); + + // Input vector 2: eTicket + ioVec[1].base = (void*)ticket; + if (ticket == NULL) { + ioVec[1].length = 0; + } else { + ioVec[1].length = sizeof(ESPTicket); + } + + // Input vector 3: Shared certs + ioVec[2].base = (void*)certs; + if (certs == NULL) { + ioVec[2].length = 0; + } else { + ioVec[2].length = certsSize; + } + + // Output vector 1: TMD + ioVec[3].base = tmd; + ioVec[3].length = sizeof(ESPTmd); + + // Output vector 2: Ticket error + ioVec[4].base = &lastTicketError; + ioVec[4].length = sizeof(lastTicketError); + + result = IOS_IoctlvAsync(DiFD, DVD_IOCTLV_OPEN_PARTITION, 3, 2, ioVec, + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport( + "@@@ (DVDLowOpenPartition) IOS_IoctlvAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowClosePartition(DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_CLOSE_PARTITION; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_CLOSE_PARTITION, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + NULL, 0, doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport( + "@@@ (DVDLowClosePartition) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowUnencryptedRead(void* dst, u32 size, u32 offset, + DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + readLength = size; + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_UNENCRYPTED_READ; + diCommand[freeCommandBuf].arg1 = size; + diCommand[freeCommandBuf].arg2 = offset; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_UNENCRYPTED_READ, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + dst, size, doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport( + "@@@ (DVDLowUnencryptedRead) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowStopMotor(BOOL eject, BOOL kill, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_STOP_MOTOR; + diCommand[freeCommandBuf].arg1 = eject; + diCommand[freeCommandBuf].arg2 = kill; + + result = + IOS_IoctlAsync(DiFD, DVD_IOCTL_STOP_MOTOR, &diCommand[freeCommandBuf], + sizeof(DVDLowDICommand), &diRegValCache, + sizeof(DVDLowDiRegs), doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowStopMotor) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "@@@ (DVDLowWaitForCoverClose) IOS_IoctlAsync returned error: %d\n"); +// clang-format on + +BOOL DVDLowInquiry(DVDDriveInfo* out, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_INQUIRY; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_INQUIRY, &diCommand[freeCommandBuf], + sizeof(DVDLowDICommand), out, sizeof(DVDDriveInfo), + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowInquiry) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowRequestError(DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_REQUEST_ERROR; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_REQUEST_ERROR, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + &diRegValCache, sizeof(DVDLowDiRegs), + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowRequestError) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "(DVDLowSetSpinupFlag): Synch functions can't be called in callbacks\n", + "@@@ (DVDLowNotifyReset) IOS_IoctlAsync returned error: %d\n"); +// clang-format on + +BOOL DVDLowSetSpinupFlag(BOOL enable) { + spinUpValue = enable; + return TRUE; +} + +BOOL DVDLowReset(DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_RESET; + diCommand[freeCommandBuf].arg1 = spinUpValue; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_RESET, &diCommand[freeCommandBuf], + sizeof(DVDLowDICommand), NULL, 0, + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowReset) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_AUDIO_BUFFER_CONFIG; + diCommand[freeCommandBuf].arg1 = enable; + diCommand[freeCommandBuf].arg2 = size; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_AUDIO_BUFFER_CONFIG, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + &diRegValCache, sizeof(DVDLowDiRegs), + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport( + "@@@ (DVDLowAudioBufferConfig) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "(DVDLowGetCoverStatus): Synch functions can't be called in callbacks\n", + "@@@ (DVDLowGetCoverStatus) IOS_Ioctl returned error: %d\n", + "@@@ (DVDLowReadDVD) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReadDVDConfig) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReadDvdCopyright) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReadDvdPhysical) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReadDvdDiscKey) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReportKey) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowOffset) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowStopLaser) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowReadDiskBca) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowSerMeasControl) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowRequestDiscStatus) IOS_IoctlAsync returned error: %d\n", + "@@@ (DVDLowRequestRetryNumber) IOS_IoctlAsync returned error: %d\n"); +// clang-format on + +BOOL DVDLowSetMaximumRotation(u32 speed, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_SET_MAX_ROTATION; + diCommand[freeCommandBuf].arg1 = speed >> 16 & 3; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_SET_MAX_ROTATION, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + NULL, 0, doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport( + "@@@ (DVDLowSetMaxRotation) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowRead(void* dst, u32 size, u32 offset, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + if ((u32)dst % 32 != 0) { + OSReport( + "(DVDLowRead): ERROR - destAddr buffer is not 32 byte aligned\n"); + return FALSE; + } + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + readLength = size; + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_READ; + diCommand[freeCommandBuf].arg1 = size; + diCommand[freeCommandBuf].arg2 = offset; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_READ, &diCommand[freeCommandBuf], + sizeof(DVDLowDICommand), dst, size, + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowRead) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL DVDLowSeek(u32 offset, DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_SEEK; + diCommand[freeCommandBuf].arg1 = offset; + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_SEEK, &diCommand[freeCommandBuf], + sizeof(DVDLowDICommand), NULL, 0, + doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowSeek) IOS_IoctlAsync returned error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "(DVDLowGetCoverReg): Synch functions can't be called in callbacks\n", + "@@@ (DVDLowGetCoverReg) IOS_Ioctl returned error: %d\n"); +// clang-format on + +u32 DVDLowGetCoverRegister(void) { + return diRegValCache.dicvr; +} + +BOOL DVDLowPrepareCoverRegister(DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_PREPARE_COVER_REGISTER; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_PREPARE_COVER_REGISTER, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + ®isterBuf, sizeof(DVDLowRegBuffer), + doPrepareCoverRegisterCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowPrepareCoverRegsiter) IOS_IoctlAsync returned " + "error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +u32 DVDLowGetImmBufferReg(void) { + return diRegValCache.diimmbuf; +} + +BOOL DVDLowUnmaskStatusInterrupts(void) { + return TRUE; +} + +BOOL DVDLowMaskCoverInterrupt(void) { + return TRUE; +} + +BOOL DVDLowClearCoverInterrupt(DVDLowCallback callback) { + DVDLowContext* ctx; + IPCResult result; + + nextCommandBuf(); + diCommand[freeCommandBuf].command = DVD_IOCTL_CLEAR_COVER_INTERRUPT; + + requestInProgress = TRUE; + ctx = newContext(callback, 1); + + result = IOS_IoctlAsync(DiFD, DVD_IOCTL_CLEAR_COVER_INTERRUPT, + &diCommand[freeCommandBuf], sizeof(DVDLowDICommand), + NULL, 0, doTransactionCallback, ctx); + + if (result != IPC_RESULT_OK) { + OSReport("@@@ (DVDLowClearCoverInterrupt) IOS_IoctlAsync returned " + "error: %d\n", + result); + ctx->inUse = FALSE; + + return FALSE; + } + + return TRUE; +} + +BOOL __DVDLowTestAlarm(const OSAlarm* alarm) { +#pragma unused(alarm) + + return FALSE; +} + +// clang-format off +DECOMP_FORCEACTIVE(dvd_broadway_c, + "@@@ (DVDLowEnableDvdVideo) IOS_IoctlAsync returned error: %d\n"); +// clang-format on diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvderror.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvderror.c new file mode 100644 index 0000000000..71c84e62ca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvderror.c @@ -0,0 +1,82 @@ +#include +#include + +static NANDFileInfo NandInfo; +static NANDCommandBlock NandCb; + +DVDErrorInfo __ErrorInfo ALIGN(32); +static DVDErrorCallback Callback; + +static void cbForNandClose(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (Callback != NULL) { + Callback(result == NAND_RESULT_OK ? 1 : 2, 0); + } +} + +static void cbForNandWrite(s32 result, NANDCommandBlock* block) { +#pragma unused(result) +#pragma unused(block) + + if (NANDCloseAsync(&NandInfo, cbForNandClose, &NandCb) != NAND_RESULT_OK) { + // Must call callback function manually + cbForNandClose(-1, NULL); + } +} + +static void cbForNandOpen(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == NAND_RESULT_OK) { + if (NANDWriteAsync(&NandInfo, &__ErrorInfo, sizeof(DVDErrorInfo), + cbForNandWrite, &NandCb) != NAND_RESULT_OK) { + // Must call callback function manually + cbForNandWrite(-1, NULL); + } + } else if (Callback != NULL) { + Callback(2, 0); + } +} + +static void cbForNandCreate(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == NAND_RESULT_OK || result == NAND_RESULT_EXISTS) { + if (NANDPrivateOpenAsync("/shared2/test2/dvderror.dat", &NandInfo, + NAND_ACCESS_WRITE, cbForNandOpen, + &NandCb) != NAND_RESULT_OK) { + // Must call callback function manually + cbForNandOpen(-1, NULL); + } + } else if (Callback != NULL) { + Callback(2, 0); + } +} + +static void cbForNandCreateDir(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == NAND_RESULT_OK || result == NAND_RESULT_EXISTS) { + if (NANDPrivateCreateAsync("/shared2/test2/dvderror.dat", + NAND_PERM_RWALL, 0, cbForNandCreate, + &NandCb) != NAND_RESULT_OK) { + // Must call callback function manually + cbForNandCreate(-1, NULL); + } + } else if (Callback != NULL) { + Callback(2, 0); + } +} + +void __DVDStoreErrorCode(u32 error, DVDErrorCallback callback) { + __ErrorInfo.error = error; + __ErrorInfo.sec = OS_TICKS_TO_SEC(OSGetTime()); + Callback = callback; + + if (NANDPrivateCreateDirAsync("/shared2/test2", NAND_PERM_RWALL, 0, + cbForNandCreateDir, &NandCb) != 0) { + // Must call callback function manually + cbForNandCreateDir(-1, NULL); + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfatal.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfatal.c new file mode 100644 index 0000000000..528406508c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfatal.c @@ -0,0 +1,105 @@ +#include +#include +#include + +static funcptr_t FatalFunc = NULL; + +const char* const __DVDErrorMessage[] = { + // clang-format off + + // SC_LANG_JP + "\n\n\nエラーが発生しました。\n\n" + "イジェクトボタンを押してディスクを取り出してか\n" + "ら、本体の電源をOFFにして、本体の取扱説明書の\n" + "指示に従ってください。", + + // SC_LANG_EN + "\n\n\nAn error has occurred.\n" + "Press the Eject Button, remove the\n" + "Game Disc, and turn the power off.\n" + "Please read the Wii operations manual\n" + "for more information.", + + // SC_LANG_DE + "\n\n\nEin Fehler ist aufgetreten.\n" + "Dr\xFC""cke den Ausgabeknopf, entnimm die\n" + "Game Disc und schalte die Wii-Konsole\n" + "aus. Bitte lies die Bedienungsanleitung der\n" + "Wii-Konsole, um weitere Informationen zu\n" + "erhalten.", + + // SC_LANG_FR + "\n\n\nUne erreur est survenue.\n" + "Appuyez sur le bouton EJECT, retirez\n" + "le disque de jeu et \xE9teignez la console.\n" + "Veuillez vous r\xE9""f\xE9rer au mode d'emploi\n" + "de la console pour de plus amples\n" + "informations.", + + // SC_LANG_SP + "\n\n\nSe ha producido un error.\n" + "Pulsa el Bot\xF3n EJECT, saca el disco y\n" + "apaga la consola. Consulta el manual de\n" + "instrucciones de la consola Wii para\n" + "obtener m\xE1s informaci\xF3n.", + + // SC_LANG_IT + "\n\n\nSi \xE8 verificato un errore.\n" + "Premi il pulsante EJECT, estrai il disco\n" + "di gioco e spegni la console. Per maggiori\n" + "informazioni consulta il manuale di\n" + "istruzioni della console Wii.", + + // SC_LANG_NL + "\n\n\nEr is een fout opgetreden.\n" + "Druk op de ejectknop, verwijder de\n" + "speldisk en zet het systeem uit. Lees\n" + "de Wii-handleiding voor meer informatie." + + // clang-format on +}; + +void __DVDShowFatalMessage(void) { + const char* msg; + GXColor bgColor = {0, 0, 0, 0}; + GXColor textColor = {255, 255, 255, 0}; + + if (SCGetLanguage() == SC_LANG_JP) { + OSSetFontEncode(OS_FONT_ENCODE_SJIS); + } else { + OSSetFontEncode(OS_FONT_ENCODE_ANSI); + } + + msg = (SCGetLanguage() > SC_LANG_NL) ? __DVDErrorMessage[SC_LANG_EN] + : __DVDErrorMessage[SCGetLanguage()]; + + OSFatal(textColor, bgColor, msg); +} + +BOOL DVDSetAutoFatalMessaging(BOOL enable) { + BOOL enabled; + BOOL old; + + enabled = OSDisableInterrupts(); + + old = (FatalFunc != NULL); + + if (enable) { + FatalFunc = __DVDShowFatalMessage; + } else { + FatalFunc = NULL; + } + + OSRestoreInterrupts(enabled); + return old; +} + +BOOL __DVDGetAutoFatalMessaging(void) { + return FatalFunc != NULL; +} + +void __DVDPrintFatalMessage(void) { + if (FatalFunc != NULL) { + FatalFunc(); + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfs.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfs.c new file mode 100644 index 0000000000..7e0cdf7fac --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdfs.c @@ -0,0 +1,395 @@ +/** + * Based on ARC decompilation by riidefi + */ + +#include +#include +#include + +typedef struct DVDNode { + union { + struct { + u32 is_folder : 8; + u32 name : 24; + }; + u32 packed_type_name; + }; // at 0x0 + + union { + struct { + u32 offset; + u32 size; + }; + + struct { + u32 parent; + u32 sibling_next; + } folder; + }; // at 0x4 +} DVDNode; + +#define DVDNodeIsFolder(node) (((node).packed_type_name & 0xFF000000)) +#define DVDNodeGetName(node) ((node).packed_type_name & 0x00FFFFFF) + +static OSBootInfo* BootInfo; +static const DVDNode* FstStart; +static char* FstStringStart; +static u32 MaxEntryNum; + +OSThreadQueue __DVDThreadQueue; +BOOL __DVDLongFileNameFlag = TRUE; + +static s32 currentDirectory; + +static void cbForReadAsync(s32 result, DVDCommandBlock* block); +static void cbForReadSync(s32 result, DVDCommandBlock* block); + +void __DVDFSInit(void) { + BootInfo = (OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO); + FstStart = (const DVDNode*)BootInfo->fstStart; + + if (FstStart != NULL) { + // Size of FST root + MaxEntryNum = FstStart->size; + // String table is placed after FST nodes + FstStringStart = (char*)&FstStart[MaxEntryNum]; + } +} + +static BOOL isSame(const char* lhs, const char* rhs) { + while (*rhs != '\0') { + if (tolower(*lhs++) != tolower(*rhs++)) { + return FALSE; + } + } + + if (*lhs == '/' || *lhs == '\0') { + return TRUE; + } + + return FALSE; +} + +s32 DVDConvertPathToEntrynum(const char* path) { + const DVDNode* new_var; + const char* name_end; + u32 it; + u32 anchor; + const char* item_name; + BOOL name_delimited_by_slash; + s32 name_length; + const char* backup_path; + const char* extension_start; + BOOL illegal_format; + BOOL has_extension; + + backup_path = path; + it = currentDirectory; + + while (TRUE) { + // End of string -> return what we have + if (*path == '\0') { + return it; + } + + // Ignore initial slash: /Path/File vs Path/File + if (*path == '/') { + it = 0; + path++; + continue; + } + + // Handle special cases: + // -../-, -.., -./-, -. + if (path[0] == '.') { + if (path[1] == '.') { + // Seek to parent ../ + if (path[2] == '/') { + it = FstStart[it].folder.parent; + path += 3; + continue; + } + // Return parent folder immediately + if (path[2] == '\0') { + return FstStart[it].folder.parent; + } + // Malformed: fall through, causing infinite loop + goto check_format; + } + + // "." directory does nothing + if (path[1] == '/') { + path += 2; + continue; + } + + // Ignore trailing dot + if (path[1] == '\0') { + return it; + } + } + + check_format: + if (!__DVDLongFileNameFlag) { + has_extension = FALSE; + illegal_format = FALSE; + + name_end = path; + while (*name_end != '\0' && *name_end != '/') { + if (*name_end == '.') { + // 8.3 format limits file name to 8 characters. + if (name_end - path > 8 || has_extension == TRUE) { + illegal_format = TRUE; + goto validate_format; + } else { + has_extension = TRUE; + extension_start = name_end + 1; + } + } + // 8.3 format does not allow spaces in file name. + else if (*name_end == ' ') { + illegal_format = TRUE; + } + + name_end++; + } + + validate_format: + if (has_extension == TRUE && name_end - extension_start > 3) { + illegal_format = TRUE; + } + + // clang-format off +#line 443 + OS_ASSERT(!illegal_format, "DVDConvertEntrynumToPath(possibly DVDOpen or DVDChangeDir or DVDOpenDir): specified directory or file (%s) doesn't match standard 8.3 format. This is a temporary restriction and will be removed soon\n", backup_path); + // clang-format on + } else { + // We've ensured the directory is not special. + // Isolate the name of the current item in the path string. + name_end = path; + while (*name_end != '\0' && *name_end != '/') { + name_end++; + } + } + + // If the name was delimited by a '/' rather than truncated. + // This must be expressed as a ternary, and an enum cannot be used.. + name_delimited_by_slash = (*name_end == '\0') ? 0 : 1; + name_length = name_end - path; + + // Traverse all children of the parent. + anchor = it + 1; + new_var = FstStart; + while (anchor < new_var[it].folder.sibling_next) { + while (TRUE) { + if (DVDNodeIsFolder(FstStart[anchor]) || + name_delimited_by_slash != TRUE) { + item_name = + FstStringStart + DVDNodeGetName(FstStart[anchor]); + + // Advance to the next item in the path + if (isSame(path, item_name) == TRUE) { + goto descend; + } + } + + if (DVDNodeIsFolder(FstStart[anchor])) { + anchor = FstStart[anchor].folder.sibling_next; + break; + } + + anchor++; + break; + } + } + + return -1; + + descend: + // If the path was truncated, there is nowhere else to go + // These basic blocks have to go here right at the end, accessed via a + // goto. An odd choice. + if (!name_delimited_by_slash) { + return anchor; + } + + it = anchor; + path += name_length + 1; + } +} + +BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* info) { + if (entrynum < 0 || entrynum >= MaxEntryNum || + DVDNodeIsFolder(FstStart[entrynum])) { + return FALSE; + } + + info->offset = FstStart[entrynum].offset >> __DVDLayoutFormat; + info->size = FstStart[entrynum].size; + info->callback = NULL; + info->block.state = DVD_STATE_IDLE; + + return TRUE; +} + +BOOL DVDOpen(const char* path, DVDFileInfo* info) { + s32 entrynum = DVDConvertPathToEntrynum(path); + + if (entrynum < 0) { + char dir[128]; + DVDGetCurrentDir(dir, sizeof(dir)); + + OSReport("Warning: DVDOpen(): file '%s' was not found under %s.\n", + path, dir); + + return FALSE; + } + + if (DVDNodeIsFolder(FstStart[entrynum])) { + return FALSE; + } + + info->offset = FstStart[entrynum].offset >> __DVDLayoutFormat; + info->size = FstStart[entrynum].size; + info->callback = NULL; + info->block.state = DVD_STATE_IDLE; + + return TRUE; +} + +BOOL DVDClose(DVDFileInfo* info) { + DVDCancel(&info->block); + return TRUE; +} + +static u32 myStrncpy(char* dst, const char* src, u32 maxlen) { + u32 i; + for (i = maxlen; i != 0 && *src != '\0'; --i) { + *dst++ = *src++; + } + + return maxlen - i; +} + +static u32 entryToPath(s32 entrynum, char* string, u32 maxlen) { + const char* name; + u32 written; + + if (entrynum == 0) { + return 0; + } + + name = FstStringStart + FstStart[entrynum].name; + + written = entryToPath(FstStart[entrynum].folder.parent, string, maxlen); + if (written == maxlen) { + return written; + } + + string[written++] = '/'; + return written + myStrncpy(string + written, name, maxlen - written); +} + +static BOOL DVDConvertEntrynumToPath(s32 entrynum, char* string, u32 maxlen) { + u32 written = entryToPath(entrynum, string, maxlen); + + if (written == maxlen) { + string[maxlen - 1] = '\0'; + return FALSE; + } + + if (DVDNodeIsFolder(FstStart[entrynum])) { + if (written == maxlen - 1) { + string[written] = '\0'; + return FALSE; + } + + string[written++] = '/'; + } + + string[written] = '\0'; + return TRUE; +} + +BOOL DVDGetCurrentDir(char* buffer, u32 maxlen) { + return DVDConvertEntrynumToPath(currentDirectory, buffer, maxlen); +} + +BOOL DVDReadAsyncPrio(DVDFileInfo* info, void* dst, s32 size, s32 offset, + DVDAsyncCallback callback, s32 prio) { + // clang-format off +#line 823 + OS_ASSERT(offset >= 0 && offset <= info->size, "DVDReadAsync(): specified area is out of the file "); + // clang-format on + + // clang-format off +#line 829 + OS_ASSERT(offset + size >= 0 && offset + size < info->size + 32, "DVDReadAsync(): specified area is out of the file "); + // clang-format on + + info->callback = callback; + + DVDReadAbsAsyncPrio(&info->block, dst, size, info->offset + (offset >> 2), + cbForReadAsync, prio); + + return TRUE; +} + +static void cbForReadAsync(s32 result, DVDCommandBlock* block) { + DVDFileInfo* info = (DVDFileInfo*)block; + + if (info->callback != NULL) { + info->callback(result, info); + } +} + +s32 DVDReadPrio(DVDFileInfo* info, void* dst, s32 size, s32 offset, s32 prio) { + DVDCommandBlock* block; + BOOL enabled; + s32 ret; + + // clang-format off +#line 893 + OS_ASSERT(offset >= 0 && offset <= info->size, "DVDRead(): specified area is out of the file "); + // clang-format on + + // clang-format off +#line 899 + OS_ASSERT(offset + size >= 0 && offset + size < info->size + 32, "DVDRead(): specified area is out of the file "); + // clang-format on + + block = &info->block; + if (!DVDReadAbsAsyncPrio(block, dst, size, info->offset + (offset >> 2), + cbForReadSync, prio)) { + return DVD_RESULT_FATAL; + } + + enabled = OSDisableInterrupts(); + + while (TRUE) { + s32 state = block->state; + + if (state == DVD_STATE_IDLE) { + ret = block->transferTotal; + break; + } else if (state == DVD_STATE_FATAL) { + ret = DVD_RESULT_FATAL; + break; + } else if (state == DVD_STATE_CANCELED) { + ret = DVD_RESULT_CANCELED; + break; + } + + OSSleepThread(&__DVDThreadQueue); + } + + OSRestoreInterrupts(enabled); + return ret; +} + +static void cbForReadSync(s32 result, DVDCommandBlock* block) { +#pragma unused(result) +#pragma unused(block) + + OSWakeupThread(&__DVDThreadQueue); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdidutils.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdidutils.c new file mode 100644 index 0000000000..b64bd0e13c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdidutils.c @@ -0,0 +1,29 @@ +#include +#include + +BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2) { + // Compare game name + if (id1->game[0] != '\0' && id2->game[0] != '\0' && + strncmp(id1->game, id2->game, sizeof(id1->game)) != 0) { + return FALSE; + } + + // Compare company name + if (id1->company[0] == '\0' || id2->company[0] == '\0' || + strncmp(id1->company, id2->company, sizeof(id1->company)) != 0) { + return FALSE; + } + + // Compare disk number + if (id1->disk != 0xFF && id2->disk != 0xFF && id1->disk != id2->disk) { + return FALSE; + } + + // Compare version number + if (id1->version != 0xFF && id2->version != 0xFF && + id1->version != id2->version) { + return FALSE; + } + + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdqueue.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdqueue.c new file mode 100644 index 0000000000..087511af70 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/DVD/dvdqueue.c @@ -0,0 +1,117 @@ +#include + +typedef struct DVDWaitingQueue { + struct DVDWaitingQueue* next; // at 0x0 + struct DVDWaitingQueue* prev; // at 0x4 +} DVDWaitingQueue; + +static DVDWaitingQueue WaitingQueue[DVD_PRIO_MAX]; + +void __DVDClearWaitingQueue(void) { + u32 i; + + for (i = 0; i < DVD_PRIO_MAX; i++) { + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[i]; + head->next = head; + head->prev = head; + } +} + +BOOL __DVDPushWaitingQueue(s32 prio, DVDCommandBlock* block) { + BOOL enabled = OSDisableInterrupts(); + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[prio]; + + head->prev->next = block; + block->prev = head->prev; + block->next = head; + head->prev = block; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +static DVDCommandBlock* PopWaitingQueuePrio(s32 prio) { + BOOL enabled = OSDisableInterrupts(); + + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[prio]; + DVDCommandBlock* block = head->next; + + head->next = block->next; + block->next->prev = head; + + OSRestoreInterrupts(enabled); + + block->next = NULL; + block->prev = NULL; + return block; +} + +DVDCommandBlock* __DVDPopWaitingQueue(void) { + u32 i; + BOOL enabled = OSDisableInterrupts(); + + for (i = 0; i < DVD_PRIO_MAX; i++) { + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[i]; + + if (head->next != head) { + OSRestoreInterrupts(enabled); + return PopWaitingQueuePrio(i); + } + } + + OSRestoreInterrupts(enabled); + return NULL; +} + +BOOL __DVDCheckWaitingQueue(void) { + u32 i; + BOOL enabled = OSDisableInterrupts(); + + for (i = 0; i < DVD_PRIO_MAX; i++) { + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[i]; + + if (head->next != head) { + OSRestoreInterrupts(enabled); + return TRUE; + } + } + + OSRestoreInterrupts(enabled); + return FALSE; +} + +DVDCommandBlock* __DVDGetNextWaitingQueue(void) { + u32 i; + BOOL enabled = OSDisableInterrupts(); + + for (i = 0; i < DVD_PRIO_MAX; i++) { + DVDCommandBlock* head = (DVDCommandBlock*)&WaitingQueue[i]; + DVDCommandBlock* block = head->next; + + if (block != head) { + OSRestoreInterrupts(enabled); + return block; + } + } + + OSRestoreInterrupts(enabled); + return NULL; +} + +BOOL __DVDDequeueWaitingQueue(const DVDCommandBlock* block) { + BOOL enabled = OSDisableInterrupts(); + + DVDCommandBlock* prev = block->prev; + DVDCommandBlock* next = block->next; + + if (prev == NULL || next == NULL) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + prev->next = next; + next->prev = prev; + + OSRestoreInterrupts(enabled); + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/ESP/esp.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/ESP/esp.c new file mode 100644 index 0000000000..2f5741b60d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/ESP/esp.c @@ -0,0 +1,54 @@ +#include + +static s32 __esFd = -1; + +s32 ESP_ReadContentFile(s32 fd, void* dst, u32 len) { + u8 WORK[256] ALIGN(32); + + IPCIOVector* vecWork = (IPCIOVector*)(WORK + 0xE8); + s32* fdWork = (s32*)(WORK + 0x00); + + // Cast is necessary + if (__esFd < 0 || fd < 0 || dst == (void*)NULL || len <= 0) { + return -0x3F9; + } + + if ((u32)dst % 32 != 0) { + return -0x3F9; + } + + *fdWork = fd; + + vecWork[1].base = dst; + vecWork[1].length = len; + vecWork[0].base = fdWork; + vecWork[0].length = sizeof(s32); + + return IOS_Ioctlv(__esFd, ES_IOCTLV_READ_CONTENT_FILE, 1, 1, vecWork); +} + +s32 ESP_SeekContentFile(s32 fd, s32 offset, s32 origin) { + u8 WORK[256] ALIGN(32); + + IPCIOVector* vecWork = (IPCIOVector*)(WORK + 0xE8); + s32* fdWork = (s32*)(WORK + 0x00); + s32* offsetWork = (s32*)(WORK + 0x20); + s32* originWork = (s32*)(WORK + 0x40); + + if (__esFd < 0) { + return -0x3F9; + } + + *fdWork = fd; + *offsetWork = offset; + *originWork = origin; + + vecWork[0].base = fdWork; + vecWork[0].length = sizeof(s32); + vecWork[1].base = offsetWork; + vecWork[1].length = sizeof(s32); + vecWork[2].base = originWork; + vecWork[2].length = sizeof(s32); + + return IOS_Ioctlv(__esFd, ES_IOCTLV_SEEK_CONTENT_FILE, 3, 0, vecWork); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/EUART/euart.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EUART/euart.c new file mode 100644 index 0000000000..8e3264b47d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EUART/euart.c @@ -0,0 +1,143 @@ +#include +#include +#include + +static BOOL __EUARTInitialized = FALSE; +static u32 __EUARTLastErrorCode = 0; +static BOOL __EUARTSendStop = FALSE; +static u32 Enabled = 0; + +BOOL EUARTInit(void) { + BOOL enabled; + u8 data; + + if (__EUARTInitialized) { + return TRUE; + } + + if ((OSGetConsoleType() & OS_CONSOLE_MASK_EMU) == 0) { + __EUARTLastErrorCode = EUART_ERROR_INVALID; + return FALSE; + } + + enabled = OSDisableInterrupts(); + + data = 0xF2; + if (!EXIWriteReg(EXI_CHAN_0, EXI_DEV_INT, 0xB0000000, &data, + sizeof(data))) { + __EUARTLastErrorCode = EUART_ERROR_EXI; + OSRestoreInterrupts(enabled); + return FALSE; + } + + data = 0xF3; + if (!EXIWriteReg(EXI_CHAN_0, EXI_DEV_INT, 0xB0000000, &data, + sizeof(data))) { + __EUARTLastErrorCode = EUART_ERROR_EXI; + OSRestoreInterrupts(enabled); + return FALSE; + } + + OSRestoreInterrupts(enabled); + __EUARTInitialized = TRUE; + __EUARTLastErrorCode = EUART_ERROR_OK; + __EUARTSendStop = FALSE; + return TRUE; +} + +EUARTError InitializeUART(void) { + if ((OSGetConsoleType() & OS_CONSOLE_MASK_EMU) == 0) { + Enabled = 0; + return EUART_ERROR_INVALID; + } + + Enabled = 0xA5FF005A; + return EUART_ERROR_OK; +} + +static s32 QueueLength(void) { + u32 cmd; + u32 imm; + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, __EXIFreq)) { + return -1; + } + + cmd = 0x30000100; + EXIImm(EXI_CHAN_0, &cmd, sizeof(u32), EXI_WRITE, NULL); + EXISync(EXI_CHAN_0); + + EXIImm(EXI_CHAN_0, &imm, sizeof(u32), EXI_READ, NULL); + EXISync(EXI_CHAN_0); + EXIDeselect(EXI_CHAN_0); + + return 32 - ((imm >> 24) % 64); +} + +EUARTError WriteUARTN(const char* msg, u32 n) { + const char* p; + s32 length; + EUARTError err; + char* it; + u32 cmd; + + p = msg; + + if (Enabled != 0xA5FF005A) { + return EUART_ERROR_INVALID; + } + + if (!__EUARTInitialized && !EUARTInit()) { + return EUART_ERROR_INVALID; + } + + if (!__EUARTInitialized) { + __EUARTLastErrorCode = EUART_ERROR_FATAL; + return EUART_ERROR_INVALID; + } + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + return EUART_ERROR_OK; + } + + for (it = (char*)p; it - msg < n; it++) { + if (*it == '\n') { + *it = '\r'; + } + } + + err = EUART_ERROR_OK; + cmd = 0xB0000100; + + while (n > 0) { + length = QueueLength(); + + if (length < 0) { + err = EUART_ERROR_BUSY; + break; + } + + if (length != 32) { + continue; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, __EXIFreq)) { + err = EUART_ERROR_BUSY; + break; + } + + EXIImm(EXI_CHAN_0, &cmd, sizeof(u32), EXI_WRITE, NULL); + EXISync(EXI_CHAN_0); + + for (; length > 0 && n > 0; p++, length--, n--) { + u32 ch = *p << 24; + EXIImm(EXI_CHAN_0, &ch, sizeof(u32), EXI_WRITE, NULL); + EXISync(EXI_CHAN_0); + } + + EXIDeselect(EXI_CHAN_0); + } + + EXIUnlock(EXI_CHAN_0); + return err; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIBios.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIBios.c new file mode 100644 index 0000000000..d522ba7f3a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIBios.c @@ -0,0 +1,669 @@ +#include +#include +#include +#include + +const char* __EXIVersion = + "<< RVL_SDK - EXI \trelease build: Nov 30 2006 03:26:56 (0x4199_60831) >>"; + +static EXIData Ecb[EXI_MAX_CHAN]; +static u32 IDSerialPort1; + +static BOOL __EXIProbe(EXIChannel chan); + +static void SetExiInterruptMask(EXIChannel chan, EXIData* exi) { + EXIData* exi2 = &Ecb[EXI_CHAN_2]; + + switch (chan) { + case EXI_CHAN_0: + if (exi->exiCallback == NULL && exi2->exiCallback == NULL || + exi->state & EXI_STATE_LOCKED) { + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_0_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_EXI)); + } else { + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_0_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_EXI)); + } + break; + case EXI_CHAN_1: + if (exi->exiCallback == NULL || exi->state & EXI_STATE_LOCKED) { + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_1_EXI)); + } else { + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_1_EXI)); + } + break; + case EXI_CHAN_2: + if (__OSGetInterruptHandler(OS_INTR_PI_DEBUG) == NULL || + exi->state & EXI_STATE_LOCKED) { + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_PI_DEBUG)); + } else { + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_PI_DEBUG)); + } + } +} + +static void CompleteTransfer(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + s32 len; + + if (exi->state & EXI_STATE_BUSY) { + if (exi->state & EXI_STATE_IMM_ACCESS && (len = exi->bytesRead) != 0) { + u8* buf; + u32 data; + int i; + + buf = (u8*)exi->buffer; + data = EXI_CHAN_PARAMS[chan].data; + for (i = 0; i < len; i++) { + *buf++ = data >> (3 - i) * 8; + } + } + + exi->state &= ~EXI_STATE_BUSY; + } +} + +BOOL EXIImm(EXIChannel chan, void* buf, s32 len, u32 type, + EXICallback callback) { + EXIData* exi = &Ecb[chan]; + BOOL enabled = OSDisableInterrupts(); + + if (exi->state & EXI_STATE_BUSY || !(exi->state & EXI_STATE_SELECTED)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->tcCallback = callback; + if (callback != NULL) { + u32 mask = OS_INTR_MASK(OS_INTR_EXI_0_TC); + EXIClearInterrupts(chan, FALSE, TRUE, FALSE); + __OSUnmaskInterrupts(mask >> (chan * 3)); + } + + exi->state |= EXI_STATE_IMM_ACCESS; + + if (type != EXI_READ) { + int i; + u32 word = 0; + for (i = 0; i < len; i++) { + word |= ((u8*)buf)[i] << (3 - i) * 8; + } + + EXI_CHAN_PARAMS[chan].data = word; + } + + exi->buffer = buf; + exi->bytesRead = (type != EXI_WRITE) ? len : 0; + EXI_CHAN_PARAMS[chan].cr = EXI_CR_TSTART | type << 2 | (len - 1) << 4; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL EXIImmEx(EXIChannel chan, void* buf, s32 len, u32 type) { + while (len != 0) { + s32 immLen = (len < 4) ? len : 4; + + if (!EXIImm(chan, buf, immLen, type, FALSE)) { + return FALSE; + } + + if (!EXISync(chan)) { + return FALSE; + } + + buf = (u8*)buf + immLen; + len -= immLen; + } + + return TRUE; +} + +BOOL EXIDma(EXIChannel chan, void* buf, s32 len, u32 type, + EXICallback callback) { + EXIData* exi = &Ecb[chan]; + BOOL enabled = OSDisableInterrupts(); + + if (exi->state & EXI_STATE_BUSY || !(exi->state & EXI_STATE_SELECTED)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->tcCallback = callback; + if (callback != NULL) { + u32 mask = OS_INTR_MASK(OS_INTR_EXI_0_TC); + EXIClearInterrupts(chan, FALSE, TRUE, FALSE); + __OSUnmaskInterrupts(mask >> (chan * 3)); + } + + exi->state |= EXI_STATE_DMA_ACCESS; + + EXI_CHAN_PARAMS[chan].mar = ROUND_DOWN_PTR(buf, 32); + EXI_CHAN_PARAMS[chan].length = len; + EXI_CHAN_PARAMS[chan].cr = type << 2 | EXI_CR_TSTART | EXI_CR_DMA; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL EXISync(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + BOOL ret = FALSE; + + while (exi->state & EXI_STATE_SELECTED) { + if (!(EXI_CHAN_PARAMS[chan].cr & EXI_CR_TSTART)) { + BOOL enabled = OSDisableInterrupts(); + + if (exi->state & EXI_STATE_SELECTED) { + CompleteTransfer(chan); + + if (__OSGetDIConfig() != 0xFF || + (OSGetConsoleType() & OS_CONSOLE_MASK) == + OS_CONSOLE_MASK_TDEV || + exi->bytesRead != 4 || + EXI_CHAN_PARAMS[chan].cpr & EXI_CPR_CLK || + (EXI_CHAN_PARAMS[chan].data != EXI_ID_USB_ADAPTER && + EXI_CHAN_PARAMS[chan].data != EXI_ID_IS_DOL_VIEWER && + EXI_CHAN_PARAMS[chan].data != 0x04220001) || + OS_DVD_DEVICE_CODE == MAKE_DVD_DEVICE_CODE(0x0200)) { + ret = TRUE; + } + } + + OSRestoreInterrupts(enabled); + break; + } + } + + return ret; +} + +void EXIClearInterrupts(EXIChannel chan, BOOL exi, BOOL tc, BOOL ext) { + u32 cpr = EXI_CHAN_PARAMS[chan].cpr & 0xFFF & + ~(EXI_CPR_EXIINT | EXI_CPR_TCINT | EXI_CPR_EXTINT); + + if (exi) { + cpr |= EXI_CPR_EXIINT; + } + + if (tc) { + cpr |= EXI_CPR_TCINT; + } + + if (ext) { + cpr |= EXI_CPR_EXTINT; + } + + EXI_CHAN_PARAMS[chan].cpr = cpr; +} + +EXICallback EXISetExiCallback(EXIChannel chan, EXICallback callback) { + EXIData* exi; + EXICallback old; + BOOL enabled; + + exi = &Ecb[chan]; + enabled = OSDisableInterrupts(); + + old = exi->exiCallback; + exi->exiCallback = callback; + + if (chan != EXI_CHAN_2) { + SetExiInterruptMask(chan, exi); + } else { + SetExiInterruptMask(EXI_CHAN_0, &Ecb[EXI_CHAN_0]); + } + + OSRestoreInterrupts(enabled); + return old; +} + +void EXIProbeReset(void) { + OS_EXI_LAST_INSERT[0] = OS_EXI_LAST_INSERT[1] = 0; + Ecb[EXI_CHAN_0].lastInsert = Ecb[EXI_CHAN_1].lastInsert = 0; + __EXIProbe(EXI_CHAN_0); + __EXIProbe(EXI_CHAN_1); +} + +static BOOL __EXIProbe(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + BOOL ret; + u32 cpr; + + if (chan == EXI_CHAN_2) { + return TRUE; + } + + ret = TRUE; + enabled = OSDisableInterrupts(); + cpr = EXI_CHAN_PARAMS[chan].cpr; + + if (!(exi->state & EXI_STATE_ATTACHED)) { + if (cpr & EXI_CPR_EXTINT) { + EXIClearInterrupts(chan, FALSE, FALSE, TRUE); + exi->lastInsert = 0; + OS_EXI_LAST_INSERT[chan] = 0; + } + + if (cpr & EXI_CPR_EXT) { + s32 time = (s32)(OS_TICKS_TO_MSEC(OSGetTime()) / 100) + 1; + if (OS_EXI_LAST_INSERT[chan] == 0) { + OS_EXI_LAST_INSERT[chan] = time; + } + + if (time - OS_EXI_LAST_INSERT[chan] < 3) { + ret = FALSE; + } + } else { + exi->lastInsert = 0; + OS_EXI_LAST_INSERT[chan] = 0; + ret = FALSE; + } + } else if (!(cpr & EXI_CPR_EXT) || cpr & EXI_CPR_EXTINT) { + exi->lastInsert = 0; + OS_EXI_LAST_INSERT[chan] = 0; + ret = FALSE; + } + + OSRestoreInterrupts(enabled); + return ret; +} + +BOOL EXIProbe(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + + BOOL ret = __EXIProbe(chan); + if (ret && exi->lastInsert == 0) { + u32 id; + return EXIGetID(chan, EXI_DEV_EXT, &id); + } + + return FALSE; +} + +static BOOL __EXIAttach(EXIChannel chan, EXICallback callback) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + u32 mask; + + enabled = OSDisableInterrupts(); + if (exi->state & EXI_STATE_ATTACHED || !__EXIProbe(chan)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + EXIClearInterrupts(chan, TRUE, FALSE, FALSE); + exi->extCallback = callback; + mask = OS_INTR_MASK(OS_INTR_EXI_0_EXT); + __OSUnmaskInterrupts(mask >> (chan * 3)); + exi->state |= EXI_STATE_ATTACHED; + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL EXIAttach(EXIChannel chan, EXICallback callback) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + BOOL ret; + + EXIProbe(chan); + enabled = OSDisableInterrupts(); + + if (exi->lastInsert == 0) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + ret = __EXIAttach(chan, callback); + OSRestoreInterrupts(enabled); + return ret; +} + +BOOL EXIDetach(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + u32 mask; + + enabled = OSDisableInterrupts(); + if (!(exi->state & EXI_STATE_ATTACHED)) { + OSRestoreInterrupts(enabled); + return TRUE; + } + + if (exi->state & EXI_STATE_LOCKED && exi->dev == EXI_DEV_EXT) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->state &= ~EXI_STATE_ATTACHED; + mask = OS_INTR_MASK(OS_INTR_EXI_0_EXI) | OS_INTR_MASK(OS_INTR_EXI_0_EXT); + __OSMaskInterrupts(mask >> (chan * 3)); + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL EXISelect(EXIChannel chan, u32 dev, u32 freq) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + u32 cpr; + + enabled = OSDisableInterrupts(); + + if (exi->state & EXI_STATE_SELECTED || + chan != EXI_CHAN_2 && + (dev == EXI_DEV_EXT && !(exi->state & EXI_STATE_ATTACHED) && + !__EXIProbe(chan) || + !(exi->state & EXI_STATE_LOCKED) || exi->dev != dev)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->state |= EXI_STATE_SELECTED; + + cpr = EXI_CHAN_PARAMS[chan].cpr; + cpr &= (EXI_CPR_EXIINTMASK | EXI_CPR_TCINTMASK | EXI_CPR_EXTINTMASK); + cpr |= (1 << dev) << 7 | freq << 4; + EXI_CHAN_PARAMS[chan].cpr = cpr; + + if (exi->state & EXI_STATE_ATTACHED) { + switch (chan) { + case EXI_CHAN_0: + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_0_EXT)); + break; + case EXI_CHAN_1: + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_1_EXT)); + break; + } + } + + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL EXIDeselect(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + u32 cpr; + BOOL enabled; + + enabled = OSDisableInterrupts(); + + if (!(exi->state & EXI_STATE_SELECTED)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->state &= ~EXI_STATE_SELECTED; + cpr = EXI_CHAN_PARAMS[chan].cpr; + EXI_CHAN_PARAMS[chan].cpr = + cpr & (EXI_CPR_EXIINTMASK | EXI_CPR_TCINTMASK | EXI_CPR_EXTINTMASK); + + if (exi->state & EXI_STATE_ATTACHED) { + switch (chan) { + case EXI_CHAN_0: + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_0_EXT)); + break; + case EXI_CHAN_1: + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_1_EXT)); + break; + } + } + + OSRestoreInterrupts(enabled); + + if (chan != EXI_CHAN_2 && cpr & EXI_CPR_CS0B) { + return __EXIProbe(chan) != FALSE; + } + + return TRUE; +} + +static void EXIIntrruptHandler(s16 intr, OSContext* ctx) { + EXIData* exi; + EXIChannel chan; + EXICallback callback; + OSContext temp; + + chan = (EXIChannel)((intr - OS_INTR_EXI_0_EXI) / 3); + exi = &Ecb[chan]; + + EXIClearInterrupts(chan, TRUE, FALSE, FALSE); + + callback = exi->exiCallback; + if (callback != NULL) { + OSClearContext(&temp); + OSSetCurrentContext(&temp); + callback(chan, ctx); + OSClearContext(&temp); + OSSetCurrentContext(ctx); + } +} + +static void TCIntrruptHandler(s16 intr, OSContext* ctx) { + EXIData* exi; + EXIChannel chan; + EXICallback callback; + OSContext temp; + + chan = (EXIChannel)((intr - OS_INTR_EXI_0_TC) / 3); + exi = &Ecb[chan]; + + __OSMaskInterrupts(0x80000000 >> intr); + EXIClearInterrupts(chan, FALSE, TRUE, FALSE); + + callback = exi->tcCallback; + if (callback != NULL) { + exi->tcCallback = NULL; + CompleteTransfer(chan); + OSClearContext(&temp); + OSSetCurrentContext(&temp); + callback(chan, ctx); + OSClearContext(&temp); + OSSetCurrentContext(ctx); + } +} + +static void EXTIntrruptHandler(s16 intr, OSContext* ctx) { + EXIChannel chan; + EXIData* exi; + EXICallback callback; + OSContext temp; + u32 mask; + + chan = (EXIChannel)((intr - OS_INTR_EXI_0_EXT) / 3); + mask = OS_INTR_MASK(OS_INTR_EXI_0_EXI) | OS_INTR_MASK(OS_INTR_EXI_0_EXT); + __OSMaskInterrupts(mask >> (chan * 3)); + + exi = &Ecb[chan]; + callback = exi->extCallback; + exi->state &= ~EXI_STATE_ATTACHED; + + if (callback != NULL) { + OSClearContext(&temp); + OSSetCurrentContext(&temp); + exi->extCallback = NULL; + callback(chan, ctx); + OSClearContext(&temp); + OSSetCurrentContext(ctx); + } +} + +void EXIInit(void) { + u32 id; + + do { + do { + ; + } while ((EXI_CHAN_PARAMS[EXI_CHAN_0].cr & EXI_CR_TSTART) == 1); + } while ((EXI_CHAN_PARAMS[EXI_CHAN_1].cr & EXI_CR_TSTART) == 1 || + (EXI_CHAN_PARAMS[EXI_CHAN_2].cr & EXI_CR_TSTART) == 1); + + __OSMaskInterrupts( + OS_INTR_MASK(OS_INTR_EXI_0_EXI) | OS_INTR_MASK(OS_INTR_EXI_0_TC) | + OS_INTR_MASK(OS_INTR_EXI_0_EXT) | OS_INTR_MASK(OS_INTR_EXI_1_EXI) | + OS_INTR_MASK(OS_INTR_EXI_1_TC) | OS_INTR_MASK(OS_INTR_EXI_1_EXT) | + OS_INTR_MASK(OS_INTR_EXI_2_EXI) | OS_INTR_MASK(OS_INTR_EXI_2_TC)); + + EXI_CHAN_PARAMS[EXI_CHAN_0].cpr = 0; + EXI_CHAN_PARAMS[EXI_CHAN_1].cpr = 0; + EXI_CHAN_PARAMS[EXI_CHAN_2].cpr = 0; + + EXI_CHAN_PARAMS[EXI_CHAN_0].cpr = EXI_CPR_ROMDIS; + + __OSSetInterruptHandler(OS_INTR_EXI_0_EXI, EXIIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_0_TC, TCIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_0_EXT, EXTIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_1_EXI, EXIIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_1_TC, TCIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_1_EXT, EXTIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_2_EXI, EXIIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_EXI_2_TC, TCIntrruptHandler); + + EXIGetID(EXI_CHAN_0, EXI_DEV_NET, &IDSerialPort1); + + if (__OSInIPL) { + EXIProbeReset(); + } else { + if ((EXIGetID(EXI_CHAN_0, EXI_DEV_EXT, &id) && id == 0x07010000)) { + __OSEnableBarnacle(EXI_CHAN_1, EXI_DEV_EXT); + } else if (EXIGetID(EXI_CHAN_1, EXI_DEV_EXT, &id) && id == 0x07010000) { + __OSEnableBarnacle(EXI_CHAN_0, EXI_DEV_NET); + } + } + + OSRegisterVersion(__EXIVersion); +} + +BOOL EXILock(EXIChannel chan, u32 dev, EXICallback callback) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + int i; + + enabled = OSDisableInterrupts(); + + if (exi->state & EXI_STATE_LOCKED) { + if (callback != NULL) { + for (i = 0; i < exi->numItems; i++) { + if (exi->items[i].dev == dev) { + OSRestoreInterrupts(enabled); + return FALSE; + } + } + + exi->items[exi->numItems].callback = callback; + exi->items[exi->numItems].dev = dev; + exi->numItems++; + } + + OSRestoreInterrupts(enabled); + return FALSE; + } else { + exi->state |= EXI_STATE_LOCKED; + exi->dev = dev; + SetExiInterruptMask(chan, exi); + OSRestoreInterrupts(enabled); + return TRUE; + } +} + +BOOL EXIUnlock(EXIChannel chan) { + EXIData* exi = &Ecb[chan]; + BOOL enabled; + EXICallback callback; + + enabled = OSDisableInterrupts(); + + if (!(exi->state & EXI_STATE_LOCKED)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + exi->state &= ~EXI_STATE_LOCKED; + SetExiInterruptMask(chan, exi); + + if (exi->numItems > 0) { + callback = exi->items[0].callback; + + if (--exi->numItems > 0) { + memmove(&exi->items[0], &exi->items[1], + exi->numItems * sizeof(EXIItem)); + } + + callback(chan, NULL); + } + + OSRestoreInterrupts(enabled); + return TRUE; +} + +// Does nothing??? +static void UnlockedHandler(EXIChannel chan, OSContext* ctx) { +#pragma unused(ctx) + u32 id; + EXIGetID(chan, EXI_DEV_EXT, &id); +} + +s32 EXIGetID(EXIChannel chan, u32 dev, u32* out) { + EXIData* exi = &Ecb[chan]; + u32 imm; + s32 ret; + s32 time; + BOOL enabled; + + if (chan == EXI_CHAN_0 && dev == EXI_DEV_NET && IDSerialPort1 != 0) { + *out = IDSerialPort1; + return 1; + } + + if (chan < EXI_CHAN_2 && dev == EXI_DEV_EXT) { + if (!__EXIProbe(chan)) { + return 0; + } + + if (exi->lastInsert == OS_EXI_LAST_INSERT[chan]) { + *out = exi->id; + return exi->lastInsert; + } + + if (!__EXIAttach(chan, NULL)) { + return 0; + } + + time = OS_EXI_LAST_INSERT[chan]; + } + + enabled = OSDisableInterrupts(); + ret = !EXILock(chan, dev, + (chan < EXI_CHAN_2 && dev == EXI_DEV_EXT) ? UnlockedHandler + : NULL); + if (ret == 0) { + ret = !EXISelect(chan, dev, EXI_FREQ_1MHZ); + if (ret == 0) { + imm = 0x00000000; + ret |= !EXIImm(chan, &imm, sizeof(u16), EXI_WRITE, NULL); + ret |= !EXISync(chan); + ret |= !EXIImm(chan, out, sizeof(u32), EXI_READ, NULL); + ret |= !EXISync(chan); + ret |= !EXIDeselect(chan); + } + EXIUnlock(chan); + } + + OSRestoreInterrupts(enabled); + + if (chan < EXI_CHAN_2 && dev == EXI_DEV_EXT) { + EXIDetach(chan); + + enabled = OSDisableInterrupts(); + ret |= time != OS_EXI_LAST_INSERT[chan]; + if (ret == 0) { + exi->id = *out; + exi->lastInsert = time; + } + + OSRestoreInterrupts(enabled); + return ret != 0 ? 0 : exi->lastInsert; + } + + return ret == 0; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXICommon.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXICommon.c new file mode 100644 index 0000000000..dc94626bf4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXICommon.c @@ -0,0 +1,41 @@ +#include +#include + +const u32 __EXIFreq = EXI_FREQ_16MHZ; + +BOOL EXIWriteReg(EXIChannel chan, u32 dev, u32 cmd, const void* buf, s32 len) { + BOOL error = FALSE; + u32 write_val; + + switch (len) { + case 1: + write_val = *(u8*)buf << 24; + break; + case 2: + write_val = *(u16*)buf << 24 | (*(u16*)buf & 0xFF00) << 8; + break; + default: + write_val = __EXISwap32(*(u32*)buf); + break; + } + + error |= !EXILock(chan, dev, NULL); + if (error) { + return FALSE; + } + + error |= !EXISelect(chan, dev, EXI_FREQ_16MHZ); + if (error) { + EXIUnlock(chan); + return FALSE; + } + + error |= !EXIImm(chan, &cmd, sizeof(cmd), EXI_WRITE, NULL); + error |= !EXISync(chan); + error |= !EXIImm(chan, &write_val, sizeof(write_val), EXI_WRITE, NULL); + error |= !EXISync(chan); + error |= !EXIDeselect(chan); + error |= !EXIUnlock(chan); + + return error == FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIUart.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIUart.c new file mode 100644 index 0000000000..9026050427 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/EXI/EXIUart.c @@ -0,0 +1,91 @@ +#include + +static BOOL Enabled = FALSE; +static BOOL BarnacleEnabled = FALSE; + +static u32 Dev = EXI_DEV_EXT; +static EXIChannel Chan = EXI_CHAN_0; + +static BOOL ProbeBarnacle(EXIChannel chan, u32 dev, u32* id) { + BOOL error; + u32 cmd; + + if (chan != EXI_CHAN_2 && dev == EXI_DEV_EXT) { + if (!EXIAttach(chan, NULL)) { + return FALSE; + } + } + + error = !EXILock(chan, dev, NULL); + if (error) { + goto _detach; + } + + error = !EXISelect(chan, dev, EXI_FREQ_1MHZ); + if (error) { + goto _unlock; + } + + cmd = 0x20011300; + error = !EXIImm(chan, &cmd, sizeof(u32), EXI_WRITE, NULL); + error |= !EXISync(chan); + + error |= !EXIImm(chan, id, sizeof(u32), EXI_READ, NULL); + error |= !EXISync(chan); + error |= !EXIDeselect(chan); + +_unlock: + EXIUnlock(chan); + +_detach: + if (chan != EXI_CHAN_2 && dev == EXI_DEV_EXT) { + EXIDetach(chan); + } + + if (error) { + return FALSE; + } + + return *id != EXI_ID_INVALID; +} + +void __OSEnableBarnacle(EXIChannel chan, u32 dev) { + u32 id; + + if (!EXIGetID(chan, dev, &id)) { + return; + } + + switch (id) { + case EXI_ID_MEMCARD_59: + case EXI_ID_MEMCARD_123: + case EXI_ID_MEMCARD_251: + case EXI_ID_MEMCARD_507: + case EXI_ID_USB_ADAPTER: + case 0x01020000: + case 0x02020000: + case 0x03010000: + case 0x04020100: + case EXI_ID_BROADBAND_ADAPTER: + case 0x04020300: + case 0x04040404: + case 0x04060000: + case 0x04120000: + case 0x04130000: + case 0x04220000: + case 0x80000004: + case 0x80000008: + case 0x80000010: + case 0x80000020: + case EXI_ID_INVALID: + break; + default: + if (ProbeBarnacle(chan, dev, &id)) { + Chan = chan; + Dev = dev; + BarnacleEnabled = 0xA5FF005A; + Enabled = 0xA5FF005A; + } + break; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/FS/fs.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/FS/fs.c new file mode 100644 index 0000000000..f79b7ed92f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/FS/fs.c @@ -0,0 +1,1018 @@ +#include +#include +#include +#include + +#define FS_HEAP_SIZE 0x1500 + +// Longest name obtainable from ReadDir ioctl +#define FS_DIR_NAME_MAX (12 + 1) + +/** + * To make the double NULL checks look less weird. + * I think they must have written something like this, as the debug version + * shows there is no inlined function causing this. + */ +#define FS_DELETE(x) \ + if ((x) != NULL) { \ + iosFree(hId, (x)); \ + } + +/** + * Used to identify the async operation that resulted in _isfsFuncCb being + * called. Some operations do not require anything else to be done (will use + * CB_STATE_NONE), but in some cases _isfsFuncCb must finish the task. + */ +typedef enum { + CB_STATE_NONE, + CB_STATE_GET_STATS, + CB_STATE_READ_DIR, + CB_STATE_GET_ATTR, + CB_STATE_GET_USAGE, + CB_STATE_GET_FILE_STATS, +} FSCallbackState; + +typedef enum { + FS_IOCTL_CREATE_DIR = 3, + FS_IOCTL_READ_DIR = 4, + FS_IOCTL_GET_ATTR = 6, + FS_IOCTL_DELETE_PATH = 7, + FS_IOCTL_RENAME_PATH = 8, + FS_IOCTL_CREATE_FILE = 9, + FS_IOCTL_GET_FILE_STATS = 11, + FS_IOCTL_SHUTDOWN_FS = 13, + + FS_IOCTLV_GET_USAGE = 12 +} FSIoctl; + +/** + * Ioctl data for FS functions. + * Some functions share the same structure (such as Create/GetAttr). + * NOTE: Some functions instead use the work buffer (ioctlWork). + */ + +// For ISFS_Create*/ISFS_GetAttr +typedef struct FSFileIoctl { + u32 ownerId; // at 0x0 + u16 groupId; // at 0x4 + char path[FS_MAX_PATH]; // at 0x6 + u8 ownerPerm; // at 0x46 + u8 groupPerm; // at 0x47 + u8 otherPerm; // at 0x48 + u8 attr; // at 0x49 + char UNK_0x4A[0x4C - 0x4A]; +} FSFileIoctl; + +// For ISFS_Rename +typedef struct FSRenameIoctl { + char from[FS_MAX_PATH]; // at 0x0 + char to[FS_MAX_PATH]; // at 0x40 +} FSRenameIoctl; + +/** + * Async context data for FS functions. + * Used to store arguments for retrieval in _isfsFuncCb. + */ + +// For ISFS_GetStatsAsync +typedef struct FSGetStatsAsyncCtx { + FSStats* statsOut; // at 0x0 +} FSGetStatsAsyncCtx; + +// For ISFS_ReadDirAsync +typedef struct FSReadDirAsyncCtx { + u32* fileCountOut; // at 0x0 +} FSReadDirAsyncCtx; + +// For ISFS_GetAttrAsync +typedef struct FSGetAttrAsyncCtx { + u32* ownerIdOut; // at 0x0 + u16* groupIdOut; // at 0x4 + u32* attrOut; // at 0x8 + u32* ownerPermOut; // at 0xC + u32* groupPermOut; // at 0x10 + u32* otherPermOut; // at 0x14 +} FSGetAttrAsyncCtx; + +// For ISFS_GetUsageAsync +typedef struct FSGetUsageAsyncCtx { + u32* blockCountOut; // at 0x0 + u32* fileCountOut; // at 0x4 +} FSGetUsageAsyncCtx; + +// For ISFS_GetFileStatsAsync +typedef struct FSGetFileStatsAsyncCtx { + FSFileStats* statsOut; // at 0x0 +} FSGetFileStatsAsyncCtx; + +/** + * Generic command-block structure used by all FS functions + */ +typedef struct FSCommandBlock { + // Data for ioctl + union { + FSFileIoctl fileIoctl; + FSRenameIoctl renameIoctl; + u8 ioctlWork[0x100]; + }; // at 0x0 + + // User callback settings + FSAsyncCallback callback; // at 0x100 + void* callbackArg; // at 0x104 + + // Data for FS IPC callback (_isfsFuncCb) + FSCallbackState callbackState; // at 0x108 + union { + FSGetStatsAsyncCtx getStatsCtx; + FSReadDirAsyncCtx readDirCtx; + FSGetAttrAsyncCtx getAttrCtx; + FSGetUsageAsyncCtx getUsageCtx; + FSGetFileStatsAsyncCtx getFileStatsCtx; + u8 forceUnionSize[0x140 - 0x10C]; + }; // at 0x10C +} FSCommandBlock; + +static s32 __fsFd = -1; +static char* __devfs = NULL; +static u32 _asynCnt = 0; +static s32 hId; + +static s32 _FSGetStatsCb(s32 result, FSCommandBlock* block); +static s32 _FSReadDirCb(s32 result, FSCommandBlock* block); +static s32 _FSGetAttrCb(s32 result, FSCommandBlock* block); +static s32 _FSGetUsageCb(s32 result, FSCommandBlock* block); +static s32 _FSGetFileStatsCb(s32 result, FSCommandBlock* block); + +// Not part of MSL, but implemented in IPC. +size_t strnlen(const char* str, size_t maxlen); + +s32 ISFS_OpenLib(void) { + static BOOL firstFl = TRUE; + static void* lo; + static void* hi; + + s32 ret = IPC_RESULT_OK; + u8* base; + + if (firstFl) { + lo = IPCGetBufferLo(); + hi = IPCGetBufferHi(); + } + + __devfs = (char*)ROUND_UP_PTR(lo, 32); + + if (firstFl && __devfs + FS_MAX_PATH > hi) { + OSReport("APP ERROR: Not enough IPC arena\n"); + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + strcpy(__devfs, "/dev/fs"); + __fsFd = IOS_Open(__devfs, 0); + + if (__fsFd < 0) { + ret = __fsFd; + goto end; + } + + base = (u8*)__devfs; + + if (firstFl && base + FS_MAX_PATH + FS_HEAP_SIZE > hi) { + OSReport("APP ERROR: Not enough IPC arena\n"); + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + if (firstFl) { + IPCSetBufferLo(base + FS_MAX_PATH + FS_HEAP_SIZE); + firstFl = FALSE; + } + + hId = iosCreateHeap(base, FS_MAX_PATH + FS_HEAP_SIZE); + if (hId < 0) { + ret = IPC_RESULT_ALLOC_FAILED; + } + +end: + return ret; +} + +static s32 _isfsFuncCb(s32 result, void* arg) { + FSCommandBlock* block = (FSCommandBlock*)arg; + + if (result >= IPC_RESULT_OK) { + switch (block->callbackState) { + case CB_STATE_GET_STATS: + _FSGetStatsCb(result, block); + break; + case CB_STATE_READ_DIR: + _FSReadDirCb(result, block); + break; + case CB_STATE_GET_ATTR: + _FSGetAttrCb(result, block); + break; + case CB_STATE_GET_USAGE: + _FSGetUsageCb(result, block); + break; + } + } + + _asynCnt = 0; + if (block->callback != NULL) { + block->callback(result, block->callbackArg); + } + + FS_DELETE(block); + return result; +} + +static s32 _FSGetStatsCb(s32 result, FSCommandBlock* block) { + if (result == IPC_RESULT_OK) { + memcpy(block->getStatsCtx.statsOut, block->ioctlWork, sizeof(FSStats)); + } + + return IPC_RESULT_OK; +} + +s32 ISFS_CreateDir(const char* path, u32 attr, u32 ownerPerm, u32 groupPerm, + u32 otherPerm) { + FSCommandBlock* block; + s32 ret; + size_t len; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->fileIoctl.path, path, len + 1); + + block->fileIoctl.attr = attr; + block->fileIoctl.ownerPerm = ownerPerm; + block->fileIoctl.groupPerm = groupPerm; + block->fileIoctl.otherPerm = otherPerm; + + ret = IOS_Ioctl(__fsFd, FS_IOCTL_CREATE_DIR, &block->fileIoctl, + sizeof(FSFileIoctl), NULL, 0); + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +s32 ISFS_CreateDirAsync(const char* path, u32 attr, u32 ownerPerm, + u32 groupPerm, u32 otherPerm, FSAsyncCallback callback, + void* callbackArg) { + FSCommandBlock* block; + size_t len; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + memcpy(block->fileIoctl.path, path, len + 1); + + block->fileIoctl.attr = attr; + block->fileIoctl.ownerPerm = ownerPerm; + block->fileIoctl.groupPerm = groupPerm; + block->fileIoctl.otherPerm = otherPerm; + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_CREATE_DIR, &block->fileIoctl, + sizeof(FSFileIoctl), NULL, 0, _isfsFuncCb, block); +} + +s32 ISFS_ReadDir(const char* path, char* filesOut, u32* fileCountOut) { + s32 ret; + FSCommandBlock* block; + char* pathWork; + IPCIOVector* vectors; + size_t len; + u32* countWork; + u32 inCount; + u32 outCount; + + block = NULL; + + if (path == NULL || fileCountOut == NULL || __fsFd < 0 || + (u32)filesOut % 32 != 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + // Directory path + vectors = (IPCIOVector*)block->ioctlWork; + pathWork = ROUND_UP_PTR((u8*)vectors + (sizeof(IPCIOVector) * 4), 32); + memcpy(pathWork, path, len + 1); + + // Input: Directory path + vectors[0].base = pathWork; + vectors[0].length = FS_MAX_PATH; + // Input: Max file count + countWork = ROUND_UP_PTR(pathWork + FS_MAX_PATH, 32); + vectors[1].base = countWork; + vectors[1].length = sizeof(u32); + + if (filesOut != NULL) { + inCount = 2; + outCount = 2; + + // Out param initially contains max file count (length of filesOut) + *countWork = *fileCountOut; + + // Output: File names + vectors[2].base = filesOut; + vectors[2].length = *fileCountOut * FS_DIR_NAME_MAX; + // Output: File count + vectors[3].base = countWork; + vectors[3].length = sizeof(u32); + } else { + inCount = 1; + outCount = 1; + } + + ret = IOS_Ioctlv(__fsFd, FS_IOCTL_READ_DIR, inCount, outCount, vectors); + if (ret == IPC_RESULT_OK) { + *fileCountOut = *countWork; + } + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +static s32 _FSReadDirCb(s32 result, FSCommandBlock* block) { + u8* pathWork; + if (result == IPC_RESULT_OK) { + pathWork = + ROUND_UP_PTR(block->ioctlWork + (sizeof(IPCIOVector) * 4), 32); + *block->readDirCtx.fileCountOut = + *(u32*)ROUND_UP_PTR((u8*)pathWork + FS_MAX_PATH, 32); + } + + return IPC_RESULT_OK; +} + +s32 ISFS_ReadDirAsync(const char* path, char* filesOut, u32* fileCountOut, + FSAsyncCallback callback, void* callbackArg) { + FSCommandBlock* block; + char* pathWork; + IPCIOVector* vectors; + size_t len; + u32* countWork; + u32 inCount; + u32 outCount; + + block = NULL; + + if (path == NULL || fileCountOut == NULL || __fsFd < 0 || + (u32)filesOut % 32 != 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_READ_DIR; + block->readDirCtx.fileCountOut = fileCountOut; + + // Directory path + vectors = (IPCIOVector*)block->ioctlWork; + pathWork = ROUND_UP_PTR((u8*)vectors + (sizeof(IPCIOVector) * 4), 32); + memcpy(pathWork, path, len + 1); + + // Input: Directory path + vectors = (IPCIOVector*)block->ioctlWork; // Second cast is required + vectors[0].base = pathWork; + vectors[0].length = FS_MAX_PATH; + // Input: Max file count + countWork = ROUND_UP_PTR(pathWork + FS_MAX_PATH, 32); + vectors[1].base = countWork; + vectors[1].length = sizeof(u32); + + if (filesOut != NULL) { + inCount = 2; + outCount = 2; + + // Out param initially contains max file count (length of filesOut) + *countWork = *fileCountOut; + + // Output: File names + vectors[2].base = filesOut; + vectors[2].length = *fileCountOut * FS_DIR_NAME_MAX; + // Output: File count + vectors[3].base = countWork; + vectors[3].length = sizeof(u32); + } else { + inCount = 1; + outCount = 1; + } + + return IOS_IoctlvAsync(__fsFd, FS_IOCTL_READ_DIR, inCount, outCount, + vectors, _isfsFuncCb, block); +} + +s32 ISFS_GetAttr(const char* path, u32* ownerIdOut, u16* groupIdOut, + u32* attrOut, u32* ownerPermOut, u32* groupPermOut, + u32* otherPermOut) { + s32 ret; + FSFileIoctl* fileIoctl; + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH || + ownerIdOut == NULL || groupIdOut == NULL || attrOut == NULL || + ownerPermOut == NULL || groupPermOut == NULL || otherPermOut == NULL) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->ioctlWork, path, len + 1); + fileIoctl = ROUND_UP_PTR(block->ioctlWork + FS_MAX_PATH, 32); + + ret = IOS_Ioctl(__fsFd, FS_IOCTL_GET_ATTR, block->ioctlWork, FS_MAX_PATH, + fileIoctl, sizeof(FSFileIoctl)); + + if (ret == IPC_RESULT_OK) { + *ownerIdOut = fileIoctl->ownerId; + *groupIdOut = fileIoctl->groupId; + *attrOut = fileIoctl->attr; + *ownerPermOut = fileIoctl->ownerPerm; + *groupPermOut = fileIoctl->groupPerm; + *otherPermOut = fileIoctl->otherPerm; + } + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +static s32 _FSGetAttrCb(s32 result, FSCommandBlock* block) { + FSFileIoctl* fileIoctl; + + if (result == IPC_RESULT_OK) { + fileIoctl = + (FSFileIoctl*)ROUND_UP_PTR(block->ioctlWork + FS_MAX_PATH, 32); + + *block->getAttrCtx.ownerIdOut = fileIoctl->ownerId; + *block->getAttrCtx.groupIdOut = fileIoctl->groupId; + *block->getAttrCtx.attrOut = fileIoctl->attr; + *block->getAttrCtx.ownerPermOut = fileIoctl->ownerPerm; + *block->getAttrCtx.groupPermOut = fileIoctl->groupPerm; + *block->getAttrCtx.otherPermOut = fileIoctl->otherPerm; + } + + return IPC_RESULT_OK; +} + +s32 ISFS_GetAttrAsync(const char* path, u32* ownerIdOut, u16* groupIdOut, + u32* attrOut, u32* ownerPermOut, u32* groupPermOut, + u32* otherPermOut, FSAsyncCallback callback, + void* callbackArg) { + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH || + ownerIdOut == NULL || groupIdOut == NULL || attrOut == NULL || + ownerPermOut == NULL || groupPermOut == NULL || otherPermOut == NULL) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->getAttrCtx.ownerIdOut = ownerIdOut; + block->getAttrCtx.groupIdOut = groupIdOut; + block->getAttrCtx.attrOut = attrOut; + block->getAttrCtx.ownerPermOut = ownerPermOut; + block->getAttrCtx.groupPermOut = groupPermOut; + block->getAttrCtx.otherPermOut = otherPermOut; + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_GET_ATTR; + + memcpy(block->ioctlWork, path, len + 1); + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_GET_ATTR, block->ioctlWork, + FS_MAX_PATH, + ROUND_UP_PTR(block->ioctlWork + FS_MAX_PATH, 32), + sizeof(FSFileIoctl), _isfsFuncCb, block); +} + +s32 ISFS_Delete(const char* path) { + s32 ret; + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->ioctlWork, path, len + 1); + + ret = IOS_Ioctl(__fsFd, FS_IOCTL_DELETE_PATH, block->ioctlWork, FS_MAX_PATH, + 0, NULL); + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +s32 ISFS_DeleteAsync(const char* path, FSAsyncCallback callback, + void* callbackArg) { + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + memcpy(block->ioctlWork, path, len + 1); + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_DELETE_PATH, block->ioctlWork, + FS_MAX_PATH, 0, NULL, _isfsFuncCb, block); +} + +s32 ISFS_Rename(const char* from, const char* to) { + s32 ret; + size_t lenFrom; + size_t lenTo; + FSCommandBlock* block; + + block = NULL; + + if (from == NULL || to == NULL || __fsFd < 0 || + (lenFrom = strnlen(from, FS_MAX_PATH)) == FS_MAX_PATH || + (lenTo = strnlen(to, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->renameIoctl.from, from, lenFrom + 1); + memcpy(block->renameIoctl.to, to, lenTo + 1); + + ret = IOS_Ioctl(__fsFd, FS_IOCTL_RENAME_PATH, &block->renameIoctl, + sizeof(FSRenameIoctl), 0, NULL); + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +s32 ISFS_RenameAsync(const char* from, const char* to, FSAsyncCallback callback, + void* callbackArg) { + size_t lenFrom; + size_t lenTo; + FSCommandBlock* block; + + block = NULL; + + if (from == NULL || to == NULL || __fsFd < 0 || + (lenFrom = strnlen(from, FS_MAX_PATH)) == FS_MAX_PATH || + (lenTo = strnlen(to, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + memcpy(block->renameIoctl.from, from, lenFrom + 1); + memcpy(block->renameIoctl.to, to, lenTo + 1); + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_RENAME_PATH, &block->renameIoctl, + sizeof(FSRenameIoctl), 0, NULL, _isfsFuncCb, block); +} + +s32 ISFS_GetUsage(const char* path, s32* blockCountOut, s32* fileCountOut) { + s32 ret; + u32* blockCountWork; + u32* fileCountWork; + char* pathWork; + IPCIOVector* vectors; + FSCommandBlock* block; + size_t len; + + block = NULL; + + if (path == NULL || __fsFd < 0 || blockCountOut == NULL || + fileCountOut == NULL || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + // Directory path + vectors = (IPCIOVector*)block->ioctlWork; + pathWork = ROUND_UP_PTR((u8*)vectors + (sizeof(IPCIOVector) * 3), 32); + memcpy(pathWork, path, len + 1); + + // Input: Directory path + vectors[0].base = pathWork; + vectors[0].length = FS_MAX_PATH; + + blockCountWork = ROUND_UP_PTR(pathWork + FS_MAX_PATH, 32); + fileCountWork = ROUND_UP_PTR((u8*)blockCountWork + sizeof(u32), 32); + + // Output: Number of blocks used by directory + vectors[1].base = blockCountWork; + vectors[1].length = sizeof(u32); + // Output: Number of files in directory + vectors[2].base = fileCountWork; + vectors[2].length = sizeof(u32); + + ret = IOS_Ioctlv(__fsFd, FS_IOCTLV_GET_USAGE, 1, 2, vectors); + if (ret == IPC_RESULT_OK) { + *blockCountOut = *blockCountWork; + *fileCountOut = *fileCountWork; + } + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +static s32 _FSGetUsageCb(s32 result, FSCommandBlock* block) { + u8* work; + + if (result == IPC_RESULT_OK) { + work = ROUND_UP_PTR(block->ioctlWork + (sizeof(IPCIOVector) * 4), 32); + + work = ROUND_UP_PTR(work + FS_MAX_PATH, 32); + *block->getUsageCtx.blockCountOut = *(u32*)work; + + work = ROUND_UP_PTR(work + sizeof(u32), 32); + *block->getUsageCtx.fileCountOut = *(u32*)work; + } + + return IPC_RESULT_OK; +} + +s32 ISFS_CreateFile(const char* path, u32 attr, u32 ownerPerm, u32 groupPerm, + u32 otherPerm) { + FSCommandBlock* block; + s32 ret; + size_t len; + + block = NULL; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->fileIoctl.path, path, len + 1); + + block->fileIoctl.attr = attr; + block->fileIoctl.ownerPerm = ownerPerm; + block->fileIoctl.groupPerm = groupPerm; + block->fileIoctl.otherPerm = otherPerm; + + ret = IOS_Ioctl(__fsFd, FS_IOCTL_CREATE_FILE, &block->fileIoctl, + sizeof(FSFileIoctl), NULL, 0); + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +s32 ISFS_CreateFileAsync(const char* path, u32 attr, u32 ownerPerm, + u32 groupPerm, u32 otherPerm, FSAsyncCallback callback, + void* callbackArg) { + FSCommandBlock* block; + size_t len; + + if (path == NULL || __fsFd < 0 || + (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + memcpy(block->fileIoctl.path, path, len + 1); + + block->fileIoctl.attr = attr; + block->fileIoctl.ownerPerm = ownerPerm; + block->fileIoctl.groupPerm = groupPerm; + block->fileIoctl.otherPerm = otherPerm; + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_CREATE_FILE, &block->fileIoctl, + sizeof(FSFileIoctl), NULL, 0, _isfsFuncCb, block); +} + +s32 ISFS_Open(const char* path, IPCOpenMode mode) { + s32 ret; + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + ret = IPC_RESULT_INVALID; + goto end; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + memcpy(block->ioctlWork, path, len + 1); + + ret = IOS_Open((const char*)block->ioctlWork, mode); + +end: + if (block != NULL) { + FS_DELETE(block); + } + + return ret; +} + +s32 ISFS_OpenAsync(const char* path, IPCOpenMode mode, FSAsyncCallback callback, + void* callbackArg) { + size_t len; + FSCommandBlock* block; + + block = NULL; + + if (path == NULL || (len = strnlen(path, FS_MAX_PATH)) == FS_MAX_PATH) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + memcpy(block->ioctlWork, path, len + 1); + + return IOS_OpenAsync((const char*)block->ioctlWork, mode, _isfsFuncCb, + block); +} + +s32 ISFS_GetFileStats(s32 fd, FSFileStats* statsOut) { + if (statsOut == NULL || (u32)statsOut % 32 != 0) { + return IPC_RESULT_INVALID; + } + + return IOS_Ioctl(fd, FS_IOCTL_GET_FILE_STATS, NULL, 0, statsOut, + sizeof(FSFileStats)); +} + +s32 ISFS_GetFileStatsAsync(s32 fd, FSFileStats* statsOut, + FSAsyncCallback callback, void* callbackArg) { + FSCommandBlock* block; + + if (statsOut == NULL || (u32)statsOut % 32 != 0) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_IoctlAsync(fd, FS_IOCTL_GET_FILE_STATS, NULL, 0, statsOut, + sizeof(FSFileStats), _isfsFuncCb, block); +} + +s32 ISFS_Seek(s32 fd, s32 offset, IPCSeekMode mode) { + return IOS_Seek(fd, offset, mode); +} + +s32 ISFS_SeekAsync(s32 fd, s32 offset, IPCSeekMode mode, + FSAsyncCallback callback, void* callbackArg) { + FSCommandBlock* block; + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_SeekAsync(fd, offset, mode, _isfsFuncCb, block); +} + +s32 ISFS_Read(s32 fd, void* dst, s32 len) { + if (dst == NULL || (u32)dst % 32 != 0) { + return IPC_RESULT_INVALID; + } + + return IOS_Read(fd, dst, len); +} + +s32 ISFS_ReadAsync(s32 fd, void* dst, s32 len, FSAsyncCallback callback, + void* callbackArg) { + FSCommandBlock* block; + + if (dst == NULL || (u32)dst % 32 != 0) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_ReadAsync(fd, dst, len, _isfsFuncCb, block); +} + +s32 ISFS_Write(s32 fd, const void* src, s32 len) { + if (src == NULL || (u32)src % 32 != 0) { + return IPC_RESULT_INVALID; + } + + return IOS_Write(fd, src, len); +} + +s32 ISFS_WriteAsync(s32 fd, const void* src, s32 len, FSAsyncCallback callback, + void* callbackArg) { + FSCommandBlock* block; + + if (src == NULL || (u32)src % 32 != 0) { + return IPC_RESULT_INVALID; + } + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_WriteAsync(fd, src, len, _isfsFuncCb, block); +} + +s32 ISFS_Close(s32 fd) { + return IOS_Close(fd); +} + +s32 ISFS_CloseAsync(s32 fd, FSAsyncCallback callback, void* callbackArg) { + FSCommandBlock* block; + + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + if (block == NULL) { + return IPC_RESULT_BUSY; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_CloseAsync(fd, _isfsFuncCb, block); +} + +s32 ISFS_ShutdownAsync(FSAsyncCallback callback, void* callbackArg) { + FSCommandBlock* block; + + // @bug Memory allocation result is not validated + block = (FSCommandBlock*)iosAllocAligned(hId, sizeof(FSCommandBlock), 32); + + if (__fsFd < 0) { + return IPC_RESULT_INVALID; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->callbackState = CB_STATE_NONE; + + return IOS_IoctlAsync(__fsFd, FS_IOCTL_SHUTDOWN_FS, NULL, 0, NULL, 0, + _isfsFuncCb, block); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXAttr.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXAttr.c new file mode 100644 index 0000000000..0624e22901 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXAttr.c @@ -0,0 +1,723 @@ +// Uses the hacky GXSetVtxAttrFmtv declaration +#define GXATTR_MATCH_HACK + +#include + +static void SETVCDATTR(GXAttr name, GXAttrType type); +static void SETVAT(u32* vatA, u32* vatB, u32* vatC, GXAttr attr, + GXCompCnt compCnt, GXCompType compType, u8 shift); +static u8 GetFracForNrm(GXCompType compType); + +static void __GXXfVtxSpecs(void) { + unsigned int cmd; + u32 nrm; + u32 clr; + u32 txc; + + nrm = gxdt->binormal ? 2 : (gxdt->normal ? 1 : 0); + + // clang-format off + + // Both fields in one access + clr = 32 - + __cntlzw(GX_BITGET(gxdt->vcdLoReg, GX_CP_VCD_LO_COLORSPECULAR_B, + GX_CP_VCD_LO_COLORSPECULAR_SZ + GX_CP_VCD_LO_COLORDIFFUSED_SZ)) + 1; + + // All 16 bits in VCD_Hi + txc = 32 - + __cntlzw(GX_BITGET(gxdt->vcdHiReg, GX_CP_VCD_HI_TEX7COORD_B, + GX_CP_VCD_HI_TEX7COORD_SZ * 8)) + 1; + + // clang-format on + + // TODO: Fakematch? Bitset macros don't work here + GX_XF_LOAD_REG_HDR(GX_XF_REG_INVERTEXSPEC); + cmd = 0; + cmd = cmd | clr >> 1; + cmd = (txc << 3) & ~0xF | cmd; + WGPIPE.i = cmd | nrm << 2; + + gxdt->lastWriteWasXF = TRUE; +} + +void GXSetVtxDesc(GXAttr name, GXAttrType type) { + SETVCDATTR(name, type); + + if (gxdt->normal || gxdt->binormal) { + GX_CP_SET_VCD_LO_NORMAL(gxdt->vcdLoReg, gxdt->normalType); + } else { + GX_CP_SET_VCD_LO_NORMAL(gxdt->vcdLoReg, GX_NONE); + } + + gxdt->gxDirtyFlags |= GX_DIRTY_VCD; +} + +static DECOMP_INLINE void SETVCDATTR(GXAttr name, GXAttrType type) { + switch (name) { + case GX_VA_PNMTXIDX: + GX_CP_SET_VCD_LO_POSMATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX0MTXIDX: + GX_CP_SET_VCD_LO_TEX0MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX1MTXIDX: + GX_CP_SET_VCD_LO_TEX1MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX2MTXIDX: + GX_CP_SET_VCD_LO_TEX2MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX3MTXIDX: + GX_CP_SET_VCD_LO_TEX3MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX4MTXIDX: + GX_CP_SET_VCD_LO_TEX4MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX5MTXIDX: + GX_CP_SET_VCD_LO_TEX5MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX6MTXIDX: + GX_CP_SET_VCD_LO_TEX6MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX7MTXIDX: + GX_CP_SET_VCD_LO_TEX7MATIDX(gxdt->vcdLoReg, type); + break; + case GX_VA_POS: + GX_CP_SET_VCD_LO_POSITION(gxdt->vcdLoReg, type); + break; + case GX_VA_NRM: + if (type != GX_NONE) { + gxdt->normal = TRUE; + // GX_VA_NRM and GX_VA_NBT should not be enabled at the same time + gxdt->binormal = FALSE; + gxdt->normalType = type; + } else { + gxdt->normal = FALSE; + } + break; + case GX_VA_NBT: + if (type != GX_NONE) { + gxdt->binormal = TRUE; + // GX_VA_NRM and GX_VA_NBT should not be enabled at the same time + gxdt->normal = FALSE; + gxdt->normalType = type; + } else { + gxdt->binormal = FALSE; + } + break; + case GX_VA_CLR0: + GX_CP_SET_VCD_LO_COLORDIFFUSED(gxdt->vcdLoReg, type); + break; + case GX_VA_CLR1: + GX_CP_SET_VCD_LO_COLORSPECULAR(gxdt->vcdLoReg, type); + break; + case GX_VA_TEX0: + GX_CP_SET_VCD_HI_TEX0COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX1: + GX_CP_SET_VCD_HI_TEX1COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX2: + GX_CP_SET_VCD_HI_TEX2COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX3: + GX_CP_SET_VCD_HI_TEX3COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX4: + GX_CP_SET_VCD_HI_TEX4COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX5: + GX_CP_SET_VCD_HI_TEX5COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX6: + GX_CP_SET_VCD_HI_TEX6COORD(gxdt->vcdHiReg, type); + break; + case GX_VA_TEX7: + GX_CP_SET_VCD_HI_TEX7COORD(gxdt->vcdHiReg, type); + break; + default: + break; + } +} + +void GXSetVtxDescv(const GXVtxDescList* list) { + for (; list->attr != GX_VA_NULL; list++) { + SETVCDATTR(list->attr, list->type); + } + + if (gxdt->normal || gxdt->binormal) { + GX_CP_SET_VCD_LO_NORMAL(gxdt->vcdLoReg, gxdt->normalType); + } else { + GX_CP_SET_VCD_LO_NORMAL(gxdt->vcdLoReg, GX_NONE); + } + + gxdt->gxDirtyFlags |= GX_DIRTY_VCD; +} + +void __GXSetVCD(void) { + GX_CP_LOAD_REG(GX_CP_REG_VCD_LO, gxdt->vcdLoReg); + GX_CP_LOAD_REG(GX_CP_REG_VCD_HI, gxdt->vcdHiReg); + __GXXfVtxSpecs(); +} + +void __GXCalculateVLim(void) { + static u8 tbl1[] = {0, 4, 1, 2}; + static u8 tbl2[] = {0, 8, 1, 2}; + static u8 tbl3[] = {0, 12, 1, 2}; + + u32 vlim; + u32 vcdLo; + u32 vcdHi; + s32 compCnt; + + if (gxdt->SHORT_0x4 == 0) { + return; + } + + vcdLo = gxdt->vcdLoReg; + vcdHi = gxdt->vcdHiReg; + + // GXCompCnt bit of normal parameters + compCnt = gxdt->vatA[GX_VTXFMT0]; + compCnt = (compCnt & 0x200) >> 9; + + vlim = GX_CP_GET_VCD_LO_POSMATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX0MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX1MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX2MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX3MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX4MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX5MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX6MATIDX(vcdLo); + vlim += GX_CP_GET_VCD_LO_TEX7MATIDX(vcdLo); + + vlim += tbl3[GX_CP_GET_VCD_LO_POSITION(vcdLo)]; + vlim += + tbl3[GX_CP_GET_VCD_LO_NORMAL(vcdLo)] * (compCnt == GX_NRM_NBT ? 3 : 1); + vlim += tbl1[GX_CP_GET_VCD_LO_COLORDIFFUSED(vcdLo)]; + vlim += tbl1[GX_CP_GET_VCD_LO_COLORSPECULAR(vcdLo)]; + + vlim += tbl2[GX_CP_GET_VCD_HI_TEX0COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX1COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX2COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX3COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX4COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX5COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX6COORD(vcdHi)]; + vlim += tbl2[GX_CP_GET_VCD_HI_TEX7COORD(vcdHi)]; + + gxdt->vlim = vlim; +} + +void GXGetVtxDesc(GXAttr name, GXAttrType* type) { + GXAttrType result; + + switch (name) { + case GX_VA_PNMTXIDX: + result = GX_CP_GET_VCD_LO_POSMATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX0MTXIDX: + result = GX_CP_GET_VCD_LO_TEX0MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX1MTXIDX: + result = GX_CP_GET_VCD_LO_TEX1MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX2MTXIDX: + result = GX_CP_GET_VCD_LO_TEX2MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX3MTXIDX: + result = GX_CP_GET_VCD_LO_TEX3MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX4MTXIDX: + result = GX_CP_GET_VCD_LO_TEX4MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX5MTXIDX: + result = GX_CP_GET_VCD_LO_TEX5MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX6MTXIDX: + result = GX_CP_GET_VCD_LO_TEX6MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_TEX7MTXIDX: + result = GX_CP_GET_VCD_LO_TEX7MATIDX(gxdt->vcdLoReg); + break; + case GX_VA_POS: + result = GX_CP_GET_VCD_LO_POSITION(gxdt->vcdLoReg); + break; + case GX_VA_NRM: + result = + gxdt->normal ? GX_CP_GET_VCD_LO_NORMAL(gxdt->vcdLoReg) : GX_NONE; + break; + case GX_VA_NBT: + result = + gxdt->binormal ? GX_CP_GET_VCD_LO_NORMAL(gxdt->vcdLoReg) : GX_NONE; + break; + case GX_VA_CLR0: + result = GX_CP_GET_VCD_LO_COLORDIFFUSED(gxdt->vcdLoReg); + break; + case GX_VA_CLR1: + result = GX_CP_GET_VCD_LO_COLORSPECULAR(gxdt->vcdLoReg); + break; + case GX_VA_TEX0: + result = GX_CP_GET_VCD_HI_TEX0COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX1: + result = GX_CP_GET_VCD_HI_TEX1COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX2: + result = GX_CP_GET_VCD_HI_TEX2COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX3: + result = GX_CP_GET_VCD_HI_TEX3COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX4: + result = GX_CP_GET_VCD_HI_TEX4COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX5: + result = GX_CP_GET_VCD_HI_TEX5COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX6: + result = GX_CP_GET_VCD_HI_TEX6COORD(gxdt->vcdHiReg); + break; + case GX_VA_TEX7: + result = GX_CP_GET_VCD_HI_TEX7COORD(gxdt->vcdHiReg); + break; + default: + result = GX_NONE; + } + + *type = result; +} + +void GXGetVtxDescv(GXVtxDescList* list) { + int i; + GXAttr attr; + int* new_var2; + + for (i = 0; i <= GX_VA_TEX7; i++) { + attr = (GXAttr)i; + list[i].attr = attr; + GXGetVtxDesc(attr, &list[i].type); + } + + list[i].attr = GX_VA_NBT; + GXGetVtxDesc(GX_VA_NBT, &list[i].type); + + // TODO: Fakematch + attr = 1; + i = (*(new_var2 = &i)) + attr; + list[i].attr = GX_VA_NULL; +} + +void GXClearVtxDesc(void) { + gxdt->vcdLoReg = 0; + // GX_VA_POS is required for every vertex descriptor + GX_CP_SET_VCD_LO_POSITION(gxdt->vcdLoReg, GX_DIRECT); + gxdt->vcdHiReg = 0; + gxdt->normal = FALSE; + gxdt->binormal = FALSE; + gxdt->gxDirtyFlags |= GX_DIRTY_VCD; +} + +void GXSetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt compCnt, + GXCompType compType, u8 shift) { + u32* vatA; + u32* vatB; + u32* vatC; + + vatA = &gxdt->vatA[fmt]; + vatB = &gxdt->vatB[fmt]; + vatC = &gxdt->vatC[fmt]; + + SETVAT(vatA, vatB, vatC, attr, compCnt, compType, shift); + gxdt->gxDirtyFlags |= GX_DIRTY_VAT; + gxdt->vatDirtyFlags |= (u8)(1 << (u8)fmt); +} + +static DECOMP_INLINE void SETVAT(u32* vatA, u32* vatB, u32* vatC, GXAttr attr, + GXCompCnt compCnt, GXCompType compType, + u8 shift) { + switch (attr) { + case GX_VA_POS: + GX_CP_SET_VAT_GROUP0_POS_CNT(*vatA, compCnt); + GX_CP_SET_VAT_GROUP0_POS_TYPE(*vatA, compType); + GX_CP_SET_VAT_GROUP0_POS_SHIFT(*vatA, shift); + break; + case GX_VA_NRM: + case GX_VA_NBT: + GX_CP_SET_VAT_GROUP0_NRM_TYPE(*vatA, compType); + if (compCnt == GX_NRM_NBT3) { + // Probably because the compCnt can only be one bit? + GX_CP_SET_VAT_GROUP0_NRM_CNT(*vatA, GX_NRM_NBT); + GX_CP_SET_VAT_GROUP0_NORMALINDEX3(*vatA, TRUE); + } else { + GX_CP_SET_VAT_GROUP0_NRM_CNT(*vatA, compCnt); + GX_CP_SET_VAT_GROUP0_NORMALINDEX3(*vatA, FALSE); + } + break; + case GX_VA_CLR0: + GX_CP_SET_VAT_GROUP0_COLORDIFF_CNT(*vatA, compCnt); + GX_CP_SET_VAT_GROUP0_COLORDIFF_TYPE(*vatA, compType); + break; + case GX_VA_CLR1: + GX_CP_SET_VAT_GROUP0_COLORSPEC_CNT(*vatA, compCnt); + GX_CP_SET_VAT_GROUP0_COLORSPEC_TYPE(*vatA, compType); + break; + case GX_VA_TEX0: + GX_CP_SET_VAT_GROUP0_TXC0_CNT(*vatA, compCnt); + GX_CP_SET_VAT_GROUP0_TXC0_TYPE(*vatA, compType); + GX_CP_SET_VAT_GROUP0_TXC0_SHIFT(*vatA, shift); + break; + case GX_VA_TEX1: + GX_CP_SET_VAT_GROUP1_TXC1_CNT(*vatB, compCnt); + GX_CP_SET_VAT_GROUP1_TXC1_TYPE(*vatB, compType); + GX_CP_SET_VAT_GROUP1_TXC1_SHIFT(*vatB, shift); + break; + case GX_VA_TEX2: + GX_CP_SET_VAT_GROUP1_TXC2_CNT(*vatB, compCnt); + GX_CP_SET_VAT_GROUP1_TXC2_TYPE(*vatB, compType); + GX_CP_SET_VAT_GROUP1_TXC2_SHIFT(*vatB, shift); + break; + case GX_VA_TEX3: + GX_CP_SET_VAT_GROUP1_TXC3_CNT(*vatB, compCnt); + GX_CP_SET_VAT_GROUP1_TXC3_TYPE(*vatB, compType); + GX_CP_SET_VAT_GROUP1_TXC3_SHIFT(*vatB, shift); + break; + case GX_VA_TEX4: + GX_CP_SET_VAT_GROUP1_TXC4_CNT(*vatB, compCnt); + GX_CP_SET_VAT_GROUP1_TXC4_TYPE(*vatB, compType); + GX_CP_SET_VAT_GROUP2_TXC4_SHIFT(*vatC, shift); + break; + case GX_VA_TEX5: + GX_CP_SET_VAT_GROUP2_TXC5_CNT(*vatC, compCnt); + GX_CP_SET_VAT_GROUP2_TXC5_TYPE(*vatC, compType); + GX_CP_SET_VAT_GROUP2_TXC5_SHIFT(*vatC, shift); + break; + case GX_VA_TEX6: + GX_CP_SET_VAT_GROUP2_TXC6_CNT(*vatC, compCnt); + GX_CP_SET_VAT_GROUP2_TXC6_TYPE(*vatC, compType); + GX_CP_SET_VAT_GROUP2_TXC6_SHIFT(*vatC, shift); + break; + case GX_VA_TEX7: + GX_CP_SET_VAT_GROUP2_TXC7_CNT(*vatC, compCnt); + GX_CP_SET_VAT_GROUP2_TXC7_TYPE(*vatC, compType); + GX_CP_SET_VAT_GROUP2_TXC7_SHIFT(*vatC, shift); + break; + } +} + +void GXSetVtxAttrFmtv(s16 fmt, const GXVtxAttrFmtList* list) { + u32* vatA; + u32* vatB; + u32* vatC; + + vatA = &gxdt->vatA[fmt]; + vatB = &gxdt->vatB[fmt]; + vatC = &gxdt->vatC[fmt]; + + for (; list->attr != GX_VA_NULL; list++) { + SETVAT(vatA, vatB, vatC, list->attr, list->compCnt, list->compType, + list->shift); + } + + gxdt->gxDirtyFlags |= GX_DIRTY_VAT; + gxdt->vatDirtyFlags |= (u8)(1 << (u8)fmt); +} + +void __GXSetVAT(void) { + int i = 0; + u32 flags = gxdt->vatDirtyFlags; + + do { + if (flags & 1) { + GX_CP_LOAD_REG(GX_CP_REG_VAT_GROUP0 | i, gxdt->vatA[i]); + GX_CP_LOAD_REG(GX_CP_REG_VAT_GROUP1 | i, gxdt->vatB[i]); + GX_CP_LOAD_REG(GX_CP_REG_VAT_GROUP2 | i, gxdt->vatC[i]); + } + + i++; + flags >>= 1; + } while (flags != 0); + + WGPIPE.c = GX_FIFO_CMD_NOOP; + gxdt->vatDirtyFlags = 0; +} + +void GXGetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt* compCnt, + GXCompType* compType, u8* shift) { + u32* vatA; + u32* vatB; + u32* vatC; + + vatA = &gxdt->vatA[fmt]; + vatB = &gxdt->vatB[fmt]; + vatC = &gxdt->vatC[fmt]; + + switch (attr) { + case GX_VA_POS: + *compCnt = GX_CP_GET_VAT_GROUP0_POS_CNT(*vatA); + *compType = GX_CP_GET_VAT_GROUP0_POS_TYPE(*vatA); + *shift = GX_CP_GET_VAT_GROUP0_POS_SHIFT(*vatA); + break; + case GX_VA_NRM: + case GX_VA_NBT: + *compCnt = GX_CP_GET_VAT_GROUP0_NRM_CNT(*vatA); + + // Undoing what SETVAT did + if (*compCnt == GX_NRM_NBT && + GX_CP_GET_VAT_GROUP0_NORMALINDEX3(*vatA)) { + *compCnt = GX_NRM_NBT3; + } + + *compType = GX_CP_GET_VAT_GROUP0_NRM_TYPE(*vatA); + *shift = GetFracForNrm(*compType); + break; + case GX_VA_CLR0: + *compCnt = GX_CP_GET_VAT_GROUP0_COLORDIFF_CNT(*vatA); + *compType = GX_CP_GET_VAT_GROUP0_COLORDIFF_TYPE(*vatA); + *shift = 0; + break; + case GX_VA_CLR1: + *compCnt = GX_CP_GET_VAT_GROUP0_COLORSPEC_CNT(*vatA); + *compType = GX_CP_GET_VAT_GROUP0_COLORSPEC_TYPE(*vatA); + *shift = 0; + break; + case GX_VA_TEX0: + *compCnt = GX_CP_GET_VAT_GROUP0_TXC0_CNT(*vatA); + *compType = GX_CP_GET_VAT_GROUP0_TXC0_TYPE(*vatA); + *shift = GX_CP_GET_VAT_GROUP0_TXC0_SHIFT(*vatA); + break; + case GX_VA_TEX1: + *compCnt = GX_CP_GET_VAT_GROUP1_TXC1_CNT(*vatB); + *compType = GX_CP_GET_VAT_GROUP1_TXC1_TYPE(*vatB); + *shift = GX_CP_GET_VAT_GROUP1_TXC1_SHIFT(*vatB); + break; + case GX_VA_TEX2: + *compCnt = GX_CP_GET_VAT_GROUP1_TXC2_CNT(*vatB); + *compType = GX_CP_GET_VAT_GROUP1_TXC2_TYPE(*vatB); + *shift = GX_CP_GET_VAT_GROUP1_TXC2_SHIFT(*vatB); + break; + case GX_VA_TEX3: + *compCnt = GX_CP_GET_VAT_GROUP1_TXC3_CNT(*vatB); + *compType = GX_CP_GET_VAT_GROUP1_TXC3_TYPE(*vatB); + *shift = GX_CP_GET_VAT_GROUP1_TXC3_SHIFT(*vatB); + break; + case GX_VA_TEX4: + *compCnt = GX_CP_GET_VAT_GROUP1_TXC4_CNT(*vatB); + *compType = GX_CP_GET_VAT_GROUP1_TXC4_TYPE(*vatB); + *shift = GX_CP_GET_VAT_GROUP2_TXC4_SHIFT(*vatC); + break; + case GX_VA_TEX5: + *compCnt = GX_CP_GET_VAT_GROUP2_TXC5_CNT(*vatC); + *compType = GX_CP_GET_VAT_GROUP2_TXC5_TYPE(*vatC); + *shift = GX_CP_GET_VAT_GROUP2_TXC5_SHIFT(*vatC); + break; + case GX_VA_TEX6: + *compCnt = GX_CP_GET_VAT_GROUP2_TXC6_CNT(*vatC); + *compType = GX_CP_GET_VAT_GROUP2_TXC6_TYPE(*vatC); + *shift = GX_CP_GET_VAT_GROUP2_TXC6_SHIFT(*vatC); + break; + case GX_VA_TEX7: + *compCnt = GX_CP_GET_VAT_GROUP2_TXC7_CNT(*vatC); + *compType = GX_CP_GET_VAT_GROUP2_TXC7_TYPE(*vatC); + *shift = GX_CP_GET_VAT_GROUP2_TXC7_SHIFT(*vatC); + break; + default: + *compCnt = GX_POS_XYZ; + *compType = GX_U8; + *shift = 0; + } +} + +static u8 GetFracForNrm(GXCompType compType) { + switch (compType) { + case GX_S8: + return 6; + case GX_S16: + return 14; + case GX_U16: + default: + return 0; + } +} + +void GXGetVtxAttrFmtv(GXVtxFmt fmt, GXVtxAttrFmtList* list) { + int i; + GXAttr attr; + + for (i = GX_VA_POS; i <= GX_VA_TEX7; i++, list++) { + attr = (GXAttr)i; + list->attr = attr; + GXGetVtxAttrFmt(fmt, attr, &list->compCnt, &list->compType, + &list->shift); + } + + list->attr = GX_VA_NULL; +} + +void GXSetArray(GXAttr attr, const void* base, u8 stride) { + u32 idx; + + if (attr == GX_VA_NBT) { + attr = GX_VA_NRM; + } + + idx = attr - GX_VA_POS; + + GX_CP_LOAD_REG(GX_BP_REG_SETMODE0_TEX4 | idx, + // Address -> offset? + (u32)base & ~0xC0000000); + + GX_CP_LOAD_REG(GX_BP_REG_SETIMAGE2_TEX4 | idx, stride); +} + +void GXInvalidateVtxCache(void) { + WGPIPE.c = GX_FIFO_CMD_INVAL_VTX; +} + +void GXSetTexCoordGen2(GXTexCoordID id, GXTexGenType type, GXTexGenSrc src, + u32 texMtxIdx, GXBool normalize, u32 dualTexMtxIdx) { + u32 reg; + u32 inputRow; + GXXfTexForm inputForm; + + reg = 0; + inputForm = GX_XF_TEX_FORM_AB11; + inputRow = 5; + + switch (src) { + case GX_TG_POS: + inputRow = 0; + inputForm = GX_XF_TEX_FORM_ABC1; + break; + case GX_TG_NRM: + inputRow = 1; + inputForm = GX_XF_TEX_FORM_ABC1; + break; + case GX_TG_BINRM: + inputRow = 3; + inputForm = GX_XF_TEX_FORM_ABC1; + break; + case GX_TG_TANGENT: + inputRow = 4; + inputForm = GX_XF_TEX_FORM_ABC1; + break; + case GX_TG_COLOR0: + inputRow = 2; + break; + case GX_TG_COLOR1: + inputRow = 2; + break; + case GX_TG_TEX0: + inputRow = 5; + break; + case GX_TG_TEX1: + inputRow = 6; + break; + case GX_TG_TEX2: + inputRow = 7; + break; + case GX_TG_TEX3: + inputRow = 8; + break; + case GX_TG_TEX4: + inputRow = 9; + break; + case GX_TG_TEX5: + inputRow = 10; + break; + case GX_TG_TEX6: + inputRow = 11; + break; + case GX_TG_TEX7: + inputRow = 12; + break; + default: + break; + } + + switch (type) { + case GX_TG_MTX2x4: + reg = 0; + GX_XF_SET_TEX_PROJTYPE(reg, GX_XF_TEX_PROJ_ST); // 2x4 projection + GX_XF_SET_TEX_INPUTFORM(reg, inputForm); + GX_XF_SET_TEX_SRCROW(reg, inputRow); + break; + case GX_TG_MTX3x4: + reg = 0; + GX_XF_SET_TEX_PROJTYPE(reg, GX_XF_TEX_PROJ_STQ); // 3x4 projection + GX_XF_SET_TEX_INPUTFORM(reg, inputForm); + GX_XF_SET_TEX_SRCROW(reg, inputRow); + break; + case GX_TG_BUMP0: + case GX_TG_BUMP1: + case GX_TG_BUMP2: + case GX_TG_BUMP3: + case GX_TG_BUMP4: + case GX_TG_BUMP5: + case GX_TG_BUMP6: + case GX_TG_BUMP7: + reg = 0; + GX_XF_SET_TEX_INPUTFORM(reg, inputForm); + GX_XF_SET_TEX_TEXGENTYPE(reg, GX_XF_TG_BUMP); + GX_XF_SET_TEX_SRCROW(reg, inputRow); + GX_XF_SET_TEX_BUMPSRCTEX(reg, src - GX_TG_TEXCOORD0); + GX_XF_SET_TEX_BUMPSRCLIGHT(reg, type - GX_TG_BUMP0); + break; + case GX_TG_SRTG: + reg = 0; + GX_XF_SET_TEX_INPUTFORM(reg, inputForm); + + if (src == GX_TG_COLOR0) { + GX_XF_SET_TEX_TEXGENTYPE(reg, GX_XF_TG_CLR0); + } else { + GX_XF_SET_TEX_TEXGENTYPE(reg, GX_XF_TG_CLR1); + } + + GX_XF_SET_TEX_SRCROW(reg, 2); + break; + default: + break; + } + + gxdt->texRegs[id] = reg; + gxdt->gxDirtyFlags |= GX_DIRTY_TEX0 << id; + + reg = 0; + GX_XF_SET_DUALTEX_BASEROW(reg, dualTexMtxIdx - GX_DUALMTX0); + GX_XF_SET_DUALTEX_NORMALIZE(reg, normalize); + gxdt->dualTexRegs[id] = reg; + + switch (id) { + case GX_TEXCOORD0: + GX_XF_SET_MATRIXINDEX0_TEX0(gxdt->matrixIndex0, texMtxIdx); + break; + case GX_TEXCOORD1: + GX_XF_SET_MATRIXINDEX0_TEX1(gxdt->matrixIndex0, texMtxIdx); + break; + case GX_TEXCOORD2: + GX_XF_SET_MATRIXINDEX0_TEX2(gxdt->matrixIndex0, texMtxIdx); + break; + case GX_TEXCOORD3: + GX_XF_SET_MATRIXINDEX0_TEX3(gxdt->matrixIndex0, texMtxIdx); + break; + case GX_TEXCOORD4: + GX_XF_SET_MATRIXINDEX1_TEX4(gxdt->matrixIndex1, texMtxIdx); + break; + case GX_TEXCOORD5: + GX_XF_SET_MATRIXINDEX1_TEX5(gxdt->matrixIndex1, texMtxIdx); + break; + case GX_TEXCOORD6: + GX_XF_SET_MATRIXINDEX1_TEX6(gxdt->matrixIndex1, texMtxIdx); + break; + default: + GX_XF_SET_MATRIXINDEX1_TEX7(gxdt->matrixIndex1, texMtxIdx); + break; + } + + gxdt->gxDirtyFlags |= GX_DIRTY_MTX_IDX; +} + +void GXSetNumTexGens(u8 num) { + GX_BP_SET_GENMODE_NUMTEX(gxdt->genMode, num); + gxdt->gxDirtyFlags |= GX_DIRTY_NUM_TEX; + gxdt->gxDirtyFlags |= GX_DIRTY_GEN_MODE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXBump.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXBump.c new file mode 100644 index 0000000000..e1d4506be0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXBump.c @@ -0,0 +1,169 @@ +#include + +void GXSetTevIndirect(GXTevStageID tevStage, GXIndTexStageID texStage, + GXIndTexFormat texFmt, GXIndTexBiasSel biasSel, + GXIndTexMtxID mtxId, GXIndTexWrap wrapS, + GXIndTexWrap wrapT, GXBool addPrev, GXBool utcLod, + GXIndTexAlphaSel alphaSel) { + u32 opcode = tevStage + GX_BP_REG_INDTEVSTAGE0; + + u32 cmd = 0; + GX_BP_SET_INDTEVSTAGE_STAGE(cmd, texStage); + GX_BP_SET_INDTEVSTAGE_FORMAT(cmd, texFmt); + GX_BP_SET_INDTEVSTAGE_BIAS(cmd, biasSel); + GX_BP_SET_INDTEVSTAGE_ALPHA(cmd, alphaSel); + GX_BP_SET_INDTEVSTAGE_MTX(cmd, mtxId); + GX_BP_SET_INDTEVSTAGE_WRAPS(cmd, wrapS); + GX_BP_SET_INDTEVSTAGE_WRAPT(cmd, wrapT); + GX_BP_SET_INDTEVSTAGE_UTCLOD(cmd, utcLod); + GX_BP_SET_INDTEVSTAGE_ADDPREV(cmd, addPrev); + GX_BP_SET_OPCODE(cmd, opcode); + + GX_BP_LOAD_REG(cmd); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetIndTexMtx(GXIndTexMtxID id, const f32 offset[2][3], s8 scaleExp) { + u32 index; + u32 cmd; + + switch (id) { + case GX_ITM_0: + case GX_ITM_1: + case GX_ITM_2: + index = id - GX_ITM_0; + break; + case GX_ITM_S0: + case GX_ITM_S1: + case GX_ITM_S2: + index = id - GX_ITM_S0; + break; + case GX_ITM_T0: + case GX_ITM_T1: + case GX_ITM_T2: + index = id - GX_ITM_T0; + break; + case 4: + case 8: + default: + index = 0; + } + + scaleExp += 17; + + cmd = 0; + GX_BP_SET_INDMTXA_M00(cmd, 1024.0f * offset[0][0]); + GX_BP_SET_INDMTXA_M10(cmd, 1024.0f * offset[1][0]); + GX_BP_SET_INDMTXA_EXP(cmd, scaleExp); + GX_BP_SET_OPCODE(cmd, index * 3 + GX_BP_REG_INDMTX0A); + GX_BP_LOAD_REG(cmd); + + // TODO: Match using GX_BP_SET_INDMTXB_EXP + cmd = 0; + GX_BP_SET_INDMTXB_M01(cmd, 1024.0f * offset[0][1]); + GX_BP_SET_INDMTXB_M11(cmd, 1024.0f * offset[1][1]); + cmd = __rlwimi(cmd, scaleExp, 20, 8, 9); + GX_BP_SET_OPCODE(cmd, index * 3 + GX_BP_REG_INDMTX0B); + GX_BP_LOAD_REG(cmd); + + // TODO: Match using GX_BP_SET_INDMTXC_EXP + cmd = 0; + GX_BP_SET_INDMTXC_M02(cmd, 1024.0f * offset[0][2]); + GX_BP_SET_INDMTXC_M12(cmd, 1024.0f * offset[1][2]); + cmd = __rlwimi(cmd, scaleExp, 18, 8, 9); + GX_BP_SET_OPCODE(cmd, index * 3 + GX_BP_REG_INDMTX0C); + GX_BP_LOAD_REG(cmd); + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetIndTexCoordScale(GXIndTexStageID stage, GXIndTexScale scaleS, + GXIndTexScale scaleT) { + switch (stage) { + case GX_INDTEXSTAGE0: + GX_BP_SET_RAS1_SS0_S0(gxdt->ras1_ss0, scaleS); + GX_BP_SET_RAS1_SS0_T0(gxdt->ras1_ss0, scaleT); + GX_BP_SET_OPCODE(gxdt->ras1_ss0, GX_BP_REG_RAS1_SS0); + GX_BP_LOAD_REG(gxdt->ras1_ss0); + break; + case GX_INDTEXSTAGE1: + GX_BP_SET_RAS1_SS0_S1(gxdt->ras1_ss0, scaleS); + GX_BP_SET_RAS1_SS0_T1(gxdt->ras1_ss0, scaleT); + GX_BP_SET_OPCODE(gxdt->ras1_ss0, GX_BP_REG_RAS1_SS0); + GX_BP_LOAD_REG(gxdt->ras1_ss0); + break; + case GX_INDTEXSTAGE2: + GX_BP_SET_RAS1_SS1_S2(gxdt->ras1_ss1, scaleS); + GX_BP_SET_RAS1_SS1_T2(gxdt->ras1_ss1, scaleT); + GX_BP_SET_OPCODE(gxdt->ras1_ss1, GX_BP_REG_RAS1_SS1); + GX_BP_LOAD_REG(gxdt->ras1_ss1); + break; + case GX_INDTEXSTAGE3: + GX_BP_SET_RAS1_SS1_S3(gxdt->ras1_ss1, scaleS); + GX_BP_SET_RAS1_SS1_T3(gxdt->ras1_ss1, scaleT); + GX_BP_SET_OPCODE(gxdt->ras1_ss1, GX_BP_REG_RAS1_SS1); + GX_BP_LOAD_REG(gxdt->ras1_ss1); + break; + } + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord, + GXTexMapID map) { + if (map == GX_TEXMAP_NULL) { + map = GX_TEXMAP0; + } + + if (coord == GX_TEXCOORD_NULL) { + coord = GX_TEXCOORD0; + } + + switch (stage) { + case GX_INDTEXSTAGE0: + GX_BP_SET_RAS1_IREF_MAP0(gxdt->ras1_iref, map); + GX_BP_SET_RAS1_IREF_TXC0(gxdt->ras1_iref, coord); + break; + case GX_INDTEXSTAGE1: + GX_BP_SET_RAS1_IREF_MAP1(gxdt->ras1_iref, map); + GX_BP_SET_RAS1_IREF_TXC1(gxdt->ras1_iref, coord); + break; + case GX_INDTEXSTAGE2: + GX_BP_SET_RAS1_IREF_MAP2(gxdt->ras1_iref, map); + GX_BP_SET_RAS1_IREF_TXC2(gxdt->ras1_iref, coord); + break; + case GX_INDTEXSTAGE3: + GX_BP_SET_RAS1_IREF_MAP3(gxdt->ras1_iref, map); + GX_BP_SET_RAS1_IREF_TXC3(gxdt->ras1_iref, coord); + break; + } + + GX_BP_LOAD_REG(gxdt->ras1_iref); + gxdt->gxDirtyFlags |= GX_DIRTY_SU_TEX; + gxdt->gxDirtyFlags |= GX_DIRTY_BP_MASK; + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetNumIndStages(u8 num) { + GX_BP_SET_GENMODE_NUMINDSTAGES(gxdt->genMode, num); + gxdt->gxDirtyFlags |= GX_DIRTY_BP_MASK; + gxdt->gxDirtyFlags |= GX_DIRTY_GEN_MODE; +} + +void GXSetTevDirect(GXTevStageID stage) { + GXSetTevIndirect(stage, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF, + GX_ITW_OFF, GX_ITW_OFF, FALSE, FALSE, GX_ITBA_OFF); +} + +void __GXUpdateBPMask(void) {} + +void __GXSetIndirectMask(u32 mask) { + GX_BP_SET_INDIMASK_IMASK(gxdt->ind_imask, mask); + GX_BP_LOAD_REG(gxdt->ind_imask); + gxdt->lastWriteWasXF = FALSE; +} + +void __GXFlushTextureState(void) { + GX_BP_LOAD_REG(gxdt->ind_imask); + gxdt->lastWriteWasXF = FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDisplayList.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDisplayList.c new file mode 100644 index 0000000000..6dbdd22c9f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDisplayList.c @@ -0,0 +1,74 @@ +#include +#include +#include + +static GXFifoObj DisplayListFifo; +static GXData __savedGXdata; +static GXFifoObj OldCPUFifo; + +void GXBeginDisplayList(void* list, u32 size) { + GXFifoObjImpl* impl = (GXFifoObjImpl*)&DisplayListFifo; + + if (gxdt->gxDirtyFlags != 0) { + __GXSetDirtyState(); + } + + if (gxdt->dlistSave) { + memcpy(&__savedGXdata, gxdt, sizeof(GXData)); + } + + impl->base = list; + impl->end = (u8*)list + size - 4; + impl->size = size; + impl->count = 0; + impl->readPtr = list; + impl->writePtr = list; + + gxdt->dlistActive = TRUE; + + GXGetCPUFifo(&OldCPUFifo); + GXSetCPUFifo(&DisplayListFifo); + GXResetWriteGatherPipe(); +} + +u32 GXEndDisplayList(void) { + u8 wrap; + BOOL enabled; + u32 ctrl; + + GXGetCPUFifo(&DisplayListFifo); + wrap = GXGetFifoWrap(&DisplayListFifo); + GXSetCPUFifo(&OldCPUFifo); + + if (gxdt->dlistSave) { + enabled = OSDisableInterrupts(); + + ctrl = gxdt->cpCtrlReg; + memcpy(gxdt, &__savedGXdata, sizeof(GXData)); + gxdt->cpCtrlReg = ctrl; + + OSRestoreInterrupts(enabled); + } + + gxdt->dlistActive = FALSE; + + if (!wrap) { + return GXGetFifoCount(&DisplayListFifo); + } + + return 0; +} + +void GXCallDisplayList(void* list, u32 size) { + if (gxdt->gxDirtyFlags != 0) { + __GXSetDirtyState(); + } + + if (gxdt->WORD_0x0 == 0) { + __GXSendFlushPrim(); + } + + WGPIPE.c = GX_FIFO_CMD_CALL_DL; + WGPIPE.p = list; + WGPIPE.i = size; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDraw.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDraw.c new file mode 100644 index 0000000000..badf06f72f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXDraw.c @@ -0,0 +1,162 @@ +#include +#include + +// +1 for null terminator +static GXVtxDescList vcd[GX_VA_MAX_ATTR + 1]; +static GXVtxAttrFmtList vat[GX_VA_MAX_ATTR + 1]; + +void GXDrawCylinder(u8 sides) { + // Unit-circle vertices + f32 vx[100]; + f32 vy[100]; + + f32 z, zn; + f32 sectorAngle; + s32 i; + + // Radius in both directions + z = 1.0f; + zn = -z; + + // Backup VAT/VCD + GXGetVtxDescv(vcd); + GXGetVtxAttrFmtv(GX_VTXFMT3, vat); + + // Set custom VAT/VCD + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_NRM, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0); + + // Calculate vertices + for (i = 0; i <= sides; i++) { + sectorAngle = 2.0f * i * M_PI / sides; + vx[i] = cosf(sectorAngle); + vy[i] = sinf(sectorAngle); + } + + GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT3, (sides + 1) * 2); + { + for (i = 0; i <= sides; i++) { + GXPosition3f32(vx[i], vy[i], zn); + GXPosition3f32(vx[i], vy[i], 0.0f); + GXPosition3f32(vx[i], vy[i], z); + GXPosition3f32(vx[i], vy[i], 0.0f); + } + } + GXEnd(); + + GXBegin(GX_TRIANGLEFAN, GX_VTXFMT3, sides + 2); + { + GXPosition3f32(0.0f, 0.0f, z); + GXPosition3f32(0.0f, 0.0f, 1.0f); + + for (i = 0; i <= sides; i++) { + + GXPosition3f32(vx[i], -vy[i], z); + GXPosition3f32(0.0f, 0.0f, 1.0f); + } + } + GXEnd(); + + GXBegin(GX_TRIANGLEFAN, GX_VTXFMT3, sides + 2); + { + GXPosition3f32(0.0f, 0.0f, zn); + GXPosition3f32(0.0f, 0.0f, -1.0f); + + for (i = 0; i <= sides; i++) { + GXPosition3f32(vx[i], vy[i], zn); + GXPosition3f32(0.0f, 0.0f, -1.0f); + } + } + GXEnd(); + + // Restore old VAT/VCD + GXSetVtxDescv(vcd); + GXSetVtxAttrFmtv(GX_VTXFMT3, vat); +} + +void GXDrawSphere(u32 stacks, u32 sectors) { + GXAttrType tex0, tex0_copy; + f32 radius; + f32 stackStep, sectorStep; + f32 stackAngle, stackAngleNext; + f32 now_xy, next_xy; + f32 now_z, next_z; + f32 sectorAngle; + f32 cosv, sinv; + int i, j; + + stackStep = M_PI / stacks; + sectorStep = 2 * M_PI / sectors; + radius = 1.0f; + + // Check texcoord attributes + GXGetVtxDesc(GX_VA_TEX0, &tex0); + + // Backup VAT/VCD + GXGetVtxDescv(vcd); + GXGetVtxAttrFmtv(GX_VTXFMT3, vat); + + // Set custom VAT/VCD + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_NRM, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0); + + // Setup texcoord VAT/VCD if enabled + if (tex0 != GX_NONE) { + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + } + + for (i = 0; i < (int)stacks; i++) { + stackAngle = i * stackStep; + stackAngleNext = stackAngle + stackStep; + + now_xy = radius * sinf(stackAngle); + next_xy = radius * sinf(stackAngleNext); + now_z = radius * cosf(stackAngle); + next_z = radius * cosf(stackAngleNext); + + GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT3, (sectors + 1) * 2); + { + tex0_copy = tex0; + + for (j = 0; j <= (int)sectors; j++) { + sectorAngle = j * sectorStep; + cosv = cosf(sectorAngle); + sinv = sinf(sectorAngle); + + // Vertex 2 position + GXPosition3f32(cosv * next_xy, sinv * next_xy, next_z); + // Vertex 2 normal + GXPosition3f32(cosv * next_xy / radius, sinv * next_xy / radius, + next_z / radius); + + // Vertex 2 texcoord (S,T) + if (tex0_copy != GX_NONE) { + GXTexCoord2f32((f32)j / sectors, (f32)(i + 1) / stacks); + } + + // Vertex 1 position + GXPosition3f32(cosv * now_xy, sinv * now_xy, now_z); + // Vertex 1 normal + GXPosition3f32(cosv * now_xy / radius, sinv * now_xy / radius, + now_z / radius); + + // Vertex 1 texcoord (S,T) + if (tex0_copy != GX_NONE) { + GXTexCoord2f32((f32)j / sectors, (f32)i / stacks); + } + } + } + GXEnd(); + } + + // Restore old VAT/VCD + GXSetVtxDescv(vcd); + GXSetVtxAttrFmtv(GX_VTXFMT3, vat); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXGeometry.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXGeometry.c new file mode 100644 index 0000000000..af16c18a88 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXGeometry.c @@ -0,0 +1,212 @@ +#include + +inline void __GXSetAmbMat(u32 dirtyFlags) { + if (dirtyFlags & GX_DIRTY_AMB_COLOR0) { + GX_XF_LOAD_REG(GX_XF_REG_AMBIENT0, *(u32*)&gxdt->ambColors[0]); + } + + if (dirtyFlags & GX_DIRTY_AMB_COLOR1) { + GX_XF_LOAD_REG(GX_XF_REG_AMBIENT1, *(u32*)&gxdt->ambColors[1]); + } + + if (dirtyFlags & GX_DIRTY_MAT_COLOR0) { + GX_XF_LOAD_REG(GX_XF_REG_MATERIAL0, *(u32*)&gxdt->matColors[0]); + } + + if (dirtyFlags & GX_DIRTY_MAT_COLOR1) { + GX_XF_LOAD_REG(GX_XF_REG_MATERIAL1, *(u32*)&gxdt->matColors[1]); + } +} + +inline void __GXSetLightChan(volatile s32 dirtyFlags) { + int i; + u32 bits; + u32 addr = GX_XF_REG_COLOR0CNTRL; + + if (dirtyFlags & GX_DIRTY_NUM_COLORS) { + u32 colors = GX_BP_GET_GENMODE_NUMCOLORS(gxdt->genMode); + GX_XF_LOAD_REG(GX_XF_REG_NUMCOLORS, colors); + } + + bits = dirtyFlags; + bits = (bits >> 12) & 0xF; + i = 0; + for (; bits != 0; i++, addr++, bits >>= 1) { + if (bits & 1) { + GX_XF_LOAD_REG(addr, gxdt->colorControl[i]); + } + } +} + +inline void __GXSetTexGen(volatile s32 dirtyFlags) { + int i; + u32 bits; + u32 taddr = GX_XF_REG_TEX0; + u32 dtaddr; + + if (dirtyFlags & GX_DIRTY_NUM_TEX) { + u32 gens = GX_BP_GET_GENMODE_NUMTEX(gxdt->genMode); + GX_XF_LOAD_REG(GX_XF_REG_NUMTEX, gens); + } + + bits = dirtyFlags; + bits = (bits >> 16) & 0xFF; + i = 0; + for (; bits != 0; taddr++, i++, bits >>= 1) { + dtaddr = taddr + GX_XF_REG_DUALTEX0 - GX_XF_REG_TEX0; + if (bits & 1) { + GX_XF_LOAD_REG(taddr, gxdt->texRegs[i]); + GX_XF_LOAD_REG(dtaddr, gxdt->dualTexRegs[i]); + } + } +} + +void __GXSetDirtyState(void) { + u32 tempFlags; + u32 dirtyFlags = gxdt->gxDirtyFlags; + + if (dirtyFlags & GX_DIRTY_SU_TEX) { + __GXSetSUTexRegs(); + } + + if (dirtyFlags & GX_DIRTY_BP_MASK) { + __GXUpdateBPMask(); + } + + if (dirtyFlags & GX_DIRTY_GEN_MODE) { + __GXSetGenMode(); + } + + if (dirtyFlags & GX_DIRTY_VCD) { + __GXSetVCD(); + } + + if (dirtyFlags & GX_DIRTY_VAT) { + __GXSetVAT(); + } + + if (dirtyFlags & (GX_DIRTY_VCD | GX_DIRTY_VAT)) { + __GXCalculateVLim(); + } + + dirtyFlags &= ~0xFF; + if (dirtyFlags) { + tempFlags = dirtyFlags & GX_AMB_MAT_MASK; + if (tempFlags != 0) { + __GXSetAmbMat(tempFlags); + } + + tempFlags = dirtyFlags & GX_LIGHT_CHAN_MASK; + if (tempFlags != 0) { + __GXSetLightChan(tempFlags); + } + + tempFlags = dirtyFlags & GX_TEX_GEN_MASK; + if (tempFlags != 0) { + __GXSetTexGen(tempFlags); + } + + tempFlags = dirtyFlags & GX_DIRTY_MTX_IDX; + if (tempFlags != 0) { + __GXSetMatrixIndex(GX_VA_PNMTXIDX); + __GXSetMatrixIndex(GX_VA_TEX4MTXIDX); + } + + tempFlags = dirtyFlags & GX_DIRTY_VIEWPORT; + if (tempFlags != 0) { + __GXSetViewport(); + } + + tempFlags = dirtyFlags & GX_DIRTY_PROJECTION; + if (tempFlags != 0) { + __GXSetProjection(); + } + + gxdt->lastWriteWasXF = TRUE; + } + + gxdt->gxDirtyFlags = 0; +} + +void GXBegin(GXPrimitive prim, GXVtxFmt fmt, u16 verts) { + if (gxdt->gxDirtyFlags != 0) { + __GXSetDirtyState(); + } + + if (gxdt->WORD_0x0 == 0) { + __GXSendFlushPrim(); + } + + WGPIPE.c = fmt | prim; + WGPIPE.s = verts; +} + +void __GXSendFlushPrim(void) { + u32 i; + u32 sz = gxdt->SHORT_0x4 * gxdt->vlim; + + WGPIPE.uc = GX_TRIANGLESTRIP; + WGPIPE.us = gxdt->SHORT_0x4; + + for (i = 0; i < sz; i += 4) { + WGPIPE.i = 0; + } + + gxdt->lastWriteWasXF = TRUE; +} + +void GXSetLineWidth(u8 width, u32 offset) { + GX_BP_SET_LINEPTWIDTH_LINESZ(gxdt->linePtWidth, width); + GX_BP_SET_LINEPTWIDTH_LINEOFS(gxdt->linePtWidth, offset); + GX_BP_LOAD_REG(gxdt->linePtWidth); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetPointSize(u8 size, u32 offset) { + GX_BP_SET_LINEPTWIDTH_POINTSZ(gxdt->linePtWidth, size); + GX_BP_SET_LINEPTWIDTH_POINTOFS(gxdt->linePtWidth, offset); + GX_BP_LOAD_REG(gxdt->linePtWidth); + gxdt->lastWriteWasXF = FALSE; +} + +void GXEnableTexOffsets(GXTexCoordID id, GXBool lineOfs, GXBool pointOfs) { + GX_BP_SET_SU_SIZE_USELINEOFS(gxdt->txcRegs[id], lineOfs); + GX_BP_SET_SU_SIZE_USEPOINTOFS(gxdt->txcRegs[id], pointOfs); + GX_BP_LOAD_REG(gxdt->txcRegs[id]); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetCullMode(GXCullMode mode) { + // Swap bits to get hardware representation + GXCullMode bits = (GXCullMode)(mode << 1 & 2 | mode >> 1 & 1); + GX_BP_SET_GENMODE_CULLMODE(gxdt->genMode, bits); + gxdt->gxDirtyFlags |= GX_DIRTY_GEN_MODE; +} + +void GXGetCullMode(GXCullMode* out) { + // TODO: Fakematch? Should use GX_BP_GET_GENMODE_CULLMODE if possible + s32 bits = 0; + bits |= (s32)(gxdt->genMode >> (13 + 1) & 2) >> 1; + bits |= (s32)(gxdt->genMode >> 13 & 2); + *out = (GXCullMode)bits; +} + +void GXSetCoPlanar(GXBool coplanar) { + u32 reg; + + GX_BP_SET_GENMODE_COPLANAR(gxdt->genMode, coplanar); + + // TODO: GX_BP_SET_OPCODE doesn't work. + // Did they really write this out? + reg = 0; + reg |= GX_BP_REG_SSMASK << 24; + reg |= 0x80000; + + GX_BP_LOAD_REG(reg); + GX_BP_LOAD_REG(gxdt->genMode); +} + +void __GXSetGenMode(void) { + GX_BP_LOAD_REG(gxdt->genMode); + gxdt->lastWriteWasXF = FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXLight.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXLight.c new file mode 100644 index 0000000000..d91b31c8a5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXLight.c @@ -0,0 +1,362 @@ +#include + +#include + +#define XF_MEM_LOBJ_SIZE 16 + +void GXInitLightAttn(GXLightObj* light, f32 aa, f32 ab, f32 ac, f32 ka, f32 kb, + f32 kc) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + + impl->aa = aa; + impl->ab = ab; + impl->ac = ac; + impl->ka = ka; + impl->kb = kb; + impl->kc = kc; +} + +void GXInitLightAttnA(GXLightObj* light, f32 a, f32 b, f32 c) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + + impl->aa = a; + impl->ab = b; + impl->ac = c; +} + +void GXInitLightAttnK(GXLightObj* light, f32 a, f32 b, f32 c) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + + impl->ka = a; + impl->kb = b; + impl->kc = c; +} + +void GXInitLightSpot(GXLightObj* light, f32 angle, GXSpotFn fn) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + f32 a, b, c, d; + f32 rad; + + if (angle <= 0.0f || angle > 90.0f) { + fn = GX_SP_OFF; + } + + rad = cosf(M_PI * angle / 180.0f); + + switch (fn) { + case GX_SP_FLAT: + a = -1000.0f * rad; + b = 1000.0f; + c = 0.0f; + break; + case GX_SP_COS: + b = 1.0f / (1.0f - rad); + a = -rad * b; + c = 0.0f; + break; + case GX_SP_COS2: + c = 1.0f / (1.0f - rad); + a = 0.0f; + b = -rad * c; + break; + case GX_SP_SHARP: + d = 1.0f / ((1.0f - rad) * (1.0f - rad)); + a = (rad * (rad - 2.0f)) * d; + b = 2.0f * d; + c = -d; + break; + case GX_SP_RING1: + d = 1.0f / ((1.0f - rad) * (1.0f - rad)); + c = -4.0f * d; + a = c * rad; + b = 4.0f * (1.0f + rad) * d; + break; + case GX_SP_RING2: + d = 1.0f / ((1.0f - rad) * (1.0f - rad)); + a = 1.0f - 2.0f * rad * rad * d; + b = 4.0f * rad * d; + c = -2.0f * d; + break; + case GX_SP_OFF: + default: + a = 1.0f; + b = 0.0f; + c = 0.0f; + break; + } + + impl->aa = a; + impl->ab = b; + impl->ac = c; +} + +void GXInitLightDistAttn(GXLightObj* light, f32 distance, f32 brightness, + GXDistAttnFn fn) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + f32 a, b, c; + + if (distance < 0.0f) { + fn = GX_DA_OFF; + } + + if (brightness <= 0.0f || brightness >= 1.0f) { + fn = GX_DA_OFF; + } + + switch (fn) { + case GX_DA_GENTLE: + a = 1.0f; + b = (1.0f - brightness) / (brightness * distance); + c = 0.0f; + break; + case GX_DA_MEDIUM: + a = 1.0f; + b = (0.5f * (1.0f - brightness)) / (brightness * distance); + c = (0.5f * (1.0f - brightness)) / (distance * (brightness * distance)); + break; + case GX_DA_STEEP: + a = 1.0f; + b = 0.0f; + c = (1.0f - brightness) / (distance * (brightness * distance)); + break; + case GX_DA_OFF: + default: + a = 1.0f; + b = 0.0f; + c = 0.0f; + break; + } + + impl->ka = a; + impl->kb = b; + impl->kc = c; +} + +void GXInitLightPos(GXLightObj* light, f32 x, f32 y, f32 z) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + + impl->posX = x; + impl->posY = y; + impl->posZ = z; +} + +void GXGetLightPos(const GXLightObj* light, f32* x, f32* y, f32* z) { + const GXLightObjImpl* impl = (GXLightObjImpl*)light; + + *x = impl->posX; + *y = impl->posY; + *z = impl->posZ; +} + +void GXInitLightDir(GXLightObj* light, f32 x, f32 y, f32 z) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + + impl->dirX = -x; + impl->dirY = -y; + impl->dirZ = -z; +} + +void GXGetLightDir(const GXLightObj* light, f32* x, f32* y, f32* z) { + const GXLightObjImpl* impl = (GXLightObjImpl*)light; + + *x = -impl->dirX; + *y = -impl->dirY; + *z = -impl->dirZ; +} + +void GXInitSpecularDir(GXLightObj* light, f32 x, f32 y, f32 z) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + f32 dirX, dirY, dirZ; + f32 mag; + + dirX = -x; + dirY = -y; + dirZ = 1.0f + -z; + + mag = dirX * dirX + dirY * dirY + dirZ * dirZ; + if (mag != 0.0f) { + mag = 1.0f / sqrtf(mag); + } + + impl->dirX = dirX * mag; + impl->dirY = dirY * mag; + impl->dirZ = dirZ * mag; + + impl->posX = -999999999999999999.0f * x; + impl->posY = -999999999999999999.0f * y; + impl->posZ = -999999999999999999.0f * z; +} + +void GXInitLightColor(GXLightObj* light, GXColor color) { + GXLightObjImpl* impl = (GXLightObjImpl*)light; + *(u32*)&impl->color = *(u32*)&color; +} + +// TODO: This inline is fake, and also is a fake match (r6 hardcoded) +inline void WriteLightObj(register volatile void* dst, + register const GXLightObjImpl* src) { + register u32 color; + register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; + + // clang-format off + asm volatile { + lwz color, src->color + xor r6, r6, r6 // make zero + psq_l ps_0, GXLightObjImpl.aa(src), 0, 0 + psq_l ps_1, GXLightObjImpl.ac(src), 0, 0 + psq_l ps_2, GXLightObjImpl.kb(src), 0, 0 + psq_l ps_3, GXLightObjImpl.posX(src), 0, 0 + psq_l ps_4, GXLightObjImpl.posZ(src), 0, 0 + psq_l ps_5, GXLightObjImpl.dirY(src), 0, 0 + + stw r6, 0(dst) + stw r6, 0(dst) + stw r6, 0(dst) + + stw color, 0(dst) + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 0(dst), 0, 0 + psq_st ps_2, 0(dst), 0, 0 + psq_st ps_3, 0(dst), 0, 0 + psq_st ps_4, 0(dst), 0, 0 + psq_st ps_5, 0(dst), 0, 0 + } + // clang-format on +} + +void GXLoadLightObjImm(const GXLightObj* light, GXLightID id) { + const GXLightObjImpl* impl; + u32 num; + + impl = (GXLightObjImpl*)light; + num = 31 - __cntlzw(id); + num = (num % 8) * XF_MEM_LOBJ_SIZE; + + GX_XF_LOAD_REGS(XF_MEM_LOBJ_SIZE - 1, num + GX_XF_MEM_LIGHTOBJ); + WriteLightObj(&WGPIPE, impl); + gxdt->lastWriteWasXF = TRUE; +} + +void GXLoadLightObjIndx(u16 index, GXLightID id) { + u32 num; + + num = 31 - __cntlzw(id); + num = (num % 8) * XF_MEM_LOBJ_SIZE; + + GX_FIFO_LOAD_INDX_D(num + GX_XF_MEM_LIGHTOBJ, XF_MEM_LOBJ_SIZE - 1, index); + gxdt->lastWriteWasXF = TRUE; +} + +void GXSetChanAmbColor(GXChannelID chan, GXColor color) { + u32 ambColor; + u32 colorId; + + switch (chan) { + case GX_COLOR0: + ambColor = + GX_BITSET_TRUNC(*(u32*)&gxdt->ambColors[0], 0, 24, *(u32*)&color); + colorId = 0; + break; + case GX_COLOR1: + ambColor = + GX_BITSET_TRUNC(*(u32*)&gxdt->ambColors[1], 0, 24, *(u32*)&color); + colorId = 1; + break; + case GX_ALPHA0: + ambColor = GX_BITSET_TRUNC(*(u32*)&gxdt->ambColors[0], 24, 8, color.a); + colorId = 0; + break; + case GX_ALPHA1: + ambColor = GX_BITSET_TRUNC(*(u32*)&gxdt->ambColors[1], 24, 8, color.a); + colorId = 1; + break; + case GX_COLOR0A0: + ambColor = *(u32*)&color; + colorId = 0; + break; + case GX_COLOR1A1: + ambColor = *(u32*)&color; + colorId = 1; + break; + default: + return; + } + + gxdt->gxDirtyFlags |= GX_DIRTY_AMB_COLOR0 << colorId; + *(u32*)&gxdt->ambColors[colorId] = ambColor; +} + +void GXSetChanMatColor(GXChannelID chan, GXColor color) { + u32 matColor; + u32 colorId; + + switch (chan) { + case GX_COLOR0: + matColor = + GX_BITSET_TRUNC(*(u32*)&gxdt->matColors[0], 0, 24, *(u32*)&color); + colorId = 0; + break; + case GX_COLOR1: + matColor = + GX_BITSET_TRUNC(*(u32*)&gxdt->matColors[1], 0, 24, *(u32*)&color); + colorId = 1; + break; + case GX_ALPHA0: + matColor = GX_BITSET_TRUNC(*(u32*)&gxdt->matColors[0], 24, 8, color.a); + colorId = 0; + break; + case GX_ALPHA1: + matColor = GX_BITSET_TRUNC(*(u32*)&gxdt->matColors[1], 24, 8, color.a); + colorId = 1; + break; + case GX_COLOR0A0: + matColor = *(u32*)&color; + colorId = 0; + break; + case GX_COLOR1A1: + matColor = *(u32*)&color; + colorId = 1; + break; + default: + return; + } + + gxdt->gxDirtyFlags |= GX_DIRTY_MAT_COLOR0 << colorId; + *(u32*)&gxdt->matColors[colorId] = matColor; +} + +void GXSetNumChans(u8 num) { + GX_BP_SET_GENMODE_NUMCOLORS(gxdt->genMode, num); + gxdt->gxDirtyFlags |= GX_DIRTY_NUM_COLORS; + gxdt->gxDirtyFlags |= GX_DIRTY_GEN_MODE; +} + +void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc ambSrc, + GXColorSrc matSrc, GXLightID lightMask, GXDiffuseFn diffFn, + GXAttnFn attnFn) { + u32 regIdx = (u32)chan % 4; + u32 reg = 0; + + GX_XF_SET_COLOR0CNTRL_LIGHT(reg, enable); + GX_XF_SET_COLOR0CNTRL_MATSRC(reg, matSrc); + GX_XF_SET_COLOR0CNTRL_AMBSRC(reg, ambSrc); + GX_XF_SET_COLOR0CNTRL_DIFFUSEATTN(reg, attnFn == GX_AF_SPEC ? GX_DF_NONE + : diffFn); + GX_XF_SET_COLOR0CNTRL_ATTNENABLE(reg, attnFn != GX_AF_NONE); + GX_XF_SET_COLOR0CNTRL_ATTNSELECT(reg, attnFn != GX_AF_SPEC); + GX_XF_SET_COLOR0CNTRL_LMASKLO(reg, (u32)lightMask); + GX_XF_SET_COLOR0CNTRL_LMASKHI(reg, (u32)lightMask >> 4); + + gxdt->colorControl[regIdx] = reg; + gxdt->gxDirtyFlags |= GX_DIRTY_CHAN_COLOR0 << (regIdx); + + if (chan == GX_COLOR0A0) { + gxdt->colorControl[GX_ALPHA0] = reg; + gxdt->gxDirtyFlags |= GX_DIRTY_CHAN_COLOR0; + gxdt->gxDirtyFlags |= GX_DIRTY_CHAN_ALPHA0; + } else if (chan == GX_COLOR1A1) { + gxdt->colorControl[GX_ALPHA1] = reg; + gxdt->gxDirtyFlags |= GX_DIRTY_CHAN_COLOR1; + gxdt->gxDirtyFlags |= GX_DIRTY_CHAN_ALPHA1; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXPixel.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXPixel.c new file mode 100644 index 0000000000..5443d9123a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXPixel.c @@ -0,0 +1,253 @@ +#include +#include + +void GXSetFog(GXFogType type, GXColor color, f32 start, f32 end, f32 near, + f32 far) { + f32 a, c; + u32 a_bits, c_bits; + + u32 fogColorReg = 0; + u32 fogParamReg0 = 0; + u32 fogParamReg1 = 0; + u32 fogParamReg2 = 0; + u32 fogParamReg3 = 0; + + u32 fsel = GX_FOG_GET_FSEL(type); + BOOL ortho = GX_FOG_GET_PROJ(type); + + if (ortho) { + if (far == near || end == start) { + a = 0.0f; + c = 0.0f; + } else { + a = (1.0f / (end - start)) * (far - near); + c = (1.0f / (end - start)) * (start - near); + } + } else { + f32 f28, f25, f24; + u32 expB, magB, shiftB; + + if (far == near || end == start) { + f28 = 0.0f; + f25 = 0.5f; + f24 = 0.0f; + } else { + f28 = (far * near) / ((far - near) * (end - start)); + f25 = far / (far - near); + f24 = start / (end - start); + } + + expB = 0; + while (f25 > 1.0l) { + f25 /= 2.0f; + expB++; + } + while (f25 > 0.0f && f25 < 0.5l) { + f25 *= 2.0f; + expB--; + } + + a = f28 / (1 << expB + 1); + magB = 8388638.0f * f25; + shiftB = expB + 1; + c = f24; + + GX_BP_SET_FOGPARAM1_B_MAG(fogParamReg1, magB); + GX_BP_SET_OPCODE(fogParamReg1, GX_BP_REG_FOGPARAM1); + GX_BP_SET_FOGPARAM2_B_SHIFT(fogParamReg2, shiftB); + GX_BP_SET_OPCODE(fogParamReg2, GX_BP_REG_FOGPARAM2); + } + + a_bits = *(u32*)&a; + c_bits = *(u32*)&c; + + GX_BP_SET_FOGPARAM0_A_MANT(fogParamReg0, a_bits >> 12 & 0x7FF); + GX_BP_SET_FOGPARAM0_A_EXP(fogParamReg0, a_bits >> 23 & 0xFF); + GX_BP_SET_FOGPARAM0_A_SIGN(fogParamReg0, a_bits >> 31); + GX_BP_SET_OPCODE(fogParamReg0, GX_BP_REG_FOGPARAM0); + + GX_BP_SET_FOGPARAM3_C_MANT(fogParamReg3, c_bits >> 12 & 0x7FF); + GX_BP_SET_FOGPARAM3_C_EXP(fogParamReg3, c_bits >> 23 & 0xFF); + GX_BP_SET_FOGPARAM3_C_SIGN(fogParamReg3, c_bits >> 31); + GX_BP_SET_FOGPARAM3_PROJ(fogParamReg3, ortho); + GX_BP_SET_FOGPARAM3_FSEL(fogParamReg3, fsel); + GX_BP_SET_OPCODE(fogParamReg3, GX_BP_REG_FOGPARAM3); + + GX_BP_SET_FOGCOLOR_RGB(fogColorReg, *(u32*)&color >> 8); + GX_BP_SET_OPCODE(fogColorReg, GX_BP_REG_FOGCOLOR); + + GX_BP_LOAD_REG(fogParamReg0); + GX_BP_LOAD_REG(fogParamReg1); + GX_BP_LOAD_REG(fogParamReg2); + GX_BP_LOAD_REG(fogParamReg3); + GX_BP_LOAD_REG(fogColorReg); + + gxdt->lastWriteWasXF = FALSE; +} + +void GXInitFogAdjTable(GXFogAdjTable* table, u16 width, const Mtx44 proj) { + f32 f31, f30, f29, f28, f27; + u32 i; + + if (proj[3][3] == 0.0l) { + f30 = proj[2][3] / (proj[2][2] - 1.0f); + f28 = f30 / proj[0][0]; + } else { + f28 = 1.0f / proj[0][0]; + f30 = M_SQRT3 * f28; + } + + f29 = 2.0f / width; + + for (i = 0; i < LENGTHOF(table->r); i++) { + f31 = (i + 1) * 32; + f31 *= f29; + f31 *= f28; + f27 = sqrtf(1.0f + (f31 * f31) / (f30 * f30)); + table->r[i] = (u32)(f27 * 256) & 0xFFF; + } +} + +void GXSetFogRangeAdj(GXBool enable, u16 center, const GXFogAdjTable* table) { + u32 fogRangeReg; + u32 fogRangeRegK; + int i; + + if (enable) { + for (i = 0; i < LENGTHOF(table->r); i += 2) { + fogRangeRegK = 0; + GX_BP_SET_FOGRANGEK_HI(fogRangeRegK, table->r[i]); + GX_BP_SET_FOGRANGEK_LO(fogRangeRegK, table->r[i + 1]); + GX_BP_SET_OPCODE(fogRangeRegK, GX_BP_REG_FOGRANGEK0 + (i / 2)); + GX_BP_LOAD_REG(fogRangeRegK); + } + } + + fogRangeReg = 0; + GX_BP_SET_FOGRANGE_CENTER(fogRangeReg, center + 342); + GX_BP_SET_FOGRANGE_ENABLED(fogRangeReg, enable); + GX_BP_SET_OPCODE(fogRangeReg, GX_BP_REG_FOGRANGE); + GX_BP_LOAD_REG(fogRangeReg); + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetBlendMode(GXBlendMode mode, GXBlendFactor src, GXBlendFactor dst, + GXLogicOp op) { + u32 blendModeReg = gxdt->blendMode; + GX_BP_SET_BLENDMODE_SUBTRACT(blendModeReg, mode == GX_BM_SUBTRACT); + GX_BP_SET_BLENDMODE_BLEND_ENABLE(blendModeReg, mode); + GX_BP_SET_BLENDMODE_LOGIC_OP_ENABLE(blendModeReg, mode == GX_BM_LOGIC); + GX_BP_SET_BLENDMODE_LOGIC_MODE(blendModeReg, op); + GX_BP_SET_BLENDMODE_SRC_FACTOR(blendModeReg, src); + GX_BP_SET_BLENDMODE_DST_FACTOR(blendModeReg, dst); + + GX_BP_LOAD_REG(blendModeReg); + gxdt->blendMode = blendModeReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetColorUpdate(GXBool enable) { + u32 blendModeReg = gxdt->blendMode; + GX_BP_SET_BLENDMODE_COLOR_UPDATE(blendModeReg, enable); + + GX_BP_LOAD_REG(blendModeReg); + gxdt->blendMode = blendModeReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetAlphaUpdate(GXBool enable) { + u32 blendModeReg = gxdt->blendMode; + GX_BP_SET_BLENDMODE_ALPHA_UPDATE(blendModeReg, enable); + + GX_BP_LOAD_REG(blendModeReg); + gxdt->blendMode = blendModeReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetZMode(GXBool enableTest, GXCompare func, GXBool enableUpdate) { + u32 zModeReg = gxdt->zMode; + GX_BP_SET_ZMODE_TEST_ENABLE(zModeReg, enableTest); + GX_BP_SET_ZMODE_COMPARE(zModeReg, func); + GX_BP_SET_ZMODE_UPDATE_ENABLE(zModeReg, enableUpdate); + + GX_BP_LOAD_REG(zModeReg); + gxdt->zMode = zModeReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetZCompLoc(GXBool beforeTex) { + GX_BP_SET_ZCONTROL_BEFORE_TEX(gxdt->zControl, beforeTex); + GX_BP_LOAD_REG(gxdt->zControl); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt) { + static u32 p2f[GX_MAX_PIXELFMT] = { + GX_PF_RGB8_Z24, GX_PF_RGBA6_Z24, GX_PF_RGBA565_Z16, GX_PF_Z24, + GX_PF_Y8, GX_PF_Y8, GX_PF_Y8, GX_PF_U8}; + + u32 zControlRegOld = gxdt->zControl; + + GX_BP_SET_ZCONTROL_PIXEL_FMT(gxdt->zControl, p2f[pixelFmt]); + GX_BP_SET_ZCONTROL_Z_FMT(gxdt->zControl, zFmt); + + if (zControlRegOld != gxdt->zControl) { + GX_BP_LOAD_REG(gxdt->zControl); + GX_BP_SET_GENMODE_MULTISAMPLE(gxdt->genMode, + pixelFmt == GX_PF_RGBA565_Z16); + gxdt->gxDirtyFlags |= GX_DIRTY_GEN_MODE; + } + + if (p2f[pixelFmt] == GX_PF_Y8) { + GX_BP_SET_DSTALPHA_YUV_FMT(gxdt->dstAlpha, pixelFmt - GX_PF_Y8); + GX_BP_SET_OPCODE(gxdt->dstAlpha, GX_BP_REG_DSTALPHA); + GX_BP_LOAD_REG(gxdt->dstAlpha); + } + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetDither(GXBool enable) { + u32 blendModeReg = gxdt->blendMode; + GX_BP_SET_BLENDMODE_DITHER(blendModeReg, enable); + + GX_BP_LOAD_REG(blendModeReg); + gxdt->blendMode = blendModeReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetDstAlpha(GXBool enable, u8 alpha) { + u32 dstAlphaReg = gxdt->dstAlpha; + GX_BP_SET_DSTALPHA_ALPHA(dstAlphaReg, alpha); + GX_BP_SET_DSTALPHA_ENABLE(dstAlphaReg, enable); + + GX_BP_LOAD_REG(dstAlphaReg); + gxdt->dstAlpha = dstAlphaReg; + + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetFieldMask(GXBool enableEven, GXBool enableOdd) { + u32 fieldMaskReg = 0; + GX_BP_SET_FIELDMASK_ODD(fieldMaskReg, enableOdd); + GX_BP_SET_FIELDMASK_EVEN(fieldMaskReg, enableEven); + GX_BP_SET_OPCODE(fieldMaskReg, GX_BP_REG_FIELDMASK); + + GX_BP_LOAD_REG(fieldMaskReg); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetFieldMode(GXBool texLOD, GXBool adjustAR) { + GX_BP_SET_LINEPTWIDTH_ADJUST_AR(gxdt->linePtWidth, adjustAR); + GX_BP_LOAD_REG(gxdt->linePtWidth); + + __GXFlushTextureState(); + GX_BP_LOAD_REG(GX_BP_REG_FIELDMODE << 24 | texLOD); + __GXFlushTextureState(); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXTransform.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXTransform.c new file mode 100644 index 0000000000..361deef7ec --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/GX/GXTransform.c @@ -0,0 +1,324 @@ +#include + +// TODO: Fake inline +inline void LoadProjPS(register f32* dst) { + register f32 ps_0, ps_1, ps_2; + register GXData* src; + + // clang-format off + asm volatile { + lwz src, gxdt + psq_l ps_0, 0 + GXData.proj(src), 0, 0 + psq_l ps_1, 8 + GXData.proj(src), 0, 0 + psq_l ps_2, 16 + GXData.proj(src), 0, 0 + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 8(dst), 0, 0 + psq_st ps_2, 16(dst), 0, 0 + } + // clang-format on +} + +inline void WriteProjPS(register volatile void* dst, register const f32* src) { + register f32 ps_0, ps_1, ps_2; + + // clang-format off + asm volatile { + psq_l ps_0, 0(src), 0, 0 + psq_l ps_1, 8(src), 0, 0 + psq_l ps_2, 16(src), 0, 0 + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 0(dst), 0, 0 + psq_st ps_2, 0(dst), 0, 0 + } + // clang-format on +} + +inline void Copy6Floats(register f32* dst, register const f32* src) { + register f32 ps_0, ps_1, ps_2; + + // clang-format off + asm volatile { + psq_l ps_0, 0(src), 0, 0 + psq_l ps_1, 8(src), 0, 0 + psq_l ps_2, 16(src), 0, 0 + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 8(dst), 0, 0 + psq_st ps_2, 16(dst), 0, 0 + } + // clang-format on +} + +void __GXSetProjection(void) { + // Temp required to match + volatile void* wgpipe = &WGPIPE; + + GX_XF_LOAD_REGS(LENGTHOF(gxdt->proj), GX_XF_REG_PROJECTIONA); + WriteProjPS(wgpipe, gxdt->proj); + WGPIPE.i = gxdt->projType; +} + +void GXSetProjection(const Mtx44 proj, GXProjectionType type) { + gxdt->projType = type; + + gxdt->proj[0] = proj[0][0]; + gxdt->proj[2] = proj[1][1]; + gxdt->proj[4] = proj[2][2]; + gxdt->proj[5] = proj[2][3]; + + if (type == GX_ORTHOGRAPHIC) { + gxdt->proj[1] = proj[0][3]; + gxdt->proj[3] = proj[1][3]; + } else { + gxdt->proj[1] = proj[0][2]; + gxdt->proj[3] = proj[1][2]; + } + + gxdt->gxDirtyFlags |= GX_DIRTY_PROJECTION; +} + +void GXSetProjectionv(const f32 proj[7]) { + gxdt->projType = proj[0] == 0.0f ? GX_PERSPECTIVE : GX_ORTHOGRAPHIC; + Copy6Floats(gxdt->proj, proj + 1); + gxdt->gxDirtyFlags |= GX_DIRTY_PROJECTION; +} + +void GXGetProjectionv(f32 proj[7]) { + proj[0] = gxdt->projType != GX_PERSPECTIVE ? 1.0f : 0.0f; + LoadProjPS(proj + 1); +} + +inline void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) { + register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; + + // clang-format off + asm volatile { + psq_l ps_0, 0(src), 0, 0 + psq_l ps_1, 8(src), 0, 0 + psq_l ps_2, 16(src), 0, 0 + psq_l ps_3, 24(src), 0, 0 + psq_l ps_4, 32(src), 0, 0 + psq_l ps_5, 40(src), 0, 0 + + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 0(dst), 0, 0 + psq_st ps_2, 0(dst), 0, 0 + psq_st ps_3, 0(dst), 0, 0 + psq_st ps_4, 0(dst), 0, 0 + psq_st ps_5, 0(dst), 0, 0 + } + // clang-format on +} + +inline void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) { + register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; + + // clang-format off + asm volatile { + psq_l ps_0, 0(src), 0, 0 + lfs ps_1, 8(src) + psq_l ps_2, 16(src), 0, 0 + lfs ps_3, 24(src) + psq_l ps_4, 32(src), 0, 0 + lfs ps_5, 40(src) + + psq_st ps_0, 0(dst), 0, 0 + stfs ps_1, 0(dst) + psq_st ps_2, 0(dst), 0, 0 + stfs ps_3, 0(dst) + psq_st ps_4, 0(dst), 0, 0 + stfs ps_5, 0(dst) + } + // clang-format on +} + +inline void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) { + register f32 ps_0, ps_1, ps_2, ps_3; + + // clang-format off + asm volatile { + psq_l ps_0, 0(src), 0, 0 + psq_l ps_1, 8(src), 0, 0 + psq_l ps_2, 16(src), 0, 0 + psq_l ps_3, 24(src), 0, 0 + + psq_st ps_0, 0(dst), 0, 0 + psq_st ps_1, 0(dst), 0, 0 + psq_st ps_2, 0(dst), 0, 0 + psq_st ps_3, 0(dst), 0, 0 + } + // clang-format on +} + +void GXLoadPosMtxImm(const Mtx mtx, u32 id) { + // Position matrices are 4x3 + GX_XF_LOAD_REGS(4 * 3 - 1, id * 4 + GX_XF_MEM_POSMTX); + WriteMTXPS4x3(&WGPIPE, mtx); +} + +void GXLoadPosMtxIndx(u16 index, u32 id) { + // Position matrices are 4x3 + GX_FIFO_LOAD_INDX_A(id * 4 + GX_XF_MEM_POSMTX, 4 * 3 - 1, index); +} + +void GXLoadNrmMtxImm(const Mtx mtx, u32 id) { + // Normal matrices are 3x3 + GX_XF_LOAD_REGS(3 * 3 - 1, id * 3 + GX_XF_MEM_NRMMTX); + WriteMTXPS3x3(&WGPIPE, mtx); +} + +void GXLoadNrmMtxIndx3x3(u16 index, u32 id) { + // Normal matrices are 3x3 + GX_FIFO_LOAD_INDX_B(id * 3 + GX_XF_MEM_NRMMTX, 3 * 3 - 1, index); +} + +void GXSetCurrentMtx(u32 id) { + GX_XF_SET_MATRIXINDEX0_GEOM(gxdt->matrixIndex0, id); + gxdt->gxDirtyFlags |= GX_DIRTY_MTX_IDX; +} + +void GXLoadTexMtxImm(const Mtx mtx, u32 id, GXMtxType type) { + u32 addr; + u32 num; + + // Base row address in XF memory + addr = id >= GX_DUALMTX0 + ? (id - GX_DUALMTX0) * sizeof(f32) + GX_XF_MEM_DUALTEXMTX + : id * 4 + (u64)GX_XF_MEM_POSMTX; + + // Number of elements in matrix + num = type == GX_MTX_2x4 ? (u64)(2 * 4) : 3 * 4; + + GX_XF_LOAD_REGS(num - 1, addr); + + if (type == GX_MTX_3x4) { + WriteMTXPS4x3(&WGPIPE, mtx); + } else { + WriteMTXPS4x2(&WGPIPE, mtx); + } +} + +void __GXSetViewport(void) { + f32 a, b, c, d, e, f; + f32 near, far; + + a = gxdt->vpSx / 2.0f; + b = -gxdt->vpSy / 2.0f; + d = gxdt->vpOx + (gxdt->vpSx / 2.0f) + 342.0f; + e = gxdt->vpOy + (gxdt->vpSy / 2.0f) + 342.0f; + + near = gxdt->vpNear * gxdt->scaleZ; + far = gxdt->vpFar * gxdt->scaleZ; + + c = far - near; + f = far + gxdt->offsetZ; + + GX_XF_LOAD_REGS(6 - 1, GX_XF_REG_SCALEX); + WGPIPE.f = a; + WGPIPE.f = b; + WGPIPE.f = c; + WGPIPE.f = d; + WGPIPE.f = e; + WGPIPE.f = f; +} + +void GXSetViewportJitter(f32 ox, f32 oy, f32 sx, f32 sy, f32 near, f32 far, + u32 nextField) { + if (nextField == GX_FIELD_EVEN) { + oy -= 0.5f; + } + + gxdt->vpOx = ox; + gxdt->vpOy = oy; + gxdt->vpSx = sx; + gxdt->vpSy = sy; + gxdt->vpNear = near; + gxdt->vpFar = far; + gxdt->gxDirtyFlags |= GX_DIRTY_VIEWPORT; +} + +void GXSetViewport(f32 ox, f32 oy, f32 sx, f32 sy, f32 near, f32 far) { + gxdt->vpOx = ox; + gxdt->vpOy = oy; + gxdt->vpSx = sx; + gxdt->vpSy = sy; + gxdt->vpNear = near; + gxdt->vpFar = far; + gxdt->gxDirtyFlags |= GX_DIRTY_VIEWPORT; +} + +void GXGetViewportv(f32 view[6]) { + Copy6Floats(view, gxdt->view); +} + +void GXSetZScaleOffset(f32 scale, f32 offset) { + gxdt->offsetZ = (f32)0xFFFFFF * offset; // ??? + gxdt->scaleZ = 1.0f + (f32)0xFFFFFF * scale; // ??? + gxdt->gxDirtyFlags |= GX_DIRTY_VIEWPORT; +} + +void GXSetScissor(u32 x, u32 y, u32 w, u32 h) { + u32 x1, y1, x2, y2; + u32 reg; + + x1 = x + 342; + y1 = y + 342; + x2 = x1 + w - 1; + y2 = y1 + h - 1; + + reg = gxdt->scissorTL; + GX_BP_SET_SCISSORTL_TOP(reg, y1); + GX_BP_SET_SCISSORTL_LEFT(reg, x1); + gxdt->scissorTL = reg; + + reg = gxdt->scissorBR; + GX_BP_SET_SCISSORBR_BOT(reg, y2); + GX_BP_SET_SCISSORBR_RIGHT(reg, x2); + gxdt->scissorBR = reg; + + GX_BP_LOAD_REG(gxdt->scissorTL); + GX_BP_LOAD_REG(gxdt->scissorBR); + gxdt->lastWriteWasXF = FALSE; +} + +void GXGetScissor(u32* x, u32* y, u32* w, u32* h) { + u32 y2, y1; + u32 x2, x1; + + x1 = GX_BP_GET_SCISSORTL_LEFT(gxdt->scissorTL); + y1 = GX_BP_GET_SCISSORTL_TOP(gxdt->scissorTL); + x2 = GX_BP_GET_SCISSORBR_RIGHT(gxdt->scissorBR); + y2 = GX_BP_GET_SCISSORBR_BOT(gxdt->scissorBR); + + *x = x1 - 342; + *y = y1 - 342; + *w = x2 - x1 + 1; + *h = y2 - y1 + 1; +} + +void GXSetScissorBoxOffset(u32 ox, u32 oy) { + u32 cmd = 0; + GX_BP_SET_SCISSOROFFSET_OX(cmd, (ox + 342) / 2); + GX_BP_SET_SCISSOROFFSET_OY(cmd, (oy + 342) / 2); + GX_BP_SET_OPCODE(cmd, GX_BP_REG_SCISSOROFFSET); + + GX_BP_LOAD_REG(cmd); + gxdt->lastWriteWasXF = FALSE; +} + +void GXSetClipMode(GXClipMode mode) { + GX_XF_LOAD_REG(GX_XF_REG_CLIPDISABLE, mode); + gxdt->lastWriteWasXF = TRUE; +} + +void __GXSetMatrixIndex(GXAttr index) { + // Tex4 and after is stored in XF MatrixIndex1 + if (index < GX_VA_TEX4MTXIDX) { + GX_CP_LOAD_REG(GX_CP_REG_MATRIXINDEXA, gxdt->matrixIndex0); + GX_XF_LOAD_REG(GX_XF_REG_MATRIXINDEX0, gxdt->matrixIndex0); + } else { + GX_CP_LOAD_REG(GX_CP_REG_MATRIXINDEXB, gxdt->matrixIndex1); + GX_XF_LOAD_REG(GX_XF_REG_MATRIXINDEX1, gxdt->matrixIndex1); + } + + gxdt->lastWriteWasXF = TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcMain.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcMain.c new file mode 100644 index 0000000000..d395e39ff6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcMain.c @@ -0,0 +1,38 @@ +#include +#include + +static u8 Initialized = FALSE; +static void* IPCCurrentBufferLo = NULL; +static void* IPCCurrentBufferHi = NULL; +static void* IPCBufferLo = NULL; +static void* IPCBufferHi = NULL; + +void IPCInit(void) { + if (!Initialized) { + IPCBufferHi = __OSGetIPCBufferHi(); + IPCBufferLo = __OSGetIPCBufferLo(); + IPCCurrentBufferHi = IPCBufferHi; + IPCCurrentBufferLo = IPCBufferLo; + Initialized = TRUE; + } +} + +u32 IPCReadReg(s32 index) { + return IPC_HW_REGS[index]; +} + +void IPCWriteReg(s32 index, u32 value) { + IPC_HW_REGS[index] = value; +} + +void* IPCGetBufferHi(void) { + return IPCCurrentBufferHi; +} + +void* IPCGetBufferLo(void) { + return IPCCurrentBufferLo; +} + +void IPCSetBufferLo(void* lo) { + IPCCurrentBufferLo = lo; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcProfile.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcProfile.c new file mode 100644 index 0000000000..acb32666a4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcProfile.c @@ -0,0 +1,65 @@ +#include + +#define IPC_REQUEST_MAX 32 + +static s32 IpcNumUnIssuedReqs; +static s32 IpcNumPendingReqs; + +static IPCRequestEx* IpcReqPtrArray[IPC_REQUEST_MAX]; +static s32 IpcFdArray[IPC_REQUEST_MAX]; + +static void AddReqInfo(IPCRequestEx* req, s32 fd); +static void DelReqInfo(IPCRequestEx* req, s32 fd); + +DECOMP_FORCEACTIVE(ipcProfile_c, IpcFdArray); + +void IPCiProfInit(void) { + int i; + + IpcNumPendingReqs = 0; + IpcNumUnIssuedReqs = 0; + + for (i = 0; i < IPC_REQUEST_MAX; i++) { + IpcReqPtrArray[i] = NULL; + IpcFdArray[i] = -1; + } +} + +void IPCiProfQueueReq(IPCRequestEx* req, s32 fd) { + IpcNumPendingReqs++; + IpcNumUnIssuedReqs++; + AddReqInfo(req, fd); +} + +void IPCiProfAck(void) { + IpcNumUnIssuedReqs--; +} + +void IPCiProfReply(IPCRequestEx* req, s32 fd) { + IpcNumPendingReqs--; + DelReqInfo(req, fd); +} + +static void AddReqInfo(IPCRequestEx* req, s32 fd) { + u32 i; + + for (i = 0; i < IPC_REQUEST_MAX; i++) { + if (IpcReqPtrArray[i] == NULL && IpcFdArray[i] == -1) { + IpcReqPtrArray[i] = req; + IpcFdArray[i] = fd; + return; + } + } +} + +static void DelReqInfo(IPCRequestEx* req, s32 fd) { + u32 i; + + for (i = 0; i < IPC_REQUEST_MAX; i++) { + if (req == IpcReqPtrArray[i] && IpcFdArray[i] == fd) { + IpcReqPtrArray[i] = NULL; + IpcFdArray[i] = -1; + return; + } + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcclt.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcclt.c new file mode 100644 index 0000000000..574a862bf7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/ipcclt.c @@ -0,0 +1,634 @@ +#include +#include + +#define IPC_QUEUE_CAPACITY 16 +#define IPC_HEAP_SIZE 0x800 + +typedef struct IPCRequestQueue { + u32 sent; // at 0x0 + u32 queued; // at 0x4 + u32 front; // at 0x8 + u32 back; // at 0xC + IPCRequestEx* queue[IPC_QUEUE_CAPACITY]; // at 0x10 +} IPCRequestQueue; + +static s32 __mailboxAck = 1; +static s32 hid = -1; + +static BOOL __relnchFl = FALSE; +static IPCRequestEx* __relnchRpc = NULL; + +static IPCRequestQueue __responses; + +size_t strnlen(const char* s, size_t maxlen); + +size_t strnlen(const char* s, size_t maxlen) { + const u8* p = (const u8*)s; + while (*p && maxlen-- > 0) { + p++; + } + return (uintptr_t)p - (uintptr_t)s; +} + +static IPCRequestEx* ipcAllocReq(void) { + return (IPCRequestEx*)iosAllocAligned(hid, sizeof(IPCRequestEx), 32); +} + +static s32 ipcFree(void* block) { + iosFree(hid, block); + return IPC_RESULT_OK; +} + +static DECOMP_INLINE s32 __ipcQueueRequest(IPCRequestEx* req) { + s32 ret = IPC_RESULT_OK; + s32 waiting; + + waiting = + (__responses.queued < __responses.sent) + // Difference of count + ? __responses.queued - __responses.sent + // Is queue full? + : (__responses.queued - __responses.sent) >= IPC_QUEUE_CAPACITY; + + if (waiting != 0) { + ret = IPC_RESULT_BUSY_INTERNAL; + } else { + __responses.queue[__responses.back] = req; + __responses.back = (__responses.back + 1) % IPC_QUEUE_CAPACITY; + __responses.queued++; + IPCiProfQueueReq(req, req->base.fd); + } + + return ret; +} + +static DECOMP_INLINE s32 __ipcSendRequest(void) { + s32 ret = IPC_RESULT_OK; + IPCRequestEx* req; + s32 waiting; + + waiting = (__responses.queued < __responses.sent) + // Difference of sent/queued + ? __responses.queued - __responses.sent + // Are no requests waiting + : (__responses.queued - __responses.sent) == 0; + + if (waiting != 0) { + ret = IPC_RESULT_BUSY_INTERNAL; + } else { + req = __responses.queue[__responses.front]; + if (req == NULL) { + goto exit; + } + + if (req->reboot) { + __relnchFl = TRUE; + __relnchRpc = req; + __mailboxAck--; + } + + IPCWriteReg(0, (u32)OSCachedToPhysical(req)); + __responses.front = (__responses.front + 1) % IPC_QUEUE_CAPACITY; + __responses.sent++; + __mailboxAck--; + IPCWriteReg(1, (IPCReadReg(1) & 0x30) | 1); + } + +exit: + return ret; +} + +static void IpcReplyHandler(s16 intr, OSContext* ctx) { +#pragma unused(intr) + + IPCRequestEx* req; + IPCIoctlvArgs* args; + u32 reg; + OSContext temp; + int i; + + reg = IPCReadReg(2); + if (reg != 0) { + req = (IPCRequestEx*)OSPhysicalToCached(reg); + + IPCWriteReg(1, (IPCReadReg(1) & 0x30) | 4); + ACRWriteReg(0x30, 0x40000000); + DCInvalidateRange(&req->base, sizeof(IPCRequest)); + + // Not type?? + switch (req->base.fd) { + case IPC_REQ_READ: + req->base.rw.data = (req->base.rw.data != NULL) + ? OSPhysicalToCached((u32)req->base.rw.data) + : NULL; + + if (req->base.ret > 0) { + DCInvalidateRange(req->base.rw.data, req->base.ret); + } + break; + case IPC_REQ_IOCTL: + req->base.ioctl.out = + (req->base.ioctl.out != NULL) + ? OSPhysicalToCached((u32)req->base.ioctl.out) + : NULL; + + DCInvalidateRange(req->base.ioctl.in, req->base.ioctl.inSize); + DCInvalidateRange(req->base.ioctl.out, req->base.ioctl.outSize); + break; + case IPC_REQ_IOCTLV: + args = &req->base.ioctlv; + + req->base.ioctlv.vectors = + (req->base.ioctlv.vectors != NULL) + ? OSPhysicalToCached((u32)req->base.ioctlv.vectors) + : NULL; + + DCInvalidateRange(req->base.ioctlv.vectors, + (args->inCount + args->outCount) * + sizeof(IPCIOVector)); + + for (i = 0; i < args->inCount + args->outCount; i++) { + // Just trust me + i++; + i--; + + req->base.ioctlv.vectors[i].base = + (args->vectors[i].base != NULL) + ? OSPhysicalToCached((u32)args->vectors[i].base) + : NULL; + DCInvalidateRange(args->vectors[i].base, + req->base.ioctlv.vectors[i].length); + } + + if (__relnchFl && __relnchRpc == req) { + __relnchFl = FALSE; + if (__mailboxAck < 1) { + __mailboxAck++; + } + } + break; + } + + if (req->callback != NULL) { + OSClearContext(&temp); + OSSetCurrentContext(&temp); + req->callback(req->base.ret, req->callbackArg); + OSClearContext(&temp); + OSSetCurrentContext(ctx); + ipcFree(req); + } else { + OSWakeupThread(&req->queue); + } + + IPCWriteReg(1, (IPCReadReg(1) & 0x30) | 8); + IPCiProfReply(req, req->base.fd); + } +} + +static void IpcAckHandler(u8 intr, OSContext* ctx) { +#pragma unused(intr) +#pragma unused(ctx) + + IPCWriteReg(1, (IPCReadReg(1) & 0x30) | 2); + ACRWriteReg(0x30, 0x40000000); + + if (__mailboxAck < 1) { + __mailboxAck++; + IPCiProfAck(); + } + + if (__mailboxAck > 0) { + if (__relnchFl) { + __relnchRpc->base.ret = IPC_RESULT_OK; + __relnchFl = FALSE; + OSWakeupThread(&__relnchRpc->queue); + IPCWriteReg(1, (IPCReadReg(1) & 0x30) | 8); + } + __ipcSendRequest(); + } +} + +static void IPCInterruptHandler(s16 intr, OSContext* ctx) { + if ((IPCReadReg(1) & 0x14) == 0x14) { + IpcReplyHandler(intr, ctx); + } + + if ((IPCReadReg(1) & 0x22) == 0x22) { + IpcAckHandler(intr, ctx); + } +} + +s32 IPCCltInit(void) { + static BOOL initialized = FALSE; + + s32 err = 0; + void* lo; + + if (!initialized) { + initialized = TRUE; + IPCInit(); + + lo = IPCGetBufferLo(); + if ((char*)lo + IPC_HEAP_SIZE > IPCGetBufferHi()) { + err = IPC_RESULT_ALLOC_FAILED; + } else { + hid = iosCreateHeap(lo, IPC_HEAP_SIZE); + IPCSetBufferLo((char*)lo + IPC_HEAP_SIZE); + __OSSetInterruptHandler(OS_INTR_PI_ACR, IPCInterruptHandler); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_PI_ACR)); + IPCWriteReg(1, 0x38); + IPCiProfInit(); + } + } + + return err; +} + +static s32 __ios_Ipc1(s32 fd, IPCRequestType type, IPCAsyncCallback callback, + void* callbackArg, IPCRequestEx** out) { + IPCRequest* req; + s32 ret = IPC_RESULT_OK; + + if (out == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + *out = ipcAllocReq(); + if (*out == NULL) { + ret = IPC_RESULT_ALLOC_FAILED; + } else { + req = &(*out)->base; + + (*out)->callback = callback; + (*out)->callbackArg = callbackArg; + (*out)->reboot = FALSE; + + req->type = type; + req->fd = fd; + } + } + + return ret; +} + +static s32 __ios_Ipc2(IPCRequestEx* req, IPCAsyncCallback callback) { + s32 ret = IPC_RESULT_OK; + BOOL enabled; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + if (callback == NULL) { + OSInitThreadQueue(&req->queue); + } + DCFlushRange(&req->base, sizeof(IPCRequest)); + + enabled = OSDisableInterrupts(); + + ret = __ipcQueueRequest(req); + if (ret != IPC_RESULT_OK) { + OSRestoreInterrupts(enabled); + if (callback != NULL) { + ipcFree(req); + } + } else { + if (__mailboxAck > 0) { + __ipcSendRequest(); + } + + if (callback == NULL) { + OSSleepThread(&req->queue); + } + + OSRestoreInterrupts(enabled); + + if (callback == NULL) { + ret = req->base.ret; + } + } + } + + if (req != NULL && callback == NULL) { + ipcFree(req); + } + + return ret; +} + +static s32 __ios_Open(IPCRequestEx* req, const char* path, IPCOpenMode mode) { + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + DCFlushRange(path, strnlen(path, 64) + 1); + req->base.open.path = (const char*)OSCachedToPhysical(path); + req->base.open.mode = mode; + } + + return ret; +} + +s32 IOS_OpenAsync(const char* path, IPCOpenMode mode, IPCAsyncCallback callback, + void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(0, IPC_REQ_OPEN, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Open(req, path, mode); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Open(const char* path, IPCOpenMode mode) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(0, IPC_REQ_OPEN, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Open(req, path, mode); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +s32 IOS_CloseAsync(s32 fd, IPCAsyncCallback callback, void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_CLOSE, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + + return ret; +} + +s32 IOS_Close(s32 fd) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_CLOSE, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + + return ret; +} + +static s32 __ios_Read(IPCRequestEx* req, void* buf, s32 len) { + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + DCInvalidateRange(buf, len); + req->base.rw.data = (buf != NULL) ? OSCachedToPhysical(buf) : NULL; + req->base.rw.length = len; + } + + return ret; +} + +s32 IOS_ReadAsync(s32 fd, void* buf, s32 len, IPCAsyncCallback callback, + void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_READ, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Read(req, buf, len); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Read(s32 fd, void* buf, s32 len) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_READ, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Read(req, buf, len); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +static s32 __ios_Write(IPCRequestEx* req, const void* buf, s32 len) { + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + req->base.rw.data = (buf != NULL) ? OSCachedToPhysical(buf) : NULL; + req->base.rw.length = len; + DCFlushRange(buf, len); + } + + return ret; +} + +s32 IOS_WriteAsync(s32 fd, const void* buf, s32 len, IPCAsyncCallback callback, + void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_WRITE, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Write(req, buf, len); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Write(s32 fd, const void* buf, s32 len) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_WRITE, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Write(req, buf, len); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +static s32 __ios_Seek(IPCRequestEx* req, s32 offset, IPCSeekMode mode) { + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + req->base.seek.offset = offset; + req->base.seek.mode = mode; + } + + return ret; +} + +s32 IOS_SeekAsync(s32 fd, s32 offset, IPCSeekMode mode, + IPCAsyncCallback callback, void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_SEEK, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Seek(req, offset, mode); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Seek(s32 fd, s32 offset, IPCSeekMode mode) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_SEEK, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Seek(req, offset, mode); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +static s32 __ios_Ioctl(IPCRequestEx* req, s32 type, void* in, s32 inSize, + void* out, s32 outSize) { + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + req->base.ioctl.type = type; + req->base.ioctl.out = (out != NULL) ? OSCachedToPhysical(out) : NULL; + req->base.ioctl.outSize = outSize; + req->base.ioctl.in = (in != NULL) ? OSCachedToPhysical(in) : NULL; + req->base.ioctl.inSize = inSize; + + DCFlushRange(in, inSize); + DCFlushRange(out, outSize); + } + + return ret; +} + +s32 IOS_IoctlAsync(s32 fd, s32 type, void* in, s32 inSize, void* out, + s32 outSize, IPCAsyncCallback callback, void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_IOCTL, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ioctl(req, type, in, inSize, out, outSize); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Ioctl(s32 fd, s32 type, void* in, s32 inSize, void* out, s32 outSize) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_IOCTL, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ioctl(req, type, in, inSize, out, outSize); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +static s32 __ios_Ioctlv(IPCRequestEx* req, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors) { + int i; + s32 ret = IPC_RESULT_OK; + + if (req == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + } else { + req->base.ioctlv.type = type; + req->base.ioctlv.inCount = inCount; + req->base.ioctlv.outCount = outCount; + req->base.ioctlv.vectors = vectors; + + for (i = 0; i < req->base.ioctlv.outCount; i++) { + DCFlushRange(req->base.ioctlv.vectors[inCount + i].base, + req->base.ioctlv.vectors[inCount + i].length); + + req->base.ioctlv.vectors[inCount + i].base = + (req->base.ioctlv.vectors[inCount + i].base != NULL) + ? OSCachedToPhysical( + req->base.ioctlv.vectors[inCount + i].base) + : NULL; + } + + for (i = 0; i < req->base.ioctlv.inCount; i++) { + DCFlushRange(req->base.ioctlv.vectors[i].base, + req->base.ioctlv.vectors[i].length); + + req->base.ioctlv.vectors[i].base = + (req->base.ioctlv.vectors[i].base != NULL) + ? OSCachedToPhysical(req->base.ioctlv.vectors[i].base) + : NULL; + } + + DCFlushRange(req->base.ioctlv.vectors, + (req->base.ioctlv.inCount + req->base.ioctlv.outCount) * + sizeof(IPCIOVector)); + + req->base.ioctlv.vectors = + (vectors != NULL) ? OSCachedToPhysical(vectors) : NULL; + } + + return ret; +} + +s32 IOS_IoctlvAsync(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors, IPCAsyncCallback callback, + void* callbackArg) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_IOCTLV, callback, callbackArg, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ioctlv(req, type, inCount, outCount, vectors); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, callback); + } + } + + return ret; +} + +s32 IOS_Ioctlv(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_IOCTLV, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ioctlv(req, type, inCount, outCount, vectors); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} + +s32 IOS_IoctlvReboot(s32 fd, s32 type, s32 inCount, s32 outCount, + IPCIOVector* vectors) { + IPCRequestEx* req; + s32 ret = __ios_Ipc1(fd, IPC_REQ_IOCTLV, NULL, NULL, &req); + if (ret == IPC_RESULT_OK) { + req->reboot = TRUE; + ret = __ios_Ioctlv(req, type, inCount, outCount, vectors); + if (ret == IPC_RESULT_OK) { + ret = __ios_Ipc2(req, NULL); + } + } + + return ret; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/memory.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/memory.c new file mode 100644 index 0000000000..9cfa7d25d0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/IPC/memory.c @@ -0,0 +1,274 @@ +#include +#include + +#define IPC_HEAP_MAX 8 + +typedef enum { + IPC_HEAP_CHUNK_FREE = 0xBABE0000, + IPC_HEAP_CHUNK_USED = 0xBABE0001, + IPC_HEAP_CHUNK_FORALIGN = 0xBABE0002 +}; + +typedef struct IPCHeapChunk { + u32 magic; // at 0x0 + u32 size; // at 0x4 + struct IPCHeapChunk* prev; // at 0x8 + struct IPCHeapChunk* next; // at 0xC +} IPCHeapChunk; + +typedef struct IPCHeapDesc { + void* start; // at 0x0 + u32 WORD_0x4; // at 0x4 + u32 size; // at 0x8 + IPCHeapChunk* head; // at 0xC +} IPCHeapDesc; + +static IPCHeapDesc __heaps[IPC_HEAP_MAX]; + +static void __iosCoalesceChunk(IPCHeapChunk* chunk) { + IPCHeapChunk* next; + + if (chunk == NULL) { + return; + } + + if ((u8*)chunk->next != (u8*)chunk + chunk->size + sizeof(IPCHeapChunk)) { + return; + } + + next = chunk->next; + + chunk->next = next->next; + if (chunk->next != NULL) { + chunk->next->prev = chunk; + } + + chunk->size += next->size + sizeof(IPCHeapChunk); +} + +s32 iosCreateHeap(void* base, u32 size) { + s32 ret = IPC_RESULT_INVALID_INTERNAL; + BOOL enabled = OSDisableInterrupts(); + IPCHeapDesc* desc; + s32 i; + + if ((u32)base % 32 != 0) { + goto _exit; + } + + for (i = 0; i < IPC_HEAP_MAX; i++) { + if (__heaps[i].start == NULL) { + break; + } + } + + if (i == IPC_HEAP_MAX) { + ret = IPC_RESULT_CONN_MAX_INTERNAL; + goto _exit; + } + + desc = &__heaps[i]; + desc->start = base; + desc->size = size; + desc->head = (IPCHeapChunk*)base; + + desc->head->magic = IPC_HEAP_CHUNK_FREE; + desc->head->size = size - sizeof(IPCHeapChunk); + desc->head->prev = NULL; + desc->head->next = NULL; + + ret = i; + +_exit: + OSRestoreInterrupts(enabled); + return ret; +} + +void* __iosAlloc(s32 handle, u32 size, u32 align) { + BOOL enabled; + IPCHeapDesc* desc; + u8* block; + IPCHeapChunk* chunk; + IPCHeapChunk* best; + u8* bestMem; + u32 bestUnalign; + + block = NULL; + enabled = OSDisableInterrupts(); + + if (size == 0 || align == 0) { + goto _exit; + } + + if (align & (align - 1)) { + goto _exit; + } + + if (align < 32) { + align = 32; + } + + size = ROUND_UP(size, 32); + + if (handle < 0 || handle >= IPC_HEAP_MAX || __heaps[handle].start == NULL) { + block = NULL; + goto _exit; + } + + desc = &__heaps[handle]; + best = NULL; + + // Find chunk best fit for specified size + for (chunk = desc->head; chunk != NULL; chunk = chunk->next) { + u8* chunkMem = (u8*)chunk + sizeof(IPCHeapChunk); + u32 chunkUnalign = + (align - 1) & (align - ((u32)chunkMem & (align - 1))); + + if (chunk->size == size && chunkUnalign == 0) { + best = chunk; + break; + } + + if (chunk->size < size + chunkUnalign) { + continue; + } + + if (best == NULL || chunk->size < best->size) { + best = chunk; + } + } + + if (best == NULL) { + goto _exit; + } + + bestMem = (u8*)best + sizeof(IPCHeapChunk); + bestUnalign = (align - 1) & (align - ((u32)bestMem & (align - 1))); + + // Split off extra size that won't be used by this allocation + if (best->size > size + bestUnalign + sizeof(IPCHeapChunk)) { + IPCHeapChunk* rest = (IPCHeapChunk*)((u8*)best + size + bestUnalign + + sizeof(IPCHeapChunk)); + + rest->magic = IPC_HEAP_CHUNK_FREE; + rest->size = best->size - size - bestUnalign - sizeof(IPCHeapChunk); + rest->next = best->next; + + if (rest->next != NULL) { + rest->next->prev = rest; + } + + best->next = rest; + best->size = size + bestUnalign; + } + + best->magic = IPC_HEAP_CHUNK_USED; + + // Remove chunk from list + if (best->prev != NULL) { + best->prev->next = best->next; + } else { + desc->head = best->next; + } + + if (best->next != NULL) { + best->next->prev = best->prev; + } + + best->next = NULL; + best->prev = NULL; + + // For unaligned chunks, create a header where one would normally be. + // To find the real chunk, you take the FORALIGN one and jump back one. + block = (u8*)best + bestUnalign + sizeof(IPCHeapChunk); + if (bestUnalign != 0) { + IPCHeapChunk* aligned = (IPCHeapChunk*)(block - sizeof(IPCHeapChunk)); + aligned->magic = IPC_HEAP_CHUNK_FORALIGN; + aligned->prev = best; + } + +_exit: + OSRestoreInterrupts(enabled); + return block; +} + +void* iosAllocAligned(s32 handle, u32 size, u32 align) { + return __iosAlloc(handle, size, align); +} + +s32 iosFree(s32 handle, void* block) { + IPCHeapChunk* chunk; + IPCHeapChunk* it; + IPCHeapDesc* desc; + BOOL enabled; + s32 ret; + + ret = IPC_RESULT_INVALID_INTERNAL; + enabled = OSDisableInterrupts(); + + if (block == NULL) { + goto _exit; + } + + if (handle < 0 || handle >= IPC_HEAP_MAX || __heaps[handle].start == NULL) { + ret = IPC_RESULT_INVALID_INTERNAL; + goto _exit; + } + + desc = &__heaps[handle]; + + if ((u8*)block < (u8*)desc->start + sizeof(IPCHeapChunk)) { + goto _exit; + } + + if ((u8*)block > (u8*)desc->start + desc->size) { + goto _exit; + } + + chunk = (IPCHeapChunk*)((u8*)block - sizeof(IPCHeapChunk)); + + // Find *real* chunk from alignment helper + if (chunk->magic == IPC_HEAP_CHUNK_FORALIGN) { + chunk = chunk->prev; + } + + if (chunk->magic != IPC_HEAP_CHUNK_USED) { + goto _exit; + } + + chunk->magic = IPC_HEAP_CHUNK_FREE; + + // Next chunk after freed + for (it = desc->head; it != NULL; it = it->next) { + if (it->next == NULL || it->next > chunk) { + break; + } + } + + // Place chunk back in list + if (it != NULL && chunk > it) { + chunk->prev = it; + chunk->next = it->next; + it->next = chunk; + + if (chunk->next != NULL) { + chunk->next->prev = chunk; + } + } else { + chunk->next = desc->head; + desc->head = chunk; + chunk->prev = NULL; + + if (chunk->next != NULL) { + chunk->next->prev = chunk; + } + } + + __iosCoalesceChunk(chunk); + __iosCoalesceChunk(chunk->prev); + ret = IPC_RESULT_OK; + +_exit: + OSRestoreInterrupts(enabled); + return ret; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_allocator.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_allocator.c new file mode 100644 index 0000000000..67de48279d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_allocator.c @@ -0,0 +1,46 @@ +#include + +static void* AllocatorAllocForExpHeap_(MEMAllocator* allocator, u32 size) { + return MEMAllocFromExpHeapEx(allocator->heap, size, allocator->heapParam1); +} + +static void AllocatorFreeForExpHeap_(MEMAllocator* allocator, void* block) { + MEMFreeToExpHeap(allocator->heap, block); +} + +static void* AllocatorAllocForFrmHeap_(MEMAllocator* allocator, u32 size) { + return MEMAllocFromFrmHeapEx(allocator->heap, size, allocator->heapParam1); +} + +static void AllocatorFreeForFrmHeap_(MEMAllocator* allocator, void* block) { +#pragma unused(allocator) +#pragma unused(block) +} + +void* MEMAllocFromAllocator(MEMAllocator* allocator, u32 size) { + return allocator->funcs->allocFunc(allocator, size); +} + +void MEMFreeToAllocator(MEMAllocator* allocator, void* block) { + allocator->funcs->freeFunc(allocator, block); +} + +void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMiHeapHead* heap, + s32 align) { + static const MEMAllocatorFuncs sAllocatorFunc = {AllocatorAllocForExpHeap_, + AllocatorFreeForExpHeap_}; + allocator->funcs = &sAllocatorFunc; + allocator->heap = heap; + allocator->heapParam1 = align; + allocator->heapParam2 = 0; +} + +void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, MEMiHeapHead* heap, + s32 align) { + static const MEMAllocatorFuncs sAllocatorFunc = {AllocatorAllocForFrmHeap_, + AllocatorFreeForFrmHeap_}; + allocator->funcs = &sAllocatorFunc; + allocator->heap = heap; + allocator->heapParam1 = align; + allocator->heapParam2 = 0; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_expHeap.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_expHeap.c new file mode 100644 index 0000000000..c2a9d25419 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_expHeap.c @@ -0,0 +1,337 @@ +#include + +#define MEM_EXP_HEAP_MAGIC 'EXPH' +#define MEM_EXP_HEAP_MBLOCK_FREE 'FR' +#define MEM_EXP_HEAP_MBLOCK_USED 'UD' + +// Size of base and expandable heap head +#define MEM_EXP_HEAP_HEAD_SIZE (sizeof(MEMiHeapHead) + sizeof(MEMiExpHeapHead)) + +static MEMiExpHeapHead* +GetExpHeapHeadPtrFromHeapHead_(const MEMiHeapHead* heap) { + return AddU32ToPtr(heap, sizeof(MEMiHeapHead)); +} + +static MEMiHeapHead* +GetHeapHeadPtrFromExpHeapHead_(const MEMiExpHeapHead* exp) { + return SubU32ToPtr(exp, sizeof(MEMiHeapHead)); +} + +static void SetAllocMode_(MEMiExpHeapHead* exp, u16 mode) { + exp->allocMode = mode; +} + +static u16 GetAllocMode_(const MEMiExpHeapHead* exp) { + return exp->allocMode; +} + +static MEMiExpHeapMBlock* GetMBlockHeadPtr_(void* memBlock) { + return SubU32ToPtr(memBlock, sizeof(MEMiExpHeapMBlock)); +} + +static const MEMiExpHeapMBlock* GetMBlockHeadCPtr_(const void* memBlock) { + return SubU32ToCPtr(memBlock, sizeof(MEMiExpHeapMBlock)); +} + +static void* GetMemPtrForMBlock_(MEMiExpHeapMBlock* mblock) { + return AddU32ToPtr(mblock, sizeof(MEMiExpHeapMBlock)); +} + +static void* GetMBlockEndAddr_(MEMiExpHeapMBlock* mblock) { + return AddU32ToPtr(GetMemPtrForMBlock_(mblock), mblock->size); +} + +static s32 GetAlignmentForMBlock_(const MEMiExpHeapMBlock* mblock) { + return mblock->align; +} + +static MEMiExpHeapMBlock* RemoveMBlock_(MEMiExpHeapMBlockList* list, + MEMiExpHeapMBlock* mblock) { + MEMiExpHeapMBlock* prev; + MEMiExpHeapMBlock* next; + + prev = mblock->prev; + next = mblock->next; + + // Fix prev link + if (prev != NULL) { + prev->next = next; + } else { + list->head = next; + } + + // Fix next link + if (next != NULL) { + next->prev = prev; + } else { + list->tail = prev; + } + + return prev; +} + +static void GetRegionOfMBlock_(void** region, MEMiExpHeapMBlock* mblock) { + region[0] = SubU32ToPtr(mblock, GetAlignmentForMBlock_(mblock)); + region[1] = GetMBlockEndAddr_(mblock); +} + +static MEMiExpHeapMBlock* InitMBlock_(void** region, u16 state) { + MEMiExpHeapMBlock* mblock; + mblock = (MEMiExpHeapMBlock*)region[0]; + + mblock->state = state; + mblock->settings = 0; + mblock->size = GetOffsetFromPtr(GetMemPtrForMBlock_(mblock), region[1]); + mblock->prev = NULL; + mblock->next = NULL; + + return mblock; +} + +static MEMiExpHeapMBlock* InitFreeMBlock_(void** region) { + return InitMBlock_(region, MEM_EXP_HEAP_MBLOCK_FREE); +} + +static MEMiHeapHead* InitExpHeap_(MEMiHeapHead* heap, void* end, u16 opt) { + MEMiExpHeapMBlock* mblock; + MEMiExpHeapHead* exp; + void* region[2]; + + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + MEMiInitHeapHead(heap, MEM_EXP_HEAP_MAGIC, + AddU32ToPtr(heap, MEM_EXP_HEAP_HEAD_SIZE), end, opt); + exp->group = 0; + exp->SHORT_0x12 = 0; + SetAllocMode_(exp, MEM_EXP_HEAP_ALLOC_FAST); + + region[0] = heap->start; + region[1] = heap->end; + + mblock = InitFreeMBlock_(region); + exp->freeMBlocks.head = mblock; + exp->freeMBlocks.tail = mblock; + + exp->usedMBlocks.head = NULL; + exp->usedMBlocks.tail = NULL; + + return heap; +} + +// Non-matching +static void* AllocUsedBlockFromFreeBlock_(MEMiExpHeapHead* exp, + MEMiExpHeapMBlock* mblock, + void* memPtr, u32 size, + u16 allocDir) { +} + +static void* AllocFromHead_(MEMiHeapHead* heap, u32 size, s32 align) { + MEMiExpHeapMBlock* it; + MEMiExpHeapHead* exp; + MEMiExpHeapMBlock* bestBlk; + u32 bestBlkSize; + void* bestBlkMemPtr; + BOOL isFastAlloc; + + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + isFastAlloc = GetAllocMode_(exp) == MEM_EXP_HEAP_ALLOC_FAST; + bestBlk = 0; + bestBlkSize = 0xFFFFFFFF; + bestBlkMemPtr = 0; + + for (it = exp->freeMBlocks.head; it != NULL; it = it->next) { + void* start = GetMemPtrForMBlock_(it); + void* alignStart = ROUND_UP_PTR(GetUIntPtr(start), align); + u32 padding = GetOffsetFromPtr(start, alignStart); + + if (it->size >= size + padding && bestBlkSize > it->size) { + bestBlk = it; + bestBlkSize = it->size; + bestBlkMemPtr = alignStart; + + if (isFastAlloc || bestBlkSize == size) { + break; + } + } + } + + return bestBlk != NULL ? AllocUsedBlockFromFreeBlock_( + exp, bestBlk, bestBlkMemPtr, size, 0) + : NULL; +} + +// Non-matching +static void* AllocFromTail_(MEMiHeapHead* heap, u32 size, s32 align) { + MEMiExpHeapMBlock* it; + MEMiExpHeapHead* exp; + MEMiExpHeapMBlock* bestBlk; + u32 bestBlkSize; + void* bestBlkMemPtr; + BOOL isFastAlloc; + + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + isFastAlloc = GetAllocMode_(exp) == MEM_EXP_HEAP_ALLOC_FAST; + bestBlk = 0; + bestBlkSize = 0xFFFFFFFF; + bestBlkMemPtr = 0; + + for (it = exp->freeMBlocks.tail; it != NULL; it = it->prev) { + void* start = GetMemPtrForMBlock_(it); + void* end = ROUND_DOWN_PTR( + GetUIntPtr(SubU32ToPtr(AddU32ToPtr(start, it->size), size)), align); + + if (ComparePtr(end, start) >= 0 && bestBlkSize > it->size) { + bestBlk = it; + bestBlkSize = it->size; + bestBlkMemPtr = end; + + if (isFastAlloc || bestBlkSize == size) { + break; + } + } + } + + return bestBlk != NULL ? AllocUsedBlockFromFreeBlock_( + exp, bestBlk, bestBlkMemPtr, size, 1) + : NULL; +} + +// Non-matching +static void RecycleRegion_(MEMiExpHeapHead* exp, void** region) { +} + +MEMiHeapHead* MEMCreateExpHeapEx(void* start, u32 size, u16 opt) { + void* end = AddU32ToPtr(start, size); + + // Heap range + end = ROUND_DOWN_PTR(end, 4); + start = ROUND_UP_PTR(start, 4); + + // Ensure valid heap + if (GetUIntPtr(start) > GetUIntPtr(end) || + GetOffsetFromPtr(start, end) < MEM_EXP_HEAP_MIN_SIZE) { + return NULL; + } + + return InitExpHeap_(start, end, opt); +} + +MEMiHeapHead* MEMDestroyExpHeap(MEMiHeapHead* heap) { + MEMiFinalizeHeap(heap); + return heap; +} + +void* MEMAllocFromExpHeapEx(MEMiHeapHead* heap, u32 size, s32 align) { + void* memBlock; + + if (size == 0) { + size = 1; + } + size = ROUND_UP(size, 4); + + LockHeap(heap); + + // Alignment sign determines alloc direction + if (align >= 0) { + memBlock = AllocFromHead_(heap, size, align); + } else { + memBlock = AllocFromTail_(heap, size, -align); + } + + UnlockHeap(heap); + + return memBlock; +} + +// Non-matching +u32 MEMResizeForMBlockExpHeap(MEMiHeapHead* heap, void* memBlock, u32 size) { +} + +void MEMFreeToExpHeap(MEMiHeapHead* heap, void* memBlock) { + MEMiExpHeapMBlock* mblock; + MEMiExpHeapHead* exp; + void* region[2]; + + if (memBlock == NULL) { + return; + } + + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + mblock = GetMBlockHeadPtr_(memBlock); + + LockHeap(heap); + + GetRegionOfMBlock_(region, mblock); + RemoveMBlock_(&exp->usedMBlocks, mblock); + RecycleRegion_(exp, region); + + UnlockHeap(heap); +} + +u32 MEMGetAllocatableSizeForExpHeapEx(MEMiHeapHead* heap, s32 align) { + MEMiExpHeapMBlock* it; + MEMiExpHeapHead* exp; + u32 smallestPadding; + u32 biggestSize; + + align = __abs(align); + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + + LockHeap(heap); + + biggestSize = 0; + smallestPadding = 0xFFFFFFFF; + for (it = exp->freeMBlocks.head; it != NULL; it = it->next) { + // MBlock buffer region + void* start = GetMemPtrForMBlock_(it); + void* alignStart = ROUND_UP_PTR(GetUIntPtr(start), align); + void* end = GetMBlockEndAddr_(it); + + if (alignStart < end) { + u32 size = GetOffsetFromPtr(alignStart, end); + u32 padding = GetOffsetFromPtr(start, alignStart); + + // MBlock with new best size, or same as best size + less alignment + // padding + if (biggestSize < size || + (biggestSize == size && smallestPadding > padding)) { + biggestSize = size; + smallestPadding = padding; + } + } + } + + UnlockHeap(heap); + return biggestSize; +} + +u32 MEMAdjustExpHeap(MEMiHeapHead* heap) { + MEMiExpHeapMBlock* mblock; + MEMiExpHeapHead* exp; + u32 size; + + exp = GetExpHeapHeadPtrFromHeapHead_(heap); + LockHeap(heap); + + mblock = exp->freeMBlocks.tail; + // No free blocks + if (mblock == NULL) { + size = 0; + } + // Last free block + else if (AddU32ToPtr(mblock, mblock->size + sizeof(MEMiExpHeapMBlock)) != + heap->end) { + size = 0; + } + // Shrink heap by the last free block + else { + RemoveMBlock_(&exp->freeMBlocks, mblock); + heap->end = + SubU32ToPtr(heap->end, mblock->size + sizeof(MEMiExpHeapMBlock)); + // New adjusted size + size = GetOffsetFromPtr(heap, heap->end); + } + + UnlockHeap(heap); + + return size; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_frameHeap.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_frameHeap.c new file mode 100644 index 0000000000..7b32efd029 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_frameHeap.c @@ -0,0 +1,285 @@ +#include +#include + +#define MEM_FRM_HEAP_MAGIC 'FRMH' + +// Size of base and frame heap head +#define MEM_FRM_HEAP_HEAD_SIZE (sizeof(MEMiHeapHead) + sizeof(MEMiFrmHeapHead)) + +static MEMiFrmHeapHead* +GetFrmHeapHeadPtrFromHeapHead_(const MEMiHeapHead* heap) { + return AddU32ToPtr(heap, sizeof(MEMiHeapHead)); +} + +static MEMiHeapHead* +GetHeapHeadPtrFromFrmHeapHead_(const MEMiFrmHeapHead* frm) { + return SubU32ToPtr(frm, sizeof(MEMiHeapHead)); +} + +static MEMiHeapHead* InitFrameHeap_(MEMiHeapHead* heap, void* end, u16 opt) { + MEMiFrmHeapHead* frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + MEMiInitHeapHead(heap, MEM_FRM_HEAP_MAGIC, + AddU32ToPtr(heap, MEM_FRM_HEAP_HEAD_SIZE), end, opt); + frm->head = heap->start; + frm->tail = heap->end; + frm->states = NULL; + return heap; +} + +static void* AllocFromHead_(MEMiFrmHeapHead* frm, u32 size, s32 align) { + void* start; + void* end; + + // Memory block to be allocated + start = ROUND_UP_PTR(GetUIntPtr(frm->head), align); + end = AddU32ToPtr(start, size); + + // Not enough memory + if (end > frm->tail) { + return NULL; + } + + // Fill memory block (clear memory, debug fill, etc.) + // Depends on heap opt. + FillAllocMemory(GetHeapHeadPtrFromFrmHeapHead_(frm), frm->head, + GetOffsetFromPtr(frm->head, end)); + // Adjust heap + frm->head = end; + + return start; +} + +static void* AllocFromTail_(MEMiFrmHeapHead* frm, u32 size, s32 align) { + void* start; + + // Memory block to be allocated (starts from tail) + start = SubU32ToPtr(frm->tail, size); + start = ROUND_DOWN_PTR(GetUIntPtr(start), align); + + // Not enough memory + if (start < frm->head) { + return NULL; + } + + // Fill memory block (clear memory, debug fill, etc.) + // Depends on heap opt. + FillAllocMemory(GetHeapHeadPtrFromFrmHeapHead_(frm), start, + GetOffsetFromPtr(start, frm->tail)); + // Adjust heap + frm->tail = start; + + return start; +} + +static void FreeHead_(MEMiHeapHead* heap) { + MEMiFrmHeapHead* frm; + + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + frm->head = heap->start; + frm->states = NULL; +} + +static void FreeTail_(MEMiHeapHead* heap) { + MEMiFrmHeapState* state; + MEMiFrmHeapHead* frm; + + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + for (state = frm->states; state != NULL; state = state->next) { + state->tail = heap->end; + } + + frm->tail = heap->end; +} + +MEMiHeapHead* MEMCreateFrmHeapEx(void* start, u32 size, u16 opt) { + void* end = AddU32ToPtr(start, size); + + // Heap range + end = ROUND_DOWN_PTR(end, 4); + start = ROUND_UP_PTR(start, 4); + + // Ensure valid heap + if (GetUIntPtr(start) > GetUIntPtr(end) || + GetOffsetFromPtr(start, end) < MEM_FRM_HEAP_MIN_SIZE) { + return NULL; + } + + return InitFrameHeap_(start, end, opt); +} + +MEMiHeapHead* MEMDestroyFrmHeap(MEMiHeapHead* heap) { + MEMiFinalizeHeap(heap); + return heap; +} + +void* MEMAllocFromFrmHeapEx(MEMiHeapHead* heap, u32 size, s32 align) { + MEMiFrmHeapHead* frm; + void* memBlock; + + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + + if (size == 0) { + size = 1; + } + size = ROUND_UP(size, 4); + + LockHeap(heap); + // Alignment sign determines alloc direction + if (align >= 0) { + memBlock = AllocFromHead_(frm, size, align); + } else { + memBlock = AllocFromTail_(frm, size, -align); + } + UnlockHeap(heap); + + return memBlock; +} + +void MEMFreeToFrmHeap(MEMiHeapHead* heap, u32 flags) { + LockHeap(heap); + if (flags & MEM_FRM_HEAP_FREE_TO_HEAD) { + FreeHead_(heap); + } + if (flags & MEM_FRM_HEAP_FREE_TO_TAIL) { + FreeTail_(heap); + } + UnlockHeap(heap); +} + +u32 MEMGetAllocatableSizeForFrmHeapEx(MEMiHeapHead* heap, s32 align) { + MEMiFrmHeapHead* frm; + BOOL enabled; + void* start; + u32 size; + + align = __abs(align); + + enabled = OSDisableInterrupts(); + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + + start = ROUND_UP_PTR(frm->head, align); + + if (start > frm->tail) { + size = 0; + } else { + size = GetOffsetFromPtr(start, frm->tail); + } + + OSRestoreInterrupts(enabled); + return size; +} + +BOOL MEMRecordStateForFrmHeap(MEMiHeapHead* heap, u32 id) { + MEMiFrmHeapState* state; + MEMiFrmHeapHead* frm; + BOOL success; + u8* head; + + LockHeap(heap); + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + + // Backup heap head because it is about to change + head = frm->head; + state = AllocFromHead_(frm, sizeof(MEMiFrmHeapState), 4); + + if (state == NULL) { + success = FALSE; + } else { + state->id = id; + state->head = head; + state->tail = frm->tail; + + state->next = frm->states; + frm->states = state; + + success = TRUE; + } + + UnlockHeap(heap); + return success; +} + +BOOL MEMFreeByStateToFrmHeap(MEMiHeapHead* heap, u32 id) { + MEMiFrmHeapState* state; + MEMiFrmHeapHead* frm; + BOOL success; + + LockHeap(heap); + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + state = frm->states; + + // Find specified state + if (id != 0) { + for (; state != NULL; state = state->next) { + if (state->id == id) { + break; + } + } + } + + if (state == NULL) { + success = FALSE; + } else { + frm->head = state->head; + frm->tail = state->tail; + frm->states = state->next; + + success = TRUE; + } + + UnlockHeap(heap); + return success; +} + +u32 MEMAdjustFrmHeap(MEMiHeapHead* heap) { + MEMiFrmHeapHead* frm; + u32 newSize; + + LockHeap(heap); + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + + if (GetOffsetFromPtr(frm->tail, heap->end) != 0) { + newSize = 0; + } else { + heap->end = frm->head; + frm->tail = frm->head; + newSize = GetOffsetFromPtr(heap, frm->head); + } + + UnlockHeap(heap); + return newSize; +} + +u32 MEMResizeForMBlockFrmHeap(MEMiHeapHead* heap, void* memBlock, u32 size) { + MEMiFrmHeapHead* frm; + u8* newHead; + u32 offset; + + if (size == 0) { + size = 1; + } + size = ROUND_UP(size, 4); + + LockHeap(heap); + frm = GetFrmHeapHeadPtrFromHeapHead_(heap); + + offset = GetOffsetFromPtr(memBlock, frm->head); + newHead = AddU32ToPtr(memBlock, size); + + if (size != offset) { + if (size > offset) { + if (GetOffsetFromPtr(frm->tail, newHead) > 0) { + size = 0; + goto exit; + } + + FillAllocMemory(heap, frm->head, size - offset); + } + + frm->head = newHead; + } + +exit: + UnlockHeap(heap); + return size; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_heapCommon.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_heapCommon.c new file mode 100644 index 0000000000..fbe0d25ce4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_heapCommon.c @@ -0,0 +1,65 @@ +#include +#include + +static BOOL sRootListInitialized; +static MEMList sRootList; +static OSMutex sRootMutex; + +static MEMiHeapHead* FindContainHeap_(MEMList* list, const void* memBlock) { + MEMiHeapHead* heap = NULL; + + while ((heap = (MEMiHeapHead*)MEMGetNextListObject(list, heap)) != NULL) { + if (GetUIntPtr(heap->start) <= GetUIntPtr(memBlock) && + GetUIntPtr(memBlock) < GetUIntPtr(heap->end)) { + MEMiHeapHead* recursive = FindContainHeap_(&heap->list, memBlock); + if (recursive != NULL) { + return recursive; + } + return heap; + } + } + + return NULL; +} + +static MEMList* FindListContainHeap_(MEMiHeapHead* heap) { + MEMList* list = &sRootList; + MEMiHeapHead* result = FindContainHeap_(&sRootList, heap); + if (result != NULL) { + list = &result->list; + } + return list; +} + +void MEMiInitHeapHead(MEMiHeapHead* heap, u32 magic, void* start, void* end, + u16 opt) { + heap->magic = magic; + heap->start = start; + heap->end = end; + heap->attribute = 0; + SetOptForHeap(heap, opt); + MEMInitList(&heap->list, offsetof(MEMiHeapHead, link)); + + if (!sRootListInitialized) { + MEMInitList(&sRootList, offsetof(MEMiHeapHead, link)); + OSInitMutex(&sRootMutex); + sRootListInitialized = TRUE; + } + + OSInitMutex(&heap->mutex); + + OSLockMutex(&sRootMutex); + MEMAppendListObject(FindListContainHeap_(heap), heap); + OSUnlockMutex(&sRootMutex); +} + +void MEMiFinalizeHeap(MEMiHeapHead* heap) { + OSLockMutex(&sRootMutex); + MEMRemoveListObject(FindListContainHeap_(heap), heap); + OSUnlockMutex(&sRootMutex); + heap->magic = 0; +} + +MEMiHeapHead* MEMFindContainHeap(const void* memBlock) { + return FindContainHeap_(&sRootList, memBlock); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_list.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_list.c new file mode 100644 index 0000000000..7a90e84b6b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MEM/mem_list.c @@ -0,0 +1,71 @@ +#include + +/** + * Get list node from a list object + */ +#define OBJECT_GET_NODE(list, object) ((MEMLink*)((char*)object + list->offset)) + +void MEMInitList(MEMList* list, u16 offset) { + list->head = NULL; + list->tail = NULL; + list->length = 0; + list->offset = offset; +} + +static void SetFirstObject_(MEMList* list, void* object) { + MEMLink* node = OBJECT_GET_NODE(list, object); + node->next = NULL; + node->prev = NULL; + + list->head = object; + list->tail = object; + list->length++; +} + +void MEMAppendListObject(MEMList* list, void* object) { + MEMLink* node; + MEMLink* tail; + + if (list->head == NULL) { + SetFirstObject_(list, object); + } else { + node = OBJECT_GET_NODE(list, object); + node->prev = list->tail; + node->next = NULL; + + tail = OBJECT_GET_NODE(list, list->tail); + tail->next = object; + + list->tail = object; + list->length++; + } +} + +void MEMRemoveListObject(MEMList* list, void* object) { + MEMLink* node = OBJECT_GET_NODE(list, object); + + if (node->prev == NULL) { + list->head = node->next; + } else { + OBJECT_GET_NODE(list, node->prev)->next = node->next; + } + + if (node->next == NULL) { + list->tail = node->prev; + } else { + OBJECT_GET_NODE(list, node->next)->prev = node->prev; + } + + node->prev = NULL; + node->next = NULL; + + list->length--; +} + +void* MEMGetNextListObject(MEMList* list, void* object) { + if (object == NULL) { + return list->head; + } + + return OBJECT_GET_NODE(list, object)->next; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtx44.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtx44.c new file mode 100644 index 0000000000..c345a7168d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtx44.c @@ -0,0 +1,87 @@ +#include +#include + +void C_MTXFrustum(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) { + f32 invrange; + + invrange = 1.0f / (r - l); + mtx[0][0] = 2.0f * n * invrange; + mtx[0][1] = 0.0f; + mtx[0][2] = invrange * (r + l); + mtx[0][3] = 0.0f; + + invrange = 1.0f / (t - b); + mtx[1][0] = 0.0f; + mtx[1][1] = 2.0f * n * invrange; + mtx[1][2] = invrange * (t + b); + mtx[1][3] = 0.0f; + + invrange = 1.0f / (f - n); + mtx[2][0] = 0.0f; + mtx[2][1] = 0.0f; + mtx[2][2] = -n * invrange; + mtx[2][3] = invrange * -(f * n); + + mtx[3][0] = 0.0f; + mtx[3][1] = 0.0f; + mtx[3][2] = -1.0f; + mtx[3][3] = 0.0f; +} + +DECOMP_FORCELITERAL(mtx44_c, 0.5f); + +void C_MTXPerspective(Mtx44 mtx, f32 fovy, f32 aspect, f32 n, f32 f) { + f32 rad, cot; + f32 invrange; + + rad = M_PI / 180.0f * (0.5f * fovy); + cot = 1.0f / tanf(rad); + + mtx[0][0] = cot / aspect; + mtx[0][1] = 0.0f; + mtx[0][2] = 0.0f; + mtx[0][3] = 0.0f; + + mtx[1][0] = 0.0f; + mtx[1][1] = cot; + mtx[1][2] = 0.0f; + mtx[1][3] = 0.0f; + + invrange = 1.0f / (f - n); + mtx[2][0] = 0.0f; + mtx[2][1] = 0.0f; + mtx[2][2] = -n * invrange; + mtx[2][3] = invrange * -(f * n); + + mtx[3][0] = 0.0f; + mtx[3][1] = 0.0f; + mtx[3][2] = -1.0f; + mtx[3][3] = 0.0f; +} + +void C_MTXOrtho(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) { + f32 invrange; + + invrange = 1.0f / (r - l); + mtx[0][0] = 2.0f * invrange; + mtx[0][1] = 0.0f; + mtx[0][2] = 0.0f; + mtx[0][3] = invrange * -(r + l); + + invrange = 1.0f / (t - b); + mtx[1][0] = 0.0f; + mtx[1][1] = 2.0f * invrange; + mtx[1][2] = 0.0f; + mtx[1][3] = invrange * -(t + b); + + invrange = 1.0f / (f - n); + mtx[2][0] = 0.0f; + mtx[2][1] = 0.0f; + mtx[2][2] = -1.0f * invrange; + mtx[2][3] = -f * invrange; + + mtx[3][0] = 0.0f; + mtx[3][1] = 0.0f; + mtx[3][2] = 0.0f; + mtx[3][3] = 1.0f; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtxvec.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtxvec.c new file mode 100644 index 0000000000..6218aa6f5e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/mtxvec.c @@ -0,0 +1,46 @@ +#include + +asm void PSMTXMultVec(register const Mtx mtx, register const Vec* vec, + register Vec* out) { + // clang-format off + nofralloc + + // Calculate X transformation (dot(mtx[0], vec)) + psq_l f0, Vec.x(vec), 0, 0 // VX, VY + psq_l f2, 0(mtx), 0, 0 // M0X, M0Y + psq_l f1, Vec.z(vec), 1, 0 // VZ, 1 + ps_mul f4, f2, f0 // M0X*VX, M0Y*VY + psq_l f3, 8(mtx), 0, 0 // M0Z, M0W + ps_madd f5, f3, f1, f4 // M0Z*VZ+M0X*VX, M0W+M0Y*VY + psq_l f8, 16(mtx), 0, 0 // M1X, M1Y + ps_sum0 f6, f5, f6, f5 // M0Z*VZ+M0X*VX+M0W+M0Y*VY, junk + + // Head start on Y transformation + psq_l f9, 24(mtx), 0, 0 // M1Z, M1W + ps_mul f10, f8, f0 // M1X*VX, M1Y*VY + + // tx = M0X*VX + M0Y*VY + M0Z*VZ + M0W + psq_st f6, Vec.x(out), 1, 0 + + // Calculate Y transformation (dot(mtx[1], vec)) + ps_madd f11, f9, f1, f10 // M1Z*VZ+M1X*VX, M1W+M1Y*VY + psq_l f2, 32(mtx), 0, 0 // M2X, M2Y + ps_sum0 f12, f11, f12, f11 // M1Z*VZ+M1X*VX+M1W+M1Y*VY, junk + + // Head start on Z transformation + psq_l f3, 40(mtx), 0, 0 // M2Z, M2W + ps_mul f4, f2, f0 // M2X*VX, M2Y*VY + + // ty = M1X*VX + M1Y*VY + M1Z*VZ + M1W + psq_st f12, Vec.y(out), 1, 0 + + // Calculate Z transformation (dot(mtx[2], vec)) + ps_madd f5, f3, f1, f4 // M2Z*VZ+M2X*VX, M2W+M2Y*VY + ps_sum0 f6, f5, f6, f5 // M2Z*VZ+M2X*VX+M2W+M2Y*VY, junk + + // tz = M2X*VX + M2Y*VY + M2Z*VZ + M2W + psq_st f6, Vec.z(out), 1, 0 + + blr + // clang-format on +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/quat.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/quat.c new file mode 100644 index 0000000000..cb00245b16 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/quat.c @@ -0,0 +1,179 @@ +#include + +#include + +#define MY_EPSILON 1e-5f + +DECOMP_FORCELITERAL(quat_c, MY_EPSILON, 1.0f, 0.0f); + +void PSQUATMultiply(register const Quaternion* a, register const Quaternion* b, + register Quaternion* prod) { + register f32 axy, azw; + register f32 bxy, bzw; + register f32 naxay, naxy, nazw; + register f32 work1, work2, work3, work4, work5; + + // clang-format off + asm { + // Load qA components + psq_l axy, Quaternion.x(a), 0, 0 // AX, AY + psq_l azw, Quaternion.z(a), 0, 0 // AZ, AW + // Load qB components + psq_l bxy, Quaternion.x(b), 0, 0 // BX, BY + psq_l bzw, Quaternion.z(b), 0, 0 // BZ, BW + + // Negate copy of qA components + ps_neg naxy, axy // -AX, -AY + ps_neg nazw, azw // -AZ, -AW + + // Compute parts of product + ps_muls0 work1, azw, bxy // AZ*BX, AW*BX + ps_merge01 naxay, naxy, axy // -AX, AY + ps_merge01 work2, nazw, azw // -AZ, AW + ps_muls0 work3, naxy, bxy // -AX*BX, -AY*BX + ps_muls1 work4, naxay, bxy // -AX*BY, AY*BY + ps_madds0 work1, naxay, bzw, work1 // -AX*BZ+AZ*BX, AY*BZ+AW*BX + ps_muls1 work5, work2, bxy // -AZ*BY, AW*BY + ps_madds0 work3, work2, bzw, work3 // -AZ*BZ-AX*BX, AW*BZ-AY*BX + ps_merge10 work1, work1, work1 // AY*BZ+AW*BX, -AX*BZ+AZ*BX + ps_madds1 work5, axy, bzw, work5 // -AX*BW-AZ*BY, -AY*BW+AW*BY + ps_merge10 work3, work3, work3 // AW*BZ-AY*BX, -AZ*BZ-AX*BX + ps_madds1 work4, nazw, bzw, work4 // -AZ*BW-AX*BY, -AW*BW+AY*BY + + // Put everything together + ps_add work1, work1, work5 // AY*BZ+AW*BX-AX*BW-AZ*BY, -AX*BZ+AZ*BX-AY*BW+AW*BY + ps_sub work3, work3, work4 // AW*BZ-AY*BX+AZ*BW-AX*BY, -AZ*BZ-AX*BX+AW*BW+AY*BY + + // Store result + psq_st work1, Quaternion.x(prod), 0, 0 + psq_st work3, Quaternion.z(prod), 0, 0 + } + // clang-format on +} + +void PSQUATNormalize(register const Quaternion* in, register Quaternion* out) { + register f32 xy, zw; + register f32 xy2, dot; + register f32 work0, work1, work2, work3; + register f32 c_epsilon, c_half, c_three; + + c_epsilon = MY_EPSILON; + c_half = 0.5f; + c_three = 3.0f; + + // clang-format off + asm { + // Load quaternion components + psq_l xy, Quaternion.x(in), 0, 0 + psq_l zw, Quaternion.z(in), 0, 0 + + // Compute dot product with self + ps_mul xy2, xy, xy // X^2, Y^2 + ps_madd dot, zw, zw, xy2 // Z^2+X^2, W^2+Y^2 + ps_sum0 dot, dot, dot, dot // Z^2+X^2+W^2+Y^2, junk + + // Reciprocal square root + frsqrte work0, dot + + // Refine estimate using Newton-Raphson method + // y = 1 / sqrt(x) + fmul work3, work0, work0 // rsqrt^2 + fmul work0, work0, c_half // rsqrt * 0.5 + fnmsub work3, work3, dot, c_three // (3 - x * rsqrt^2) + fmul work0, work3, work0 // (3 - x * rsqrt^2) * (rsqrt * 0.5) + + // Set magnitude to zero if too small + // (dot - epsilon > zero) ? rsqrt : zero + ps_sub work1, dot, c_epsilon + ps_sub work2, c_epsilon, c_epsilon + ps_sel work0, work1, work0, work2 + + // Scale components to normalize + ps_muls0 xy, xy, work0 + ps_muls0 zw, zw, work0 + + // Store result + psq_st xy, Quaternion.x(out), 0, 0 + psq_st zw, Quaternion.z(out), 0, 0 + } + // clang-format on +} + +void C_QUATMtx(Quaternion* quat, const Mtx mtx) { + f32 root, trace; + u32 dmax, dnext, dlast; + u32 next[3] = {1, 2, 0}; + f32 temp[3]; + + trace = mtx[0][0] + mtx[1][1] + mtx[2][2]; + + if (trace > 0.0f) { + root = sqrtf(1.0f + trace); + quat->w = root * 0.5f; + + root = 0.5f / root; + quat->x = root * (mtx[2][1] - mtx[1][2]); + quat->y = root * (mtx[0][2] - mtx[2][0]); + quat->z = root * (mtx[1][0] - mtx[0][1]); + } else { + dmax = 0; + + if (mtx[1][1] > mtx[dmax][dmax]) { + dmax = 1; + } + + if (mtx[2][2] > mtx[dmax][dmax]) { + dmax = 2; + } + + dnext = next[dmax]; + dlast = next[dnext]; + + root = sqrtf(mtx[dmax][dmax] - (mtx[dnext][dnext] + mtx[dlast][dlast]) + + 1.0f); + temp[dmax] = 0.5f * root; + + if (0.0f != root) { + root = 0.5f / root; + } + + quat->w = root * (mtx[dlast][dnext] - mtx[dnext][dlast]); + temp[dnext] = root * (mtx[dmax][dnext] + mtx[dnext][dmax]); + temp[dlast] = root * (mtx[dmax][dlast] + mtx[dlast][dmax]); + + quat->x = temp[0]; + quat->y = temp[1]; + quat->z = temp[2]; + } +} + +void C_QUATSlerp(const Quaternion* a, const Quaternion* b, Quaternion* out, + f32 t) { + f32 dot; + f32 coeffa, coeffb; + f32 theta, sintheta; + + dot = a->x * b->x + a->y * b->y + a->z * b->z + a->w * b->w; + coeffb = 1.0f; + + if (dot < 0) { + dot = -dot; + coeffb = -coeffb; + } + + if (dot <= 1.0f - MY_EPSILON) { + theta = acosf(dot); + sintheta = sinf(theta); + + coeffa = sinf((1.0f - t) * theta) / sintheta; + coeffb *= sinf(t * theta) / sintheta; + } else { + coeffa = 1.0f - t; + coeffb *= t; + } + + out->x = coeffa * a->x + coeffb * b->x; + out->y = coeffa * a->y + coeffb * b->y; + out->z = coeffa * a->z + coeffb * b->z; + out->w = coeffa * a->w + coeffb * b->w; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/vec.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/vec.c new file mode 100644 index 0000000000..654ea9bc2e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/MTX/vec.c @@ -0,0 +1,250 @@ +#include + +asm void PSVECAdd(register const Vec* a, register const Vec* b, + register Vec* sum) { + // clang-format off + nofralloc + + // Sum X,Y components + psq_l f2, Vec.x(a), 0, 0 + psq_l f4, Vec.x(b), 0, 0 + ps_add f6, f2, f4 + + // Store result + psq_st f6, Vec.x(sum), 0, 0 + + // Sum Z component + psq_l f3, Vec.z(a), 1, 0 + psq_l f5, Vec.z(b), 1, 0 + ps_add f7, f3, f5 + + // Store result + psq_st f7, Vec.z(sum), 1, 0 + + blr + // clang-format on +} + +void PSVECScale(register const Vec* in, register Vec* out, register f32 scale) { + register f32 xy, z; + register f32 sxy, sz; + + // clang-format off + asm { + // Load components + psq_l xy, Vec.x(in), 0, 0 + psq_l z, Vec.z(in), 1, 0 + + // Scale components + ps_muls0 sxy, xy, scale + ps_muls0 sz, z, scale + + // Store result + psq_st sxy, Vec.x(out), 0, 0 + psq_st sz, Vec.z(out), 1, 0 + } + // clang-format on +} + +void PSVECNormalize(register const Vec* in, register Vec* out) { + register f32 c_half, c_three; + register f32 xy, z; + register f32 z2; + register f32 dot; + register f32 work0, work1, work2; + + c_half = 0.5f; + c_three = 3.0f; + + // clang-format off + asm { + // Load vector components + psq_l xy, Vec.x(in), 0, 0 + psq_l z, Vec.z(in), 1, 0 + + // Compute dot product with self + ps_mul work0, xy, xy // X^2, Y^2 + ps_madd z2, z, z, work0 // Z^2+X^2, junk + ps_sum0 dot, z2, z, work0 // Z^2+X^2+Y^2, junk + + // Reciprocal square root + frsqrte work0, dot + + // Refine estimate using Newton-Raphson method + // y = 1 / sqrt(x) + fmuls work1, work0, work0 // rsqrt^2 + fmuls work2, work0, c_half // rsqrt * 0.5 + fnmsubs work1, work1, dot, c_three // (3 - x * rsqrt^2) + fmuls work0, work1, work2 // (3 - x * rsqrt^2) * (rsqrt * 0.5) + + // Scale components to normalize + ps_muls0 xy, xy, work0 + ps_muls0 z, z, work0 + + // Store result + psq_st xy, Vec.x(out), 0, 0 + psq_st z, Vec.z(out), 1, 0 + } + // clang-format on +} + +f32 PSVECMag(register const Vec* v) { + register f32 xy, xy2; + register f32 z, z2; + register f32 dot; + register f64 rsqrt; + register f32 work0, work1; + register f32 c_three, c_half, c_zero; + + c_half = 0.5f; + // clang-format off + asm { + // Load vector components + psq_l xy, Vec.x(v), 0, 0 + lfs z, Vec.z(v) + + // Compute dot product with self + ps_mul xy2, xy, xy // X^2, Y^2 + ps_madd z2, z, z, xy2 // Z^2+X^2, junk + ps_sum0 dot, z2, xy2, xy2 // Z^2+X^2+Y^2, junk + + // Get zero + fsubs c_zero, c_half, c_half + } + // clang-format on + + // Avoid problematic square root where dot is zero + if (dot == c_zero) { + return dot; + } + + // Estimate reciprocal square root + rsqrt = __frsqrte(dot); + + c_three = 3.0f; + // clang-format off + asm { + // Refine estimate using Newton-Raphson method + // y = 1 / sqrt(x) + fmuls work0, rsqrt, rsqrt // rsqrt^2 + fmuls work1, rsqrt, c_half // rsqrt * 0.5 + fnmsubs work0, work0, dot, c_three // (3 - x * rsqrt^2) + fmuls work1, work0, work1 // (3 - x * rsqrt^2) * (rsqrt * 0.5) + + // Convert rsqrt -> sqrt + // x * rsqrt(x) == sqrt(x) + fmuls dot, dot, work1 + } + // clang-format on + + return dot; +} + +asm f32 PSVECDotProduct(register const Vec* a, register const Vec* b) { + // clang-format off + nofralloc + + // Compute Y,Z products + psq_l f2, Vec.y(a), 0, 0 + psq_l f3, Vec.y(b), 0, 0 + ps_mul f2, f2, f3 // ABY, ABZ + + // Compute X product + psq_l f5, Vec.x(a), 0, 0 + psq_l f4, Vec.x(b), 0, 0 + ps_madd f3, f5, f4, f2 // ABX+ABY, junk + + // Compute dot product + ps_sum0 f1, f3, f2, f2 // ABX+ABY+ABZ, junk + + blr + // clang-format on +} + +asm void PSVECCrossProduct(register const Vec* a, register const Vec* b, + register Vec* prod) { + // clang-format off + nofralloc + + // Load vector components + psq_l f1, Vec.x(b), 0, 0 // BX, BY + lfs f2, Vec.z(a) // AZ, AZ + psq_l f0, Vec.x(a), 0, 0 // AX, AY + ps_merge10 f6, f1, f1 // BY, BX + lfs f3, Vec.z(b) // BZ, BZ + + // Compute cross product components + ps_mul f4, f1, f2 // BX*AZ, BY*AZ + ps_muls0 f7, f1, f0 // BX*AX, BY*AX + ps_msub f5, f0, f3, f4 // AX*BZ-BX*AZ, AY*BZ-BY*AZ + ps_msub f8, f0, f6, f7 // AX*BY-BX*AX, AY*BX-BY*AX + + // Manipulate storage + ps_merge11 f9, f5, f5 // AY*BZ-BY*AZ, AY*BZ-BY*AZ + ps_merge01 f10, f5, f8 // AX*BZ-BX*AZ, AY*BX-BY*AX + + // Store cross product X + // cx = AY*BZ-BY*AZ + psq_st f9, Vec.x(prod), 1, 0 + + // Store cross product Y/Z + // Negate to fix formula + // cy = -(AX*BZ-BX*AZ) -> BX*AZ-AX*BZ + // cz = -(AY*BX-BY*AX) -> BY*AX-AY*BX + ps_neg f10, f10 + psq_st f10, Vec.y(prod), 0, 0 + + blr + // clang-format on +} + +void C_VECHalfAngle(register const Vec* a, register const Vec* b, + register Vec* half) { + Vec na, nb, ns; + + na.x = -a->x; + na.y = -a->y; + na.z = -a->z; + + nb.x = -b->x; + nb.y = -b->y; + nb.z = -b->z; + + PSVECNormalize(&na, &na); + PSVECNormalize(&nb, &nb); + PSVECAdd(&na, &nb, &ns); + + if (PSVECDotProduct(&ns, &ns) > 0.0f) { + PSVECNormalize(&ns, half); + } else { + *half = ns; + } +} + +f32 PSVECSquareDistance(register const Vec* a, register const Vec* b) { + register f32 ayz, byz; + register f32 axy, bxy; + register f32 dxy, dyz; + register f32 dist; + + // clang-format off + asm { + // Load vector components + psq_l axy, Vec.x(a), 0, 0 + psq_l ayz, Vec.y(a), 0, 0 + psq_l bxy, Vec.x(b), 0, 0 + psq_l byz, Vec.y(b), 0, 0 + + // Compute differences + ps_sub dxy, axy, bxy + ps_sub dyz, ayz, byz + + // Compute distance + ps_mul dyz, dyz, dyz + ps_madd dist, dxy, dxy, dyz + ps_sum0 dist, dist, dyz, dyz + } + // clang-format on + + return dist; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCheck.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCheck.c new file mode 100644 index 0000000000..9641cdd33a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCheck.c @@ -0,0 +1,94 @@ +#include + +static const char* USER_DIR_LIST[] = {"/meta", + "/ticket", + "/title/00010000", + "/title/00010001", + "/title/00010003", + "/title/00010004", + "/title/00010005", + "/title/00010006", + "/title/00010007", + "/shared2/title", + NULL, + NULL}; + +static s32 nandCalcUsage(s32* blockCountOut, s32* fileCountOut, + const char** dirList) { + s32 result = -117; + + *blockCountOut = 0; + *fileCountOut = 0; + + for (; *dirList != NULL; dirList++) { + s32 blockCount = 0; + s32 fileCount = 0; + + result = ISFS_GetUsage(*dirList, &blockCount, &fileCount); + if (result == IPC_RESULT_OK) { + *blockCountOut += blockCount; + *fileCountOut += fileCount; + } else if (result == IPC_RESULT_NOEXISTS) { + result = IPC_RESULT_OK; + } else { + break; + } + } + + return result; +} + +static s32 nandCalcUserUsage(s32* blockCountOut, s32* fileCountOut) { + return nandCalcUsage(blockCountOut, fileCountOut, USER_DIR_LIST); +} + +static u32 nandCheck(u32 neededBlocks, u32 neededFiles, u32 homeDirBlocks, + u32 homeDirFiles, u32 userBlocks, u32 userFiles) { + u32 answer = 0; + + if (homeDirBlocks + neededBlocks > 0x400) { + answer |= NAND_CHECK_TOO_MANY_APP_BLOCKS; + } + + if (homeDirFiles + neededFiles > 0x21) { + answer |= NAND_CHECK_TOO_MANY_APP_FILES; + } + + if (userBlocks + neededBlocks > 0x4400) { + answer |= NAND_CHECK_TOO_MANY_USER_BLOCKS; + } + + if (userFiles + neededFiles > 0xFA0) { + answer |= NAND_CHECK_TOO_MANY_USER_FILES; + } + + return answer; +} + +s32 NANDCheck(u32 neededBlocks, u32 neededFiles, u32* answer) { + s32 result; + + s32 homeDirBlocks = -1; + s32 homeDirFiles = -1; + s32 userBlocks = -1; + s32 userFiles = -1; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + result = ISFS_GetUsage(nandGetHomeDir(), &homeDirBlocks, &homeDirFiles); + if (result != IPC_RESULT_OK) { + return nandConvertErrorCode(result); + } + + result = nandCalcUserUsage(&userBlocks, &userFiles); + if (result != IPC_RESULT_OK) { + return nandConvertErrorCode(result); + } + + *answer = nandCheck(neededBlocks, neededFiles, homeDirBlocks, homeDirFiles, + userBlocks, userFiles); + + return NAND_RESULT_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCore.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCore.c new file mode 100644 index 0000000000..8379308e21 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDCore.c @@ -0,0 +1,535 @@ +#include +#include +#include +#include +#include +#include + +#define NAND_BANNER_MAGIC 'WIBN' + +typedef enum { + NAND_LIB_UNINITIALIZED, + NAND_LIB_INITIALIZING, + NAND_LIB_INITIALIZED +} NANDLibState; + +static void nandShutdownCallback(s32 result, void* arg); +static void nandGetTypeCallback(s32 result, void* arg); +static BOOL nandOnShutdown(BOOL final, u32 event); +static s32 _ES_InitLib(s32* fd); +static s32 _ES_GetDataDir(s32* fd, u64 tid, char* dirOut) DECOMP_DONT_INLINE; +static s32 _ES_GetTitleId(s32* fd, u64* tidOut); +static s32 _ES_CloseLib(s32* fd); + +const char* __NANDVersion = + "<< RVL_SDK - NAND \trelease build: Nov 30 2006 03:32:57 (0x4199_60831) >>"; + +static NANDLibState s_libState = NAND_LIB_UNINITIALIZED; +static char s_currentDir[64] ALIGN(32) = "/"; +static OSShutdownFunctionInfo s_shutdownFuncInfo = {nandOnShutdown, 255, NULL, + NULL}; + +static char s_homeDir[64] ALIGN(32); + +void nandRemoveTailToken(char* newp, const char* oldp) { + int i; + + if (oldp[0] == '/' && oldp[1] == '\0') { + newp[0] = '/'; + newp[1] = '\0'; + } else { + for (i = strlen(oldp) - 1; i >= 0; i--) { + if (oldp[i] == '/') { + if (i != 0) { + strncpy(newp, oldp, i); + newp[i] = '\0'; + break; + } else { + newp[0] = '/'; + newp[1] = '\0'; + break; + } + } + } + } +} + +void nandGetHeadToken(char* head, char* rest, const char* path) { + int i; + + for (i = 0; i <= strlen(path); i++) { + if (path[i] == '/') { + strncpy(head, path, i); + head[i] = '\0'; + + if (path[i + 1] == '\0') { + *rest = '\0'; + } else { + strcpy(rest, path + i + 1); + } + break; + } else if (path[i] == '\0') { + strncpy(head, path, i); + head[i] = '\0'; + *rest = '\0'; + break; + } + } +} + +void nandGetRelativeName(char* name, const char* path) { + int i; + + if (strcmp("/", path) == 0) { + strcpy(name, ""); + } else { + for (i = strlen(path) - 1; i >= 0; i--) { + if (path[i] == '/') { + break; + } + } + + strcpy(name, path + i + 1); + } +} + +void nandConvertPath(char* abs, const char* dir, const char* rel) { + char head[128]; + char rest[128]; + char notail[128]; + char newdir[128]; + + if (strlen(rel) == 0) { + strcpy(abs, dir); + return; + } + + nandGetHeadToken(head, rest, rel); + + if (strcmp(head, ".") == 0) { + nandConvertPath(abs, dir, rest); + } else if (strcmp(head, "..") == 0) { + nandRemoveTailToken(notail, dir); + nandConvertPath(abs, notail, rest); + } else if (head[0] != '\0') { + if (strcmp(dir, "/") == 0) { + sprintf(newdir, "/%s", head); + } else { + sprintf(newdir, "%s/%s", dir, head); + } + nandConvertPath(abs, newdir, rest); + } else { + strcpy(abs, dir); + } +} + +BOOL nandIsRelativePath(const char* path) { + return *path == '/' ? FALSE : TRUE; +} + +BOOL nandIsPrivatePath(const char* path) { + size_t len = sizeof("/shared2") - 1; + return strncmp(path, "/shared2", len) == 0; +} + +BOOL nandIsUnderPrivatePath(const char* path) { + size_t len = sizeof("/shared2/") - 1; + + if (strncmp(path, "/shared2/", len) == 0 && path[len] != '\0') { + return TRUE; + } + + return FALSE; +} + +BOOL nandIsInitialized(void) { + return s_libState == NAND_LIB_INITIALIZED ? TRUE : FALSE; +} + +// Stubbed for release +void nandReportErrorCode(s32 result){ +#pragma unused(result) +} + +s32 nandConvertErrorCode(s32 result) { + int i; + + // clang-format off + const s32 errorMap[] = {IPC_RESULT_OK, NAND_RESULT_OK, + IPC_RESULT_ACCESS, NAND_RESULT_ACCESS, + IPC_RESULT_CORRUPT, NAND_RESULT_CORRUPT, + IPC_RESULT_ECC_CRIT, NAND_RESULT_ECC_CRIT, + IPC_RESULT_EXISTS, NAND_RESULT_EXISTS, + -116, NAND_RESULT_AUTHENTICATION, + IPC_RESULT_INVALID, NAND_RESULT_INVALID, + IPC_RESULT_MAXBLOCKS, NAND_RESULT_MAXBLOCKS, + IPC_RESULT_MAXFD, NAND_RESULT_MAXFD, + IPC_RESULT_MAXFILES, NAND_RESULT_MAXFILES, + IPC_RESULT_NOEXISTS, NAND_RESULT_NOEXISTS, + IPC_RESULT_NOTEMPTY, NAND_RESULT_NOTEMPTY, + -104, NAND_RESULT_UNKNOWN, + IPC_RESULT_OPENFD, NAND_RESULT_OPENFD, + -117, NAND_RESULT_UNKNOWN, + IPC_RESULT_BUSY, NAND_RESULT_BUSY, + IPC_RESULT_FATAL_ERROR, NAND_RESULT_FATAL_ERROR, + IPC_RESULT_ACCESS_INTERNAL, NAND_RESULT_ACCESS, + IPC_RESULT_EXISTS_INTERNAL, NAND_RESULT_EXISTS, + -3, NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_INTERNAL, NAND_RESULT_INVALID, + -5, NAND_RESULT_UNKNOWN, + IPC_RESULT_NOEXISTS_INTERNAL, NAND_RESULT_NOEXISTS, + -7, NAND_RESULT_UNKNOWN, + IPC_RESULT_BUSY_INTERNAL, NAND_RESULT_BUSY, + -9, NAND_RESULT_UNKNOWN, + -10, NAND_RESULT_UNKNOWN, + -11, NAND_RESULT_UNKNOWN, + IPC_RESULT_ECC_CRIT_INTERNAL, NAND_RESULT_ECC_CRIT, + -13, NAND_RESULT_UNKNOWN, + -14, NAND_RESULT_UNKNOWN, + -15, NAND_RESULT_UNKNOWN, + -16, NAND_RESULT_UNKNOWN, + -17, NAND_RESULT_UNKNOWN, + -18, NAND_RESULT_UNKNOWN, + -19, NAND_RESULT_UNKNOWN, + -20, NAND_RESULT_UNKNOWN, + -21, NAND_RESULT_UNKNOWN, + IPC_RESULT_ALLOC_FAILED, NAND_RESULT_ALLOC_FAILED, + -23, NAND_RESULT_UNKNOWN}; + // clang-format on + + i = 0; + + if (result >= 0) { + return result; + } + + for (; i < LENGTHOF(errorMap); i += 2) { + if (result == errorMap[i]) { + nandReportErrorCode(result); + return errorMap[i + 1]; + } + } + + OSReport("CAUTION! Unexpected error code [%d] was found.\n", result); + nandReportErrorCode(result); + return NAND_RESULT_UNKNOWN; +} + +void nandGenerateAbsPath(char* abs, const char* rel) { + s32 len; + + if (strlen(rel) == 0) { + strcpy(abs, ""); + } else if (nandIsRelativePath(rel)) { + nandConvertPath(abs, s_currentDir, rel); + } else { + strcpy(abs, rel); + len = strlen(abs); + if (len != 0 && abs[len - 1] == '/' && len - 1 != 0) { + abs[len - 1] = '\0'; + } + } +} + +void nandGetParentDirectory(char* dir, const char* path) { + int i; + + for (i = strlen(path); i >= 0; i--) { + if (path[i] == '/') { + break; + } + } + + if (i == 0) { + strcpy(dir, "/"); + } else { + strncpy(dir, path, i); + dir[i] = '\0'; + } +} + +s32 NANDInit(void) { + s32 result; + u64 tid; + s32 fd; + BOOL enabled; + + enabled = OSDisableInterrupts(); + + if (s_libState == NAND_LIB_INITIALIZING) { + OSRestoreInterrupts(enabled); + return NAND_RESULT_BUSY; + } else if (s_libState == NAND_LIB_INITIALIZED) { + OSRestoreInterrupts(enabled); + return NAND_RESULT_OK; + } + + s_libState = NAND_LIB_INITIALIZING; + OSRestoreInterrupts(enabled); + + result = ISFS_OpenLib(); + if (result == IPC_RESULT_OK) { + + result = _ES_InitLib(&fd); + + if (result == IPC_RESULT_OK) { + result = _ES_GetTitleId(&fd, &tid); + } + + if (result == IPC_RESULT_OK) { + result = _ES_GetDataDir(&fd, tid, s_homeDir); + } + + if (result == IPC_RESULT_OK) { + strcpy(s_currentDir, s_homeDir); + } + + _ES_CloseLib(&fd); + + if (result != IPC_RESULT_OK) { + OSReport("Failed to set home directory.\n"); + } + + OSRegisterShutdownFunction(&s_shutdownFuncInfo); + enabled = OSDisableInterrupts(); + s_libState = NAND_LIB_INITIALIZED; + OSRestoreInterrupts(enabled); + OSRegisterVersion(__NANDVersion); + return NAND_RESULT_OK; + } else { + enabled = OSDisableInterrupts(); + s_libState = NAND_LIB_UNINITIALIZED; + OSRestoreInterrupts(enabled); + return nandConvertErrorCode(result); + } +} + +static BOOL nandOnShutdown(BOOL final, u32 event) { + if (!final) { + if (event == OS_SD_EVENT_SHUTDOWN) { + volatile BOOL shutdown = FALSE; + s64 start = OSGetTime(); + ISFS_ShutdownAsync(nandShutdownCallback, (void*)&shutdown); + + while (OS_TICKS_TO_MSEC(OSGetTime() - start) < 500) { + if (shutdown) { + break; + } + } + } + + return TRUE; + } + + return TRUE; +} + +static void nandShutdownCallback(s32 result, void* arg) { +#pragma unused(result) + + *(BOOL*)arg = TRUE; +} + +s32 NANDGetCurrentDir(char* out) { + BOOL enabled; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + enabled = OSDisableInterrupts(); + strcpy(out, s_currentDir); + OSRestoreInterrupts(enabled); + return NAND_RESULT_OK; +} + +s32 NANDGetHomeDir(char* out) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + strcpy(out, s_homeDir); + return NAND_RESULT_OK; +} + +void nandCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + block->callback(nandConvertErrorCode(result), block); +} + +static s32 nandGetType(const char* path, u8* type, NANDCommandBlock* block, + BOOL async, BOOL priv) { + char absPath[64]; + u32 numFiles; + s32 result; + + if (strlen(path) == 0) { + return IPC_RESULT_INVALID; + } + + if (async) { + nandGenerateAbsPath(block->path, path); + + if (!priv && nandIsUnderPrivatePath(block->path)) { + return IPC_RESULT_ACCESS; + } + + block->type = type; + return ISFS_ReadDirAsync(block->path, NULL, &block->dirFileCount, + nandGetTypeCallback, block); + } else { + MEMCLR(&absPath); + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsUnderPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + numFiles = 0; + result = ISFS_ReadDir(absPath, NULL, &numFiles); + if (result == IPC_RESULT_OK || result == IPC_RESULT_ACCESS) { + *type = NAND_FILE_TYPE_DIR; + return IPC_RESULT_OK; + } else if (result == IPC_RESULT_INVALID) { + *type = NAND_FILE_TYPE_FILE; + return IPC_RESULT_OK; + } + + return result; + } +} + +s32 NANDGetType(const char* path, u8* type) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(nandGetType(path, type, NULL, FALSE, FALSE)); +} + +s32 NANDPrivateGetTypeAsync(const char* path, u8* type, + NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode(nandGetType(path, type, block, TRUE, TRUE)); +} + +static void nandGetTypeCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result == IPC_RESULT_OK || result == IPC_RESULT_ACCESS) { + *block->type = NAND_FILE_TYPE_DIR; + result = IPC_RESULT_OK; + } else if (result == IPC_RESULT_INVALID) { + *block->type = NAND_FILE_TYPE_FILE; + result = IPC_RESULT_OK; + } + + block->callback(nandConvertErrorCode(result), block); +} + +const char* nandGetHomeDir(void) { + return s_homeDir; +} + +void NANDInitBanner(NANDBanner* banner, u32 flags, const wchar_t* title, + const wchar_t* subtitle) { + memset(banner, 0, sizeof(NANDBanner)); + banner->flags = flags; + banner->magic = NAND_BANNER_MAGIC; + + if (wcscmp(title, L"") == 0) { + wcsncpy(banner->title, L" ", NAND_BANNER_TITLE_MAX); + } else { + wcsncpy(banner->title, title, NAND_BANNER_TITLE_MAX); + } + + if (wcscmp(subtitle, L"") == 0) { + wcsncpy(banner->subtitle, L" ", NAND_BANNER_TITLE_MAX); + } else { + wcsncpy(banner->subtitle, subtitle, NAND_BANNER_TITLE_MAX); + } +} + +/** + * These were actually re(?)implemented in NANDCore/OSExec according to BBA + */ + +static s32 _ES_InitLib(s32* fd) { + s32 result; + + *fd = -1; + result = IPC_RESULT_OK; + + *fd = IOS_Open("/dev/es", IPC_OPEN_NONE); + if (*fd < 0) { + result = *fd; + } + + return result; +} + +static s32 _ES_GetDataDir(s32* fd, u64 tid, char* dirOut) { + // TODO: Hacky solution + u8 tidWork[256] ALIGN(32); + u8 vectorWork[32] ALIGN(32); + IPCIOVector* pVectors = (IPCIOVector*)vectorWork; + u64* pTid = (u64*)tidWork; + + // Cast is necessary + if (*fd < 0 || dirOut == ((void*)NULL)) { + return -0x3F9; + } + + if ((u32)dirOut % 32 != 0) { + return -0x3F9; + } + + *pTid = tid; + + pVectors[0].base = pTid; + pVectors[0].length = sizeof(u64); + pVectors[1].base = dirOut; + pVectors[1].length = 30; + + return IOS_Ioctlv(*fd, ES_IOCTLV_GET_DATA_DIR, 1, 1, pVectors); +} + +static s32 _ES_GetTitleId(s32* fd, u64* tidOut) { + s32 result; + u64* pTid; + // TODO: Hacky solution + u8 tidWork[256] ALIGN(32); + u8 vectorWork[32] ALIGN(32); + IPCIOVector* pVectors = (IPCIOVector*)vectorWork; + + // Cast is necessary + if (*fd < 0 || tidOut == ((void*)NULL)) { + return -0x3F9; + } + + pTid = (u64*)tidWork; + pVectors[0].base = pTid; + pVectors[0].length = sizeof(u64); + + result = IOS_Ioctlv(*fd, ES_IOCTLV_GET_TITLE_ID, 0, 1, pVectors); + if (result == IPC_RESULT_OK) { + *tidOut = *pTid; + } + + return result; +} + +static s32 _ES_CloseLib(s32* fd) { + s32 result = IPC_RESULT_OK; + + if (*fd >= 0 && (result = IOS_Close(*fd)) == IPC_RESULT_OK) { + *fd = -1; + } + + return result; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDOpenClose.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDOpenClose.c new file mode 100644 index 0000000000..dda9c9b510 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/NANDOpenClose.c @@ -0,0 +1,414 @@ +#include +#include +#include + +static void nandOpenCallback(s32 result, void* arg); +static s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 access, + void* buffer, u32 bufferSize, + NANDAsyncCallback callback, + NANDCommandBlock* block, BOOL priv); +static void nandSafeOpenCallback(s32 result, void* arg); +static void nandReadOpenCallback(s32 result, void* arg); +static s32 nandSafeCloseAsync(NANDFileInfo* info, NANDAsyncCallback callback, + NANDCommandBlock* block); +static void nandSafeCloseCallback(s32 result, void* arg); +static void nandReadCloseCallback(s32 result, void* arg); +static void nandCloseCallback(s32 result, void* arg); +static u32 nandGetUniqueNumber(void); + +static s32 nandOpen(const char* path, u8 mode, NANDCommandBlock* block, + BOOL async, BOOL priv) { + IPCOpenMode ipcMode; + char absPath[64]; + + MEMCLR(&absPath); + ipcMode = IPC_OPEN_NONE; + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + switch (mode) { + case NAND_ACCESS_RW: + ipcMode = IPC_OPEN_RW; + break; + case NAND_ACCESS_READ: + ipcMode = IPC_OPEN_READ; + break; + case NAND_ACCESS_WRITE: + ipcMode = IPC_OPEN_WRITE; + break; + } + + if (async) { + return ISFS_OpenAsync(absPath, ipcMode, nandOpenCallback, block); + } else { + return ISFS_Open(absPath, ipcMode); + } +} + +s32 NANDOpen(const char* path, NANDFileInfo* info, u8 mode) { + s32 result; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + result = nandOpen(path, mode, NULL, FALSE, FALSE); + if (result >= 0) { + info->fd = result; + info->mark = 1; + return NAND_RESULT_OK; + } + + return nandConvertErrorCode(result); +} + +s32 NANDPrivateOpen(const char* path, NANDFileInfo* info, u8 mode) { + s32 result; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + result = nandOpen(path, mode, NULL, FALSE, TRUE); + if (result >= 0) { + info->fd = result; + info->mark = 1; + return NAND_RESULT_OK; + } + + return nandConvertErrorCode(result); +} + +s32 NANDOpenAsync(const char* path, NANDFileInfo* info, u8 mode, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + block->info = info; + return nandConvertErrorCode(nandOpen(path, mode, block, TRUE, FALSE)); +} + +s32 NANDPrivateOpenAsync(const char* path, NANDFileInfo* info, u8 mode, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + block->info = info; + return nandConvertErrorCode(nandOpen(path, mode, block, TRUE, TRUE)); +} + +static void nandOpenCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result >= 0) { + block->info->fd = result; + block->info->stage = 2; + block->info->mark = 1; + block->callback(NAND_RESULT_OK, block); + } else { + block->callback(nandConvertErrorCode(result), block); + } +} + +s32 NANDClose(NANDFileInfo* info) { + s32 result; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + if (info->mark != 1) { + return NAND_RESULT_INVALID; + } + + result = ISFS_Close(info->fd); + if (result == IPC_RESULT_OK) { + info->mark = 2; + } + + return nandConvertErrorCode(result); +} + +s32 NANDCloseAsync(NANDFileInfo* info, NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + if (info->mark != 1) { + return NAND_RESULT_INVALID; + } + + block->callback = callback; + block->info = info; + return nandConvertErrorCode( + ISFS_CloseAsync(info->fd, nandCloseCallback, block)); +} + +s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 access, + void* buffer, u32 bufferSize, + NANDAsyncCallback callback, + NANDCommandBlock* block) { + return nandSafeOpenAsync(path, info, access, buffer, bufferSize, callback, + block, TRUE); +} + +static s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 access, + void* buffer, u32 bufferSize, + NANDAsyncCallback callback, + NANDCommandBlock* block, BOOL priv) { + s32 result; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + info->access = access; + info->stage = 0; + + nandGenerateAbsPath(info->openPath, path); + + if (!priv && nandIsPrivatePath(info->openPath)) { + return NAND_RESULT_ACCESS; + } + + if (access == NAND_ACCESS_READ) { + block->info = info; + block->callback = callback; + result = ISFS_OpenAsync(info->openPath, IPC_OPEN_READ, + nandReadOpenCallback, block); + return (result == IPC_RESULT_OK) ? NAND_RESULT_OK + : nandConvertErrorCode(result); + } + + if (access == NAND_ACCESS_WRITE || access == NAND_ACCESS_RW) { + block->info = info; + block->callback = callback; + block->state = 0; + block->buffer = buffer; + block->bufferSize = bufferSize; + result = ISFS_CreateDirAsync("/tmp/sys", 0, IPC_OPEN_RW, IPC_OPEN_RW, + IPC_OPEN_RW, nandSafeOpenCallback, block); + return (result == IPC_RESULT_OK) ? NAND_RESULT_OK + : nandConvertErrorCode(result); + } + + return NAND_RESULT_INVALID; +} + +static void nandSafeOpenCallback(s32 result, void* arg) { +// Why??? +#define block ((NANDCommandBlock*)arg) + + s32 myResult; + char tempPath[64]; + char relativeName[12]; + + if (result >= 0 || (result == IPC_RESULT_EXISTS && block->state == 0)) { + NANDFileInfo* info = block->info; + myResult = -117; + + if (block->state == 0) { + info->stage = 1; + } + + block->state++; + + if (block->state == 1) { + myResult = ISFS_GetAttrAsync( + info->openPath, &block->ownerId, &block->groupId, &block->attr, + &block->ownerPerm, &block->groupPerm, &block->otherPerm, + nandSafeOpenCallback, block); + } else if (block->state == 2) { + myResult = ISFS_OpenAsync(info->openPath, IPC_OPEN_READ, + nandSafeOpenCallback, block); + } else if (block->state == 3) { + info->stage = 2; + block->uniqueNo = nandGetUniqueNumber(); + info->tempFd = result; + sprintf(tempPath, "%s/%08x", "/tmp/sys", block->uniqueNo); + myResult = + ISFS_CreateDirAsync(tempPath, 0, IPC_OPEN_RW, IPC_OPEN_NONE, + IPC_OPEN_NONE, nandSafeOpenCallback, block); + } else if (block->state == 4) { + info->stage = 3; + nandGetRelativeName(relativeName, info->openPath); + sprintf(info->tempPath, "%s/%08x/%s", "/tmp/sys", block->uniqueNo, + relativeName); + myResult = ISFS_CreateFileAsync( + info->tempPath, block->attr, block->ownerPerm, block->groupPerm, + block->otherPerm, nandSafeOpenCallback, block); + } else if (block->state == 5) { + info->stage = 4; + if (info->access == NAND_ACCESS_WRITE) { + myResult = ISFS_OpenAsync(info->tempPath, IPC_OPEN_WRITE, + nandSafeOpenCallback, block); + } else if (info->access == NAND_ACCESS_RW) { + myResult = ISFS_OpenAsync(info->tempPath, IPC_OPEN_RW, + nandSafeOpenCallback, block); + } else { + myResult = -117; + } + } else if (block->state == 6) { + info->fd = result; + info->stage = 5; + block->state = 7; + myResult = + ISFS_ReadAsync(info->tempFd, block->buffer, block->bufferSize, + nandSafeOpenCallback, block); + } else if (block->state == 7) { + myResult = + ISFS_ReadAsync(info->tempFd, block->buffer, block->bufferSize, + nandSafeOpenCallback, block); + } else if (block->state == 8) { + if (result > 0) { + block->state = 6; + myResult = ISFS_WriteAsync(info->fd, block->buffer, result, + nandSafeOpenCallback, block); + } else if (result == IPC_RESULT_OK) { + myResult = ISFS_SeekAsync(info->fd, 0, IPC_SEEK_BEG, + nandSafeOpenCallback, block); + } + } else if (block->state == 9) { + if (result == IPC_RESULT_OK) { + info->mark = 3; + block->callback(nandConvertErrorCode(IPC_RESULT_OK), block); + } else { + block->callback(nandConvertErrorCode(result), block); + } + return; + } + + if (myResult != IPC_RESULT_OK) { + block->callback(nandConvertErrorCode(myResult), block); + } + return; + } + + block->callback(nandConvertErrorCode(result), block); + +#undef block +} + +static void nandReadOpenCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result >= 0) { + block->info->fd = result; + block->info->stage = 2; + block->info->mark = 3; + block->callback(NAND_RESULT_OK, block); + } else { + block->callback(nandConvertErrorCode(result), block); + } +} + +s32 NANDSafeCloseAsync(NANDFileInfo* info, NANDAsyncCallback callback, + NANDCommandBlock* block) { + s32 result; + + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + if (info->mark != 3) { + return NAND_RESULT_INVALID; + } + + if (info->access == NAND_ACCESS_READ) { + block->info = info; + block->callback = callback; + result = ISFS_CloseAsync(info->fd, nandReadCloseCallback, block); + } else if (info->access == NAND_ACCESS_WRITE || + info->access == NAND_ACCESS_RW) { + block->info = info; + block->callback = callback; + block->state = 10; + result = ISFS_CloseAsync(info->fd, nandSafeCloseCallback, block); + } else { + result = IPC_RESULT_INVALID; + } + + return nandConvertErrorCode(result); +} + +static void nandSafeCloseCallback(s32 result, void* arg) { + s32 myResult; + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result == IPC_RESULT_OK) { + NANDFileInfo* info = block->info; + myResult = -117; + + block->state++; + + if (block->state == 11) { + info->stage = 6; + myResult = + ISFS_CloseAsync(info->tempFd, nandSafeCloseCallback, block); + } else if (block->state == 12) { + info->stage = 7; + myResult = ISFS_RenameAsync(info->tempPath, info->openPath, + nandSafeCloseCallback, block); + } else if (block->state == 13) { + char parentDir[64]; + MEMCLR(&parentDir); + + info->stage = 8; + nandGetParentDirectory(parentDir, info->tempPath); + myResult = + ISFS_DeleteAsync(parentDir, nandSafeCloseCallback, block); + } else if (block->state == 14) { + info->stage = 9; + info->mark = 4; + block->callback(nandConvertErrorCode(result), block); + return; + } + + if (myResult != IPC_RESULT_OK) { + block->callback(nandConvertErrorCode(myResult), block); + } + return; + } + + block->callback(nandConvertErrorCode(result), block); +} + +static void nandReadCloseCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result == IPC_RESULT_OK) { + block->info->stage = 7; + block->info->mark = 4; + } + + block->callback(nandConvertErrorCode(result), block); +} + +static void nandCloseCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + + if (result == IPC_RESULT_OK) { + block->info->stage = 7; + block->info->mark = 2; + } + + block->callback(nandConvertErrorCode(result), block); +} + +static u32 nandGetUniqueNumber(void) { + static u32 s_counter = 0; + + BOOL enabled = OSDisableInterrupts(); + u32 num = s_counter++; + OSRestoreInterrupts(enabled); + + return num; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/nand.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/nand.c new file mode 100644 index 0000000000..a994a9b9fd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NAND/nand.c @@ -0,0 +1,499 @@ +#include +#include +#include +#include + +static void nandSplitPerm(u8 perm, u32* ownerPerm, u32* groupPerm, + u32* otherPerm) DECOMP_DONT_INLINE; +static void nandGetStatusCallback(s32 result, void* arg); +static void nandGetFileStatusAsyncCallback(s32 result, void* arg); +static BOOL nandInspectPermission(u8 perm); + +static s32 nandCreate(const char* path, u8 perm, u8 attr, + NANDCommandBlock* block, BOOL async, BOOL priv) { + char absPath[64]; + u32 ownerPerm, groupPerm, otherPerm; + + MEMCLR(&absPath); + + ownerPerm = 0; + groupPerm = 0; + otherPerm = 0; + + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + if (!nandInspectPermission(perm)) { + return IPC_RESULT_INVALID; + } + + nandSplitPerm(perm, &ownerPerm, &groupPerm, &otherPerm); + + if (async) { + return ISFS_CreateFileAsync(absPath, attr, ownerPerm, groupPerm, + otherPerm, nandCallback, block); + } else { + return ISFS_CreateFile(absPath, attr, ownerPerm, groupPerm, otherPerm); + } +} + +s32 NANDCreate(const char* path, u8 perm, u8 attr) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode( + nandCreate(path, perm, attr, NULL, FALSE, FALSE)); +} + +s32 NANDPrivateCreate(const char* path, u8 perm, u8 attr) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode( + nandCreate(path, perm, attr, NULL, FALSE, TRUE)); +} + +s32 NANDPrivateCreateAsync(const char* path, u8 perm, u8 attr, + NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode( + nandCreate(path, perm, attr, block, TRUE, TRUE)); +} + +static s32 nandDelete(const char* path, NANDCommandBlock* block, BOOL async, + BOOL priv) { + char absPath[64]; + + MEMCLR(&absPath); + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + if (async) { + return ISFS_DeleteAsync(absPath, nandCallback, block); + } else { + return ISFS_Delete(absPath); + } +} + +s32 NANDDelete(const char* path) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(nandDelete(path, NULL, FALSE, FALSE)); +} + +s32 NANDPrivateDelete(const char* path) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(nandDelete(path, NULL, FALSE, TRUE)); +} + +s32 NANDPrivateDeleteAsync(const char* path, NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode(nandDelete(path, block, TRUE, TRUE)); +} + +s32 NANDRead(NANDFileInfo* info, void* buf, u32 len) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(ISFS_Read(info->fd, buf, len)); +} + +s32 NANDReadAsync(NANDFileInfo* info, void* buf, u32 len, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode( + ISFS_ReadAsync(info->fd, buf, len, nandCallback, block)); +} + +s32 NANDWrite(NANDFileInfo* info, const void* buf, u32 len) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(ISFS_Write(info->fd, buf, len)); +} + +s32 NANDWriteAsync(NANDFileInfo* info, const void* buf, u32 len, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode( + ISFS_WriteAsync(info->fd, buf, len, nandCallback, block)); +} + +static s32 nandSeek(s32 fd, s32 offset, NANDSeekMode whence, + NANDCommandBlock* block, BOOL async) { + IPCSeekMode mode = (IPCSeekMode)-1; + + switch (whence) { + case NAND_SEEK_BEG: + mode = IPC_SEEK_BEG; + break; + case NAND_SEEK_CUR: + mode = IPC_SEEK_CUR; + break; + case NAND_SEEK_END: + mode = IPC_SEEK_END; + break; + } + + if (async) { + return ISFS_SeekAsync(fd, offset, mode, nandCallback, block); + } else { + return ISFS_Seek(fd, offset, mode); + } +} + +s32 NANDSeek(NANDFileInfo* info, s32 offset, NANDSeekMode whence) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode( + nandSeek(info->fd, offset, whence, NULL, FALSE)); +} + +s32 NANDSeekAsync(NANDFileInfo* info, s32 offset, NANDSeekMode whence, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode( + nandSeek(info->fd, offset, whence, block, TRUE)); +} + +static s32 nandCreateDir(const char* path, u8 perm, u8 attr, + NANDCommandBlock* block, BOOL async, BOOL priv) { + char absPath[64]; + u32 ownerPerm, groupPerm, otherPerm; + + MEMCLR(&absPath); + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + if (!nandInspectPermission(perm)) { + return IPC_RESULT_INVALID; + } + + ownerPerm = 0; + groupPerm = 0; + otherPerm = 0; + nandSplitPerm(perm, &ownerPerm, &groupPerm, &otherPerm); + + if (async) { + return ISFS_CreateDirAsync(absPath, attr, ownerPerm, groupPerm, + otherPerm, nandCallback, block); + } else { + return ISFS_CreateDir(absPath, attr, ownerPerm, groupPerm, otherPerm); + } +} + +s32 NANDPrivateCreateDir(const char* path, u8 perm, u8 attr) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode( + nandCreateDir(path, perm, attr, NULL, FALSE, TRUE)); +} + +s32 NANDPrivateCreateDirAsync(const char* path, u8 perm, u8 attr, + NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + return nandConvertErrorCode( + nandCreateDir(path, perm, attr, block, TRUE, TRUE)); +} + +static s32 nandMove(const char* from, const char* to, NANDCommandBlock* block, + BOOL async, BOOL priv) { + char absPathFrom[64]; + char absPathTo[64]; + char relativeName[13]; + + MEMCLR(&absPathFrom); + MEMCLR(&absPathTo); + MEMCLR(&relativeName); + + relativeName[12] = '\0'; + + nandGenerateAbsPath(absPathFrom, from); + nandGetRelativeName(relativeName, absPathFrom); + nandGenerateAbsPath(absPathTo, to); + + if (strcmp(absPathTo, "/") == 0) { + sprintf(absPathTo, "/%s", relativeName); + } else { + strcat(absPathTo, "/"); + strcat(absPathTo, relativeName); + } + + if (!priv && + (nandIsPrivatePath(absPathFrom) || nandIsPrivatePath(absPathTo))) { + return IPC_RESULT_ACCESS; + } + + if (async) { + return ISFS_RenameAsync(absPathFrom, absPathTo, nandCallback, block); + } else { + return ISFS_Rename(absPathFrom, absPathTo); + } +} + +s32 NANDMove(const char* from, const char* to) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(nandMove(from, to, NULL, FALSE, FALSE)); +} + +static s32 nandGetFileStatus(s32 fd, u32* lengthOut, u32* positionOut) { + FSFileStats stats; + s32 result; + + result = ISFS_GetFileStats(fd, &stats); + if (result == IPC_RESULT_OK) { + if (lengthOut != NULL) { + *lengthOut = stats.length; + } + + if (positionOut != NULL) { + *positionOut = stats.position; + } + } + + return result; +} + +s32 NANDGetLength(NANDFileInfo* info, u32* length) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode(nandGetFileStatus(info->fd, length, NULL)); +} + +static s32 nandGetFileStatusAsync(s32 fd, NANDCommandBlock* block) { + // Work buffer??? + return ISFS_GetFileStatsAsync(fd, + (FSFileStats*)ROUND_UP_PTR(block->path, 32), + nandGetFileStatusAsyncCallback, block); +} + +static void nandGetFileStatusAsyncCallback(s32 result, void* arg) { + // Implicit cast required + NANDCommandBlock* block = arg; + // Work buffer??? + FSFileStats* stats = (FSFileStats*)ROUND_UP_PTR(block->path, 32); + + if (result == IPC_RESULT_OK) { + if (block->length != NULL) { + *block->length = stats->length; + } + + if (block->position != NULL) { + *block->position = stats->position; + } + } + + block->callback(nandConvertErrorCode(result), arg); +} + +s32 NANDGetLengthAsync(NANDFileInfo* info, u32* lengthOut, + NANDAsyncCallback callback, NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + block->length = lengthOut; + block->position = NULL; + return nandConvertErrorCode(nandGetFileStatusAsync(info->fd, block)); +} + +static void nandComposePerm(u8* out, u32 ownerPerm, u32 groupPerm, + u32 otherPerm) DECOMP_DONT_INLINE { + u32 perm = 0; + + if (ownerPerm & NAND_ACCESS_READ) { + perm |= NAND_PERM_RUSR; + } + + if (ownerPerm & NAND_ACCESS_WRITE) { + perm |= NAND_PERM_WUSR; + } + + if (groupPerm & NAND_ACCESS_READ) { + perm |= NAND_PERM_RGRP; + } + + if (groupPerm & NAND_ACCESS_WRITE) { + perm |= NAND_PERM_WGRP; + } + + if (otherPerm & NAND_ACCESS_READ) { + perm |= NAND_PERM_ROTH; + } + + if (otherPerm & NAND_ACCESS_WRITE) { + perm |= NAND_PERM_WOTH; + } + + *out = perm; +} + +static void nandSplitPerm(u8 perm, u32* ownerPerm, u32* groupPerm, + u32* otherPerm) { + *ownerPerm = 0; + *groupPerm = 0; + *otherPerm = 0; + + if (perm & NAND_PERM_RUSR) { + *ownerPerm |= NAND_ACCESS_READ; + } + + if (perm & NAND_PERM_WUSR) { + *ownerPerm |= NAND_ACCESS_WRITE; + } + + if (perm & NAND_PERM_RGRP) { + *groupPerm |= NAND_ACCESS_READ; + } + + if (perm & NAND_PERM_WGRP) { + *groupPerm |= NAND_ACCESS_WRITE; + } + + if (perm & NAND_PERM_ROTH) { + *otherPerm |= NAND_ACCESS_READ; + } + + if (perm & NAND_PERM_WOTH) { + *otherPerm |= NAND_ACCESS_WRITE; + } +} + +static s32 nandGetStatus(const char* path, NANDStatus* status, + NANDCommandBlock* block, BOOL async, BOOL priv) { + s32 result; + u32 attr; + u32 ownerPerm, groupPerm, otherPerm; + char absPath[64]; + + MEMCLR(&absPath); + nandGenerateAbsPath(absPath, path); + + if (!priv && nandIsUnderPrivatePath(absPath)) { + return IPC_RESULT_ACCESS; + } + + if (async) { + return ISFS_GetAttrAsync(absPath, &status->ownerId, &status->groupId, + &block->attr, &block->ownerPerm, + &block->groupPerm, &block->otherPerm, + nandGetStatusCallback, block); + } else { + attr = 0; + ownerPerm = 0; + groupPerm = 0; + otherPerm = 0; + + result = ISFS_GetAttr(absPath, &status->ownerId, &status->groupId, + &attr, &ownerPerm, &groupPerm, &otherPerm); + + if (result == IPC_RESULT_OK) { + nandComposePerm(&status->perm, ownerPerm, groupPerm, otherPerm); + status->attr = attr; + } + + return result; + } +} + +static void nandGetStatusCallback(s32 result, void* arg) { + NANDCommandBlock* block = (NANDCommandBlock*)arg; + NANDStatus* status; + + if (result == IPC_RESULT_OK) { + status = block->status; + status->attr = block->attr; + nandComposePerm(&status->perm, block->ownerPerm, block->groupPerm, + block->otherPerm); + } + + block->callback(nandConvertErrorCode(result), block); +} + +s32 NANDGetStatus(const char* path, NANDStatus* status) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + return nandConvertErrorCode( + nandGetStatus(path, status, NULL, FALSE, FALSE)); +} + +s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status, + NANDAsyncCallback callback, + NANDCommandBlock* block) { + if (!nandIsInitialized()) { + return NAND_RESULT_FATAL_ERROR; + } + + block->callback = callback; + block->status = status; + return nandConvertErrorCode(nandGetStatus(path, status, block, TRUE, TRUE)); +} + +void NANDSetUserData(NANDCommandBlock* block, void* data) { + block->userData = data; +} + +void* NANDGetUserData(NANDCommandBlock* block) { + return block->userData; +} + +static BOOL nandInspectPermission(u8 perm) { + return perm & NAND_PERM_RUSR; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Config.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Config.c new file mode 100644 index 0000000000..3a6ebecfcc --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Config.c @@ -0,0 +1,262 @@ +#include + +#include +#include + +#define CONFIG_MAGIC 'WcCf' +#define CONFIG_VERSION 8 +#define CONFIG_MAX_ID_COUNT 32 + +#define COMPANY_CODE_NINTENDO 01 + +static NWC24Config* config = NULL; +static BOOL ConfigModified = FALSE; + +static const char* MBoxDir = "/shared2/wc24/mbox"; +static const char* ConfigFile = "/shared2/wc24/nwc24msg.cfg"; +static const char* CfgBakFile = "/shared2/wc24/nwc24msg.cbk"; + +static u32 GetConfigCheckSum(void); +static NWC24Err CheckConfig(void) DECOMP_DONT_INLINE; +static NWC24Err GenerateUserId(u64* idOut); + +NWC24Err NWC24GetMyUserId(u64* idOut) { + NWC24Err scdErr; + NWC24Err result; + + result = NWC24_OK; + + if (NWC24IsMsgLibOpened() || NWC24IsMsgLibOpenedByTool()) { + *idOut = config->userId; + } else { + scdErr = NWC24SuspendScheduler(); + if (scdErr < 0) { + return scdErr; + } + + result = NWC24GenerateNewUserId(idOut); + if (result == NWC24_ERR_ID_GENERATED || + result == NWC24_ERR_ID_REGISTERED) { + result = NWC24_OK; + } + + scdErr = NWC24ResumeScheduler(); + if (scdErr < 0) { + result = result != NWC24_OK ? result : scdErr; + } + } + + return result; +} + +NWC24Err NWC24GenerateNewUserId(u64* idOut) { + NWC24Err open; + NWC24Err close; + + open = NWC24BlockOpenMsgLib(TRUE); + if (open < 0) { + return open; + } + + open = GenerateUserId(idOut); + close = NWC24BlockOpenMsgLib(FALSE); + + return open >= 0 ? close : open; +} + +NWC24Err NWC24iConfigOpen(void) { + config = (NWC24Config*)NWC24WorkP->config; + ConfigModified = FALSE; + return NWC24iConfigReload(); +} + +NWC24Err NWC24iConfigReload(void) { + NWC24Err result; + NWC24Err close; + NWC24File file; + + if (NWC24WorkP == NULL) { + return NWC24_ERR_LIB_NOT_OPENED; + } + + result = NWC24FOpen(&file, ConfigFile, NWC24_OPEN_NAND_R); + + if (result == NWC24_OK) { + result = NWC24FRead(config, sizeof(NWC24Config), &file); + close = NWC24FClose(&file); + result = result != NWC24_OK ? result : close; + } + + if (result == NWC24_OK) { + result = CheckConfig(); + + if (result == NWC24_OK) { + ConfigModified = FALSE; + return result; + } + } + + result = NWC24FOpen(&file, CfgBakFile, NWC24_OPEN_NAND_R); + + if (result == NWC24_OK) { + result = NWC24FRead(config, sizeof(NWC24Config), &file); + close = NWC24FClose(&file); + result = result != NWC24_OK ? result : close; + } + + if (result == NWC24_OK) { + result = CheckConfig(); + + if (result == NWC24_OK) { + ConfigModified = TRUE; + } + } + + return result; +} + +NWC24Err NWC24iConfigFlush(void) { + NWC24Err result; + NWC24Err close; + NWC24File file; + + if (NWC24WorkP == NULL) { + return NWC24_ERR_LIB_NOT_OPENED; + } + + if (!ConfigModified) { + return NWC24_OK; + } + + config->checksum = GetConfigCheckSum(); + + result = NWC24FOpen(&file, ConfigFile, NWC24_OPEN_NAND_W); + + if (result == NWC24_OK) { + result = NWC24FWrite(config, sizeof(NWC24Config), &file); + close = NWC24FClose(&file); + result = result != NWC24_OK ? result : close; + + ConfigModified = FALSE; + } + + if (result != NWC24_OK) { + return result; + } + + result = NWC24FOpen(&file, CfgBakFile, NWC24_OPEN_NAND_W); + + if (result == NWC24_OK) { + result = NWC24FWrite(config, sizeof(NWC24Config), &file); + close = NWC24FClose(&file); + result = result != NWC24_OK ? result : close; + + ConfigModified = FALSE; + } + + return result; +} + +const char* NWC24GetAccountDomain(void) { + return config->acctDomain; +} + +const char* NWC24GetMBoxDir(void) { + OSIOSRev rev; + __OSGetIOSRev(&rev); + + // Debug: "Firmware older than 0.7.6 is not supported" + if (rev.idLo == 0 && + (rev.verMajor == 7 && rev.verMinor == 0 || rev.verMajor < 7)) { + // clang-format off +#line 666 + OSError("stopped."); + // clang-format on + } + + return MBoxDir; +} + +u32 NWC24GetAppId(void) { + u32 appId = *(u32*)OSGetAppGamename(); + + if (appId == 0 && OSGetAppType() == 0) { + appId = *(u32*)DVDGetCurrentDiskID()->game; + } + + return appId; +} + +u16 NWC24GetGroupId(void) { + NANDStatus stat; + u16 groupId; + char* dir; + + groupId = COMPANY_CODE_NINTENDO; + + switch (OSGetAppType()) { + case OS_APP_TYPE_IPL: + groupId = COMPANY_CODE_NINTENDO; + break; + case OS_APP_TYPE_DVD: + groupId = *(u16*)DVDGetCurrentDiskID()->company; + break; + case OS_APP_TYPE_CHANNEL: + dir = NWC24WorkP->pathWork; + if (NANDGetHomeDir(dir) == NAND_RESULT_OK) { + if (NANDGetStatus(dir, &stat) == NAND_RESULT_OK) { + groupId = stat.groupId; + } + } + break; + } + + return groupId; +} + +static u32 GetConfigCheckSum(void) { + u32 i; + u32 csum; + u32* ptr; + + csum = 0; + ptr = (u32*)config; + + // -1 to avoid checksum member + for (i = 0; i < sizeof(NWC24Config) / sizeof(u32) - 1; i++) { + csum += *ptr++; + } + + return csum; +} + +static NWC24Err CheckConfig(void) { + if (config->magic != CONFIG_MAGIC) { + return NWC24_ERR_BROKEN; + } + + if (config->checksum != GetConfigCheckSum()) { + return NWC24_ERR_BROKEN; + } + + if (config->createCount >= CONFIG_MAX_ID_COUNT) { + return NWC24_ERR_BROKEN; + } + + if (config->version != CONFIG_VERSION) { + return NWC24_ERR_VER_MISMATCH; + } + + return NWC24_OK; +} + +static NWC24Err GenerateUserId(u64* idOut) { + u32 sp08 = 0; + + if (idOut == NULL) { + return NWC24_ERR_INVALID_VALUE; + } + + *idOut = 9999999999999999; + return NWC24iRequestGenerateUserId(idOut, &sp08); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Download.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Download.c new file mode 100644 index 0000000000..bc187347a7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Download.c @@ -0,0 +1,324 @@ +#include +#include + +static const char* DLFilePath = "/shared2/wc24/nwc24dl.bin"; + +static NWC24DlEntry* GetDlTaskEntryHeader(u16 i); +static NWC24Err WriteDlHeader(NWC24File* file); +static NWC24Err SeekDlTaskEntry(u16 i, NWC24File* file); +static NWC24Err CheckDlEntryAvailable(u16 i); +static NWC24Err WriteDlTaskEntry(NWC24DlTask* task, NWC24File* file); +static NWC24Err ReadDlTaskEntry(NWC24DlTask* task, u16 i, NWC24File* file); +static NWC24Err ClearDlTaskEntry(u16 i, NWC24File* file); +static NWC24Err ReadDlHeader(NWC24File* file); +static void InitTaskEntryHeader(u16 i); +static NWC24Err LoadDlTask(NWC24DlTask* task, u16 i); +static NWC24Err DeleteDlTask(NWC24DlTask* task) DECOMP_DONT_INLINE; +static NWC24Err CheckHeader(NWC24DlHeader* header); + +static BOOL IsPrivateId(u16 i) { + return i < NWC24iGetCachedDlHeader()->privateTasks; +} + +NWC24Err NWC24CheckDlTask(NWC24DlTask* task) { + NWC24DlHeader* header; + + header = NWC24iGetCachedDlHeader(); + + if (task == NULL) { + return NWC24_ERR_INVALID_VALUE; + } + + if (header == NULL) { + return NWC24_ERR_LIB_NOT_OPENED; + } + + // @bug Should be maxTasks + if (task->id != 0xFFFF && + task->id >= NWC24iGetCachedDlHeader()->maxSubTasks) { + return NWC24_ERR_INVALID_VALUE; + } + + return NWC24_OK; +} + +NWC24Err NWC24DeleteDlTaskForced(NWC24DlTask* task) { + NWC24Err result; + + result = NWC24CheckDlTask(task); + if (result != NWC24_OK) { + return result; + } + + result = DeleteDlTask(task); + if (result < 0) { + return result; + } + + task->id = 0xFFFF; + return result; +} + +NWC24Err NWC24GetDlTask(NWC24DlTask* task, u16 i) { + NWC24Err result; + + result = CheckDlEntryAvailable(i); + if (result < 0) { + return result; + } + + result = LoadDlTask(task, i); + if (result < 0) { + return result; + } + + return result; +} + +NWC24Err NWC24iOpenDlTaskList(void) { + NWC24Err result; + + result = NWC24iLoadDlHeader(); + + if (result >= 0) { + NWC24iSynchronizeRtcCounter(FALSE); + result = NWC24iCheckHeaderConsistency(NWC24iGetCachedDlHeader(), FALSE); + + if (result >= 0) { + return NWC24_OK; + } + } + + return result; +} + +NWC24Err NWC24iCloseDlTaskList(void) { + return NWC24_OK; +} + +NWC24DlHeader* NWC24iGetCachedDlHeader(void) { + return (NWC24DlHeader*)NWC24WorkP->dlHeader; +} + +NWC24Err NWC24iCheckHeaderConsistency(NWC24DlHeader* header, BOOL clear) { + NWC24DlTask* ptask; + NWC24DlTask* pptask; + NWC24DlTask task; + u16 i; + + // Man... + ptask = &task; + pptask = ptask; + + // @bug Should be maxTasks + for (i = 0; i < header->maxSubTasks; i++) { + if (CheckDlEntryAvailable(i) == NWC24_OK && clear) { + if (NWC24GetDlTask(pptask, i) < 0) { + NWC24DeleteDlTaskForced(ptask); + } else if (!IsPrivateId(i) && task.count == 0) { + NWC24DeleteDlTaskForced(ptask); + } + } + } + + return NWC24_OK; +} + +NWC24Err NWC24iLoadDlHeader(void) { + NWC24File file; + NWC24Err result; + NWC24Err close; + NWC24Err ret; + u32 length; + + length = 0; + + result = NWC24FOpen(&file, DLFilePath, NWC24_OPEN_NAND_R); + if (result < 0) { + return result; + } + + result = ReadDlHeader(&file); + if (result < 0) { + return result; + } + + result = NWC24FGetLength(&file, &length); + if (result >= 0) { + result = CheckHeader(NWC24iGetCachedDlHeader()); + } + + close = NWC24FClose(&file); + + if (result != NWC24_OK) { + ret = result; + } else { + ret = close; + } + + return ret; +} + +static NWC24DlEntry* GetDlTaskEntryHeader(u16 i) { + return &NWC24iGetCachedDlHeader()->entries[i]; +} + +static NWC24Err WriteDlHeader(NWC24File* file) { + NWC24Err result; + + result = NWC24FSeek(file, 0, NWC24_SEEK_BEG); + if (result < 0) { + return result; + } + + result = + NWC24FWrite(NWC24iGetCachedDlHeader(), sizeof(NWC24DlHeader), file); + if (result < 0) { + return result; + } + + return NWC24_OK; +} + +static NWC24Err SeekDlTaskEntry(u16 i, NWC24File* file) { + return NWC24FSeek(file, sizeof(NWC24DlHeader) + i * sizeof(NWC24DlTask), + NWC24_SEEK_BEG); +} + +static NWC24Err CheckDlEntryAvailable(u16 i) { + // @bug Should be maxTasks + if (i >= NWC24iGetCachedDlHeader()->maxSubTasks || i == 0xFFFF) { + return NWC24_ERR_INVALID_VALUE; + } + + if (GetDlTaskEntryHeader(i)->app == 0) { + return NWC24_ERR_NOT_FOUND; + } + + return NWC24_OK; +} + +static NWC24Err WriteDlTaskEntry(NWC24DlTask* task, NWC24File* file) { + NWC24Err result; + + result = SeekDlTaskEntry(task->id, file); + if (result < 0) { + return result; + } + + memcpy(NWC24WorkP->dlTask, task, sizeof(NWC24DlTask)); + result = NWC24FWrite(NWC24WorkP->dlTask, sizeof(NWC24DlTask), file); + if (result < 0) { + return result; + } + + return NWC24_OK; +} + +static NWC24Err ReadDlTaskEntry(NWC24DlTask* task, u16 i, NWC24File* file) { + NWC24Err result; + + result = SeekDlTaskEntry(i, file); + if (result < 0) { + return result; + } + + result = NWC24FRead(task, sizeof(NWC24DlTask), file); + if (result < 0) { + return result; + } + + return NWC24_OK; +} + +static NWC24Err ClearDlTaskEntry(u16 i, NWC24File* file) { + NWC24DlTask* task = (NWC24DlTask*)NWC24WorkP->dlTask; + + memset(task, 0, sizeof(NWC24DlTask)); + task->type = 0xFF; + task->id = i; + + InitTaskEntryHeader(i); + return WriteDlTaskEntry(task, file); +} + +static NWC24Err ReadDlHeader(NWC24File* file) { + NWC24Err result; + + result = NWC24FSeek(file, 0, NWC24_SEEK_BEG); + if (result < 0) { + return result; + } + + result = NWC24FRead(&NWC24WorkP->dlHeader, sizeof(NWC24DlHeader), file); + if (result < 0) { + return result; + } + + return NWC24_OK; +} + +static void InitTaskEntryHeader(u16 i) { + memset(GetDlTaskEntryHeader(i), 0, sizeof(NWC24DlEntry)); +} + +static NWC24Err LoadDlTask(NWC24DlTask* task, u16 i) { + NWC24File file; + NWC24Err result; + NWC24Err close; + NWC24Err ret; + + result = NWC24FOpen(&file, DLFilePath, NWC24_OPEN_NAND_RBUFF); + if (result < 0) { + return result; + } + + result = ReadDlTaskEntry(task, i, &file); + close = NWC24FClose(&file); + + if (result != NWC24_OK) { + ret = result; + } else { + ret = close; + } + + return ret; +} + +static NWC24Err DeleteDlTask(NWC24DlTask* task) { + NWC24File file; + NWC24Err result; + NWC24Err close; + NWC24Err ret; + + result = NWC24FOpen(&file, DLFilePath, NWC24_OPEN_NAND_RW); + if (result < 0) { + return result; + } + + result = ClearDlTaskEntry(task->id, &file); + if (result >= 0) { + InitTaskEntryHeader(task->id); + result = WriteDlHeader(&file); + } + + close = NWC24FClose(&file); + + if (result != NWC24_OK) { + ret = result; + } else { + ret = close; + } + + return ret; +} + +static NWC24Err CheckHeader(NWC24DlHeader* header) { + // @bug Should be maxTasks + if (header->maxSubTasks < 1 || header->privateTasks < 1 || + header->maxSubTasks < header->privateTasks) { + return NWC24_ERR_BROKEN; + } + + return NWC24_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FileApi.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FileApi.c new file mode 100644 index 0000000000..069a1ee16e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FileApi.c @@ -0,0 +1,635 @@ +#include + +#include + +#include + +#define WC24_DRIVE "@24" +#define NAND_RETRY_COUNT 3 + +// Set MSB after buffered read to "invalidate" align. +// Requires new seek operation before every buffered read. +#define INVALIDATE_ALIGN 0x80000000 + +#define SLEEP_MSEC(x) OSSleepTicks(OS_MSEC_TO_TICKS((s64)(x))) + +static u32 RdBufferMutex = 0; +static u32 WrBufferMutex = 0; +static u32 InstanceIdGen = 0; + +static NWC24Err BufferedWrite(const void* src, s32 size, NWC24File* file); +static NWC24Err BufferedWriteFlush(NWC24File* file); +static NWC24Err BufferedRead(void* dst, s32 size, NWC24File* file); +static NWC24Err AlignedSeek(NWC24File* file, s32 offset, NWC24SeekMode whence); +static NWC24Err ConvertError(s32 nanderr, NWC24Err wc24err); +static NWC24Err ConvertVfError(s32 vferr, NWC24Err wc24err); + +NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode) { + InstanceIdGen++; + InstanceIdGen |= 0x80000000; + + file->id = InstanceIdGen; + file->align = 0; + file->mode = mode; + + if (mode == NWC24_OPEN_NAND_WBUFF || mode == NWC24_OPEN_NAND_RBUFF || + mode == NWC24_OPEN_VF_WBUFF || mode == NWC24_OPEN_VF_RBUFF) { + + if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { + return NWC24_ERR_LIB_NOT_OPENED; + } + } + + if (mode == NWC24_OPEN_NAND_WBUFF || mode == NWC24_OPEN_VF_WBUFF) { + if (WrBufferMutex != 0) { + return NWC24_ERR_MUTEX; + } + + WrBufferMutex = file->id; + } + + if (mode & NWC24_OPEN_VF) { + return NWC24iFOpenVF(file, path, mode); + } + + return NWC24iFOpenNand(file, path, mode); +} + +NWC24Err NWC24iFOpenNand(NWC24File* file, const char* path, u32 mode) { + s32 result; + NANDAccessType access; + u32 i; + + switch (mode) { + case NWC24_OPEN_NAND_W: + case NWC24_OPEN_NAND_WBUFF: + result = NANDPrivateCreate(path, NAND_PERM_RWALL, 0); + if (result != NAND_RESULT_OK && result != NAND_RESULT_EXISTS) { + return NWC24_ERR_FILE_OTHER; + } + access = NAND_ACCESS_WRITE; + break; + case NWC24_OPEN_NAND_R: + case NWC24_OPEN_NAND_RBUFF: + access = NAND_ACCESS_READ; + break; + case NWC24_OPEN_NAND_RW: + access = NAND_ACCESS_RW; + break; + default: + return NWC24_ERR_INVALID_VALUE; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDPrivateOpen(path, &file->nandf, access); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result != NAND_RESULT_OK) { + if (mode == NWC24_OPEN_NAND_WBUFF) { + WrBufferMutex = NULL; + } + + if (result == NAND_RESULT_NOEXISTS) { + return NWC24_ERR_FILE_NOEXISTS; + } + + return NWC24_ERR_FILE_OPEN; + } + + return NWC24_OK; +} + +NWC24Err NWC24iFOpenVF(NWC24File* file, const char* path, u32 mode) { + s32 result; + const char* access; + + switch (mode) { + case NWC24_OPEN_VF_W: + case NWC24_OPEN_VF_WBUFF: + access = "w"; + break; + case NWC24_OPEN_VF_R: + case NWC24_OPEN_VF_RBUFF: + access = "r"; + break; + default: + return NWC24_ERR_INVALID_VALUE; + } + + file->vff = VFOpenFile(path, access, 0); + + if (file->vff == NULL) { + result = VFGetLastError(); + + if (mode == NWC24_OPEN_VF_WBUFF) { + WrBufferMutex = 0; + } + + if (*access == 'r' && result == VF_ERROR_0002) { + return NWC24_ERR_FILE_NOEXISTS; + } + + return ConvertVfError(result, NWC24_ERR_FILE_OPEN); + } + + return NWC24_OK; +} + +NWC24Err NWC24FClose(NWC24File* file) { + NWC24Err close = NWC24_OK; + NWC24Err read = NWC24_OK; + + if (file->mode == NWC24_OPEN_NAND_WBUFF || + file->mode == NWC24_OPEN_VF_WBUFF) { + read = BufferedWriteFlush(file); + WrBufferMutex = 0; + } + + if (file->mode & NWC24_OPEN_VF) { + close = NWC24iFCloseVF(file); + } else { + close = NWC24iFCloseNand(file); + } + + return read != NWC24_OK ? read : close; +} + +NWC24Err NWC24iFCloseNand(NWC24File* file) { + s32 result; + NWC24Err err; + u32 i; + + err = NWC24_OK; + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDClose(&file->nandf); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + err = NWC24_ERR_NAND_CORRUPT; + } else if (result != NAND_RESULT_OK) { + err = NWC24_ERR_FILE_CLOSE; + } + + return err; +} + +NWC24Err NWC24iFCloseVF(NWC24File* file) { + s32 result; + + result = VFCloseFile(file->vff); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_CLOSE); + } + + return NWC24_OK; +} + +NWC24Err NWC24FSeek(NWC24File* file, s32 offset, NWC24SeekMode whence) { + s32 result; + u32 i; + + if (file->mode == NWC24_OPEN_NAND_RBUFF || + file->mode == NWC24_OPEN_VF_RBUFF) { + return AlignedSeek(file, offset, whence); + } + + if (file->mode & NWC24_OPEN_VF) { + result = VFSeekFile(file->vff, offset, whence); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_OTHER); + } + + return NWC24_OK; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDSeek(&file->nandf, offset, whence); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result < 0) { + return NWC24_ERR_FILE_OTHER; + } + + return NWC24_OK; +} + +NWC24Err NWC24FRead(void* dst, s32 size, NWC24File* file) { + s32 result; + u32 i; + + switch (file->mode) { + case NWC24_OPEN_NAND_W: + case NWC24_OPEN_NAND_WBUFF: + case NWC24_OPEN_VF_W: + return NWC24_ERR_PROTECTED; + case NWC24_OPEN_NAND_RBUFF: + case NWC24_OPEN_VF_RBUFF: + return BufferedRead(dst, size, file); + } + + if (file->mode & NWC24_OPEN_VF) { + result = VFReadFile(file->vff, dst, size, NULL); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_READ); + } + + return NWC24_OK; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDRead(&file->nandf, dst, size); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + return NWC24_ERR_NAND_CORRUPT; + } + + if (result < 0) { + return ConvertError(result, NWC24_ERR_FILE_READ); + } + + return NWC24_OK; +} + +NWC24Err NWC24FWrite(const void* src, s32 size, NWC24File* file) { + s32 result; + u32 i; + + switch (file->mode) { + case NWC24_OPEN_NAND_WBUFF: + case NWC24_OPEN_VF_WBUFF: + return BufferedWrite(src, size, file); + // @bug Missing NWC24_OPEN_VF_RBUFF + case NWC24_OPEN_NAND_R: + case NWC24_OPEN_NAND_RBUFF: + case NWC24_OPEN_VF_R: + return NWC24_ERR_PROTECTED; + } + + if (file->mode & NWC24_OPEN_VF) { + result = VFWriteFile(file->vff, src, size); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_WRITE); + } + + return NWC24_OK; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDWrite(&file->nandf, src, size); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + return NWC24_ERR_NAND_CORRUPT; + } + + if (result < 0) { + return ConvertError(result, NWC24_ERR_FILE_WRITE); + } + + if (result != size) { + return NWC24_ERR_FILE_WRITE; + } + + return NWC24_OK; +} + +NWC24Err NWC24FGetLength(NWC24File* file, u32* lengthOut) { + s32 error; + + if (file->mode & NWC24_OPEN_VF) { + error = VFGetFileSizeByFd(file->vff); + if (error < 0) { + return ConvertVfError(error, NWC24_ERR_FILE_OTHER); + } + + *lengthOut = error; + return NWC24_OK; + } + + error = NANDGetLength(&file->nandf, lengthOut); + if (error != NAND_RESULT_OK) { + return NWC24_ERR_FILE_OTHER; + } + + return NWC24_OK; +} + +NWC24Err NWC24FDeleteVF(const char* path) { + s32 result; + + result = VFDeleteFile(path); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_OTHER); + } + + return NWC24_OK; +} + +NWC24Err NWC24MountVF(const char* drive, const char* filename) { + s32 result; + + result = VFMountDriveNANDFlashEx(drive, filename); + if (result == VF_ERROR_B001) { + return NWC24_ERR_FILE_NOEXISTS; + } + + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_INTERNAL_VF); + } + + result = VFSetSyncMode(drive, VF_SYNC_MODE_1); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_INTERNAL_VF); + } + + return NWC24_OK; +} + +NWC24Err NWC24UnmountVF(const char* drive) { + s32 result; + + result = VFUnmountDrive(drive); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_INTERNAL_VF); + } + + return NWC24_OK; +} + +NWC24Err NWC24CheckSizeVF(const char* drive, u32* sizeOut) { + s32 size; + + size = VFGetDriveFreeSize(drive); + *sizeOut = size; + + if (size < 0) { + return ConvertVfError(VFGetLastError(), NWC24_ERR_INTERNAL_VF); + } + + return NWC24_OK; +} + +static NWC24Err BufferedWrite(const void* src, s32 size, NWC24File* file) { + u32 now; + u32 left; + u32 pos; + u8* buf; + const u8* bsrc; + s32 result; + NWC24Err err; + u32 i; + + left = size; + pos = file->align; + buf = NWC24WorkP->writeBuffer; + bsrc = (u8*)src; + err = NWC24_OK; + + while (left != 0) { + now = NWC24_IO_BUFFER_SIZE - pos; + + if (left < now) { + now = left; + } + + memcpy(buf + pos, bsrc, now); + + pos += now; + left -= now; + bsrc += now; + + if (pos < NWC24_IO_BUFFER_SIZE) { + continue; + } + + pos = 0; + + if (file->mode & NWC24_OPEN_VF) { + result = VFWriteFile(file->vff, buf, NWC24_IO_BUFFER_SIZE); + if (result == VF_OK) { + continue; + } + + err = ConvertVfError(result, NWC24_ERR_FILE_WRITE); + break; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDWrite(&file->nandf, buf, NWC24_IO_BUFFER_SIZE); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + return NWC24_ERR_NAND_CORRUPT; + } + + if (result != NWC24_IO_BUFFER_SIZE) { + err = NWC24_ERR_FILE_WRITE; + break; + } + } + + file->align = pos; + return err; +} + +static NWC24Err BufferedWriteFlush(NWC24File* file) { + s32 result; + u32 pos; + u8* buf; + NWC24Err err; + u32 i; + + pos = file->align; + buf = NWC24WorkP->writeBuffer; + err = NWC24_OK; + + if (pos == 0) { + return err; + } + + while (pos % 32 != 0) { + buf[pos++] = 0x00; + } + + if (file->mode & NWC24_OPEN_VF) { + result = VFWriteFile(file->vff, buf, pos); + if (result != VF_OK) { + err = ConvertVfError(result, NWC24_ERR_FILE_WRITE); + } + + return err; + } + + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDWrite(&file->nandf, buf, pos); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + return NWC24_ERR_NAND_CORRUPT; + } + + if (result != pos) { + err = NWC24_ERR_FILE_WRITE; + } + + return err; +} + +static NWC24Err BufferedRead(void* dst, s32 size, NWC24File* file) { + u32 total; + u32 now; + u32 left; + s32 result; + u32 pos; + u8* buf; + u8* bdst; + NWC24Err err; + u32 i; + u32 bytesread; + + bdst = (u8*)dst; + total = size; + buf = NWC24WorkP->readBuffer; + err = NWC24_OK; + + if (RdBufferMutex != 0) { + return NWC24_ERR_MUTEX; + } + + RdBufferMutex = file->id; + + if (file->align & INVALIDATE_ALIGN) { + return NWC24_ERR_INVALID_OPERATION; + } + + pos = file->align; + + while (total > 0) { + now = NWC24_IO_BUFFER_SIZE; + left = now - pos; + + if (total < left) { + left = total; + now = ROUND_UP(total + pos, 32); + } + + if (file->mode & NWC24_OPEN_VF) { + result = VFReadFile(file->vff, buf, now, &bytesread); + if (result != VF_OK) { + err = ConvertVfError(result, NWC24_ERR_FILE_READ); + break; + } + + result = bytesread; + } else { + for (i = 0; i < NAND_RETRY_COUNT; i++) { + result = NANDRead(&file->nandf, buf, now); + if (result != NAND_RESULT_BUSY) { + break; + } + + SLEEP_MSEC(1000); + } + + if (result == NAND_RESULT_CORRUPT) { + return NWC24_ERR_NAND_CORRUPT; + } + } + + if (result != now) { + err = NWC24_ERR_FILE_READ; + break; + } else { + memcpy(bdst, buf + pos, left); + bdst += left; + total -= left; + pos = 0; + } + } + + file->align = (file->align + size) % 32; + file->align |= INVALIDATE_ALIGN; + RdBufferMutex = 0; + return err; +} + +static NWC24Err AlignedSeek(NWC24File* file, s32 offset, NWC24SeekMode whence) { + s32 result; + s32 alignofs; + + file->align = offset % 32; + alignofs = offset - file->align; + + if (file->mode & NWC24_OPEN_VF) { + result = VFSeekFile(file->vff, alignofs, whence); + if (result != VF_OK) { + return ConvertVfError(result, NWC24_ERR_FILE_OTHER); + } + + return NWC24_OK; + } + + result = NANDSeek(&file->nandf, alignofs, whence); + if (result < 0) { + return NWC24_ERR_FILE_OTHER; + } + + return NWC24_OK; +} + +static NWC24Err ConvertError(s32 nanderr, NWC24Err wc24err) { + switch (nanderr) { + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_AUTHENTICATION: + return NWC24_ERR_FILE_BROKEN; + case NAND_RESULT_CORRUPT: + return NWC24_ERR_NAND_CORRUPT; + default: + return wc24err; + } +} + +static NWC24Err ConvertVfError(s32 vferr, NWC24Err wc24err) { + if (vferr == VF_ERROR_0005) { + return ConvertError(VFGetLastDeviceError(WC24_DRIVE), wc24err); + } + + return wc24err; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FriendList.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FriendList.c new file mode 100644 index 0000000000..8cfbf9d117 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24FriendList.c @@ -0,0 +1,54 @@ +#include + +#define FRIEND_LIST_MAGIC 'WcFl' +#define FRIEND_LIST_VERSION 2 + +static const char* FLFilePath = "/shared2/wc24/nwc24fl.bin"; + +static NWC24Err GetCachedFLHeader(NWC24FLHeader** header); + +NWC24Err NWC24iOpenFriendList(void) { + NWC24FLHeader* header = (NWC24FLHeader*)NWC24WorkP->flHeader; + Mail_memset(header, 0, sizeof(NWC24FLHeader)); + return GetCachedFLHeader(&header); +} + +static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) { + NWC24File file; + NWC24Err result; + NWC24Err read; + NWC24Err close; + + *header = (NWC24FLHeader*)NWC24WorkP->flHeader; + + if ((*header)->magic != FRIEND_LIST_MAGIC) { + result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_NAND_R); + if (result != NWC24_OK) { + return result; + } + + NWC24FSeek(&file, 0, NWC24_SEEK_BEG); + read = NWC24FRead(*header, sizeof(NWC24FLHeader), &file); + close = NWC24FClose(&file); + + if (read != NWC24_OK) { + result = read; + } else { + result = close; + } + + if (result != NWC24_OK) { + return result; + } + + if ((*header)->magic != FRIEND_LIST_MAGIC) { + return NWC24_ERR_BROKEN; + } + + if ((*header)->version != FRIEND_LIST_VERSION) { + return NWC24_ERR_VER_MISMATCH; + } + } + + return NWC24_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Ipc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Ipc.c new file mode 100644 index 0000000000..d4535f1b25 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Ipc.c @@ -0,0 +1,76 @@ +#include + +static BOOL NWC24iIsRequestPending = FALSE; + +static s32 CallbackAsyncIpc(s32 result, void* arg); + +NWC24Err NWC24iOpenResourceManager(const char* user, const char* name, + s32* fdOut, IPCOpenMode mode) { +#pragma unused(user) + + NWC24Err result; + + if (fdOut == NULL) { + return NWC24_ERR_INVALID_VALUE; + } + + result = IOS_Open(name, mode); + *fdOut = result; + + if (result < 0) { + if (result == IPC_RESULT_NOEXISTS_INTERNAL) { + return NWC24_ERR_INPROGRESS; + } + + if (result == IPC_RESULT_BUSY_INTERNAL) { + return NWC24_ERR_BUSY; + } + + return NWC24_ERR_INTERNAL_IPC; + } + + return NWC24_OK; +} + +NWC24Err NWC24iCloseResourceManager(const char* user, s32 fd) { +#pragma unused(user) + + return IOS_Close(fd) < 0 ? NWC24_ERR_INTERNAL_IPC : NWC24_OK; +} + +NWC24Err NWC24iIoctlResourceManager(const char* user, s32 fd, s32 type, + void* in, s32 inSize, void* out, + s32 outSize) { +#pragma unused(user) + + return IOS_Ioctl(fd, type, in, inSize, out, outSize) < 0 + ? NWC24_ERR_INTERNAL_IPC + : NWC24_OK; +} + +NWC24Err NWC24iIoctlResourceManagerAsync(const char* user, s32 fd, s32 type, + void* in, s32 inSize, void* out, + s32 outSize, void* callbackArg) { +#pragma unused(user) + + if (IOS_IoctlAsync(fd, type, in, inSize, out, outSize, CallbackAsyncIpc, + callbackArg) < 0) { + return NWC24_ERR_INTERNAL_IPC; + } + + NWC24iIsRequestPending = TRUE; + return NWC24_OK; +} + +BOOL NWC24iIsAsyncRequestPending(void) { + return NWC24iIsRequestPending; +} + +static s32 CallbackAsyncIpc(s32 result, void* arg) { + if (arg != NULL) { + *(s32*)arg = result; + } + + NWC24iIsRequestPending = FALSE; + return IPC_RESULT_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Manage.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Manage.c new file mode 100644 index 0000000000..b9e65ea80c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Manage.c @@ -0,0 +1,240 @@ +#include + +#include +#include + +#define MANAGE_ERROR_CODE_BASE 109000 + +typedef enum { + NWC24_LIB_CLOSED, + NWC24_LIB_OPENED, + NWC24_LIB_OPENED_BY_TOOL, + NWC24_LIB_BLOCKED +} NWC24LibState; + +typedef enum { + NWC24_FAIL_SFL = (1 << 0), + NWC24_FAIL_DL_TASK = (1 << 1), + NWC24_FAIL_FATAL = (1 << 2) +} NWC24FailFlag; + +const char* __NWC24Version = "<< RVL_SDK - NWC24 \trelease build: May 10 2007 " + "17:58:59 (0x4199_60831) >>"; + +NWC24Work* NWC24WorkP = NULL; + +static NWC24LibState Opened = NWC24_LIB_CLOSED; +static u32 YouGotMail = 0; +static u32 GlobalErrorCode = 0; +static BOOL Registered = FALSE; + +static NWC24Err NWC24OpenLibInternal(NWC24Work* work, NWC24LibState state); + +void NWC24iRegister(void) { + if (Registered) { + return; + } + + OSRegisterVersion(__NWC24Version); + Registered = TRUE; +} + +NWC24Err NWC24OpenLib(NWC24Work* work) { + if (Opened == NWC24_LIB_OPENED_BY_TOOL) { + return NWC24_ERR_BUSY; + } + + return NWC24OpenLibInternal(work, NWC24_LIB_OPENED); +} + +static NWC24Err NWC24OpenLibInternal(NWC24Work* work, NWC24LibState state) { + NWC24Err result; + NWC24Err failErr; + u32 failFlag; + + NWC24iSetErrorCode(NWC24_OK); + + if (!VFIsAvailable()) { + return NWC24_ERR_FATAL; + } + + if (NWC24IsMsgLibOpened()) { + return NWC24_ERR_LIB_OPENED; + } + + if (NWC24IsMsgLibOpenBlocking()) { + return NWC24_ERR_BUSY; + } + + if (work == NULL) { + return NWC24_ERR_NULL; + } + + if ((uintptr_t)work % 32 != 0) { + return NWC24_ERR_ALIGNMENT; + } + + result = NWC24iTrySuspendForOpenLib(); + if (result == NWC24_OK) { + NWC24iRegister(); + + YouGotMail &= ~(1 << NWC24_MSGTYPE_RVL_MENU_SHARED); + NWC24WorkP = work; + + NWC24InitBase64Table(NWC24WorkP->base64Work); + + failFlag = 0; + failErr = NWC24_OK; + + result = NWC24iConfigOpen(); + if (result != NWC24_OK) { + failErr = result; + failFlag |= NWC24_FAIL_FATAL; + } + + result = NWC24iOpenMBox(); + if (result != NWC24_OK) { + failErr = result; + failFlag |= NWC24_FAIL_FATAL; + } + + result = NWC24iOpenFriendList(); + if (result != NWC24_OK) { + failErr = result; + failFlag |= NWC24_FAIL_FATAL; + } + + result = NWC24iOpenSecretFriendList(); + if (result != NWC24_OK) { + failErr = result; + + if (result == NWC24_ERR_FILE_NOEXISTS) { + failFlag |= NWC24_FAIL_FATAL; + } else { + failFlag |= NWC24_FAIL_SFL; + } + } + + result = NWC24iOpenDlTaskList(); + if (result < 0) { + failErr = result; + + if (result == NWC24_ERR_FILE_NOEXISTS) { + failFlag |= NWC24_FAIL_FATAL; + } else { + failFlag |= NWC24_FAIL_DL_TASK; + } + } + + if (failFlag == (NWC24_FAIL_SFL | NWC24_FAIL_DL_TASK)) { + failErr = NWC24_ERR_OLD_SYSTEM; + } + + if (failFlag != 0) { + NWC24WorkP = NULL; + NWC24iResumeForCloseLib(); + result = failErr; + } else { + Opened = state; + return NWC24_OK; + } + } + + switch (result) { + case NWC24_ERR_OLD_SYSTEM: + case NWC24_ERR_FILE_BROKEN: + case NWC24_ERR_INTERNAL_VF: + case NWC24_ERR_INTERNAL_IPC: + case NWC24_ERR_NAND_CORRUPT: + case NWC24_ERR_INPROGRESS: + case NWC24_ERR_BUSY: + case NWC24_ERR_MUTEX: + case NWC24_ERR_FILE_OTHER: + case NWC24_ERR_FILE_NOEXISTS: + case NWC24_ERR_FILE_WRITE: + case NWC24_ERR_FILE_READ: + case NWC24_ERR_FILE_CLOSE: + case NWC24_ERR_FILE_OPEN: + case NWC24_ERR_BROKEN: + case NWC24_ERR_FATAL: + NWC24iSetErrorCode(result - MANAGE_ERROR_CODE_BASE); + break; + } + + return result; +} + +NWC24Err NWC24CloseLib(void) { + s32 result; + + if (Opened != NWC24_LIB_OPENED) { + return NWC24_ERR_LIB_NOT_OPENED; + } + + result = NWC24iConfigFlush(); + if (result != NWC24_OK) { + return result; + } + + result = NWC24iCloseDlTaskList(); + if (result < 0) { + return result; + } + + result = NWC24iResumeForCloseLib(); + if (result != NWC24_OK) { + return result; + } + + NWC24WorkP = NULL; + Opened = NWC24_LIB_CLOSED; + return result; +} + +BOOL NWC24IsMsgLibOpened(void) { + return Opened == NWC24_LIB_OPENED; +} + +BOOL NWC24IsMsgLibOpenedByTool(void) { + return Opened == NWC24_LIB_OPENED_BY_TOOL; +} + +BOOL NWC24IsMsgLibOpenBlocking(void) { + return Opened == NWC24_LIB_BLOCKED; +} + +NWC24Err NWC24BlockOpenMsgLib(BOOL block) { + s32 result; + BOOL enabled; + + result = NWC24_OK; + enabled = OSDisableInterrupts(); + + if (block) { + if (Opened == NWC24_LIB_CLOSED) { + Opened = NWC24_LIB_BLOCKED; + } else if (Opened == NWC24_LIB_OPENED) { + result = NWC24_ERR_LIB_OPENED; + } else { + result = NWC24_ERR_BUSY; + } + } else { + if (Opened == NWC24_LIB_BLOCKED) { + Opened = NWC24_LIB_CLOSED; + } else { + result = NWC24_ERR_LIB_NOT_OPENED; + } + } + + OSRestoreInterrupts(enabled); + return result; +} + +NWC24Err NWC24iSetNewMsgArrived(u32 flags) { + YouGotMail |= flags; + return NWC24_OK; +} + +void NWC24iSetErrorCode(u32 code) { + GlobalErrorCode = code; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24MsgObj.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24MsgObj.c new file mode 100644 index 0000000000..b447dbb180 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24MsgObj.c @@ -0,0 +1,241 @@ +#include +#include + +#define YEAR_MIN 2000 +#define YEAR_MAX 2035 // !!! + +#define ALT_NAME_MAX 35 +#define SMTP_LINE_MAX 1000 + +typedef enum { + MSG_OBJ_FOR_RECIPIENT = (1 << 0), + MSG_OBJ_FOR_PUBLIC = (1 << 1), + MSG_OBJ_FOR_APP = (1 << 2), + MSG_OBJ_FOR_MENU = (1 << 3), + MSG_OBJ_INITIALIZED = (1 << 8), + MSG_OBJ_DELIVERING = (1 << 9) +} NWC24MsgObjFlags; + +NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) { + u32 i; + // TODO: Is there an internal structure? + NWC24MsgObj* _msg = (NWC24MsgObj*)msg; + + Mail_memset(_msg, 0, sizeof(NWC24MsgObj)); + + _msg->id = 0; + _msg->flags = MSG_OBJ_INITIALIZED; + _msg->appId = NWC24GetAppId(); + _msg->ledPattern = 0; + _msg->tag = 0; + _msg->groupId = NWC24GetGroupId(); + + switch (type) { + case NWC24_MSGTYPE_RVL_MENU_SHARED: + _msg->flags |= + MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_APP | MSG_OBJ_FOR_MENU; + break; + case NWC24_MSGTYPE_RVL: + _msg->flags |= MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_APP; + break; + case NWC24_MSGTYPE_RVL_MENU: + _msg->flags |= MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_MENU; + break; + case NWC24_MSGTYPE_RVL_HIDDEN: + _msg->flags |= MSG_OBJ_FOR_RECIPIENT; + break; + case NWC24_MSGTYPE_PUBLIC: + _msg->flags |= MSG_OBJ_FOR_PUBLIC; + break; + default: + return NWC24_ERR_INVALID_VALUE; + } + + _msg->WORD_0x28 = 0; + _msg->WORD_0x2C = 0; + NWC24GetMyUserId(&_msg->fromId); + _msg->numTo = 0; + + for (i = 0; i < NWC24_MSG_RECIPIENT_MAX; i++) { + if (type == NWC24_MSGTYPE_PUBLIC) { + NWC24Data_Init(&_msg->toAddrs[i]); + } else { + _msg->toIds[i] = 0; + } + } + + NWC24Data_Init(&_msg->subject); + NWC24Data_Init(&_msg->text); + _msg->charset = NWC24_US_ASCII; + _msg->encoding = NWC24_ENC_7BIT; + _msg->numAttached = 0; + + for (i = 0; i < NWC24_MSG_ATTACHMENT_MAX; i++) { + NWC24Data_Init(&_msg->attached[i]); + _msg->attachedSize[i] = 0; + _msg->attachedType[i] = NWC24_TEXT_PLAIN; + } + + NWC24Data_Init(&_msg->DATA_0x30); + NWC24Data_Init(&_msg->DATA_0x38); + NWC24Data_Init(&_msg->DATA_0x50); + NWC24Data_Init(&_msg->DATA_0x58); + NWC24Data_Init(&_msg->DATA_0xD0); + NWC24Data_Init(&_msg->face); + NWC24Data_Init(&_msg->alt); + _msg->mb.raw = 0; + + return NWC24_OK; +} + +NWC24Err NWC24SetMsgToId(NWC24MsgObj* msg, u64 id) { + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (!(msg->flags & MSG_OBJ_FOR_RECIPIENT)) { + return NWC24_ERR_NOT_SUPPORTED; + } + + if (msg->numTo >= NWC24_MSG_RECIPIENT_MAX) { + return NWC24_ERR_FULL; + } + + msg->toIds[msg->numTo] = id; + msg->numTo++; + + return NWC24_OK; +} + +NWC24Err NWC24SetMsgText(NWC24MsgObj* msg, const char* text, u32 len, + NWC24Charset charset, NWC24Encoding encoding) { + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (NWC24GetCharsetStr(charset) == NULL) { + return NWC24_ERR_INVALID_VALUE; + } + + if (NWC24GetEncodingStr(encoding) == NULL) { + return NWC24_ERR_INVALID_VALUE; + } + + if (text == NULL) { + NWC24Data_Init(&msg->text); + return NWC24_OK; + } + + if (text[len] != '\0') { + return NWC24_ERR_STRING_END; + } + + // Lines are limited to at most 1000 characters + if (encoding == NWC24_ENC_7BIT || encoding == NWC24_ENC_8BIT) { + u32 lineLength; + const char* it; + + lineLength = 0; + + for (it = text; it < text + len; it++) { + if (it[0] == '\r' && it[1] == '\n') { + lineLength = 0; + it++; + } + // Include "\r\n" in line length + else if (++lineLength > SMTP_LINE_MAX - 2) { + return NWC24_ERR_FORMAT; + } + } + } + + NWC24Data_SetDataP(&msg->text, text, len); + msg->charset = charset; + msg->encoding = encoding; + return NWC24_OK; +} + +NWC24Err NWC24SetMsgFaceData(NWC24MsgObj* msg, const RFLCharData* data) { + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (msg->face.size > 0) { + return NWC24_ERR_FULL; + } + + NWC24Data_SetDataP(&msg->face, data, sizeof(RFLCharData)); + return NWC24_OK; +} + +NWC24Err NWC24SetMsgAltName(NWC24MsgObj* msg, const wchar_t* name, u32 len) { + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (msg->alt.size > 0) { + return NWC24_ERR_FULL; + } + + if (len > ALT_NAME_MAX) { + return NWC24_ERR_INVALID_VALUE; + } + + if (name == NULL || len == 0) { + return NWC24_ERR_NULL; + } + + NWC24Data_SetDataP(&msg->alt, name, len * sizeof(wchar_t)); + return NWC24_OK; +} + +NWC24Err NWC24SetMsgMBNoReply(NWC24MsgObj* msg, BOOL enable) { + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (!(msg->flags & MSG_OBJ_FOR_MENU)) { + return NWC24_ERR_NOT_SUPPORTED; + } + + if (enable) { + msg->mb.noreply = TRUE; + } else { + msg->mb.noreply = FALSE; + } + + return NWC24_OK; +} + +NWC24Err NWC24SetMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day) { + NWC24Err result; + u16 regdate; + + if (!(msg->flags & MSG_OBJ_INITIALIZED) || + (msg->flags & MSG_OBJ_DELIVERING)) { + return NWC24_ERR_PROTECTED; + } + + if (!(msg->flags & MSG_OBJ_FOR_MENU)) { + return NWC24_ERR_NOT_SUPPORTED; + } + + if (year < YEAR_MIN || year > YEAR_MAX) { + return NWC24_ERR_INVALID_VALUE; + } + + result = NWC24iIsValidDate(year, month, day); + if (result != NWC24_OK) { + return result; + } + + // Bitfield access won't match + regdate = (year - YEAR_MIN) << 9 | month << 5 | day; + msg->mb.raw = msg->mb.raw & 0xFFFF0000 | regdate; + return NWC24_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Parser.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Parser.c new file mode 100644 index 0000000000..f1aba998de --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Parser.c @@ -0,0 +1,92 @@ +#include + +const char* MIMETypeStr[] = {"application/octet-stream", + "application/x-wii-minidata", + "application/x-wii-msgboard", + "image/jpeg", + "image/x-wii-picture", + "multipart/alternative", + "multipart/mixed", + "multipart/related", + "text/html", + "text/plain"}; +NWC24MIMEType MIMETypeConv[] = {NWC24_APPLICATION_OCTET_STREAM, + NWC24_X_WII_MINIDATA, + NWC24_X_WII_MSGBOARD, + NWC24_IMAGE_JPEG, + NWC24_X_WII_PICTURE, + NWC24_MULTIPART_ALTERNATIVE, + NWC24_MULTIPART_MIXED, + NWC24_MULTIPART_RELATED, + NWC24_TEXT_HTML, + NWC24_TEXT_PLAIN}; +const char* MIMETypeSuffix[] = {"dat", "wii", "wii", "jpg", "wii", + "???", "???", "???", "htm", "txt"}; + +const char* CharsetStr[] = { + "euc-jp", "iso-2022-jp", "iso-8859-1", "iso-8859-10", + "iso-8859-15", "iso-8859-2", "iso-8859-3", "iso-8859-5", + "iso-8859-7", "iso-8859-9", "shift_jis", "us-ascii", + "utf-16be", "utf-32be", "utf-8", "windows-1252"}; +NWC24Charset CharsetConv[] = { + NWC24_EUC_JP, NWC24_ISO_2022_JP, NWC24_ISO_8859_1, NWC24_ISO_8859_10, + NWC24_ISO_8859_15, NWC24_ISO_8859_2, NWC24_ISO_8859_3, NWC24_ISO_8859_5, + NWC24_ISO_8859_7, NWC24_ISO_8859_9, NWC24_SHIFT_JIS, NWC24_US_ASCII, + NWC24_UTF_16BE, NWC24_UTF_32BE, NWC24_UTF_8, NWC24_WINDOWS_1252}; + +const char* EncodingStr[] = {"7bit", "8bit", "base64", "quoted-printable"}; +NWC24Encoding EncodingConv[] = {NWC24_ENC_7BIT, NWC24_ENC_8BIT, + NWC24_ENC_BASE64, NWC24_ENC_QUOTED_PRINTABLE}; + +const char* NWC24GetMIMETypeStr(NWC24MIMEType type) { + NWC24MIMEType* conv; + int i; + + for (i = 0; i < LENGTHOF(MIMETypeConv); i++) { + // TODO: Fakematch + conv = MIMETypeConv; + conv && !conv; + + if (type == conv[i]) { + return MIMETypeStr[i]; + } + } + + return NULL; +} + +const char* NWC24iGetMIMETypeSuffix(NWC24MIMEType type) { + int i; + + for (i = 0; i < LENGTHOF(MIMETypeConv); i++) { + if (type == MIMETypeConv[i]) { + return MIMETypeSuffix[i]; + } + } + + return NULL; +} + +const char* NWC24GetCharsetStr(NWC24Charset set) { + int i; + + for (i = 0; i < LENGTHOF(CharsetConv); i++) { + if (set == CharsetConv[i]) { + return CharsetStr[i]; + } + } + + return NULL; +} + +const char* NWC24GetEncodingStr(NWC24Encoding enc) { + int i; + + for (i = 0; i < LENGTHOF(EncodingConv); i++) { + if (enc == EncodingConv[i]) { + return EncodingStr[i]; + } + } + + return NULL; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Schedule.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Schedule.c new file mode 100644 index 0000000000..fc4755d670 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Schedule.c @@ -0,0 +1,349 @@ +#include +#include +#include + +#define CHECK_CALLING_STATUS(block) CheckCallingStatus(__FUNCTION__, block) + +#define IOCTL_IN ((CommonBuffer*)nwc24ScdCommonBuffer) +#define IOCTL_OUT ((CommonResult*)nwc24ScdCommonResult) + +typedef enum { + NWC24_IOCTL_SUSPEND_SCHEDULER = 1, + NWC24_IOCTL_TRY_SUSPEND_SCHEDULER = 2, + NWC24_IOCTL_RESUME_SCHEDULER = 3, + NWC24_IOCTL_GENERATE_USER_ID = 15, +} NWC24Ioctl; + +typedef struct CommonBuffer { + u32 WORD_0x0; +} CommonBuffer; + +#pragma pack(push, 1) +typedef struct CommonResult { + s32 result; // at 0x0 + union { + u64 userid; + s32 exResult; + }; // at 0x4 + u32 WORD_0x8; +} CommonResult; +#pragma pack(pop) + +static u32 nwc24ScdInitialized = 0; +static s32 nwc24ScdSuspendCnt = 0; +static s32 nwc24ScdOpenCnt = 0; + +static OSMutex nwc24ScdCommandMutex; +static OSMutex nwc24ScdCounterMutex; + +static u8 nwc24ScdCommonBuffer[32] ALIGN(32); +static u8 nwc24ScdCommonResult[32] ALIGN(32); + +static u8 nwc24ScdStatBuf[256] ALIGN(32); + +// clang-format off +// nwc24ScdStatBuf unused +DECOMP_FORCEACTIVE(NWC24Schedule_c, + nwc24ScdCounterMutex, + nwc24ScdCommandMutex, + nwc24ScdCommonBuffer, + nwc24ScdCommonResult, + nwc24ScdStatBuf); +// clang-format on + +// Pool order +DECOMP_FORCEACTIVE(NWC24Schedule_c, "/dev/net/kd/request"); + +static NWC24Err ExecSuspendScheduler(void) DECOMP_DONT_INLINE; +static NWC24Err ExecTrySuspendScheduler(u32 arg0); +static NWC24Err ExecResumeScheduler(void) DECOMP_DONT_INLINE; +static NWC24Err ExecNoParamCommand(const char* user, s32 type, + NWC24Err* exResultOut); + +static void InitScdMutex(void); + +static void LockRight(void); +static BOOL TryLockRight(void); +static void UnlockRight(void); + +static void LockCounters(void); +static BOOL TryLockCounters(void); +static void UnlockCounters(void); + +static NWC24Err CheckCallingStatus(const char* user, BOOL block); + +s32 NWC24SuspendScheduler(void) { + s32 count; + + LockCounters(); + { + count = ExecSuspendScheduler(); + if (count >= 0) { + nwc24ScdSuspendCnt++; + count -= nwc24ScdOpenCnt; + } + } + UnlockCounters(); + + return count; +} + +s32 NWC24ResumeScheduler(void) { + s32 count; + + LockCounters(); + { + if (nwc24ScdOpenCnt > 0 && nwc24ScdSuspendCnt == 0) { + count = 0; + } else { + count = ExecResumeScheduler(); + + if (nwc24ScdSuspendCnt > 0) { + nwc24ScdSuspendCnt--; + count -= nwc24ScdOpenCnt; + } + } + } + UnlockCounters(); + + return count; +} + +NWC24Err NWC24iRequestGenerateUserId(u64* idOut, u32* arg1) { + s32 fd; + NWC24Err result; + NWC24Err close; + + result = CHECK_CALLING_STATUS(TRUE); + if (result < 0) { + return result; + } + + LockRight(); + { + result = NWC24_OPEN_DEVICE("/dev/net/kd/request", &fd, IPC_OPEN_NONE); + + if (result >= 0) { + result = NWC24_IOCTL_DEVICE(fd, NWC24_IOCTL_GENERATE_USER_ID, NULL, + 0, nwc24ScdCommonResult, + sizeof(nwc24ScdCommonResult)); + + if (result >= 0) { + result = IOCTL_OUT->result; + + if (result == NWC24_OK || result == NWC24_ERR_ID_GENERATED || + result == NWC24_ERR_ID_REGISTERED) { + + if (idOut != (void*)NULL) { + *idOut = IOCTL_OUT->userid; + } + + if (arg1 != (void*)NULL) { + *arg1 = IOCTL_OUT->WORD_0x8; + } + } + } + + close = NWC24_CLOSE_DEVICE(fd); + if (result >= 0) { + result = close; + } + } + } + UnlockRight(); + + return result; +} + +NWC24Err NWC24iTrySuspendForOpenLib(void) { + NWC24Err result; + + if (!TryLockCounters()) { + return NWC24_ERR_MUTEX; + } + + result = ExecTrySuspendScheduler(0); + if (result >= 0) { + nwc24ScdOpenCnt++; + result = NWC24_OK; + } + + UnlockCounters(); + return result; +} + +NWC24Err NWC24iResumeForCloseLib(void) { + NWC24Err result; + + LockCounters(); + { + result = ExecResumeScheduler(); + if (result >= 0) { + nwc24ScdOpenCnt--; + result = NWC24_OK; + } + } + UnlockCounters(); + + return result; +} + +static NWC24Err ExecSuspendScheduler(void) { + return ExecNoParamCommand(NULL, NWC24_IOCTL_SUSPEND_SCHEDULER, NULL); +} + +static NWC24Err ExecTrySuspendScheduler(u32 arg0) { + s32 fd; + NWC24Err result; + NWC24Err close; + + result = CHECK_CALLING_STATUS(TRUE); + if (result < 0) { + return result; + } + + if (!TryLockRight()) { + return NWC24_ERR_MUTEX; + } + + result = NWC24_OPEN_DEVICE("/dev/net/kd/request", &fd, IPC_OPEN_NONE); + + if (result >= 0) { + IOCTL_IN->WORD_0x0 = arg0; + + result = NWC24_IOCTL_DEVICE( + fd, NWC24_IOCTL_TRY_SUSPEND_SCHEDULER, nwc24ScdCommonBuffer, + sizeof(nwc24ScdCommonBuffer), nwc24ScdCommonResult, + sizeof(nwc24ScdCommonResult)); + + if (result >= 0) { + result = IOCTL_OUT->result; + } + + close = NWC24_CLOSE_DEVICE(fd); + if (close < 0) { + result = close; + } + } + + UnlockRight(); + return result; +} + +static NWC24Err ExecResumeScheduler(void) { + return ExecNoParamCommand(NULL, NWC24_IOCTL_RESUME_SCHEDULER, NULL); +} + +static NWC24Err ExecNoParamCommand(const char* user, s32 type, + NWC24Err* exResultOut) { + s32 fd; + NWC24Err result; + NWC24Err close; + + if (OSGetCurrentThread() == NULL) { + return NWC24_ERR_FATAL; + } + + LockRight(); + { + result = NWC24iOpenResourceManager(user, "/dev/net/kd/request", &fd, + IPC_OPEN_NONE); + + if (result >= 0) { + result = NWC24iIoctlResourceManager(user, fd, type, NULL, 0, + nwc24ScdCommonResult, + sizeof(nwc24ScdCommonResult)); + + if (result >= 0) { + result = IOCTL_OUT->result; + + if (result == NWC24_ERR_FAILED || + result == NWC24_ERR_CONFIG_NETWORK) { + + if (exResultOut != (void*)NULL) { + *exResultOut = IOCTL_OUT->exResult; + } + } + } + + close = NWC24iCloseResourceManager(user, fd); + if (close < 0) { + result = close; + } + } + } + UnlockRight(); + + return result; +} + +static void InitScdMutex(void) { + BOOL enabled = OSDisableInterrupts(); + + if (!(nwc24ScdInitialized & 1)) { + OSInitMutex(&nwc24ScdCommandMutex); + OSInitMutex(&nwc24ScdCounterMutex); + + memset(nwc24ScdCommonBuffer, 0, sizeof(nwc24ScdCommonBuffer)); + memset(nwc24ScdCommonResult, 0, sizeof(nwc24ScdCommonResult)); + + nwc24ScdInitialized |= 1; + } + + OSRestoreInterrupts(enabled); +} + +static void LockRight(void) { + if (!(nwc24ScdInitialized & 1)) { + InitScdMutex(); + } + + OSLockMutex(&nwc24ScdCommandMutex); +} + +static BOOL TryLockRight(void) { + if (!(nwc24ScdInitialized & 1)) { + InitScdMutex(); + } + + return OSTryLockMutex(&nwc24ScdCommandMutex); +} + +static void UnlockRight(void) { + OSUnlockMutex(&nwc24ScdCommandMutex); +} + +static void LockCounters(void) { + if (!(nwc24ScdInitialized & 1)) { + InitScdMutex(); + } + + OSLockMutex(&nwc24ScdCounterMutex); +} + +static BOOL TryLockCounters(void) { + if (!(nwc24ScdInitialized & 1)) { + InitScdMutex(); + } + + return OSTryLockMutex(&nwc24ScdCounterMutex); +} + +static void UnlockCounters(void) { + OSUnlockMutex(&nwc24ScdCounterMutex); +} + +static NWC24Err CheckCallingStatus(const char* user, BOOL block) { +#pragma unused(user) +#pragma unused(block) + + if (OSGetCurrentThread() == NULL) { + return NWC24_ERR_FATAL; + } + + if (NWC24IsMsgLibOpened() || NWC24IsMsgLibOpenedByTool()) { + return NWC24_ERR_LIB_OPENED; + } + + return NWC24_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24SecretFList.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24SecretFList.c new file mode 100644 index 0000000000..ff00a395b4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24SecretFList.c @@ -0,0 +1,55 @@ +#include + +#define SECRET_FRIEND_LIST_MAGIC 'WcFs' +#define SECRET_FRIEND_LIST_VERSION 2 + +static const char* FLFilePath = "/shared2/wc24/nwc24fls.bin"; + +static NWC24Err GetCachedSecretFLHeader(NWC24SecretFLHeader** header); + +NWC24Err NWC24iOpenSecretFriendList(void) { + NWC24SecretFLHeader* header = + (NWC24SecretFLHeader*)NWC24WorkP->secretFlHeader; + Mail_memset(header, 0, sizeof(NWC24SecretFLHeader)); + return GetCachedSecretFLHeader(&header); +} + +static NWC24Err GetCachedSecretFLHeader(NWC24SecretFLHeader** header) { + NWC24File file; + NWC24Err result; + NWC24Err read; + NWC24Err close; + + *header = (NWC24SecretFLHeader*)NWC24WorkP->secretFlHeader; + + if ((*header)->magic != SECRET_FRIEND_LIST_MAGIC) { + result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_NAND_R); + if (result != NWC24_OK) { + return result; + } + + NWC24FSeek(&file, 0, NWC24_SEEK_BEG); + read = NWC24FRead(*header, sizeof(NWC24SecretFLHeader), &file); + close = NWC24FClose(&file); + + if (read != NWC24_OK) { + result = read; + } else { + result = close; + } + + if (result != NWC24_OK) { + return result; + } + + if ((*header)->magic != SECRET_FRIEND_LIST_MAGIC) { + return NWC24_ERR_BROKEN; + } + + if ((*header)->version != SECRET_FRIEND_LIST_VERSION) { + return NWC24_ERR_VER_MISMATCH; + } + } + + return NWC24_OK; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24System.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24System.c new file mode 100644 index 0000000000..4c5a30bfb9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24System.c @@ -0,0 +1,96 @@ +#include +#include +#include + +#define SHUTDOWN_RETRY_MAX 5 + +typedef enum { + NWC24_IOCTL_SHUTDOWN = 40, +} NWC24Ioctl; + +static s32 nwc24ShtFd = -1; +static s32 nwc24ShtRetryRest = 0; + +static OSShutdownFunctionInfo ShutdownFuncInfo; + +NWC24Err NWC24EnableLedNotification(BOOL enable) { + SCIdleModeInfo idleMode; + u32 status; + u32 led = 0; + + if (enable) { + do { + status = SCCheckStatus(); + + if (status == SC_STATUS_FATAL) { + return NWC24_ERR_FATAL; + } + } while (status == SC_STATUS_BUSY); + + SCGetIdleMode(&idleMode); + led = idleMode.slotLight; + } + + __OSSetIdleLEDMode(led); + return NWC24_OK; +} + +NWC24Err NWC24iPrepareShutdown(void) { + NWC24Err result = NWC24_OK; + + NWC24iRegister(); + + ShutdownFuncInfo.func = NWC24Shutdown; + ShutdownFuncInfo.prio = 110; + OSRegisterShutdownFunction(&ShutdownFuncInfo); + + if (nwc24ShtFd < 0) { + result = NWC24_OPEN_DEVICE("/dev/net/kd/request", &nwc24ShtFd, + IPC_OPEN_READ); + } + + nwc24ShtRetryRest = SHUTDOWN_RETRY_MAX; + NWC24EnableLedNotification(TRUE); + + return result; +} + +NWC24Err NWC24iRequestShutdown(u32 event, NWC24Err* resultOut) { + static u8 shtBuffer[32] ALIGN(32); + static u8 shtResult[32] ALIGN(32); + + *(u32*)shtBuffer = event; + return NWC24_IOCTL_DEVICE_ASYNC(nwc24ShtFd, NWC24_IOCTL_SHUTDOWN, shtBuffer, + sizeof(shtBuffer), shtResult, + sizeof(shtResult), resultOut); +} + +BOOL NWC24Shutdown(BOOL final, u32 event) { + static BOOL shuttingdown = FALSE; + static NWC24Err result = NWC24_OK; + + if (final) { + return TRUE; + } + + if (shuttingdown) { + if (NWC24iIsAsyncRequestPending()) { + return FALSE; + } + + if (result >= 0) { + return TRUE; + } + + if (nwc24ShtRetryRest > 0) { + shuttingdown = FALSE; + nwc24ShtRetryRest--; + } else { + return TRUE; + } + } else if (NWC24iRequestShutdown(event, &result) >= 0) { + shuttingdown = TRUE; + } + + return FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Time.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Time.c new file mode 100644 index 0000000000..4287b938db --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Time.c @@ -0,0 +1,217 @@ +#include + +#include + +#include + +#define CHECK_CALLING_STATUS() CheckCallingStatus(__FUNCTION__) + +#define IOCTL_IN ((CommonBuffer*)nwc24TimeCommonBuffer) +#define IOCTL_OUT ((CommonResult*)nwc24TimeCommonResult) + +typedef enum { + NWC24_IOCTL_SET_RTC_COUNTER = 23, + NWC24_IOCTL_GET_TIME_DIFFERENCE = 24, +} NWC24Ioctl; + +typedef struct CommonBuffer { + u32 rtc; // at 0x0 + u32 flags; // at 0x4 +} CommonBuffer; + +#pragma pack(push, 1) +typedef struct CommonResult { + s32 result; // at 0x0 + s64 diff; // at 0x4 +} CommonResult; +#pragma pack(pop) + +static BOOL nwc24TimeInitialized = FALSE; +static u32 nwc24TimeRtc = 0; +static s64 nwc24TimeDifference = 0; + +static u8 nwc24TimeCommonResult[32] ALIGN(32); +static u8 nwc24TimeCommonBuffer[32] ALIGN(32); +static OSMutex nwc24TimeCommandMutex ALIGN(32); + +static NWC24Err GetRTC(u32* rtc); +static NWC24Err CheckCallingStatus(const char* user); +static void InitMutex(void); +static void LockRight(void); +static void UnlockRight(void); + +// Unused from NWC24iStrTime, but pooled in +static u8 buf[128]; +DECOMP_FORCEACTIVE(NWC24Time_c, buf); + +NWC24Err NWC24iGetUniversalTime(s64* timeOut) { + static s64 whenCached = 0; + + NWC24Err result; + + if (timeOut == NULL) { + nwc24TimeDifference = 0; + return NWC24_ERR_INVALID_VALUE; + } + + if (whenCached == 0 || + whenCached + OS_SEC_TO_TICKS(1) <= __OSGetSystemTime() || + nwc24TimeRtc == 0) { + + result = NWC24iGetTimeDifference(&nwc24TimeDifference); + if (result < 0) { + return result; + } + + result = GetRTC(&nwc24TimeRtc); + if (result != NWC24_OK) { + return result; + } + + whenCached = __OSGetSystemTime(); + } + + *timeOut = nwc24TimeDifference + nwc24TimeRtc; + return NWC24_OK; +} + +NWC24Err NWC24iGetTimeDifference(s64* diffOut) { + s32 fd; + NWC24Err result; + NWC24Err close; + + result = CHECK_CALLING_STATUS(); + if (result < 0) { + return result; + } + + LockRight(); + { + result = NWC24_OPEN_DEVICE("/dev/net/kd/time", &fd, IPC_OPEN_NONE); + + if (result >= 0) { + result = NWC24_IOCTL_DEVICE(fd, NWC24_IOCTL_GET_TIME_DIFFERENCE, + NULL, 0, &nwc24TimeCommonResult, + sizeof(nwc24TimeCommonResult)); + + if (result >= 0) { + result = IOCTL_OUT->result; + + // Cast is necessary + if (result == 0 && diffOut != (void*)NULL) { + *diffOut = IOCTL_OUT->diff; + } + } + + close = NWC24_CLOSE_DEVICE(fd); + if (result >= 0) { + result = close; + } + } + } + UnlockRight(); + + return result; +} + +NWC24Err NWC24iSetRtcCounter(u32 rtc, u32 flags) { + s32 fd; + NWC24Err result; + NWC24Err close; + + result = CHECK_CALLING_STATUS(); + if (result < 0) { + return result; + } + + LockRight(); + { + result = NWC24_OPEN_DEVICE("/dev/net/kd/time", &fd, IPC_OPEN_NONE); + + if (result >= 0) { + IOCTL_IN->rtc = rtc; + IOCTL_IN->flags = flags; + + result = NWC24_IOCTL_DEVICE( + fd, NWC24_IOCTL_SET_RTC_COUNTER, &nwc24TimeCommonBuffer, + sizeof(nwc24TimeCommonBuffer), &nwc24TimeCommonResult, + sizeof(nwc24TimeCommonResult)); + + if (result >= 0) { + result = IOCTL_OUT->result; + } + + close = NWC24_CLOSE_DEVICE(fd); + if (result >= 0) { + result = close; + } + } + } + UnlockRight(); + + return result; +} + +NWC24Err NWC24iSynchronizeRtcCounter(BOOL forceSave) { + u32 rtc; + NWC24Err result; + + result = GetRTC(&rtc); + if (result != NWC24_OK) { + return result; + } + + return NWC24iSetRtcCounter(rtc, forceSave ? 1 : 0); +} + +static NWC24Err GetRTC(u32* rtc) { + u32 status; + + do { + status = SCCheckStatus(); + + if (status == SC_STATUS_FATAL) { + return NWC24_ERR_FATAL; + } + } while (status != SC_STATUS_OK); + + *rtc = OS_TICKS_TO_SEC(OSGetTime()) - SCGetCounterBias(); + return NWC24_OK; +} + +static NWC24Err CheckCallingStatus(const char* user) { +#pragma unused(user) + + if (OSGetCurrentThread() == NULL) { + return NWC24_ERR_FATAL; + } + + return NWC24_OK; +} + +static void InitMutex(void) { + BOOL enabled = OSDisableInterrupts(); + + if (!nwc24TimeInitialized) { + OSInitMutex(&nwc24TimeCommandMutex); + + memset(&nwc24TimeCommonBuffer, 0, sizeof(nwc24TimeCommonBuffer)); + memset(&nwc24TimeCommonResult, 0, sizeof(nwc24TimeCommonResult)); + + nwc24TimeInitialized = TRUE; + } + + OSRestoreInterrupts(enabled); +} + +static void LockRight(void) { + if (!nwc24TimeInitialized) { + InitMutex(); + } + + OSLockMutex(&nwc24TimeCommandMutex); +} + +static void UnlockRight(void) { + OSUnlockMutex(&nwc24TimeCommandMutex); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Utils.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Utils.c new file mode 100644 index 0000000000..7ab39ebded --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NWC24/NWC24Utils.c @@ -0,0 +1,36 @@ +#include + +void NWC24Data_Init(NWC24Data* data) { + data->ptr = NULL; + data->size = 0; +} + +void NWC24Data_SetDataP(NWC24Data* data, const void* ptr, u32 size) { + data->ptr = ptr; + data->size = size; +} + +void NWC24Date_Init(NWC24Date* date) { + date->year = 2000; + date->month = 1; + date->day = 1; + date->hour = 12; + date->min = 0; + date->sec = 0; + date->BYTE_0x7 = 0; +} + +void NWC24iConvIdToStr(u64 addr, char* out) { + u64 a = addr; + int i; + + // Count nibbles in u64 + const int n = sizeof(u64) * 2; + + for (i = n - 1; i >= 0; i--) { + out[i] = '0' + a % 10; + a /= 10; + } + + out[n] = '\0'; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/DebuggerDriver.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/DebuggerDriver.c new file mode 100644 index 0000000000..b1373b45c6 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/DebuggerDriver.c @@ -0,0 +1,129 @@ +#include +#include + +static u32 __DBRecvDataSize; +static u32 __DBRecvMail; +static u8 __DBEXIInputFlag; +static OSInterruptHandler __DBDbgCallback; +static OSInterruptHandler __DBMtrCallback; + +static u8 __DBReadUSB_CSR(void); +static void __DBWaitForSendMail(void); + +void __DBMtrHandler(s16 type, OSContext* ctx) { + __DBEXIInputFlag = TRUE; + + if (__DBMtrCallback != NULL) + __DBMtrCallback(0, ctx); +} + +void __DBIntrHandler(s16 type, OSContext* ctx) { + PI_HW_REGS[PI_INTSR] = PI_INTSR_DEBUG; + if (__DBDbgCallback != NULL) + __DBDbgCallback(type, ctx); +} + +static void __DBCheckMailBox(void) { + u8 csr = __DBReadUSB_CSR(); + if (!(csr & 0x8)) { + u32 mail; + __DBReadMailbox(&mail); + if (ODEMUIsValidMail(mail)) { + __DBRecvMail = mail; + __DBRecvDataSize = ODEMUGetSize(mail); + __DBEXIInputFlag = TRUE; + } + } +} + +static u8 __DBReadUSB_CSR(void) { + u8 val; + __DBEXIReadReg(0x34000000, &val, sizeof(val)); + return val; +} + +void DBInitComm(u8** flagOut, OSInterruptHandler handler) { + BOOL enabled = OSDisableInterrupts(); + + *flagOut = &__DBEXIInputFlag; + __DBMtrCallback = handler; + __DBEXIInit(); + + OSRestoreInterrupts(enabled); +} + +// Non-matching +void DBInitInterrupts(void) { + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_2_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_TC)); + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_PI_DEBUG)); + __DBDbgCallback = __DBMtrHandler; + __OSSetInterruptHandler(OS_INTR_PI_DEBUG, __DBIntrHandler); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_PI_DEBUG)); +} + +u32 DBQueryData(void) { + __DBEXIInputFlag = FALSE; + + if (__DBRecvDataSize == 0) { + BOOL enabled = OSDisableInterrupts(); + __DBCheckMailBox(); + OSRestoreInterrupts(enabled); + } + + return __DBRecvDataSize; +} + +BOOL DBRead(void* dst, u32 size) { + BOOL enabled = OSDisableInterrupts(); + + __DBRead(ODEMUGetPc2NngcOffset(__DBRecvMail) + 0x1000, dst, + ROUND_UP(size, 4)); + __DBRecvDataSize = 0; + __DBEXIInputFlag = FALSE; + + OSRestoreInterrupts(enabled); + + return FALSE; +} + +BOOL DBWrite(const void* src, u32 size) { + static u8 l_byOffsetCounter = 128; + + BOOL enabled = OSDisableInterrupts(); + + u32 ofs, mail; + + __DBWaitForSendMail(); + + ofs = 0; + if (!(++l_byOffsetCounter & 0x1)) { + ofs = 0; + } else { + ofs = 0x800; + } + + while (__DBWrite(ofs, src, ROUND_UP(size, 4)) == 0) { + } + + __DBWaitForSendMail(); + + mail = ODEMUGenMailData(l_byOffsetCounter, size); + while (__DBWriteMailbox(mail) == 0) { + } + + __DBWaitForSendMail(); + + OSRestoreInterrupts(enabled); + + return FALSE; +} + +static void __DBWaitForSendMail(void) { + while (__DBReadUSB_CSR() & 0x4) { + } +} + +void DBOpen(void) {} + +void DBClose(void) {} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/exi2.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/exi2.c new file mode 100644 index 0000000000..41ccb549de --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/NdevExi2AD/exi2.c @@ -0,0 +1,174 @@ +#include +#include +#include + +static BOOL __EXI2Select(void) { + u32 cpr = EXI_CHAN_PARAMS[EXI_CHAN_2].cpr; + + // @bug Maybe bug? 0x40 is LSB bit of CLK. Surely meant to be CS1B + EXI_CHAN_PARAMS[EXI_CHAN_2].cpr = + ((cpr & (EXI_CPR_EXIINTMASK | EXI_CPR_TCINTMASK | EXI_CPR_EXTINTMASK)) | + 0x40 | EXI_CPR_CS0B); + + return TRUE; +} + +static BOOL __EXI2Deselect(void) { + u32 cpr = EXI_CHAN_PARAMS[EXI_CHAN_2].cpr; + + EXI_CHAN_PARAMS[EXI_CHAN_2].cpr = + cpr & (EXI_CPR_EXIINTMASK | EXI_CPR_TCINTMASK | EXI_CPR_EXTINTMASK); + + return TRUE; +} + +static BOOL __EXI2Sync(void) { + while (EXI_CHAN_PARAMS[EXI_CHAN_2].cr & EXI_CR_TSTART) { + ; + } + + return TRUE; +} + +BOOL __EXI2Imm(void* mem, s32 size, u32 type) { + int i; + + if (type != EXI_READ) { + u32 imm = 0; + + for (i = 0; i < size; i++) { + const u8* bmem = (const u8*)mem; + imm |= bmem[i] << (3 - i) * 8; + } + + EXI_CHAN_PARAMS[EXI_CHAN_2].data = imm; + } + + EXI_CHAN_PARAMS[EXI_CHAN_2].cr = + type << 2 | EXI_CR_TSTART | (size - 1) * 16; + + __EXI2Sync(); + + if (type == EXI_READ) { + u32 imm = EXI_CHAN_PARAMS[EXI_CHAN_2].data; + + u8* bmem = (u8*)mem; + for (i = 0; i < size; i++, bmem++) { + *bmem = imm >> (3 - i) * 8; + } + } + + return TRUE; +} + +void __DBEXIInit(void) { + u32 val0, val1; + + __OSMaskInterrupts(OS_INTR_MASK(OS_INTR_EXI_2_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_TC)); + while ((EXI_CHAN_PARAMS[EXI_CHAN_2].cr & EXI_CR_TSTART) == 1) { + } + EXI_CHAN_PARAMS[EXI_CHAN_2].cpr = 0; + + val0 = 0xB4000000; + val1 = 0xD4000000; + + __EXI2Select(); + __EXI2Imm(&val0, 4, EXI_WRITE); + __EXI2Sync(); + + __EXI2Imm(&val1, 4, EXI_WRITE); + __EXI2Sync(); + __EXI2Deselect(); +} + +BOOL __DBEXIReadReg(u32 cmd, void* mem, s32 size) { + BOOL error = FALSE; + u32 read_val = 0; + + error = error | !__EXI2Select(); + error = error | !__EXI2Imm(&cmd, sizeof(cmd), EXI_WRITE); + error = error | !__EXI2Sync(); + error = error | !__EXI2Imm(&read_val, sizeof(read_val), EXI_READ); + error = error | !__EXI2Sync(); + error = error | !__EXI2Deselect(); + + switch (size) { + case 1: + *(u8*)mem = read_val >> 24; + break; + case 2: + *(u16*)mem = read_val >> 24 | read_val >> 8 & 0xFF00; + break; + default: + *(u32*)mem = __EXISwap32(read_val); + break; + } + + return error == FALSE; +} + +BOOL __DBEXIWriteReg(u32 cmd, const void* mem, s32 size) { + BOOL error = FALSE; + u32 write_val = 0; + + switch (size) { + case 1: + write_val = *(u8*)mem << 24; + break; + case 2: + write_val = *(u16*)mem << 24 | (*(u16*)mem & 0xFF00) << 8; + break; + default: + write_val = __EXISwap32(*(u32*)mem); + break; + } + + error = error | !__EXI2Select(); + error = error | !__EXI2Imm(&cmd, sizeof(cmd), EXI_WRITE); + error = error | !__EXI2Sync(); + error = error | !__EXI2Imm(&write_val, sizeof(write_val), EXI_WRITE); + error = error | !__EXI2Sync(); + error = error | !__EXI2Deselect(); + + return error == FALSE; +} + +BOOL __DBEXIReadRam(u32 cmd, void* mem, s32 size) { + BOOL error = FALSE; + u32 read_val; + u32* lmem = (u32*)mem; + + error = error | !__EXI2Select(); + error = error | !__EXI2Imm(&cmd, sizeof(cmd), EXI_WRITE); + error = error | !__EXI2Sync(); + + for (; size > 0; size -= 4) { + error = error | !__EXI2Imm(&read_val, sizeof(read_val), EXI_READ); + error = error | !__EXI2Sync(); + *lmem++ = read_val; + } + + error = error | !__EXI2Deselect(); + + return error == FALSE; +} + +BOOL __DBEXIWriteRam(u32 cmd, const void* mem, s32 size) { + BOOL error = FALSE; + u32* lmem = (u32*)mem; + + error = error | !__EXI2Select(); + error = error | !__EXI2Imm(&cmd, sizeof(cmd), EXI_WRITE); + error = error | !__EXI2Sync(); + + for (; size > 0; size -= 4) { + u32 write_val = *lmem++; + error = error | !__EXI2Imm(&write_val, sizeof(write_val), EXI_WRITE); + error = error | !__EXI2Sync(); + } + + error = error | !__EXI2Deselect(); + + return error == FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OS.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OS.c new file mode 100644 index 0000000000..f0b00d1675 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OS.c @@ -0,0 +1,902 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +OSExecParams __OSRebootParams; +static DVDDriveInfo DriveInfo ALIGN(32); +static DVDCommandBlock DriveBlock; + +s64 __OSStartTime; +static OSBootInfo* BootInfo; +static u32* BI2DebugFlag; +static u32 BI2DebugFlagHolder; + +static char GameNameBuffer[sizeof('ABCD') + 1]; + +static f64 ZeroF; // for lfd +static f32 ZeroPS[2]; // for psl_l + +static OSExceptionHandler* OSExceptionTable; + +static BOOL AreWeInitialized; +DECL_WEAK BOOL __OSIsGcam; +BOOL __OSInNandBoot; +BOOL __OSInIPL; + +const char* __OSVersion = + "<< RVL_SDK - OS \trelease build: Apr 24 2007 11:50:47 (0x4199_60831) >>"; + +static void OSExceptionInit(void); + +void __OSDBINTSTART(void); +void __OSDBINTEND(void); +void __OSDBJUMPSTART(void); +void __OSDBJUMPDEST(void); +void __OSDBJUMPEND(void); +void __OSEVStart(void); +void __DBVECTOR(void); +void __OSEVSetNumber(void); +void __OSEVEnd(void); + +DECOMP_FORCEACTIVE(OS_c, __OSRebootParams); + +asm void __OSFPRInit(void) { + // clang-format off + nofralloc + + // Set FP available bit + mfmsr r3 + ori r3, r3, MSR_FP + mtmsr r3 + + // Check if paired-singles are enabled in HID2 + mfspr r3, 0x398 + rlwinm. r3, r3, 3, 31, 31 + beq paired_singles_disabled + + lis r3, ZeroPS@ha + addi r3, r3, ZeroPS@l + psq_l f0, 0(r3), 0, 0 + ps_mr f1, f0 + ps_mr f2, f0 + ps_mr f3, f0 + ps_mr f4, f0 + ps_mr f5, f0 + ps_mr f6, f0 + ps_mr f7, f0 + ps_mr f8, f0 + ps_mr f9, f0 + ps_mr f10, f0 + ps_mr f11, f0 + ps_mr f12, f0 + ps_mr f13, f0 + ps_mr f14, f0 + ps_mr f15, f0 + ps_mr f16, f0 + ps_mr f17, f0 + ps_mr f18, f0 + ps_mr f19, f0 + ps_mr f20, f0 + ps_mr f21, f0 + ps_mr f22, f0 + ps_mr f23, f0 + ps_mr f24, f0 + ps_mr f25, f0 + ps_mr f26, f0 + ps_mr f27, f0 + ps_mr f28, f0 + ps_mr f29, f0 + ps_mr f30, f0 + ps_mr f31, f0 + +paired_singles_disabled: + lfd f0, ZeroF + fmr f1, f0 + fmr f2, f0 + fmr f3, f0 + fmr f4, f0 + fmr f5, f0 + fmr f6, f0 + fmr f7, f0 + fmr f8, f0 + fmr f9, f0 + fmr f10, f0 + fmr f11, f0 + fmr f12, f0 + fmr f13, f0 + fmr f14, f0 + fmr f15, f0 + fmr f16, f0 + fmr f17, f0 + fmr f18, f0 + fmr f19, f0 + fmr f20, f0 + fmr f21, f0 + fmr f22, f0 + fmr f23, f0 + fmr f24, f0 + fmr f25, f0 + fmr f26, f0 + fmr f27, f0 + fmr f28, f0 + fmr f29, f0 + fmr f30, f0 + fmr f31, f0 + mtfsf 0xff, f0 + + blr + // clang-format on +} + +static void DisableWriteGatherPipe(void) { + PPCMthid2(PPCMfhid2() & ~HID2_WPE); +} + +u32 __OSGetHollywoodRev(void) { + return *(u32*)OSPhysicalToCached(OS_PHYS_HOLLYWOOD_REV); +} + +void __OSGetIOSRev(OSIOSRev* rev) { + u32 version = *(u32*)OSPhysicalToUncached(OS_PHYS_IOS_VERSION); + u32 builddate = *(u32*)OSPhysicalToUncached(OS_PHYS_IOS_BUILD_DATE); + + rev->idHi = version >> 24 & 0xFF; + rev->idLo = version >> 16 & 0xFF; + rev->verMajor = version >> 8 & 0xFF; + rev->verMinor = version >> 0 & 0xFF; + + rev->buildMon = (builddate >> 16 & 0xF) + (builddate >> 20 & 0xF) * 10; + rev->buildDay = (builddate >> 8 & 0xF) + (builddate >> 12 & 0xF) * 10; + rev->buildYear = + (builddate >> 0 & 0xF) + (builddate >> 4 & 0xF) * 10 + 2000; +} + +u32 OSGetConsoleType(void) { + u32 hollywood; + u32 mem2size; + + if (BootInfo == NULL || BootInfo->consoleType == 0) { + return 0x10000002; + } + + hollywood = __OSGetHollywoodRev(); + + if (OS_DVD_DEVICE_CODE & DVD_DEVICE_CODE_READ) { + switch (OS_DVD_DEVICE_CODE & ~DVD_DEVICE_CODE_READ) { + case 0x0002: + case 0x0003: + case 0x0203: + switch (hollywood) { + case 0x00000000: + return 0x00000010; + case 0x00000001: + return OS_CONSOLE_RVL_PP_1; + case 0x00000002: + return OS_CONSOLE_RVL_PP_2_1; + case 0x00000010: + return 0x00000020; + case 0x00000011: + return 0x00000021; + } + + if (hollywood > 0x00000011) { + return 0x00000021; + } + + case 0x0202: + case 0x0201: + switch (hollywood) { + case 0x00000000: + return OS_CONSOLE_NDEV_1_0; + case 0x00000001: + return OS_CONSOLE_NDEV_1_1; + case 0x00000002: + return OS_CONSOLE_NDEV_1_2; + case 0x00000010: + return OS_CONSOLE_NDEV_2_0; + case 0x00000011: + return OS_CONSOLE_NDEV_2_1; + } + + if (hollywood > 0x00000011) { + return OS_CONSOLE_NDEV_2_1; + } + } + } + + mem2size = OSGetPhysicalMem2Size(); + + switch (hollywood) { + case 0x00000000: + if (mem2size == OS_MEM_MB_TO_B(64)) { + return 0x00000010; + } + return 0x10000010; + case 0x00000001: + if (mem2size == OS_MEM_MB_TO_B(64)) { + return OS_CONSOLE_RVL_PP_1; + } + return 0x10000011; + case 0x00000002: + if (mem2size == OS_MEM_MB_TO_B(64)) { + return OS_CONSOLE_RVL_PP_2_1; + } + return 0x10000012; + case 0x00000010: + if (mem2size == OS_MEM_MB_TO_B(64)) { + return 0x00000020; + } + return 0x10000020; + case 0x00000011: + if (mem2size == OS_MEM_MB_TO_B(64)) { + return 0x00000021; + } + return OS_CONSOLE_NDEV_2_1; + } + + if (hollywood > 0x00000011) { + if (mem2size == OS_MEM_MB_TO_B(64)) { + return 0x00000021; + } + return OS_CONSOLE_NDEV_2_1; + } + + return BootInfo->consoleType; +} + +static void MemClear(void* mem, u32 size) { + void* flush = (0x40000 < size) ? (u32)mem + (size - 0x40000) : mem; + DCZeroRange(mem, size); + DCFlushRange(flush, 0x40000); +} + +static void ClearArena(void) DECOMP_DONT_INLINE { + // System reset + if (!((OSGetResetCode() >> 31) & 1)) { + MemClear(OSGetArenaLo(), (u32)OSGetArenaHi() - (u32)OSGetArenaLo()); + } + // Region doesn't exist, or begins somewhere outside of MEM1 + else if (__OSRebootParams.regionStart == NULL || + !OSIsMEM1Region(__OSRebootParams.regionStart)) { + MemClear(OSGetArenaLo(), (u32)OSGetArenaHi() - (u32)OSGetArenaLo()); + } + // Region begins after arena begins + else if (OSGetArenaLo() < __OSRebootParams.regionStart) { + // Region is outside of arena + if (OSGetArenaHi() <= __OSRebootParams.regionStart) { + MemClear(OSGetArenaLo(), (u32)OSGetArenaHi() - (u32)OSGetArenaLo()); + } + // Region begins in arena + else { + // Clear arena area before region + MemClear(OSGetArenaLo(), + (u32)__OSRebootParams.regionStart - (u32)OSGetArenaLo()); + + // Region ends inside arena + if (OSGetArenaHi() > __OSRebootParams.regionEnd) { + // Clear arena area after region + MemClear(__OSRebootParams.regionEnd, + (u32)OSGetArenaHi() - (u32)__OSRebootParams.regionEnd); + } + } + } +} + +static void ClearMEM2Arena(void) DECOMP_DONT_INLINE { + // System reset + if (!((OSGetResetCode() >> 31) & 1)) { + MemClear(OSGetMEM2ArenaLo(), + (u32)OSGetMEM2ArenaHi() - (u32)OSGetMEM2ArenaLo()); + } + // Region doesn't exist, or begins somewhere outside of MEM2 + else if (__OSRebootParams.regionStart == NULL || + !OSIsMEM2Region(__OSRebootParams.regionStart)) { + MemClear(OSGetMEM2ArenaLo(), + (u32)OSGetMEM2ArenaHi() - (u32)OSGetMEM2ArenaLo()); + } + // Region begins after arena begins + else if (OSGetMEM2ArenaLo() < __OSRebootParams.regionStart) { + // Region is outside of arena + if (OSGetMEM2ArenaHi() <= __OSRebootParams.regionStart) { + MemClear(OSGetMEM2ArenaLo(), + (u32)OSGetMEM2ArenaHi() - (u32)OSGetMEM2ArenaLo()); + } + // Region begins in arena + else { + // Clear arena area before region + MemClear(OSGetMEM2ArenaLo(), (u32)__OSRebootParams.regionStart - + (u32)OSGetMEM2ArenaLo()); + // Region ends inside arena + if (OSGetMEM2ArenaHi() > __OSRebootParams.regionEnd) { + // Clear arena area after region + MemClear(__OSRebootParams.regionEnd, + (u32)OSGetMEM2ArenaHi() - + (u32)__OSRebootParams.regionEnd); + } + } + } +} + +static void InquiryCallback(s32 result, DVDCommandBlock* block) { +#pragma unused(result) + + switch (block->state) { + case DVD_STATE_IDLE: + OS_DVD_DEVICE_CODE = MAKE_DVD_DEVICE_CODE(DriveInfo.deviceCode); + break; + default: + OS_DVD_DEVICE_CODE = 0x0001; + break; + } +} + +static void CheckTargets(void) { + switch (*(u8*)OSPhysicalToCached(OS_PHYS_BOOT_PROGRAM_TARGET)) { + case 0x81: + OSReport("OS ERROR: boot program is not for RVL target. Please use " + "correct boot program.\n"); + // clang-format off +#line 1112 + OSError("Failed to run app"); + // clang-format on + break; + case 0x80: + default: + break; + } + + switch (*(u8*)OSPhysicalToCached(OS_PHYS_APPLOADER_TARGET)) { + case 0x81: + OSReport("OS ERROR: apploader[D].img is not for RVL target. Please use " + "correct apploader[D].img.\n"); + // clang-format off +#line 1130 + OSError("Failed to run app"); + // clang-format on + break; + case 0x80: + default: + break; + } +} + +static void ReportOSInfo(void) { + OSConsoleType type; + OSIOSRev rev; + u32 category; + u32 tdev; + + OSReport("\nRevolution OS\n"); + OSReport("Kernel built : %s %s\n", "Apr 24 2007", "11:50:47"); + + OSReport("Console Type : "); + type = OSGetConsoleType(); + category = type & OS_CONSOLE_MASK; + switch (category) { + case OS_CONSOLE_MASK_RVL: + switch (type) { + case OS_CONSOLE_RVL_PP_1: + OSReport("Pre-production board 1\n"); + break; + case OS_CONSOLE_RVL_PP_2_1: + OSReport("Pre-production board 2-1\n"); + break; + case OS_CONSOLE_RVL_PP_2_2: + OSReport("Pre-production board 2-2\n"); + break; + default: + OSReport("Retail %d\n", type); + break; + } + break; + case OS_CONSOLE_MASK_EMU: + switch (type) { + case OS_CONSOLE_NDEV_2_1: + OSReport("NDEV 2.1\n"); + break; + case OS_CONSOLE_NDEV_2_0: + OSReport("NDEV 2.0\n"); + break; + case OS_CONSOLE_NDEV_1_2: + OSReport("NDEV 1.2\n"); + break; + case OS_CONSOLE_NDEV_1_1: + OSReport("NDEV 1.1\n"); + break; + case OS_CONSOLE_NDEV_1_0: + OSReport("NDEV 1.0\n"); + break; + case OS_CONSOLE_RVL_EMU: + OSReport("Revolution Emulator\n"); + break; + default: + OSReport("Emulation platform (%08x)\n", type); + break; + } + break; + case OS_CONSOLE_MASK_TDEV: + tdev = type & 0x0FFFFFFF; + OSReport("TDEV-based emulation HW%d\n", tdev - 3); + break; + default: + OSReport("%08x\n", type); + break; + } + + __OSGetIOSRev(&rev); + OSReport("Firmware : %d.%d.%d ", rev.idLo, rev.verMajor, rev.verMinor); + OSReport("(%d/%d/%d)\n", rev.buildMon, rev.buildDay, rev.buildYear); + + OSReport("Memory %d MB\n", OS_MEM_B_TO_MB(OSGetConsoleSimulatedMem1Size() + + OSGetConsoleSimulatedMem2Size())); + OSReport("MEM1 Arena : 0x%x - 0x%x\n", OSGetMEM1ArenaLo(), + OSGetMEM1ArenaHi()); + OSReport("MEM2 Arena : 0x%x - 0x%x\n", OSGetMEM2ArenaLo(), + OSGetMEM2ArenaHi()); +} + +void OSInit(void) { + OSBI2* bi2; + void* mem1lo; + void* mem1hi; + void* mem2lo; + void* mem2hi; + + if (!AreWeInitialized) { + AreWeInitialized = TRUE; + + __OSStartTime = __OSGetSystemTime(); + OSDisableInterrupts(); + __OSGetExecParams(&__OSRebootParams); + + PPCMtmmcr0(0); + PPCMtmmcr1(0); + PPCMtpmc1(0); + PPCMtpmc2(0); + PPCMtpmc3(0); + PPCMtpmc4(0); + PPCMthid4(HID4_H4A | HID4_SBE | HID4_PS1_CTL | (1 << 23) | + HID4_L2_CCFI); + PPCDisableSpeculation(); + PPCSetFpNonIEEEMode(); + + BootInfo = (OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO); + BI2DebugFlag = NULL; + __DVDLongFileNameFlag = FALSE; + + // DVD BI2 information + bi2 = *(OSBI2**)OSPhysicalToCached(OS_PHYS_DVD_BI2); + if (bi2 != NULL) { + // Use from DVD and update OS globals + BI2DebugFlag = &bi2->debugFlag; + __PADSpec = bi2->padSpec; + *(u8*)OSPhysicalToCached(OS_PHYS_BI2_DEBUG_FLAG) = *BI2DebugFlag; + *(u8*)OSPhysicalToCached(OS_PHYS_PAD_SPEC) = __PADSpec; + } else if (BootInfo->arenaHi != NULL) { + // Use from OS globals + BI2DebugFlagHolder = + *(u8*)OSPhysicalToCached(OS_PHYS_BI2_DEBUG_FLAG); + BI2DebugFlag = &BI2DebugFlagHolder; + __PADSpec = *(u8*)OSPhysicalToCached(OS_PHYS_PAD_SPEC); + } + + __DVDLongFileNameFlag = TRUE; + + // Initialize MEM1 arena lo + mem1lo = *(void**)OSPhysicalToCached(OS_PHYS_USABLE_MEM1_START); + if (mem1lo == NULL) { + // Use the linker-generated arena if it is in MEM1... + if (OSIsMEM1Region(__ArenaLo)) { + // ...and if the OS boot info does not specify one + mem1lo = + BootInfo->arenaLo == NULL ? __ArenaLo : BootInfo->arenaLo; + + /** + * Linker generates stack/arena in this order: + * 1. Program stack (32K) + * 2. Debug stack (8K) + * 3. Program arena + * + * By using the end of the debug stack as the arena start, + * we can avoid wasting the 8K allocated for the debug stack + * (if there is no debugger attached). + * + * If the arena instead starts in MEM2, this optimization is + * also performed. + */ + if (BootInfo->arenaLo == NULL && BI2DebugFlag != NULL && + *BI2DebugFlag < 2) { + mem1lo = ROUND_UP_PTR(_db_stack_end, 32); + } + } else { + // ??? + mem1lo = (void*)0x80004000; + } + } + OSSetMEM1ArenaLo(mem1lo); + + // Initialize MEM1 arena hi + mem1hi = *(void**)OSPhysicalToCached(OS_PHYS_USABLE_MEM1_END); + if (mem1hi == NULL) { + // Use the linker-generated arena if OS boot info does not specify + // one + mem1hi = BootInfo->arenaHi == NULL ? __ArenaHi : BootInfo->arenaHi; + } + OSSetMEM1ArenaHi(mem1hi); + + // Initialize MEM2 arena lo + mem2lo = *(void**)OSPhysicalToCached(OS_PHYS_USABLE_MEM2_START); + if (mem2lo != NULL) { + // Use the linker-generated arena if it is in MEM2 + if (OSIsMEM2Region(__ArenaLo)) { + mem2lo = __ArenaLo; + + // Use debugger stack if it would be wasted + if (BI2DebugFlag != NULL && *BI2DebugFlag < 2) { + mem2lo = ROUND_UP_PTR(_db_stack_end, 32); + } + } + // First 2K of MEM2 is reserved? + else if (mem2lo >= (void*)0x90000000 && + mem2lo < (void*)0x90000800) { + mem2lo = (void*)0x90000800; + } + OSSetMEM2ArenaLo(mem2lo); + } + + // Initialize MEM2 arena hi + mem2hi = *(void**)OSPhysicalToCached(OS_PHYS_USABLE_MEM2_END); + if (mem2hi != NULL) { + OSSetMEM2ArenaHi(mem2hi); + } + + // Initialize other modules + __OSInitIPCBuffer(); + OSExceptionInit(); + __OSInitSystemCall(); + __OSInitAlarm(); + __OSModuleInit(); + __OSInterruptInit(); + __OSContextInit(); + __OSCacheInit(); + EXIInit(); + SIInit(); + __OSInitSram(); + __OSThreadInit(); + __OSInitAudioSystem(); + + DisableWriteGatherPipe(); + + if (!__OSInIPL) { + __OSInitMemoryProtection(); + } + + ReportOSInfo(); + OSRegisterVersion(__OSVersion); + + // Check for debugger just like earlier + if (BI2DebugFlag != NULL && *BI2DebugFlag >= 2) { + EnableMetroTRKInterrupts(); + } + + ClearArena(); + ClearMEM2Arena(); + OSEnableInterrupts(); + IPCCltInit(); + + if (!__OSInNandBoot && !__OSInReboot) { + __OSInitSTM(); + + SCInit(); + while (SCCheckStatus() == SC_STATUS_BUSY) { + ; + } + + __OSInitNet(); + } + + if (!__OSInIPL) { + CheckTargets(); + DVDInit(); + + if (__OSIsGcam) { + OS_DVD_DEVICE_CODE = MAKE_DVD_DEVICE_CODE(0x1000); + } else if (OS_DVD_DEVICE_CODE == 0) { + DCInvalidateRange(&DriveInfo, sizeof(DVDDriveInfo)); + DVDInquiryAsync(&DriveBlock, &DriveInfo, InquiryCallback); + } + } + + if (!__OSInIPL && !__OSInNandBoot && !__OSInReboot) { + __OSStartPlayRecord(); + } + } +} + +// Physical addresses +// (Must be defined down here because of data pooling) +static u32 __OSExceptionLocations[OS_EXC_MAX] = { + 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800, + 0x0900, 0x0C00, 0x0D00, 0x0F00, 0x1300, 0x1400, 0x1700}; + +static void OSExceptionInit(void) { + u32* dst; + u8 i; + u32* pInst; + u32 inst; + void* vectorCode; + u32 vectorSize; + int j; + u32* code; + + // Instruction that will be modified + pInst = (u32*)__OSEVSetNumber; + inst = *pInst; + + // OS exception vector + vectorCode = __OSEVStart; + vectorSize = (u32)__OSEVEnd - (u32)__OSEVStart; + + dst = (u32*)OSPhysicalToCached(OS_PHYS_DB_INTEGRATOR_HOOK); + // Code is empty if DB integrator has not yet been installed + if (*dst == 0) { + DBPrintf("Installing OSDBIntegrator\n"); + memcpy(dst, __OSDBINTSTART, (u32)__OSDBINTEND - (u32)__OSDBINTSTART); + DCFlushRangeNoSync(dst, (u32)__OSDBINTEND - (u32)__OSDBINTSTART); + __sync(); + ICInvalidateRange(dst, (u32)__OSDBINTEND - (u32)__OSDBINTSTART); + } + + for (i = 0; i < OS_EXC_MAX; i++) { + if (BI2DebugFlag != NULL && *BI2DebugFlag >= 2 && + __DBIsExceptionMarked(i)) { + DBPrintf(">>> OSINIT: exception %d commandeered by TRK\n", i); + } else { + // Modify li instruction with exception ID + *pInst = inst | i; + + if (__DBIsExceptionMarked(i)) { + DBPrintf(">>> OSINIT: exception %d vectored to debugger\n", i); + memcpy(__DBVECTOR, __OSDBJUMPSTART, + (u32)__OSDBJUMPEND - (u32)__OSDBJUMPSTART); + } else { + code = (u32*)__DBVECTOR; + for (j = 0; j < (u32)__OSDBJUMPEND - (u32)__OSDBJUMPSTART; + j += sizeof(u32), code++) { + // Write nop + *code = 0x60000000; + } + } + + dst = OSPhysicalToCached(__OSExceptionLocations[i]); + memcpy(dst, vectorCode, vectorSize); + DCFlushRangeNoSync(dst, vectorSize); + __sync(); + ICInvalidateRange(dst, vectorSize); + } + } + + OSExceptionTable = + (OSExceptionHandler*)OSPhysicalToCached(OS_PHYS_EXCEPTION_TABLE); + for (i = 0; i < OS_EXC_MAX; i++) { + __OSSetExceptionHandler(i, OSDefaultExceptionHandler); + } + + // Restore original instruction + *pInst = inst; + DBPrintf("Exceptions initialized...\n"); +} + +static asm void __OSDBIntegrator(void) { + // clang-format off + nofralloc + + entry __OSDBINTSTART + + // Access OS debug interface + li r5, OS_PHYS_DEBUG_INTERFACE + + // Save exception hook return address + mflr r3 + stw r3, OSDebugInterface.exceptionHookLR(r5) + + // Load exception hook + lwz r3, OSDebugInterface.exceptionHook(r5) + // Physical -> Cached + oris r3, r3, 0x8000 + mtlr r3 + + // Setup MMU + li r3, (MSR_IR | MSR_DR) + mtmsr r3 + + // Call exception hook + blr + + entry __OSDBINTEND + // clang-format on +} + +static asm void __OSDBJump(void){ + // clang-format off + nofralloc + + entry __OSDBJUMPSTART + + bl __OSDBJUMPDEST + + entry __OSDBJUMPEND + // clang-format on +} + +OSExceptionHandler + __OSSetExceptionHandler(u8 type, OSExceptionHandler handler) { + OSExceptionHandler old = OSExceptionTable[type]; + OSExceptionTable[type] = handler; + return old; +} + +OSExceptionHandler __OSGetExceptionHandler(u8 type) { + return OSExceptionTable[type]; +} + +static asm void OSExceptionVector(void) { + // clang-format off + nofralloc + + entry __OSEVStart + + mtsprg0 r4 + + // Current OS context (physical address) + lwz r4, 0x000000C0(0) + stw r3, OSContext.gprs[3](r4) + mfsprg0 r3 + stw r3, OSContext.gprs[4](r4) + stw r5, OSContext.gprs[5](r4) + lhz r3, OSContext.state(r4) + ori r3, r3, 0x2 + sth r3, OSContext.state(r4) + mfcr r3 + stw r3, OSContext.cr(r4) + mflr r3 + stw r3, OSContext.lr(r4) + mfctr r3 + + entry __OSDBJUMPDEST + + stw r3, OSContext.ctr(r4) + mfxer r3 + stw r3, OSContext.xer(r4) + mfsrr0 r3 + stw r3, OSContext.srr0(r4) + mfsrr1 r3 + stw r3, OSContext.srr1(r4) + mr r5, r3 + + entry __DBVECTOR + + nop + mfmsr r3 + ori r3, r3, (MSR_IR | MSR_DR) + mtsrr1 r3 + + entry __OSEVSetNumber + + li r3, 0 + // Currrent OS context (cached address) + lwz r4, 0x000000D4(r0) + rlwinm. r5, r5, 0, 30, 30 + bne lbl_800ECF70 + lis r5, OSDefaultExceptionHandler@ha + addi r5, r5, OSDefaultExceptionHandler@l + mtsrr0 r5 + rfi + +lbl_800ECF70: + rlwinm r5, r3, 2, 22, 29 + lwz r5, 0x3000(r5) + mtsrr0 r5 + rfi + + entry __OSEVEnd + + nop + // clang-format on +} + +asm void OSDefaultExceptionHandler(u8 type, register OSContext* ctx) { + // clang-format off + nofralloc + + stw r0, ctx->gprs[0] + stw r1, ctx->gprs[1] + stw r2, ctx->gprs[2] + stmw r6, ctx->gprs[6] + + mfspr r0, GQR1 + stw r0, ctx->gqrs[1] + mfspr r0, GQR2 + stw r0, ctx->gqrs[2] + mfspr r0, GQR3 + stw r0, ctx->gqrs[3] + mfspr r0, GQR4 + stw r0, ctx->gqrs[4] + mfspr r0, GQR5 + stw r0, ctx->gqrs[5] + mfspr r0, GQR6 + stw r0, ctx->gqrs[6] + mfspr r0, GQR7 + stw r0, ctx->gqrs[7] + + mfdsisr r5 + mfdar r6 + + stwu r1, -8(r1) + b __OSUnhandledException + // clang-format on +} + +void __OSPSInit(void) { + PPCMthid2(PPCMfhid2() | (1 << 31) | HID2_PSE); + ICFlashInvalidate(); + + // clang-format off + asm { + sync + li r3, 0 + mtgqr0 r3 + mtgqr1 r3 + mtgqr2 r3 + mtgqr3 r3 + mtgqr4 r3 + mtgqr5 r3 + mtgqr6 r3 + mtgqr7 r3 + } + // clang-format on +} + +u32 __OSGetDIConfig(void) { + return OS_DI_CONFIG & 0xFF; +} + +void OSRegisterVersion(const char* ver) { + OSReport("%s\n", ver); +} + +// Must be defined down here because of data pooling +static const char* AppGameNameForSysMenu = "HAEA"; + +const char* OSGetAppGamename(void) { + int i; + const char* name = + (const char*)OSPhysicalToCached(OS_PHYS_CURRENT_APP_NAME); + + if (__OSInIPL) { + name = AppGameNameForSysMenu; + } + + for (i = 0; i < 4; i++) { + GameNameBuffer[i] = name[i]; + } + GameNameBuffer[4] = '\0'; + + return GameNameBuffer; +} + +u8 OSGetAppType(void) { + if (__OSInIPL) { + return OS_APP_TYPE_IPL; + } + + return *(u8*)OSPhysicalToCached(OS_PHYS_CURRENT_APP_TYPE); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlarm.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlarm.c new file mode 100644 index 0000000000..d8fc7b443c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlarm.c @@ -0,0 +1,255 @@ +#include +#include +#include + +static BOOL OnReset(BOOL final, u32 event); +static void DecrementerExceptionHandler(u8 type, OSContext* ctx); + +static OSAlarmQueue AlarmQueue; +static OSShutdownFunctionInfo ShutdownFunctionInfo = {OnReset, 0xFFFFFFFF, 0, + 0}; + +static void SetTimer(const OSAlarm* alarm) { + s64 timeLeft = alarm->end - __OSGetSystemTime(); + + if (timeLeft < 0) { + PPCMtdec(0); + } else if (timeLeft < 0x80000000) { + PPCMtdec(timeLeft); + } else { + PPCMtdec(0x7FFFFFFF); + } +} + +void __OSInitAlarm(void) { + if (__OSGetExceptionHandler(OS_ERR_DECREMENTER) != + DecrementerExceptionHandler) { + AlarmQueue.head = AlarmQueue.tail = NULL; + __OSSetExceptionHandler(OS_ERR_DECREMENTER, + DecrementerExceptionHandler); + OSRegisterShutdownFunction(&ShutdownFunctionInfo); + } +} + +void OSCreateAlarm(OSAlarm* alarm) { + alarm->handler = NULL; + alarm->tag = 0; +} + +static void InsertAlarm(OSAlarm* alarm, s64 end, OSAlarmHandler handler) { + OSAlarm* iter; + OSAlarm* prev; + + // Calculate periodic alarm end time (caller makes 'end' 0) + if (alarm->period > 0) { + s64 time = __OSGetSystemTime(); + end = alarm->start; + + if (alarm->start < time) { + s64 periodLeft = ((time - alarm->start) / alarm->period); + end += alarm->period * (periodLeft + 1); + } + } + + alarm->handler = handler; + alarm->end = end; + + // Find position to insert alarm (sorted ascending by end time) + for (iter = AlarmQueue.head; iter != NULL; iter = iter->next) { + if (iter->end <= end) { + continue; + } + + alarm->prev = iter->prev; + iter->prev = alarm; + alarm->next = iter; + + prev = alarm->prev; + if (prev != NULL) { + prev->next = alarm; + } else { + AlarmQueue.head = alarm; + SetTimer(alarm); + } + + return; + } + + alarm->next = NULL; + prev = AlarmQueue.tail; + AlarmQueue.tail = alarm; + alarm->prev = prev; + + if (prev != NULL) { + prev->next = alarm; + } else { + AlarmQueue.tail = alarm; + AlarmQueue.head = alarm; + SetTimer(alarm); + } +} + +void OSSetAlarm(OSAlarm* alarm, s64 tick, OSAlarmHandler handler) { + BOOL enabled = OSDisableInterrupts(); + + alarm->period = 0; + InsertAlarm(alarm, __OSGetSystemTime() + tick, handler); + + OSRestoreInterrupts(enabled); +} + +void OSSetPeriodicAlarm(OSAlarm* alarm, s64 tick, s64 period, + OSAlarmHandler handler) { + BOOL enabled = OSDisableInterrupts(); + + alarm->period = period; + alarm->start = __OSTimeToSystemTime(tick); + InsertAlarm(alarm, 0, handler); + + OSRestoreInterrupts(enabled); +} + +void OSCancelAlarm(OSAlarm* alarm) { + OSAlarm* next; + + BOOL enabled = OSDisableInterrupts(); + + if (alarm->handler == NULL) { + OSRestoreInterrupts(enabled); + return; + } + + next = alarm->next; + if (next == NULL) { + AlarmQueue.tail = alarm->prev; + } else { + next->prev = alarm->prev; + } + + if (alarm->prev != NULL) { + alarm->prev->next = next; + } else { + AlarmQueue.head = next; + if (next != NULL) { + SetTimer(next); + } + } + + alarm->handler = NULL; + + OSRestoreInterrupts(enabled); +} + +static void DecrementerExceptionCallback(u8 type, OSContext* ctx) { +#pragma unused(type) + + OSAlarmHandler handler; + OSContext tempCtx; + OSAlarm* alarm; + OSAlarm* next; + + s64 time = __OSGetSystemTime(); + alarm = AlarmQueue.head; + + if (alarm == NULL) { + OSLoadContext(ctx); + } + + if (time < alarm->end) { + SetTimer(alarm); + OSLoadContext(ctx); + } + + next = alarm->next; + AlarmQueue.head = next; + if (next == NULL) { + AlarmQueue.tail = NULL; + } else { + next->prev = NULL; + } + + handler = alarm->handler; + alarm->handler = NULL; + + if (alarm->period > 0) { + InsertAlarm(alarm, 0, handler); + } + + if (AlarmQueue.head != NULL) { + SetTimer(AlarmQueue.head); + } + + OSDisableScheduler(); + OSClearContext(&tempCtx); + OSSetCurrentContext(&tempCtx); + handler(alarm, ctx); + OSClearContext(&tempCtx); + OSSetCurrentContext(ctx); + OSEnableScheduler(); + + __OSReschedule(); + OSLoadContext(ctx); +} + +static asm void DecrementerExceptionHandler(register u8 type, + register OSContext* ctx) { + // clang-format off + nofralloc + + stw r0, ctx->gprs[0] + stw r1, ctx->gprs[1] + stw r2, ctx->gprs[2] + stmw r6, ctx->gprs[6] + + mfspr r0, GQR1 + stw r0, ctx->gqrs[1] + mfspr r0, GQR2 + stw r0, ctx->gqrs[2] + mfspr r0, GQR3 + stw r0, ctx->gqrs[3] + mfspr r0, GQR4 + stw r0, ctx->gqrs[4] + mfspr r0, GQR5 + stw r0, ctx->gqrs[5] + mfspr r0, GQR6 + stw r0, ctx->gqrs[6] + mfspr r0, GQR7 + stw r0, ctx->gqrs[7] + + stwu r1, -8(r1) + b DecrementerExceptionCallback + // clang-format on +} + +void OSSetAlarmTag(OSAlarm* alarm, u32 tag) { + alarm->tag = tag; +} + +static BOOL OnReset(BOOL final, u32 event) { + OSAlarm* iter; + OSAlarm* next; + + if (final) { + iter = AlarmQueue.head; + next = (iter != NULL) ? iter->next : NULL; + + while (iter != NULL) { + if (!__DVDTestAlarm(iter)) { + OSCancelAlarm(iter); + } + + iter = next; + next = (next != NULL) ? next->next : NULL; + } + } + + return TRUE; +} + +void OSSetAlarmUserData(OSAlarm* alarm, void* userData) { + alarm->userData = userData; +} + +void* OSGetAlarmUserData(const OSAlarm* alarm) { + return alarm->userData; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlloc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlloc.c new file mode 100644 index 0000000000..b5fa693222 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAlloc.c @@ -0,0 +1,195 @@ +#include + +typedef struct OSHeapDescriptor { + s32 size; // at 0x0 + struct OSHeapCell* freeList; // at 0x4 + struct OSHeapCell* usedList; // at 0x8 +} OSHeapDescriptor; + +typedef struct OSHeapCell { + struct OSHeapCell* prev; // at 0x0 + struct OSHeapCell* next; // at 0x4 + s32 size; // at 0x8 + struct OSHeapDescriptor* hd; // at 0xC + s32 usedSize; // at 0x10 + char UNK_0x14[0x20 - 0x14]; +} OSHeapCell; + +volatile s32 __OSCurrHeap = -1; + +static void* ArenaEnd = NULL; +static void* ArenaStart = NULL; +static s32 NumHeaps = 0; +static OSHeapDescriptor* HeapArray = NULL; + +static OSHeapCell* DLAddFront(OSHeapCell* list, OSHeapCell* child) { + child->next = list; + child->prev = NULL; + + if (list != NULL) { + list->prev = child; + } + + return child; +} + +static OSHeapCell* DLExtract(OSHeapCell* list, OSHeapCell* child) { + if (child->next != NULL) { + child->next->prev = child->prev; + } + + if (child->prev == NULL) { + return child->next; + } + + child->prev->next = child->next; + return list; +} + +static OSHeapCell* DLInsert(OSHeapCell* list, OSHeapCell* child) { + OSHeapCell* prev = NULL; + OSHeapCell* next = list; + + for (; next != NULL; prev = next, next = next->next) { + if (child <= next) { + break; + } + } + + child->next = next; + child->prev = prev; + + if (next != NULL) { + next->prev = child; + + if ((u8*)child + child->size == (u8*)next) { + child->size += next->size; + next = next->next; + child->next = next; + if (next != NULL) { + next->prev = child; + } + } + } + + if (prev != NULL) { + prev->next = child; + + if ((u8*)prev + prev->size == (u8*)child) { + prev->size += child->size; + prev->next = next; + if (next != NULL) { + next->prev = prev; + } + } + + return list; + } else { + return child; + } +} + +void* OSAllocFromHeap(s32 handle, s32 size) { + OSHeapDescriptor* hd = &HeapArray[handle]; + OSHeapCell* cell; + u32 avail; + + hd = &HeapArray[handle]; + size = ROUND_UP(size + sizeof(OSHeapCell), 32); + + for (cell = hd->freeList; cell != NULL; cell = cell->next) { + if (size <= cell->size) { + break; + } + } + + if (cell == NULL) { + return NULL; + } + + avail = cell->size - size; + if (avail < 64) { + hd->freeList = DLExtract(hd->freeList, cell); + } else { + OSHeapCell* adj; + cell->size = size; + + adj = (OSHeapCell*)((u8*)cell + size); + adj->size = avail; + adj->prev = cell->prev; + adj->next = cell->next; + + if (adj->next != NULL) { + adj->next->prev = adj; + } + + if (adj->prev != NULL) { + adj->prev->next = adj; + } else { + hd->freeList = adj; + } + } + + hd->usedList = DLAddFront(hd->usedList, cell); + return (u8*)cell + sizeof(OSHeapCell); +} + +void OSFreeToHeap(s32 handle, void* p) { + OSHeapDescriptor* hd = &HeapArray[handle]; + OSHeapCell* cell = (OSHeapCell*)((u8*)p - sizeof(OSHeapCell)); + hd->usedList = DLExtract(hd->usedList, cell); + hd->freeList = DLInsert(hd->freeList, cell); +} + +s32 OSSetCurrentHeap(s32 handle) { + s32 old = __OSCurrHeap; + __OSCurrHeap = handle; + return old; +} + +void* OSInitAlloc(void* start, void* end, s32 numHeaps) { + u32 headerSize; + int i; + + headerSize = numHeaps * sizeof(OSHeapDescriptor); + HeapArray = (OSHeapDescriptor*)start; + NumHeaps = numHeaps; + + for (i = 0; i < NumHeaps; i++) { + OSHeapDescriptor* hd = &HeapArray[i]; + hd->size = -1; + hd->usedList = NULL; + hd->freeList = NULL; + } + + __OSCurrHeap = -1; + ArenaStart = ROUND_UP_PTR((u8*)HeapArray + headerSize, 32); + ArenaEnd = ROUND_DOWN_PTR(end, 32); + + return ArenaStart; +} + +s32 OSCreateHeap(void* start, void* end) { + s32 handle; + + start = ROUND_UP_PTR(start, 32); + end = ROUND_DOWN_PTR(end, 32); + + for (handle = 0; handle < NumHeaps; handle++) { + OSHeapCell* cell = (OSHeapCell*)start; + OSHeapDescriptor* hd = &HeapArray[handle]; + if (hd->size < 0) { + hd->size = (uintptr_t)end - (uintptr_t)start; + + cell->prev = NULL; + cell->next = NULL; + cell->size = hd->size; + + hd->freeList = cell; + hd->usedList = NULL; + return handle; + } + } + + return -1; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSArena.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSArena.c new file mode 100644 index 0000000000..07c75fb8ac --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSArena.c @@ -0,0 +1,62 @@ +#include + +static void* __OSArenaLo = (void*)-1; +static void* s_mem2ArenaLo = (void*)-1; +static void* __OSArenaHi = NULL; +static void* s_mem2ArenaHi = NULL; + +void* OSGetMEM1ArenaHi(void) { + return __OSArenaHi; +} + +void* OSGetMEM2ArenaHi(void) { + return s_mem2ArenaHi; +} + +void* OSGetArenaHi(void) { + return OSGetMEM1ArenaHi(); +} + +void* OSGetMEM1ArenaLo(void) { + return __OSArenaLo; +} + +void* OSGetMEM2ArenaLo(void) { + return s_mem2ArenaLo; +} + +void* OSGetArenaLo(void) { + return OSGetMEM1ArenaLo(); +} + +void OSSetMEM1ArenaHi(void* hi) { + __OSArenaHi = hi; +} + +void OSSetMEM2ArenaHi(void* hi) { + s_mem2ArenaHi = hi; +} + +void OSSetArenaHi(void* hi) { + OSSetMEM1ArenaHi(hi); +} + +void OSSetMEM1ArenaLo(void* lo) { + __OSArenaLo = lo; +} + +void OSSetMEM2ArenaLo(void* lo) { + s_mem2ArenaLo = lo; +} + +void OSSetArenaLo(void* lo) { + OSSetMEM1ArenaLo(lo); +} + +void* OSAllocFromMEM1ArenaLo(size_t size, u32 align) { + u8* begin = ROUND_UP_PTR(OSGetMEM1ArenaLo(), align); + u8* end = begin + size; + end = ROUND_UP_PTR(end, align); + OSSetMEM1ArenaLo(end); + return begin; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAudioSystem.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAudioSystem.c new file mode 100644 index 0000000000..e4d6a07f2d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSAudioSystem.c @@ -0,0 +1,197 @@ +#include +#include +#include + +#define DSP_CODE_WORK_MEM ((void*)0x81000000) +#define DSP_CODE_WORK_MEM_BACKUP ((u8*)OSGetArenaHi() - sizeof(DSPInitCode)) + +static u8 DSPInitCode[128] = { + 0x02, 0x9F, 0x00, 0x10, 0x02, 0x9F, 0x00, 0x33, 0x02, 0x9F, 0x00, 0x34, + 0x02, 0x9F, 0x00, 0x35, 0x02, 0x9F, 0x00, 0x36, 0x02, 0x9F, 0x00, 0x37, + 0x02, 0x9F, 0x00, 0x38, 0x02, 0x9F, 0x00, 0x39, 0x12, 0x06, 0x12, 0x03, + 0x12, 0x04, 0x12, 0x05, 0x00, 0x80, 0x80, 0x00, 0x00, 0x88, 0xFF, 0xFF, + 0x00, 0x84, 0x10, 0x00, 0x00, 0x64, 0x00, 0x1D, 0x02, 0x18, 0x00, 0x00, + 0x81, 0x00, 0x1C, 0x1E, 0x00, 0x44, 0x1B, 0x1E, 0x00, 0x84, 0x08, 0x00, + 0x00, 0x64, 0x00, 0x27, 0x19, 0x1E, 0x00, 0x00, 0x00, 0xDE, 0xFF, 0xFC, + 0x02, 0xA0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x28, 0x16, 0xFC, 0x00, 0x54, + 0x16, 0xFD, 0x43, 0x48, 0x00, 0x21, 0x02, 0xFF, 0x02, 0xFF, 0x02, 0xFF, + 0x02, 0xFF, 0x02, 0xFF, 0x02, 0xFF, 0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +static void waitMicroSec(u32 usec) { + u32 start = OSGetTick(); + do { + ; + } while (OS_TICKS_TO_USEC(OS_TICKS_DELTA(OSGetTick(), start)) < usec); +} + +static void __AIClockInit(BOOL arg0) { + u32 tmp; + + tmp = OS_UNK_CD800180; + tmp &= ~0x100; + tmp |= (arg0 << 8); + tmp &= ~0x80; + OS_UNK_CD800180 = tmp; + + OS_UNK_CD8001D0 &= ~0xC0000000; + waitMicroSec(100); + + if (!arg0) { + tmp = OS_UNK_CD8001CC; + tmp &= ~0x3FFC0; + tmp |= 0xFC0; + tmp &= ~0x3F; + tmp &= ~0x7FC0000; + tmp |= 0x4640000; + OS_UNK_CD8001CC = tmp; + } else { + tmp = OS_UNK_CD8001CC; + tmp &= ~0x3FFC0; + tmp |= 0xFFC0; + tmp &= ~0x3F; + tmp |= 0xE; + tmp &= ~0x7FC0000; + tmp |= 0x4B00000; + OS_UNK_CD8001CC = tmp; + } + waitMicroSec(100); + + OS_UNK_CD8001D0 &= ~0x10000000; + waitMicroSec(1000); + + OS_UNK_CD8001D0 = (OS_UNK_CD8001D0 & ~0x40000000) | 0x40000000; + waitMicroSec(1000); + + OS_UNK_CD8001D0 = (OS_UNK_CD8001D0 & ~0x80000000) | 0x80000000; + waitMicroSec(1000); +} + +void __OSInitAudioSystem(void) { + u16 cpuMboxHi; + u32 start; + u16 ctrl; + + if (!__OSInIPL) { + __AIClockInit(TRUE); + } + + // Backup existing work memory contents + memcpy(DSP_CODE_WORK_MEM_BACKUP, DSP_CODE_WORK_MEM, sizeof(DSPInitCode)); + // Copy in DSP code + memcpy(DSP_CODE_WORK_MEM, DSPInitCode, sizeof(DSPInitCode)); + DCFlushRange(DSP_CODE_WORK_MEM, sizeof(DSPInitCode)); + + DSP_HW_REGS[DSP_AR_SIZE] = 0x43; + DSP_HW_REGS[DSP_CSR] = DSP_CSR_HALT | DSP_CSR_AIDINT | DSP_CSR_ARINT | + DSP_CSR_DSPINT | DSP_CSR_RES; + + // Reset DSP + DSP_HW_REGS[DSP_CSR] |= 0x1; + while (DSP_HW_REGS[DSP_CSR] & 0x1) { + ; + } + + DSP_HW_REGS[DSP_DSPMBOX_H] = 0; + // Wait for mail delivery + while (((DSP_HW_REGS[DSP_CPUMBOX_H] << 16) | DSP_HW_REGS[DSP_CPUMBOX_L]) & + (DSP_CPUMBOX_H_STATUS << 16)) { + ; + } + + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_MMADDR_H] = 0x01000000; + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_ARADDR_H] = 0x00000000; + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_CNT_H] = 32; + + // Wait for ARAM interrupt + for (ctrl = DSP_HW_REGS[DSP_CSR]; !(ctrl & DSP_CSR_ARINT); + ctrl = DSP_HW_REGS[DSP_CSR]) { + ; + } + DSP_HW_REGS[DSP_CSR] = ctrl; + + start = OSGetTick(); + do { + ; + } while (OS_TICKS_DELTA(OSGetTick(), start) < 2194); + + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_MMADDR_H] = 0x01000000; + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_ARADDR_H] = 0x00000000; + *(u32*)&DSP_HW_REGS[DSP_AR_DMA_CNT_H] = 32; + + // Wait for ARAM interrupt + for (ctrl = DSP_HW_REGS[DSP_CSR]; !(ctrl & DSP_CSR_ARINT); + ctrl = DSP_HW_REGS[DSP_CSR]) { + ; + } + DSP_HW_REGS[DSP_CSR] = ctrl; + + DSP_HW_REGS[DSP_CSR] &= ~DSP_CSR_RES; + while (DSP_HW_REGS[DSP_CSR] & 0x400) { + ; + } + + DSP_HW_REGS[DSP_CSR] &= ~DSP_CSR_HALT; + for (cpuMboxHi = DSP_HW_REGS[DSP_CPUMBOX_H]; + !(cpuMboxHi & DSP_CPUMBOX_H_STATUS); + cpuMboxHi = DSP_HW_REGS[DSP_CPUMBOX_H]) { + ; + } + + // ????? + DSP_HW_REGS[DSP_CPUMBOX_L]; + + DSP_HW_REGS[DSP_CSR] |= DSP_CSR_HALT; + DSP_HW_REGS[DSP_CSR] = DSP_CSR_HALT | DSP_CSR_AIDINT | DSP_CSR_ARINT | + DSP_CSR_DSPINT | DSP_CSR_RES; + + // Reset DSP + DSP_HW_REGS[DSP_CSR] |= 0x1; + while (DSP_HW_REGS[DSP_CSR] & 0x1) { + ; + } + + // Restore backup + memcpy(DSP_CODE_WORK_MEM, DSP_CODE_WORK_MEM_BACKUP, sizeof(DSPInitCode)); +} + +void __OSStopAudioSystem(void) { + u32 start; + u16 ctrl; + + DSP_HW_REGS[DSP_CSR] = DSP_CSR_HALT | DSP_CSR_RES; + // Clear sample control + DSP_HW_REGS[DSP_AI_DMA_CSR] &= ~DSP_AI_DMA_CSR_PLAY; + + for (ctrl = DSP_HW_REGS[DSP_CSR]; ctrl & 0x400; + ctrl = DSP_HW_REGS[DSP_CSR]) { + ; + } + + // Wait for DMA interrupt to end + for (ctrl = DSP_HW_REGS[DSP_CSR]; ctrl & DSP_CSR_DMAINT; + ctrl = DSP_HW_REGS[DSP_CSR]) { + ; + } + + DSP_HW_REGS[DSP_CSR] = DSP_CSR_HALT | DSP_CSR_AIDINT | DSP_CSR_ARINT | + DSP_CSR_DSPINT | DSP_CSR_RES; + + DSP_HW_REGS[DSP_DSPMBOX_H] = 0; + // Wait for mail delivery + while (((DSP_HW_REGS[DSP_CPUMBOX_H] << 16) | DSP_HW_REGS[DSP_CPUMBOX_L]) & + (DSP_CPUMBOX_H_STATUS << 16)) { + ; + } + + start = OSGetTick(); + do { + ; + } while (OS_TICKS_DELTA(OSGetTick(), start) < 44); + + // Reset DSP + DSP_HW_REGS[DSP_CSR] |= 0x1; + for (ctrl = DSP_HW_REGS[DSP_CSR]; ctrl & 0x1; ctrl = DSP_HW_REGS[DSP_CSR]) { + ; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSCache.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSCache.c new file mode 100644 index 0000000000..1d86eeb1a4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSCache.c @@ -0,0 +1,473 @@ +#include +#include +#include + +asm void DCEnable(void) { + // clang-format off + nofralloc + + sync + mfhid0 r3 + ori r3, r3, 0x4000 + mthid0 r3 + + blr + // clang-format on +} + +asm void DCInvalidateRange(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_invalidate: + dcbi 0, buf + addi buf, buf, 32 + bdnz do_invalidate + + blr + // clang-format on +} + +asm void DCFlushRange(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_flush: + dcbf 0, buf + addi buf, buf, 32 + bdnz do_flush + sc + + blr + // clang-format on +} + +asm void DCStoreRange(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_store: + dcbst 0, buf + addi buf, buf, 32 + bdnz do_store + sc + + blr + // clang-format on +} + +asm void DCFlushRangeNoSync(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_flush: + dcbf 0, buf + addi buf, buf, 32 + bdnz do_flush + + blr + // clang-format on +} + +asm void DCStoreRangeNoSync(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_store: + dcbst 0, buf + addi buf, buf, 32 + bdnz do_store + + blr + // clang-format on +} + +asm void DCZeroRange(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_zero: + dcbz 0, buf + addi buf, buf, 32 + bdnz do_zero + + blr + // clang-format on +} + +asm void ICInvalidateRange(register const void* buf, register u32 len) { + // clang-format off + nofralloc + + cmplwi len, 0 + blelr + + clrlwi r5, buf, 27 + add len, len, r5 + addi len, len, 31 + srwi len, len, 5 + mtctr len + +do_invalidate: + icbi 0, buf + addi buf, buf, 32 + bdnz do_invalidate + + sync + isync + + blr + // clang-format on +} + +asm void ICFlashInvalidate(void) { + // clang-format off + nofralloc + + mfhid0 r3 + ori r3, r3, 0x800 + mthid0 r3 + + blr + // clang-format on +} + +asm void ICEnable(void) { + // clang-format off + nofralloc + + isync + mfhid0 r3 + ori r3, r3, 0x8000 + mthid0 r3 + + blr + // clang-format on +} + +static asm void __LCEnable(void) { + // clang-format off + nofralloc + + mfmsr r5 + ori r5, r5, 0x1000 + mtmsr r5 + + lis r3, 0x80000000@h + li r4, 1024 + mtctr r4 +do_store: + dcbt 0, r3 + dcbst 0, r3 + addi r3, r3, 32 + bdnz do_store + + mfspr r4, 0x398 + oris r4, r4, 0x100F + mtspr 0x398, r4 + + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + + lis r3, 0xE0000002@h + ori r3, r3, 0xE0000002@l + mtdbatl 3, r3 + ori r3, r3, 0x1FE + mtdbatu 3, r3 + isync + + lis r3, 0xE0000000@h + li r6, 512 + mtctr r6 + li r6, 0 +do_load: + dcbz_l r6, r3 + addi r3, r3, 32 + bdnz do_load + + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + + blr + // clang-format on +} + +void LCEnable(void) { + BOOL enabled = OSDisableInterrupts(); + __LCEnable(); + OSRestoreInterrupts(enabled); +} + +asm void LCDisable(void) { + // clang-format off + nofralloc + + lis r3, 0xE0000000@ha + li r4, 512 + mtctr r4 +do_invalidate: + dcbi 0, r3 + addi r3, r3, 32 + bdnz do_invalidate + + mfspr r4, 0x398 + rlwinm r4, r4, 0, 4, 2 + mtspr 0x398, r4 + + blr + // clang-format on +} + +asm void LCLoadBlocks(register void* dst, register const void* src, + register u32 blocks) { + // clang-format off + nofralloc + + rlwinm r6, blocks, 30, 27, 31 + clrlwi src, src, 3 + or r6, r6, src + mtspr DMA_U, r6 + rlwinm r6, blocks, 2, 28, 29 + or r6, r6, dst + ori r6, r6, 0x12 + mtspr DMA_L, r6 + + blr + // clang-format on +} + +asm void LCStoreBlocks(register void* dst, register const void* src, + register u32 blocks){ + // clang-format off + nofralloc + + rlwinm r6, blocks, 30, 27, 31 + clrlwi dst, dst, 3 + or r6, r6, dst + mtspr DMA_U, r6 + rlwinm r6, blocks, 2, 28, 29 + or r6, r6, src + ori r6, r6, 0x2 + mtspr DMA_L, r6 + + blr + // clang-format on +} + +u32 LCStoreData(void* dst, const void* src, u32 len) { + u32 blocks = (len + 31) / 32; + u32 ret = (blocks + 127) / 128; + + while (blocks > 0) { + if (blocks < 128) { + LCStoreBlocks(dst, src, blocks); + blocks = 0; + } else { + LCStoreBlocks(dst, src, 0); + blocks -= 128; + + dst = (u8*)dst + 0x1000; + src = (u8*)src + 0x1000; + } + } + + return ret; +} + +asm u32 LCQueueLength(void) { + // clang-format off + nofralloc + + mfspr r4, 0x398 + rlwinm r3, r4, 8, 28, 31 + + blr + // clang-format on +} + +asm void LCQueueWait(register u32 n) { + // clang-format off + nofralloc + + mfspr r4, 0x398 + rlwinm r4, r4, 8, 28, 31 + cmpw r4, n + bgt LCQueueWait + + blr + // clang-format on +} + +static void L2Init(void) { + u32 msr; + + msr = PPCMfmsr(); + __sync(); + PPCMtmsr(MSR_IR | MSR_DR); + __sync(); + + L2Disable(); + L2GlobalInvalidate(); + PPCMtmsr(msr); +} + +void L2Enable(void) { + u32 l2cr = PPCMfl2cr(); + PPCMtl2cr((l2cr | L2CR_L2E) & ~L2CR_L2I); +} + +void L2Disable(void) { + u32 l2cr; + + __sync(); + l2cr = PPCMfl2cr(); + PPCMtl2cr(l2cr & ~L2CR_L2E); + __sync(); +} + +void L2GlobalInvalidate(void) { + u32 l2cr; + + L2Disable(); + + l2cr = PPCMfl2cr(); + PPCMtl2cr(l2cr | L2CR_L2I); + + while (PPCMfl2cr() & L2CR_L2IP) { + } + + l2cr = PPCMfl2cr(); + PPCMtl2cr(l2cr & ~L2CR_L2I); + + while (PPCMfl2cr() & L2CR_L2IP) { + DBPrintf(">>> L2 INVALIDATE : SHOULD NEVER HAPPEN\n"); + } +} + +void DMAErrorHandler(u8 error, OSContext* ctx, u32 dsisr, u32 dar, ...) { + u32 hid2 = PPCMfhid2(); + + OSReport("Machine check received\n"); + OSReport("HID2 = 0x%x SRR1 = 0x%x\n", hid2, ctx->srr1); + + if (!(hid2 & (HID2_DCHERR | HID2_DNCERR | HID2_DCMERR | HID2_DQOERR)) || + !(ctx->srr1 & 0x200000)) { + OSReport("Machine check was not DMA/locked cache related\n"); + OSDumpContext(ctx); + PPCHalt(); + } + + OSReport("DMAErrorHandler(): An error occurred while processing DMA.\n"); + OSReport("The following errors have been detected and cleared :\n"); + + if (hid2 & HID2_DCHERR) { + OSReport( + "\t- Requested a locked cache tag that was already in the cache\n"); + } + if (hid2 & HID2_DNCERR) { + OSReport("\t- DMA attempted to access normal cache\n"); + } + if (hid2 & HID2_DCMERR) { + OSReport("\t- DMA missed in data cache\n"); + } + if (hid2 & HID2_DQOERR) { + OSReport("\t- DMA queue overflowed\n"); + } + + PPCMthid2(hid2); +} + +void __OSCacheInit(void) { + if (!(PPCMfhid0() & HID0_ICE)) { + ICEnable(); + DBPrintf("L1 i-caches initialized\n"); + } + + if (!(PPCMfhid0() & HID0_DCE)) { + DCEnable(); + DBPrintf("L1 d-caches initialized\n"); + } + + if (!(PPCMfl2cr() & L2CR_L2E)) { + L2Init(); + L2Enable(); + DBPrintf("L2 cache initialized\n"); + } + + OSSetErrorHandler(OS_ERR_MACHINE_CHECK, DMAErrorHandler); + DBPrintf("Locked cache machine check handler installed\n"); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSContext.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSContext.c new file mode 100644 index 0000000000..9424dc8b9b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSContext.c @@ -0,0 +1,591 @@ +#include +#include +#include + +static asm void __OSLoadFPUContext(UNKWORD unused, register OSContext* ctx) { + // clang-format off + nofralloc + + lhz r5, ctx->state + clrlwi. r5, r5, 31 + beq _exit + + lfd f0, ctx->fpscr_pad + mtfs f0 + mfspr r5, 0x398 + rlwinm. r5, r5, 3, 31, 31 + beq _load_fprs + + psq_l f0, OSContext.psfs[0](ctx), 0, 0 + psq_l f1, OSContext.psfs[1](ctx), 0, 0 + psq_l f2, OSContext.psfs[2](ctx), 0, 0 + psq_l f3, OSContext.psfs[3](ctx), 0, 0 + psq_l f4, OSContext.psfs[4](ctx), 0, 0 + psq_l f5, OSContext.psfs[5](ctx), 0, 0 + psq_l f6, OSContext.psfs[6](ctx), 0, 0 + psq_l f7, OSContext.psfs[7](ctx), 0, 0 + psq_l f8, OSContext.psfs[8](ctx), 0, 0 + psq_l f9, OSContext.psfs[9](ctx), 0, 0 + psq_l f10, OSContext.psfs[10](ctx), 0, 0 + psq_l f11, OSContext.psfs[11](ctx), 0, 0 + psq_l f12, OSContext.psfs[12](ctx), 0, 0 + psq_l f13, OSContext.psfs[13](ctx), 0, 0 + psq_l f14, OSContext.psfs[14](ctx), 0, 0 + psq_l f15, OSContext.psfs[15](ctx), 0, 0 + psq_l f16, OSContext.psfs[16](ctx), 0, 0 + psq_l f17, OSContext.psfs[17](ctx), 0, 0 + psq_l f18, OSContext.psfs[18](ctx), 0, 0 + psq_l f19, OSContext.psfs[19](ctx), 0, 0 + psq_l f20, OSContext.psfs[20](ctx), 0, 0 + psq_l f21, OSContext.psfs[21](ctx), 0, 0 + psq_l f22, OSContext.psfs[22](ctx), 0, 0 + psq_l f23, OSContext.psfs[23](ctx), 0, 0 + psq_l f24, OSContext.psfs[24](ctx), 0, 0 + psq_l f25, OSContext.psfs[25](ctx), 0, 0 + psq_l f26, OSContext.psfs[26](ctx), 0, 0 + psq_l f27, OSContext.psfs[27](ctx), 0, 0 + psq_l f28, OSContext.psfs[28](ctx), 0, 0 + psq_l f29, OSContext.psfs[29](ctx), 0, 0 + psq_l f30, OSContext.psfs[30](ctx), 0, 0 + psq_l f31, OSContext.psfs[31](ctx), 0, 0 + +_load_fprs: + lfd f0, ctx->fprs[0] + lfd f1, ctx->fprs[1] + lfd f2, ctx->fprs[2] + lfd f3, ctx->fprs[3] + lfd f4, ctx->fprs[4] + lfd f5, ctx->fprs[5] + lfd f6, ctx->fprs[6] + lfd f7, ctx->fprs[7] + lfd f8, ctx->fprs[8] + lfd f9, ctx->fprs[9] + lfd f10, ctx->fprs[10] + lfd f11, ctx->fprs[11] + lfd f12, ctx->fprs[12] + lfd f13, ctx->fprs[13] + lfd f14, ctx->fprs[14] + lfd f15, ctx->fprs[15] + lfd f16, ctx->fprs[16] + lfd f17, ctx->fprs[17] + lfd f18, ctx->fprs[18] + lfd f19, ctx->fprs[19] + lfd f20, ctx->fprs[20] + lfd f21, ctx->fprs[21] + lfd f22, ctx->fprs[22] + lfd f23, ctx->fprs[23] + lfd f24, ctx->fprs[24] + lfd f25, ctx->fprs[25] + lfd f26, ctx->fprs[26] + lfd f27, ctx->fprs[27] + lfd f28, ctx->fprs[28] + lfd f29, ctx->fprs[29] + lfd f30, ctx->fprs[30] + lfd f31, ctx->fprs[31] + +_exit: + blr + // clang-format on +} + +static asm void __OSSaveFPUContext(UNKWORD unused, UNKWORD unused1, + register OSContext* ctx) { + // clang-format off + nofralloc + + lhz r3, ctx->state + ori r3, r3, OS_CONTEXT_STATE_FP_SAVED + sth r3, ctx->state + + stfd f0, ctx->fprs[0] + stfd f1, ctx->fprs[1] + stfd f2, ctx->fprs[2] + stfd f3, ctx->fprs[3] + stfd f4, ctx->fprs[4] + stfd f5, ctx->fprs[5] + stfd f6, ctx->fprs[6] + stfd f7, ctx->fprs[7] + stfd f8, ctx->fprs[8] + stfd f9, ctx->fprs[9] + stfd f10, ctx->fprs[10] + stfd f11, ctx->fprs[11] + stfd f12, ctx->fprs[12] + stfd f13, ctx->fprs[13] + stfd f14, ctx->fprs[14] + stfd f15, ctx->fprs[15] + stfd f16, ctx->fprs[16] + stfd f17, ctx->fprs[17] + stfd f18, ctx->fprs[18] + stfd f19, ctx->fprs[19] + stfd f20, ctx->fprs[20] + stfd f21, ctx->fprs[21] + stfd f22, ctx->fprs[22] + stfd f23, ctx->fprs[23] + stfd f24, ctx->fprs[24] + stfd f25, ctx->fprs[25] + stfd f26, ctx->fprs[26] + stfd f27, ctx->fprs[27] + stfd f28, ctx->fprs[28] + stfd f29, ctx->fprs[29] + stfd f30, ctx->fprs[30] + stfd f31, ctx->fprs[31] + + mffs f0 + stfd f0, ctx->fpscr_pad + lfd f0, ctx->fprs[0] + mfspr r3, 0x398 + rlwinm. r3, r3, 3, 31, 31 + beq _exit + + psq_st f0, OSContext.psfs[0](ctx), 0, 0 + psq_st f1, OSContext.psfs[1](ctx), 0, 0 + psq_st f2, OSContext.psfs[2](ctx), 0, 0 + psq_st f3, OSContext.psfs[3](ctx), 0, 0 + psq_st f4, OSContext.psfs[4](ctx), 0, 0 + psq_st f5, OSContext.psfs[5](ctx), 0, 0 + psq_st f6, OSContext.psfs[6](ctx), 0, 0 + psq_st f7, OSContext.psfs[7](ctx), 0, 0 + psq_st f8, OSContext.psfs[8](ctx), 0, 0 + psq_st f9, OSContext.psfs[9](ctx), 0, 0 + psq_st f10, OSContext.psfs[10](ctx), 0, 0 + psq_st f11, OSContext.psfs[11](ctx), 0, 0 + psq_st f12, OSContext.psfs[12](ctx), 0, 0 + psq_st f13, OSContext.psfs[13](ctx), 0, 0 + psq_st f14, OSContext.psfs[14](ctx), 0, 0 + psq_st f15, OSContext.psfs[15](ctx), 0, 0 + psq_st f16, OSContext.psfs[16](ctx), 0, 0 + psq_st f17, OSContext.psfs[17](ctx), 0, 0 + psq_st f18, OSContext.psfs[18](ctx), 0, 0 + psq_st f19, OSContext.psfs[19](ctx), 0, 0 + psq_st f20, OSContext.psfs[20](ctx), 0, 0 + psq_st f21, OSContext.psfs[21](ctx), 0, 0 + psq_st f22, OSContext.psfs[22](ctx), 0, 0 + psq_st f23, OSContext.psfs[23](ctx), 0, 0 + psq_st f24, OSContext.psfs[24](ctx), 0, 0 + psq_st f25, OSContext.psfs[25](ctx), 0, 0 + psq_st f26, OSContext.psfs[26](ctx), 0, 0 + psq_st f27, OSContext.psfs[27](ctx), 0, 0 + psq_st f28, OSContext.psfs[28](ctx), 0, 0 + psq_st f29, OSContext.psfs[29](ctx), 0, 0 + psq_st f30, OSContext.psfs[30](ctx), 0, 0 + psq_st f31, OSContext.psfs[31](ctx), 0, 0 + +_exit: + blr + // clang-format on +} + +asm void OSSaveFPUContext(register OSContext* ctx) { + // clang-format off + nofralloc + + addi r5, ctx, 0 + b __OSSaveFPUContext + // clang-format on +} + +asm void OSSetCurrentContext(register OSContext* ctx) { + // clang-format off + nofralloc + + lis r4, 0x80000000@ha + stw ctx, OS_CURRENT_CONTEXT@l(r4) + + clrlwi r5, ctx, 2 + stw r5, OS_CURRENT_CONTEXT_PHYS@l(r4) + + lwz r5, OS_CURRENT_FPU_CONTEXT@l(r4) + cmpw r5, ctx + bne _not_current_fpu_ctx + + lwz r6, ctx->srr1 + ori r6, r6, 0x2000 + stw r6, ctx->srr1 + mfmsr r6 + ori r6, r6, 2 + mtmsr r6 + blr + +_not_current_fpu_ctx: + lwz r6, ctx->srr1 + rlwinm r6, r6, 0, 19, 17 + stw r6, ctx->srr1 + mfmsr r6 + rlwinm r6, r6, 0, 19, 17 + ori r6, r6, 2 + mtmsr r6 + + isync + blr + // clang-format on +} + +OSContext* OSGetCurrentContext(void) { + return OS_CURRENT_CONTEXT; +} + +asm BOOL OSSaveContext(register OSContext* ctx) { + // clang-format off + nofralloc + + stmw r13, ctx->gprs[13] + + mfgqr1 r0 + stw r0, ctx->gqrs[1] + mfgqr2 r0 + stw r0, ctx->gqrs[2] + mfgqr3 r0 + stw r0, ctx->gqrs[3] + mfgqr4 r0 + stw r0, ctx->gqrs[4] + mfgqr5 r0 + stw r0, ctx->gqrs[5] + mfgqr6 r0 + stw r0, ctx->gqrs[6] + mfgqr7 r0 + stw r0, ctx->gqrs[7] + + mfcr r0 + stw r0, ctx->cr + + mflr r0 + stw r0, ctx->lr + stw r0, ctx->srr0 + + mfmsr r0 + stw r0, ctx->srr1 + + mfctr r0 + stw r0, ctx->ctr + + mfxer r0 + stw r0, ctx->xer + + stw r1, ctx->gprs[1] + stw r2, ctx->gprs[2] + + li r0, 1 + stw r0, ctx->gprs[3] + + li r3, 0 + blr + // clang-format on +} + +asm void OSLoadContext(register OSContext* ctx) { + // clang-format off + nofralloc + + // If the context was in OSDisableInterrupts, + // jump back to the beginning of the function + lis r4, __RAS_OSDisableInterrupts_begin@ha + lwz r6, ctx->srr0 + addi r5, r4, __RAS_OSDisableInterrupts_begin@l + cmplw r6, r5 + ble _srr0_not_in_disableintr + lis r4, __RAS_OSDisableInterrupts_end@ha + addi r0, r4, __RAS_OSDisableInterrupts_end@l + cmplw r6, r0 + bge _srr0_not_in_disableintr + stw r5, ctx->srr0 + +_srr0_not_in_disableintr: + lwz r0, ctx->gprs[0] + lwz r1, ctx->gprs[1] + lwz r2, ctx->gprs[2] + lhz r4, ctx->state + rlwinm. r5, r4, 0, 30, 30 + beq _load_saved_gprs + + rlwinm r4, r4, 0, 31, 29 + sth r4, ctx->state + lmw r5, ctx->gprs[5] + b _load_special_regs + +_load_saved_gprs: + lmw r13, ctx->gprs[13] + +_load_special_regs: + lwz r4, ctx->gqrs[1] + mtgqr1 r4 + lwz r4, ctx->gqrs[2] + mtgqr2 r4 + lwz r4, ctx->gqrs[3] + mtgqr3 r4 + lwz r4, ctx->gqrs[4] + mtgqr4 r4 + lwz r4, ctx->gqrs[5] + mtgqr5 r4 + lwz r4, ctx->gqrs[6] + mtgqr6 r4 + lwz r4, ctx->gqrs[7] + mtgqr7 r4 + + lwz r4, ctx->cr + mtcr r4 + lwz r4, ctx->lr + mtlr r4 + lwz r4, ctx->ctr + mtctr r4 + lwz r4, ctx->xer + mtxer r4 + + mfmsr r4 + rlwinm r4, r4, 0, 17, 15 + rlwinm r4, r4, 0, 31, 29 + mtmsr r4 + + lwz r4, ctx->srr0 + mtsrr0 r4 + + lwz r4, ctx->srr1 + mtsrr1 r4 + + lwz r4, ctx->gprs[4] + lwz r3, ctx->gprs[3] + + rfi + // clang-format on +} + +asm void* OSGetStackPointer(void) { + // clang-format off + nofralloc + + mr r3, r1 + blr + // clang-format on +} + +asm void OSSwitchFiber(register void* func, register void* stack) { + // clang-format off + nofralloc + + mflr r0 + // Back chain + mr r5, r1 + stwu r5, -8(stack) + // LR save + mr r1, stack + stw r0, 4(r5) + // Call function + mtlr func + blrl + + // Switch back + lwz r5, 0(r1) + lwz r0, 4(r5) + mtlr r0 + mr r1, r5 + blr + // clang-format on +} + +asm void OSSwitchFiberEx(u32 r3, u32 r4, u32 r5, u32 r6, register void* func, + register void* stack) { + // clang-format off + nofralloc + + mflr r0 + // Back chain + mr r9, r1 + stwu r9, -8(stack) + // LR save + mr r1, stack + stw r0, 4(r9) + // Call function (args in r3-r6) + mtlr func + blrl + + // Switch back + lwz r5, 0(r1) + lwz r0, 4(r5) + mtlr r0 + mr r1, r5 + blr + // clang-format on +} + +void OSClearContext(OSContext* ctx) { + ctx->mode = 0; + ctx->state = 0; + + if (ctx == OS_CURRENT_FPU_CONTEXT) { + OS_CURRENT_FPU_CONTEXT = NULL; + } +} + +asm void OSInitContext(register OSContext* ctx, register void* _srr0, + register void* stack) { + // clang-format off + nofralloc + + stw _srr0, ctx->srr0 + stw stack, ctx->gprs[1] + + li r11, 0 + ori r11, r11, 0x9032 + stw r11, ctx->srr1 + + li r0, 0 + stw r0, ctx->cr + stw r0, ctx->xer + + stw r2, ctx->gprs[2] + stw r13, ctx->gprs[13] + + stw r0, ctx->gprs[3] + stw r0, ctx->gprs[4] + stw r0, ctx->gprs[5] + stw r0, ctx->gprs[6] + stw r0, ctx->gprs[7] + stw r0, ctx->gprs[8] + stw r0, ctx->gprs[9] + stw r0, ctx->gprs[10] + stw r0, ctx->gprs[11] + stw r0, ctx->gprs[12] + stw r0, ctx->gprs[14] + stw r0, ctx->gprs[15] + stw r0, ctx->gprs[16] + stw r0, ctx->gprs[17] + stw r0, ctx->gprs[18] + stw r0, ctx->gprs[19] + stw r0, ctx->gprs[20] + stw r0, ctx->gprs[21] + stw r0, ctx->gprs[22] + stw r0, ctx->gprs[23] + stw r0, ctx->gprs[24] + stw r0, ctx->gprs[25] + stw r0, ctx->gprs[26] + stw r0, ctx->gprs[27] + stw r0, ctx->gprs[28] + stw r0, ctx->gprs[29] + stw r0, ctx->gprs[30] + stw r0, ctx->gprs[31] + + stw r0, ctx->gqrs[0] + stw r0, ctx->gqrs[1] + stw r0, ctx->gqrs[2] + stw r0, ctx->gqrs[3] + stw r0, ctx->gqrs[4] + stw r0, ctx->gqrs[5] + stw r0, ctx->gqrs[6] + stw r0, ctx->gqrs[7] + + b OSClearContext + // clang-format on +} + +void OSDumpContext(const OSContext* ctx) { + u32 i; + u32* sp; + + OSReport( + "------------------------- Context 0x%08x -------------------------\n", + ctx); + + for (i = 0; i < 16; i++) { + OSReport("r%-2d = 0x%08x (%14d) r%-2d = 0x%08x (%14d)\n", i, + ctx->gprs[i], ctx->gprs[i], i + 16, ctx->gprs[i + 16], + ctx->gprs[i + 16]); + } + + OSReport("LR = 0x%08x CR = 0x%08x\n", ctx->lr, + ctx->cr); + OSReport("SRR0 = 0x%08x SRR1 = 0x%08x\n", ctx->srr0, + ctx->srr1); + + OSReport("\nGQRs----------\n"); + for (i = 0; i < 4; i++) { + OSReport("gqr%d = 0x%08x \t gqr%d = 0x%08x\n", i, ctx->gqrs[i], i + 4, + ctx->gqrs[i + 4]); + } + + if (ctx->state & OS_CONTEXT_STATE_FP_SAVED) { + OSContext tempCtx; + BOOL enabled = OSDisableInterrupts(); + OSContext* currCtx = OSGetCurrentContext(); + + OSClearContext(&tempCtx); + OSSetCurrentContext(&tempCtx); + + OSReport("\n\nFPRs----------\n"); + for (i = 0; i < 32; i += 2) { + OSReport("fr%d \t= %d \t fr%d \t= %d\n", i, (u32)ctx->fprs[i], + i + 1, (u32)ctx->fprs[i + 1]); + } + + OSReport("\n\nPSFs----------\n"); + for (i = 0; i < 32; i += 2) { + OSReport("ps%d \t= 0x%x \t ps%d \t= 0x%x\n", i, (u32)ctx->psfs[i], + i + 1, (u32)ctx->psfs[i + 1]); + } + + OSClearContext(&tempCtx); + OSSetCurrentContext(currCtx); + OSRestoreInterrupts(enabled); + } + + OSReport("\nAddress: Back Chain LR Save\n"); + i = 0; + sp = (u32*)ctx->gprs[1]; + for (; sp != NULL && sp != (u32*)0xFFFFFFFF && i++ < 16; sp = (u32*)*sp) { + OSReport("0x%08x: 0x%08x 0x%08x\n", sp, *sp, sp[1]); + } +} + +static asm void OSSwitchFPUContext(register u8 err, register OSContext* ctx) { + // clang-format off + nofralloc + + mfmsr r5 + ori r5, r5, MSR_FP + mtmsr r5 + + isync + + lwz r5, ctx->srr1 + ori r5, r5, 0x2000 + mtsrr1 r5 + + lis r3, OS_CURRENT_FPU_CONTEXT@ha + lwz r5, OS_CURRENT_FPU_CONTEXT@l(r3) + stw ctx, OS_CURRENT_FPU_CONTEXT@l(r3) + cmpw r5, ctx + beq _ctx_is_curr_fpu_ctx + cmpwi r5, 0 + beq _ctx_is_null + bl __OSSaveFPUContext + +_ctx_is_null: + bl __OSLoadFPUContext + +_ctx_is_curr_fpu_ctx: + lwz r3, ctx->cr + mtcr r3 + lwz r3, ctx->lr + mtlr r3 + lwz r3, ctx->srr0 + mtsrr0 r3 + lwz r3, ctx->ctr + mtctr r3 + lwz r3, ctx->xer + mtxer r3 + + lhz r3, ctx->state + rlwinm r3, r3, 0, 31, 29 + sth r3, ctx->state + + lwz r5, ctx->gprs[5] + lwz r3, ctx->gprs[3] + lwz r4, ctx->gprs[4] + + rfi + // clang-format on +} + +void __OSContextInit(void) { + __OSSetExceptionHandler(OS_ERR_FP_UNAVAIL, OSSwitchFPUContext); + OS_CURRENT_FPU_CONTEXT = NULL; + DBPrintf("FPU-unavailable handler installed\n"); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSError.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSError.c new file mode 100644 index 0000000000..3b75817641 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSError.c @@ -0,0 +1,207 @@ +#include +#include +#include +#include + +OSErrorHandler __OSErrorTable[OS_ERR_MAX]; +u32 __OSFpscrEnableBits = + (FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE); + +void OSReport(const char* msg, ...) { + va_list list; + va_start(list, msg); + vprintf(msg, list); + va_end(list); +} + +void OSPanic(const char* file, int line, const char* msg, ...) { + u32 depth; + u32* sp; + va_list list; + + OSDisableInterrupts(); + + va_start(list, msg); + vprintf(msg, list); + va_end(list); + OSReport(" in \"%s\" on line %d.\n", file, line); + + OSReport("\nAddress: Back Chain LR Save\n"); + for (depth = 0, sp = (u32*)OSGetStackPointer(); + sp != NULL && sp != (u32*)0xFFFFFFFF && depth++ < 16; sp = (u32*)*sp) { + OSReport("0x%08x: 0x%08x 0x%08x\n", sp, sp[0], sp[1]); + } + + PPCHalt(); +} + +OSErrorHandler OSSetErrorHandler(u16 error, OSErrorHandler handler) { + OSErrorHandler oldHandler; + BOOL enabled = OSDisableInterrupts(); + + oldHandler = __OSErrorTable[error]; + __OSErrorTable[error] = handler; + + if (error == OS_ERR_FP_EXCEPTION) { + OSThread* thread; + u32 msr; + u32 fpscr; + + msr = PPCMfmsr(); + PPCMtmsr(msr | MSR_FP); + fpscr = PPCMffpscr(); + + if (handler != NULL) { + int i; + for (thread = OS_THREAD_QUEUE.head; thread != NULL; + thread = thread->nextActive) { + thread->context.srr1 |= 0x900; + + if (!(thread->context.state & 0x1)) { + thread->context.state |= 0x1; + + for (i = 0; i < 32; i++) { + *(u64*)&thread->context.fprs[i] = 0xFFFFFFFFFFFFFFFF; + *(u64*)&thread->context.psfs[i] = 0xFFFFFFFFFFFFFFFF; + } + + thread->context.fpscr = FPSCR_NI; + } + thread->context.fpscr |= + __OSFpscrEnableBits & + (FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE); + thread->context.fpscr &= + (FPSCR_FEX | FPSCR_VX | FPSCR_FR | FPSCR_FPRF | + FPSCR_UNK20 | FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | + FPSCR_XE | FPSCR_NI | FPSCR_RN); + } + + fpscr |= __OSFpscrEnableBits & + (FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE); + msr |= (MSR_FE0 | MSR_FE1); + } else { + for (thread = OS_THREAD_QUEUE.head; thread != NULL; + thread = thread->nextActive) { + thread->context.srr1 &= ~0x900; + thread->context.fpscr &= + ~(FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE); + thread->context.fpscr &= + (FPSCR_FEX | FPSCR_VX | FPSCR_FR | FPSCR_FPRF | + FPSCR_UNK20 | FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | + FPSCR_XE | FPSCR_NI | FPSCR_RN); + } + + fpscr &= ~(FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE); + msr &= ~(MSR_FE0 | MSR_FE1); + } + + PPCMtfpscr(fpscr & (FPSCR_FEX | FPSCR_VX | FPSCR_FR | FPSCR_FPRF | + FPSCR_UNK20 | FPSCR_VE | FPSCR_OE | FPSCR_UE | + FPSCR_ZE | FPSCR_XE | FPSCR_NI | FPSCR_RN)); + PPCMtmsr(msr); + } + + OSRestoreInterrupts(enabled); + return oldHandler; +} + +void __OSUnhandledException(u8 error, OSContext* ctx, u32 dsisr, u32 dar) { + s64 tb = OSGetTime(); + + if (!(ctx->srr1 & 0x2)) { + OSReport("Non-recoverable Exception %d", error); + } else { + if (error == OS_ERR_PROGRAM && ctx->srr1 & 0x100000 && + __OSErrorTable[OS_ERR_FP_EXCEPTION] != NULL) { + u32 msr; + u32 fpscr; + + error = OS_ERR_FP_EXCEPTION; + + msr = PPCMfmsr(); + PPCMtmsr(msr | MSR_FP); + + if (OS_CURRENT_FPU_CONTEXT != NULL) { + OSSaveFPUContext(OS_CURRENT_FPU_CONTEXT); + } + + fpscr = PPCMffpscr(); + PPCMtfpscr(fpscr & (FPSCR_FEX | FPSCR_VX | FPSCR_FR | FPSCR_FPRF | + FPSCR_UNK20 | FPSCR_VE | FPSCR_OE | FPSCR_UE | + FPSCR_ZE | FPSCR_XE | FPSCR_NI | FPSCR_RN)); + PPCMtmsr(msr); + + if (OS_CURRENT_FPU_CONTEXT == ctx) { + OSDisableScheduler(); + __OSErrorTable[error](error, ctx, dsisr, dar); + ctx->srr1 &= ~0x2000; + OS_CURRENT_FPU_CONTEXT = NULL; + ctx->fpscr &= (FPSCR_FEX | FPSCR_VX | FPSCR_FR | FPSCR_FPRF | + FPSCR_UNK20 | FPSCR_VE | FPSCR_OE | FPSCR_UE | + FPSCR_ZE | FPSCR_XE | FPSCR_NI | FPSCR_RN); + OSEnableScheduler(); + __OSReschedule(); + } else { + ctx->srr1 &= ~0x2000; + OS_CURRENT_FPU_CONTEXT = NULL; + } + + OSLoadContext(ctx); + } + + if (__OSErrorTable[error] != NULL) { + OSDisableScheduler(); + __OSErrorTable[error](error, ctx, dsisr, dar); + OSEnableScheduler(); + __OSReschedule(); + OSLoadContext(ctx); + } + + if (error == OS_ERR_DECREMENTER) { + OSLoadContext(ctx); + } + + OSReport("Unhandled Exception %d", error); + } + + OSReport("\n"); + OSDumpContext(ctx); + OSReport("\nDSISR = 0x%08x DAR = 0x%08x\n", dsisr, dar); + OSReport("TB = 0x%016llx\n", tb); + switch (error) { + case OS_ERR_DSI: + OSReport("\nInstruction at 0x%x (read from SRR0) attempted to access " + "invalid address 0x%x (read from DAR)\n", + ctx->srr0, dar); + break; + case OS_ERR_ISI: + OSReport("\nAttempted to fetch instruction from invalid address 0x%x " + "(read from SRR0)\n", + ctx->srr0); + break; + case OS_ERR_ALIGNMENT: + OSReport("\nInstruction at 0x%x (read from SRR0) attempted to access " + "unaligned address 0x%x (read from DAR)\n", + ctx->srr0, dar); + break; + case OS_ERR_PROGRAM: + OSReport("\nProgram exception : Possible illegal instruction/operation " + "at or around 0x%x (read from SRR0)\n", + ctx->srr0, dar); + break; + case OS_ERR_PROTECTION: + OSReport("\n"); + OSReport("AI DMA Address = 0x%04x%04x\n", + DSP_HW_REGS[DSP_AI_DMA_START_H], + DSP_HW_REGS[DSP_AI_DMA_START_L]); + OSReport("ARAM DMA Address = 0x%04x%04x\n", + DSP_HW_REGS[DSP_AR_DMA_MMADDR_H], + DSP_HW_REGS[DSP_AR_DMA_MMADDR_L]); + OSReport("DI DMA Address = 0x%08x\n", OS_DI_DMA_ADDR); + break; + } + + OSReport("\nLast interrupt (%d): SRR0 = 0x%08x TB = 0x%016llx\n", + __OSLastInterrupt, __OSLastInterruptSrr0, __OSLastInterruptTime); + PPCHalt(); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSExec.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSExec.c new file mode 100644 index 0000000000..376d8b5f33 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSExec.c @@ -0,0 +1,157 @@ +#include +#include +#include +#include + +#define MENU_TITLE_ID 0x0000000100000002 +#define TICKET_VIEW_SIZE 0xD8 + +// Force CW to align the file boundary to 64 +u8 FORCE_BSS_ALIGN[0xABCD] ALIGN(64); + +static u8 views[0xBD00] ALIGN(32); + +BOOL __OSInReboot; + +static s32 _ES_InitLib(s32* fd); +static s32 _ES_GetTicketViews(s32* fd, u64 tid, void* pViews, u32* count); +static s32 _ES_LaunchTitle(s32* fd, u64 tid, void* pViews) DECOMP_DONT_INLINE; + +void __OSGetExecParams(OSExecParams* out) { + if (OS_DOL_EXEC_PARAMS >= (void*)0x80000000) { + memcpy(out, OS_DOL_EXEC_PARAMS, sizeof(OSExecParams)); + } else { + out->WORD_0x0 = 0; + } +} + +void __OSLaunchMenu(void) { + // This makes me feel sick + s32 result; + void* pviews = &views; + u32 count = 1; + s32 fd = -1; + struct { + u8 tmp[4]; + } unused = {0xFF, 0xFF, 0xFF, 0}; + + if (_ES_InitLib(&fd) != IPC_RESULT_OK) { + return; + } + + // Get num ticket views + result = _ES_GetTicketViews(&fd, MENU_TITLE_ID, NULL, &count); + if (count != 1 || result != IPC_RESULT_OK) { + return; + } + + // Get ticket views + if (_ES_GetTicketViews(&fd, MENU_TITLE_ID, pviews, &count) != + IPC_RESULT_OK) { + return; + } + + // Launch title + if (_ES_LaunchTitle(&fd, MENU_TITLE_ID, pviews) != IPC_RESULT_OK) { + return; + } + + while (TRUE) { + ; + } +} + +/** + * These were actually re(?)implemented in NANDCore/OSExec according to BBA + */ + +static s32 _ES_InitLib(s32* fd) { + s32 result; + + // Had to remove fd initialization to match __OSLaunchMenu + // *fd = -1; + + result = IPC_RESULT_OK; + + *fd = IOS_Open("/dev/es", IPC_OPEN_NONE); + if (*fd < 0) { + result = *fd; + } + + return result; +} + +static s32 _ES_GetTicketViews(s32* fd, u64 tid, void* pViews, u32* count) { + s32 result; + // TODO: Hacky solution + u8 work[0x120] ALIGN(32); + IPCIOVector* pVectors = (IPCIOVector*)(work + 0x0); + u64* pTid = (u64*)(work + 0x20); + u32* pCount = (u32*)(work + 0x40); + + // Cast is necessary + if (*fd < 0 || count == ((void*)NULL)) { + return -0x3F9; + } + + if ((u32)pViews % 32 != 0) { + return -0x3F9; + } + + *pTid = tid; + + // NULL views ptr = get num views + if (pViews == (void*)NULL) { + pVectors[0].base = pTid; + pVectors[0].length = sizeof(u64); + pVectors[1].base = pCount; + pVectors[1].length = sizeof(u32); + + result = + IOS_Ioctlv(*fd, ES_IOCTLV_GET_NUM_TICKET_VIEWS, 1, 1, pVectors); + if (result == IPC_RESULT_OK) { + *count = *pCount; + } + + return result; + } + + if (*count == 0) { + return -0x3F9; + } + + *pCount = *count; + + pVectors[0].base = pTid; + pVectors[0].length = sizeof(u64); + pVectors[1].base = pCount; + pVectors[1].length = sizeof(u32); + pVectors[2].base = pViews; + pVectors[2].length = *count * TICKET_VIEW_SIZE; + return IOS_Ioctlv(*fd, ES_IOCTLV_GET_TICKET_VIEWS, 2, 1, pVectors); +} + +static s32 _ES_LaunchTitle(s32* fd, u64 tid, void* pViews) { + // TODO: Hacky solution + u8 tidWork[256] ALIGN(32); + u8 vectorWork[32] ALIGN(32); + IPCIOVector* pVectors = (IPCIOVector*)vectorWork; + u64* pTid = (u64*)tidWork; + + if (*fd < 0) { + return -0x3F9; + } + + if ((u32)pViews % 32 != 0) { + return -0x3F9; + } + + *pTid = tid; + + pVectors[0].base = pTid; + pVectors[0].length = sizeof(u64); + pVectors[1].base = pViews; + pVectors[1].length = TICKET_VIEW_SIZE; + + return IOS_IoctlvReboot(*fd, ES_IOCTLV_LAUNCH_TITLE, 2, 0, pVectors); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFatal.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFatal.c new file mode 100644 index 0000000000..63f627c980 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFatal.c @@ -0,0 +1,283 @@ +#include +#include +#include +#include +#include +#include + +/** + * Framebuffer formatted as 32-bits per two pixels + * Pixels are written as brightness/chroma pairs + */ +#define FATAL_FB_W 640 +#define FATAL_FB_H 480 +#define FATAL_FB_SIZE (FATAL_FB_W * FATAL_FB_H * 2) + +typedef struct OSFatalParam { + GXColor textColor; // at 0x0 + GXColor bgColor; // at 0x4 + const char* msg; // at 0x8 +} OSFatalParam; + +static OSContext FatalContext; +static OSFatalParam FatalParam; + +static void Halt(void); + +static void ScreenClear(u8* fb, u16 width, u16 height, GXColor yuv) { + int x, y; + + for (y = 0; y < height; y += 1) { + for (x = 0; x < width; x += 2) { + fb[0] = yuv.r; + fb[1] = yuv.g; + + fb[2] = yuv.r; + fb[3] = yuv.b; + + fb += sizeof(u32); + } + } +} + +static void ScreenReport(void* fb, u16 width, u16 height, GXColor msgYUV, s32 x, + s32 y, u32 lf, const char* msg) { + u32 texel[70]; + u32 charWidth; + u8* tmp; + u8 bright; + s32 xPos; + u32 idx; + u32 idx2; + u32 idx3; + u32 i; + u32 j; + +new_line: + if (height - 24 < y) { + return; + } + + tmp = (u8*)fb + ((x + (y * width)) * 2); + xPos = x; + + while (*msg != '\0') { + if (*msg == '\n') { + msg++; + y += lf; + goto new_line; + } else if (width - 48 < xPos) { + y += lf; + goto new_line; + } + + for (i = 0; i < 24; i++) { + idx = (i & 7) + ((i / 8) * 24); + texel[idx] = 0; + texel[idx + 8] = 0; + texel[idx + 16] = 0; + } + + msg = OSGetFontTexel(msg, texel, 0, 6, &charWidth); + + for (i = 0; i < 24; i++) { + idx = (i & 7) + ((i / 8) * 24); + + for (j = 0; j < 24; j++) { + idx2 = idx + ((j / 8) * 8); + bright = (texel[idx2] >> ((7 - (j & 7)) * 4)) & 0x0F; + + if (bright != 0) { + // Y component/brightness + bright = (((msgYUV.r * (bright * 0xEF)) / 255) / 15) + 16; + idx3 = (j + (width * i)); + tmp[idx3 * 2] = bright; + + // Order chroma depending on pixel pair + if ((xPos + j) % 2 != 0) { + tmp[(idx3 * 2) - 1] = msgYUV.g; + tmp[(idx3 * 2) + 1] = msgYUV.b; + } else { + tmp[(idx3 * 2) - 1] = msgYUV.b; + tmp[(idx3 * 2) + 1] = msgYUV.g; + } + } + } + } + + tmp += charWidth * 2; + xPos += charWidth; + } +} + +static void ConfigureVideo(u16 width, u16 height) { + GXRenderModeObj rmode; + + rmode.fbWidth = width; + rmode.efbHeight = FATAL_FB_H; + rmode.xfbHeight = height; + + rmode.viXOrigin = 40; + rmode.viWidth = FATAL_FB_W; + rmode.viHeight = height; + + switch (VIGetTvFormat()) { + case VI_TV_FMT_NTSC: + case VI_TV_FMT_MPAL: + if (VI_HW_REGS[VI_VICLK] & VI_VICLK_SPEED /* == VI_VICLK_54MHZ */) { + // Progressive mode + rmode.tvInfo = VI_TV_INFO(VI_TV_FMT_NTSC, VI_SCAN_MODE_PROG); + rmode.viYOrigin = 0; + rmode.xfbMode = VI_XFB_MODE_SF; + } else { + // Non-progressive mode + rmode.tvInfo = VI_TV_INFO(VI_TV_FMT_NTSC, VI_SCAN_MODE_INT); + rmode.viYOrigin = 0; + rmode.xfbMode = VI_XFB_MODE_DF; + } + break; + case VI_TV_FMT_EURGB60: + rmode.tvInfo = VI_TV_INFO(VI_TV_FMT_EURGB60, VI_SCAN_MODE_INT); + rmode.viYOrigin = 0; + rmode.xfbMode = VI_XFB_MODE_DF; + break; + case VI_TV_FMT_PAL: + rmode.tvInfo = VI_TV_INFO(VI_TV_FMT_PAL, VI_SCAN_MODE_INT); + rmode.viYOrigin = 47; + rmode.xfbMode = VI_XFB_MODE_DF; + break; + } + + VIConfigure(&rmode); + VIConfigurePan(0, 0, FATAL_FB_W, FATAL_FB_H); +} + +// Intel IPP RGBToYCbCr algorithm (+0.5f?) +static GXColor RGB2YUV(GXColor rgb) { + GXColor yuv; + + // clang-format off + f32 y = ( 0.257f * rgb.r + 0.504f * rgb.g + 0.098f * rgb.b + 16.0f) + 0.5f; + f32 cb = (-0.148f * rgb.r - 0.291f * rgb.g + 0.439f * rgb.b + 128.0f) + 0.5f; + f32 cr = ( 0.439f * rgb.r - 0.368f * rgb.g - 0.071f * rgb.b + 128.0f) + 0.5f; + // clang-format on + + yuv.r = CLAMP(16.0f, 235.0f, y); + yuv.g = CLAMP(16.0f, 240.0f, cb); + yuv.b = CLAMP(16.0f, 240.0f, cr); + yuv.a = 0; + + return yuv; +} + +void OSFatal(GXColor textColor, GXColor bgColor, const char* msg) { + s32 retraceCount; + s64 start; + OSBootInfo* bootInfo; + + bootInfo = (OSBootInfo*)OSPhysicalToCached(OS_PHYS_BOOT_INFO); + + OSDisableInterrupts(); + + OSDisableScheduler(); + OSClearContext(&FatalContext); + OSSetCurrentContext(&FatalContext); + __OSStopAudioSystem(); + + VIInit(); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_PI_VI)); + VISetBlack(TRUE); + VIFlush(); + VISetPreRetraceCallback(NULL); + VISetPostRetraceCallback(NULL); + + OSEnableInterrupts(); + + retraceCount = VIGetRetraceCount(); + while (VIGetRetraceCount() - retraceCount < 1) { + ; + } + + start = OSGetTime(); + do { + if (__OSCallShutdownFunctions(0, 0)) { + break; + } + } while (OSGetTime() - start < OS_MSEC_TO_TICKS(1000)); + + OSDisableInterrupts(); + __OSCallShutdownFunctions(1, 0); + + EXISetExiCallback(EXI_CHAN_0, NULL); + EXISetExiCallback(EXI_CHAN_2, NULL); + while (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + EXISync(EXI_CHAN_0); + EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + } + EXIUnlock(EXI_CHAN_0); + + while ((EXI_CHAN_PARAMS[EXI_CHAN_0].cr & EXI_CR_TSTART) == 1) { + ; + } + + __OSSetExceptionHandler(OS_ERR_DECREMENTER, OSDefaultExceptionHandler); + + GXAbortFrame(); + + OSSetArenaLo((void*)0x81400000); + OSSetArenaHi(bootInfo->fstStart); + + FatalParam.textColor = textColor; + FatalParam.bgColor = bgColor; + FatalParam.msg = msg; + OSSwitchFiber(Halt, OSGetArenaHi()); +} + +static void Halt(void) { + OSFontHeader* msgFont; + const char* msg; + s32 retraceCount; + size_t msgLen; + void* msgBuf; + void* fb; + OSFatalParam* params; + + OSEnableInterrupts(); + + params = &FatalParam; + msg = params->msg; + + msgLen = strlen(msg) + 1; + msgBuf = OSAllocFromMEM1ArenaLo(msgLen, 32); + params->msg = memmove(msgBuf, msg, msgLen); + + msgFont = (OSFontHeader*)OSAllocFromMEM1ArenaLo(0xA1004, 32); + OSLoadFont(msgFont, OSGetArenaLo()); + + fb = OSAllocFromMEM1ArenaLo(FATAL_FB_SIZE, 32); + ScreenClear(fb, FATAL_FB_W, FATAL_FB_H, RGB2YUV(params->bgColor)); + VISetNextFrameBuffer(fb); + ConfigureVideo(FATAL_FB_W, FATAL_FB_H); + VIFlush(); + + retraceCount = VIGetRetraceCount(); + while (VIGetRetraceCount() - retraceCount < 2) { + ; + } + + ScreenReport(fb, FATAL_FB_W, FATAL_FB_H, RGB2YUV(params->textColor), 48, + 100, msgFont->leading, params->msg); + DCFlushRange(fb, FATAL_FB_SIZE); + VISetBlack(FALSE); + VIFlush(); + + retraceCount = VIGetRetraceCount(); + while (VIGetRetraceCount() - retraceCount < 1) { + ; + } + + OSDisableInterrupts(); + OSReport("%s\n", params->msg); + PPCHalt(); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFont.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFont.c new file mode 100644 index 0000000000..4af492bf62 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSFont.c @@ -0,0 +1,759 @@ +#include +#include +#include + +#define ROM_FONT_SJIS_START ((void*)0x001AFF00) +#define ROM_FONT_SJIS_SIZE 0x0004D000 +#define ROM_FONT_ANSI_START ((void*)0x001FCF00) +#define ROM_FONT_ANSI_SIZE 0x00003000 + +typedef const u8* (*ParseStringFunc)(u16 encode, const u8* str, + OSFontHeader** fontOut, u32* codeOut); + +static u16 FontEncode = 0xFFFF; + +static OSFontHeader* FontDataAnsi; +static OSFontHeader* FontDataSjis; +static BOOL FixedPitch; +static ParseStringFunc ParseString; + +extern u16 HankakuToCode[]; +extern u16 Zenkaku2Code[]; + +static const u8* ParseStringS(u16 encode, const u8* str, OSFontHeader** fontOut, + u32* codeOut); +static const u8* ParseStringW(u16 encode, const u8* str, OSFontHeader** fontOut, + u32* codeOut); + +static BOOL IsSjisLeadByte(u8 ch) { + return (0x81 <= ch && ch <= 0x9F) || (0xE0 <= ch && ch <= 0xFC); +} + +static BOOL IsSjisTrailByte(u8 ch) { + return (0x40 <= ch && ch <= 0xFC) && (ch != 0x7F); +} + +static u32 GetFontCode(u16 encode, u16 code) { + u32 tmp; + s32 trail; + + if (encode == OS_FONT_ENCODE_SJIS) { + if (code >= 0x20 && code <= 0xDF) { + return HankakuToCode[code - 0x20]; + } else if (code > 0x889E && code <= 0x9872) { + tmp = ((code >> 8) - 0x88) * 0xBC; + trail = code & 0xFF; + + if (!IsSjisTrailByte(trail)) { + return 0; + } + + trail -= 0x40; + if (trail >= 0x40) { + trail--; + } + + return tmp + trail + 0x2BE; + } else if (code >= 0x8140 && code < 0x879E) { + tmp = ((code >> 8) - 0x81) * 0xBC; + trail = code & 0xFF; + + if (!IsSjisTrailByte(trail)) { + return 0; + } + + trail -= 0x40; + if (trail >= 0x40) { + trail--; + } + + return Zenkaku2Code[tmp + trail]; + } + } else if (code > 0x20 && code <= 0xFF) { + return code - 0x20; + } + + return 0; +} + +// 'Yay0' decompression (See YAGCD sections 16.1.1, 16.1.2) +static void Decode(u8* src, u8* dst) { + int j; + s32 linkOfs; + s32 chunkPos; + int i; + s32 chunksOfs; + u32 maskTblPos; + s32 expandSize; + s32 linkTblOfs; + s32 count; + u32 maskBits; + u32 mask; + + expandSize = *(s32*)(src + 0x4); + linkTblOfs = *(s32*)(src + 0x8); + chunksOfs = *(s32*)(src + 0xC); + + i = 0; + maskBits = 0; + maskTblPos = 16; + + do { + // Get next mask + if (maskBits == 0) { + mask = *(u32*)(src + maskTblPos); + maskTblPos += sizeof(u32); + maskBits = sizeof(u32) * 8; + } + + // Non-linked chunk + if (mask & 0x80000000) { + dst[i++] = src[chunksOfs++]; + } + // Linked chunk + else { + // Read offset from link table + linkOfs = src[linkTblOfs] << 8 | src[linkTblOfs + 1]; + linkTblOfs += sizeof(u16); + + // Apply offset + chunkPos = i - (linkOfs & 0x0FFF); + count = linkOfs >> 12; + if (count == 0) { + count = src[chunksOfs++] + 0x12; + } else { + count += 2; + } + + // Copy chunk + for (j = 0; j < count; j++, i++, chunkPos++) { + dst[i] = dst[chunkPos - 1]; + } + } + + // Prepare next mask bit + mask <<= 1; + maskBits--; + } while (i < expandSize); +} + +static u32 GetFontSize(const u8* font) { + if (font[0] == 'Y' && font[1] == 'a' && font[2] == 'y') { + return *(u32*)(font + 0x4); + } + + return 0; +} + +u16 OSGetFontEncode(void) { + if (FontEncode != 0xFFFF) { + return FontEncode; + } + + switch (*(u32*)OSPhysicalToCached(OS_PHYS_TV_FORMAT)) { + case VI_TV_FMT_NTSC: + FontEncode = ((VI_HW_REGS[VI_VISEL] & 2) != 0) ? OS_FONT_ENCODE_SJIS + : OS_FONT_ENCODE_ANSI; + break; + case VI_TV_FMT_PAL: + case VI_TV_FMT_MPAL: + case VI_TV_FMT_DEBUG: + case VI_TV_FMT_DEBUG_PAL: + case VI_TV_FMT_EURGB60: + default: + FontEncode = OS_FONT_ENCODE_ANSI; + } + + ParseString = ParseStringS; + + return FontEncode; +} + +u16 OSSetFontEncode(u16 encode) { + u16 old = OSGetFontEncode(); + + if (encode <= OS_FONT_ENCODE_UTF32) { + FontEncode = encode; + + if (encode >= OS_FONT_ENCODE_UTF8 && encode <= OS_FONT_ENCODE_UTF32) { + ParseString = ParseStringW; + } + } + + return old; +} + +static void ReadROM(void* dst, s32 size, const void* src) { + s32 blockSize; + + while (size > 0) { + blockSize = (size <= 256) ? size : 256; + size -= blockSize; + + while (!__OSReadROM(dst, blockSize, src)) { + ; + } + + src = (u8*)src + blockSize; + dst = (u8*)dst + blockSize; + } +} + +static u32 ReadFont(void* dst, u16 encode, OSFontHeader* font) { + u8* tex; + int i; + u32 code; + u32 size; + s32 sheet; + s32 numRestTex; + s32 row; + s32 col; + u8* tmp; + + if (encode == OS_FONT_ENCODE_SJIS) { + ReadROM(dst, ROM_FONT_SJIS_SIZE, ROM_FONT_SJIS_START); + } else { + ReadROM(dst, ROM_FONT_ANSI_SIZE, ROM_FONT_ANSI_START); + } + + size = GetFontSize(dst); + if (size == 0) { + return 0; + } + + Decode(dst, (u8*)font); + + if (encode == OS_FONT_ENCODE_SJIS) { + u16 sp28[] = {0x2ABE, 0x003D, 0x003D, 0x003D}; + + /** + * Find 'T' texture (See OSGetFontTexture) + */ + code = GetFontCode(encode, 'T'); + // Font sheet on which the texture resides + sheet = (s32)code / (font->sheetNumCol * font->sheetNumRow); + // Number of succeeding textures on the sheet + numRestTex = code - (sheet * (font->sheetNumCol * font->sheetNumRow)); + // Texture position on sheet + row = numRestTex / font->sheetNumCol; + col = numRestTex - row * font->sheetNumCol; + // Texture position + row *= font->cellHeight; + col *= font->cellWidth; + // Font code texture + tex = (u8*)font + font->sheetImageOfs; + tex += sheet * font->sheetSize / 2; + + // Editing the texture at runtime? + for (i = 4; i < 8; i++) { + tmp = tex + (((font->sheetWidth / 8) * 32) / 2) * ((row + i) / 8); + tmp += (col / 8) * 16; + tmp += ((row + i) % 8) * 2; + tmp += (col % 8) / 4; + *(u16*)tmp = sp28[i - 4]; + } + } + + return size; +} + +u32 OSLoadFont(OSFontHeader* font, void* dst) { + u32 size; + + switch (OSGetFontEncode()) { + case OS_FONT_ENCODE_ANSI: + FontDataAnsi = font; + size = ReadFont(dst, OS_FONT_ENCODE_ANSI, FontDataAnsi); + break; + case OS_FONT_ENCODE_SJIS: + FontDataSjis = font; + size = ReadFont(dst, OS_FONT_ENCODE_SJIS, FontDataSjis); + break; + case OS_FONT_ENCODE_UTF8: + case OS_FONT_ENCODE_UTF16: + case OS_FONT_ENCODE_UTF32: + FontDataAnsi = font; + size = ReadFont(dst, OS_FONT_ENCODE_ANSI, FontDataAnsi); + if (size == 0) { + break; + } + + FontDataSjis = (OSFontHeader*)((u8*)FontDataAnsi + size); + size += ReadFont(dst, OS_FONT_ENCODE_SJIS, FontDataSjis); + break; + case OS_FONT_ENCODE_2: + default: + size = 0; + break; + } + + return size; +} + +static const u8* ParseStringS(u16 encode, const u8* str, OSFontHeader** fontOut, + u32* codeOut) { + OSFontHeader* font; + u16 code = 0; + + switch (encode) { + case OS_FONT_ENCODE_ANSI: + font = FontDataAnsi; + code = *str; + if (code != 0) { + str++; + } + break; + case OS_FONT_ENCODE_SJIS: + font = FontDataSjis; + code = *str; + if (code == 0) { + break; + } + str++; + + if (IsSjisLeadByte(code) && IsSjisTrailByte(*str)) { + code = (code << 8 | *str++); + } + break; + } + + *fontOut = font; + *codeOut = GetFontCode(encode, code); + + return str; +} + +static const u8* ParseStringW(u16 encode, const u8* str, OSFontHeader** fontOut, + u32* codeOut) { + OSFontHeader* font; + u16 code = 0; + u32 utf32 = 0; + + switch (encode) { + case OS_FONT_ENCODE_ANSI: + font = FontDataAnsi; + code = *str; + if (code != 0) { + str++; + } + break; + case OS_FONT_ENCODE_SJIS: + font = FontDataSjis; + code = *str; + if (code == 0) { + break; + } + str++; + + if (IsSjisLeadByte(code) && IsSjisTrailByte(*str)) { + code = (code << 8 | *str++); + } + break; + case OS_FONT_ENCODE_UTF8: + str = OSUTF8to32(str, &utf32); + break; + case OS_FONT_ENCODE_UTF16: + str = (const u8*)OSUTF16to32((const u16*)str, &utf32); + break; + case OS_FONT_ENCODE_UTF32: + utf32 = *(u32*)str; + if (utf32 != 0) { + str += sizeof(u32); + } + break; + } + + if (utf32 != 0) { + encode = OS_FONT_ENCODE_ANSI; + font = FontDataAnsi; + code = OSUTF32toANSI(utf32); + + if (code == 0 || (FixedPitch && utf32 <= 0x7F)) { + code = OSUTF32toSJIS(utf32); + if (code != 0) { + encode = OS_FONT_ENCODE_SJIS; + font = FontDataSjis; + } + } + } + + *fontOut = font; + *codeOut = GetFontCode(encode, code); + + return str; +} + +const char* OSGetFontTexel(const char* str, void* dst, s32 xOfs, s32 arg3, + u32* widthOut) { + OSFontHeader* font; + s32 numRestTex; + u8* local_24; + s32 row; + u8* local_20; + s32 col; + s32 local_48; + u32 code; + int j; + int i; + u32 sheet; + u8* local_4C; + u8* font_u8; + u8* tex; + s32 local_44; + + str = (const char*)ParseString(OSGetFontEncode(), (const u8*)str, &font, + &code); + local_4C = &font->c0; + + /** + * Find font code texture (See OSGetFontTexture) + */ + // Font sheet on which the texture resides + sheet = (s32)code / (font->sheetNumCol * font->sheetNumRow); + // Number of succeeding textures on the sheet + numRestTex = code - (sheet * (font->sheetNumCol * font->sheetNumRow)); + // Texture position on sheet + row = numRestTex / font->sheetNumCol; + col = numRestTex - row * font->sheetNumCol; + // Texture position + row *= font->cellHeight; + col *= font->cellWidth; + // Font code texture + tex = (u8*)font + font->sheetImageOfs; + tex += sheet * font->sheetSize / 2; + + for (i = 0; i < font->cellHeight; i++) { + for (j = 0; j < font->cellWidth; j++) { + local_20 = + tex + (((font->sheetWidth / 8) * 32) / 2) * ((row + i) / 8); + local_20 += ((col + j) / 8) * 16; + local_20 += ((row + i) % 8) * 2; + local_20 += ((col + j) % 8) / 4; + + local_44 = (col + j) % 4; + + local_24 = (u8*)dst + ((i / 8) * (((arg3 * 4) / 8) * 32)); + local_24 += (((xOfs + j) / 8) * 32); + local_24 += ((i % 8) * 4); + local_24 += ((xOfs + j) % 8) / 2; + + local_48 = (xOfs + j) % 2; + + *local_24 |= + (u8)(local_4C[(*local_20 >> (6 - (local_44 * 2))) & 3] & + (local_48 != 0 ? 0x0F : 0xF0)); + } + } + + if (widthOut != NULL) { + // TODO: Permuter fake(?)match + font_u8 = (u8*)font; + *widthOut = (font_u8 + font->widthTableOfs)[code]; + } + + return str; +} + +static void ExpandFontSheet(const OSFontHeader* font, u8* src, u8* dst) { + int i; + const u8* tmp = &font->c0; + + if (font->sheetFormat == GX_TF_I4) { + for (i = (s32)font->sheetFullSize / 2 - 1; i >= 0; i--) { + dst[i * 2 + 0] = + tmp[src[i] >> 6 & 3] & 0xF0 | tmp[src[i] >> 4 & 3] & 0x0F; + dst[i * 2 + 1] = + tmp[src[i] >> 2 & 3] & 0xF0 | tmp[src[i] >> 0 & 3] & 0x0F; + } + } else if (font->sheetFormat == GX_TF_IA4) { + for (i = (s32)font->sheetFullSize / 4 - 1; i >= 0; i--) { + dst[i * 4 + 0] = tmp[src[i] >> 6 & 3]; + dst[i * 4 + 1] = tmp[src[i] >> 4 & 3]; + dst[i * 4 + 2] = tmp[src[i] >> 2 & 3]; + dst[i * 4 + 3] = tmp[src[i] >> 0 & 3]; + } + } + + DCStoreRange(dst, font->sheetFullSize); +} + +BOOL OSInitFont(OSFontHeader* font) { + u8* sheets; + + switch (OSGetFontEncode()) { + case OS_FONT_ENCODE_ANSI: + FontDataAnsi = font; + if (ReadFont((u8*)font + 0x1D120, OS_FONT_ENCODE_ANSI, FontDataAnsi) == + 0) { + return FALSE; + } + + sheets = (u8*)FontDataAnsi + FontDataAnsi->sheetImageOfs; + FontDataAnsi->sheetImageOfs = ROUND_UP(FontDataAnsi->sheetImageOfs, 32); + ExpandFontSheet(FontDataAnsi, sheets, + (u8*)FontDataAnsi + FontDataAnsi->sheetImageOfs); + break; + case OS_FONT_ENCODE_SJIS: + FontDataSjis = font; + if (ReadFont((u8*)font + 0xD3F00, OS_FONT_ENCODE_SJIS, FontDataSjis) == + 0) { + return FALSE; + } + + sheets = (u8*)FontDataSjis + FontDataSjis->sheetImageOfs; + FontDataSjis->sheetImageOfs = ROUND_UP(FontDataSjis->sheetImageOfs, 32); + ExpandFontSheet(FontDataSjis, sheets, + (u8*)FontDataSjis + FontDataSjis->sheetImageOfs); + break; + case OS_FONT_ENCODE_2: + break; + case OS_FONT_ENCODE_UTF8: + case OS_FONT_ENCODE_UTF16: + case OS_FONT_ENCODE_UTF32: + FontDataAnsi = font; + if (ReadFont((u8*)font + 0xF4020, OS_FONT_ENCODE_ANSI, FontDataAnsi) == + 0) { + return FALSE; + } + + sheets = (u8*)FontDataAnsi + FontDataAnsi->sheetImageOfs; + FontDataAnsi->sheetImageOfs = ROUND_UP(FontDataAnsi->sheetImageOfs, 32); + ExpandFontSheet(FontDataAnsi, sheets, + (u8*)FontDataAnsi + FontDataAnsi->sheetImageOfs); + + FontDataSjis = (OSFontHeader*)((u8*)FontDataAnsi + 0x20120); + if (ReadFont((u8*)font + 0xF4020, OS_FONT_ENCODE_SJIS, FontDataSjis) == + 0) { + return FALSE; + } + + sheets = (u8*)FontDataSjis + FontDataSjis->sheetImageOfs; + FontDataSjis->sheetImageOfs = ROUND_UP(FontDataSjis->sheetImageOfs, 32); + ExpandFontSheet(FontDataSjis, sheets, + (u8*)FontDataSjis + FontDataSjis->sheetImageOfs); + break; + } + + return TRUE; +} + +const char* OSGetFontTexture(const char* str, void** texOut, u32* xOut, + u32* yOut, u32* widthOut) { + OSFontHeader* font; + s32 numRestTex; + u8* font_u8; + u32 code; + u32 sheet; + u32 row; + u32 col; + u32 tmp; + + str = (const char*)ParseString(OSGetFontEncode(), (const u8*)str, &font, + &code); + + // Font sheet on which the texture resides + sheet = (s32)code / (font->sheetNumCol * font->sheetNumRow); + // Font code texture + *texOut = (font->sheetSize * sheet) + ((u8*)font + font->sheetImageOfs); + + // Number of succeeding textures on the sheet + // TODO: Permuter fake(?)match + tmp = font->sheetNumRow; + numRestTex = code - (sheet * (font->sheetNumCol * tmp)); + + // Sheet row on which the texure resides + row = numRestTex / font->sheetNumCol; + // Sheet column on which the texture resides + col = numRestTex - row * font->sheetNumCol; + + // Texture position + *xOut = col * font->cellWidth; + *yOut = row * font->cellHeight; + + if (widthOut != NULL) { + // TODO: Permuter fake(?)match + font_u8 = (u8*)font; + *widthOut = (font_u8 + font->widthTableOfs)[code]; + } + + return str; +} + +const char* OSGetFontWidth(const char* str, u32* widthOut) { + OSFontHeader* font; + u8* font_u8; + u32 code; + + str = (const char*)ParseString(OSGetFontEncode(), (const u8*)str, &font, + &code); + + if (widthOut != NULL) { + // TODO: Permuter fake(?)match + font_u8 = (u8*)font; + *widthOut = (font_u8 + font->widthTableOfs)[code]; + } + + return str; +} + +static u16 HankakuToCode[] = { + 0x020C, 0x020D, 0x020E, 0x020F, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, + 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021A, 0x021B, 0x021C, 0x021D, + 0x021E, 0x021F, 0x0220, 0x0221, 0x0222, 0x0223, 0x0224, 0x0225, 0x0226, + 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, + 0x0230, 0x0231, 0x0232, 0x0233, 0x0234, 0x0235, 0x0236, 0x0237, 0x0238, + 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x023F, 0x0240, 0x0241, + 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0249, 0x024A, + 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, + 0x0254, 0x0255, 0x0256, 0x0257, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, + 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264, 0x0265, + 0x0266, 0x0267, 0x0268, 0x0269, 0x026A, 0x020C, 0x020C, 0x020C, 0x020C, + 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, + 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, + 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, 0x020C, + 0x020C, 0x020C, 0x020C, 0x026B, 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, + 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, + 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0282, + 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, + 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291, 0x0292, 0x0293, 0x0294, + 0x0295, 0x0296, 0x0297, 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, + 0x029E, 0x029F, 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4, 0x02A5, 0x02A6, + 0x02A7, 0x02A8, 0x02A9}; + +static u16 Zenkaku2Code[] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, + 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, + 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, + 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, + 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, + 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, + 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, + 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, + 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, + 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, + 0x0073, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, 0x0080, 0x0081, 0x0082, 0x0083, + 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, + 0x008F, 0x0090, 0x0091, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0093, 0x0094, 0x0095, 0x0096, + 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, + 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, + 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, + 0x00B4, 0x00B5, 0x00B6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, + 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, + 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, + 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, + 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, + 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, + 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, + 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, + 0x010D, 0x010E, 0x010F, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, + 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, + 0x011F, 0x0120, 0x0121, 0x0122, 0x0123, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0125, + 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, + 0x012F, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, 0x0137, + 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x013F, 0x0140, + 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, + 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, 0x0150, 0x0151, 0x0152, + 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, + 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, + 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, + 0x016E, 0x016F, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, 0x0176, + 0x0177, 0x0178, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, + 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, + 0x018A, 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0193, + 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, + 0x019D, 0x019E, 0x019F, 0x01A0, 0x01A1, 0x01A2, 0x01A3, 0x01A4, 0x01A5, + 0x01A6, 0x01A7, 0x01A8, 0x01A9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01AA, 0x01AB, 0x01AC, + 0x01AD, 0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, + 0x01B6, 0x01B7, 0x01B8, 0x01B9, 0x01BA, 0x01BB, 0x01BC, 0x01BD, 0x01BE, + 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, + 0x01C8, 0x01C9, 0x01CA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, + 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DB, 0x01DC, + 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, + 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA, 0x01EB, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x01EC, 0x01ED, 0x01EE, 0x01EF, 0x01F0, 0x01F1, 0x01F2, 0x01F3, + 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, + 0x01FD, 0x01FE, 0x01FF, 0x0200, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, + 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x020C, 0x020D, 0x020E, 0x020F, 0x0210, + 0x0211, 0x0212, 0x0213, 0x0214, 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, + 0x021A, 0x021B, 0x021C, 0x021D, 0x021E, 0x021F, 0x0220, 0x0221, 0x0222, + 0x0223, 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, + 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0231, 0x0232, 0x0233, 0x0234, + 0x0235, 0x0236, 0x0237, 0x0238, 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, + 0x023E, 0x023F, 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, + 0x0247, 0x0248, 0x0249, 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, + 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0258, + 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, + 0x0262, 0x0263, 0x0264, 0x0265, 0x0266, 0x0267, 0x0268, 0x0269, 0x026A, + 0x026B, 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, 0x0271, 0x0272, 0x0273, + 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, + 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, + 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, + 0x028F, 0x0290, 0x0291, 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, + 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x02A0, + 0x02A1, 0x02A2, 0x02A3, 0x02A4, 0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, + 0x02AA, 0x02AB, 0x02AC, 0x02AD, 0x02AE, 0x02AF, 0x02B0, 0x02B1, 0x02B2, + 0x02B3, 0x02B4, 0x02B5, 0x02B6, 0x02B7, 0x02B8, 0x02B9, 0x02BA, 0x02BB, + 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, + 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, + 0x02CF, 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, + 0x02D8, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x02DE, 0x02DF, 0x02E0, + 0x02E1, 0x02E2, 0x02E3, 0x02E4, 0x02E5, 0x02E6, 0x0000, 0x02E7, 0x02E8, + 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, + 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7, 0x02F8, 0x02F9, 0x02FA, + 0x02FB, 0x02FC, 0x02FD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x02FE, 0x02FF, 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, + 0x0305, 0x0306, 0x0307, 0x0308, 0x0309, 0x030A, 0x030B, 0x030C, 0x030D, + 0x030E, 0x030F, 0x0310, 0x0311, 0x0312, 0x0313, 0x0314, 0x0315, 0x0316, + 0x0317, 0x0318, 0x0319, 0x031A, 0x031B, 0x0000}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSInterrupt.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSInterrupt.c new file mode 100644 index 0000000000..a33df5b746 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSInterrupt.c @@ -0,0 +1,559 @@ +#include +#include +#include +#include +#include +#include + +static OSInterruptHandler* InterruptHandlerTable; +s64 __OSLastInterruptTime; +s16 __OSLastInterrupt; +u32 __OSLastInterruptSrr0; + +static u32 InterruptPrioTable[] = { + 0x00000100, 0x00000040, 0xF8000000, 0x00000200, 0x00000080, 0x00000010, + 0x00003000, 0x00000020, 0x03FF8C00, 0x04000000, 0x00004000, 0xFFFFFFFF}; + +static void ExternalInterruptHandler(u8 type, OSContext* ctx); + +asm BOOL OSDisableInterrupts(void) { + // clang-format off + nofralloc + + entry __RAS_OSDisableInterrupts_begin + + mfmsr r3 + // Clear external interrupts bit + rlwinm r4, r3, 0, 17, 15 + mtmsr r4 + + entry __RAS_OSDisableInterrupts_end + + // Return old interrupt status + rlwinm r3, r3, 17, 31, 31 + blr + // clang-format on +} + +asm BOOL OSEnableInterrupts(void) { + // clang-format off + nofralloc + + mfmsr r3 + // Set external interrupts bit + ori r4, r3, MSR_EE + mtmsr r4 + + // Return old interrupt status + rlwinm r3, r3, 17, 31, 31 + blr + // clang-format on +} + +asm BOOL OSRestoreInterrupts(register BOOL status){ + // clang-format off + nofralloc + + cmpwi status, 0 + mfmsr r4 + beq disable + + // Set external interrupts bit + ori r5, r4, MSR_EE + b set_msr + +disable: + // Clear external interrupts bit + rlwinm r5, r4, 0, 17, 15 + +set_msr: + mtmsr r5 + // Return old interrupt status + rlwinm r3, r4, 17, 31, 31 + blr + // clang-format on +} + +OSInterruptHandler + __OSSetInterruptHandler(OSInterruptType type, OSInterruptHandler handler) { + OSInterruptHandler old = InterruptHandlerTable[type]; + InterruptHandlerTable[type] = handler; + return old; +} + +OSInterruptHandler __OSGetInterruptHandler(OSInterruptType type) { + return InterruptHandlerTable[type]; +} + +void __OSInterruptInit(void) { + InterruptHandlerTable = + (OSInterruptHandler*)OSPhysicalToCached(OS_PHYS_INTR_HANDLER_TABLE); + memset(InterruptHandlerTable, 0, sizeof(OSInterruptHandler) * OS_INTR_MAX); + + *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) = 0; + *(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK) = 0; + + PI_HW_REGS[PI_INTMR] = + PI_INTMR_EXI | PI_INTMR_AI | PI_INTMR_DSP | PI_INTMR_MEM; + OS_UNK_CD000034 = 0x40000000; + + __OSMaskInterrupts( + OS_INTR_MASK(OS_INTR_MEM_0) | OS_INTR_MASK(OS_INTR_MEM_1) | + OS_INTR_MASK(OS_INTR_MEM_2) | OS_INTR_MASK(OS_INTR_MEM_3) | + OS_INTR_MASK(OS_INTR_MEM_ADDRESS) | OS_INTR_MASK(OS_INTR_DSP_AI) | + OS_INTR_MASK(OS_INTR_DSP_ARAM) | OS_INTR_MASK(OS_INTR_DSP_DSP) | + OS_INTR_MASK(OS_INTR_AI_AI) | OS_INTR_MASK(OS_INTR_EXI_0_EXI) | + OS_INTR_MASK(OS_INTR_EXI_0_TC) | OS_INTR_MASK(OS_INTR_EXI_0_EXT) | + OS_INTR_MASK(OS_INTR_EXI_1_EXI) | OS_INTR_MASK(OS_INTR_EXI_1_TC) | + OS_INTR_MASK(OS_INTR_EXI_1_EXT) | OS_INTR_MASK(OS_INTR_EXI_2_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_TC) | OS_INTR_MASK(OS_INTR_PI_CP) | + OS_INTR_MASK(OS_INTR_PI_PE_TOKEN) | OS_INTR_MASK(OS_INTR_PI_PE_FINISH) | + OS_INTR_MASK(OS_INTR_PI_SI) | OS_INTR_MASK(OS_INTR_PI_DI) | + OS_INTR_MASK(OS_INTR_PI_RSW) | OS_INTR_MASK(OS_INTR_PI_ERROR) | + OS_INTR_MASK(OS_INTR_PI_VI) | OS_INTR_MASK(OS_INTR_PI_DEBUG) | + OS_INTR_MASK(OS_INTR_PI_HSP) | OS_INTR_MASK(OS_INTR_PI_ACR)); + + __OSSetExceptionHandler(OS_ERR_EXT_INTERRUPT, ExternalInterruptHandler); +} + +static u32 SetInterruptMask(u32 type, u32 mask) { + u32 miMask; + u32 dspMask; + u32 aiMask; + u32 exi0Mask, exi1Mask, exi2Mask; + u32 piMask; + + switch (__cntlzw(type)) { + /** + * MEM interrupts + */ + case OS_INTR_MEM_0: + case OS_INTR_MEM_1: + case OS_INTR_MEM_2: + case OS_INTR_MEM_3: + case OS_INTR_MEM_ADDRESS: + miMask = 0; + + if (!(mask & OS_INTR_MASK(OS_INTR_MEM_0))) { + miMask |= MI_INTMR_MEM0; + } + if (!(mask & OS_INTR_MASK(OS_INTR_MEM_1))) { + miMask |= MI_INTMR_MEM1; + } + if (!(mask & OS_INTR_MASK(OS_INTR_MEM_2))) { + miMask |= MI_INTMR_MEM2; + } + if (!(mask & OS_INTR_MASK(OS_INTR_MEM_3))) { + miMask |= MI_INTMR_MEM3; + } + if (!(mask & OS_INTR_MASK(OS_INTR_MEM_ADDRESS))) { + miMask |= MI_INTMR_ADDR; + } + + MI_HW_REGS[MI_INTMR] = miMask; + return type & + ~(OS_INTR_MASK(OS_INTR_MEM_0) | OS_INTR_MASK(OS_INTR_MEM_1) | + OS_INTR_MASK(OS_INTR_MEM_2) | OS_INTR_MASK(OS_INTR_MEM_3) | + OS_INTR_MASK(OS_INTR_MEM_ADDRESS)); + /** + * DSP interrupts + */ + case OS_INTR_DSP_AI: + case OS_INTR_DSP_ARAM: + case OS_INTR_DSP_DSP: + dspMask = DSP_HW_REGS[DSP_CSR]; + dspMask &= ~(DSP_CSR_AIDINT | DSP_CSR_AIDINTMSK | DSP_CSR_ARINT | + DSP_CSR_ARINTMSK | DSP_CSR_DSPINT | DSP_CSR_DSPINTMSK); + + if (!(mask & OS_INTR_MASK(OS_INTR_DSP_AI))) { + dspMask |= DSP_CSR_AIDINTMSK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_DSP_ARAM))) { + dspMask |= DSP_CSR_ARINTMSK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_DSP_DSP))) { + dspMask |= DSP_CSR_DSPINTMSK; + } + + DSP_HW_REGS[DSP_CSR] = dspMask; + return type & + ~(OS_INTR_MASK(OS_INTR_DSP_AI) | OS_INTR_MASK(OS_INTR_DSP_ARAM) | + OS_INTR_MASK(OS_INTR_DSP_DSP)); + /** + * AI interrupts + */ + case OS_INTR_AI_AI: + aiMask = AI_HW_REGS[AI_AICR]; + aiMask &= ~(AI_AICR_AIINTMSK | AI_AICR_AIINT | AI_AICR_SCRESET); + + if (!(mask & OS_INTR_MASK(OS_INTR_AI_AI))) { + aiMask |= AI_AICR_AIINTMSK; + } + + AI_HW_REGS[AI_AICR] = aiMask; + return type & ~OS_INTR_MASK(OS_INTR_AI_AI); + /** + * EXI interrupts (Channel 0) + */ + case OS_INTR_EXI_0_EXI: + case OS_INTR_EXI_0_TC: + case OS_INTR_EXI_0_EXT: + exi0Mask = EXI_CHAN_PARAMS[EXI_CHAN_0].cpr; + exi0Mask &= ~(EXI_CPR_EXIINTMASK | EXI_CPR_EXIINT | EXI_CPR_TCINTMASK | + EXI_CPR_TCINT | EXI_CPR_EXTINTMASK | EXI_CPR_EXTINT | + EXI_CPR_ROMDIS); + + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_0_EXI))) { + exi0Mask |= EXI_CPR_EXIINTMASK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_0_TC))) { + exi0Mask |= EXI_CPR_TCINTMASK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_0_EXT))) { + exi0Mask |= EXI_CPR_EXTINTMASK; + } + + EXI_CHAN_PARAMS[EXI_CHAN_0].cpr = exi0Mask; + return type & ~(OS_INTR_MASK(OS_INTR_EXI_0_EXI) | + OS_INTR_MASK(OS_INTR_EXI_0_TC) | + OS_INTR_MASK(OS_INTR_EXI_0_EXT)); + /** + * EXI interrupts (Channel 1) + */ + case OS_INTR_EXI_1_EXI: + case OS_INTR_EXI_1_TC: + case OS_INTR_EXI_1_EXT: + exi1Mask = EXI_CHAN_PARAMS[EXI_CHAN_1].cpr; + exi1Mask &= ~(EXI_CPR_EXIINTMASK | EXI_CPR_EXIINT | EXI_CPR_TCINTMASK | + EXI_CPR_TCINT | EXI_CPR_EXTINTMASK | EXI_CPR_EXTINT); + + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_1_EXI))) { + exi1Mask |= EXI_CPR_EXIINTMASK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_1_TC))) { + exi1Mask |= EXI_CPR_TCINTMASK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_1_EXT))) { + exi1Mask |= EXI_CPR_EXTINTMASK; + } + + EXI_CHAN_PARAMS[EXI_CHAN_1].cpr = exi1Mask; + return type & ~(OS_INTR_MASK(OS_INTR_EXI_1_EXI) | + OS_INTR_MASK(OS_INTR_EXI_1_TC) | + OS_INTR_MASK(OS_INTR_EXI_1_EXT)); + /** + * EXI interrupts (Channel 2) + */ + case OS_INTR_EXI_2_EXI: + case OS_INTR_EXI_2_TC: + exi2Mask = EXI_CHAN_PARAMS[EXI_CHAN_2].cpr; + exi2Mask &= ~(EXI_CPR_EXIINTMASK | EXI_CPR_EXIINT | EXI_CPR_TCINTMASK | + EXI_CPR_TCINT); + + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_2_EXI))) { + exi2Mask |= EXI_CPR_EXIINTMASK; + } + if (!(mask & OS_INTR_MASK(OS_INTR_EXI_2_TC))) { + exi2Mask |= EXI_CPR_TCINTMASK; + } + + EXI_CHAN_PARAMS[EXI_CHAN_2].cpr = exi2Mask; + return type & ~(OS_INTR_MASK(OS_INTR_EXI_2_EXI) | + OS_INTR_MASK(OS_INTR_EXI_2_TC)); + /** + * PI interrupts + */ + case OS_INTR_PI_CP: + case OS_INTR_PI_PE_TOKEN: + case OS_INTR_PI_PE_FINISH: + case OS_INTR_PI_SI: + case OS_INTR_PI_DI: + case OS_INTR_PI_RSW: + case OS_INTR_PI_ERROR: + case OS_INTR_PI_VI: + case OS_INTR_PI_DEBUG: + case OS_INTR_PI_HSP: + case OS_INTR_PI_ACR: + piMask = PI_INTMR_EXI | PI_INTMR_AI | PI_INTMR_DSP | PI_INTMR_MEM; + + if (!(mask & OS_INTR_MASK(OS_INTR_PI_CP))) { + piMask |= PI_INTMR_CP; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_SI))) { + piMask |= PI_INTMR_SI; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_DI))) { + piMask |= PI_INTMR_DI; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_RSW))) { + piMask |= PI_INTMR_RSW; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_ERROR))) { + piMask |= PI_INTMR_ERROR; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_VI))) { + piMask |= PI_INTMR_VI; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_DEBUG))) { + piMask |= PI_INTMR_DEBUG; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_PE_TOKEN))) { + piMask |= PI_INTMR_PE_TOKEN; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_PE_FINISH))) { + piMask |= PI_INTMR_PE_FINISH; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_HSP))) { + piMask |= PI_INTMR_HSP; + } + if (!(mask & OS_INTR_MASK(OS_INTR_PI_ACR))) { + piMask |= PI_INTMR_ACR; + } + + PI_HW_REGS[PI_INTMR] = piMask; + return type & + ~(OS_INTR_MASK(OS_INTR_PI_CP) | + OS_INTR_MASK(OS_INTR_PI_PE_TOKEN) | + OS_INTR_MASK(OS_INTR_PI_PE_FINISH) | + OS_INTR_MASK(OS_INTR_PI_SI) | OS_INTR_MASK(OS_INTR_PI_DI) | + OS_INTR_MASK(OS_INTR_PI_RSW) | OS_INTR_MASK(OS_INTR_PI_ERROR) | + OS_INTR_MASK(OS_INTR_PI_VI) | OS_INTR_MASK(OS_INTR_PI_DEBUG) | + OS_INTR_MASK(OS_INTR_PI_HSP) | OS_INTR_MASK(OS_INTR_PI_ACR)); + default: + return type; + } +} + +u32 __OSMaskInterrupts(u32 userMask) { + BOOL enabled = OSDisableInterrupts(); + u32 prevMask = *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK); + u32 currMask = *(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK); + + u32 workMask = userMask & ~(prevMask | currMask); + userMask = prevMask | userMask; + *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) = userMask; + + while (workMask != 0) { + workMask = SetInterruptMask(workMask, userMask | currMask); + } + + OSRestoreInterrupts(enabled); + return prevMask; +} + +u32 __OSUnmaskInterrupts(u32 userMask) { + BOOL enabled = OSDisableInterrupts(); + u32 prevMask = *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK); + u32 currMask = *(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK); + + u32 workMask = userMask & (prevMask | currMask); + userMask = prevMask & ~userMask; + *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) = userMask; + + while (workMask != 0) { + workMask = SetInterruptMask(workMask, userMask | currMask); + } + + OSRestoreInterrupts(enabled); + return prevMask; +} + +void __OSDispatchInterrupt(u8 intr, OSContext* ctx) { + u32 intsr; + u32 mask, newMask; + u32 miCause; + u32 dspCause; + u32 exi0Cause, exi1Cause, exi2Cause; + u32 piMask; + + intsr = PI_HW_REGS[PI_INTSR]; + intsr &= ~PI_INTSR_RSWST; + + piMask = PI_HW_REGS[PI_INTMR]; + if (intsr == 0 || !(intsr & piMask)) { + OSLoadContext(ctx); + } + + mask = 0; + newMask = 0; + + /** + * MEM interrupts + */ + if (intsr & PI_INTMR_MEM) { + miCause = MI_HW_REGS[MI_INTSR]; + if (miCause & MI_INTSR_MEM0) { + mask |= OS_INTR_MASK(OS_INTR_MEM_0); + } + if (miCause & MI_INTSR_MEM1) { + mask |= OS_INTR_MASK(OS_INTR_MEM_1); + } + if (miCause & MI_INTSR_MEM2) { + mask |= OS_INTR_MASK(OS_INTR_MEM_2); + } + if (miCause & MI_INTSR_MEM3) { + mask |= OS_INTR_MASK(OS_INTR_MEM_3); + } + if (miCause & MI_INTSR_ADDR) { + mask |= OS_INTR_MASK(OS_INTR_MEM_ADDRESS); + } + } + + /** + * DSP interrupts + */ + if (intsr & PI_INTSR_DSP) { + dspCause = DSP_HW_REGS[DSP_CSR]; + if (dspCause & DSP_CSR_AIDINT) { + mask |= OS_INTR_MASK(OS_INTR_DSP_AI); + } + if (dspCause & DSP_CSR_ARINT) { + mask |= OS_INTR_MASK(OS_INTR_DSP_ARAM); + } + if (dspCause & DSP_CSR_DSPINT) { + mask |= OS_INTR_MASK(OS_INTR_DSP_DSP); + } + } + + /** + * AI interrupts + */ + if ((intsr & PI_INTSR_AI) && (AI_HW_REGS[AI_AICR] & AI_AICR_AIINT)) { + mask |= OS_INTR_MASK(OS_INTR_AI_AI); + } + + /** + * EXI interrupts + */ + if (intsr & PI_INTSR_EXI) { + exi0Cause = EXI_CHAN_PARAMS[EXI_CHAN_0].cpr; + if (exi0Cause & EXI_CPR_EXIINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_0_EXI); + } + if (exi0Cause & EXI_CPR_TCINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_0_TC); + } + if (exi0Cause & EXI_CPR_EXTINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_0_EXT); + } + + exi1Cause = EXI_CHAN_PARAMS[EXI_CHAN_1].cpr; + if (exi1Cause & EXI_CPR_EXIINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_1_EXI); + } + if (exi1Cause & EXI_CPR_TCINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_1_TC); + } + if (exi1Cause & EXI_CPR_EXTINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_1_EXT); + } + + exi2Cause = EXI_CHAN_PARAMS[EXI_CHAN_2].cpr; + if (exi2Cause & EXI_CPR_EXIINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_2_EXI); + } + if (exi2Cause & EXI_CPR_TCINT) { + mask |= OS_INTR_MASK(OS_INTR_EXI_2_TC); + } + } + + /** + * PI interrupts + */ + if (intsr & PI_INTSR_HSP) { + mask |= OS_INTR_MASK(OS_INTR_PI_HSP); + } + if (intsr & PI_INTSR_DEBUG) { + mask |= OS_INTR_MASK(OS_INTR_PI_DEBUG); + } + if (intsr & PI_INTSR_PE_FINISH) { + mask |= OS_INTR_MASK(OS_INTR_PI_PE_FINISH); + } + if (intsr & PI_INTSR_PE_TOKEN) { + mask |= OS_INTR_MASK(OS_INTR_PI_PE_TOKEN); + } + if (intsr & PI_INTSR_VI) { + mask |= OS_INTR_MASK(OS_INTR_PI_VI); + } + if (intsr & PI_INTSR_SI) { + mask |= OS_INTR_MASK(OS_INTR_PI_SI); + } + if (intsr & PI_INTSR_DI) { + mask |= OS_INTR_MASK(OS_INTR_PI_DI); + } + if (intsr & PI_INTSR_RSW) { + mask |= OS_INTR_MASK(OS_INTR_PI_RSW); + } + if (intsr & PI_INTSR_CP) { + mask |= OS_INTR_MASK(OS_INTR_PI_CP); + } + if (intsr & PI_INTSR_ERROR) { + mask |= OS_INTR_MASK(OS_INTR_PI_ERROR); + } + if (intsr & PI_INTSR_ACR) { + mask |= OS_INTR_MASK(OS_INTR_PI_ACR); + } + + newMask = mask & ~(*(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) | + *(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK)); + + if (newMask != 0) { + s16 type; + u32* pPrio; + OSInterruptHandler handler; + + for (pPrio = InterruptPrioTable; TRUE; pPrio++) { + if (newMask & *pPrio) { + type = __cntlzw(newMask & *pPrio); + break; + } + } + + handler = __OSGetInterruptHandler(type); + if (handler != NULL) { + if (type > OS_INTR_MEM_ADDRESS) { + __OSLastInterrupt = type; + __OSLastInterruptTime = OSGetTime(); + __OSLastInterruptSrr0 = ctx->srr0; + } + + OSDisableScheduler(); + handler(type, ctx); + OSEnableScheduler(); + __OSReschedule(); + OSLoadContext(ctx); + } + } + + OSLoadContext(ctx); +} + +static asm void ExternalInterruptHandler(register u8 type, + register OSContext* ctx) { + // clang-format off + nofralloc + + stw r0, ctx->gprs[0] + stw r1, ctx->gprs[1] + stw r2, ctx->gprs[2] + stmw r6, ctx->gprs[6] + + mfspr r0, GQR1 + stw r0, ctx->gqrs[1] + mfspr r0, GQR2 + stw r0, ctx->gqrs[2] + mfspr r0, GQR3 + stw r0, ctx->gqrs[3] + mfspr r0, GQR4 + stw r0, ctx->gqrs[4] + mfspr r0, GQR5 + stw r0, ctx->gqrs[5] + mfspr r0, GQR6 + stw r0, ctx->gqrs[6] + mfspr r0, GQR7 + stw r0, ctx->gqrs[7] + + stwu r1, -8(r1) + b __OSDispatchInterrupt + // clang-format on +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSIpc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSIpc.c new file mode 100644 index 0000000000..feb31b015d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSIpc.c @@ -0,0 +1,17 @@ +#include + +static void* IpcBufferLo = (void*)-1; +static void* IpcBufferHi = NULL; + +void* __OSGetIPCBufferHi(void) { + return IpcBufferHi; +} + +void* __OSGetIPCBufferLo(void) { + return IpcBufferLo; +} + +void __OSInitIPCBuffer(void) { + IpcBufferLo = *(void**)OSPhysicalToCached(OS_PHYS_IPC_BUFFER_START); + IpcBufferHi = *(void**)OSPhysicalToCached(OS_PHYS_IPC_BUFFER_END); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSLink.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSLink.c new file mode 100644 index 0000000000..2cbb521134 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSLink.c @@ -0,0 +1,6 @@ +#include + +void __OSModuleInit(void) { + OS_FIRST_REL = OS_LAST_REL = NULL; + OS_REL_NAME_TABLE = NULL; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMemory.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMemory.c new file mode 100644 index 0000000000..4581255b21 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMemory.c @@ -0,0 +1,523 @@ +#include + +static BOOL OnShutdown(BOOL final, u32 event); +static OSShutdownFunctionInfo ShutdownFunctionInfo = {OnShutdown, 127, NULL, + NULL}; + +u32 OSGetPhysicalMem1Size(void) { + return OS_PHYSICAL_MEM1_SIZE; +} + +u32 OSGetPhysicalMem2Size(void) { + return OS_PHYSICAL_MEM2_SIZE; +} + +u32 OSGetConsoleSimulatedMem1Size(void) { + return OS_SIMULATED_MEM1_SIZE; +} + +u32 OSGetConsoleSimulatedMem2Size(void) { + return OS_SIMULATED_MEM2_SIZE; +} + +static BOOL OnShutdown(BOOL final, u32 event) { +#pragma unused(event) + + if (final) { + MI_HW_REGS[MI_PROT_MEM0] = 0xFF; + __OSMaskInterrupts( + OS_INTR_MASK(OS_INTR_MEM_0) | OS_INTR_MASK(OS_INTR_MEM_1) | + OS_INTR_MASK(OS_INTR_MEM_2) | OS_INTR_MASK(OS_INTR_MEM_3)); + } + + return TRUE; +} + +// TYPO +static void MEMIntrruptHandler(s16 intr, OSContext* ctx) { +#pragma unused(intr) + + u32 dsisr = MI_HW_REGS[MI_INTSR]; + u32 dar = (MI_HW_REGS[MI_ADDRHI] & 0x3ff) << 0x10 | MI_HW_REGS[MI_ADDRLO]; + MI_HW_REGS[MI_REG_0x20] = 0; + + if (__OSErrorTable[OS_ERR_PROTECTION] != NULL) { + __OSErrorTable[OS_ERR_PROTECTION](OS_ERR_PROTECTION, ctx, dsisr, dar); + } else { + __OSUnhandledException(OS_ERR_PROTECTION, ctx, dsisr, dar); + } +} + +static asm void ConfigMEM1_24MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x00000002@ha + addi r4, r4, 0x00000002@l + lis r3, 0x800001FF@ha + addi r3, r3, 0x800001FF@l + lis r6, 0x01000002@ha + addi r6, r6, 0x01000002@l + lis r5, 0x810000FF@ha + addi r5, r5, 0x810000FF@l + isync + mtdbatu 0, r7 + mtdbatl 0, r4 + mtdbatu 0, r3 + isync + mtibatu 0, r7 + mtibatl 0, r4 + mtibatu 0, r3 + isync + mtdbatu 2, r7 + mtdbatl 2, r6 + mtdbatu 2, r5 + isync + mtibatu 2, r7 + mtibatl 2, r6 + mtibatu 2, r5 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM1_48MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x00000002@ha + addi r4, r4, 0x00000002@l + lis r3, 0x800003FF@ha + addi r3, r3, 0x800003FF@l + lis r6, 0x02000002@ha + addi r6, r6, 0x02000002@l + lis r5, 0x820001FF@ha + addi r5, r5, 0x820001FF@l + isync + mtdbatu 0, r7 + mtdbatl 0, r4 + mtdbatu 0, r3 + isync + mtibatu 0, r7 + mtibatl 0, r4 + mtibatu 0, r3 + isync + mtdbatu 2, r7 + mtdbatl 2, r6 + mtdbatu 2, r5 + isync + mtibatu 2, r7 + mtibatl 2, r6 + mtibatu 2, r5 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM2_52MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x10000002@ha + addi r4, r4, 0x10000002@l + lis r3, 0x900003FF@ha + addi r3, r3, 0x900003FF@l + lis r6, 0x1000002A@ha + addi r6, r6, 0x1000002A@l + lis r5, 0xD00007FF@ha + addi r5, r5, 0xD00007FF@l + isync + mtspr 0x238, r7 + mtspr 0x239, r4 + mtspr 0x238, r3 + isync + mtspr 0x230, r7 + mtspr 0x231, r4 + mtspr 0x230, r3 + isync + mtspr 0x23a, r7 + mtspr 0x23b, r6 + mtspr 0x23a, r5 + isync + mtspr 0x232, r7 + mtspr 0x233, r7 + isync + lis r4, 0x12000002@ha + addi r4, r4, 0x12000002@l + lis r3, 0x920001FF@ha + addi r3, r3, 0x920001FF@l + lis r6, 0x13000002@ha + addi r6, r6, 0x13000002@l + lis r5, 0x9300007F@ha + addi r5, r5, 0x9300007F@l + isync + mtspr 0x23c, r7 + mtspr 0x23d, r4 + mtspr 0x23c, r3 + isync + mtspr 0x234, r7 + mtspr 0x235, r4 + mtspr 0x234, r3 + isync + mtspr 0x23e, r7 + mtspr 0x23f, r6 + mtspr 0x23e, r5 + isync + mtspr 0x236, r7 + mtspr 0x237, r6 + mtspr 0x236, r5 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM2_56MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x10000002@ha + addi r4, r4, 0x10000002@l + lis r3, 0x900003FF@ha + addi r3, r3, 0x900003FF@l + lis r6, 0x1000002A@ha + addi r6, r6, 0x1000002A@l + lis r5, 0xD00007FF@ha + addi r5, r5, 0xD00007FF@l + isync + mtspr 0x238, r7 + mtspr 0x239, r4 + mtspr 0x238, r3 + isync + mtspr 0x230, r7 + mtspr 0x231, r4 + mtspr 0x230, r3 + isync + mtspr 0x23a, r7 + mtspr 0x23b, r6 + mtspr 0x23a, r5 + isync + mtspr 0x232, r7 + mtspr 0x233, r7 + isync + lis r4, 0x12000002@ha + addi r4, r4, 0x12000002@l + lis r3, 0x920001FF@ha + addi r3, r3, 0x920001FF@l + lis r6, 0x13000002@ha + addi r6, r6, 0x13000002@l + lis r5, 0x930000FF@ha + addi r5, r5, 0x930000FF@l + isync + mtspr 0x23c, r7 + mtspr 0x23d, r4 + mtspr 0x23c, r3 + isync + mtspr 0x234, r7 + mtspr 0x235, r4 + mtspr 0x234, r3 + isync + mtspr 0x23e, r7 + mtspr 0x23f, r6 + mtspr 0x23e, r5 + isync + mtspr 0x236, r7 + mtspr 0x237, r6 + mtspr 0x236, r5 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM2_64MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x10000002@ha + addi r4, r4, 0x10000002@l + lis r3, 0x900007FF@ha + addi r3, r3, 0x900007FF@l + lis r6, 0x1000002A@ha + addi r6, r6, 0x1000002A@l + lis r5, 0xD00007FF@ha + addi r5, r5, 0xD00007FF@l + isync + mtspr 0x238, r7 + mtspr 0x239, r4 + mtspr 0x238, r3 + isync + mtspr 0x230, r7 + mtspr 0x231, r4 + mtspr 0x230, r3 + isync + mtspr 0x23a, r7 + mtspr 0x23b, r6 + mtspr 0x23a, r5 + isync + mtspr 0x232, r7 + mtspr 0x233, r7 + isync + mtspr 0x234, r7 + mtspr 0x235, r7 + isync + mtspr 0x236, r7 + mtspr 0x237, r7 + isync + mtspr 0x23c, r7 + mtspr 0x23d, r7 + isync + mtspr 0x23e, r7 + mtspr 0x23f, r7 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM2_112MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x10000002@ha + addi r4, r4, 0x10000002@l + lis r3, 0x900007FF@ha + addi r3, r3, 0x900007FF@l + lis r6, 0x1000002A@ha + addi r6, r6, 0x1000002A@l + lis r5, 0xD0000FFF@ha + addi r5, r5, 0xD0000FFF@l + isync + mtspr 0x238, r7 + mtspr 0x239, r4 + mtspr 0x238, r3 + isync + mtspr 0x230, r7 + mtspr 0x231, r4 + mtspr 0x230, r3 + isync + mtspr 0x23a, r7 + mtspr 0x23b, r6 + mtspr 0x23a, r5 + isync + mtspr 0x232, r7 + mtspr 0x233, r7 + isync + lis r4, 0x14000002@ha + addi r4, r4, 0x14000002@l + lis r3, 0x940003FF@ha + addi r3, r3, 0x940003FF@l + lis r6, 0x16000002@ha + addi r6, r6, 0x16000002@l + lis r5, 0x960001FF@ha + addi r5, r5, 0x960001FF@l + isync + mtspr 0x23c, r7 + mtspr 0x23d, r4 + mtspr 0x23c, r3 + isync + mtspr 0x234, r7 + mtspr 0x235, r4 + mtspr 0x234, r3 + isync + mtspr 0x23e, r7 + mtspr 0x23f, r6 + mtspr 0x23e, r5 + isync + mtspr 0x236, r7 + mtspr 0x237, r6 + mtspr 0x236, r5 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM2_128MB(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x10000002@ha + addi r4, r4, 0x10000002@l + lis r3, 0x90000FFF@ha + addi r3, r3, 0x90000FFF@l + lis r6, 0x1000002A@ha + addi r6, r6, 0x1000002A@l + lis r5, 0xD0000FFF@ha + addi r5, r5, 0xD0000FFF@l + isync + mtspr 0x238, r7 + mtspr 0x239, r4 + mtspr 0x238, r3 + isync + mtspr 0x230, r7 + mtspr 0x231, r4 + mtspr 0x230, r3 + isync + mtspr 0x23a, r7 + mtspr 0x23b, r6 + mtspr 0x23a, r5 + isync + mtspr 0x232, r7 + mtspr 0x233, r7 + isync + mtspr 0x234, r7 + mtspr 0x235, r7 + isync + mtspr 0x236, r7 + mtspr 0x237, r7 + isync + mtspr 0x23c, r7 + mtspr 0x23d, r7 + isync + mtspr 0x23e, r7 + mtspr 0x23f, r7 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void ConfigMEM_ES1_0(void) { + // clang-format off + nofralloc + + li r7, 0 + lis r4, 0x00000002@ha + addi r4, r4, 0x00000002@l + lis r3, 0x80000FFF@ha + addi r3, r3, 0x80000FFF@l + isync + mtdbatu 0, r7 + mtdbatl 0, r4 + mtdbatu 0, r3 + isync + mtibatu 0, r7 + mtibatl 0, r4 + mtibatu 0, r3 + isync + mfmsr r3 + ori r3, r3, 0x30 + mtspr 0x1b, r3 + mflr r3 + mtspr 0x1a, r3 + rfi + // clang-format on +} + +static asm void RealMode(register void* config) { + // clang-format off + nofralloc + + clrlwi config, config, 2 + mtspr 0x1a, config + mfmsr config + rlwinm config, config, 0, 0x1c, 0x19 + mtspr 0x1b, config + rfi + // clang-format on +} + +static void BATConfig(void) { + u32 mem1sim; + u32 mem1phys; + void* mem2end; + + if (OS_HOLLYWOOD_REV == 0) { + // @bug Checks function address rather than result + if (OSGetPhysicalMem1Size == 0) { + RealMode(ConfigMEM_ES1_0); + return; + } + } + + mem1sim = OSGetConsoleSimulatedMem1Size(); + mem1phys = OSGetPhysicalMem1Size(); + if (OSGetConsoleSimulatedMem1Size() < mem1phys && + mem1sim == OS_MEM_MB_TO_B(24)) { + DCInvalidateRange((void*)0x81800000, OS_MEM_MB_TO_B(24)); + MI_HW_REGS[MI_REG_0x28] = 2; + } + + if (mem1sim <= OS_MEM_MB_TO_B(24)) { + RealMode(ConfigMEM1_24MB); + } else if (mem1sim <= OS_MEM_MB_TO_B(48)) { + RealMode(ConfigMEM1_48MB); + } + + mem2end = *(void**)OSPhysicalToCached(OS_PHYS_ACCESSIBLE_MEM2_END); + if (OSGetConsoleSimulatedMem2Size() <= OS_MEM_MB_TO_B(64)) { + if (mem2end <= (void*)0x93400000) { + RealMode(ConfigMEM2_52MB); + } else if (mem2end <= (char*)0x93400000 + OS_MEM_MB_TO_B(4)) { + RealMode(ConfigMEM2_56MB); + } else { + RealMode(ConfigMEM2_64MB); + } + } else if (OSGetConsoleSimulatedMem2Size() <= OS_MEM_MB_TO_B(128)) { + if (mem2end <= (void*)0x97000000) { + RealMode(ConfigMEM2_112MB); + } else { + RealMode(ConfigMEM2_128MB); + } + } +} + +void __OSInitMemoryProtection(void) { + BOOL enabled = OSDisableInterrupts(); + + MI_HW_REGS[MI_REG_0x20] = 0; + MI_HW_REGS[MI_PROT_MEM0] = 0xFF; + + __OSMaskInterrupts( + OS_INTR_MASK(OS_INTR_MEM_0) | OS_INTR_MASK(OS_INTR_MEM_1) | + OS_INTR_MASK(OS_INTR_MEM_2) | OS_INTR_MASK(OS_INTR_MEM_3)); + __OSSetInterruptHandler(OS_INTR_MEM_0, MEMIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_MEM_1, MEMIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_MEM_2, MEMIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_MEM_3, MEMIntrruptHandler); + __OSSetInterruptHandler(OS_INTR_MEM_ADDRESS, MEMIntrruptHandler); + OSRegisterShutdownFunction(&ShutdownFunctionInfo); + + BATConfig(); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_MEM_ADDRESS)); + + OSRestoreInterrupts(enabled); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMessage.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMessage.c new file mode 100644 index 0000000000..6589c73d6c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMessage.c @@ -0,0 +1,81 @@ +#include + +void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* buffer, + s32 capacity) { + OSInitThreadQueue(&queue->sendQueue); + OSInitThreadQueue(&queue->recvQueue); + queue->buffer = buffer; + queue->capacity = capacity; + queue->front = 0; + queue->size = 0; +} + +BOOL OSSendMessage(OSMessageQueue* queue, OSMessage mesg, u32 flags) { + s32 mesgId; + BOOL enabled = OSDisableInterrupts(); + + while (queue->capacity <= queue->size) { + if (!(flags & OS_MSG_BLOCKING)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + OSSleepThread(&queue->sendQueue); + } + + mesgId = (queue->front + queue->size) % queue->capacity; + queue->buffer[mesgId] = mesg; + queue->size++; + + OSWakeupThread(&queue->recvQueue); + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* mesg, u32 flags) { + BOOL enabled = OSDisableInterrupts(); + + while (queue->size == 0) { + if (!(flags & OS_MSG_BLOCKING)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + OSSleepThread(&queue->recvQueue); + } + + if (mesg != NULL) { + *mesg = queue->buffer[queue->front]; + } + queue->front++; + queue->front %= queue->capacity; + queue->size--; + + OSWakeupThread(&queue->sendQueue); + OSRestoreInterrupts(enabled); + return TRUE; +} + +BOOL OSJamMessage(OSMessageQueue* queue, OSMessage mesg, u32 flags) { + s32 lastMesg; + BOOL enabled = OSDisableInterrupts(); + + while (queue->capacity <= queue->size) { + if (!(flags & OS_MSG_BLOCKING)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + OSSleepThread(&queue->sendQueue); + } + + // Find last position in queue + lastMesg = (queue->front + queue->capacity - 1) % queue->capacity; + queue->front = lastMesg; + queue->buffer[lastMesg] = mesg; + queue->size++; + + OSWakeupThread(&queue->recvQueue); + OSRestoreInterrupts(enabled); + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMutex.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMutex.c new file mode 100644 index 0000000000..86114341f8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSMutex.c @@ -0,0 +1,129 @@ +#include + +void OSInitMutex(OSMutex* mutex) { + OSInitThreadQueue(&mutex->queue); + mutex->thread = NULL; + mutex->lock = 0; +} + +void OSLockMutex(OSMutex* mutex) { + BOOL enabled = OSDisableInterrupts(); + OSThread* currThread = OSGetCurrentThread(); + + while (TRUE) { + if (mutex->thread == NULL) { + OSMutex* tail; + + mutex->thread = currThread; + mutex->lock++; + + tail = currThread->mutexQueue.tail; + if (tail == NULL) { + currThread->mutexQueue.head = mutex; + } else { + tail->next = mutex; + } + + mutex->prev = tail; + mutex->next = NULL; + currThread->mutexQueue.tail = mutex; + break; + } else if (mutex->thread == currThread) { + mutex->lock++; + break; + } else { + currThread->mutex = mutex; + __OSPromoteThread(mutex->thread, currThread->priority); + OSSleepThread(&mutex->queue); + currThread->mutex = NULL; + } + } + + OSRestoreInterrupts(enabled); +} + +void OSUnlockMutex(OSMutex* mutex) { + BOOL enabled = OSDisableInterrupts(); + OSThread* currThread = OSGetCurrentThread(); + + if (mutex->thread == currThread) { + mutex->lock--; + + if (mutex->lock == 0) { + OSMutex* next = mutex->next; + OSMutex* prev = mutex->prev; + + if (next == NULL) { + currThread->mutexQueue.tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + currThread->mutexQueue.head = next; + } else { + prev->next = next; + } + + mutex->thread = NULL; + if (currThread->priority < currThread->base) { + currThread->priority = __OSGetEffectivePriority(currThread); + } + + OSWakeupThread(&mutex->queue); + } + } + + OSRestoreInterrupts(enabled); +} + +void __OSUnlockAllMutex(OSThread* thread) { + OSMutex* mutex; + while ((mutex = thread->mutexQueue.head) != NULL) { + OSMutex* next = mutex->next; + if (next == NULL) { + thread->mutexQueue.tail = NULL; + } else { + next->prev = NULL; + } + + thread->mutexQueue.head = next; + mutex->lock = 0; + mutex->thread = NULL; + OSWakeupThread(&mutex->queue); + } +}; + +BOOL OSTryLockMutex(OSMutex* mutex) { + BOOL enabled = OSDisableInterrupts(); + OSThread* currThread = OSGetCurrentThread(); + BOOL lock = FALSE; + + if (mutex->thread == NULL) { + OSMutex* tail; + + mutex->thread = currThread; + mutex->lock++; + + tail = currThread->mutexQueue.tail; + if (tail == NULL) { + currThread->mutexQueue.head = mutex; + } else { + tail->next = mutex; + } + + mutex->prev = tail; + mutex->next = NULL; + + currThread->mutexQueue.tail = mutex; + lock = TRUE; + } else if (mutex->thread == currThread) { + mutex->lock++; + lock = TRUE; + } else { + lock = FALSE; + } + + OSRestoreInterrupts(enabled); + return lock; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSNet.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSNet.c new file mode 100644 index 0000000000..26010fe0fe --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSNet.c @@ -0,0 +1,50 @@ +#include + +// @bug Wrong prototypes. Somebody forgot to include the header!!! +int NWC24iPrepareShutdown(); +int NWC24SuspendScheduler(); +int NWC24iSynchronizeRtcCounter(); + +void __OSInitNet(void) { + s32 error; + OSIOSRev rev; + + __OSGetIOSRev(&rev); + if (rev.idLo <= 4 || rev.idLo == 9) { + return; + } + + error = NWC24iPrepareShutdown(); + if (error != 0) { + if (error < 0) { + OSReport("Failed to register network shutdown function. %d\n", + error); + } + + error = NWC24SuspendScheduler(); + if (error < 0) { + OSReport("Failed to suspend the WiiConnect24 scheduler. %d\n", + error); + } + } + + // @bug Wrong prototype. Somebody forgot to include the header!!! + error = NWC24iSynchronizeRtcCounter(); + if (error != 0) { + OSReport( + "Failed to synchronize time with network resource managers. %d\n", + error); + } +} + +// clang-format off +DECOMP_FORCEACTIVE(OSNet_c, + "NWC24iPrepareShutdown", + "/dev/net/kd/request", + "NWC24SuspendScheduler", + "NWC24ResumeScheduler", + "NWC24iRequestShutdown", + "NWC24Shutdown_: Give up!\n", + "NWC24iSetRtcCounter_", + "/dev/net/kd/time"); +// clang-format on diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSPlayRecord.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSPlayRecord.c new file mode 100644 index 0000000000..bdbaaf37d3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSPlayRecord.c @@ -0,0 +1,294 @@ +#include +#include + +// Why?!? :( +#define MY_SEC_TO_TICKS(x) (x * (s64)OS_SEC_TO_TICKS(1)) + +typedef enum { + PLAY_RECORD_STATE_STARTED, //!< __OSStartPlayRecord + PLAY_RECORD_STATE_OPEN, //!< Open play record + PLAY_RECORD_STATE_READ, //!< Read play record + PLAY_RECORD_STATE_SEEK, //!< Seek play record + PLAY_RECORD_STATE_SET_ALARM, //!< Set alarm callback + PLAY_RECORD_STATE_WRITE, //!< Save play record + PLAY_RECORD_STATE_CLOSE, //!< Close play record + PLAY_RECORD_STATE_CLOSED, //!< Play record was closed + PLAY_RECORD_STATE_TIMEOUT, //!< Play record could not be closed + PLAY_RECORD_STATE_STOPPED //!< __OSStopPlayRecord +} OSPlayRecordState; + +typedef struct OSPlayRecord { + u32 checksum; // at 0x0 + wchar_t titleName[40]; // at 0x4 + char UNK_0x54[0x4]; + s64 startTime; // at 0x58 + s64 stopTime; // at 0x60 + char titleId[6]; // at 0x68 + char UNK_0x6E[0x80 - 0x6E]; +} OSPlayRecord; + +static OSPlayRecordState PlayRecordState = PLAY_RECORD_STATE_STOPPED; + +static s64 PlayRecordLastCloseTime; +static s32 PlayRecordLastError; +static BOOL PlayRecordRetry; +static BOOL PlayRecordTerminated; +static BOOL PlayRecordTerminate; +static BOOL PlayRecordError; +static BOOL PlayRecordGet; + +static OSPlayRecord PlayRecord ALIGN(32); +static NANDFileInfo FileInfo; +static NANDCommandBlock Block; +static OSAlarm PlayRecordAlarm; + +static void PlayRecordCallback(s32 result, NANDCommandBlock* block); + +static u32 RecordCheckSum(const OSPlayRecord* playRec) { + int i; + const u32* ptr = (const u32*)&playRec->titleName; + u32 checksum = 0; + + for (i = 0; i < (sizeof(OSPlayRecord) / sizeof(u32)) - 1; i++) { + checksum += *ptr++; + } + + return checksum; +} + +DECOMP_FORCEACTIVE(OSPlayRecord_c, PlayRecord); + +static void PlayRecordAlarmCallback(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(alarm) +#pragma unused(ctx) + + PlayRecordCallback(NAND_RESULT_OK, NULL); +} + +static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + s32 error = NAND_RESULT_OK; + PlayRecordLastError = result; + + if (PlayRecordTerminate) { + PlayRecordTerminated = TRUE; + return; + } + + if (!PlayRecordRetry) { + switch (PlayRecordState) { + case PLAY_RECORD_STATE_STARTED: + PlayRecordState = PLAY_RECORD_STATE_OPEN; + break; + case PLAY_RECORD_STATE_OPEN: + if (result == NAND_RESULT_MAXFD) { + PlayRecordRetry = TRUE; + OSCreateAlarm(&PlayRecordAlarm); + OSSetAlarm(&PlayRecordAlarm, MY_SEC_TO_TICKS(1), + PlayRecordAlarmCallback); + return; + } else if (result == NAND_RESULT_OK) { + if (!PlayRecordGet) { + PlayRecordState = PLAY_RECORD_STATE_READ; + } else { + PlayRecordState = PLAY_RECORD_STATE_SET_ALARM; + } + break; + } else { + PlayRecordError = TRUE; + PlayRecordState = PLAY_RECORD_STATE_CLOSED; + return; + } + case PLAY_RECORD_STATE_READ: + if (result == sizeof(OSPlayRecord)) { + PlayRecordGet = TRUE; + PlayRecordLastCloseTime = PlayRecord.stopTime; + PlayRecordState = PLAY_RECORD_STATE_SEEK; + } else { + PlayRecordError = TRUE; + PlayRecordState = PLAY_RECORD_STATE_CLOSE; + } + break; + case PLAY_RECORD_STATE_SEEK: + if (result == NAND_RESULT_OK) { + PlayRecordState = PLAY_RECORD_STATE_SET_ALARM; + } else { + PlayRecordError = TRUE; + PlayRecordState = PLAY_RECORD_STATE_CLOSE; + } + break; + case PLAY_RECORD_STATE_SET_ALARM: + PlayRecordState = PLAY_RECORD_STATE_WRITE; + break; + case PLAY_RECORD_STATE_WRITE: + if (result == sizeof(OSPlayRecord)) { + if (OSGetTime() - PlayRecordLastCloseTime > + MY_SEC_TO_TICKS(300)) { + PlayRecordState = PLAY_RECORD_STATE_CLOSE; + } else { + PlayRecordState = PLAY_RECORD_STATE_SEEK; + } + } else { + PlayRecordError = TRUE; + PlayRecordState = PLAY_RECORD_STATE_CLOSE; + } + break; + case PLAY_RECORD_STATE_CLOSE: + if (PlayRecordError) { + PlayRecordState = PLAY_RECORD_STATE_CLOSED; + return; + } else if (result == NAND_RESULT_OK) { + PlayRecordLastCloseTime = PlayRecord.stopTime; + PlayRecordState = PLAY_RECORD_STATE_OPEN; + } else { + PlayRecordState = PLAY_RECORD_STATE_CLOSED; + PlayRecordError = TRUE; + return; + } + break; + default: + PlayRecordState = PLAY_RECORD_STATE_CLOSED; + PlayRecordError = TRUE; + return; + } + } + + PlayRecordRetry = FALSE; + + switch (PlayRecordState) { + case PLAY_RECORD_STATE_OPEN: + error = NANDOpenAsync("/title/00000001/00000002/data/play_rec.dat", + &FileInfo, NAND_ACCESS_RW, PlayRecordCallback, + &Block); + break; + case PLAY_RECORD_STATE_READ: + error = NANDReadAsync(&FileInfo, &PlayRecord, sizeof(OSPlayRecord), + PlayRecordCallback, &Block); + break; + case PLAY_RECORD_STATE_SEEK: + error = NANDSeekAsync(&FileInfo, 0, NAND_SEEK_BEG, PlayRecordCallback, + &Block); + break; + case PLAY_RECORD_STATE_SET_ALARM: + OSCreateAlarm(&PlayRecordAlarm); + OSSetAlarm(&PlayRecordAlarm, MY_SEC_TO_TICKS(60), + PlayRecordAlarmCallback); + break; + case PLAY_RECORD_STATE_WRITE: + PlayRecord.stopTime = OSGetTime(); + PlayRecord.checksum = RecordCheckSum(&PlayRecord); + error = NANDWriteAsync(&FileInfo, &PlayRecord, sizeof(OSPlayRecord), + PlayRecordCallback, &Block); + break; + case PLAY_RECORD_STATE_CLOSE: + error = NANDCloseAsync(&FileInfo, PlayRecordCallback, &Block); + break; + } + + if (error != NAND_RESULT_OK) { + if (error == NAND_RESULT_BUSY) { + OSCreateAlarm(&PlayRecordAlarm); + OSSetAlarm(&PlayRecordAlarm, MY_SEC_TO_TICKS(1), + PlayRecordAlarmCallback); + PlayRecordRetry = TRUE; + } else { + PlayRecordError = TRUE; + + switch (PlayRecordState) { + case PLAY_RECORD_STATE_READ: + case PLAY_RECORD_STATE_SEEK: + case PLAY_RECORD_STATE_WRITE: + PlayRecordState = PLAY_RECORD_STATE_CLOSE; + error = NANDCloseAsync(&FileInfo, PlayRecordCallback, &Block); + if (error == NAND_RESULT_BUSY) { + PlayRecordRetry = TRUE; + OSCreateAlarm(&PlayRecordAlarm); + OSSetAlarm(&PlayRecordAlarm, MY_SEC_TO_TICKS(1), + PlayRecordAlarmCallback); + } + break; + default: + PlayRecordState = PLAY_RECORD_STATE_CLOSED; + break; + } + } + } + + PlayRecordLastError = error; +} + +void __OSStartPlayRecord(void) { + if (NANDInit() == NAND_RESULT_OK) { + PlayRecordTerminate = FALSE; + PlayRecordGet = FALSE; + PlayRecordState = PLAY_RECORD_STATE_STARTED; + PlayRecordError = FALSE; + PlayRecordRetry = FALSE; + PlayRecordTerminated = FALSE; + PlayRecordLastError = NAND_RESULT_OK; + PlayRecordCallback(NAND_RESULT_OK, NULL); + } +} + +void __OSStopPlayRecord(void) { + BOOL enabled; + s64 start; + + enabled = OSDisableInterrupts(); + + PlayRecordTerminate = TRUE; + + if (PlayRecordState == PLAY_RECORD_STATE_CLOSED || + PlayRecordState == PLAY_RECORD_STATE_STARTED || + PlayRecordState == PLAY_RECORD_STATE_STOPPED || + PlayRecordState == PLAY_RECORD_STATE_TIMEOUT) { + OSRestoreInterrupts(enabled); + } else if (PlayRecordState == PLAY_RECORD_STATE_SET_ALARM) { + OSCancelAlarm(&PlayRecordAlarm); + OSRestoreInterrupts(enabled); + PlayRecord.stopTime = OSGetTime(); + PlayRecord.checksum = RecordCheckSum(&PlayRecord); + NANDWrite(&FileInfo, &PlayRecord, sizeof(OSPlayRecord)); + NANDClose(&FileInfo); + } else { + if (PlayRecordRetry) { + OSCancelAlarm(&PlayRecordAlarm); + OSRestoreInterrupts(enabled); + } else { + OSRestoreInterrupts(enabled); + start = OSGetTime(); + + while (TRUE) { + if (PlayRecordTerminated) { + break; + } + + if (OSGetTime() - start > OS_MSEC_TO_TICKS(500)) { + PlayRecordState = PLAY_RECORD_STATE_TIMEOUT; + return; + } + } + } + + switch (PlayRecordState) { + case PLAY_RECORD_STATE_READ: + case PLAY_RECORD_STATE_SEEK: + case PLAY_RECORD_STATE_WRITE: + NANDClose(&FileInfo); + break; + case PLAY_RECORD_STATE_OPEN: + if (PlayRecordLastError == NAND_RESULT_OK && !PlayRecordRetry) { + NANDClose(&FileInfo); + } + break; + case PLAY_RECORD_STATE_CLOSE: + if (PlayRecordRetry) { + NANDClose(&FileInfo); + } + break; + } + } + + PlayRecordState = PLAY_RECORD_STATE_STOPPED; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSReset.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSReset.c new file mode 100644 index 0000000000..8c69760ead --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSReset.c @@ -0,0 +1,240 @@ +#include +#include +#include +#include +#include +#include + +static OSShutdownFunctionQueue ShutdownFunctionQueue; + +static void KillThreads(void); + +void OSRegisterShutdownFunction(OSShutdownFunctionInfo* info) { + OSShutdownFunctionInfo* it; + OSShutdownFunctionInfo* prev; + OSShutdownFunctionInfo* tail; + + for (it = ShutdownFunctionQueue.head; it != NULL && it->prio <= info->prio; + it = it->next) { + ; + } + + if (it == NULL) { + + tail = ShutdownFunctionQueue.tail; + if (tail == NULL) { + ShutdownFunctionQueue.head = info; + } else { + ShutdownFunctionQueue.tail->next = info; + } + + info->prev = tail; + info->next = NULL; + + it = ShutdownFunctionQueue.head; + ShutdownFunctionQueue.tail = info; + } else { + info->next = it; + + prev = it->prev; + it->prev = info; + info->prev = prev; + + if (prev == NULL) { + ShutdownFunctionQueue.head = info; + } else { + prev->next = info; + } + } +} + +BOOL __OSCallShutdownFunctions(u32 pass, u32 event) { + OSShutdownFunctionInfo* iter; + BOOL failure; + u32 prio; + + prio = 0; + failure = FALSE; + + for (iter = ShutdownFunctionQueue.head; iter != NULL; iter = iter->next) { + if (failure && prio != iter->prio) { + break; + } + + failure |= !iter->func(pass, event); + prio = iter->prio; + } + + failure |= !__OSSyncSram(); + + return !failure; +} + +void __OSShutdownDevices(u32 event) { + BOOL padIntr; + BOOL osIntr; + BOOL keepEnable; + + switch (event) { + case 0: + case OS_SD_EVENT_RESTART: + case OS_SD_EVENT_RETURN_TO_MENU: + case OS_SD_EVENT_LAUNCH_APP: + keepEnable = FALSE; + break; + case 1: + case OS_SD_EVENT_SHUTDOWN: + case 3: + default: + keepEnable = TRUE; + break; + } + + __OSStopAudioSystem(); + + if (!keepEnable) { + padIntr = __PADDisableRecalibration(TRUE); + } + + while (!__OSCallShutdownFunctions(FALSE, event)) { + ; + } + + while (!__OSSyncSram()) { + ; + } + + osIntr = OSDisableInterrupts(); + __OSCallShutdownFunctions(TRUE, event); + LCDisable(); + + if (!keepEnable) { + __PADDisableRecalibration(padIntr); + } + + KillThreads(); +} + +// TODO: There must be a better way.... +void __OSGetDiscState(u8* out) { + u32 flags; + + if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { + *out = 3; + } else if (*out == 1) { + if (!__OSGetRTCFlags(&flags) || flags == 0) { + goto status_1; + } + + status_2: + *out = 2; + } else { + goto status_2; + + status_1: + *out = 1; + } +} + +static void KillThreads(void) { + OSThread* iter; + OSThread* next; + + for (iter = OS_THREAD_QUEUE.head; iter != NULL; iter = next) { + next = iter->nextActive; + + switch (iter->state) { + case OS_THREAD_STATE_SLEEPING: + case OS_THREAD_STATE_READY: + OSCancelThread(iter); + break; + } + } +} + +void OSShutdownSystem(void) { + SCIdleModeInfo idleMode; + OSStateFlags stateFlags; + OSIOSRev iosRev; + + memset(&idleMode, 0, sizeof(SCIdleModeInfo)); + SCInit(); + while (SCCheckStatus() == SC_STATUS_BUSY) { + ; + } + SCGetIdleMode(&idleMode); + + __OSStopPlayRecord(); + __OSUnRegisterStateEvent(); + __DVDPrepareReset(); + __OSReadStateFlags(&stateFlags); + + __OSGetDiscState(&stateFlags.discState); + if (idleMode.wc24 == TRUE) { + stateFlags.BYTE_0x5 = 5; + } else { + stateFlags.BYTE_0x5 = 1; + } + + __OSClearRTCFlags(); + __OSWriteStateFlags(&stateFlags); + __OSGetIOSRev(&iosRev); + + if (idleMode.wc24 == TRUE) { + OSDisableScheduler(); + __OSShutdownDevices(OS_SD_EVENT_RETURN_TO_MENU); + OSEnableScheduler(); + __OSLaunchMenu(); + } else { + OSDisableScheduler(); + __OSShutdownDevices(OS_SD_EVENT_SHUTDOWN); + __OSShutdownToSBY(); + } +} + +void OSReturnToMenu(void) { + OSStateFlags stateFlags; + + __OSStopPlayRecord(); + __OSUnRegisterStateEvent(); + __DVDPrepareReset(); + + __OSReadStateFlags(&stateFlags); + __OSGetDiscState(&stateFlags.discState); + stateFlags.BYTE_0x5 = 3; + __OSClearRTCFlags(); + __OSWriteStateFlags(&stateFlags); + + OSDisableScheduler(); + __OSShutdownDevices(OS_SD_EVENT_RETURN_TO_MENU); + OSEnableScheduler(); + + __OSLaunchMenu(); + OSDisableScheduler(); + __VISetRGBModeImm(); + __OSHotReset(); + + // clang-format off +#line 843 + OSError("OSReturnToMenu(): Falied to boot system menu.\n"); + // clang-format on +} + +u32 OSGetResetCode(void) { + if (__OSRebootParams.WORD_0x0 != 0) { + return __OSRebootParams.WORD_0x4 | 0x80000000; + } + + return PI_HW_REGS[PI_RESET] >> 3; +} + +void OSResetSystem(u32 arg0, u32 arg1, u32 arg2) { +#pragma unused(arg0) +#pragma unused(arg1) +#pragma unused(arg2) + + // clang-format off +#line 1020 + OSError("OSResetSystem() is obsoleted. It doesn't work any longer.\n"); + // clang-format on +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSRtc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSRtc.c new file mode 100644 index 0000000000..8110665676 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSRtc.c @@ -0,0 +1,289 @@ +#include +#include + +#define OS_SRAM_SIZE (sizeof(OSSram) + sizeof(OSSramEx)) + +typedef struct OSScb { + union { + struct { + OSSram sram; + OSSramEx sramEx; + }; + u8 block[OS_SRAM_SIZE]; + }; // at 0x0 + u32 pos; // at 0x40 + BOOL enabled; // at 0x44 + BOOL locked; // at 0x48 + BOOL sync; // at 0x4C + UNKWORD WORD_0x50; +} OSScb; + +static OSScb Scb ALIGN(32); + +static BOOL WriteSram(const void* src, u32 pos, s32 size); + +static BOOL ReadSram(OSScb* scb) { + BOOL error = FALSE; + u32 imm; + + DCInvalidateRange(scb, OS_SRAM_SIZE); + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + return FALSE; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, EXI_FREQ_8MHZ)) { + EXIUnlock(EXI_CHAN_0); + return FALSE; + } + + imm = 0x20000100; + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDma(EXI_CHAN_0, scb->block, OS_SRAM_SIZE, EXI_READ, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + + return error == FALSE; +} + +static void WriteSramCallback(EXIChannel chan, OSContext* ctx) { +#pragma unused(chan) +#pragma unused(ctx) + + Scb.sync = WriteSram(Scb.block + Scb.pos, Scb.pos, OS_SRAM_SIZE - Scb.pos); + if (Scb.sync) { + Scb.pos = OS_SRAM_SIZE; + } +} + +static BOOL WriteSram(const void* src, u32 pos, s32 size) { + u32 imm; + BOOL error = FALSE; + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, WriteSramCallback)) { + return FALSE; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, EXI_FREQ_8MHZ)) { + EXIUnlock(EXI_CHAN_0); + return FALSE; + } + + imm = pos * 0x40 + 0x100 | 0xA0000000; + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIImmEx(EXI_CHAN_0, (void*)src, size, EXI_WRITE); + error |= !EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + + return error == FALSE; +} + +void __OSInitSram(void) { + Scb.enabled = FALSE; + Scb.locked = FALSE; + Scb.sync = ReadSram(&Scb); + Scb.pos = OS_SRAM_SIZE; + OSSetGbsMode(OSGetGbsMode()); +} + +static void* LockSram(u32 pos) { + BOOL enabled; + + enabled = OSDisableInterrupts(); + + if (Scb.locked) { + OSRestoreInterrupts(enabled); + return NULL; + } + + Scb.enabled = enabled; + Scb.locked = TRUE; + + return Scb.block + pos; +} + +OSSramEx* __OSLockSramEx(void) { + return (OSSramEx*)LockSram(sizeof(OSSram)); +} + +static BOOL UnlockSram(BOOL save, u32 pos) { + u16* data; + OSSram* sram; + OSSramEx* sramEx; + + if (save) { + if (pos == 0) { + sram = &Scb.sram; + if ((u8)(sram->flags & 0x3) > 2) { + sram->flags &= ~0x3; + } + + // Checksum base SRAM + sram->invchecksum = 0; + sram->checksum = 0; + for (data = (u16*)&sram->counterBias; data < (u16*)&Scb.sramEx; + data++) { + sram->checksum += *data; + sram->invchecksum += ~*data; + } + } + + if (pos < Scb.pos) { + Scb.pos = pos; + } + + sramEx = &Scb.sramEx; + if (Scb.pos <= sizeof(OSSram) && + (((u32)sramEx->gbs & 0x7C00) == 0x5000 || + ((u32)sramEx->gbs & 0xC0) == 0xC0)) { + sramEx->gbs = 0; + } + + Scb.sync = + WriteSram(Scb.block + Scb.pos, Scb.pos, OS_SRAM_SIZE - Scb.pos); + if (Scb.sync) { + Scb.pos = OS_SRAM_SIZE; + } + } + + Scb.locked = FALSE; + OSRestoreInterrupts(Scb.enabled); + return Scb.sync; +} + +BOOL __OSUnlockSramEx(BOOL save) { + return UnlockSram(save, sizeof(OSSram)); +} + +BOOL __OSSyncSram(void) { + return Scb.sync; +} + +BOOL __OSReadROM(void* dst, s32 size, const void* src) { + u32 imm; + BOOL error = FALSE; + + DCInvalidateRange(dst, size); + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + return FALSE; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, EXI_FREQ_8MHZ)) { + EXIUnlock(EXI_CHAN_0); + return FALSE; + } + + imm = (u32)src << 6; + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDma(EXI_CHAN_0, dst, size, EXI_READ, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + + return error == FALSE; +} + +u16 OSGetWirelessID(s32 pad) { + OSSramEx* sram; + u16 id; + + sram = __OSLockSramEx(); + id = sram->wirelessPadId[pad]; + __OSUnlockSramEx(FALSE); + + return id; +} + +void OSSetWirelessID(s32 pad, u16 id) { + OSSramEx* sram; + + sram = __OSLockSramEx(); + if (id != sram->wirelessPadId[pad]) { + sram->wirelessPadId[pad] = id; + __OSUnlockSramEx(TRUE); + } else { + __OSUnlockSramEx(FALSE); + } +} + +u16 OSGetGbsMode(void) { + OSSramEx* sram; + u16 gbs; + + sram = __OSLockSramEx(); + gbs = sram->gbs; + __OSUnlockSramEx(FALSE); + + return gbs; +} + +void OSSetGbsMode(u16 gbs) { + OSSramEx* sram; + + if (((u32)gbs & 0x7C00) == 0x5000 || ((u32)gbs & 0xC0) == 0xC0) { + gbs = 0; + } + + sram = __OSLockSramEx(); + if (gbs == sram->gbs) { + __OSUnlockSramEx(FALSE); + } else { + sram->gbs = gbs; + __OSUnlockSramEx(TRUE); + } +} + +BOOL __OSGetRTCFlags(u32* out) { + u32 imm; + BOOL error = FALSE; + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + return FALSE; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, EXI_FREQ_8MHZ)) { + EXIUnlock(EXI_CHAN_0); + return FALSE; + } + + imm = 0x21000800; + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_READ, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + + *out = imm; + return error == FALSE; +} + +BOOL __OSClearRTCFlags(void) { + u32 imm; + u32 flags = 0; + BOOL error = FALSE; + + if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { + return FALSE; + } + + if (!EXISelect(EXI_CHAN_0, EXI_DEV_INT, EXI_FREQ_8MHZ)) { + EXIUnlock(EXI_CHAN_0); + return FALSE; + } + + imm = 0xA1000800; + error |= !EXIImm(EXI_CHAN_0, &imm, sizeof(imm), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIImm(EXI_CHAN_0, &flags, sizeof(flags), EXI_WRITE, NULL); + error |= !EXISync(EXI_CHAN_0); + error |= !EXIDeselect(EXI_CHAN_0); + EXIUnlock(EXI_CHAN_0); + + return error == FALSE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateFlags.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateFlags.c new file mode 100644 index 0000000000..d3d843417a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateFlags.c @@ -0,0 +1,68 @@ +#include +#include +#include + +static OSStateFlags StateFlags ALIGN(32); + +static u32 CheckSum(const OSStateFlags* state) { + int i; + const u32* ptr = (const u32*)&state->BYTE_0x4; + u32 checksum = 0; + + for (i = 0; i < (sizeof(OSStateFlags) / sizeof(u32)) - 1; i++) { + checksum += *ptr++; + } + + return checksum; +} + +BOOL __OSWriteStateFlags(const OSStateFlags* state) { + NANDFileInfo file; + + memcpy(&StateFlags, state, sizeof(OSStateFlags)); + StateFlags.checksum = CheckSum(&StateFlags); + + if (NANDOpen("/title/00000001/00000002/data/state.dat", &file, + NAND_ACCESS_WRITE) == NAND_RESULT_OK) { + if (NANDWrite(&file, &StateFlags, sizeof(OSStateFlags)) != + sizeof(OSStateFlags)) { + NANDClose(&file); + return FALSE; + } + if (NANDClose(&file) != NAND_RESULT_OK) { + return FALSE; + } + } else { + return FALSE; + } + + return TRUE; +} + +BOOL __OSReadStateFlags(OSStateFlags* state) { + NANDFileInfo file; + + if (NANDOpen("/title/00000001/00000002/data/state.dat", &file, + NAND_ACCESS_READ) == NAND_RESULT_OK) { + + s32 bytesRead = NANDRead(&file, &StateFlags, sizeof(OSStateFlags)); + NANDClose(&file); + + if (bytesRead != sizeof(OSStateFlags)) { + NANDDelete("/title/00000001/00000002/data/state.dat"); + memset(state, 0, sizeof(OSStateFlags)); + return FALSE; + } + } else { + memset(state, 0, sizeof(OSStateFlags)); + return FALSE; + } + + if (CheckSum(&StateFlags) != StateFlags.checksum) { + memset(state, 0, sizeof(OSStateFlags)); + return FALSE; + } + + memcpy(state, &StateFlags, sizeof(OSStateFlags)); + return TRUE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateTM.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateTM.c new file mode 100644 index 0000000000..07a8a8cbde --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSStateTM.c @@ -0,0 +1,304 @@ +#include +#include +#include + +typedef enum { + STM_IOCTL_REG_STM_EVENT = 0x1000, + STM_IOCTL_HOT_RESET = 0x2001, + STM_IOCTL_SHUTDOWN_TO_SBY = 0x2003, + STM_IOCTL_UNREG_STM_EVENT = 0x3002, + STM_IOCTL_SET_VI_DIM = 0x5001, + STM_IOCTL_SET_IDLE_LED_MODE = 0x6002, +} OSStateTMIoctl; + +static u8 StmEhInBuf[32] ALIGN(32); +static u8 StmEhOutBuf[32] ALIGN(32); + +static u8 StmImInBuf[32] ALIGN(32); +static u8 StmImOutBuf[32] ALIGN(32); + +static u8 StmVdInBuf[32] ALIGN(32); +static u8 StmVdOutBuf[32] ALIGN(32); + +static OSStateCallback ResetCallback; +static OSStateCallback PowerCallback; + +static BOOL StmVdInUse; + +static BOOL StmEhRegistered; +static BOOL StmEhDesc; + +static BOOL StmImDesc; + +static BOOL StmReady; +static BOOL ResetDown; + +static s32 AccessVIDimRegs(void); +static s32 __OSVIDimReplyHandler(s32 result, void* arg); +static void __OSRegisterStateEvent(void); +static void __OSDefaultResetCallback(void); +static void __OSDefaultPowerCallback(void); +static s32 __OSStateEventHandler(s32 result, void* arg); +static void LockUp(void); + +OSStateCallback OSSetResetCallback(OSStateCallback callback) { + BOOL enabled; + OSStateCallback old; + + enabled = OSDisableInterrupts(); + + old = ResetCallback; + ResetCallback = callback; + + if (!StmEhRegistered) { + __OSRegisterStateEvent(); + } + + OSRestoreInterrupts(enabled); + return old; +} + +OSStateCallback OSSetPowerCallback(OSStateCallback callback) { + BOOL enabled; + OSStateCallback old; + + enabled = OSDisableInterrupts(); + + old = PowerCallback; + PowerCallback = callback; + + if (!StmEhRegistered) { + __OSRegisterStateEvent(); + } + + OSRestoreInterrupts(enabled); + return old; +} + +BOOL __OSInitSTM(void) { + BOOL success; + + PowerCallback = __OSDefaultPowerCallback; + ResetCallback = __OSDefaultResetCallback; + ResetDown = FALSE; + + if (StmReady) { + return TRUE; + } + + StmVdInUse = FALSE; + StmImDesc = IOS_Open("/dev/stm/immediate", IPC_OPEN_NONE); + if (StmImDesc < 0) { + StmReady = FALSE; + success = FALSE; + goto exit; + } + + StmEhDesc = IOS_Open("/dev/stm/eventhook", IPC_OPEN_NONE); + if (StmEhDesc < 0) { + StmReady = FALSE; + success = FALSE; + goto exit; + } + + __OSRegisterStateEvent(); + StmReady = TRUE; + success = TRUE; + +exit: + return success; +} + +void __OSShutdownToSBY(void) { +#define in_args ((u32*)StmImInBuf) + + VI_HW_REGS[VI_DCR] = 0; + + // clang-format off +#line 276 + OS_ASSERT(StmReady, "Error: The firmware doesn't support shutdown feature.\n"); + // clang-format on + + in_args[0] = 0; + IOS_Ioctl(StmImDesc, STM_IOCTL_SHUTDOWN_TO_SBY, StmImInBuf, + sizeof(StmImInBuf), StmImOutBuf, sizeof(StmImOutBuf)); + LockUp(); + +#undef in_args +} + +void __OSHotReset(void) { + VI_HW_REGS[VI_DCR] = 0; + + // clang-format off +#line 340 + OS_ASSERT(StmReady, "Error: The firmware doesn't support reboot feature.\n"); + // clang-format on + + IOS_Ioctl(StmImDesc, STM_IOCTL_HOT_RESET, StmImInBuf, sizeof(StmImInBuf), + StmImOutBuf, sizeof(StmImOutBuf)); + LockUp(); +} + +BOOL __OSGetResetButtonStateRaw(void) { + return (!(PI_HW_REGS[PI_INTSR] & PI_INTSR_RSWST)) ? TRUE : FALSE; +} + +s32 __OSSetVIForceDimming(u32 arg0, u32 arg1, u32 arg2) { +#define in_args ((u32*)StmVdInBuf) + + BOOL enabled; + + if (!StmReady) { + return -10; + } + + enabled = OSDisableInterrupts(); + + if (StmVdInUse) { + OSRestoreInterrupts(enabled); + return 0; + } + + StmVdInUse = TRUE; + OSRestoreInterrupts(enabled); + + // Screen brightness + in_args[0] = arg1 << 3 | arg2 | arg0 << 7; + + in_args[1] = 0; + in_args[2] = 0; + in_args[3] = 0; + in_args[4] = 0; + + in_args[5] = 0xFFFFFFFF; + in_args[6] = 0xFFFF0000; + + in_args[7] = 0; + + return AccessVIDimRegs(); + +#undef in_args +} + +s32 __OSSetIdleLEDMode(u32 mode) { +#define in_args ((u32*)StmImInBuf) + + if (!StmReady) { + return -6; + } + + in_args[0] = mode; + + return IOS_Ioctl(StmImDesc, STM_IOCTL_SET_IDLE_LED_MODE, StmImInBuf, + sizeof(StmImInBuf), StmImOutBuf, sizeof(StmImOutBuf)); + +#undef in_args +} + +s32 __OSUnRegisterStateEvent(void) { + IPCResult result; + + if (!StmEhRegistered) { + return 0; + } + + if (!StmReady) { + return -6; + } + + result = IOS_Ioctl(StmImDesc, STM_IOCTL_UNREG_STM_EVENT, StmImInBuf, + sizeof(StmImInBuf), StmImOutBuf, sizeof(StmImOutBuf)); + if (result == IPC_RESULT_OK) { + StmEhRegistered = FALSE; + } + + return result; +} + +static s32 AccessVIDimRegs(void) { + IPCResult result = IOS_IoctlAsync( + StmImDesc, STM_IOCTL_SET_VI_DIM, StmVdInBuf, sizeof(StmVdInBuf), + StmVdOutBuf, sizeof(StmVdOutBuf), __OSVIDimReplyHandler, NULL); + return result != IPC_RESULT_OK ? result : 1; +} + +static s32 __OSVIDimReplyHandler(s32 result, void* arg) { +#pragma unused(result) +#pragma unused(arg) + + StmVdInUse = FALSE; + return IPC_RESULT_OK; +} + +static void __OSRegisterStateEvent(void) { + BOOL enabled = OSDisableInterrupts(); + + if (IOS_IoctlAsync(StmEhDesc, STM_IOCTL_REG_STM_EVENT, StmEhInBuf, + sizeof(StmEhInBuf), StmEhOutBuf, sizeof(StmEhOutBuf), + __OSStateEventHandler, NULL) == IPC_RESULT_OK) { + StmEhRegistered = TRUE; + } else { + StmEhRegistered = FALSE; + } + + OSRestoreInterrupts(enabled); +} + +static void __OSDefaultResetCallback(void) {} + +static void __OSDefaultPowerCallback(void) {} + +static s32 __OSStateEventHandler(s32 result, void* arg) { +#pragma unused(result) +#pragma unused(arg) + +#define out_args ((u32*)StmEhOutBuf) + + BOOL enabled; + OSStateCallback callback; + + // clang-format off +#line 748 + OS_ASSERT(result == IPC_RESULT_OK, "Error on STM state event handler\n"); + // clang-format on + + StmEhRegistered = FALSE; + + if (out_args[0] == 0x20000) { + if (__OSGetResetButtonStateRaw()) { + enabled = OSDisableInterrupts(); + + callback = ResetCallback; + ResetDown = TRUE; + ResetCallback = __OSDefaultResetCallback; + callback(); + + OSRestoreInterrupts(enabled); + } + __OSRegisterStateEvent(); + } + + if (out_args[0] == 0x800) { + enabled = OSDisableInterrupts(); + + callback = PowerCallback; + PowerCallback = __OSDefaultPowerCallback; + callback(); + + OSRestoreInterrupts(enabled); + } + + return IPC_RESULT_OK; + +#undef out_args +} + +static void LockUp(void) { + OSDisableInterrupts(); + ICFlashInvalidate(); + + while (TRUE) { + ; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSSync.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSSync.c new file mode 100644 index 0000000000..e9c209a70f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSSync.c @@ -0,0 +1,39 @@ +#include +#include +#include + +#define OS_PHYS_SYSCALL_INTR 0xC00 +#define OS_INTR_SLOT_SIZE 0x100 + +void __OSSystemCallVectorStart(void); +void __OSSystemCallVectorEnd(void); + +static asm void SystemCallVector(void) { + // clang-format off + nofralloc + + entry __OSSystemCallVectorStart + mfhid0 r9 + ori r10, r9, HID0_ABE + mthid0 r10 + isync + sync + + mthid0 r9 + rfi + + entry __OSSystemCallVectorEnd + nop + // clang-format on +} + +void __OSInitSystemCall(void) { + memcpy(OSPhysicalToCached(OS_PHYS_SYSCALL_INTR), __OSSystemCallVectorStart, + (u32)__OSSystemCallVectorEnd - (u32)__OSSystemCallVectorStart); + + DCFlushRangeNoSync(OSPhysicalToCached(OS_PHYS_SYSCALL_INTR), + OS_INTR_SLOT_SIZE); + __sync(); + ICInvalidateRange(OSPhysicalToCached(OS_PHYS_SYSCALL_INTR), + OS_INTR_SLOT_SIZE); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSThread.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSThread.c new file mode 100644 index 0000000000..f88c588421 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSThread.c @@ -0,0 +1,954 @@ +#include + +static void DefaultSwitchThreadCallback(OSThread* currThread, + OSThread* newThread); + +static OSSwitchThreadCallback SwitchThreadCallback = + DefaultSwitchThreadCallback; + +static OSThread DefaultThread; +static OSThreadQueue RunQueue[32]; +static OSContext IdleContext; +static OSThread IdleThread; + +volatile static s32 Reschedule = 0; +volatile static BOOL RunQueueHint = FALSE; +volatile static u32 RunQueueBits = 0; + +static void DefaultSwitchThreadCallback(OSThread* currThread, + OSThread* newThread){ +#pragma unused(currThread) +#pragma unused(newThread) +} + +OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback newCb) { + OSSwitchThreadCallback oldCb; + BOOL enabled = OSDisableInterrupts(); + + oldCb = SwitchThreadCallback; + SwitchThreadCallback = + (newCb != NULL) ? newCb : DefaultSwitchThreadCallback; + + OSRestoreInterrupts(enabled); + return (oldCb == DefaultSwitchThreadCallback) ? NULL : oldCb; +} + +void __OSThreadInit(void) { + int i; + OSThread* thread = &DefaultThread; + OSThread* tail; + + thread->state = OS_THREAD_STATE_RUNNING; + thread->flags = OS_THREAD_DETACHED; + thread->base = 16; + thread->priority = 16; + thread->suspend = 0; + thread->val = 0xFFFFFFFF; + thread->mutex = NULL; + + OSInitThreadQueue(&thread->joinQueue); + OSInitMutexQueue(&thread->mutexQueue); + + OS_CURRENT_FPU_CONTEXT = &thread->context; + OSClearContext(&thread->context); + OSSetCurrentContext(&thread->context); + + thread->stackBegin = (u32*)_stack_addr; + thread->stackEnd = (u32*)_stack_end; + *thread->stackEnd = OS_THREAD_STACK_MAGIC; + + OSSetCurrentThread(thread); + OSClearStack(0x00); + + RunQueueBits = 0; + RunQueueHint = FALSE; + for (i = 0; i < 32; i++) { + OSInitThreadQueue(&RunQueue[i]); + } + + OSInitThreadQueue(&OS_THREAD_QUEUE); + + tail = OS_THREAD_QUEUE.tail; + if (tail == NULL) { + OS_THREAD_QUEUE.head = thread; + } else { + tail->nextActive = thread; + } + + thread->prevActive = tail; + thread->nextActive = NULL; + OS_THREAD_QUEUE.tail = thread; + + OSClearContext(&IdleContext); + Reschedule = 0; +} + +void OSSetCurrentThread(OSThread* thread) { + SwitchThreadCallback(OSGetCurrentThread(), thread); + OS_CURRENT_THREAD = thread; +} + +void OSInitMutexQueue(OSMutexQueue* queue) { + queue->tail = NULL; + queue->head = NULL; +} + +void OSInitThreadQueue(OSThreadQueue* queue) { + queue->tail = NULL; + queue->head = NULL; +} + +OSThread* OSGetCurrentThread(void) { + return OS_CURRENT_THREAD; +} + +static void __OSSwitchThread(OSThread* thread) { + OSSetCurrentThread(thread); + OSSetCurrentContext(&thread->context); + OSLoadContext(&thread->context); +} + +BOOL OSIsThreadTerminated(OSThread* thread) { + return thread->state == OS_THREAD_STATE_MORIBUND || + thread->state == OS_THREAD_STATE_EXITED + ? TRUE + : FALSE; +} + +static BOOL __OSIsThreadActive(OSThread* thread) { + OSThread* iter; + + if (thread->state == OS_THREAD_STATE_EXITED) { + return FALSE; + } + + for (iter = OS_THREAD_QUEUE.head; iter != NULL; iter = iter->nextActive) { + if (thread == iter) { + return TRUE; + } + } + + return FALSE; +} + +s32 OSDisableScheduler(void) { + s32 old; + BOOL enabled = OSDisableInterrupts(); + + old = Reschedule++; + + OSRestoreInterrupts(enabled); + + return old; +} + +s32 OSEnableScheduler(void) { + s32 old; + BOOL enabled = OSDisableInterrupts(); + + old = Reschedule--; + + OSRestoreInterrupts(enabled); + + return old; +} + +void OSClearStack(u8 val) { + u32* end; + u32* begin; + u32 longVal; + + longVal = val << 24 | val << 16 | val << 8 | val; + + begin = (u32*)OSGetStackPointer(); + end = OSGetCurrentThread()->stackEnd + 1; + + for (; end < (u32*)begin; end++) { + *end = longVal; + } +} + +static void SetRun(OSThread* thread) { + OSThreadQueue* queue; + OSThread* tail; + + queue = &RunQueue[thread->priority]; + thread->queue = queue; + tail = thread->queue->tail; + + if (tail == NULL) { + thread->queue->head = thread; + } else { + tail->next = thread; + } + + thread->prev = tail; + thread->next = NULL; + thread->queue->tail = thread; + + RunQueueBits |= (1 << OS_PRIORITY_MAX - thread->priority); + RunQueueHint = TRUE; +} + +static void UnsetRun(OSThread* thread) DECOMP_DONT_INLINE { + OSThreadQueue* queue; + OSThread* next; + OSThread* prev; + + next = thread->next; + queue = thread->queue; + prev = thread->prev; + + if (next == NULL) { + queue->tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + queue->head = next; + } else { + prev->next = next; + } + + if (queue->head == NULL) { + RunQueueBits &= ~(1 << OS_PRIORITY_MAX - thread->priority); + } + + thread->queue = NULL; +} + +s32 __OSGetEffectivePriority(OSThread* thread) { + s32 prio = thread->base; + + OSMutex* mutex; + for (mutex = thread->mutexQueue.head; mutex != NULL; mutex = mutex->next) { + OSThread* mutexThread = mutex->queue.head; + if (mutexThread != NULL && mutexThread->priority < prio) { + prio = mutexThread->priority; + } + } + + return prio; +} + +static OSThread* SetEffectivePriority(OSThread* thread, s32 prio) { + OSThread* iter; + OSThread* iterPrev; + OSThread* next; + OSThread* prev; + + switch (thread->state) { + case OS_THREAD_STATE_READY: + UnsetRun(thread); + thread->priority = prio; + thread->queue = &RunQueue[prio]; + SetRun(thread); + break; + case OS_THREAD_STATE_SLEEPING: + next = thread->next; + prev = thread->prev; + if (next == NULL) { + thread->queue->tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + thread->queue->head = next; + } else { + prev->next = next; + } + + thread->priority = prio; + + for (iter = thread->queue->head; + iter != NULL && iter->priority <= thread->priority; + iter = iter->next) { + } + + if (iter == NULL) { + iter = thread->queue->tail; + if (iter == NULL) { + thread->queue->head = thread; + } else { + iter->next = thread; + } + thread->prev = iter; + thread->next = NULL; + thread->queue->tail = thread; + } else { + thread->next = iter; + iterPrev = iter->prev; + iter->prev = thread; + thread->prev = iterPrev; + + if (iterPrev == NULL) { + thread->queue->head = thread; + } else { + iterPrev->next = thread; + } + } + + if (thread->mutex != NULL) { + return thread->mutex->thread; + } + break; + case OS_THREAD_STATE_RUNNING: + RunQueueHint = TRUE; + thread->priority = prio; + break; + default: + break; + } + + return NULL; +} + +static void UpdatePriority(OSThread* thread) { + s32 prio = 0; + + while (TRUE) { + if (thread->suspend > 0) { + return; + } + + prio = __OSGetEffectivePriority(thread); + if (thread->priority == prio) { + return; + } + + thread = SetEffectivePriority(thread, prio); + if (thread == NULL) { + return; + } + } +} + +void __OSPromoteThread(OSThread* thread, s32 prio) { + while (TRUE) { + if (thread->suspend > 0) { + return; + } + + if (thread->priority <= prio) { + return; + } + + thread = SetEffectivePriority(thread, prio); + if (thread == NULL) { + return; + } + } +} + +static OSThread* SelectThread(BOOL b) { + OSThreadQueue* queue; + OSThread* currThread; + OSThread* head; + OSThread* next; + OSContext* currCtx; + s32 prio; + + if (Reschedule > 0) { + return NULL; + } + + currCtx = OSGetCurrentContext(); + currThread = OSGetCurrentThread(); + + if (currCtx != &currThread->context) { + return NULL; + } + + if (currThread != NULL) { + if (currThread->state == OS_THREAD_STATE_RUNNING) { + if (!b) { + prio = __cntlzw(RunQueueBits); + if (currThread->priority <= prio) { + return NULL; + } + } + + currThread->state = OS_THREAD_STATE_READY; + SetRun(currThread); + } + + if (!(currThread->context.state & 0x2)) { + if (OSSaveContext(&currThread->context)) { + return NULL; + } + } + } + + if (RunQueueBits == 0) { + OSSetCurrentThread(NULL); + OSSetCurrentContext(&IdleContext); + + do { + OSEnableInterrupts(); + + while (RunQueueBits == 0) { + } + OSDisableInterrupts(); + + } while (RunQueueBits == 0); + + OSClearContext(&IdleContext); + } + + RunQueueHint = FALSE; + + prio = __cntlzw(RunQueueBits); + queue = &RunQueue[prio]; + head = queue->head; + next = head->next; + + if (next == NULL) { + queue->tail = NULL; + } else { + next->prev = NULL; + } + + queue->head = next; + if (next == NULL) { + RunQueueBits &= ~(1 << OS_PRIORITY_MAX - prio); + } + + head->queue = NULL; + head->state = OS_THREAD_STATE_RUNNING; + __OSSwitchThread(head); + return head; +} + +void __OSReschedule(void) { + if (RunQueueHint) { + SelectThread(FALSE); + } +} + +void OSYieldThread(void) { + BOOL enabled = OSDisableInterrupts(); + SelectThread(TRUE); + OSRestoreInterrupts(enabled); +} + +BOOL OSCreateThread(OSThread* thread, OSThreadFunc func, void* funcArg, + void* stackBegin, u32 stackSize, s32 prio, u16 flags) { + BOOL enabled; + int i; + OSThread* tail; + void* sp; + + if (prio < OS_PRIORITY_MIN || prio > OS_PRIORITY_MAX) { + return FALSE; + } + + thread->state = OS_THREAD_STATE_READY; + thread->flags = flags & OS_THREAD_DETACHED; + thread->base = prio; + thread->priority = prio; + thread->suspend = 1; + thread->val = 0xFFFFFFFF; + thread->mutex = NULL; + OSInitThreadQueue(&thread->joinQueue); + OSInitMutexQueue(&thread->mutexQueue); + + sp = ROUND_DOWN_PTR(stackBegin, 8); + *((u32*)sp - 2) = 0x00000000; + *((u32*)sp - 1) = 0x00000000; + + OSInitContext(&thread->context, func, (char*)sp - 8); + thread->context.lr = (u32)OSExitThread; + thread->context.gprs[3] = (u32)funcArg; + + thread->stackBegin = (u32*)stackBegin; + thread->stackEnd = (u32*)((char*)stackBegin - stackSize); + *thread->stackEnd = OS_THREAD_STACK_MAGIC; + + thread->error = 0; + for (i = 0; i < 2; i++) { + thread->specific[i] = NULL; + } + + enabled = OSDisableInterrupts(); + if (__OSErrorTable[OS_ERR_FP_EXCEPTION] != NULL) { + thread->context.srr1 |= 0x900; + thread->context.state |= 0x1; + thread->context.fpscr = __OSFpscrEnableBits & 0xF8; + thread->context.fpscr |= 0x4; + + for (i = 0; i < 32; i++) { + *(u64*)&thread->context.fprs[i] = 0xFFFFFFFFFFFFFFFF; + *(u64*)&thread->context.psfs[i] = 0xFFFFFFFFFFFFFFFF; + } + } + + tail = OS_THREAD_QUEUE.tail; + if (tail == NULL) { + OS_THREAD_QUEUE.head = thread; + } else { + tail->nextActive = thread; + } + + thread->prevActive = tail; + thread->nextActive = NULL; + OS_THREAD_QUEUE.tail = thread; + tail = thread; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +void OSExitThread(OSThread* thread) { + BOOL enabled; + OSThread* currThread; + OSThread* next; + OSThread* prev; + + enabled = OSDisableInterrupts(); + currThread = OSGetCurrentThread(); + OSClearContext(&currThread->context); + + if ((currThread->flags & OS_THREAD_DETACHED)) { + next = currThread->nextActive; + prev = currThread->prevActive; + + if (next == NULL) { + OS_THREAD_QUEUE.tail = prev; + } else { + next->prevActive = prev; + } + + if (prev == NULL) { + OS_THREAD_QUEUE.head = next; + } else { + prev->nextActive = next; + } + + currThread->state = OS_THREAD_STATE_EXITED; + } else { + currThread->state = OS_THREAD_STATE_MORIBUND; + currThread->val = (u32)thread; + } + + __OSUnlockAllMutex(currThread); + OSWakeupThread(&currThread->joinQueue); + RunQueueHint = TRUE; + __OSReschedule(); + OSRestoreInterrupts(enabled); +} + +void OSCancelThread(OSThread* thread) { + BOOL enabled; + OSThread* next; + OSThread* prev; + + enabled = OSDisableInterrupts(); + + switch (thread->state) { + case OS_THREAD_STATE_READY: + if (thread->suspend <= 0) { + UnsetRun(thread); + } + break; + case OS_THREAD_STATE_RUNNING: + RunQueueHint = 1; + break; + case OS_THREAD_STATE_SLEEPING: + next = thread->next; + prev = thread->prev; + if (next == NULL) { + thread->queue->tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + thread->queue->head = next; + } else { + prev->next = next; + } + + thread->queue = NULL; + if (thread->suspend <= 0 && thread->mutex != NULL) { + UpdatePriority(thread->mutex->thread); + } + break; + default: + OSRestoreInterrupts(enabled); + return; + break; + } + + OSClearContext(&thread->context); + if (thread->flags & OS_THREAD_DETACHED) { + next = thread->nextActive; + prev = thread->prevActive; + + if (next == NULL) { + OS_THREAD_QUEUE.tail = prev; + } else { + next->prevActive = prev; + } + + if (prev == NULL) { + OS_THREAD_QUEUE.head = next; + } else { + prev->nextActive = next; + } + + thread->state = OS_THREAD_STATE_EXITED; + } else { + thread->state = OS_THREAD_STATE_MORIBUND; + } + + __OSUnlockAllMutex(thread); + OSWakeupThread(&thread->joinQueue); + __OSReschedule(); + OSRestoreInterrupts(enabled); +} + +BOOL OSJoinThread(OSThread* thread, void* val) { + BOOL enabled; + OSThread* next; + OSThread* prev; + + enabled = OSDisableInterrupts(); + + if (!(thread->flags & OS_THREAD_DETACHED) && + thread->state != OS_THREAD_STATE_MORIBUND && + thread->joinQueue.head == NULL) { + OSSleepThread(&thread->joinQueue); + if (!__OSIsThreadActive(thread)) { + OSRestoreInterrupts(enabled); + return FALSE; + } + } + + if (thread->state == OS_THREAD_STATE_MORIBUND) { + if (val != NULL) { + *(u32*)val = thread->val; + } + + next = thread->nextActive; + prev = thread->prevActive; + + if (next == NULL) { + OS_THREAD_QUEUE.tail = prev; + } else { + next->prevActive = prev; + } + + if (prev == NULL) { + OS_THREAD_QUEUE.head = next; + } else { + prev->nextActive = next; + } + + thread->state = OS_THREAD_STATE_EXITED; + + OSRestoreInterrupts(enabled); + return TRUE; + } + + OSRestoreInterrupts(enabled); + return FALSE; +} + +void OSDetachThread(OSThread* thread) { + BOOL enabled; + OSThread* next; + OSThread* prev; + + enabled = OSDisableInterrupts(); + thread->flags |= OS_THREAD_DETACHED; + + if (thread->state == OS_THREAD_STATE_MORIBUND) { + next = thread->nextActive; + prev = thread->prevActive; + + if (next == NULL) { + OS_THREAD_QUEUE.tail = prev; + } else { + next->prevActive = prev; + } + + if (prev == NULL) { + OS_THREAD_QUEUE.head = next; + } else { + prev->nextActive = next; + } + + thread->state = OS_THREAD_STATE_EXITED; + } + + OSWakeupThread(&thread->joinQueue); + OSRestoreInterrupts(enabled); +} + +s32 OSResumeThread(OSThread* thread) { + BOOL enabled; + s32 suspend; + OSThread* iter; + OSThread* iterPrev; + OSThread* next; + OSThread* prev; + + enabled = OSDisableInterrupts(); + suspend = thread->suspend--; + + if (thread->suspend < 0) { + thread->suspend = 0; + } else if (thread->suspend == 0) { + switch (thread->state) { + case OS_THREAD_STATE_READY: + thread->priority = __OSGetEffectivePriority(thread); + SetRun(thread); + break; + case OS_THREAD_STATE_SLEEPING: + next = thread->next; + prev = thread->prev; + if (next == NULL) { + thread->queue->tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + thread->queue->head = next; + } else { + prev->next = next; + } + + thread->priority = __OSGetEffectivePriority(thread); + + for (iter = thread->queue->head; + iter != NULL && iter->priority <= thread->priority; + iter = iter->next) { + } + + if (iter == NULL) { + iter = thread->queue->tail; + if (iter == NULL) { + thread->queue->head = thread; + } else { + iter->next = thread; + } + thread->prev = iter; + thread->next = NULL; + thread->queue->tail = thread; + } else { + thread->next = iter; + iterPrev = iter->prev; + iter->prev = thread; + thread->prev = iterPrev; + + if (iterPrev == NULL) { + thread->queue->head = thread; + } else { + iterPrev->next = thread; + } + } + + if (thread->mutex != NULL) { + UpdatePriority(thread->mutex->thread); + } + break; + default: + break; + } + + __OSReschedule(); + } + + OSRestoreInterrupts(enabled); + return suspend; +} + +s32 OSSuspendThread(OSThread* thread) { + BOOL enabled; + s32 suspend; + OSThread* next; + OSThread* prev; + OSThread* tail; + + enabled = OSDisableInterrupts(); + suspend = thread->suspend++; + + if (suspend == 0) { + switch (thread->state) { + case OS_THREAD_STATE_RUNNING: + RunQueueHint = TRUE; + thread->state = OS_THREAD_STATE_READY; + break; + case OS_THREAD_STATE_READY: + UnsetRun(thread); + break; + case OS_THREAD_STATE_SLEEPING: + next = thread->next; + prev = thread->prev; + if (next == NULL) { + thread->queue->tail = prev; + } else { + next->prev = prev; + } + + if (prev == NULL) { + thread->queue->head = next; + } else { + prev->next = next; + } + + thread->priority = OS_PRIORITY_MAX + 1; + + tail = thread->queue->tail; + if (tail == NULL) { + thread->queue->head = thread; + } else { + tail->next = thread; + } + + thread->prev = tail; + thread->next = NULL; + thread->queue->tail = thread; + tail = thread; + + if (thread->mutex != NULL) { + UpdatePriority(thread->mutex->thread); + } + break; + default: + break; + } + + __OSReschedule(); + } + + OSRestoreInterrupts(enabled); + return suspend; +} + +void OSSleepThread(OSThreadQueue* queue) { + BOOL enabled; + OSThread* currThread; + OSThread* iter; + OSThread* iterPrev; + + enabled = OSDisableInterrupts(); + currThread = OSGetCurrentThread(); + + currThread->state = OS_THREAD_STATE_SLEEPING; + currThread->queue = queue; + + for (iter = queue->head; + iter != NULL && iter->priority <= currThread->priority; + iter = iter->next) { + } + + if (iter == NULL) { + iter = queue->tail; + if (iter == NULL) { + queue->head = currThread; + } else { + iter->next = currThread; + } + currThread->prev = iter; + currThread->next = NULL; + queue->tail = currThread; + } else { + currThread->next = iter; + iterPrev = iter->prev; + iter->prev = currThread; + currThread->prev = iterPrev; + + if (iterPrev == NULL) { + queue->head = currThread; + } else { + iterPrev->next = currThread; + } + } + + RunQueueHint = TRUE; + __OSReschedule(); + OSRestoreInterrupts(enabled); +} + +void OSWakeupThread(OSThreadQueue* queue) { + BOOL enabled; + OSThread* head; + OSThread* next; + + enabled = OSDisableInterrupts(); + + while (queue->head != NULL) { + head = queue->head; + next = head->next; + + if (next == NULL) { + queue->tail = NULL; + } else { + next->prev = NULL; + } + + queue->head = next; + + head->state = OS_THREAD_STATE_READY; + if (head->suspend <= 0) { + SetRun(head); + } + } + + __OSReschedule(); + OSRestoreInterrupts(enabled); +} + +BOOL OSSetThreadPriority(OSThread* thread, s32 prio) { + BOOL enabled; + + if (prio < OS_PRIORITY_MIN || prio > OS_PRIORITY_MAX) { + return FALSE; + } + + enabled = OSDisableInterrupts(); + + if (thread->base != prio) { + thread->base = prio; + UpdatePriority(thread); + __OSReschedule(); + } + + OSRestoreInterrupts(enabled); + return TRUE; +} + +static void SleepAlarmHandler(OSAlarm* alarm, OSContext* ctx) { +#pragma unused(ctx) + + OSResumeThread((OSThread*)OSGetAlarmUserData(alarm)); +} + +void OSSleepTicks(s64 ticks) { + BOOL enabled; + OSAlarm alarm; + OSThread* thread; + + enabled = OSDisableInterrupts(); + + thread = OS_CURRENT_THREAD; + if (thread == NULL) { + OSRestoreInterrupts(enabled); + return; + } + + OSCreateAlarm(&alarm); + OSSetAlarmTag(&alarm, (u32)thread); + OSSetAlarmUserData(&alarm, thread); + OSSetAlarm(&alarm, ticks, SleepAlarmHandler); + + OSSuspendThread(thread); + OSCancelAlarm(&alarm); + OSRestoreInterrupts(enabled); +} + +DECOMP_FORCEACTIVE(OSThread_c, IdleThread); diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSTime.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSTime.c new file mode 100644 index 0000000000..c424e6f94d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSTime.c @@ -0,0 +1,155 @@ +#include + +#define USEC_MAX 1000 +#define MSEC_MAX 1000 +#define MONTH_MAX 12 +#define WEEK_DAY_MAX 7 +#define YEAR_DAY_MAX 365 + +#define SECS_IN_MIN 60 +#define SECS_IN_HOUR (SECS_IN_MIN * 60) +#define SECS_IN_DAY (SECS_IN_HOUR * 24) +#define SECS_IN_YEAR (SECS_IN_DAY * 365) + +#define BIAS 0xB2575 + +// End of each month in standard year +static s32 YearDays[MONTH_MAX] = {0, 31, 59, 90, 120, 151, + 181, 212, 243, 273, 304, 334}; +// End of each month in leap year +static s32 LeapYearDays[MONTH_MAX] = {0, 31, 60, 91, 121, 152, + 182, 213, 244, 274, 305, 335}; + +asm s64 OSGetTime(void) { + // clang-format off + nofralloc + + mftbu r3 + mftb r4 + + // Check for possible carry from TBL to TBU + mftbu r5 + cmpw r3, r5 + bne OSGetTime + + blr + // clang-format on +} + +asm u32 OSGetTick(void){ + // clang-format off + nofralloc + + mftb r3 + blr + // clang-format on +} + +s64 __OSGetSystemTime(void) { + BOOL enabled = OSDisableInterrupts(); + s64 time = OSGetTime() + OS_SYSTEM_TIME; + OSRestoreInterrupts(enabled); + return time; +} + +s64 __OSTimeToSystemTime(s64 time) { + BOOL enabled = OSDisableInterrupts(); + s64 sysTime = OS_SYSTEM_TIME + time; + OSRestoreInterrupts(enabled); + return sysTime; +} + +static BOOL IsLeapYear(s32 year) { + return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); +} + +static s32 GetYearDays(s32 year, s32 mon) { + return (IsLeapYear(year) ? LeapYearDays : YearDays)[mon]; +} + +static s32 GetLeapDays(s32 year) { + if (year < 1) { + return 0; + } + return (year + 3) / 4 - (year - 1) / 100 + (year - 1) / 400; +} + +static void GetDates(s32 days, OSCalendarTime* cal) DECOMP_DONT_INLINE { + s32 year; + s32 totalDays; + s32* p_days; + s32 month; + + cal->wday = (days + 6) % WEEK_DAY_MAX; + + // WTF?? + for (year = days / YEAR_DAY_MAX; + days < (totalDays = year * YEAR_DAY_MAX + GetLeapDays(year)); year--) { + ; + } + days -= totalDays; + cal->year = year; + cal->yday = days; + + p_days = IsLeapYear(year) ? LeapYearDays : YearDays; + for (month = MONTH_MAX; days < p_days[--month];) { + ; + } + cal->month = month; + cal->mday = days - p_days[month] + 1; +} + +void OSTicksToCalendarTime(s64 ticks, OSCalendarTime* cal) { + s32 days, secs; + s64 d; + + d = ticks % OS_SEC_TO_TICKS(1); + if (d < 0) { + d += OS_SEC_TO_TICKS(1); + } + + cal->usec = OS_TICKS_TO_USEC(d) % USEC_MAX; + cal->msec = OS_TICKS_TO_MSEC(d) % MSEC_MAX; + ticks -= d; + + days = (OS_TICKS_TO_SEC(ticks) / SECS_IN_DAY) + BIAS; + secs = OS_TICKS_TO_SEC(ticks) % SECS_IN_DAY; + if (secs < 0) { + days -= 1; + secs += SECS_IN_DAY; + } + + GetDates(days, cal); + cal->hour = secs / 60 / 60; + cal->min = secs / 60 % 60; + cal->sec = secs % 60; +} + +s64 OSCalendarTimeToTicks(const OSCalendarTime* cal) { + s64 seconds; + s32 month; + s32 ovMon; + s32 year; + + ovMon = cal->month / MONTH_MAX; + month = cal->month - (ovMon * MONTH_MAX); + + if (month < 0) { + month += MONTH_MAX; + ovMon--; + } + + year = cal->year + ovMon; + + // clang-format off + seconds = (s64)SECS_IN_YEAR * year + + (s64)SECS_IN_DAY * (cal->mday + GetLeapDays(year) + GetYearDays(year, month) - 1) + + (s64)SECS_IN_HOUR * cal->hour + + (s64)SECS_IN_MIN * cal->min + + cal->sec - + (s64)0xEB1E1BF80ULL; + // clang-format on + + return OS_SEC_TO_TICKS(seconds) + OS_MSEC_TO_TICKS((s64)cal->msec) + + OS_USEC_TO_TICKS((s64)cal->usec); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSUtf.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSUtf.c new file mode 100644 index 0000000000..8bc516fe3d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/OSUtf.c @@ -0,0 +1,3042 @@ +#include + +extern wchar_t UcsAnsiTable[32]; +extern wchar_t* UcsSjisTable[256]; + +const u8* OSUTF8to32(const u8* utf8, u32* utf32) { + u32 code; + u32 full; + u32 size; + int i; + + code = *utf8; + full = 0; + if (code != 0) { + utf8++; + } + + if (!(code & 0x80)) { + full = code; + size = 0; + } else if ((code & 0xE0) == 0xC0) { + full = code & 0x1F; + size = 1; + } else if ((code & 0xF0) == 0xE0) { + full = code & 0xF; + size = 2; + } else if ((code & 0xF8) == 0xF0) { + full = code & 0x7; + size = 3; + } else { + return NULL; + } + + for (i = 0; i < size; i++) { + code = *utf8++; + full <<= 6; + + if ((code & 0xC0) != 0x80) { + return NULL; + } + + full |= code & 0x3F; + } + + if (full <= 0x7F) { + if (size != 0) { + return NULL; + } + } else if (full <= 0x7FF) { + if (size != 1) { + return NULL; + } + } else if (full <= 0xFFFF) { + if (size != 2) { + return NULL; + } + } + + if (full >= 0xD800 && full <= 0xDFFF) { + return NULL; + } + + *utf32 = full; + return utf8; +} + +const wchar_t* OSUTF16to32(const wchar_t* utf16, u32* utf32) { + wchar_t hi, lo; + u32 full; + + hi = *utf16; + if (hi != 0) { + utf16++; + } + + if (hi < 0xD800 || hi > 0xDFFF) { + full = hi; + } else if (hi <= 0xDBFF) { + lo = *utf16++; + + if (lo >= 0xDC00 && lo <= 0xDFFF) { + full = (hi & 0x3FF) << 10 | lo & 0x3FF; + full += 0x10000; + } else { + return NULL; + } + } else { + return NULL; + } + + *utf32 = full; + return utf16; +} + +u8 OSUTF32toANSI(u32 utf32) { + int i; + + if (utf32 > 0xFF) { + return 0; + } + + if (utf32 < 0x80 || utf32 > 0x9F) { + return utf32 & 0xFF; + } + + if (utf32 >= 0x152 && utf32 <= 0x2122) { + for (i = 0; i < LENGTHOF(UcsAnsiTable); i++) { + if (UcsAnsiTable[i] == utf32) { + return i + 0x80 & 0xFF; + } + } + } + + return 0; +} + +wchar_t OSUTF32toSJIS(u32 utf32) { + if (utf32 >= 0x10000) { + return 0; + } + + if (UcsSjisTable[utf32 >> 8 & 0xFF] != NULL) { + return UcsSjisTable[utf32 >> 8 & 0xFF][utf32 & 0xFF]; + } + + return 0; +} + +static wchar_t UcsAnsiTable[32] = { + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178}; + +static wchar_t Ucs00[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0021, 0x0022, 0x0023, + 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, + 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, + 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, + 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, + 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, + 0x005A, 0x005B, 0x815F, 0x005D, 0x005E, 0x005F, 0x0060, 0x0061, 0x0062, + 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, + 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, + 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8191, 0x8192, 0x0000, 0x005C, 0x0000, 0x8198, 0x814E, 0x0000, 0x0000, + 0x0000, 0x81CA, 0x0000, 0x0000, 0x0000, 0x818B, 0x817D, 0x0000, 0x0000, + 0x814C, 0x0000, 0x81F7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x817E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8180, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs03[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x839F, 0x83A0, 0x83A1, 0x83A2, 0x83A3, 0x83A4, 0x83A5, 0x83A6, + 0x83A7, 0x83A8, 0x83A9, 0x83AA, 0x83AB, 0x83AC, 0x83AD, 0x83AE, 0x83AF, + 0x0000, 0x83B0, 0x83B1, 0x83B2, 0x83B3, 0x83B4, 0x83B5, 0x83B6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x83BF, 0x83C0, 0x83C1, + 0x83C2, 0x83C3, 0x83C4, 0x83C5, 0x83C6, 0x83C7, 0x83C8, 0x83C9, 0x83CA, + 0x83CB, 0x83CC, 0x83CD, 0x83CE, 0x83CF, 0x0000, 0x83D0, 0x83D1, 0x83D2, + 0x83D3, 0x83D4, 0x83D5, 0x83D6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs04[256] = { + 0x0000, 0x8446, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8440, 0x8441, + 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, 0x844A, 0x844B, + 0x844C, 0x844D, 0x844E, 0x844F, 0x8450, 0x8451, 0x8452, 0x8453, 0x8454, + 0x8455, 0x8456, 0x8457, 0x8458, 0x8459, 0x845A, 0x845B, 0x845C, 0x845D, + 0x845E, 0x845F, 0x8460, 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, 0x8475, + 0x8477, 0x8478, 0x8479, 0x847A, 0x847B, 0x847C, 0x847D, 0x847E, 0x8480, + 0x8481, 0x8482, 0x8483, 0x8484, 0x8485, 0x8486, 0x8487, 0x8488, 0x8489, + 0x848A, 0x848B, 0x848C, 0x848D, 0x848E, 0x848F, 0x8490, 0x8491, 0x0000, + 0x8476, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs20[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x815D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x815C, 0x8161, 0x0000, 0x8165, 0x8166, 0x0000, + 0x0000, 0x8167, 0x8168, 0x0000, 0x0000, 0x81F5, 0x81F6, 0x0000, 0x0000, + 0x0000, 0x8164, 0x8163, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x81F1, 0x0000, 0x818C, 0x818D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81A6, 0x0000, 0x0000, 0x007E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs21[256] = { + 0x0000, 0x0000, 0x0000, 0x818E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81F0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x81A9, 0x81AA, 0x81A8, 0x81AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x81CB, 0x0000, 0x81CC, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs22[256] = { + 0x81CD, 0x0000, 0x81DD, 0x81CE, 0x0000, 0x0000, 0x0000, 0x81DE, 0x81B8, + 0x0000, 0x0000, 0x81B9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x817C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81E3, + 0x0000, 0x0000, 0x81E5, 0x8187, 0x0000, 0x81DA, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x81C8, 0x81C9, 0x81BF, 0x81BE, 0x81E7, 0x81E8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8188, 0x81E6, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81E4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x81E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8182, 0x81DF, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8185, 0x8186, 0x0000, 0x0000, 0x81E1, 0x81E2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x81BC, 0x81BD, 0x0000, 0x0000, 0x81BA, + 0x81BB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x81DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs23[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x81DC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs25[256] = { + 0x849F, 0x84AA, 0x84A0, 0x84AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x84A1, 0x0000, 0x0000, 0x84AC, 0x84A2, 0x0000, + 0x0000, 0x84AD, 0x84A4, 0x0000, 0x0000, 0x84AF, 0x84A3, 0x0000, 0x0000, + 0x84AE, 0x84A5, 0x84BA, 0x0000, 0x0000, 0x84B5, 0x0000, 0x0000, 0x84B0, + 0x84A7, 0x84BC, 0x0000, 0x0000, 0x84B7, 0x0000, 0x0000, 0x84B2, 0x84A6, + 0x0000, 0x0000, 0x84B6, 0x84BB, 0x0000, 0x0000, 0x84B1, 0x84A8, 0x0000, + 0x0000, 0x84B8, 0x84BD, 0x0000, 0x0000, 0x84B3, 0x84A9, 0x0000, 0x0000, + 0x84B9, 0x0000, 0x0000, 0x84BE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x84B4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81A1, 0x81A0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81A3, 0x81A2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81A5, + 0x81A4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x819F, 0x819E, 0x0000, 0x0000, 0x0000, 0x819B, 0x0000, 0x0000, 0x819D, + 0x819C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81FC, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs26[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x819A, 0x8199, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x818A, 0x0000, 0x8189, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x81F4, 0x0000, + 0x0000, 0x81F3, 0x0000, 0x81F2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs30[256] = { + 0x8140, 0x8141, 0x8142, 0x8156, 0x0000, 0x8158, 0x8159, 0x815A, 0x8171, + 0x8172, 0x8173, 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, 0x8179, 0x817A, + 0x81A7, 0x81AC, 0x816B, 0x816C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8160, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x829F, 0x82A0, 0x82A1, 0x82A2, 0x82A3, 0x82A4, 0x82A5, + 0x82A6, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AB, 0x82AC, 0x82AD, 0x82AE, + 0x82AF, 0x82B0, 0x82B1, 0x82B2, 0x82B3, 0x82B4, 0x82B5, 0x82B6, 0x82B7, + 0x82B8, 0x82B9, 0x82BA, 0x82BB, 0x82BC, 0x82BD, 0x82BE, 0x82BF, 0x82C0, + 0x82C1, 0x82C2, 0x82C3, 0x82C4, 0x82C5, 0x82C6, 0x82C7, 0x82C8, 0x82C9, + 0x82CA, 0x82CB, 0x82CC, 0x82CD, 0x82CE, 0x82CF, 0x82D0, 0x82D1, 0x82D2, + 0x82D3, 0x82D4, 0x82D5, 0x82D6, 0x82D7, 0x82D8, 0x82D9, 0x82DA, 0x82DB, + 0x82DC, 0x82DD, 0x82DE, 0x82DF, 0x82E0, 0x82E1, 0x82E2, 0x82E3, 0x82E4, + 0x82E5, 0x82E6, 0x82E7, 0x82E8, 0x82E9, 0x82EA, 0x82EB, 0x82EC, 0x82ED, + 0x82EE, 0x82EF, 0x82F0, 0x82F1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x814A, 0x814B, 0x8154, 0x8155, 0x0000, 0x0000, 0x8340, + 0x8341, 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, + 0x834A, 0x834B, 0x834C, 0x834D, 0x834E, 0x834F, 0x8350, 0x8351, 0x8352, + 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, 0x835A, 0x835B, + 0x835C, 0x835D, 0x835E, 0x835F, 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, + 0x8365, 0x8366, 0x8367, 0x8368, 0x8369, 0x836A, 0x836B, 0x836C, 0x836D, + 0x836E, 0x836F, 0x8370, 0x8371, 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, + 0x8377, 0x8378, 0x8379, 0x837A, 0x837B, 0x837C, 0x837D, 0x837E, 0x8380, + 0x8381, 0x8382, 0x8383, 0x8384, 0x8385, 0x8386, 0x8387, 0x8388, 0x8389, + 0x838A, 0x838B, 0x838C, 0x838D, 0x838E, 0x838F, 0x8390, 0x8391, 0x8392, + 0x8393, 0x8394, 0x8395, 0x8396, 0x0000, 0x0000, 0x0000, 0x0000, 0x8145, + 0x815B, 0x8152, 0x8153, 0x0000}; + +static wchar_t Ucs4E[256] = { + 0x88EA, 0x929A, 0x0000, 0x8EB5, 0x0000, 0x0000, 0x0000, 0x969C, 0x8FE4, + 0x8E4F, 0x8FE3, 0x89BA, 0x0000, 0x9573, 0x975E, 0x0000, 0x98A0, 0x894E, + 0x0000, 0x0000, 0x8A8E, 0x98A1, 0x90A2, 0x99C0, 0x8B75, 0x95B8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8FE5, 0x0000, 0x0000, 0x97BC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x95C0, 0x0000, 0x0000, 0x0000, 0x98A2, 0x0000, 0x0000, + 0x9286, 0x0000, 0x0000, 0x0000, 0x98A3, 0x8BF8, 0x0000, 0x0000, 0x0000, + 0x98A4, 0x0000, 0x8ADB, 0x924F, 0x0000, 0x8EE5, 0x98A5, 0x0000, 0x0000, + 0x98A6, 0x0000, 0x0000, 0x98A7, 0x9454, 0x0000, 0x8B76, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9456, 0x0000, 0x93E1, 0x8CC1, 0x9652, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE568, 0x98A8, 0x8FE6, 0x98A9, 0x89B3, + 0x0000, 0x0000, 0x0000, 0x8BE3, 0x8CEE, 0x96E7, 0x0000, 0x0000, 0x9BA4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9790, 0x0000, 0x93FB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8AA3, 0x0000, 0x8B54, 0x0000, 0x98AA, 0x0000, 0x0000, 0x98AB, 0x97B9, + 0x0000, 0x975C, 0x9188, 0x98AD, 0x8E96, 0x93F1, 0x0000, 0x98B0, 0x0000, + 0x0000, 0x895D, 0x8CDD, 0x0000, 0x8CDC, 0x88E4, 0x0000, 0x0000, 0x986A, + 0x9869, 0x0000, 0x8DB1, 0x889F, 0x0000, 0x98B1, 0x98B2, 0x98B3, 0x9653, + 0x98B4, 0x0000, 0x8CF0, 0x88E5, 0x9692, 0x0000, 0x8B9C, 0x0000, 0x0000, + 0x8B9D, 0x8B9E, 0x92E0, 0x97BA, 0x0000, 0x98B5, 0x0000, 0x0000, 0x98B6, + 0x0000, 0x0000, 0x98B7, 0x0000, 0x0000, 0x0000, 0x906C, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8F59, 0x906D, 0x98BC, 0x0000, 0x98BA, 0x0000, + 0x98BB, 0x8B77, 0x0000, 0x0000, 0x8DA1, 0x89EE, 0x0000, 0x98B9, 0x98B8, + 0x95A7, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E65, 0x8E64, 0x91BC, 0x98BD, + 0x9574, 0x90E5, 0x0000, 0x0000, 0x0000, 0x8157, 0x98BE, 0x98C0, 0x0000, + 0x0000, 0x0000, 0x91E3, 0x97DF, 0x88C8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x98BF, 0x89BC, 0x0000, 0x8BC2, 0x0000, 0x9287, + 0x0000, 0x0000, 0x0000, 0x8C8F, 0x98C1, 0x0000, 0x0000, 0x0000, 0x9443, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs4F[256] = { + 0x0000, 0x8AE9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x98C2, 0x88C9, 0x0000, 0x0000, 0x8CDE, 0x8AEA, 0x959A, 0x94B0, 0x8B78, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89EF, + 0x0000, 0x98E5, 0x9360, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x948C, 0x98C4, 0x0000, 0x0000, 0x0000, 0x94BA, 0x0000, + 0x97E0, 0x0000, 0x904C, 0x0000, 0x8E66, 0x0000, 0x8E97, 0x89BE, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x92CF, 0x0000, 0x0000, 0x9241, 0x98C8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x88CA, 0x92E1, 0x8F5A, 0x8DB2, + 0x9743, 0x0000, 0x91CC, 0x0000, 0x89BD, 0x0000, 0x98C7, 0x0000, 0x975D, + 0x98C3, 0x98C5, 0x8DEC, 0x98C6, 0x9B43, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x98CE, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x98D1, 0x98CF, 0x0000, 0x0000, 0x89C0, 0x0000, + 0x95B9, 0x98C9, 0x0000, 0x0000, 0x0000, 0x0000, 0x98CD, 0x8CF1, 0x0000, + 0x0000, 0x8E67, 0x0000, 0x0000, 0x0000, 0x8AA4, 0x0000, 0x0000, 0x98D2, + 0x0000, 0x98CA, 0x0000, 0x0000, 0x97E1, 0x0000, 0x8E98, 0x0000, 0x98CB, + 0x0000, 0x98D0, 0x0000, 0x0000, 0x0000, 0x0000, 0x98D3, 0x0000, 0x98CC, + 0x0000, 0x0000, 0x8B9F, 0x0000, 0x88CB, 0x0000, 0x0000, 0x8BA0, 0x89BF, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9B44, 0x0000, 0x9699, 0x958E, 0x8CF2, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x904E, 0x97B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x95D6, 0x0000, 0x0000, 0x8C57, 0x91A3, 0x89E2, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8F72, 0x0000, 0x0000, 0x0000, 0x98D7, + 0x0000, 0x98DC, 0x98DA, 0x0000, 0x0000, 0x98D5, 0x0000, 0x0000, 0x91AD, + 0x98D8, 0x0000, 0x98DB, 0x98D9, 0x0000, 0x95DB, 0x0000, 0x98D6, 0x0000, + 0x904D, 0x0000, 0x9693, 0x98DD, 0x98DE, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8F43, 0x98EB, 0x0000, 0x0000, 0x0000, + 0x946F, 0x0000, 0x9555, 0x98E6, 0x0000, 0x95EE, 0x0000, 0x89B4, 0x0000, + 0x0000, 0x0000, 0x98EA, 0x0000}; + +static wchar_t Ucs50[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x98E4, 0x98ED, 0x0000, 0x0000, + 0x9171, 0x0000, 0x8CC2, 0x0000, 0x947B, 0x0000, 0xE0C5, 0x0000, 0x98EC, + 0x937C, 0x0000, 0x98E1, 0x0000, 0x8CF4, 0x0000, 0x0000, 0x8CF3, 0x98DF, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8ED8, 0x0000, 0x98E7, 0x0000, 0x95ED, + 0x926C, 0x98E3, 0x8C91, 0x0000, 0x98E0, 0x98E8, 0x98E2, 0x97CF, 0x98E9, + 0x9860, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8BE4, 0x0000, 0x0000, 0x8C90, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x98EE, 0x0000, 0x0000, 0x0000, 0x98EF, + 0x98F3, 0x88CC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95CE, 0x98F2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x98F1, 0x98F5, 0x0000, 0x0000, 0x0000, + 0x98F4, 0x0000, 0x92E2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8C92, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x98F6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EC3, 0x0000, 0x91A4, + 0x92E3, 0x8BF4, 0x0000, 0x98F7, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B55, + 0x0000, 0x0000, 0x98F8, 0x0000, 0x0000, 0x0000, 0x0000, 0x98FA, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9654, 0x0000, 0x0000, + 0x0000, 0x8C86, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E50, + 0x94F5, 0x98F9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8DC3, 0x9762, 0x0000, 0x0000, 0x0000, 0x0000, 0x98FC, 0x9942, + 0x98FB, 0x8DC2, 0x0000, 0x8F9D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8C58, 0x0000, 0x0000, 0x0000, 0x9943, 0x0000, 0x0000, 0x8BCD, + 0x0000, 0x0000, 0x0000, 0x9940, 0x9941, 0x0000, 0x0000, 0x93AD, 0x0000, + 0x919C, 0x0000, 0x8BA1, 0x0000, 0x0000, 0x0000, 0x966C, 0x9944, 0x0000, + 0x0000, 0x0000, 0x97BB, 0x0000, 0x0000, 0x0000, 0x9945, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9948, 0x0000, 0x9946, 0x0000, 0x916D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9947, 0x9949, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x994B, 0x0000, 0x0000, 0x0000, 0x994A, 0x0000, 0x95C6, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs51[256] = { + 0x8B56, 0x994D, 0x994E, 0x0000, 0x89AD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x994C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8EF2, 0x0000, 0x9951, 0x9950, 0x994F, 0x0000, 0x98D4, 0x0000, 0x9952, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8F9E, 0x0000, 0x9953, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9744, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x96D7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9955, 0x0000, 0x0000, 0x9954, 0x9957, 0x9956, 0x0000, 0x0000, + 0x9958, 0x9959, 0x88F2, 0x0000, 0x8CB3, 0x8C5A, 0x8F5B, 0x929B, 0x8BA2, + 0x90E6, 0x8CF5, 0x0000, 0x8D8E, 0x995B, 0x96C6, 0x9365, 0x0000, 0x8E99, + 0x0000, 0x995A, 0x0000, 0x995C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x937D, 0x0000, 0x8A95, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x995D, + 0x0000, 0x0000, 0x93FC, 0x0000, 0x0000, 0x9153, 0x995F, 0x9960, 0x94AA, + 0x8CF6, 0x985A, 0x9961, 0x0000, 0x0000, 0x8BA4, 0x0000, 0x0000, 0x0000, + 0x95BA, 0x91B4, 0x8BEF, 0x9354, 0x0000, 0x0000, 0x0000, 0x8C93, 0x0000, + 0x0000, 0x0000, 0x9962, 0x0000, 0x9963, 0x0000, 0x0000, 0x93E0, 0x897E, + 0x0000, 0x0000, 0x9966, 0x8DFB, 0x0000, 0x9965, 0x8DC4, 0x0000, 0x9967, + 0xE3EC, 0x9968, 0x9660, 0x9969, 0x0000, 0x996A, 0x996B, 0x8FE7, 0x0000, + 0x8ECA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AA5, 0x0000, + 0x996E, 0x0000, 0x996C, 0x96BB, 0x996D, 0x0000, 0x9579, 0x996F, 0x9970, + 0x9971, 0x937E, 0x0000, 0x0000, 0x0000, 0x9975, 0x9973, 0x9974, 0x9972, + 0x8DE1, 0x9976, 0x96E8, 0x97E2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9977, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90A6, 0x9978, + 0x8F79, 0x0000, 0x0000, 0x9979, 0x0000, 0x929C, 0x97BD, 0x9380, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x99C3, 0x0000, + 0x0000, 0x0000, 0x0000, 0x997A, 0xEAA3, 0x8BC3, 0x0000, 0x0000, 0x997B, + 0x967D, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F88, 0x91FA, 0x0000, 0x997D, + 0x93E2, 0x0000, 0x0000, 0x997E, 0x0000, 0x0000, 0x9980, 0x8A4D, 0x0000, + 0x0000, 0x0000, 0x9981, 0x8BA5, 0x0000, 0x93CA, 0x899A, 0x8F6F, 0x0000, + 0x0000, 0x949F, 0x9982, 0x0000}; + +static wchar_t Ucs52[256] = { + 0x9381, 0x0000, 0x0000, 0x906E, 0x9983, 0x0000, 0x95AA, 0x90D8, 0x8AA0, + 0x0000, 0x8AA7, 0x9984, 0x0000, 0x0000, 0x9986, 0x0000, 0x0000, 0x8C59, + 0x0000, 0x0000, 0x9985, 0x0000, 0x0000, 0x97F1, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8F89, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x94BB, 0x95CA, 0x0000, 0x9987, 0x0000, 0x9798, 0x9988, 0x0000, 0x0000, + 0x0000, 0x9989, 0x0000, 0x939E, 0x0000, 0x0000, 0x998A, 0x0000, 0x0000, + 0x90A7, 0x8DFC, 0x8C94, 0x998B, 0x8E68, 0x8D8F, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x92E4, 0x998D, 0x0000, 0x0000, 0x91A5, + 0x0000, 0x0000, 0x8DED, 0x998E, 0x998F, 0x914F, 0x0000, 0x998C, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9991, 0x0000, 0x9655, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8D84, 0x0000, 0x0000, 0x9990, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C95, 0x8DDC, 0x948D, 0x0000, 0x0000, 0x0000, 0x9994, 0x9992, 0x0000, + 0x0000, 0x0000, 0x0000, 0x959B, 0x8FE8, 0x999B, 0x8A84, 0x9995, 0x9993, + 0x916E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9997, + 0x0000, 0x9996, 0x0000, 0x0000, 0x0000, 0x8A63, 0x0000, 0x0000, 0x0000, + 0x8C80, 0x999C, 0x97AB, 0x0000, 0x0000, 0x0000, 0x9998, 0x0000, 0x0000, + 0x0000, 0x999D, 0x999A, 0x0000, 0x9999, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x97CD, 0x0000, 0x0000, 0x0000, 0x8CF7, 0x89C1, 0x0000, + 0x0000, 0x97F2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F95, 0x9377, + 0x8D85, 0x99A0, 0x99A1, 0x0000, 0x0000, 0x0000, 0x97E3, 0x0000, 0x0000, + 0x984A, 0x99A3, 0x0000, 0x0000, 0x0000, 0x8CF8, 0x0000, 0x0000, 0x99A2, + 0x0000, 0x8A4E, 0x0000, 0x0000, 0x99A4, 0x0000, 0x9675, 0x0000, 0x92BA, + 0x0000, 0x9745, 0x0000, 0x95D7, 0x0000, 0x0000, 0x0000, 0x99A5, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE8D3, 0x0000, 0x0000, 0x93AE, 0x0000, 0x99A6, + 0x8AA8, 0x96B1, 0x0000, 0x0000, 0x0000, 0x8F9F, 0x99A7, 0x95E5, 0x99AB, + 0x0000, 0x90A8, 0x99A8, 0x8BCE, 0x0000, 0x99A9, 0x8AA9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C4D, + 0x99AC, 0x0000, 0x99AD, 0x0000, 0x0000, 0x99AE, 0x99AF, 0x8ED9, 0x0000, + 0x0000, 0x0000, 0x8CF9, 0x96DC}; + +static wchar_t Ucs53[256] = { + 0x0000, 0x96E6, 0x93F5, 0x0000, 0x0000, 0x95EF, 0x99B0, 0x0000, 0x99B1, + 0x0000, 0x0000, 0x0000, 0x0000, 0x99B3, 0x0000, 0x99B5, 0x99B4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x99B6, 0x89BB, 0x966B, 0x0000, 0x8DFA, 0x99B7, + 0x0000, 0x0000, 0x9178, 0x0000, 0x0000, 0x8FA0, 0x8BA7, 0x0000, 0x99B8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94D9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x99B9, 0x0000, 0x99BA, 0x0000, 0x99BB, 0x0000, 0x0000, + 0x0000, 0x0000, 0x99BC, 0x9543, 0x8BE6, 0x88E3, 0x0000, 0x0000, 0x0000, + 0x93BD, 0x99BD, 0x8F5C, 0x0000, 0x90E7, 0x0000, 0x99BF, 0x99BE, 0x8FA1, + 0x8CDF, 0x99C1, 0x94BC, 0x0000, 0x0000, 0x99C2, 0x0000, 0x0000, 0x0000, + 0x94DA, 0x91B2, 0x91EC, 0x8BA6, 0x0000, 0x0000, 0x93EC, 0x9250, 0x0000, + 0x948E, 0x0000, 0x966D, 0x0000, 0x99C4, 0x0000, 0x90E8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8C54, 0x0000, 0x0000, 0x99C5, 0x0000, 0x0000, + 0x0000, 0x0000, 0x99C6, 0x894B, 0x88F3, 0x8AEB, 0x0000, 0x91A6, 0x8B70, + 0x9791, 0x0000, 0x99C9, 0x89B5, 0x0000, 0x0000, 0x99C8, 0x0000, 0x0000, + 0x0000, 0x8BA8, 0x0000, 0x0000, 0x99CA, 0x0000, 0x96EF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x99CB, 0x0000, 0x97D0, + 0x0000, 0x8CFA, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CB4, 0x99CC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x99CE, 0x99CD, 0x0000, 0x907E, 0x8958, 0x0000, + 0x0000, 0x0000, 0x897D, 0x99CF, 0x0000, 0x99D0, 0x0000, 0x0000, 0x8CB5, + 0x0000, 0x0000, 0x99D1, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B8E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E51, 0x99D2, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9694, 0x8DB3, 0x8B79, 0x9746, 0x916F, 0x94BD, 0x8EFB, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F66, 0x0000, 0x8EE6, 0x8EF3, + 0x0000, 0x8F96, 0x0000, 0x94BE, 0x0000, 0x0000, 0x0000, 0x99D5, 0x0000, + 0x8962, 0x9170, 0x8CFB, 0x8CC3, 0x8BE5, 0x0000, 0x0000, 0x99D9, 0x9240, + 0x91FC, 0x8BA9, 0x8FA2, 0x99DA, 0x99D8, 0x89C2, 0x91E4, 0x8EB6, 0x8E6A, + 0x8945, 0x0000, 0x0000, 0x8A90, 0x8D86, 0x8E69, 0x0000, 0x99DB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs54[256] = { + 0x0000, 0x99DC, 0x0000, 0x8B68, 0x8A65, 0x0000, 0x0000, 0x0000, 0x8D87, + 0x8B67, 0x92DD, 0x8944, 0x93AF, 0x96BC, 0x8D40, 0x9799, 0x9366, 0x8CFC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C4E, 0x0000, 0x99E5, 0x0000, 0x8BE1, 0x9669, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x94DB, 0x0000, 0x0000, 0x99E4, 0x0000, 0x8ADC, 0x99DF, + 0x99E0, 0x99E2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x99E3, 0x0000, 0x8B7A, 0x9081, 0x0000, 0x95AB, 0x99E1, 0x99DD, 0x8CE1, + 0x0000, 0x99DE, 0x0000, 0x9843, 0x0000, 0x0000, 0x0000, 0x95F0, 0x0000, + 0x92E6, 0x8CE0, 0x8D90, 0x0000, 0x0000, 0x0000, 0x99E6, 0x0000, 0x0000, + 0x93DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x99EA, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EFC, 0x0000, 0x8EF4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x99ED, 0x99EB, 0x0000, 0x96A1, 0x0000, + 0x99E8, 0x99F1, 0x99EC, 0x0000, 0x0000, 0x0000, 0x99EF, 0x8CC4, 0x96BD, + 0x0000, 0x0000, 0x99F0, 0x0000, 0x0000, 0x0000, 0x99F2, 0x0000, 0x99F4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8DEE, 0x9861, 0x0000, 0x99E9, 0x99E7, + 0x99F3, 0x0000, 0x99EE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x99F6, 0x0000, 0x9A42, 0x99F8, 0x0000, 0x0000, 0x99FC, 0x0000, 0x0000, + 0x9A40, 0x99F9, 0x0000, 0x0000, 0x9A5D, 0x0000, 0x0000, 0x8DE7, 0x8A50, + 0x0000, 0x0000, 0x0000, 0x0000, 0x99F7, 0x0000, 0x0000, 0x0000, 0x9A44, + 0x88F4, 0x9A43, 0x0000, 0x88A3, 0x9569, 0x9A41, 0x0000, 0x99FA, 0x0000, + 0x0000, 0x99F5, 0x99FB, 0x8DC6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9A45, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x88F5, 0x9A4E, 0x0000, 0x0000, 0x9A46, 0x9A47, 0x0000, 0x8FA3, 0x9689, + 0x0000, 0x0000, 0x0000, 0x9A4C, 0x9A4B, 0x0000, 0x0000, 0x0000, 0x934E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A4D, 0x0000, + 0x0000, 0x9A4A, 0x0000, 0x0000}; + +static wchar_t Ucs55[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x8953, 0x0000, 0x8DB4, 0x904F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A48, 0x9382, 0x0000, + 0x0000, 0x0000, 0x9A49, 0x0000, 0x88A0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9A53, 0x9742, 0x0000, 0x8FA5, 0x0000, 0x9A59, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A58, 0x9A4F, 0x0000, 0x0000, 0x0000, 0x0000, 0x91C1, + 0x0000, 0x9A50, 0x0000, 0x0000, 0x0000, 0x91ED, 0x9A55, 0x8FA4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9A52, 0x0000, 0x0000, 0x96E2, 0x0000, + 0x0000, 0x0000, 0x8C5B, 0x0000, 0x0000, 0x9A56, 0x9A57, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A54, 0x9A5A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9A51, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A60, 0x9A65, 0x0000, + 0x9A61, 0x0000, 0x9A5C, 0x0000, 0x0000, 0x9A66, 0x9150, 0x0000, 0x0000, + 0x9A68, 0x0000, 0x8D41, 0x9A5E, 0x929D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A62, + 0x9A5B, 0x8AAB, 0x0000, 0x8AEC, 0x8A85, 0x9A63, 0x9A5F, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C96, 0x9A69, 0x9A67, 0x9172, + 0x8B69, 0x8BAA, 0x0000, 0x9A64, 0x0000, 0x8BF2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8963, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A6D, 0x9A6B, + 0x0000, 0x9AA5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A70, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A6A, 0x0000, 0x9A6E, 0x0000, 0x0000, 0x9A6C, 0x0000, + 0x0000, 0x0000, 0x8E6B, 0x9A6F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9A72, 0x0000, 0x9A77, 0x0000, 0x0000, + 0x0000, 0x9A75, 0x9A74, 0x0000}; + +static wchar_t Ucs56[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9251, 0x0000, 0x0000, + 0x89C3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A71, 0x0000, 0x9A73, 0x8FA6, 0x8952, 0x0000, 0x0000, + 0x9A76, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89DC, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A82, 0x0000, 0x8FFA, 0x9A7D, 0x0000, 0x9A7B, 0x0000, + 0x9A7C, 0x0000, 0x9A7E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x895C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9158, 0x0000, 0x9A78, 0x0000, 0x9A79, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8A9A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9A81, 0x0000, 0x0000, 0x0000, 0x8AED, 0x0000, 0x9A84, 0x9A80, + 0x9A83, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95AC, + 0x0000, 0x0000, 0x0000, 0x93D3, 0x0000, 0x94B6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A86, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A85, + 0x8A64, 0x0000, 0x0000, 0x9A87, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A8A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9A89, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A88, 0x0000, + 0x9458, 0x0000, 0x0000, 0x9A8B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9A8C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9A8E, 0x0000, 0x9A8D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A90, + 0x0000, 0x0000, 0x0000, 0x9A93, 0x9A91, 0x9A8F, 0x9A92, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9A94, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A95, + 0x0000, 0x0000, 0x9A96, 0x0000, 0x9A97, 0x0000, 0x0000, 0x0000, 0x9A98, + 0x9964, 0x0000, 0x8EFA, 0x8E6C, 0x0000, 0x0000, 0x89F1, 0x0000, 0x88F6, + 0x0000, 0x0000, 0x9263, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9A99, 0x0000, 0x8DA2, 0x0000, 0x88CD, + 0x907D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A9A, 0x8CC5, 0x0000, + 0x0000, 0x8D91, 0x0000, 0x9A9C}; + +static wchar_t Ucs57[256] = { + 0x9A9B, 0x0000, 0x0000, 0x95DE, 0x9A9D, 0x0000, 0x0000, 0x0000, 0x9A9F, + 0x9A9E, 0x0000, 0x9AA0, 0x0000, 0x9AA1, 0x0000, 0x8C97, 0x0000, 0x0000, + 0x8980, 0x9AA2, 0x0000, 0x0000, 0x9AA4, 0x0000, 0x9AA3, 0x0000, 0x0000, + 0x0000, 0x9AA6, 0x0000, 0x0000, 0x9379, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9AA7, 0x88B3, 0x8DDD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C5C, 0x0000, 0x0000, 0x926E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9AA8, 0x9AA9, 0x0000, 0x0000, 0x9AAB, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9AAC, 0x0000, 0x8DE2, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BCF, + 0x0000, 0x0000, 0x9656, 0x0000, 0x0000, 0x0000, 0x9AAA, 0x9AAD, 0x8DBF, + 0x8D42, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AB1, 0x0000, + 0x0000, 0x8DA3, 0x0000, 0x9252, 0x0000, 0x0000, 0x9AAE, 0x92D8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9AB2, 0x0000, 0x0000, 0x9082, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9AB0, 0x9AB3, 0x0000, 0x8C5E, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9AB4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AB5, 0x0000, + 0x8D43, 0x8A5F, 0x9AB7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AB8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AB9, 0x0000, 0x0000, 0x9AB6, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9AAF, 0x0000, 0x0000, 0x9ABA, 0x0000, 0x0000, + 0x9ABB, 0x0000, 0x0000, 0x0000, 0x0000, 0x9684, 0x0000, 0x0000, 0x8FE9, + 0x0000, 0x0000, 0x0000, 0x9ABD, 0x9ABE, 0x9ABC, 0x0000, 0x9AC0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9457, 0x0000, 0x0000, 0x88E6, 0x9575, + 0x0000, 0x0000, 0x9AC1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8FFB, 0x0000, 0x0000, 0x8EB7, 0x0000, 0x947C, 0x8AEE, 0x0000, + 0x8DE9, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs58[256] = { + 0x9678, 0x0000, 0x93B0, 0x0000, 0x0000, 0x8C98, 0x91CD, 0x0000, 0x0000, + 0x0000, 0x9ABF, 0x9AC2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x91C2, 0x0000, 0x0000, 0x0000, 0x9AC3, 0x0000, + 0x0000, 0x0000, 0x9AC4, 0x0000, 0x0000, 0x0000, 0x9AC6, 0x0000, 0x0000, + 0x92E7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AAC, 0x0000, 0x0000, + 0x0000, 0x0000, 0xEA9F, 0x8981, 0x95F1, 0x0000, 0x0000, 0x8FEA, 0x9367, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8DE4, 0x0000, 0x0000, 0x9ACC, 0x0000, + 0x0000, 0x95BB, 0x97DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x89F2, 0x9AC8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9159, 0x9ACB, 0x0000, 0x9383, 0x0000, 0x0000, 0x9368, 0x9384, 0x94B7, + 0x92CB, 0x0000, 0x0000, 0x0000, 0x8DC7, 0x0000, 0x0000, 0x0000, 0x9AC7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8996, 0x0000, 0x9355, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9AC9, 0x0000, 0x9AC5, 0x0000, 0x0000, + 0x906F, 0x0000, 0x0000, 0x0000, 0x9ACD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8F6D, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BAB, 0x0000, 0x9ACE, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x95E6, 0x0000, 0x0000, 0x0000, 0x919D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x92C4, 0x0000, 0x0000, 0x9AD0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x966E, 0x0000, 0x0000, + 0x9AD1, 0x0000, 0x0000, 0x9AD6, 0x0000, 0x0000, 0x0000, 0x0000, 0x95AD, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9AD5, 0x9ACF, 0x9AD2, 0x9AD4, 0x0000, + 0x0000, 0x8DA4, 0x0000, 0x0000, 0x95C7, 0x0000, 0x0000, 0x0000, 0x9AD7, + 0x0000, 0x9264, 0x0000, 0x0000, 0x89F3, 0x0000, 0x8FEB, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9AD9, 0x0000, 0x9AD8, 0x0000, 0x8D88, 0x0000, 0x9ADA, + 0x9ADC, 0x9ADB, 0x0000, 0x0000, 0x9ADE, 0x0000, 0x9AD3, 0x9AE0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9ADF, 0x9ADD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8E6D, 0x9070, 0x0000, 0x9173, 0x9AE1, 0x90BA, 0x88EB, 0x9484, + 0x0000, 0x0000, 0x0000, 0x0000, 0x92D9, 0x0000, 0x9AE3, 0x9AE2, 0x9AE4, + 0x9AE5, 0x9AE6, 0x0000, 0x0000}; + +static wchar_t Ucs59[256] = { + 0x0000, 0x0000, 0x9AE7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x95CF, 0x9AE8, 0x0000, 0x0000, 0x0000, 0x0000, 0x89C4, 0x9AE9, 0x0000, + 0x0000, 0x0000, 0x0000, 0x975B, 0x8A4F, 0x0000, 0x99C7, 0x8F67, 0x91BD, + 0x9AEA, 0x96E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x96B2, 0x0000, + 0x0000, 0x9AEC, 0x0000, 0x91E5, 0x0000, 0x9356, 0x91BE, 0x9576, 0x9AED, + 0x9AEE, 0x899B, 0x0000, 0x0000, 0x8EB8, 0x9AEF, 0x0000, 0x0000, 0x0000, + 0x0000, 0x88CE, 0x9AF0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AF1, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8982, 0x0000, 0x0000, 0x8AEF, + 0x93DE, 0x95F2, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AF5, 0x9174, 0x9AF4, + 0x8C5F, 0x0000, 0x0000, 0x967A, 0x9AF3, 0x0000, 0x9385, 0x9AF7, 0x0000, + 0x9AF6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9AF9, 0x0000, 0x9AF8, + 0x0000, 0x0000, 0x899C, 0x0000, 0x9AFA, 0x8FA7, 0x9AFC, 0x9244, 0x0000, + 0x9AFB, 0x0000, 0x95B1, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F97, 0x937A, + 0x0000, 0x0000, 0x0000, 0x9B40, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D44, + 0x0000, 0x0000, 0x0000, 0x9B41, 0x9440, 0x94DC, 0x96CF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9444, 0x0000, 0x0000, 0x9B4A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8B57, 0x0000, 0x0000, 0x9764, 0x0000, 0x0000, + 0x96AD, 0x0000, 0x9BAA, 0x0000, 0x9B42, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9B45, 0x0000, 0x91C3, 0x0000, 0x0000, 0x9657, 0x0000, 0x0000, + 0x0000, 0x9369, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B46, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9685, 0x0000, 0x8DC8, 0x0000, + 0x0000, 0x8FA8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9B47, 0x0000, 0x0000, 0x8E6F, 0x0000, 0x8E6E, 0x0000, 0x0000, 0x0000, + 0x0000, 0x88B7, 0x8CC6, 0x0000, 0x90A9, 0x88CF, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9B4B, 0x9B4C, 0x0000, 0x9B49, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8957, 0x8AAD, 0x0000, 0x9B48, 0x0000, + 0x96C3, 0x9550, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x88A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x88F7, + 0x0000, 0x0000, 0x0000, 0x8E70}; + +static wchar_t Ucs5A[256] = { + 0x0000, 0x88D0, 0x0000, 0x88A1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9B51, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B4F, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x96BA, 0x0000, 0x9B52, + 0x0000, 0x9B50, 0x0000, 0x0000, 0x9B4E, 0x9050, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9B4D, 0x0000, 0x0000, 0x0000, 0x95D8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8CE2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B56, + 0x9B57, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FA9, 0x0000, 0x0000, + 0x0000, 0x9B53, 0x984B, 0x0000, 0x0000, 0x0000, 0x0000, 0x946B, 0x0000, + 0x0000, 0x9B55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8DA5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B58, + 0x0000, 0x0000, 0x0000, 0x9577, 0x0000, 0x0000, 0x0000, 0x9B59, 0x0000, + 0x9B54, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x96B9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x947D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9B5A, 0x9551, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B5B, + 0x9B5F, 0x9B5C, 0x0000, 0x0000, 0x89C5, 0x9B5E, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8EB9, 0x0000, 0x9B5D, 0x8C99, 0x0000, 0x0000, + 0x0000, 0x9B6B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B64, 0x9B61, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9284, 0x0000, 0x9B60, 0x0000, 0x0000, 0x9B62, 0x0000, 0x0000, 0x9B63, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B65, 0x9B66, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs5B[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8AF0, 0x0000, 0x9B68, 0x9B67, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9B69, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FEC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B6C, 0x0000, 0x92DA, + 0x0000, 0x0000, 0x0000, 0x8964, 0x0000, 0x9B6A, 0x0000, 0x0000, 0x0000, + 0x9B6D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B6E, + 0x0000, 0x9B71, 0x0000, 0x0000, 0x9B6F, 0x0000, 0x9B70, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E71, + 0x9B72, 0x0000, 0x0000, 0x8D45, 0x9B73, 0x0000, 0x8E9A, 0x91B6, 0x0000, + 0x9B74, 0x9B75, 0x8E79, 0x8D46, 0x0000, 0x96D0, 0x0000, 0x0000, 0x0000, + 0x8B47, 0x8CC7, 0x9B76, 0x8A77, 0x0000, 0x0000, 0x9B77, 0x0000, 0x91B7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9B78, 0x9BA1, 0x0000, 0x9B79, 0x0000, + 0x9B7A, 0x0000, 0x0000, 0x9B7B, 0x0000, 0x9B7D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9B7E, 0x0000, 0x0000, 0x9B80, 0x0000, 0x91EE, 0x0000, + 0x8946, 0x8EE7, 0x88C0, 0x0000, 0x9176, 0x8AAE, 0x8EB3, 0x0000, 0x8D47, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9386, 0x0000, 0x8F40, 0x8AAF, + 0x9288, 0x92E8, 0x88B6, 0x8B58, 0x95F3, 0x0000, 0x8EC0, 0x0000, 0x0000, + 0x8B71, 0x90E9, 0x8EBA, 0x9747, 0x9B81, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8B7B, 0x0000, 0x8DC9, 0x0000, 0x0000, 0x8A51, + 0x8983, 0x8FAA, 0x89C6, 0x0000, 0x9B82, 0x9765, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8F68, 0x0000, 0x0000, 0x8EE2, 0x9B83, 0x8AF1, 0x93D0, + 0x96A7, 0x9B84, 0x0000, 0x9B85, 0x0000, 0x0000, 0x9578, 0x0000, 0x0000, + 0x0000, 0x9B87, 0x0000, 0x8AA6, 0x8BF5, 0x9B86, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8AB0, 0x0000, 0x9051, 0x9B8B, 0x8E40, 0x0000, + 0x89C7, 0x9B8A, 0x0000, 0x9B88, 0x9B8C, 0x9B89, 0x944A, 0x9ECB, 0x9052, + 0x0000, 0x9B8D, 0x0000, 0x0000, 0x97BE, 0x0000, 0x9B8E, 0x0000, 0x0000, + 0x9B90, 0x0000, 0x929E, 0x9B8F, 0x0000, 0x90A1, 0x0000, 0x8E9B, 0x0000, + 0x0000, 0x0000, 0x91CE, 0x8EF5}; + +static wchar_t Ucs5C[256] = { + 0x0000, 0x9595, 0x90EA, 0x0000, 0x8ECB, 0x9B91, 0x8FAB, 0x9B92, 0x9B93, + 0x88D1, 0x91B8, 0x9071, 0x0000, 0x9B94, 0x93B1, 0x8FAC, 0x0000, 0x8FAD, + 0x0000, 0x9B95, 0x0000, 0x0000, 0x90EB, 0x0000, 0x0000, 0x0000, 0x8FAE, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9B96, 0x0000, 0x9B97, 0x0000, + 0x96DE, 0x0000, 0x0000, 0x0000, 0x9B98, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8BC4, 0x0000, 0x0000, 0x0000, 0x8F41, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9B99, 0x9B9A, 0x8EDA, 0x904B, 0x93F2, 0x9073, 0x94F6, + 0x9441, 0x8BC7, 0x9B9B, 0x0000, 0x0000, 0x0000, 0x8B8F, 0x9B9C, 0x0000, + 0x8BFC, 0x0000, 0x93CD, 0x89AE, 0x0000, 0x8E72, 0x9B9D, 0x9BA0, 0x9B9F, + 0x8BFB, 0x0000, 0x9B9E, 0x0000, 0x9357, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x91AE, 0x0000, 0x936A, 0x8EC6, 0x0000, + 0x0000, 0x9177, 0x979A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9BA2, 0x0000, 0x9BA3, 0x93D4, 0x0000, 0x8E52, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9BA5, 0x0000, 0x0000, 0x9BA6, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9BA7, 0x0000, 0x0000, 0x0000, + 0x8AF2, 0x9BA8, 0x0000, 0x0000, 0x9BA9, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89AA, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x915A, 0x8AE2, 0x0000, + 0x9BAB, 0x96A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x91D0, 0x0000, 0x8A78, + 0x0000, 0x0000, 0x9BAD, 0x9BAF, 0x8ADD, 0x0000, 0x0000, 0x9BAC, 0x9BAE, + 0x0000, 0x9BB1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9BB0, + 0x0000, 0x9BB2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9BB3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x93BB, + 0x8BAC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89E3, 0x9BB4, + 0x9BB9, 0x0000, 0x0000, 0x9BB7, 0x0000, 0x95F5, 0x95F4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9387, 0x0000, 0x0000, 0x0000, 0x9BB6, 0x8F73, + 0x0000, 0x9BB5, 0x0000, 0x0000}; + +static wchar_t Ucs5D[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9092, 0x0000, + 0x0000, 0x0000, 0x9BBA, 0x0000, 0x0000, 0x8DE8, 0x0000, 0x0000, 0x9BC0, + 0x0000, 0x0000, 0x9BC1, 0x9BBB, 0x8A52, 0x9BBC, 0x9BC5, 0x9BC4, 0x9BC3, + 0x9BBF, 0x0000, 0x0000, 0x0000, 0x9BBE, 0x0000, 0x0000, 0x9BC2, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95F6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BC9, 0x9BC6, 0x0000, 0x9BC8, 0x0000, 0x9792, + 0x0000, 0x9BC7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9BBD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9093, 0x0000, 0x0000, + 0x9BCA, 0x0000, 0x0000, 0x8DB5, 0x0000, 0x0000, 0x0000, 0x9BCB, 0x0000, + 0x0000, 0x9BCC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9BCF, 0x0000, 0x9BCE, 0x0000, 0x0000, + 0x9BCD, 0x0000, 0x0000, 0x0000, 0x9388, 0x9BB8, 0x0000, 0x0000, 0x0000, + 0x9BD5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9BD1, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9BD0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9BD2, 0x0000, 0x9BD3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BD6, 0x0000, 0x0000, 0x97E4, 0x0000, 0x9BD7, + 0x9BD4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BD8, 0x0000, 0x0000, 0x8ADE, 0x9BD9, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BDB, 0x9BDA, 0x0000, 0x0000, 0x9BDC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BDD, 0x0000, 0x90EC, 0x8F42, 0x0000, 0x0000, + 0x8F84, 0x0000, 0x9183, 0x0000, 0x8D48, 0x8DB6, 0x8D49, 0x8B90, 0x0000, + 0x0000, 0x9BDE, 0x0000, 0x0000, 0x8DB7, 0x0000, 0x0000, 0x8CC8, 0x9BDF, + 0x96A4, 0x9462, 0x9BE0, 0x0000, 0x8D4A, 0x0000, 0x0000, 0x0000, 0x8AAA, + 0x0000, 0x9246, 0x8BD0, 0x0000}; + +static wchar_t Ucs5E[256] = { + 0x0000, 0x0000, 0x8E73, 0x957A, 0x0000, 0x0000, 0x94BF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9BE1, 0x8AF3, 0x0000, 0x0000, 0x0000, 0x0000, 0x9BE4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x929F, 0x0000, 0x0000, 0x9BE3, 0x9BE2, + 0x9BE5, 0x0000, 0x92E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9083, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E74, 0x0000, + 0x90C8, 0x0000, 0x91D1, 0x8B41, 0x0000, 0x0000, 0x92A0, 0x0000, 0x0000, + 0x9BE6, 0x9BE7, 0x8FED, 0x0000, 0x0000, 0x0000, 0x0000, 0x9658, 0x0000, + 0x0000, 0x9BEA, 0x0000, 0x0000, 0x9BE9, 0x9BE8, 0x959D, 0x0000, 0x9BF1, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9679, 0x0000, 0x9BEB, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9BED, 0x968B, 0x0000, 0x9BEC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9BEE, 0x0000, 0x94A6, 0x9BEF, + 0x95BC, 0x9BF0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AB1, 0x95BD, 0x944E, + 0x9BF2, 0x9BF3, 0x0000, 0x8D4B, 0x8AB2, 0x9BF4, 0x8CB6, 0x9763, 0x9748, + 0x8AF4, 0x9BF6, 0x0000, 0x92A1, 0x0000, 0x8D4C, 0x8FAF, 0x0000, 0x0000, + 0x94DD, 0x0000, 0x0000, 0x8FB0, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F98, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x92EA, 0x95F7, 0x9358, 0x0000, + 0x0000, 0x8D4D, 0x0000, 0x957B, 0x0000, 0x0000, 0x0000, 0x9BF7, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9378, 0x8DC0, 0x0000, 0x0000, 0x0000, + 0x8CC9, 0x0000, 0x92EB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x88C1, 0x8F8E, 0x8D4E, 0x9766, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9BF8, 0x9BF9, 0x9470, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9BFA, 0x97F5, 0x984C, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9BFC, 0x9BFB, 0x0000, 0x0000, 0x8A66, 0x0000, 0x0000, 0x9C40, 0x0000, + 0x0000, 0x0000, 0x9C43, 0x9C44, 0x0000, 0x9C42, 0x0000, 0x955F, 0x8FB1, + 0x9C46, 0x9C45, 0x9C41, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C47, 0x9C48, + 0x0000, 0x0000, 0x9C49, 0x0000, 0x0000, 0x0000, 0x9C4C, 0x9C4A, 0x0000, + 0x9C4B, 0x9C4D, 0x0000, 0x8984, 0x92EC, 0x9C4E, 0x0000, 0x8C9A, 0x89F4, + 0x9455, 0x0000, 0x9C4F, 0x93F9}; + +static wchar_t Ucs5F[256] = { + 0x0000, 0x95D9, 0x0000, 0x9C50, 0x984D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9C51, 0x95BE, 0x9C54, 0x989F, 0x98AF, 0x0000, 0x8EAE, 0x93F3, 0x9C55, + 0x0000, 0x8B7C, 0x92A2, 0x88F8, 0x9C56, 0x95A4, 0x8D4F, 0x0000, 0x0000, + 0x926F, 0x0000, 0x0000, 0x0000, 0x92ED, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x96ED, 0x8CB7, 0x8CCA, 0x0000, 0x9C57, 0x0000, 0x0000, 0x0000, + 0x9C58, 0x0000, 0x9C5E, 0x0000, 0x8EE3, 0x0000, 0x0000, 0x0000, 0x92A3, + 0x0000, 0x8BAD, 0x9C59, 0x0000, 0x0000, 0x0000, 0x954A, 0x0000, 0x9265, + 0x0000, 0x0000, 0x9C5A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9C5B, 0x0000, 0x8BAE, 0x0000, 0x9C5C, 0x0000, 0x9C5D, 0x0000, 0x0000, + 0x9C5F, 0x0000, 0x9396, 0x0000, 0x0000, 0x9C60, 0x9C61, 0x0000, 0x9C62, + 0x0000, 0x0000, 0x9C53, 0x9C52, 0x0000, 0x0000, 0x0000, 0x9C63, 0x8C60, + 0x0000, 0x0000, 0x0000, 0x9546, 0x0000, 0x0000, 0x8DCA, 0x9556, 0x92A4, + 0x956A, 0x9C64, 0x0000, 0x0000, 0x8FB2, 0x8965, 0x0000, 0x9C65, 0x0000, + 0x0000, 0x0000, 0x9C66, 0x0000, 0x96F0, 0x0000, 0x0000, 0x94DE, 0x0000, + 0x0000, 0x9C69, 0x899D, 0x90AA, 0x9C68, 0x9C67, 0x8C61, 0x91D2, 0x0000, + 0x9C6D, 0x9C6B, 0x0000, 0x9C6A, 0x97A5, 0x8CE3, 0x0000, 0x0000, 0x0000, + 0x8F99, 0x9C6C, 0x936B, 0x8F5D, 0x0000, 0x0000, 0x0000, 0x93BE, 0x9C70, + 0x9C6F, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C6E, 0x0000, 0x9C71, 0x8CE4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C72, 0x959C, 0x8F7A, + 0x0000, 0x0000, 0x9C73, 0x94F7, 0x0000, 0x0000, 0x0000, 0x0000, 0x93BF, + 0x92A5, 0x0000, 0x0000, 0x0000, 0x0000, 0x934F, 0x0000, 0x0000, 0x9C74, + 0x8B4A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9053, 0x0000, 0x954B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AF5, 0x9445, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C75, 0x8E75, + 0x9659, 0x965A, 0x0000, 0x0000, 0x899E, 0x9C7A, 0x0000, 0x0000, 0x9289, + 0x0000, 0x0000, 0x0000, 0x9C77, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x89F5, 0x0000, 0x0000, 0x0000, 0x0000, 0x9CAB, 0x9C79, 0x0000, + 0x0000, 0x0000, 0x944F, 0x0000, 0x0000, 0x9C78, 0x0000, 0x0000, 0x9C76, + 0x0000, 0x8D9A, 0x0000, 0x9C7C}; + +static wchar_t Ucs60[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C83, 0x9C89, 0x9C81, 0x0000, + 0x937B, 0x0000, 0x0000, 0x9C86, 0x957C, 0x0000, 0x0000, 0x9C80, 0x0000, + 0x9C85, 0x97E5, 0x8E76, 0x0000, 0x0000, 0x91D3, 0x9C7D, 0x0000, 0x0000, + 0x0000, 0x8B7D, 0x9C88, 0x90AB, 0x8985, 0x9C82, 0x89F6, 0x9C87, 0x0000, + 0x0000, 0x0000, 0x8BAF, 0x0000, 0x9C84, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9C8A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9C8C, 0x9C96, 0x9C94, 0x0000, 0x0000, 0x9C91, 0x0000, + 0x0000, 0x0000, 0x9C90, 0x97F6, 0x0000, 0x9C92, 0x0000, 0x0000, 0x8BB0, + 0x0000, 0x8D50, 0x0000, 0x0000, 0x8F9A, 0x0000, 0x0000, 0x0000, 0x9C99, + 0x9C8B, 0x0000, 0x0000, 0x0000, 0x0000, 0x9C8F, 0x9C7E, 0x0000, 0x89F8, + 0x9C93, 0x9C95, 0x9270, 0x0000, 0x0000, 0x8DA6, 0x89B6, 0x9C8D, 0x9C98, + 0x9C97, 0x8BB1, 0x0000, 0x91A7, 0x8A86, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C62, 0x0000, 0x9C8E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9C9A, 0x0000, 0x9C9D, 0x9C9F, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8EBB, 0x0000, 0x9CA5, 0x92EE, 0x9C9B, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9CA3, 0x0000, 0x89F7, 0x0000, 0x9CA1, 0x9CA2, 0x0000, + 0x0000, 0x9C9E, 0x9CA0, 0x0000, 0x0000, 0x0000, 0x8CE5, 0x9749, 0x0000, + 0x0000, 0x8AB3, 0x0000, 0x0000, 0x8978, 0x9CA4, 0x0000, 0x9459, 0x88AB, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94DF, 0x9C7B, + 0x9CAA, 0x9CAE, 0x96E3, 0x0000, 0x9CA7, 0x0000, 0x0000, 0x0000, 0x9389, + 0x9CAC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FEE, + 0x9CAD, 0x93D5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9866, 0x0000, 0x9CA9, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9CAF, 0x0000, 0x8D9B, 0x0000, 0x90C9, 0x0000, 0x0000, 0x88D2, 0x9CA8, + 0x9CA6, 0x0000, 0x9179, 0x0000, 0x0000, 0x0000, 0x9C9C, 0x8E53, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91C4, 0x9CBB, 0x0000, + 0x917A, 0x9CB6, 0x0000, 0x9CB3, 0x9CB4, 0x0000, 0x8EE4, 0x9CB7, 0x9CBA, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs61[256] = { + 0x9CB5, 0x8F44, 0x0000, 0x9CB8, 0x0000, 0x0000, 0x9CB2, 0x0000, 0x96FA, + 0x96F9, 0x0000, 0x0000, 0x0000, 0x9CBC, 0x9CBD, 0x88D3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9CB1, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BF0, + 0x88A4, 0x0000, 0x0000, 0x0000, 0x8AB4, 0x0000, 0x9CB9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9CC1, 0x9CC0, 0x0000, 0x0000, 0x0000, 0x9CC5, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9CC6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9CC4, 0x9CC7, 0x9CBF, + 0x9CC3, 0x0000, 0x0000, 0x9CC8, 0x0000, 0x9CC9, 0x0000, 0x0000, 0x9CBE, + 0x8E9C, 0x0000, 0x9CC2, 0x91D4, 0x8D51, 0x9CB0, 0x9054, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9CD6, 0x0000, 0x95E7, 0x0000, 0x0000, 0x9CCC, 0x9CCD, + 0x9CCE, 0x0000, 0x0000, 0x9CD5, 0x0000, 0x9CD4, 0x0000, 0x0000, 0x969D, + 0x8AB5, 0x0000, 0x9CD2, 0x0000, 0x8C64, 0x8A53, 0x0000, 0x0000, 0x9CCF, + 0x0000, 0x0000, 0x97B6, 0x9CD1, 0x88D4, 0x9CD3, 0x0000, 0x9CCA, 0x9CD0, + 0x9CD7, 0x8C63, 0x9CCB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x977C, 0x0000, 0x0000, 0x0000, 0x974A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9CDA, 0x0000, 0x0000, 0x9CDE, 0x0000, 0x0000, 0x0000, 0x919E, 0x0000, + 0x97F7, 0x9CDF, 0x0000, 0x0000, 0x9CDC, 0x0000, 0x9CD9, 0x0000, 0x0000, + 0x9CD8, 0x9CDD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x95AE, 0x0000, 0x0000, 0x93B2, 0x0000, 0x8C65, 0x0000, + 0x9CE0, 0x9CDB, 0x0000, 0x9CE1, 0x0000, 0x0000, 0x0000, 0x8C9B, 0x0000, + 0x0000, 0x0000, 0x89AF, 0x0000, 0x0000, 0x0000, 0x9CE9, 0x0000, 0x0000, + 0x0000, 0x8AB6, 0x0000, 0x0000, 0x0000, 0x0000, 0x9CE7, 0x0000, 0x0000, + 0x9CE8, 0x8DA7, 0x9CE6, 0x9CE4, 0x9CE3, 0x9CEA, 0x9CE2, 0x9CEC, 0x0000, + 0x0000, 0x89F9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9CEE, 0x0000, 0x0000, 0x9CED, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x92A6, + 0x0000, 0x9CF1, 0x0000, 0x9CEF, 0x9CE5, 0x8C9C, 0x0000, 0x9CF0, 0x0000, + 0x9CF4, 0x9CF3, 0x9CF5, 0x9CF2}; + +static wchar_t Ucs62[256] = { + 0x9CF6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9CF7, + 0x9CF8, 0x95E8, 0x0000, 0x9CFA, 0x9CF9, 0x8F5E, 0x0000, 0x90AC, 0x89E4, + 0x89FA, 0x0000, 0x9CFB, 0x0000, 0x88BD, 0x0000, 0x0000, 0x0000, 0x90CA, + 0x9CFC, 0x0000, 0xE6C1, 0x9D40, 0x8C81, 0x0000, 0x9D41, 0x0000, 0x0000, + 0x0000, 0x0000, 0x90ED, 0x0000, 0x0000, 0x0000, 0x9D42, 0x0000, 0x0000, + 0x0000, 0x9D43, 0x8B59, 0x9D44, 0x0000, 0x9D45, 0x9D46, 0x91D5, 0x0000, + 0x0000, 0x0000, 0x8CCB, 0x0000, 0x0000, 0x96DF, 0x0000, 0x0000, 0x0000, + 0x965B, 0x8F8A, 0x9D47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90EE, + 0xE7BB, 0x94E0, 0x0000, 0x8EE8, 0x0000, 0x8DCB, 0x9D48, 0x0000, 0x0000, + 0x0000, 0x0000, 0x91C5, 0x0000, 0x95A5, 0x0000, 0x0000, 0x91EF, 0x0000, + 0x0000, 0x9D4B, 0x0000, 0x0000, 0x9D49, 0x0000, 0x9D4C, 0x0000, 0x0000, + 0x9D4A, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D4D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x95AF, 0x0000, 0x0000, 0x88B5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x957D, 0x0000, 0x0000, 0x94E1, 0x0000, 0x0000, 0x9D4E, 0x0000, + 0x9D51, 0x8FB3, 0x8B5A, 0x0000, 0x9D4F, 0x9D56, 0x8FB4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9D50, 0x9463, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x977D, 0x9D52, 0x9D53, 0x9D57, 0x938A, 0x9D54, 0x8D52, 0x90DC, + 0x0000, 0x0000, 0x9D65, 0x94B2, 0x0000, 0x91F0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x94E2, 0x9DAB, 0x0000, 0x0000, 0x0000, 0x0000, 0x95F8, 0x0000, 0x0000, + 0x0000, 0x92EF, 0x0000, 0x0000, 0x0000, 0x9695, 0x0000, 0x9D5A, 0x899F, + 0x928A, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D63, 0x0000, 0x0000, 0x9253, + 0x9D5D, 0x9D64, 0x9D5F, 0x9D66, 0x9D62, 0x0000, 0x9D61, 0x948F, 0x0000, + 0x9D5B, 0x89FB, 0x9D59, 0x8B91, 0x91F1, 0x9D55, 0x0000, 0x0000, 0x9D58, + 0x8D53, 0x90D9, 0x0000, 0x8FB5, 0x9D60, 0x9471, 0x0000, 0x0000, 0x8B92, + 0x8A67, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8A87, 0x9040, 0x9D68, 0x9D6D, 0x0000, 0x9D69, 0x0000, + 0x8C9D, 0x0000, 0x9D6E, 0x8E41, 0x8D89, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8F45, 0x9D5C}; + +static wchar_t Ucs63[256] = { + 0x0000, 0x8E9D, 0x9D6B, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E77, 0x9D6C, + 0x88C2, 0x0000, 0x0000, 0x9D67, 0x0000, 0x0000, 0x0000, 0x0000, 0x92A7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B93, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8BB2, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9D6A, 0x88A5, 0x0000, 0x0000, 0x8DC1, 0x0000, + 0x0000, 0x0000, 0x9055, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x92F0, 0x0000, 0x0000, 0x94D2, 0x9D70, + 0x917D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x91A8, 0x0000, 0x0000, 0x8E4A, 0x9D71, 0x0000, 0x9D73, 0x9D6F, + 0x0000, 0x0000, 0x0000, 0x0000, 0x95DF, 0x0000, 0x92BB, 0x0000, 0x0000, + 0x0000, 0x0000, 0x917B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x95F9, 0x8ECC, 0x9D80, 0x0000, 0x9D7E, + 0x0000, 0x0000, 0x9098, 0x0000, 0x0000, 0x0000, 0x8C9E, 0x0000, 0x0000, + 0x0000, 0x9D78, 0x8FB7, 0x0000, 0x0000, 0x93E6, 0x9450, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9D76, 0x0000, 0x0000, 0x917C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8EF6, 0x9D7B, 0x0000, 0x0000, 0x8FB6, 0x0000, 0x9D75, 0x9D7A, + 0x0000, 0x0000, 0x9472, 0x0000, 0x0000, 0x0000, 0x9D74, 0x0000, 0x8C40, + 0x0000, 0x0000, 0x8A7C, 0x0000, 0x0000, 0x0000, 0x9D7C, 0x97A9, 0x8DCC, + 0x9254, 0x9D79, 0x0000, 0x90DA, 0x0000, 0x8D54, 0x9084, 0x8986, 0x915B, + 0x9D77, 0x8B64, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C66, 0x0000, + 0x92CD, 0x9D7D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x917E, 0x0000, + 0x0000, 0x9D81, 0x0000, 0x9D83, 0x0000, 0x0000, 0x91B5, 0x9D89, 0x0000, + 0x9D84, 0x0000, 0x0000, 0x9D86, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9560, 0x92F1, 0x0000, 0x9D87, 0x0000, 0x0000, 0x0000, 0x974B, 0x0000, + 0x0000, 0x0000, 0x9767, 0x8AB7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x88AC, 0x0000, 0x9D85, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D82, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8AF6, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8987, 0x0000, 0x9D88, 0x0000, 0x0000, 0x0000, 0x9768, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs64[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D8C, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x91B9, 0x0000, 0x9D93, 0x0000, 0x0000, + 0x0000, 0x9D8D, 0x0000, 0x0000, 0x9D8A, 0x9D91, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9D72, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9D8E, 0x0000, 0x9D92, 0x0000, 0x0000, 0x0000, 0x94C0, + 0x938B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D8B, 0x0000, + 0x9D8F, 0x0000, 0x0000, 0x0000, 0x8C67, 0x0000, 0x0000, 0x0000, 0x8DEF, + 0x0000, 0x0000, 0x0000, 0x90DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D97, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9345, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9D94, 0x0000, 0x9680, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9D95, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9D96, 0x0000, 0x96CC, 0x0000, 0x90A0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C82, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9D9D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8E54, 0x9D9A, 0x0000, 0x9D99, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9451, 0x0000, 0x0000, 0x0000, 0x93B3, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9350, 0x9D9B, 0x0000, 0x0000, 0x0000, 0x9D9C, 0x0000, + 0x958F, 0x0000, 0x9464, 0x8E42, 0x0000, 0x90EF, 0x0000, 0x966F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8A68, 0x0000, 0x9DA3, 0x9D9E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9769, 0x9DA5, 0x0000, 0x0000, 0x9DA1, + 0x0000, 0x9DA2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9180, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9DA0, 0x0000, 0x9D5E, 0x0000, 0x0000, 0x0000, + 0x9DA4, 0x0000, 0x9D9F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DA9, + 0x9DAA, 0x9346, 0x9DAC, 0x0000, 0x0000, 0x8E43, 0x9DA7, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8B5B, 0x0000, 0x0000, 0x9DAD, 0x0000, 0x9DA6, 0x9DB1, + 0x0000, 0x9DB0, 0x0000, 0x9DAF, 0x0000, 0x0000, 0x0000, 0x9DB2, 0x0000, + 0x0000, 0x9DB4, 0x8FEF, 0x0000}; + +static wchar_t Ucs65[256] = { + 0x9DB3, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DB7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DB5, 0x0000, 0x0000, + 0x0000, 0x9DB6, 0x9D90, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DB9, + 0x9DB8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9D98, 0x9DBA, 0x9DAE, + 0x0000, 0x0000, 0x8E78, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DBB, 0x9DBC, + 0x9DBE, 0x9DBD, 0x9DBF, 0x89FC, 0x0000, 0x8D55, 0x0000, 0x0000, 0x95FA, + 0x90AD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CCC, 0x0000, 0x0000, + 0x9DC1, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DC4, 0x0000, 0x9571, 0x0000, + 0x8B7E, 0x0000, 0x0000, 0x0000, 0x9DC3, 0x9DC2, 0x9473, 0x9DC5, 0x8BB3, + 0x0000, 0x0000, 0x0000, 0x9DC7, 0x9DC6, 0x0000, 0x0000, 0x0000, 0x8AB8, + 0x8E55, 0x0000, 0x0000, 0x93D6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C68, 0x0000, 0x0000, 0x0000, 0x9094, 0x0000, 0x9DC8, 0x0000, 0x90AE, + 0x9347, 0x0000, 0x957E, 0x9DC9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9DCA, 0x9DCB, 0x0000, 0x0000, 0x0000, + 0x95B6, 0x9B7C, 0x90C4, 0x0000, 0x0000, 0x956B, 0x0000, 0x8DD6, 0x0000, + 0x94E3, 0x94C1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x936C, 0x0000, + 0x97BF, 0x0000, 0x9DCD, 0x8ECE, 0x0000, 0x0000, 0x9DCE, 0x0000, 0x88B4, + 0x0000, 0x0000, 0x8BD2, 0x90CB, 0x0000, 0x9580, 0x0000, 0x0000, 0x0000, + 0x9DCF, 0x8E61, 0x9266, 0x0000, 0x8E7A, 0x9056, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9DD0, 0x0000, 0x95FB, 0x0000, 0x0000, 0x8997, + 0x8E7B, 0x0000, 0x0000, 0x0000, 0x9DD3, 0x0000, 0x9DD1, 0x9DD4, 0x97B7, + 0x9DD2, 0x0000, 0x0000, 0x0000, 0x0000, 0x90F9, 0x9DD5, 0x0000, 0x0000, + 0x91B0, 0x0000, 0x0000, 0x9DD6, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AF8, + 0x0000, 0x9DD8, 0x0000, 0x9DD7, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DD9, + 0x9DDA, 0x8AF9, 0x0000, 0x0000, 0x93FA, 0x9255, 0x8B8C, 0x8E7C, 0x9181, + 0x0000, 0x0000, 0x8F7B, 0x88AE, 0x0000, 0x0000, 0x0000, 0x9DDB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89A0, 0x9DDF, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs66[256] = { + 0x0000, 0x0000, 0x8D56, 0x9DDE, 0x0000, 0x0000, 0x8DA9, 0x8FB8, 0x0000, + 0x0000, 0x9DDD, 0x0000, 0x8FB9, 0x0000, 0x96BE, 0x8DA8, 0x0000, 0x0000, + 0x0000, 0x88D5, 0x90CC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9DE4, 0x0000, 0x0000, 0x90AF, 0x8966, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8F74, 0x0000, 0x9686, 0x8DF0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8FBA, 0x0000, 0x90A5, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DE3, 0x9DE1, + 0x9DE2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x928B, 0x0000, 0x0000, + 0x9E45, 0x0000, 0x9DE8, 0x8E9E, 0x8D57, 0x9DE6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9DE7, 0x0000, 0x9057, 0x0000, 0x0000, 0x0000, 0x9DE5, 0x0000, + 0x0000, 0x8E4E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9DEA, 0x9DE9, 0x9DEE, 0x0000, 0x0000, 0x9DEF, + 0x0000, 0x9DEB, 0x0000, 0x8A41, 0x9DEC, 0x9DED, 0x94D3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9581, 0x8C69, 0x9DF0, 0x0000, 0x0000, 0x0000, 0x90B0, + 0x0000, 0x8FBB, 0x0000, 0x0000, 0x0000, 0x9271, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8BC5, 0x0000, 0x9DF1, 0x9DF5, 0x0000, 0x0000, + 0x89C9, 0x9DF2, 0x9DF4, 0x0000, 0x0000, 0x0000, 0x0000, 0x9DF3, 0x0000, + 0x0000, 0x8F8B, 0x0000, 0x0000, 0x0000, 0x0000, 0x9267, 0x88C3, 0x9DF6, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9DF7, 0x0000, 0x0000, 0x0000, 0x0000, + 0x92A8, 0x0000, 0x0000, 0x0000, 0x97EF, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8E62, 0x0000, 0x0000, 0x95E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x965C, 0x0000, 0x0000, 0x0000, 0x9E41, 0x9DF9, 0x0000, 0x0000, 0x9DFC, + 0x0000, 0x9DFB, 0x0000, 0x0000, 0x9DF8, 0x0000, 0x0000, 0x9E40, 0x0000, + 0x0000, 0x93DC, 0x0000, 0x9DFA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E42, 0x0000, + 0x0000, 0x8F8C, 0x9E43, 0x0000, 0x976A, 0x9498, 0x0000, 0x0000, 0x9E44, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E46, 0x0000, 0x0000, 0x9E47, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E48, 0x0000, 0x8BC8, + 0x8967, 0x8D58, 0x9E49, 0x0000, 0x9E4A, 0x8F91, 0x9182, 0x0000, 0x0000, + 0x99D6, 0x915D, 0x915C, 0x91D6}; + +static wchar_t Ucs67[256] = { + 0x8DC5, 0x0000, 0x0000, 0x98F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C8E, + 0x974C, 0x0000, 0x95FC, 0x0000, 0x959E, 0x0000, 0x9E4B, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8DF1, 0x92BD, 0x9E4C, 0x984E, 0x0000, 0x0000, 0x0000, + 0x965D, 0x0000, 0x92A9, 0x9E4D, 0x8AFA, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9E4E, 0x9E4F, 0x96D8, 0x0000, 0x96A2, 0x9696, 0x967B, + 0x8E44, 0x9E51, 0x0000, 0x0000, 0x8EE9, 0x0000, 0x0000, 0x9670, 0x0000, + 0x9E53, 0x9E56, 0x9E55, 0x0000, 0x8AF7, 0x0000, 0x0000, 0x8B80, 0x0000, + 0x9E52, 0x0000, 0x9E54, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E57, 0x0000, + 0x0000, 0x9099, 0x0000, 0x0000, 0x0000, 0x0000, 0x979B, 0x88C7, 0x8DDE, + 0x91BA, 0x0000, 0x8EDB, 0x0000, 0x0000, 0x8FF1, 0x0000, 0x0000, 0x9E5A, + 0x0000, 0x0000, 0x936D, 0x0000, 0x9E58, 0x91A9, 0x9E59, 0x8FF0, 0x96DB, + 0x9E5B, 0x9E5C, 0x9788, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E61, 0x0000, + 0x0000, 0x8D59, 0x0000, 0x9474, 0x9E5E, 0x938C, 0x9DDC, 0x9DE0, 0x0000, + 0x8B6E, 0x0000, 0x9466, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E60, 0x0000, + 0x8FBC, 0x94C2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E66, 0x0000, + 0x94F8, 0x0000, 0x9E5D, 0x0000, 0x9E63, 0x9E62, 0x0000, 0x0000, 0x0000, + 0x90CD, 0x0000, 0x0000, 0x0000, 0x0000, 0x968D, 0x0000, 0x97D1, 0x0000, + 0x0000, 0x9687, 0x0000, 0x89CA, 0x8E7D, 0x0000, 0x0000, 0x9867, 0x9E65, + 0x9095, 0x0000, 0x0000, 0x0000, 0x9E64, 0x0000, 0x0000, 0x9E5F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8CCD, 0x0000, 0x0000, 0x0000, 0x9E6B, + 0x9E69, 0x0000, 0x89CB, 0x9E67, 0x9E6D, 0x9E73, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x91C6, 0x0000, 0x0000, 0x95BF, 0x0000, + 0x9E75, 0x0000, 0x0000, 0x0000, 0x9541, 0x0000, 0x0000, 0x0000, 0x9E74, + 0x9490, 0x965E, 0x8AB9, 0x0000, 0x90F5, 0x8F5F, 0x0000, 0x0000, 0x0000, + 0x92D1, 0x0000, 0x974D, 0x0000, 0x0000, 0x9E70, 0x9E6F, 0x0000, 0x0000, + 0x0000, 0x9E71, 0x0000, 0x9E6E, 0x0000, 0x0000, 0x9E76, 0x0000, 0x9E6C, + 0x0000, 0x0000, 0x9E6A, 0x0000, 0x9E72, 0x9E68, 0x0000, 0x928C, 0x0000, + 0x96F6, 0x8EC4, 0x8DF2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8DB8, + 0x0000, 0x0000, 0x968F, 0x8A60}; + +static wchar_t Ucs68[256] = { + 0x0000, 0x0000, 0x92CC, 0x93C8, 0x8968, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x90F0, 0x0000, 0x0000, 0x90B2, 0x8C49, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9E78, 0x0000, 0x0000, 0x8D5A, 0x8A9C, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E7A, 0x8A94, 0x9E81, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E7D, 0x0000, 0x90F1, 0x0000, + 0x0000, 0x0000, 0x8A6A, 0x8DAA, 0x0000, 0x0000, 0x8A69, 0x8DCD, 0x0000, + 0x0000, 0x9E7B, 0x8C85, 0x8C6A, 0x938D, 0x0000, 0x0000, 0x9E79, 0x0000, + 0x88C4, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E7C, 0x9E7E, 0x0000, 0x8BCB, + 0x8C4B, 0x0000, 0x8ABA, 0x8B6A, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E82, + 0x0000, 0x0000, 0x8DF7, 0x9691, 0x0000, 0x8E56, 0x0000, 0x0000, 0x0000, + 0x9E83, 0x0000, 0x0000, 0x0000, 0x954F, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E8F, + 0x0000, 0x89B1, 0x9E84, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9E95, 0x9E85, 0x0000, 0x97C0, 0x0000, 0x9E8C, 0x0000, 0x947E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9E94, 0x0000, 0x9E87, + 0x0000, 0x0000, 0x0000, 0x88B2, 0x9E89, 0x0000, 0x0000, 0x8D5B, 0x0000, + 0x0000, 0x0000, 0x9E8B, 0x0000, 0x9E8A, 0x0000, 0x9E86, 0x9E91, 0x0000, + 0x8FBD, 0x0000, 0x0000, 0x0000, 0x9AEB, 0x8CE6, 0x979C, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9E88, 0x0000, 0x92F2, 0x8A42, 0x8DAB, 0x0000, 0x9E80, + 0x0000, 0x9E90, 0x8A81, 0x0000, 0x0000, 0x9E8E, 0x9E92, 0x0000, 0x938E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AFC, 0x0000, + 0x9EB0, 0x0000, 0x0000, 0x96C7, 0x9E97, 0x8AFB, 0x0000, 0x9E9E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x965F, 0x0000, 0x9E9F, 0x9EA1, 0x0000, 0x9EA5, + 0x9E99, 0x0000, 0x9249, 0x0000, 0x0000, 0x0000, 0x0000, 0x938F, 0x9EA9, + 0x9E9C, 0x0000, 0x9EA6, 0x0000, 0x0000, 0x0000, 0x9EA0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9058, 0x9EAA, 0x0000, 0x0000, 0x90B1, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EA8, 0x8ABB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs69[256] = { + 0x986F, 0x9E96, 0x0000, 0x0000, 0x9EA4, 0x88D6, 0x0000, 0x0000, 0x9E98, + 0x0000, 0x0000, 0x96B8, 0x9E9D, 0x9041, 0x92C5, 0x9E93, 0x0000, 0x0000, + 0x9EA3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x909A, 0x9EAD, + 0x8A91, 0x8C9F, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EAF, 0x9E9A, 0x9EAE, + 0x0000, 0x9EA7, 0x9E9B, 0x0000, 0x9EAB, 0x0000, 0x9EAC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9EBD, 0x0000, 0x0000, 0x0000, 0x93CC, 0x0000, + 0x9EA2, 0x0000, 0x0000, 0x9EB9, 0x0000, 0x0000, 0x0000, 0x9EBB, 0x0000, + 0x92D6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x976B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9596, 0x9EB6, 0x91C8, 0x0000, 0x0000, 0x0000, 0x9EBC, + 0x915E, 0x0000, 0x9EB3, 0x9EC0, 0x9EBF, 0x0000, 0x93ED, 0x9EBE, 0x93E8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EC2, 0x9EB5, + 0x0000, 0x8BC6, 0x9EB8, 0x8F7C, 0x0000, 0x0000, 0x0000, 0x9480, 0x9EBA, + 0x8BC9, 0x0000, 0x9EB2, 0x9EB4, 0x9EB1, 0x0000, 0x0000, 0x984F, 0x8A79, + 0x9EB7, 0x0000, 0x0000, 0x9EC1, 0x8A54, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8DE5, 0x0000, 0x0000, 0x0000, 0x897C, 0x0000, + 0x0000, 0x9ED2, 0x0000, 0x0000, 0x9850, 0x9ED5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9059, 0x9ED4, 0x0000, 0x0000, 0x0000, 0x9ED3, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9ED0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9EC4, 0x0000, 0x0000, 0x9EE1, 0x9EC3, 0x0000, + 0x9ED6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9ECE, 0x0000, + 0x0000, 0x9EC9, 0x9EC6, 0x0000, 0x9EC7, 0x0000, 0x9ECF, 0x0000, 0x0000, + 0x0000, 0xEAA0, 0x0000, 0x0000, 0x9ECC, 0x8D5C, 0x92C6, 0x9184, 0x9ECA, + 0x0000, 0x9EC5, 0x0000, 0x0000, 0x9EC8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x976C, 0x968A, 0x0000, 0x0000, 0x0000, 0x9ECD, 0x9ED7, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EDF, 0x9ED8, 0x0000, + 0x0000, 0x9EE5, 0x0000, 0x9EE3, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EDE, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EDD, 0x0000, 0x92CE, + 0x0000, 0x9185, 0x0000, 0x9EDB}; + +static wchar_t Ucs6A[256] = { + 0x0000, 0x0000, 0x9ED9, 0x0000, 0x0000, 0x9EE0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9EE6, 0x94F3, 0x9EEC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9EE7, 0x9EEA, 0x9EE4, 0x0000, 0x0000, 0x9294, 0x0000, 0x9557, 0x0000, + 0x9EDA, 0x0000, 0x0000, 0x9EE2, 0x8FBE, 0x0000, 0x96CD, 0x9EF6, 0x9EE9, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CA0, 0x89A1, 0x8A7E, 0x0000, + 0x0000, 0x9ED1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FBF, + 0x9EEE, 0x0000, 0x9EF5, 0x8EF7, 0x8A92, 0x0000, 0x0000, 0x924D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EEB, 0x0000, 0x0000, 0x9EF0, + 0x9EF4, 0x0000, 0x0000, 0x8BB4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B6B, 0x9EF2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B40, 0x0000, 0x93C9, 0x9EF1, + 0x0000, 0x0000, 0x0000, 0x9EF3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EED, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9EEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8A80, 0x9268, 0x0000, 0x0000, 0x0000, 0x9EFA, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9EF8, 0x8CE7, 0x0000, + 0x9EF7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F40, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9E77, 0x0000, 0x0000, 0x0000, 0x9EF9, 0x0000, + 0x9EFB, 0x9EFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F4B, + 0x0000, 0x9F47, 0x0000, 0x9E8D, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F46, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9F45, 0x0000, 0x0000, 0x9F42, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9EE8, 0x9F44, 0x9F43, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9F49, 0x0000, 0x9845, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9F4C, 0x8BF9, 0x0000, 0x0000, 0x9F48, 0x9F4A, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94A5, 0x0000, + 0x9F4D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F51, 0x9F4E, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs6B[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x9793, 0x9F4F, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9EDC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9F52, 0x0000, 0x0000, 0x0000, 0x9F53, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8954, 0x0000, 0x9F55, 0x8C87, 0x8E9F, 0x0000, 0x8BD3, + 0x0000, 0x0000, 0x0000, 0x89A2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x977E, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9F57, 0x9F56, 0x9F59, 0x8B5C, 0x0000, 0x0000, 0x8BD4, 0x8ABC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9F5C, 0x0000, 0x0000, 0x0000, 0x9F5B, + 0x0000, 0x9F5D, 0x0000, 0x0000, 0x89CC, 0x0000, 0x9256, 0x0000, 0x9F5E, + 0x0000, 0x0000, 0x8ABD, 0x9F60, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F5F, + 0x0000, 0x9F61, 0x0000, 0x0000, 0x0000, 0x9F62, 0x0000, 0x9F63, 0x8E7E, + 0x90B3, 0x8D9F, 0x0000, 0x9590, 0x0000, 0x0000, 0x95E0, 0x9863, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8E95, 0x0000, 0x0000, 0x0000, 0x8DCE, 0x97F0, + 0x0000, 0x0000, 0x0000, 0x9F64, 0x9F65, 0x0000, 0x8E80, 0x0000, 0x0000, + 0x0000, 0x9F66, 0x9F67, 0x0000, 0x0000, 0x9F69, 0x9F68, 0x0000, 0x9677, + 0x0000, 0x0000, 0x8F7D, 0x8EEA, 0x8E63, 0x0000, 0x9F6A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F6C, 0x9042, 0x0000, 0x9F6B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F6D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9F6E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F6F, + 0x9F70, 0x0000, 0x0000, 0x0000, 0x9F71, 0x0000, 0x9F73, 0x9F72, 0x9F74, + 0x89A3, 0x9269, 0x0000, 0x9F75, 0x0000, 0x0000, 0x8E45, 0x8A6B, 0x9F76, + 0x0000, 0x0000, 0x9361, 0x9ACA, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B42, + 0x9F77, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F78, 0x0000, 0x95EA, 0x9688, + 0x0000, 0x0000, 0x0000, 0x93C5, 0x9F79, 0x94E4, 0x0000, 0x0000, 0x0000, + 0x94F9, 0x0000, 0x0000, 0x96D1, 0x0000, 0x0000, 0x0000, 0x9F7A, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9F7C, 0x9F7B, 0x0000, 0x0000, 0x9F7E, 0x0000, 0x0000, 0x0000, + 0x9F7D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs6C[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F81, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E81, 0x0000, 0x96AF, + 0x0000, 0x9F82, 0x9F83, 0x0000, 0x0000, 0x8B43, 0x0000, 0x0000, 0x0000, + 0x9F84, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F86, + 0x9F85, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9085, 0x0000, + 0x0000, 0x9558, 0x8969, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94C3, + 0x0000, 0x92F3, 0x8F60, 0x8B81, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94C4, 0x0000, 0x8EAC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9F88, 0x0000, 0x8ABE, 0x0000, 0x0000, + 0x8998, 0x0000, 0x0000, 0x93F0, 0x9F87, 0x8D5D, 0x9272, 0x0000, 0x9F89, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9F91, 0x0000, 0x9F8A, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x91BF, 0x0000, 0x8B82, 0x9F92, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C88, 0x0000, 0x0000, 0x8B44, + 0x9F90, 0x0000, 0x0000, 0x9F8E, 0x9F8B, 0x9780, 0x0000, 0x0000, 0x0000, + 0x0000, 0x92BE, 0x0000, 0x0000, 0x0000, 0x93D7, 0x9F8C, 0x0000, 0x0000, + 0x9F94, 0x0000, 0x9F93, 0x8C42, 0x0000, 0x0000, 0x89AB, 0x0000, 0x0000, + 0x8DB9, 0x9F8D, 0x9F8F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9676, + 0x91F2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9697, 0x0000, 0x0000, 0x9F9C, 0x0000, 0x0000, 0x9F9D, 0x0000, 0x89CD, + 0x0000, 0x0000, 0x0000, 0x0000, 0x95A6, 0x96FB, 0x9F9F, 0x8EA1, 0x8FC0, + 0x9F98, 0x9F9E, 0x8988, 0x0000, 0x8BB5, 0x0000, 0x0000, 0x9F95, 0x9F9A, + 0x0000, 0x0000, 0x0000, 0x90F2, 0x9491, 0x0000, 0x94E5, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9F97, 0x0000, 0x9640, 0x0000, 0x9F99, + 0x0000, 0x9FA2, 0x0000, 0x9FA0, 0x0000, 0x9F9B, 0x0000, 0x0000, 0x0000, + 0x9641, 0x9467, 0x8B83, 0x0000, 0x9344, 0x0000, 0x0000, 0x928D, 0x0000, + 0x9FA3, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FA1, 0x91D7, 0x9F96, 0x0000, + 0x896A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs6D[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x976D, 0x9FAE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9FAD, 0x0000, 0x0000, 0x0000, 0x0000, 0x90F4, 0x0000, 0x9FAA, 0x0000, + 0x978C, 0x0000, 0x0000, 0x93B4, 0x9FA4, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x92C3, 0x0000, 0x0000, 0x0000, 0x896B, 0x8D5E, 0x9FA7, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F46, 0x9FAC, 0x0000, 0x9FAB, + 0x9FA6, 0x0000, 0x9FA9, 0x0000, 0x0000, 0x8A88, 0x0000, 0x9FA8, 0x9468, + 0x0000, 0x0000, 0x97AC, 0x0000, 0x0000, 0x8FF2, 0x90F3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FB4, + 0x9FB2, 0x0000, 0x956C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9FAF, 0x9FB1, 0x0000, 0x8959, 0x0000, 0x0000, 0x8D5F, 0x9851, 0x0000, + 0x8A5C, 0x0000, 0x9582, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9781, + 0x0000, 0x0000, 0x8A43, 0x905A, 0x9FB3, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FB8, 0x0000, + 0x0000, 0x8FC1, 0x0000, 0x0000, 0x0000, 0x974F, 0x0000, 0x9FB5, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9FB0, 0x0000, 0x9FB6, 0x0000, 0x0000, 0x0000, + 0x97DC, 0x0000, 0x9393, 0x93C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8A55, 0x0000, 0x0000, 0x8974, 0x0000, + 0x0000, 0x9FBC, 0x0000, 0x0000, 0x9FBF, 0x0000, 0x0000, 0x0000, 0x97C1, + 0x0000, 0x0000, 0x0000, 0x9784, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FC6, + 0x9FC0, 0x9FBD, 0x0000, 0x0000, 0x0000, 0x97D2, 0x9FC3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8F69, 0x9FC5, 0x0000, 0x0000, 0x9FCA, 0x0000, 0x0000, + 0x9391, 0x9FC8, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FC2, 0x0000, 0x0000, + 0x9257, 0x0000, 0x0000, 0x9FC9, 0x0000, 0x9FBE, 0x0000, 0x9FC4, 0x0000, + 0x9FCB, 0x88FA, 0x9FC1, 0x0000, 0x9FCC, 0x0000, 0x0000, 0x905B, 0x0000, + 0x8F7E, 0x0000, 0x95A3, 0x0000, 0x8DAC, 0x0000, 0x9FB9, 0x9FC7, 0x9359, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs6E[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90B4, 0x0000, 0x8A89, 0x8DCF, + 0x8FC2, 0x9FBB, 0x8F61, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8C6B, 0x0000, 0x9FBA, 0x0000, 0x0000, 0x0000, 0x9FD0, 0x8F8D, + 0x8CB8, 0x0000, 0x9FDF, 0x0000, 0x9FD9, 0x8B94, 0x936E, 0x0000, 0x9FD4, + 0x9FDD, 0x88AD, 0x8951, 0x0000, 0x0000, 0x89B7, 0x0000, 0x9FD6, 0x91AA, + 0x9FCD, 0x9FCF, 0x8D60, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9FE0, 0x0000, 0x9FDB, 0x0000, 0x0000, 0x0000, 0x9FD3, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9FDA, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x96A9, 0x0000, 0x0000, 0x9FD8, 0x9FDC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CCE, 0x0000, 0x8FC3, 0x0000, + 0x0000, 0x9258, 0x0000, 0x0000, 0x0000, 0x9FD2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x974E, 0x0000, 0x0000, 0x0000, 0x9FD5, + 0x0000, 0x0000, 0x9FCE, 0x9392, 0x0000, 0x0000, 0x9FD1, 0x0000, 0x0000, + 0x0000, 0x9FD7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9870, 0x8EBC, 0x969E, 0x0000, 0x9FE1, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94AC, 0x0000, 0x0000, 0x9FED, + 0x8CB9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F80, 0x0000, 0x9FE3, + 0x0000, 0x0000, 0x0000, 0x97AD, 0x8D61, 0x0000, 0x9FF0, 0x0000, 0x0000, + 0x88EC, 0x0000, 0x0000, 0x9FEE, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FE2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9FE8, 0x0000, 0x0000, 0x9FEA, 0x0000, + 0x0000, 0x0000, 0x976E, 0x9FE5, 0x0000, 0x0000, 0x934D, 0x0000, 0x0000, + 0x9FE7, 0x0000, 0x0000, 0x0000, 0x0000, 0x9FEF, 0x0000, 0x9FE9, 0x96C5, + 0x0000, 0x0000, 0x0000, 0x9FE4, 0x0000, 0x8EA0, 0x9FFC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8A8A, 0x0000, 0x9FE6, 0x9FEB, 0x9FEC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91EA, 0x91D8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9FF4, 0x0000, 0x0000, 0x9FFA, 0x0000, 0x0000, 0x9FF8, + 0x0000, 0x9348, 0x0000, 0x0000, 0xE042, 0x9FF5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9FF6, 0x9FDE}; + +static wchar_t Ucs6F[256] = { + 0x0000, 0x8B99, 0x9559, 0x0000, 0x0000, 0x0000, 0x8EBD, 0x0000, 0x0000, + 0x8D97, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9852, 0x0000, 0x9FF2, + 0x0000, 0xE041, 0x8989, 0x9186, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9499, 0x0000, 0x8ABF, 0x97F8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x969F, 0x92D0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9FF9, 0x9FFB, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9151, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE040, + 0x9FF7, 0x0000, 0x9FF1, 0x0000, 0x0000, 0x0000, 0x8AC1, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8C89, 0x0000, 0x0000, 0x0000, 0xE04E, 0x0000, + 0x0000, 0xE049, 0x90F6, 0x0000, 0x0000, 0x8A83, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8F81, 0x0000, 0xE052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE04B, 0x92AA, 0xE048, 0x92D7, 0x0000, 0x0000, 0x0000, 0xE06B, + 0x0000, 0x0000, 0x0000, 0xE045, 0x0000, 0xE044, 0x0000, 0xE04D, 0x0000, + 0x0000, 0x0000, 0xE047, 0xE046, 0xE04C, 0x0000, 0x909F, 0x0000, 0xE043, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE04F, 0x0000, + 0x0000, 0xE050, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AC0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE055, + 0x0000, 0xE054, 0xE056, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE059, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9362, 0x0000, 0xE053, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE057, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8C83, 0x91F7, 0xE051, 0x945A, 0x0000, 0x0000, + 0xE058, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE05D, 0xE05B, 0x0000, 0x0000, + 0xE05E, 0x0000, 0x0000, 0xE061, 0x0000, 0x0000, 0x0000, 0xE05A, 0x8D8A, + 0x9447, 0x0000, 0x0000, 0x9FB7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9794, 0xE05C, 0x0000, 0xE060, 0x91F3, 0x0000, 0xE05F, 0x0000, + 0xE04A, 0x0000, 0x0000, 0xE889, 0x0000, 0x0000, 0x0000, 0xE064, 0x0000, + 0x0000, 0x0000, 0xE068, 0x0000}; + +static wchar_t Ucs70[256] = { + 0x0000, 0xE066, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE062, 0x0000, 0xE063, 0x0000, 0x0000, 0x0000, 0xE067, 0x0000, 0xE065, + 0x0000, 0x0000, 0x0000, 0x956D, 0x0000, 0x0000, 0xE06D, 0x0000, 0xE06A, + 0xE069, 0x0000, 0xE06C, 0x93D2, 0xE06E, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9295, 0x91EB, 0x0000, 0x0000, 0x0000, 0x0000, 0x90A3, + 0x0000, 0x0000, 0x0000, 0xE06F, 0x0000, 0xE071, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE070, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9FF3, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE072, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x93E5, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE073, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89CE, + 0x0000, 0x0000, 0x0000, 0x9394, 0x8A44, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8B84, 0x0000, 0x0000, 0x0000, 0x8EDC, 0x8DD0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9846, 0x9086, 0x0000, 0x0000, 0x0000, 0x898A, 0x0000, + 0x0000, 0x0000, 0xE075, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE074, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE078, 0x9259, 0xE07B, 0xE076, 0x0000, 0x0000, 0x0000, 0xE07A, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE079, 0x935F, 0x88D7, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x97F3, 0x0000, 0x0000, 0xE07D, 0x0000, 0x0000, 0x0000, + 0x8947, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE080, 0x0000, 0x0000, 0x0000, 0xE07E, 0x0000, 0xE07C, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE077, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9642, 0x0000, 0x0000, + 0x0000, 0xE082, 0x0000, 0x0000}; + +static wchar_t Ucs71[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x898B, 0x0000, 0x0000, 0x0000, 0x0000, 0xE084, 0x95B0, + 0x0000, 0xE083, 0x0000, 0x0000, 0x0000, 0x0000, 0x96B3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8FC5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9152, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FC4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x97F9, 0x0000, 0x0000, 0xE08A, 0x0000, 0x90F7, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE086, 0xE08B, 0x0000, 0x0000, 0x898C, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE089, + 0x0000, 0x9481, 0xE085, 0xE088, 0x8FC6, 0x0000, 0x94CF, 0x0000, 0x0000, + 0xE08C, 0x0000, 0x8ECF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90F8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE08F, 0x0000, 0x0000, + 0x0000, 0xE087, 0x0000, 0x8C46, 0x0000, 0x0000, 0x0000, 0x0000, 0xE08D, + 0x0000, 0x0000, 0x0000, 0x0000, 0x976F, 0xE090, 0x0000, 0x0000, 0x0000, + 0xEAA4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8F6E, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE091, 0x0000, 0x0000, + 0x0000, 0xE092, 0x0000, 0x0000, 0x0000, 0x0000, 0x944D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE094, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE095, 0x0000, 0x0000, 0x0000, 0x0000, 0x9452, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9395, 0xE097, 0x0000, 0x0000, 0x0000, 0x0000, 0xE099, + 0x0000, 0x97D3, 0x0000, 0xE096, 0x0000, 0xE098, 0x898D, 0x0000, 0xE093, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9A7A, 0xE09A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9187, 0x8E57, 0xE09C, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE09B, 0x9043, 0x99D7, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE09D, 0x0000, 0x0000, 0x0000, 0xE09F, 0x0000, 0xE08E, + 0xE09E, 0x0000, 0x0000, 0xE0A0}; + +static wchar_t Ucs72[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x949A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0A1, 0x0000, 0x0000, 0xE0A2, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE0A3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0A4, 0x0000, 0x92DC, 0x0000, 0xE0A6, + 0xE0A5, 0x0000, 0x0000, 0xE0A7, 0x0000, 0xE0A8, 0x0000, 0x0000, 0x8EDD, + 0x9583, 0x0000, 0x0000, 0x0000, 0x96EA, 0xE0A9, 0xE0AA, 0x9175, 0x8EA2, + 0xE0AB, 0xE0AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0AD, 0x95D0, + 0x94C5, 0x0000, 0x0000, 0xE0AE, 0x9476, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x92AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0AF, 0x89E5, + 0x0000, 0x8B8D, 0x0000, 0x96C4, 0x0000, 0x96B4, 0x0000, 0x89B2, 0x9853, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9671, 0x0000, 0x95A8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90B5, 0x0000, 0xE0B0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x93C1, 0x0000, 0x0000, 0x0000, 0x8CA1, + 0xE0B1, 0x0000, 0x8DD2, 0xE0B3, 0xE0B2, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE0B4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE0B5, 0x0000, 0x0000, 0x0000, 0xE0B6, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B5D, 0x0000, + 0xE0B7, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0B8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8CA2, 0x0000, 0x0000, 0x94C6, 0x0000, 0x0000, 0xE0BA, 0x0000, + 0x0000, 0x0000, 0x8FF3, 0x0000, 0x0000, 0xE0B9, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BB6, 0xE0BB, 0xE0BD, 0x0000, + 0xE0BC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0BE, + 0x0000, 0x8CCF, 0x0000, 0xE0BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BE7, + 0x0000, 0x915F, 0x0000, 0x8D9D, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0C1, + 0xE0C2, 0xE0C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EEB, + 0x0000, 0x0000, 0x93C6, 0x8BB7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0C4, 0x924B, 0xE0C3, 0x0000, 0x0000, + 0x9854, 0x9482, 0x0000, 0x0000}; + +static wchar_t Ucs73[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE0C7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0C9, 0xE0C6, 0x0000, 0x0000, 0x0000, + 0x96D2, 0xE0C8, 0xE0CA, 0x0000, 0x97C2, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE0CE, 0x0000, 0x0000, 0x0000, 0xE0CD, 0x9296, 0x944C, 0x0000, + 0x0000, 0x8CA3, 0xE0CC, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0CB, 0x0000, + 0x9750, 0x9751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0CF, + 0x898E, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D96, 0x8E82, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0D0, 0xE0D1, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0D3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8F62, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0D5, 0x0000, 0xE0D4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0D6, 0x0000, 0x8A6C, 0x0000, 0x0000, + 0xE0D8, 0x0000, 0x0000, 0xE0D7, 0x0000, 0xE0DA, 0xE0D9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CBA, 0x0000, 0x0000, + 0x97A6, 0x0000, 0x8BCA, 0x0000, 0x89A4, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BE8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8ADF, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x97E6, 0xE0DC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0DE, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE0DF, 0x0000, 0x89CF, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE0DB, 0x0000, 0x8E58, 0x0000, 0x0000, 0x92BF, 0xE0DD, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0E2, 0x0000, 0x8EEC, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0E0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C5D, 0x0000, 0x0000, 0x94C7, 0xE0E1, 0x0000, 0x0000, 0xE0FC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0E7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8CBB, 0x0000}; + +static wchar_t Ucs74[256] = { + 0x0000, 0x0000, 0x0000, 0x8B85, 0x0000, 0xE0E4, 0x979D, 0x0000, 0x0000, + 0x97AE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91F4, 0x0000, + 0x0000, 0xE0E6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0E8, 0x97D4, 0x8BD5, 0x94FA, + 0x9469, 0x0000, 0x0000, 0x0000, 0xE0E9, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE0EB, 0x0000, 0xE0EE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0EA, 0x0000, 0x0000, 0x0000, 0xE0ED, + 0x8CE8, 0x896C, 0xE0EF, 0x0000, 0x9090, 0xE0EC, 0x97DA, 0x0000, 0x0000, + 0xE0F2, 0xEAA2, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0F0, 0xE0F3, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE0E5, 0xE0F1, 0x0000, 0x0000, 0x8DBA, 0x0000, + 0x0000, 0xE0F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE0F5, 0x0000, 0x0000, 0x0000, 0x0000, 0x979E, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0F6, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0F7, 0x0000, 0x0000, 0x0000, + 0xE0E3, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0F8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AC2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8EA3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE0F9, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE0FA, 0x0000, 0x0000, 0x0000, 0x0000, 0xE0FB, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x895A, 0x0000, 0x0000, 0x0000, 0xE140, + 0x0000, 0x955A, 0xE141, 0x0000, 0x0000, 0x8AA2, 0xE142, 0x0000, 0xE143, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE144, 0x0000, 0xE146, 0xE147, 0xE145, + 0x0000, 0x0000, 0x0000, 0x9572, 0xE149, 0xE148, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs75[256] = { + 0x0000, 0x0000, 0x0000, 0xE14B, 0xE14A, 0xE14C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE14D, 0xE14F, 0xE14E, 0x0000, 0x0000, 0x8D99, + 0x0000, 0xE151, 0x0000, 0xE150, 0x0000, 0x0000, 0x8AC3, 0x0000, 0x9072, + 0x0000, 0x935B, 0x0000, 0xE152, 0x90B6, 0x0000, 0x0000, 0x0000, 0x8E59, + 0x0000, 0x8999, 0xE153, 0x0000, 0x9770, 0x0000, 0x0000, 0x95E1, 0xE154, + 0x0000, 0x0000, 0x0000, 0x9363, 0x9752, 0x8D62, 0x905C, 0x0000, 0x0000, + 0x0000, 0x926A, 0x99B2, 0x0000, 0x92AC, 0x89E6, 0xE155, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE156, 0x0000, 0xE15B, 0x0000, + 0x0000, 0xE159, 0xE158, 0x9DC0, 0x8A45, 0xE157, 0x0000, 0x88D8, 0x0000, + 0x94A8, 0x0000, 0x0000, 0x94C8, 0x0000, 0x0000, 0x0000, 0x0000, 0x97AF, + 0xE15C, 0xE15A, 0x927B, 0x90A4, 0x0000, 0x0000, 0x94A9, 0x0000, 0x954C, + 0x0000, 0xE15E, 0x97AA, 0x8C6C, 0xE15F, 0x0000, 0xE15D, 0x94D4, 0xE160, + 0x0000, 0xE161, 0x0000, 0x0000, 0x88D9, 0x0000, 0x0000, 0x8FF4, 0xE166, + 0x0000, 0xE163, 0x93EB, 0xE162, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8B45, 0x0000, 0x0000, 0xE169, 0x0000, 0x0000, 0x0000, 0xE164, + 0xE165, 0x0000, 0xE168, 0xE167, 0x9544, 0x0000, 0x0000, 0x9161, 0x9160, + 0x0000, 0x8B5E, 0x0000, 0x0000, 0xE16A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE16B, 0x0000, 0x0000, 0xE16C, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE16E, 0x0000, 0xE16D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8975, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE176, 0x94E6, 0xE170, + 0x0000, 0xE172, 0x0000, 0x0000, 0xE174, 0x905D, 0x0000, 0x0000, 0xE175, + 0xE173, 0x8EBE, 0x0000, 0x0000, 0x0000, 0xE16F, 0xE171, 0x0000, 0x9561, + 0x0000, 0x8FC7, 0x0000, 0x0000, 0xE178, 0x0000, 0x0000, 0xE177, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE179, 0x0000, 0x8EA4, 0x8DAD, 0x0000, 0x0000, + 0x9397, 0xE17A, 0x0000, 0x92C9, 0x0000, 0x0000, 0xE17C, 0x0000, 0x0000, + 0x0000, 0x979F, 0xE17B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9189, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE182, 0x0000, 0xE184, + 0xE185, 0x9273, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE183, 0x0000, + 0xE180, 0x0000, 0xE17D, 0xE17E}; + +static wchar_t Ucs76[256] = { + 0x0000, 0xE181, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE188, 0x0000, 0xE186, 0x0000, 0xE187, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE189, 0xE18B, 0xE18C, 0xE18D, 0x0000, + 0xE18E, 0x0000, 0x0000, 0xE18A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE190, 0x0000, 0x0000, 0x0000, 0xE18F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE191, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x97C3, 0x0000, 0x0000, 0x0000, 0xE194, 0xE192, + 0xE193, 0x0000, 0x0000, 0x0000, 0x8AE0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x96FC, 0x0000, 0x0000, 0x0000, 0x95C8, 0x0000, 0xE196, 0x0000, + 0x0000, 0x0000, 0xE195, 0x0000, 0x0000, 0x0000, 0x0000, 0xE197, 0xE198, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE19C, 0xE199, 0xE19A, 0xE19B, 0x0000, + 0xE19D, 0x0000, 0x0000, 0x0000, 0xE19E, 0x0000, 0xE19F, 0x0000, 0x0000, + 0x0000, 0xE1A0, 0x0000, 0xE1A1, 0x0000, 0x94AD, 0x936F, 0xE1A2, 0x9492, + 0x9553, 0x0000, 0xE1A3, 0x0000, 0x0000, 0xE1A4, 0x9349, 0x0000, 0x8A46, + 0x8D63, 0xE1A5, 0x0000, 0x0000, 0xE1A6, 0x0000, 0x0000, 0xE1A7, 0x0000, + 0x8E48, 0x0000, 0x0000, 0xE1A9, 0x0000, 0x0000, 0xE1A8, 0x0000, 0x0000, + 0xE1AA, 0xE1AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x94E7, 0x0000, 0xE1AC, 0x0000, 0x0000, 0x0000, + 0xE1AD, 0x0000, 0x0000, 0xEA89, 0xE1AE, 0xE1AF, 0xE1B0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8E4D, 0x0000, 0x0000, 0xE1B1, 0x9475, 0x0000, 0x0000, + 0x967E, 0x0000, 0x896D, 0x0000, 0x8976, 0x0000, 0x0000, 0xE1B2, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE1B4, 0x0000, 0x0000, 0x0000, 0xE1B3, 0x9390, + 0x0000, 0x0000, 0x0000, 0x90B7, 0x9F58, 0x0000, 0xE1B5, 0x96BF, 0x0000, + 0xE1B6, 0x0000, 0x8AC4, 0x94D5, 0xE1B7, 0x0000, 0xE1B8, 0x0000, 0x0000, + 0xE1B9, 0x0000, 0x0000, 0x0000, 0x96DA, 0x0000, 0x0000, 0x0000, 0x96D3, + 0x0000, 0x92BC, 0x0000, 0x0000, 0x0000, 0x918A, 0x0000, 0x0000, 0xE1BB, + 0x0000, 0x0000, 0x8F82, 0x0000}; + +static wchar_t Ucs77[256] = { + 0x0000, 0x8FC8, 0x0000, 0x0000, 0xE1BE, 0x0000, 0x0000, 0xE1BD, 0xE1BC, + 0x94FB, 0x0000, 0x8AC5, 0x8CA7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE1C4, 0x0000, 0x0000, 0xE1C1, 0x905E, 0x96B0, 0x0000, 0x0000, 0x0000, + 0xE1C0, 0xE1C2, 0xE1C3, 0x0000, 0x0000, 0xE1BF, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE1C5, 0xE1C6, 0x0000, 0x92AD, 0x0000, 0x8AE1, 0x0000, 0x0000, + 0x0000, 0x9285, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1C7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE1C8, 0xE1CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9087, 0x0000, + 0x93C2, 0x0000, 0xE1CC, 0x9672, 0x0000, 0xE1C9, 0x0000, 0x0000, 0xE1CA, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE1CF, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE1CE, 0xE1CD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE1D1, 0x0000, 0x0000, 0xE1D0, 0x0000, + 0x0000, 0xE1D2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1D4, 0x0000, 0xE1D3, 0x0000, + 0x0000, 0x0000, 0x0000, 0x95CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8F75, 0x97C4, 0x0000, 0x0000, 0xE1D5, 0x0000, 0x0000, 0x93B5, + 0x0000, 0x0000, 0xE1D6, 0x0000, 0x0000, 0xE1D7, 0x0000, 0xE1DB, 0xE1D9, + 0xE1DA, 0x0000, 0xE1D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE1DC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1DD, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1DE, + 0x0000, 0x0000, 0xE1DF, 0x96B5, 0xE1E0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x96EE, 0xE1E1, 0x0000, 0x926D, 0x0000, 0x948A, 0x0000, 0x8BE9, + 0x0000, 0x0000, 0x0000, 0x925A, 0xE1E2, 0x8BB8, 0x0000, 0x0000, 0x0000, + 0x90CE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE1E3, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs78[256] = { + 0x0000, 0x0000, 0x8DBB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE1E4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE1E5, 0x0000, 0x8CA4, 0x8DD3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1E7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9375, 0x8DD4, 0x8B6D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9643, 0x0000, 0x946A, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x9376, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8D7B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1E9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8FC9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x97B0, + 0x8D64, 0x0000, 0x0000, 0x8CA5, 0x0000, 0x0000, 0x94A1, 0x0000, 0xE1EB, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1ED, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8CE9, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1EC, + 0x92F4, 0x0000, 0x0000, 0x0000, 0x0000, 0xE1EF, 0x8A56, 0xE1EA, 0x0000, + 0x0000, 0x94E8, 0x0000, 0x894F, 0x0000, 0x8DEA, 0x0000, 0x9871, 0x0000, + 0x0000, 0xE1EE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE1F0, 0x0000, 0x0000, 0x0000, 0x95C9, 0x0000, 0x90D7, 0xE1F2, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE1F3, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE1F1, 0x0000, 0x0000, 0x0000, 0x0000, 0x8A6D, 0x0000, 0xE1F9, + 0x0000, 0xE1F8, 0x0000, 0x0000, 0x8EA5, 0x0000, 0x0000, 0x0000, 0xE1FA, + 0xE1F5, 0x0000, 0x0000, 0x0000, 0xE1FB, 0xE1F6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x94D6, 0xE1F4, 0x0000, 0x0000, 0xE1F7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE240, 0x9681, 0x0000, + 0x0000, 0x0000, 0xE1FC, 0x0000, 0x0000, 0x88E9, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE243, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE242, 0x0000, 0x0000}; + +static wchar_t Ucs79[256] = { + 0x0000, 0x8FCA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE244, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9162, 0x0000, 0x0000, 0xE246, + 0xE245, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE247, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE1E6, 0x0000, 0x0000, 0x0000, 0xE1E8, 0xE249, 0xE248, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8EA6, 0x0000, 0x97E7, 0x0000, 0x8ED0, + 0x0000, 0xE24A, 0x8C56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B5F, + 0x8B46, 0x8E83, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9753, + 0x0000, 0x0000, 0xE250, 0x0000, 0xE24F, 0x9163, 0xE24C, 0x0000, 0x0000, + 0xE24E, 0x0000, 0x0000, 0x8F6A, 0x905F, 0xE24D, 0xE24B, 0x0000, 0x9449, + 0x0000, 0x0000, 0x8FCB, 0x0000, 0x0000, 0x955B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8DD5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9398, 0x0000, 0x0000, 0xE251, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE252, 0xE268, 0x8BD6, 0x0000, 0x0000, 0x985C, 0x9154, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE253, 0x0000, 0x0000, 0x89D0, 0x92F5, 0x959F, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE254, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8B9A, 0xE255, 0x0000, 0x0000, 0xE257, + 0x0000, 0x0000, 0x0000, 0xE258, 0x0000, 0x9448, 0x0000, 0x0000, 0xE259, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE25A, 0xE25B, 0x0000, 0x0000, + 0x8BD7, 0x89D1, 0x93C3, 0x8F47, 0x8E84, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE25C, 0x0000, 0x8F48, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x89C8, 0x9562, 0x0000, 0x0000, 0xE25D, 0x0000, 0x0000, + 0x94E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9164, 0x0000, + 0xE260, 0x0000, 0xE261, 0x9489, 0x0000, 0x9060, 0xE25E, 0x0000, 0x9281, + 0x0000, 0x0000, 0xE25F, 0x0000, 0x0000, 0x0000, 0x8FCC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x88DA, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs7A[256] = { + 0x8B48, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE262, + 0x0000, 0x0000, 0x92F6, 0x0000, 0xE263, 0x90C5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x96AB, 0x0000, 0x0000, 0x9542, 0xE264, 0xE265, 0x9274, + 0x0000, 0x97C5, 0x0000, 0x0000, 0xE267, 0xE266, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8EED, 0x0000, 0x0000, 0xE269, 0x88EE, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE26C, 0x0000, 0x0000, 0x0000, 0xE26A, 0x89D2, 0x8C6D, 0xE26B, + 0x8D65, 0x8D92, 0x0000, 0x95E4, 0xE26D, 0x0000, 0x0000, 0x9673, 0x0000, + 0x0000, 0xE26F, 0x0000, 0x0000, 0x0000, 0x90CF, 0x896E, 0x89B8, 0x88AA, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE26E, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE270, 0xE271, + 0x8FF5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE272, 0x0000, 0x8A6E, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE274, 0x0000, 0x0000, 0x0000, 0x8C8A, + 0x0000, 0x8B86, 0x0000, 0x0000, 0xE275, 0x8BF3, 0x0000, 0x0000, 0xE276, + 0x0000, 0x90FA, 0x0000, 0x93CB, 0x0000, 0x90DE, 0x8DF3, 0x0000, 0x0000, + 0x0000, 0xE277, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9282, 0x918B, 0x0000, 0xE279, 0xE27B, 0xE278, 0xE27A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C41, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE27C, 0x8C45, + 0x0000, 0x0000, 0x0000, 0x8B87, 0x9771, 0xE27E, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE280, 0x0000, 0x0000, 0x0000, 0x894D, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE283, 0x0000, 0x0000, 0x0000, 0x8A96, 0xE282, 0xE281, + 0x0000, 0xE285, 0xE27D, 0x0000, 0xE286, 0x97A7, 0x0000, 0xE287, 0x0000, + 0xE288, 0x0000, 0x0000, 0x9AF2, 0xE28A, 0x0000, 0xE289, 0x0000, 0x0000, + 0x0000, 0xE28B, 0xE28C, 0x0000, 0x97B3, 0xE28D, 0x0000, 0xE8ED, 0x8FCD, + 0xE28E, 0xE28F, 0x8F76, 0x0000, 0x93B6, 0xE290, 0x0000, 0x0000, 0x0000, + 0x9247, 0x0000, 0x0000, 0xE291, 0x0000, 0x925B, 0xE292, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8BA3, 0x0000, 0x995E, 0x927C, 0x8EB1, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8AC6}; + +static wchar_t Ucs7B[256] = { + 0x0000, 0x0000, 0xE293, 0x0000, 0xE2A0, 0x0000, 0xE296, 0x0000, 0x8B88, + 0x0000, 0xE295, 0xE2A2, 0x0000, 0x0000, 0x0000, 0xE294, 0x0000, 0x8FCE, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE298, 0xE299, 0x0000, + 0x934A, 0x0000, 0x0000, 0xE29A, 0x0000, 0x8A7D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9079, 0x9584, 0x0000, 0xE29C, 0x0000, 0x0000, 0x0000, 0x91E6, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE297, 0x0000, 0xE29B, + 0xE29D, 0x0000, 0x0000, 0x8DF9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2A4, 0x954D, 0x0000, + 0x94A4, 0x9399, 0x0000, 0x8BD8, 0xE2A3, 0xE2A1, 0x0000, 0x94B3, 0xE29E, + 0x927D, 0x939B, 0x0000, 0x939A, 0x0000, 0x8DF4, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE2B6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE2A6, 0x0000, 0xE2A8, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE2AB, 0x0000, 0xE2AC, 0x0000, 0xE2A9, 0xE2AA, 0x0000, 0x0000, 0xE2A7, + 0xE2A5, 0x0000, 0x0000, 0x0000, 0x0000, 0xE29F, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95CD, + 0x89D3, 0x0000, 0x0000, 0x0000, 0xE2B3, 0x0000, 0xE2B0, 0x0000, 0xE2B5, + 0x0000, 0x0000, 0xE2B4, 0x0000, 0x9493, 0x96A5, 0x0000, 0x8E5A, 0xE2AE, + 0xE2B7, 0xE2B2, 0x0000, 0xE2B1, 0xE2AD, 0x0000, 0xE2AF, 0x0000, 0x8AC7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x925C, + 0x0000, 0x0000, 0x90FB, 0x0000, 0x0000, 0x0000, 0x94A0, 0x0000, 0x0000, + 0xE2BC, 0x0000, 0x0000, 0x0000, 0x94A2, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x90DF, 0xE2B9, 0x0000, 0x0000, 0x94CD, 0x0000, + 0xE2BD, 0x95D1, 0x0000, 0x927A, 0x0000, 0xE2B8, 0xE2BA, 0x0000, 0x0000, + 0xE2BB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2BE, 0x0000, 0x0000, 0x8EC2, + 0x0000, 0x0000, 0x0000, 0x93C4, 0xE2C3, 0xE2C2, 0x0000, 0x0000, 0xE2BF, + 0x0000, 0x0000, 0x0000, 0x9855, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE2C8, 0x0000, 0x0000, 0xE2CC, 0xE2C9, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs7C[256] = { + 0xE2C5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2C6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE2CB, 0x0000, 0x0000, 0x0000, 0xE2C0, + 0x99D3, 0xE2C7, 0xE2C1, 0x0000, 0x0000, 0xE2CA, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE2D0, 0x0000, 0x8AC8, 0x0000, 0xE2CD, + 0x0000, 0x0000, 0x0000, 0xE2CE, 0x0000, 0x0000, 0xE2CF, 0xE2D2, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE2D1, 0x94F4, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2D3, 0x97FA, + 0x95EB, 0xE2D8, 0x0000, 0x0000, 0xE2D5, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE2D4, 0x90D0, 0x0000, 0xE2D7, 0xE2D9, + 0x0000, 0x0000, 0x0000, 0xE2D6, 0x0000, 0xE2DD, 0x0000, 0xE2DA, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2DB, 0xE2C4, 0x0000, 0x0000, + 0x0000, 0xE2DC, 0xE2DE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE2DF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95C4, 0x0000, + 0xE2E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x96E0, 0x0000, 0x0000, 0x8BCC, 0x8C48, 0xE2E1, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x95B2, 0x0000, 0x9088, 0x0000, 0x96AE, 0x0000, 0x0000, + 0xE2E2, 0x0000, 0x97B1, 0x0000, 0x0000, 0x9494, 0x0000, 0x9165, 0x9453, + 0x0000, 0x0000, 0x8F6C, 0x0000, 0x0000, 0x0000, 0x88BE, 0x0000, 0xE2E7, + 0xE2E5, 0x0000, 0xE2E3, 0x8A9F, 0x0000, 0x8FCF, 0xE2E8, 0x0000, 0x0000, + 0xE2E6, 0x0000, 0xE2E4, 0xE2EC, 0x0000, 0x0000, 0xE2EB, 0xE2EA, 0xE2E9, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2ED, 0x0000, 0x0000, 0x0000, + 0xE2EE, 0x90B8, 0x0000, 0xE2EF, 0x0000, 0xE2F1, 0x0000, 0x0000, 0xE2F0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8CD0, 0x0000, 0x0000, 0x0000, 0x9157, + 0x0000, 0x0000, 0x0000, 0xE2F3, 0x0000, 0x0000, 0x0000, 0x939C, 0x0000, + 0xE2F2, 0x0000, 0x0000, 0x0000, 0xE2F4, 0x0000, 0x95B3, 0x918C, 0x8D66, + 0x0000, 0xE2F5, 0x0000, 0x0000, 0x0000, 0x0000, 0x97C6, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2F7, 0x0000, 0x0000, 0xE2F8, + 0x0000, 0xE2F9, 0x0000, 0xE2FA, 0x0000, 0x8E85, 0x0000, 0xE2FB, 0x8C6E, + 0x0000, 0x0000, 0x8B8A, 0x0000}; + +static wchar_t Ucs7D[256] = { + 0x8B49, 0x0000, 0xE340, 0x0000, 0x96F1, 0x8D67, 0xE2FC, 0x0000, 0x0000, + 0x0000, 0xE343, 0x96E4, 0x0000, 0x945B, 0x0000, 0x0000, 0x9552, 0x0000, + 0x0000, 0x0000, 0x8F83, 0xE342, 0x0000, 0x8ED1, 0x8D68, 0x8E86, 0x8B89, + 0x95B4, 0xE341, 0x0000, 0x0000, 0x0000, 0x9166, 0x9661, 0x8DF5, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E87, 0x92DB, + 0x0000, 0xE346, 0x97DD, 0x8DD7, 0x0000, 0xE347, 0x9061, 0x0000, 0xE349, + 0x0000, 0x0000, 0x0000, 0x8FD0, 0x8DAE, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE348, 0x0000, 0x0000, 0x8F49, 0x8CBC, 0x9167, 0xE344, 0xE34A, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE345, 0x8C6F, 0x0000, 0xE34D, 0xE351, 0x8C8B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE34C, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE355, 0x0000, 0x0000, 0x8D69, 0x0000, 0x0000, 0x978D, 0x88BA, + 0xE352, 0x0000, 0x0000, 0x8B8B, 0x0000, 0xE34F, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE350, 0x0000, 0x0000, 0x939D, 0xE34E, 0xE34B, 0x0000, + 0x8A47, 0x90E2, 0x0000, 0x0000, 0x8CA6, 0x0000, 0x0000, 0x0000, 0xE357, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE354, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE356, + 0x0000, 0x0000, 0x0000, 0xE353, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C70, 0x91B1, 0xE358, 0x918E, 0x0000, 0x0000, 0xE365, 0x0000, 0x0000, + 0xE361, 0xE35B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE35F, 0x8EF8, 0x88DB, 0xE35A, 0xE362, 0xE366, 0x8D6A, 0x96D4, 0x0000, + 0x92D4, 0xE35C, 0x0000, 0x0000, 0xE364, 0x0000, 0xE359, 0x925D, 0x0000, + 0xE35E, 0x88BB, 0x96C8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE35D, 0x0000, 0x0000, 0x8BD9, 0x94EA, 0x0000, 0x0000, 0x0000, + 0x918D, 0x0000, 0x97CE, 0x8F8F, 0x0000, 0x0000, 0xE38E, 0x0000, 0x0000, + 0xE367, 0x0000, 0x90FC, 0x0000, 0xE363, 0xE368, 0xE36A, 0x0000, 0x92F7, + 0xE36D, 0x0000, 0x0000, 0xE369, 0x0000, 0x0000, 0x0000, 0x95D2, 0x8AC9, + 0x0000, 0x0000, 0x96C9, 0x0000, 0x0000, 0x88DC, 0x0000, 0x0000, 0xE36C, + 0x0000, 0x97FB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE36B, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs7E[256] = { + 0x0000, 0x898F, 0x0000, 0x0000, 0x93EA, 0xE36E, 0x0000, 0x0000, 0x0000, + 0xE375, 0xE36F, 0xE376, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE372, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x949B, 0x0000, 0x0000, 0x8EC8, 0xE374, 0x0000, 0xE371, 0xE377, 0xE370, + 0x0000, 0x0000, 0x8F63, 0x0000, 0x0000, 0x0000, 0x0000, 0x9644, 0x0000, + 0x0000, 0x8F6B, 0x0000, 0x0000, 0xE373, 0xE380, 0x0000, 0x0000, 0xE37B, + 0x0000, 0xE37E, 0x0000, 0xE37C, 0xE381, 0xE37A, 0x0000, 0xE360, 0x90D1, + 0x0000, 0x0000, 0x94C9, 0x0000, 0xE37D, 0x0000, 0x0000, 0xE378, 0x0000, + 0x0000, 0x0000, 0x9140, 0x8C71, 0x0000, 0x8F4A, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9044, 0x9155, 0xE384, 0x0000, 0x0000, 0xE386, + 0xE387, 0x0000, 0x0000, 0xE383, 0xE385, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE379, 0xE382, 0x0000, 0xE38A, 0xE389, 0x0000, + 0x0000, 0x969A, 0x0000, 0x0000, 0x8C4A, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE388, 0x0000, 0xE38C, 0xE38B, 0xE38F, + 0x0000, 0xE391, 0x0000, 0x0000, 0x8E5B, 0xE38D, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE392, 0xE393, 0x0000, 0x0000, 0xE394, 0x0000, 0xE39A, 0x935A, + 0xE396, 0x0000, 0xE395, 0xE397, 0xE398, 0x0000, 0xE399, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE39B, 0xE39C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs7F[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8ACA, 0x0000, 0xE39D, 0x0000, 0xE39E, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE39F, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE3A0, 0xE3A1, 0xE3A2, 0x0000, 0xE3A3, + 0xE3A4, 0x0000, 0x0000, 0xE3A6, 0xE3A5, 0x0000, 0x0000, 0xE3A7, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3A8, 0xE3A9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE3AC, 0xE3AA, 0xE3AB, 0x8DDF, 0x8C72, + 0x0000, 0x0000, 0x9275, 0x0000, 0x94B1, 0x0000, 0x8F90, 0x0000, 0x0000, + 0x946C, 0x0000, 0x94EB, 0xE3AD, 0x9CEB, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE3AE, 0xE3B0, 0x0000, 0x9785, 0xE3AF, + 0xE3B2, 0xE3B1, 0x0000, 0x9772, 0x0000, 0xE3B3, 0x0000, 0x94FC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE3B4, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE3B7, 0x0000, 0x0000, 0xE3B6, 0xE3B5, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE3B8, 0x8C51, 0x0000, 0x0000, 0x0000, 0x9141, 0x8B60, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE3BC, 0xE3B9, 0x0000, 0x0000, 0xE3BA, 0x0000, + 0x0000, 0x0000, 0xE3BD, 0x0000, 0xE3BE, 0xE3BB, 0x0000, 0x0000, 0x0000, + 0x8948, 0x0000, 0x0000, 0x0000, 0x89A5, 0x0000, 0x0000, 0x0000, 0xE3C0, + 0xE3C1, 0x0000, 0x0000, 0x0000, 0xE3C2, 0x0000, 0x9782, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8F4B, 0x0000, 0xE3C4, 0xE3C3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9089, + 0xE3C5, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3C6, 0x0000, 0x0000, 0xE3C7, + 0x0000, 0x8AE3, 0x0000, 0x0000, 0x0000, 0x0000, 0x8ACB, 0x0000, 0x0000, + 0xE3C8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3C9, 0x0000, 0x967C, + 0x9783, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs80[256] = { + 0x9773, 0x9856, 0x0000, 0x8D6C, 0xE3CC, 0x8ED2, 0xE3CB, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE3CD, 0x8EA7, 0x0000, 0x0000, 0x0000, 0x91CF, 0x0000, + 0xE3CE, 0x0000, 0x0000, 0x8D6B, 0x0000, 0x96D5, 0xE3CF, 0xE3D0, 0x0000, + 0x0000, 0xE3D1, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3D2, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE3D3, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EA8, 0x0000, 0x0000, + 0x96EB, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3D5, 0x0000, 0x925E, 0x0000, + 0xE3D4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3D7, 0x0000, + 0x0000, 0x0000, 0xE3D6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE3D8, 0x0000, 0x0000, 0x0000, 0x90B9, 0x0000, 0xE3D9, 0x0000, + 0xE3DA, 0x0000, 0x0000, 0x0000, 0x95B7, 0xE3DB, 0x0000, 0x918F, 0xE3DC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3DD, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x97FC, 0xE3E0, 0x0000, 0xE3DF, 0xE3DE, 0x92AE, + 0x0000, 0xE3E1, 0x9045, 0x0000, 0xE3E2, 0x0000, 0x0000, 0x0000, 0xE3E3, + 0x9857, 0xE3E4, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3E5, 0xE3E7, 0xE3E6, + 0x94A3, 0x0000, 0x93F7, 0x0000, 0x985D, 0x94A7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE3E9, 0x0000, 0x0000, 0x8FD1, 0x0000, 0x9549, + 0x0000, 0xE3EA, 0xE3E8, 0x0000, 0x8ACC, 0x0000, 0x0000, 0x0000, 0x8CD2, + 0x8E88, 0x0000, 0x0000, 0x94EC, 0x0000, 0x0000, 0x0000, 0x8CA8, 0x9662, + 0x0000, 0xE3ED, 0xE3EB, 0x0000, 0x8D6D, 0x0000, 0x8D6E, 0x88E7, 0x0000, + 0x8DE6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9478, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x88DD, 0xE3F2, 0x0000, + 0x925F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9477, 0x0000, 0x91D9, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3F4, 0x0000, + 0x0000, 0xE3F0, 0xE3F3, 0xE3EE, 0x0000, 0xE3F1, 0x9645, 0x0000, 0x0000, + 0x8CD3, 0x0000, 0x0000, 0x88FB, 0xE3EF, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3F6, 0x0000, 0xE3F7, 0x0000, + 0x0000, 0x93B7, 0x0000, 0x0000, 0x0000, 0x8BB9, 0x0000, 0x0000, 0x0000, + 0xE445, 0x945C, 0x0000, 0x0000}; + +static wchar_t Ucs81[256] = { + 0x0000, 0x0000, 0x8E89, 0x0000, 0x0000, 0x8BBA, 0x90C6, 0x9865, 0x96AC, + 0xE3F5, 0x90D2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B72, + 0xE3F8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3FA, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE3F9, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE3FB, 0x0000, 0x9245, 0x0000, 0x945D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x92AF, 0x0000, 0x0000, 0x0000, 0x0000, 0xE442, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE441, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE3FC, 0x0000, 0x0000, 0x9074, 0x0000, 0x9585, + 0xE444, 0x0000, 0xE443, 0x8D6F, 0x9872, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE454, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE448, 0xE449, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EEE, + 0x0000, 0x0000, 0xE447, 0x0000, 0x8D98, 0xE446, 0x0000, 0x0000, 0xE44A, + 0x0000, 0x0000, 0x0000, 0x92B0, 0x95A0, 0x9142, 0x0000, 0x0000, 0x0000, + 0x0000, 0x91DA, 0xE44E, 0x0000, 0xE44F, 0xE44B, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE44C, 0x0000, 0xE44D, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D70, + 0x0000, 0x0000, 0x0000, 0xE455, 0x0000, 0xE451, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9586, 0x0000, 0x968C, 0x9547, 0x0000, 0x0000, 0xE450, 0x0000, + 0x0000, 0xE453, 0xE452, 0x0000, 0x0000, 0x0000, 0x9663, 0xE456, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE457, 0x0000, 0x0000, 0x9156, + 0x0000, 0xE458, 0x0000, 0x0000, 0xE45A, 0x0000, 0xE45E, 0x0000, 0x0000, + 0xE45B, 0xE459, 0x945E, 0xE45C, 0x0000, 0xE45D, 0x0000, 0x0000, 0x0000, + 0x89B0, 0x0000, 0xE464, 0xE45F, 0x0000, 0x0000, 0x0000, 0xE460, 0x0000, + 0x0000, 0x0000, 0xE461, 0x0000, 0x919F, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE463, 0xE462, 0xE465, 0x0000, 0x0000, 0x0000, 0x0000, 0xE466, 0xE467, + 0x0000, 0x0000, 0x9062, 0x0000, 0x89E7, 0x0000, 0xE468, 0x97D5, 0x0000, + 0x8EA9, 0x0000, 0x0000, 0x8F4C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8E8A, 0x9276, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE469, 0xE46A, + 0x8950, 0x0000, 0xE46B, 0x0000}; + +static wchar_t Ucs82[256] = { + 0x0000, 0xE46C, 0xE46D, 0x0000, 0x0000, 0xE46E, 0x0000, 0xE46F, 0x8BBB, + 0x9DA8, 0xE470, 0x0000, 0x90E3, 0xE471, 0x8EC9, 0x0000, 0xE472, 0x0000, + 0x98AE, 0x0000, 0x0000, 0x0000, 0xE473, 0x95DC, 0x8ADA, 0x0000, 0x0000, + 0x9143, 0x8F77, 0x0000, 0x9591, 0x8F4D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE474, 0x8D71, 0xE475, 0x94CA, + 0x0000, 0xE484, 0x0000, 0x0000, 0x0000, 0x0000, 0xE477, 0x0000, 0x91C7, + 0x9495, 0x8CBD, 0xE476, 0x9144, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE478, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x92F8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE47A, 0xE479, + 0xE47C, 0x0000, 0x0000, 0xE47B, 0x0000, 0xE47D, 0x0000, 0x0000, 0xE480, + 0x0000, 0xE47E, 0x0000, 0x8ACD, 0x0000, 0xE481, 0x0000, 0xE482, 0xE483, + 0x0000, 0x0000, 0x8DAF, 0x97C7, 0x0000, 0xE485, 0x9046, 0x0000, 0x0000, + 0x0000, 0x8990, 0xE486, 0xE487, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE488, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x88F0, 0x0000, 0xE489, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE48A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9587, 0x0000, 0x0000, 0x0000, 0x8EC5, 0x0000, 0xE48C, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8A48, 0x88B0, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE48B, 0xE48E, 0x946D, 0x0000, 0x9063, 0x0000, 0x89D4, 0x0000, 0x9646, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8C7C, 0x8BDA, 0x0000, 0xE48D, 0x0000, + 0x89E8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8AA1, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8991, 0xE492, 0x97E8, 0x91DB, 0x0000, 0x0000, 0x9563, + 0x0000, 0xE49E, 0x0000, 0x89D5, 0xE49C, 0x0000, 0xE49A, 0xE491, 0x0000, + 0xE48F, 0x0000, 0xE490, 0x0000, 0x8EE1, 0x8BEA, 0x9297, 0x0000, 0x0000, + 0x0000, 0x93CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8970, 0x0000, + 0xE494, 0xE493, 0x0000, 0x0000, 0x0000, 0x0000, 0xE499, 0xE495, 0xE498, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs83[256] = { + 0x0000, 0x0000, 0x96CE, 0xE497, 0x89D6, 0x8A9D, 0xE49B, 0x0000, 0x0000, + 0xE49D, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C73, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE4A1, 0xE4AA, 0xE4AB, 0x0000, 0x0000, + 0x0000, 0x88A9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4B2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x88EF, 0x0000, 0x0000, 0xE4A9, 0x0000, + 0x0000, 0x0000, 0xE4A8, 0x0000, 0xE4A3, 0xE4A2, 0x0000, 0xE4A0, 0xE49F, + 0x9283, 0x0000, 0x91F9, 0xE4A5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE4A4, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4A7, 0x0000, 0x0000, + 0x0000, 0x9190, 0x8C74, 0x0000, 0x0000, 0x0000, 0x0000, 0x8960, 0xE4A6, + 0x0000, 0x8D72, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9191, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4B8, 0x0000, + 0xE4B9, 0x0000, 0x89D7, 0x0000, 0x0000, 0x0000, 0x89AC, 0xE4B6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4AC, 0x0000, + 0xE4B4, 0x0000, 0xE4BB, 0xE4B5, 0x0000, 0x0000, 0x0000, 0xE4B3, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE496, 0x0000, 0x0000, 0xE4B1, 0x0000, 0x0000, + 0x0000, 0xE4AD, 0x0000, 0x0000, 0x0000, 0x8ACE, 0xE4AF, 0xE4BA, 0x0000, + 0xE4B0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4BC, 0x0000, 0xE4AE, + 0x949C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9789, 0x0000, 0x0000, + 0x0000, 0xE4B7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE4CD, 0x0000, 0x0000, 0x0000, 0xE4C5, 0x0000, 0x0000, 0x0000, 0x909B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8B65, 0x0000, 0x8BDB, 0x0000, 0xE4C0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x89D9, 0x0000, 0x0000, 0x8FD2, 0x0000, + 0xE4C3, 0x0000, 0x0000, 0x0000, 0x8DD8, 0x0000, 0x0000, 0x9370, 0xE4C8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95EC, + 0x0000, 0xE4BF, 0x0000, 0x0000, 0x0000, 0x89D8, 0x8CD4, 0x9548, 0xE4C9, + 0x0000, 0xE4BD, 0x0000, 0x0000, 0xE4C6, 0x0000, 0x0000, 0x0000, 0xE4D0, + 0x0000, 0xE4C1, 0x0000, 0x0000}; + +static wchar_t Ucs84[256] = { + 0x0000, 0x0000, 0x0000, 0xE4C2, 0x93B8, 0x0000, 0x0000, 0xE4C7, 0x0000, + 0x0000, 0x0000, 0xE4C4, 0x9647, 0xE4CA, 0x88DE, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE4BE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4CC, 0x0000, 0xE4CB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x948B, 0xE4D2, 0x0000, 0xE4DD, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8A9E, 0x0000, 0x0000, 0x0000, 0xE4E0, + 0x0000, 0x0000, 0xE4CE, 0x0000, 0x0000, 0x0000, 0xE4D3, 0x978E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4DC, 0x0000, + 0x0000, 0x9774, 0x0000, 0x0000, 0x0000, 0x0000, 0x97A8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9298, 0x0000, 0x0000, + 0x0000, 0x8A8B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9592, 0xE4E2, + 0x939F, 0x0000, 0x0000, 0x88AF, 0x0000, 0x0000, 0xE4DB, 0x0000, 0xE4D7, + 0x9192, 0xE4D1, 0xE4D9, 0xE4DE, 0x0000, 0x944B, 0x0000, 0x0000, 0x0000, + 0x88A8, 0x0000, 0xE4D6, 0x0000, 0xE4DF, 0x9598, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE4DA, 0x0000, 0xE4D5, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8FD3, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8F4E, 0x0000, 0x0000, 0x0000, 0x8EAA, 0x0000, 0x0000, 0x0000, 0x0000, + 0x96D6, 0x0000, 0x0000, 0x9566, 0x0000, 0x0000, 0xE4E5, 0x0000, 0xE4EE, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE4D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x8A97, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8FF6, 0xE4E3, 0x0000, 0xE4E8, 0x9193, + 0x0000, 0x0000, 0xE4E4, 0x0000, 0xE4EB, 0x0000, 0x0000, 0x927E, 0x0000, + 0xE4EC, 0x0000, 0x0000, 0x9775, 0xE4E1, 0x8A57, 0x0000, 0xE4E7, 0x0000, + 0x0000, 0xE4EA, 0x96AA, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4ED, 0x0000, + 0x0000, 0xE4E6, 0xE4E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9648, 0x0000, 0x9840, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE4F1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE4F8, 0x0000, 0x0000, 0xE4F0}; + +static wchar_t Ucs85[256] = { + 0x8EC1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4CF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95CC, + 0x0000, 0x96A0, 0xE4F7, 0xE4F6, 0x0000, 0xE4F2, 0xE4F3, 0x0000, 0x8955, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE4F5, 0x0000, 0xE4EF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x92D3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE4F4, + 0x88FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91A0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x95C1, 0x0000, + 0x0000, 0xE4F9, 0xE540, 0x0000, 0x94D7, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE4FC, 0x8FD4, 0x8EC7, 0xE542, 0x0000, 0x0000, 0x8BBC, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE543, 0x0000, 0x9599, 0xE4FB, 0x0000, + 0xE4D4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE4FA, 0x0000, 0x0000, 0x0000, 0x0000, 0x986E, 0x93A0, 0x9593, 0x0000, + 0x0000, 0xE54A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE550, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE551, 0x0000, 0xE544, 0x0000, 0x0000, 0x0000, 0x9496, 0x0000, 0x0000, + 0xE54E, 0xE546, 0x0000, 0xE548, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE552, 0xE547, 0x0000, 0x0000, 0xE54B, 0x0000, 0x0000, 0x8992, 0x0000, + 0x93E3, 0x0000, 0xE54C, 0xE54F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE545, 0x0000, 0x9145, 0x0000, 0xE549, 0x8E46, 0x9064, + 0x8C4F, 0x96F2, 0x0000, 0x96F7, 0x8F92, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE556, 0xE554, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x986D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE553, 0x0000, 0x0000, 0x0000, 0x9795, 0x0000, + 0xE555, 0xE557, 0x0000, 0x0000, 0x0000, 0x0000, 0xE558, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE55B, 0xE559, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x93A1, 0xE55A, 0x0000, 0x0000, 0x0000, 0x94CB, + 0xE54D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8F93, 0x0000, 0xE55C, 0xE561, 0x9194, + 0x0000, 0x0000, 0xE560, 0x0000}; + +static wchar_t Ucs86[256] = { + 0x0000, 0x0000, 0xE541, 0x0000, 0x0000, 0x0000, 0xE562, 0x9168, 0x0000, + 0x0000, 0xE55D, 0xE55F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE55E, 0x0000, 0x0000, 0x9F50, 0x9F41, 0x0000, 0x0000, 0xE564, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE563, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9796, 0x0000, 0xE1BA, 0xE565, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE566, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE567, 0x8CD5, 0x0000, 0x8B73, + 0x0000, 0x0000, 0x0000, 0xE569, 0x997C, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8B95, 0x0000, 0x97B8, 0x0000, 0x8BF1, 0xE56A, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE56B, 0x0000, 0x0000, 0x0000, 0x928E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE56C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x93F8, 0x0000, 0x88B8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x89E1, 0xE571, 0xE572, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE56D, 0x0000, 0x8E5C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE56E, 0x9461, 0x0000, 0x0000, 0x0000, 0x0000, 0xE56F, 0xE570, + 0xE57A, 0x0000, 0x0000, 0x0000, 0xE574, 0xE577, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE573, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE575, 0x0000, + 0xE576, 0x8ED6, 0x0000, 0xE578, 0x0000, 0x9260, 0x0000, 0x8C75, 0x8A61, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE57B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8A5E, 0x0000, 0xE581, 0x0000, 0x0000, 0xE57C, 0xE580, 0x0000, + 0x0000, 0x0000, 0x0000, 0x94B8, 0x0000, 0x0000, 0x0000, 0x0000, 0xE57D, + 0x0000, 0x0000, 0xE57E, 0x9567, 0x94D8, 0xE582, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91FB, 0xE58C, 0x0000, 0xE588, + 0x0000, 0x0000, 0x89E9, 0x0000}; + +static wchar_t Ucs87[256] = { + 0xE586, 0x0000, 0x9649, 0xE587, 0x0000, 0x0000, 0xE584, 0x0000, 0xE585, + 0xE58A, 0xE58D, 0x0000, 0x0000, 0xE58B, 0x0000, 0x0000, 0x0000, 0xE589, + 0xE583, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9277, 0x0000, 0xE594, + 0x0000, 0x96A8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE592, 0x0000, 0x0000, 0x0000, 0xE593, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE58E, 0x0000, + 0x0000, 0xE590, 0x0000, 0x0000, 0x0000, 0xE591, 0x0000, 0x0000, 0x0000, + 0xE58F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x90E4, 0x0000, 0x9858, 0xE598, 0x0000, 0xE599, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE59F, 0x0000, 0x9049, 0x0000, 0xE59B, 0x0000, 0xE59E, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE596, 0xE595, 0x0000, 0x0000, + 0xE5A0, 0x0000, 0x0000, 0x89DA, 0x0000, 0xE59C, 0x0000, 0xE5A1, 0x0000, + 0x0000, 0x0000, 0xE59D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE59A, + 0x0000, 0x92B1, 0x0000, 0xE597, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9488, 0x0000, 0x0000, 0xE5A5, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x975A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5A4, 0x0000, 0x0000, + 0xE5A3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE5AC, 0x0000, 0x0000, 0x0000, 0xE5A6, 0x0000, 0x0000, 0x0000, 0xE5AE, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9786, 0xE5B1, 0x0000, + 0xE5A8, 0x0000, 0x0000, 0xE5A9, 0x0000, 0x0000, 0x0000, 0xE5AD, 0x0000, + 0xE5B0, 0xE5AF, 0x0000, 0x0000, 0x0000, 0xE5A7, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE5AA, 0x0000, 0xE5BB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5B4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5B2, 0x0000, 0x0000, 0xE5B3, + 0x0000, 0x0000, 0x0000, 0xE5B8, 0xE5B9, 0x0000, 0x8A49, 0x0000, 0x8B61, + 0x0000, 0x0000, 0xE5B7, 0x0000}; + +static wchar_t Ucs88[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5A2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE5B6, 0xE5BA, 0xE5B5, 0x0000, 0xE5BC, + 0x0000, 0x0000, 0x0000, 0xE5BE, 0xE5BD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5C0, 0xE5BF, 0xE579, + 0x0000, 0x0000, 0x0000, 0xE5C4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE5C1, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE5C2, 0x0000, 0x0000, 0xE5C3, 0x0000, 0xE5C5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8C8C, 0x0000, 0xE5C7, 0x0000, 0xE5C6, 0x0000, 0x8F4F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8D73, 0x9FA5, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE5C8, 0x8F70, 0x0000, 0x0000, 0x0000, 0x8A58, 0x0000, 0xE5C9, + 0x0000, 0x8971, 0x0000, 0x8FD5, 0xE5CA, 0x0000, 0x0000, 0x8D74, 0xE5CB, + 0x88DF, 0x0000, 0x0000, 0x0000, 0x0000, 0x955C, 0x0000, 0x0000, 0xE5CC, + 0x0000, 0x0000, 0x0000, 0x0000, 0x908A, 0x0000, 0xE5D3, 0x0000, 0x0000, + 0xE5D0, 0x0000, 0x928F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5D1, + 0xE5CE, 0x8BDC, 0x0000, 0xE5CD, 0xE5D4, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8C55, 0x0000, 0x0000, 0x91DC, 0x0000, 0xE5DA, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE5D6, 0x0000, 0x0000, 0x0000, 0x91B3, 0xE5D5, 0x0000, + 0xE5D8, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5CF, 0x0000, 0x0000, 0x0000, + 0xE5D9, 0x0000, 0xE5DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x94ED, 0x0000, 0x0000, 0xE5D7, 0x0000, 0xE5DC, 0xE5DE, 0x0000, 0x0000, + 0x8CD1, 0xE5D2, 0x0000, 0x88BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE5DD, 0x0000, 0x8DD9, 0x97F4, 0xE5DF, 0xE5E0, 0x9195, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x97A0, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5E1, 0x9754, 0x0000, 0x0000, + 0xE5E2, 0xE5E3, 0x0000, 0x0000, 0x95E2, 0xE5E4, 0x0000, 0x8DBE, 0x0000, + 0x97A1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5E9, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5EA, + 0x8FD6, 0xE5E8, 0x0000, 0x0000, 0x0000, 0x9787, 0xE5E5, 0x0000, 0x0000, + 0xE5E7, 0x90BB, 0x909E, 0x0000}; + +static wchar_t Ucs89[256] = { + 0x0000, 0x0000, 0xE5E6, 0x0000, 0xE5EB, 0x0000, 0x0000, 0x95A1, 0x0000, + 0x0000, 0xE5ED, 0x0000, 0xE5EC, 0x0000, 0x0000, 0x0000, 0x8A8C, 0x0000, + 0x964A, 0xE5EE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE5FA, 0xE5F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE5F1, 0x0000, 0x0000, 0x0000, 0x0000, 0xE5F2, 0xE5F3, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE5F7, 0x0000, 0xE5F8, 0x0000, 0x0000, 0xE5F6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE5F4, 0x0000, 0xE5EF, 0xE5F5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE5F9, 0xE8B5, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x89A6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE5FC, 0x8BDD, 0xE5FB, 0x0000, 0x0000, + 0x0000, 0xE641, 0x0000, 0xE640, 0x0000, 0x0000, 0x0000, 0xE643, 0x0000, + 0x0000, 0xE642, 0x0000, 0xE644, 0x0000, 0x0000, 0x8F50, 0x0000, 0xE645, + 0x0000, 0x0000, 0xE646, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE647, 0x90BC, 0x0000, 0x9776, 0x0000, 0xE648, 0x0000, 0x0000, 0x95A2, + 0x9465, 0xE649, 0x0000, 0xE64A, 0x8CA9, 0x0000, 0x0000, 0x0000, 0x8B4B, + 0x0000, 0x0000, 0x0000, 0xE64B, 0x0000, 0x0000, 0x8E8B, 0x9460, 0xE64C, + 0x0000, 0x8A6F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE64D, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE64F, 0x9797, 0x0000, 0xE64E, 0x9065, + 0x0000, 0xE650, 0x0000, 0x0000, 0xE651, 0x0000, 0x0000, 0xE652, 0x8ACF, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE653, 0x0000, 0x0000, + 0xE654, 0x0000, 0xE655, 0xE656, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8A70, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE657, 0x0000, 0xE658, 0xE659, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x89F0, 0x0000, 0x0000, 0x9047, 0xE65A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE65B, 0x0000, 0x0000, 0x0000, 0xE65C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs8A[256] = { + 0x8CBE, 0x0000, 0x92F9, 0xE65D, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C76, + 0x0000, 0x9075, 0x0000, 0xE660, 0x0000, 0x93A2, 0x0000, 0xE65F, 0x0000, + 0x0000, 0x8C50, 0x0000, 0x0000, 0xE65E, 0x91F5, 0x8B4C, 0x0000, 0x0000, + 0xE661, 0x0000, 0xE662, 0x0000, 0x8FD7, 0x0000, 0x0000, 0x0000, 0x8C8D, + 0x0000, 0xE663, 0x0000, 0x0000, 0x0000, 0x0000, 0x964B, 0x0000, 0x0000, + 0x90DD, 0x0000, 0x0000, 0x0000, 0x8B96, 0x0000, 0x96F3, 0x9169, 0x0000, + 0xE664, 0x0000, 0x0000, 0x0000, 0x9066, 0x9290, 0x8FD8, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE665, 0x0000, 0x0000, 0x0000, 0x0000, 0xE668, 0x0000, + 0xE669, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8DBC, + 0x91C0, 0xE667, 0x0000, 0x8FD9, 0x955D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE666, 0x0000, 0x0000, 0x8E8C, 0x0000, 0x8972, 0x0000, 0xE66D, + 0x8C77, 0x0000, 0x0000, 0x8E8E, 0x0000, 0x0000, 0x8E8D, 0x0000, 0x986C, + 0xE66C, 0xE66B, 0x9146, 0x0000, 0x8B6C, 0x9862, 0x8A59, 0x8FDA, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE66A, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE66F, 0x0000, 0xE670, 0xE66E, 0x0000, + 0x8CD6, 0x0000, 0x975F, 0x0000, 0x0000, 0x8E8F, 0x9446, 0x0000, 0x0000, + 0x0000, 0xE673, 0x0000, 0x90BE, 0x0000, 0x9261, 0x0000, 0x0000, 0x9755, + 0x0000, 0xE676, 0x0000, 0x0000, 0x0000, 0x8CEA, 0x0000, 0x90BD, 0xE672, + 0x0000, 0xE677, 0x8CEB, 0xE674, 0xE675, 0x0000, 0xE671, 0x0000, 0x0000, + 0x0000, 0x90E0, 0x93C7, 0x0000, 0x0000, 0x924E, 0x0000, 0x89DB, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x94EE, 0x0000, 0x0000, 0x8B62, + 0x0000, 0x0000, 0x92B2, 0x0000, 0x0000, 0xE67A, 0x0000, 0xE678, 0x0000, + 0x0000, 0x926B, 0x0000, 0x0000, 0x0000, 0x90BF, 0x8AD0, 0xE679, 0x0000, + 0x907A, 0x0000, 0x0000, 0x97C8, 0x0000, 0x0000, 0x0000, 0x985F, 0x0000, + 0x0000, 0x0000, 0xE67B, 0xE687, 0x92B3, 0x0000, 0xE686, 0x0000, 0xE683, + 0xE68B, 0xE684, 0x0000, 0xE680, 0x0000, 0x92FA, 0xE67E, 0x0000, 0x0000, + 0x0000, 0xE67C, 0x0000, 0x9740, 0x8E90, 0x0000, 0x0000, 0xE681, 0x0000, + 0xE67D, 0x0000, 0x0000, 0x0000, 0xE685, 0x8F94, 0x0000, 0x8CBF, 0x0000, + 0x0000, 0x0000, 0x91F8, 0x0000}; + +static wchar_t Ucs8B[256] = { + 0x9664, 0x8979, 0x88E0, 0x0000, 0x93A3, 0x0000, 0x0000, 0xE689, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE688, 0x0000, 0x93E4, 0x0000, 0xE68D, 0x0000, + 0x0000, 0x0000, 0xE682, 0x0000, 0xE68C, 0xE68E, 0x0000, 0x8CAA, 0xE68A, + 0x8D75, 0x0000, 0x8ED3, 0x0000, 0x0000, 0xE68F, 0x9777, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE692, 0x0000, 0xE695, 0x0000, 0x0000, 0xE693, 0x9554, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE690, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8BDE, 0x0000, 0x0000, 0x0000, 0x0000, 0xE694, + 0x0000, 0x0000, 0xE696, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE69A, 0x0000, 0x0000, 0xE697, 0x0000, 0xE699, 0xE698, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE69B, 0x0000, 0x8EAF, 0x0000, + 0xE69D, 0xE69C, 0x9588, 0x0000, 0x0000, 0xE69F, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8C78, 0x0000, 0x0000, 0x0000, 0x0000, 0xE69E, + 0xE6A0, 0x0000, 0x0000, 0xE6A1, 0x8B63, 0xE3BF, 0x8FF7, 0x0000, 0xE6A2, + 0x0000, 0x0000, 0x8CEC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6A3, + 0x0000, 0x0000, 0xE6A4, 0x0000, 0x0000, 0x8E5D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9DCC, 0x0000, 0xE6A5, 0x0000, 0xE6A6, 0x0000, + 0x8F51, 0x0000, 0xE6A7, 0xE6A8, 0x0000, 0x0000, 0xE6A9, 0x0000, 0x0000, + 0xE6AA, 0xE6AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs8C[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x924A, 0x0000, 0x0000, 0xE6AC, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE6AE, 0x0000, 0xE6AD, 0x0000, 0x0000, 0x0000, 0x0000, 0x93A4, 0x0000, + 0xE6AF, 0x0000, 0x964C, 0x0000, 0xE6B0, 0x0000, 0xE6B1, 0x0000, 0xE6B2, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE6B3, 0x0000, 0x0000, 0x0000, 0x0000, + 0x93D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FDB, 0xE6B4, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D8B, 0x98AC, + 0xE6B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE6B6, 0x955E, 0xE6B7, 0x0000, 0xE6BF, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE6B8, 0x0000, 0x0000, 0xE6BA, 0x0000, + 0x0000, 0x0000, 0xE6B9, 0xE6BB, 0x0000, 0x9665, 0xE6BC, 0xE6BD, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE6BE, 0x0000, 0x0000, 0x0000, 0xE6C0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8A4C, 0x92E5, 0x0000, 0x9589, 0x8DE0, + 0x8D76, 0x0000, 0x0000, 0x0000, 0x0000, 0x956E, 0x89DD, 0x94CC, 0xE6C3, + 0x8AD1, 0x90D3, 0xE6C2, 0xE6C7, 0x9299, 0x96E1, 0x0000, 0xE6C5, 0xE6C6, + 0x8B4D, 0x0000, 0xE6C8, 0x9483, 0x91DD, 0x0000, 0x0000, 0x94EF, 0x935C, + 0xE6C4, 0x0000, 0x9666, 0x89EA, 0xE6CA, 0x9847, 0x92C0, 0x9864, 0x0000, + 0x0000, 0x8E91, 0xE6C9, 0x0000, 0x91AF, 0x0000, 0x0000, 0xE6DA, 0x9147, + 0x0000, 0x0000, 0x93F6, 0x0000, 0x956F, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE6CD, 0x8E5E, 0x8E92, 0x0000, 0x8FDC, 0x0000, 0x9485, + 0x0000, 0x8CAB, 0xE6CC, 0xE6CB, 0x0000, 0x958A, 0x0000, 0x0000, 0x0000, + 0x8EBF, 0x0000, 0x0000, 0x9371, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6CF, 0xE6D0, + 0x8D77, 0xE6CE, 0x0000, 0x0000}; + +static wchar_t Ucs8D[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0xE6D1, 0xE6D2, 0x0000, 0xE6D4, 0x91A1, + 0x0000, 0xE6D3, 0x8AE4, 0x0000, 0xE6D6, 0x0000, 0xE6D5, 0xE6D7, 0x0000, + 0x0000, 0xE6D9, 0xE6DB, 0x0000, 0xE6DC, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x90D4, 0x0000, 0x8ECD, 0xE6DD, 0x0000, 0x0000, 0x0000, 0x8A71, + 0x0000, 0xE6DE, 0x0000, 0x0000, 0x9196, 0xE6DF, 0x0000, 0xE6E0, 0x958B, + 0x0000, 0x0000, 0x8B4E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE6E1, 0x0000, 0x0000, 0x0000, 0x92B4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x897A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE6E2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8EEF, 0x0000, 0x0000, 0x0000, 0x0000, 0x9096, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x91AB, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6E5, 0x0000, 0x0000, + 0x0000, 0xE6E4, 0x0000, 0x0000, 0x0000, 0xE6E3, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6EB, 0xE6E9, 0x0000, 0x0000, + 0xE6E6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6E8, 0x0000, + 0x0000, 0x0000, 0xE6E7, 0xE6EA, 0x0000, 0x8B97, 0x0000, 0xE6EE, 0x0000, + 0x90D5, 0x0000, 0xE6EF, 0x0000, 0x0000, 0x0000, 0x0000, 0x8CD7, 0x0000, + 0xE6EC, 0xE6ED, 0x0000, 0x0000, 0x0000, 0x9848, 0x0000, 0x0000, 0x0000, + 0x92B5, 0x0000, 0x9148, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE6F0, 0x0000, 0x0000, 0xE6F3}; + +static wchar_t Ucs8E[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE6F1, + 0xE6F2, 0x9778, 0x0000, 0x0000, 0x0000, 0x0000, 0x93A5, 0xE6F6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE6F4, 0xE6F5, 0xE6F7, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE748, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE6FA, 0x0000, 0x0000, 0x0000, 0xE6FB, 0xE6F9, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE6F8, 0x0000, 0x92FB, 0x0000, 0x0000, 0xE740, + 0xE744, 0xE741, 0xE6FC, 0x0000, 0xE742, 0x0000, 0x0000, 0x0000, 0xE743, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE74A, 0x0000, 0x0000, 0x0000, 0xE745, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x90D6, 0xE747, 0x0000, 0x0000, + 0xE749, 0xE746, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE74C, 0x0000, 0x8F52, + 0x0000, 0xE74B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE74D, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE74E, 0x0000, 0x0000, 0xE751, 0xE750, 0x0000, + 0xE74F, 0x0000, 0x0000, 0xE753, 0xE752, 0x0000, 0x96F4, 0x0000, 0x0000, + 0x0000, 0xE755, 0x0000, 0xE754, 0xE756, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE757, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE759, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE758, + 0x9067, 0xE75A, 0x0000, 0x0000, 0x8BEB, 0xE75B, 0xE75D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE75E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE75F, + 0xE75C, 0x0000, 0xE760, 0x0000, 0x8ED4, 0xE761, 0x8B4F, 0x8C52, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8CAC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE762, 0x0000, 0x0000, 0x0000, 0x93EE, 0x0000, + 0x0000, 0x935D, 0xE763, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE766, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EB2, 0x0000, 0x0000, 0xE765, + 0xE764, 0x8C79, 0xE767, 0x0000}; + +static wchar_t Ucs8F[256] = { + 0x0000, 0x0000, 0x0000, 0x8A72, 0x0000, 0xE769, 0x0000, 0x0000, 0x0000, + 0x8DDA, 0xE768, 0x0000, 0xE771, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE76B, 0xE76D, 0x95E3, 0xE76A, 0x0000, 0x0000, 0x0000, 0xE76C, 0x0000, + 0xE770, 0xE76E, 0x8B50, 0x0000, 0xE76F, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE772, 0x0000, 0x0000, 0x9479, 0x97D6, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8F53, 0x0000, 0x0000, 0x0000, 0xE773, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9741, 0xE775, 0x0000, 0xE774, 0x0000, 0x0000, 0xE778, + 0x9760, 0x0000, 0x0000, 0xE777, 0x0000, 0x8A8D, 0xE776, 0xE77B, 0x0000, + 0x0000, 0xE77A, 0x0000, 0x0000, 0xE779, 0x9351, 0xE77C, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE77D, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE77E, 0x0000, 0x0000, 0x8D8C, 0x0000, 0x8C44, 0xE780, + 0xE781, 0xE782, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9068, 0xE783, 0x0000, 0x8EAB, 0xE784, 0x0000, 0x0000, + 0x0000, 0xE785, 0x0000, 0x0000, 0x0000, 0x999F, 0x999E, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE786, 0xE390, 0xE787, 0x9243, 0x904A, 0x945F, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE788, 0x0000, 0x0000, 0x95D3, 0x92D2, 0x8D9E, + 0x0000, 0x0000, 0x9248, 0x0000, 0x0000, 0x8949, 0x0000, 0x9698, 0x9076, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C7D, + 0x0000, 0x0000, 0x8BDF, 0x0000, 0x0000, 0x95D4, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE789, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE78B, 0x0000, 0x0000, 0xE78A, 0x89DE, 0x0000, 0x0000, 0x93F4, + 0xE78C, 0x9497, 0x0000, 0x9352, 0x0000, 0xE78D, 0x8F71, 0x0000, 0x0000, + 0x0000, 0xE78F, 0x0000, 0x0000, 0x96C0, 0xE79E, 0xE791, 0xE792, 0x0000, + 0x0000, 0x92C7, 0x0000, 0x0000}; + +static wchar_t Ucs90[256] = { + 0x91DE, 0x9197, 0x0000, 0x93A6, 0x0000, 0xE790, 0x8B74, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE799, 0x0000, 0xE796, 0xE7A3, 0x93A7, 0x9280, 0xE793, + 0x0000, 0x92FC, 0x9372, 0xE794, 0xE798, 0x9080, 0x0000, 0x9487, 0x92CA, + 0x0000, 0x0000, 0x90C0, 0xE797, 0x91AC, 0x91A2, 0xE795, 0x88A7, 0x9841, + 0x0000, 0x0000, 0x0000, 0xE79A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x91DF, 0x0000, 0x0000, 0x8F54, 0x9069, 0x0000, 0x0000, 0xE79C, + 0xE79B, 0x0000, 0x88ED, 0xE79D, 0x0000, 0x0000, 0x954E, 0x0000, 0xE7A5, + 0x0000, 0x0000, 0x93D9, 0x908B, 0x0000, 0x0000, 0x9278, 0x0000, 0x8BF6, + 0x0000, 0xE7A4, 0x9756, 0x895E, 0x0000, 0x95D5, 0x89DF, 0xE79F, 0xE7A0, + 0xE7A1, 0xE7A2, 0x93B9, 0x9242, 0x88E1, 0xE7A6, 0x0000, 0xE7A7, 0xEAA1, + 0x0000, 0x0000, 0x91BB, 0x0000, 0xE7A8, 0x0000, 0x8993, 0x916B, 0x0000, + 0x8CAD, 0x0000, 0x9779, 0x0000, 0x0000, 0xE7A9, 0x934B, 0x0000, 0x0000, + 0x0000, 0x9198, 0x8ED5, 0xE7AA, 0x0000, 0x0000, 0xE7AD, 0x0000, 0x0000, + 0x8F85, 0xE7AB, 0x914A, 0x9149, 0x0000, 0x88E2, 0x0000, 0x97C9, 0xE7AF, + 0x0000, 0x94F0, 0xE7B1, 0xE7B0, 0xE7AE, 0xE284, 0x8AD2, 0x0000, 0x0000, + 0xE78E, 0x0000, 0xE7B3, 0xE7B2, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7B4, + 0x0000, 0x9757, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x93DF, 0x0000, 0x0000, 0x964D, 0x0000, 0xE7B5, 0x0000, 0x8ED7, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE7B6, 0x0000, 0xE7B7, 0x0000, 0x0000, + 0x0000, 0xE7B8, 0x0000, 0x0000, 0x9340, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x88E8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8D78, 0x0000, 0x0000, 0x0000, 0x9859, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE7BC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C53, 0xE7B9, 0x0000, 0xE7BA, 0x0000, 0x0000, 0x0000, 0x9594, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8A73, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9758, 0x0000, 0x8BBD, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9373, 0x0000, 0x0000}; + +static wchar_t Ucs91[256] = { + 0x0000, 0x0000, 0xE7BD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7BE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7BF, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9341, 0x0000, 0x0000, 0xE7C1, 0x0000, 0xE7C0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x93D1, 0xE7C2, 0x8F55, 0x8EDE, 0x947A, 0x9291, 0x0000, 0x0000, + 0x0000, 0x8EF0, 0x0000, 0x908C, 0x0000, 0xE7C3, 0x0000, 0xE7C4, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x907C, + 0xE7C5, 0x0000, 0xE7C6, 0x0000, 0x0000, 0x0000, 0xE7C7, 0x978F, 0x0000, + 0x8F56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7C9, 0xE7C8, 0x0000, + 0x8D79, 0x0000, 0x8D93, 0x8E5F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE7CC, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8F86, 0x0000, 0xE7CB, 0x0000, 0xE7CA, 0x0000, 0x91E7, 0x0000, 0x0000, + 0x8CED, 0x0000, 0x90C1, 0x0000, 0x0000, 0x0000, 0x0000, 0x94AE, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8F58, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7CD, 0x0000, 0x8FDD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7D0, + 0xE7CE, 0x0000, 0x0000, 0x0000, 0xE7CF, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7D2, 0xE7D1, 0x0000, 0x0000, 0x8FF8, 0x0000, 0xE7D3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE7D4, 0xE7D5, 0x0000, 0x0000, 0x0000, 0x0000, + 0x94CE, 0x8DD1, 0x8EDF, 0xE7D6, 0x0000, 0xE7D7, 0x97A2, 0x8F64, 0x96EC, + 0x97CA, 0xE7D8, 0x8BE0, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7D9, 0x0000, + 0x9342, 0x0000, 0x0000, 0xE7DC, 0x8A98, 0x906A, 0x0000, 0xE7DA, 0x0000, + 0xE7DB, 0x0000, 0x92DE, 0x0000, 0x0000, 0x9674, 0x8BFA, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE7DE, 0xE7DF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7DD, 0x0000, 0x0000, 0xE7E1}; + +static wchar_t Ucs92[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x93DD, 0x8A62, 0x0000, 0x0000, 0xE7E5, + 0x0000, 0x0000, 0xE7E2, 0xE7E4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE7E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE86E, 0x0000, 0x0000, 0xE7E3, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x97E9, 0x0000, + 0x0000, 0x8CD8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7ED, 0x0000, 0x0000, 0x0000, 0x0000, 0x9353, 0xE7E8, 0x0000, 0x0000, + 0xE7EB, 0xE7E9, 0x0000, 0xE7EE, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7EF, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7E7, 0x0000, 0x0000, + 0xE7F4, 0x8994, 0x0000, 0x0000, 0xE7E6, 0x0000, 0x0000, 0x0000, 0x94AB, + 0x0000, 0xE7EA, 0x0000, 0x8FDE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D7A, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9667, 0x0000, 0x8BE2, 0x0000, 0x0000, 0x8F65, 0x0000, 0x93BA, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x914C, 0x0000, 0xE7F2, 0x0000, 0xE7EC, 0xE7F1, 0x0000, 0x96C1, + 0x0000, 0x92B6, 0xE7F3, 0xE7F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x914B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE7F7, 0x0000, 0xE7F6, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE7F5, 0x0000, 0x0000, 0x964E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8F9B, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7F8, + 0x95DD, 0x0000, 0x0000, 0x8973, 0x0000, 0x0000, 0x0000, 0x0000, 0x9565, + 0x9292, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B98, 0x0000, 0xE7FA, 0x0000, + 0x8D7C, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs93[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E4B, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7F9, 0x908D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x908E, 0xE840, 0xE842, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FF9, 0x0000, 0xE841, 0xE843, + 0x0000, 0x0000, 0x8BD1, 0x0000, 0x9564, 0x0000, 0x0000, 0x8EE0, 0x9842, + 0x0000, 0xE7FC, 0x8DF6, 0x0000, 0x0000, 0x985E, 0x0000, 0x0000, 0xE845, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE844, 0xE846, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE7FB, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x93E7, 0x0000, 0x9374, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x92D5, 0x0000, 0xE84B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9262, 0xE847, 0x0000, 0x0000, 0x0000, 0xE848, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8C4C, 0x0000, 0xE84A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8CAE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE849, 0x0000, + 0x8FDF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8A99, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE84F, 0x0000, 0x8DBD, 0x9199, 0x0000, + 0x0000, 0x92C8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8A5A, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE84D, 0xE84E, 0x92C1, 0x0000, 0xE84C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE850, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE856, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE859, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE858, 0x934C, 0x0000, 0x0000, 0x0000, 0x0000, 0xE851, 0xE852, + 0xE855, 0x0000, 0x0000, 0x0000, 0x0000, 0xE857, 0x0000, 0x0000, 0x0000, + 0x8BBE, 0x0000, 0x0000, 0xE85A, 0xE854, 0x0000, 0x0000, 0xE853, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs94[256] = { + 0x0000, 0x0000, 0x0000, 0xE85E, 0x0000, 0x0000, 0x0000, 0xE85F, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE860, 0x0000, + 0x0000, 0xE85D, 0xE85C, 0x0000, 0x0000, 0x0000, 0x8FE0, 0x93A8, 0xE85B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE864, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE862, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE863, + 0xE861, 0x0000, 0x91F6, 0x0000, 0xE865, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE866, 0x0000, 0x0000, 0xE868, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8AD3, 0xE867, 0x96F8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE873, 0xE869, 0x0000, 0x0000, 0xE86C, 0x0000, 0xE86A, 0x0000, 0xE86B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE86D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE86F, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE870, 0x0000, 0xE871, 0x0000, 0x0000, 0x0000, 0x0000, 0xE874, 0xE872, + 0xE875, 0xE877, 0x0000, 0xE876, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs95[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x92B7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x96E5, 0x0000, 0xE878, 0x914D, 0x0000, 0x0000, 0x0000, + 0xE879, 0x0000, 0x95C2, 0xE87A, 0x8A4A, 0x0000, 0x0000, 0x0000, 0x895B, + 0x0000, 0x8AD5, 0x0000, 0x8AD4, 0xE87B, 0x0000, 0xE87C, 0x0000, 0xE87D, + 0xE87E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE880, 0x0000, + 0x8AD6, 0x8A74, 0x8D7D, 0x94B4, 0x0000, 0xE882, 0xE881, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE883, 0x0000, 0x0000, 0x0000, 0x0000, 0x897B, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE886, 0x0000, 0xE885, 0xE884, + 0x0000, 0xE887, 0x0000, 0x0000, 0x0000, 0x0000, 0xE88A, 0x0000, 0x0000, + 0x0000, 0x88C5, 0x0000, 0x0000, 0xE888, 0x0000, 0xE88C, 0xE88B, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE88E, 0xE88D, 0xE88F, 0x0000, + 0x93AC, 0x0000, 0x0000, 0x0000, 0xE890, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE891, 0xE893, 0x0000, 0x0000, 0xE892, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs96[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x958C, 0x0000, 0x0000, 0x0000, 0x0000, 0xE894, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE895, 0x0000, 0x8DE3, 0x0000, 0x0000, + 0x0000, 0xE896, 0xE897, 0x0000, 0x0000, 0x9668, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x916A, 0x0000, 0x0000, 0x0000, + 0x88A2, 0x91C9, 0x0000, 0xE898, 0x0000, 0x958D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE89B, 0xE899, 0x8D7E, 0x0000, 0xE89A, 0x8CC0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x95C3, 0xE89D, 0xE89F, 0xE89E, 0xE8A0, 0x0000, 0x0000, 0x8940, + 0x9077, 0x8F9C, 0x8AD7, 0xE8A1, 0x0000, 0x0000, 0x0000, 0x9486, 0x0000, + 0xE8A3, 0x0000, 0x0000, 0x0000, 0x8941, 0x0000, 0xE8A2, 0x92C2, 0x0000, + 0x97CB, 0x93A9, 0xE89C, 0x97A4, 0x0000, 0x8CAF, 0x0000, 0x0000, 0x977A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8BF7, 0x97B2, + 0x0000, 0x8C47, 0x0000, 0x91E0, 0xE440, 0x0000, 0xE8A4, 0x8A4B, 0x908F, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8A75, 0xE8A6, 0x0000, 0xE8A7, 0xE8A5, + 0x8C84, 0x0000, 0x8DDB, 0x8FE1, 0x0000, 0x0000, 0x0000, 0x8942, 0x0000, + 0x0000, 0x97D7, 0x0000, 0x0000, 0x0000, 0xE8A9, 0xE7AC, 0x0000, 0xE8A8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE8AC, 0xE8AA, 0xE8AB, 0x0000, + 0xE8AD, 0x0000, 0xE8AE, 0x97EA, 0xE8AF, 0xE8B0, 0x0000, 0x90C7, 0x94B9, + 0x0000, 0x0000, 0x0000, 0x909D, 0x8AE5, 0x0000, 0x0000, 0x9759, 0x89EB, + 0x8F57, 0x8CD9, 0x0000, 0xE8B3, 0x0000, 0xE8B2, 0x8E93, 0xE8B4, 0xE8B1, + 0x0000, 0x0000, 0x8E47, 0x0000, 0x0000, 0x0000, 0xE8B8, 0xE5AB, 0x0000, + 0x0000, 0x99D4, 0x0000, 0x9097, 0xE8B6, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x97A3, 0x93EF, 0x0000, 0x0000, 0x0000, 0x0000, 0x894A, 0x0000, + 0x90E1, 0x8EB4, 0x0000, 0x0000, 0x0000, 0x0000, 0x95B5, 0x0000, 0x895F, + 0x0000, 0x0000, 0x0000, 0x97EB, 0x978B, 0x0000, 0xE8B9, 0x0000, 0x9364, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs97[256] = { + 0x8EF9, 0x0000, 0x0000, 0x0000, 0xE8BA, 0x0000, 0xE8BB, 0x906B, 0xE8BC, + 0x0000, 0x97EC, 0x0000, 0x0000, 0xE8B7, 0xE8BE, 0xE8C0, 0x0000, 0xE8BF, + 0x0000, 0xE8BD, 0x0000, 0x0000, 0xE8C1, 0x0000, 0x0000, 0xE8C2, 0x0000, + 0x0000, 0x919A, 0x0000, 0x89E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE8C3, 0x0000, 0x0000, 0x96B6, 0x0000, 0x0000, 0xE8C4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE8C5, 0x0000, 0x9849, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x9E50, 0xE8C6, 0x0000, 0x0000, 0x0000, 0xE8C7, 0xE8C8, + 0x0000, 0x0000, 0x0000, 0xE8CC, 0x0000, 0xE8C9, 0x0000, 0xE8CA, 0x0000, + 0xE8CB, 0xE8CD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x90C2, 0x0000, 0x0000, 0x0000, 0x96F5, 0x0000, 0x0000, 0x90C3, + 0x0000, 0x0000, 0xE8CE, 0x0000, 0x94F1, 0x0000, 0xE8CF, 0xEA72, 0x96CA, + 0x0000, 0xE8D0, 0x0000, 0xE8D1, 0x0000, 0xE8D2, 0x8A76, 0x0000, 0xE8D4, + 0x0000, 0x9078, 0x0000, 0x0000, 0x0000, 0xE8D5, 0x0000, 0x0000, 0x8C43, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE8D6, 0xE8DA, 0x0000, 0xE8D8, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE8D9, 0x0000, 0x0000, 0x8A93, 0xE8D7, 0xE8DB, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE8DC, 0x0000, 0x88C6, 0x0000, 0xE8DD, + 0xE8DE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8FE2, + 0x0000, 0x0000, 0x0000, 0xE8DF, 0x0000, 0x0000, 0x0000, 0x8B66, 0x0000, + 0x0000, 0xE8E2, 0x0000, 0x0000, 0xE8E1, 0x0000, 0xE8E0, 0x0000, 0x0000, + 0xE691, 0x0000, 0x95DA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE8E3, + 0xE8E4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE8E5, 0x0000, 0x0000, + 0xE8E6, 0x0000, 0xE8E7, 0x0000, 0x0000, 0xE8E8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8AD8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE8E9, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE8EA, 0x9442, 0x0000, 0x0000, 0x0000, 0xE8EC, + 0x89B9, 0x0000, 0xE8EF, 0xE8EE, 0x0000, 0x0000, 0x0000, 0x0000, 0x8943, + 0x0000, 0x0000, 0x0000, 0x8BBF}; + +static wchar_t Ucs98[256] = { + 0x0000, 0x95C5, 0x92B8, 0x8DA0, 0x0000, 0x8D80, 0x8F87, 0x0000, 0x907B, + 0x0000, 0x0000, 0x0000, 0xE8F1, 0x0000, 0x0000, 0xE8F0, 0x9761, 0x8AE6, + 0x94D0, 0x93DA, 0x0000, 0x0000, 0x0000, 0x909C, 0x97CC, 0x0000, 0x8C7A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE8F4, 0x0000, 0x0000, + 0xE8F3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x966A, + 0x93AA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x896F, 0x0000, + 0x0000, 0xE8F5, 0xE8F2, 0x0000, 0x0000, 0x9570, 0x978A, 0xE8F6, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE8F7, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE8F9, 0x91E8, 0x8A7A, 0x8A7B, 0xE8F8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8AE7, 0x8CB0, 0x0000, 0x0000, 0x8AE8, 0x0000, + 0x0000, 0x935E, 0x0000, 0x0000, 0x97DE, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8CDA, 0x0000, 0x0000, 0x0000, 0xE8FA, + 0x0000, 0x0000, 0x0000, 0xE8FB, 0xE8FC, 0xE940, 0x0000, 0xE942, 0xE941, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9597, 0x0000, 0xE943, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE944, 0x0000, 0xE945, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE946, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE948, 0xE947, 0x0000, + 0xE949, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x94F2, 0xE3CA, 0x0000, 0x0000, 0x9048, 0x0000, + 0x0000, 0x8B51, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE94A, + 0x0000, 0xE94B, 0x0000, 0x99AA, 0x9F5A, 0x94D1, 0x0000, 0x0000, 0x88F9, + 0x0000, 0x88B9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8E94, 0x964F, 0x8FFC, 0x0000}; + +static wchar_t Ucs99[256] = { + 0x0000, 0x0000, 0x0000, 0xE94C, 0x0000, 0x96DD, 0x0000, 0x0000, 0x0000, + 0xE94D, 0x977B, 0x0000, 0x8961, 0x0000, 0x0000, 0x0000, 0x8E60, 0x0000, + 0xE94E, 0x89EC, 0xE94F, 0x0000, 0x0000, 0x0000, 0xE950, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE952, 0xE953, 0x0000, 0xE955, 0xE951, 0x0000, 0x0000, + 0xE954, 0x0000, 0x0000, 0x0000, 0x8AD9, 0x0000, 0x0000, 0x0000, 0xE956, + 0x0000, 0xE957, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE958, 0xE959, + 0x0000, 0x0000, 0x0000, 0xE95A, 0x0000, 0x0000, 0xE95C, 0x0000, 0x0000, + 0x0000, 0xE95B, 0x0000, 0xE95E, 0xE961, 0x0000, 0x0000, 0x0000, 0xE95D, + 0xE95F, 0xE960, 0x0000, 0x0000, 0xE962, 0x0000, 0x8BC0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8EF1, 0xE963, 0xE964, + 0x8D81, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE965, 0x0000, 0x0000, 0x8A5D, 0x0000, 0x0000, + 0x0000, 0x946E, 0xE966, 0xE967, 0x0000, 0x0000, 0x0000, 0x0000, 0x9279, + 0x93E9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE968, + 0x0000, 0x0000, 0x0000, 0x0000, 0x949D, 0x0000, 0x0000, 0x91CA, 0x8977, + 0x8BEC, 0x0000, 0x8BED, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9293, 0xE96D, 0x8BEE, 0x0000, 0x0000, 0x89ED, 0x0000, 0x0000, + 0xE96C, 0x0000, 0x0000, 0xE96A, 0x0000, 0xE96B, 0x0000, 0xE969, 0x0000, + 0x0000, 0xE977, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE96E, 0xE96F, 0x0000, 0x0000, 0xE970, 0xE971, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE973, 0x0000, 0x0000, 0xE972, + 0x0000, 0x0000, 0x0000, 0x8F78}; + +static wchar_t Ucs9A[256] = { + 0x0000, 0xE974, 0x0000, 0x0000, 0x0000, 0xE976, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B52, 0xE975, 0x0000, 0x0000, + 0x919B, 0x8CB1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE978, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x91CB, 0x0000, 0x0000, 0xE979, 0x0000, + 0x0000, 0x0000, 0x0000, 0x93AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE97A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE980, + 0x0000, 0xE97D, 0x0000, 0xE97C, 0xE97E, 0x0000, 0xE97B, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE982, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE981, 0x0000, 0xE984, 0x0000, 0x0000, + 0x8BC1, 0xE983, 0x0000, 0x0000, 0x0000, 0xE985, 0x0000, 0x0000, 0xE986, + 0x0000, 0xE988, 0xE987, 0x0000, 0x0000, 0x0000, 0xE989, 0xE98B, 0xE98A, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D9C, 0x0000, 0x0000, + 0x0000, 0x0000, 0xE98C, 0x0000, 0x0000, 0xE98D, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8A5B, 0x0000, 0x0000, 0x0000, 0xE98E, + 0x0000, 0x0000, 0x0000, 0xE98F, 0x0000, 0x0000, 0x0000, 0x9091, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE990, 0x0000, 0xE991, 0x0000, 0xE992, 0xE993, 0x0000, 0x0000, 0x0000, + 0x8D82, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE994, 0xE995, 0x0000, + 0x0000, 0xE996, 0xE997, 0x0000, 0x0000, 0xE998, 0x0000, 0x0000, 0x0000, + 0x94AF, 0xE99A, 0x0000, 0x9545, 0xE99B, 0xE999, 0x0000, 0xE99D, 0x0000, + 0x0000, 0xE99C, 0x0000, 0x0000, 0xE99E, 0x0000, 0x0000, 0x0000, 0xE99F, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs9B[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9A0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9A1, 0x0000, 0xE9A2, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE9A3, 0x0000, 0x0000, 0xE9A4, 0xE9A5, + 0x0000, 0xE9A6, 0x0000, 0xE9A7, 0xE9A8, 0xE9A9, 0xE9AA, 0x0000, 0x0000, + 0x0000, 0xE9AB, 0xE9AC, 0x0000, 0x9F54, 0xE9AD, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE2F6, 0x8B53, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8A40, 0x8DB0, 0xE9AF, 0xE9AE, 0x96A3, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9B1, 0xE9B2, 0xE9B0, 0x0000, + 0xE9B3, 0x0000, 0x0000, 0x9682, 0x0000, 0x0000, 0x0000, 0xE9B4, 0x0000, + 0x8B9B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x9844, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9B5, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9B7, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x88BC, 0x0000, + 0x0000, 0xE9B8, 0x95A9, 0xE9B6, 0x0000, 0x0000, 0xE9B9, 0xE9BA, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9BB, 0xE9BC, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9BD, 0x0000, 0x968E, + 0x8E4C, 0x0000, 0x8DF8, 0x914E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE9BE, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9C1, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xE9BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE9C2, 0x0000, 0x0000, 0x8CEF, 0xE9C0, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE9C3, 0x0000, 0xE9C4, 0xE9C5, 0x0000, 0xE9C9, 0x0000, 0x8E49, 0x0000, + 0x0000, 0x0000, 0x0000, 0x91E2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE9CA, 0xE9C7, 0xE9C6, 0xE9C8, 0x0000, 0x0000, 0x0000, 0x8C7E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9CE, 0xE9CD, 0xE9CC, + 0x0000, 0x0000, 0x88B1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs9C[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0xE9D8, 0x0000, 0xE9D4, 0x0000, 0xE9D5, + 0xE9D1, 0xE9D7, 0x0000, 0xE9D3, 0x8A82, 0x0000, 0x0000, 0x986B, 0x0000, + 0xE9D6, 0xE9D2, 0xE9D0, 0xE9CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xE9DA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9DD, 0x0000, 0x0000, + 0xE9DC, 0xE9DB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9568, 0xE9D9, 0x88F1, 0xE9DE, 0x0000, 0xE9E0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x8A8F, 0xE9CB, 0x8956, 0x0000, 0x0000, 0xE9E2, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9E1, 0xE9DF, + 0x924C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x9690, 0x0000, 0x0000, 0x0000, 0x0000, 0x97D8, 0x0000, 0x0000, + 0xE9E3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE9E4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xE9E5, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xE9E6, 0x0000, 0xE9E7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x92B9, 0x0000, 0xE9E8, 0x0000, 0x94B5, + 0x0000, 0xE9ED, 0xE9E9, 0x0000, 0x0000, 0x0000, 0xE9EA, 0x0000, 0x0000, + 0x9650, 0x96C2, 0x0000, 0x93CE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t Ucs9D[256] = { + 0x0000, 0x0000, 0x0000, 0xE9EE, 0x0000, 0x0000, 0xE9EF, 0x93BC, 0xE9EC, + 0xE9EB, 0x0000, 0x0000, 0x0000, 0x0000, 0x89A8, 0x0000, 0x0000, 0x0000, + 0xE9F7, 0x0000, 0x0000, 0xE9F6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x8995, 0x0000, 0x0000, 0x0000, 0xE9F4, 0x0000, 0x0000, 0x0000, 0xE9F3, + 0x0000, 0x0000, 0xE9F1, 0x0000, 0x8A9B, 0x0000, 0xE9F0, 0x8EB0, 0x89A7, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8D83, 0x0000, 0x0000, 0xE9FA, + 0xE9F9, 0x0000, 0xE9F8, 0x0000, 0x0000, 0xE9F5, 0x0000, 0xE9FB, 0x0000, + 0xE9FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA44, + 0xEA43, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA45, + 0x0000, 0x0000, 0x894C, 0xEA40, 0xEA41, 0x0000, 0x8D94, 0x96B7, 0x0000, + 0x0000, 0xEA42, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9651, 0x0000, 0x0000, 0xEA4A, 0x0000, 0x0000, 0xEA46, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA4B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xEA48, 0x0000, 0xEA47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8C7B, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xEA4C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xEA4D, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA4E, 0x0000, + 0xEA49, 0x0000, 0x0000, 0x0000, 0xE9F2, 0x0000, 0x0000, 0xEA4F, 0x0000, + 0x92DF, 0x0000, 0x0000, 0x0000, 0xEA53, 0x0000, 0xEA54, 0xEA52, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xEA51, 0xEA57, 0x0000, 0xEA50, 0x0000, + 0xEA55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xEA56, 0x0000, 0x0000, 0x0000, 0xEA59, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xEA58, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA5B, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xEA5C, 0x0000, 0xEA5D, 0x0000, 0x0000, 0x9868, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA5A, 0x91E9, 0x8DEB, 0x0000, + 0x0000, 0xEA5E, 0x0000, 0x0000}; + +static wchar_t Ucs9E[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA5F, + 0xEA60, 0x0000, 0x0000, 0xEA61, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xEA62, 0x0000, 0x0000, 0x8CB2, 0xEA63, 0x0000, 0x0000, 0x0000, 0xEA64, + 0x0000, 0x8EAD, 0x0000, 0xEA65, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xEA66, 0x0000, 0x0000, 0xEA67, 0xEA68, 0x0000, 0x0000, 0x0000, + 0x0000, 0xEA6B, 0xEA69, 0x985B, 0x0000, 0xEA6A, 0x0000, 0x97ED, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xEA6C, 0x0000, 0x97D9, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xEA6D, 0x949E, 0x0000, 0x0000, 0xEA6E, 0xEA70, + 0x0000, 0x0000, 0xEA71, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xEA6F, 0x8D8D, 0x96CB, 0x9683, 0x9BF5, + 0x0000, 0x9F80, 0x969B, 0x0000, 0x0000, 0x0000, 0x0000, 0x89A9, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA73, 0x8B6F, 0xEA74, + 0xEA75, 0xEA76, 0x0000, 0x8D95, 0x0000, 0xEA77, 0x0000, 0x0000, 0x0000, + 0xE0D2, 0x96D9, 0x0000, 0x91E1, 0xEA78, 0xEA7A, 0xEA79, 0x0000, 0xEA7B, + 0x0000, 0x0000, 0x0000, 0x0000, 0xEA7C, 0x0000, 0x0000, 0xEA7D, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA7E, 0x0000, 0x0000, 0x0000, + 0x0000, 0xEA80, 0x0000, 0xEA81, 0xEA82, 0x0000, 0xEA83, 0x0000, 0xEA84, + 0xEA85, 0xEA86, 0x0000, 0x0000}; + +static wchar_t Ucs9F[256] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA87, 0xEA88, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9343, 0x0000, 0x0000, 0x0000, + 0x0000, 0x8CDB, 0x0000, 0xEA8A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x916C, 0xEA8B, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA8C, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9540, 0x0000, 0x0000, 0xEA8D, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xEA8E, 0xE256, 0x0000, 0x0000, 0xE6D8, 0xE8EB, 0x0000, + 0x0000, 0xEA8F, 0x0000, 0xEA90, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA92, 0xEA93, 0xEA94, 0x97EE, + 0xEA91, 0x0000, 0x0000, 0xEA95, 0xEA96, 0x0000, 0x0000, 0xEA98, 0x0000, + 0xEA97, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA9A, 0x0000, 0x0000, + 0x0000, 0xEA9B, 0xEA99, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x97B4, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA9C, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xEA9D, 0xE273, 0x0000, 0x0000, 0xEA9E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t UcsFF[256] = { + 0x0000, 0x8149, 0x0000, 0x8194, 0x8190, 0x8193, 0x8195, 0x0000, 0x8169, + 0x816A, 0x8196, 0x817B, 0x8143, 0x0000, 0x8144, 0x815E, 0x824F, 0x8250, + 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, 0x8257, 0x8258, 0x8146, + 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, 0x8197, 0x8260, 0x8261, 0x8262, + 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826A, 0x826B, + 0x826C, 0x826D, 0x826E, 0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, + 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x816D, 0x0000, 0x816E, 0x814F, + 0x8151, 0x814D, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287, + 0x8288, 0x8289, 0x828A, 0x828B, 0x828C, 0x828D, 0x828E, 0x828F, 0x8290, + 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, + 0x829A, 0x816F, 0x8162, 0x8170, 0x0000, 0x0000, 0x0000, 0x00A1, 0x00A2, + 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, + 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, + 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, + 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, + 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, + 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x8150, 0x0000, 0x818F, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; + +static wchar_t* UcsSjisTable[256] = { + Ucs00, NULL, NULL, Ucs03, Ucs04, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Ucs20, + Ucs21, Ucs22, Ucs23, NULL, Ucs25, Ucs26, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, Ucs30, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, Ucs4E, Ucs4F, Ucs50, Ucs51, Ucs52, Ucs53, Ucs54, Ucs55, Ucs56, Ucs57, + Ucs58, Ucs59, Ucs5A, Ucs5B, Ucs5C, Ucs5D, Ucs5E, Ucs5F, Ucs60, Ucs61, Ucs62, + Ucs63, Ucs64, Ucs65, Ucs66, Ucs67, Ucs68, Ucs69, Ucs6A, Ucs6B, Ucs6C, Ucs6D, + Ucs6E, Ucs6F, Ucs70, Ucs71, Ucs72, Ucs73, Ucs74, Ucs75, Ucs76, Ucs77, Ucs78, + Ucs79, Ucs7A, Ucs7B, Ucs7C, Ucs7D, Ucs7E, Ucs7F, Ucs80, Ucs81, Ucs82, Ucs83, + Ucs84, Ucs85, Ucs86, Ucs87, Ucs88, Ucs89, Ucs8A, Ucs8B, Ucs8C, Ucs8D, Ucs8E, + Ucs8F, Ucs90, Ucs91, Ucs92, Ucs93, Ucs94, Ucs95, Ucs96, Ucs97, Ucs98, Ucs99, + Ucs9A, Ucs9B, Ucs9C, Ucs9D, Ucs9E, Ucs9F, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, UcsFF}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__ppc_eabi_init.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__ppc_eabi_init.c new file mode 100644 index 0000000000..aeb6f7b334 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__ppc_eabi_init.c @@ -0,0 +1,89 @@ +#include +#include + +#pragma section ".ctors$00" +DECL_SECTION(".ctors$00") extern funcptr_t _ctors[]; +#pragma section ".dtors$00" +DECL_SECTION(".dtors$00") extern funcptr_t _dtors[]; + +asm void __init_hardware(void) { + // clang-format off + nofralloc + + // Enable floating-point + mfmsr r0 + ori r0, r0, MSR_FP + mtmsr r0 + + // Backup LR + mflr r31 + + bl __OSPSInit + bl __OSFPRInit + bl __OSCacheInit + + // Restore LR + mtlr r31 + blr + // clang-format on +} + +asm void __flush_cache(register void* dst, register size_t n) { + // clang-format off + nofralloc + + lis r5, 0xFFFFFFF1@h + ori r5, r5, 0xFFFFFFF1@l + and r5, r5, dst + + subf r3, r5, r3 + add n, n, r3 + +_loop: + dcbst 0, r5 + sync + icbi 0, r5 + addic r5, r5, 8 + subic. n, n, 8 + bge _loop + + isync + blr + // clang-format on +} + +asm void __init_user(void) { + // clang-format off + fralloc + + bl __init_cpp + + frfree + blr + // clang-format on +} + +void __init_cpp(void) { + funcptr_t* ctor; + + for (ctor = _ctors; *ctor != NULL; ctor++) { + (*ctor)(); + } +} + +void __fini_cpp(void) { + funcptr_t* dtor; + + for (dtor = _dtors; *dtor != NULL; dtor++) { + (*dtor)(); + } +} + +void exit(void) { + __fini_cpp(); + _ExitProcess(); +} + +void _ExitProcess(void) { + PPCHalt(); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__start.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__start.c new file mode 100644 index 0000000000..6ade851629 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/OS/__start.c @@ -0,0 +1,374 @@ +#include +#include +#include +#include +#include + +int main(int argc, char** argv); + +static u8 Debug_BBA; + +DECL_SECTION(".init") static void __init_registers(void); +DECL_SECTION(".init") static void __init_data(void); + +DECL_SECTION(".init") static void __check_pad3(void) { + if ((OS_GC_PAD_3_BTN & 0x0EEF) == 0x0EEF) { + OSResetSystem(0, 0, 0); + } +} + +DECL_SECTION(".init") static void __set_debug_bba(void) { + Debug_BBA = TRUE; +} + +DECL_SECTION(".init") static BOOL __get_debug_bba(void) { + return Debug_BBA; +} + +void __start(void); +DECL_SECTION(".init") DECL_WEAK asm void __start(void) { + // clang-format off + nofralloc + + // Setup hardware + bl __init_registers + bl __init_hardware + + // Create first stack frame + li r0, -1 + // Parameter save + stwu r1, -8(r1) + // LR save (-1 to signify first frame) + stw r0, 4(r1) + // Back chain (-1 to signify first frame) + stw r0, 0(r1) + + // Setup ROM/BSS + bl __init_data + + // Clear debugger exception mask + li r0, 0 + lis r6, (OS_DEBUG_INTERFACE + OSDebugInterface.exceptionMask)@ha + addi r6, r6, (OS_DEBUG_INTERFACE + OSDebugInterface.exceptionMask)@l + stw r0, 0(r6) + + /** + * Check the BI2 debug flag to determine how to call InitMetroTRK. + * + * This can be done by either checking the value from the DVD + * (OSBI2.debugFlag), or by checking the global OS_BI2_DEBUG_FLAG. + * + * If the DVD BI2 is available, it is prioritized over the global value. + */ + lis r6, OS_DVD_BI2@ha + addi r6, r6, OS_DVD_BI2@l + lwz r6, 0(r6) + cmplwi r6, 0 + beq _no_dvd_bi2 // <- NULL BI2, try the OS global + + // Use the DVD's flag + lwz r7, OSBI2.debugFlag(r6) + b _handle_bi2_debug_flag + + /** + * At this point, we do one last check to decide whether we want to + * setup the TRK debugger. + * + * If the OS boot info specifies an arena hi, we grab the BI2 debug + * flag using the global OS_BI2_DEBUG_FLAG. + * + * (This must be some heuristic, but I don't understand it) + */ +_no_dvd_bi2: + lis r5, (OS_BOOT_INFO + OSBootInfo.arenaHi)@ha + addi r5, r5, (OS_BOOT_INFO + OSBootInfo.arenaHi)@l + lwz r5, 0(r5) + cmplwi r5, 0 + beq _check_for_exec_args // <- NULL arena hi, don't setup the debugger + + // Grab the global BI2 debug flag + lis r7, OS_BI2_DEBUG_FLAG@ha + addi r7, r7, OS_BI2_DEBUG_FLAG@l + lwz r7, 0(r7) + + /** + * The BI2 debug flag/level decides how to set up TRK. + * + * Most importantly, it decides how InitMetroTRKCommTable is called, by + * specifying a type of hardware. + * + * ID 1: NDEV hardware + * ID 2: BBA hardware + * Anything else: "Unknown" to TRK, defaults to GDEV hardware + * + * BI2 debug level maps to TRK comm hardware ID as follows: + * - BI2 Level 2 -> ID 0 (GDEV) + * - BI2 Level 3 -> ID 1 (NDEV) + * - BI2 Level 4 -> ID 2 (BBA) + */ +_handle_bi2_debug_flag: + // BI2 Debug Level 3: Init TRK as GDEV hardware + li r5, 0 + cmplwi r7, 2 + beq _call_init_metro_trk + + // BI2 Debug Level 2: Init TRK as NDEV hardware + cmplwi r7, 3 + li r5, 1 + beq _call_init_metro_trk + + // BI2 Debug Level 4: Init TRK as BBA hardware + // *Any other debug level is ignored* + cmplwi r7, 4 + bne _check_for_exec_args // <- Ignore debug level, goto next step + /** + * I think at one point this used to call InitMetroTRK as they set + * r5 here; however, in this version it goes unused. + * + * What currently happens is __set_debug_bba sets Debug_BBA, which + * will result in a call to InitMetroTRK_BBA after the OS is + * initialized. + * + * Maybe this is a leftover from how things worked before + * InitMetroTRK_BBA was written? + */ + li r5, 2 + bl __set_debug_bba + b _check_for_exec_args + + /** + * Call InitMetroTRK + * The MetroTRK hardware ID is specified in r5 + */ +_call_init_metro_trk: + lis r6, InitMetroTRK@ha + addi r6, r6, InitMetroTRK@l + mtlr r6 + blrl + + /** + * After setting up the hardware and the debugger, we next setup + * the program arguments. This label checks whether any arguments + * exist. + * + * BI2 contains an offset from itself to the argument data, which + * is formatted as follows: + * + * typedef struct BI2Args { + * int argc; + * union { + * char* argument; + * u32 offset; + * } argv[]; + * } BI2Args; + */ +_check_for_exec_args: + lis r6, OS_DVD_BI2@ha + addi r6, r6, OS_DVD_BI2@l + lwz r5, 0(r6) + cmplwi r5, 0 + beq+ _no_args // <- No BI2 to get args from + + lwz r6, OSBI2.argumentOfs(r5) + cmplwi r6, 0 + beq+ _no_args // <- Invalid argument offset in BI2 + + // Calculate pointer to argument data + add r6, r5, r6 + // First integer value is the argument count + lwz r14, 0(r6) + cmplwi r14, 0 + beq _no_args // <- Argument count is zero + + // BI2 args + 0x8, used to adjust MEM1 later + addi r15, r6, 4 + // Move argc to the counter to prepare the loop + mtctr r14 + + /** + * This loop unpacks the arguments by converting them from offsets + * to pointers, in-place. + * + * The offsets are relative to the start of the BI2, so we just + * add the offset to the BI2 pointer and write it back. + */ +_unpack_args_loop: + // Skip over argc + addi r6, r6, 4 + // Load argument offset + lwz r7, 0(r6) + // Convert offset to pointer + add r7, r7, r5 + // Store pointer + stw r7, 0(r6) + bdnz _unpack_args_loop + + /** + * Both the MEM1 arena hi and the MEM1 limit are adjusted to + * preserve the BI2 args. + * + * They are set to eight bytes into the BI2 arguments, + * rounded down to the nearest 32 bytes. + */ + lis r5, (OS_BOOT_INFO + OSBootInfo.arenaHi)@ha + addi r5, r5, (OS_BOOT_INFO + OSBootInfo.arenaHi)@l + clrrwi r7, r15, 5 + stw r7, 0(r5) + + lis r5, OS_USABLE_MEM1_END@ha + addi r5, r5, OS_USABLE_MEM1_END@l + clrrwi r7, r15, 5 + stw r7, 0(r5) + b _init_os + + /** + * Either there was no BI2 available, or it did not contain any arguments + */ +_no_args: + li r14, 0 // argc = 0 + li r15, 0 // argv = NULL + + /** + * Here, the OS and its debug monitor are initialized, and + * then we check if we should call __check_pad3. + * + * __check_pad3 is called before future initialization if the disk + * drive device code is 0x0001, or if the OS' inquiry fails (emulation + * or some debug hardware?) + * + * The apploader reads the button state of the fourth GCN controller + * and writes it to GC_PAD_3_BTN (zero-indexed), which is used in + * __check_pad3. WiiBrew states that this is for GameCube NR disc + * support, so that could explain the unusual DVD device code address. + */ +_init_os: + // Initialize the OS and its debug monitor + bl DBInit + bl OSInit + + // Load DVD device code address + lis r4, OS_DVD_DEVICE_CODE@ha + addi r4, r4, OS_DVD_DEVICE_CODE@l + lhz r3, 0(r4) + // Check whether OS inquiry failed + andi. r5, r3, DVD_DEVICE_CODE_READ + beq _call_check_pad3 // <- Bit 0 is NOT set (fail) + // 0x0001 may be a real ID or a failsafe (see OS.c:InquiryCallback) + andi. r3, r3, (~DVD_DEVICE_CODE_READ) & 0xFFFF + cmplwi r3, 0x0001 + bne _check_debug_bba // <- NOT 0x0001 device code address +_call_check_pad3: + bl __check_pad3 + + /** + * If the BI2 debug level from earlier was set to four, we need to + * initialize the debugger for BBA hardware. + */ +_check_debug_bba: + bl __get_debug_bba + cmplwi r3, 1 + bne _after_init_metro_trk_bba // <- Debug_BBA == false + bl InitMetroTRK_BBA + + /** + * 1. Initialize C++ runtime + * 2. Call main(argc, argv) + * 3. Teardown C++ runtime + */ +_after_init_metro_trk_bba: + bl __init_user + mr r3, r14 + mr r4, r15 + bl main + b exit // <- Will halt CPU + // clang-format on +} + +DECL_SECTION(".init") +static void __copy_rom_section(void* dst, const void* src, size_t size) { + if (size == 0 || dst == src) { + return; + } + + memcpy(dst, src, size); + __flush_cache(dst, size); +} + +DECL_SECTION(".init") +static void __init_bss_section(void* dst, size_t size) { + if (size == 0) { + return; + } + + memset(dst, 0, size); +} + +DECL_SECTION(".init") static asm void __init_registers(void) { + // clang-format off + nofralloc + + li r0, 0 + li r3, 0 + li r4, 0 + li r5, 0 + li r6, 0 + li r7, 0 + li r8, 0 + li r9, 0 + li r10, 0 + li r11, 0 + li r12, 0 + li r14, 0 + li r15, 0 + li r16, 0 + li r17, 0 + li r18, 0 + li r19, 0 + li r20, 0 + li r21, 0 + li r22, 0 + li r23, 0 + li r24, 0 + li r25, 0 + li r26, 0 + li r27, 0 + li r28, 0 + li r29, 0 + li r30, 0 + li r31, 0 + + lis r1, _stack_addr@h + ori r1, r1, _stack_addr@l + lis r2, _SDA2_BASE_@h + ori r2, r2, _SDA2_BASE_@l + lis r13, _SDA_BASE_@h + ori r13, r13, _SDA_BASE_@l + + blr + // clang-format on +} + +DECL_SECTION(".init") static void __init_data(void) { + const RomSection* rs; + const BssSection* bs; + + rs = _rom_copy_info; + while (TRUE) { + if (rs->size == 0) { + break; + } + + __copy_rom_section(rs->virt, rs->phys, rs->size); + rs++; + } + + bs = _bss_init_info; + while (TRUE) { + if (bs->size == 0) { + break; + } + + __init_bss_section(bs->virt, bs->size); + bs++; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/PAD/Pad.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/PAD/Pad.c new file mode 100644 index 0000000000..1911c4d7aa --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/PAD/Pad.c @@ -0,0 +1,18 @@ +#include +#include + +u32 __PADSpec = 0; + +BOOL __PADDisableRecalibration(BOOL disable) { + BOOL enabled = OSDisableInterrupts(); + BOOL old = (OS_PAD_FLAGS & PAD_FLAG_NO_RECALIBRATE) ? TRUE : FALSE; + + OS_PAD_FLAGS &= ~PAD_FLAG_NO_RECALIBRATE; + + if (disable) { + OS_PAD_FLAGS |= PAD_FLAG_NO_RECALIBRATE; + } + + OSRestoreInterrupts(enabled); + return old; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi.c new file mode 100644 index 0000000000..ca9e8b958b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi.c @@ -0,0 +1,173 @@ +#include + +u8 SCGetAspectRatio(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_AR)) { + item = SC_ASPECT_STD; + } else if (item != SC_ASPECT_WIDE) { + item = SC_ASPECT_STD; + } + + return item; +} + +s8 SCGetDisplayOffsetH(void) { + s8 item; + + if (!SCFindS8Item(&item, SC_ITEM_IPL_DH)) { + item = 0; + } else if (item < -32) { + item = -32; + } else if (item > 32) { + item = 32; + } + + return item & ~1; +} + +u8 SCGetEuRgb60Mode(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_E60)) { + item = SC_EURGB_50_HZ; + } else if (item != SC_EURGB_60_HZ) { + item = SC_EURGB_50_HZ; + } + + return item; +} + +void SCGetIdleMode(SCIdleModeInfo* mode) { + SCFindByteArrayItem(mode, sizeof(SCIdleModeInfo), SC_ITEM_IPL_IDL); +} + +u8 SCGetLanguage(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_LNG)) { + if (SCGetProductArea() == SC_AREA_JPN) { + item = SC_LANG_JP; + } else { + item = SC_LANG_EN; + } + } else if (item > SC_LANG_KR) { + item = SC_LANG_EN; + } + + return item; +} + +u8 SCGetProgressiveMode(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_PGS)) { + item = FALSE; + } else if (item != TRUE) { + item = FALSE; + } + + return item; +} + +u8 SCGetScreenSaverMode(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_SSV)) { + item = TRUE; + } else if (item != TRUE) { + item = FALSE; + } + + return item; +} + +u8 SCGetSoundMode(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_IPL_SND)) { + item = SC_SND_STEREO; + } else if (item != SC_SND_MONO && item != SC_SND_STEREO && + item != SC_SND_SURROUND) { + item = SC_SND_STEREO; + } + + return item; +} + +u32 SCGetCounterBias(void) { + u32 item; + + if (!SCFindU32Item(&item, SC_ITEM_IPL_CB)) { + // 2,192 days? + item = 2192 * 24 * 60 * 60; + } + + return item; +} + +void SCGetBtDeviceInfoArray(SCBtDeviceInfoArray* info) { + SCFindByteArrayItem(info, sizeof(SCBtDeviceInfoArray), SC_ITEM_BT_DINF); +} + +void SCSetBtDeviceInfoArray(const SCBtDeviceInfoArray* info) { + SCReplaceByteArrayItem(info, sizeof(SCBtDeviceInfoArray), SC_ITEM_BT_DINF); +} + +u32 SCGetBtDpdSensibility(void) { + u32 item; + + if (!SCFindU32Item(&item, SC_ITEM_BT_SENS)) { + item = 2; + } else if (item < 1) { + item = 1; + } else if (item > 5) { + item = 5; + } + + return item; +} + +u8 SCGetWpadMotorMode(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_BT_MOT)) { + item = TRUE; + } else if (item != TRUE) { + item = FALSE; + } + + return item; +} + +void SCSetWpadMotorMode(u8 mode) { + SCReplaceU8Item(mode, SC_ITEM_BT_MOT); +} + +u8 SCGetWpadSensorBarPosition(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_BT_BAR)) { + item = SC_SENSOR_BAR_BOTTOM; + } else if (item != SC_SENSOR_BAR_TOP) { + item = SC_SENSOR_BAR_BOTTOM; + } + + return item; +} + +u8 SCGetWpadSpeakerVolume(void) { + u8 item; + + if (!SCFindU8Item(&item, SC_ITEM_BT_SPKV)) { + item = 89; + } else if (item > 127) { + item = 127; + } + + return item; +} + +void SCSetWpadSpeakerVolume(u8 vol) { + SCReplaceU8Item(vol, SC_ITEM_BT_SPKV); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi_prdinfo.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi_prdinfo.c new file mode 100644 index 0000000000..4dca24b881 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scapi_prdinfo.c @@ -0,0 +1,94 @@ +#include +#include +#include + +#define XOR_KEY 0x73B5DBFA + +typedef struct SCRegion { + s8 area; // at 0x0 + char name[4]; // at 0x1 +} SCRegion; + +static SCRegion ProductAreaAndStringTbl[] = {{SC_AREA_JPN, "JPN"}, + {SC_AREA_USA, "USA"}, + {SC_AREA_EUR, "EUR"}, + {SC_AREA_AUS, "AUS"}, + {SC_AREA_BRA, "BRA"}, + {SC_AREA_TWN, "TWN"}, + {SC_AREA_TWN, "ROC"}, + {SC_AREA_KOR, "KOR"}, + {SC_AREA_HKG, "HKG"}, + {SC_AREA_ASI, "ASI"}, + {SC_AREA_LTN, "LTN"}, + {SC_AREA_SAF, "SAF"}, + {-1, ""}}; + +BOOL __SCF1(const char* type, char* buf, u32 sz) { + u8 ptext; + BOOL found = FALSE; + u32 i; + const u8* settings = (const u8*)OSPhysicalToCached(OS_PHYS_SC_PRDINFO); + u32 key = XOR_KEY; + u32 typeOfs = 0; + u32 bufOfs = 0; + + for (i = 0; i < SC_PRDINFO_SIZE; i++, key = key >> 31 | key << 1) { + ptext = settings[i]; + + if (ptext != 0x00) { + ptext ^= key; + if (type[typeOfs] == 0x00 && ptext == '=') { + found = TRUE; + break; + } + + if (((ptext ^ type[typeOfs]) & 0xDF) == 0) { + typeOfs++; + } else { + typeOfs = 0; + } + } + } + + if (found) { + for (i++; i < SC_PRDINFO_SIZE && bufOfs < sz; i++) { + key = key >> 31 | key << 1; + ptext = settings[i]; + + if (ptext != 0x00) { + ptext ^= key; + if (ptext == '\r' || ptext == '\n') { + ptext = 0x00; + } + } + + buf[bufOfs++] = ptext; + + if (ptext == 0x00) { + return TRUE; + } + } + } + + return FALSE; +} + +BOOL SCGetProductAreaString(char* buf, u32 sz) { + return __SCF1("AREA", buf, sz); +} + +s8 SCGetProductArea(void) { + s8 area; + char name[4]; + SCRegion* iter = ProductAreaAndStringTbl; + + if (SCGetProductAreaString(name, sizeof(name))) { + for (; (area = iter->area) != -1; iter++) { + if (!strcmp(iter->name, name)) { + return area; + } + } + } + + return -1; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scsystem.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scsystem.c new file mode 100644 index 0000000000..ab54306757 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SC/scsystem.c @@ -0,0 +1,1217 @@ +#include +#include +#include +#include +#include + +#define SC_CONF_MIN_SIZE (sizeof(SCConfHeader) + sizeof(u32)) +#define SC_CONF_MAX_SIZE 0x4000 + +#define SC_CONF_BEGIN_MAGIC "SCv0" +#define SC_CONF_END_MAGIC "SCed" + +#define SC_SMALLARRAY_MAX 0xFF +#define SC_BIGARRAY_MAX 0xFFFF + +typedef enum { + NAND_CB_STATE_0, + NAND_CB_STATE_1, + NAND_CB_STATE_2, + NAND_CB_STATE_3, + NAND_CB_STATE_4, + NAND_CB_STATE_5, + NAND_CB_STATE_6, + NAND_CB_STATE_7, + NAND_CB_STATE_8, + NAND_CB_STATE_9 +} NandCallbackState; + +typedef enum { + SC_CONF_FILE_SYSTEM, // SYSCONF + SC_CONF_FILE_PRODUCT, // setting.txt + SC_CONF_FILE_MAX +} SCConfFile; + +typedef enum { + SC_ITEM_BIGARRAY = (1 << 5), + SC_ITEM_SMALLARRAY = (2 << 5), + SC_ITEM_BYTE = (3 << 5), + SC_ITEM_SHORT = (4 << 5), + SC_ITEM_LONG = (5 << 5), + SC_ITEM_LONGLONG = (6 << 5), + SC_ITEM_BOOL = (7 << 5) +} SCItemType; + +typedef void (*SCAsyncCallback)(s32 result); + +typedef struct SCConfHeader { + u32 magic; // at 0x0 + u16 numItems; // at 0x4 + u16 itemOffsets[]; // at 0x6 +} SCConfHeader; + +typedef struct SCConfItem { + // & 00011111 -> name length (-1) + // & 11100000 -> item type + u8 desc; // at 0x0 + char name[]; // at 0x4 +} SCConfItem; + +typedef struct SCControl { + OSThreadQueue threadQueue; // at 0x0 + NANDFileInfo fileInfo; // at 0x8 + NANDCommandBlock commandBlock; // at 0x94 + union { + NANDStatus fileAttr; + u8 fileType; + }; // at 0x14C + u8 nandCbState; // at 0x154 + u8 isFileOpen; // at 0x155 + u8 openFileType; // at 0x156 + SCAsyncCallback asyncCallback; // at 0x158 + s32 asyncResult; // at 0x15C + const char* filePaths[SC_CONF_FILE_MAX]; // at 0x160 + u8* fileBuffers[SC_CONF_FILE_MAX]; // at 0x168 + u32 bufferSizes[SC_CONF_FILE_MAX]; // at 0x170 + u32 fileSizes[SC_CONF_FILE_MAX]; // at 0x178 + SCFlushCallback flushCallback; // at 0x180 + SCStatus flushStatus; // at 0x184 + u32 flushSize; // at 0x188 +} SCControl; + +typedef struct SCNameAndID { + const char* name; // at 0x0 + SCItemID id; // at 0x4 +} SCNameAndID; + +typedef struct SCItem { + char UNK_0x0[0x8]; + u8 primType; // at 0x8 + u8 arrayType; // at 0x9 + u32 nameLen; // at 0xC + u32 dataLen; // at 0x10 + const char* name; // at 0x14 + u8* data; // at 0x18 + u32 itemLen; // at 0x1C +} SCItem; + +const char* __SCVersion = + "<< RVL_SDK - SC \trelease build: Nov 30 2006 03:33:00 (0x4199_60831) >>"; + +static SCControl Control; +static u8 ConfBuf[SC_CONF_MAX_SIZE] ALIGN(32); +static u8 ConfBufForFlush[SC_CONF_MAX_SIZE] ALIGN(32); + +static const char ConfDirName[] = "/shared2/sys"; +static const char ConfFileName[] = "/shared2/sys/SYSCONF"; +static const char ProductInfoFileName[] = + "/title/00000001/00000002/data/setting.txt"; + +static u8 BgJobStatus = SC_STATUS_OK; + +static u32 ItemRestSize = 0; +static u32 ItemNumTotal = 0; +static u32 ItemIDMaxPlus1 = 0; +static u32 ItemIDOffsetTblOffset = 0; + +static u8 IsDevKit = FALSE; +static u8 DirtyFlag = FALSE; +static u8 Initialized = FALSE; + +static SCNameAndID NameAndIDTbl[SC_ITEM_MAX] = { + {"IPL.CB", SC_ITEM_IPL_CB}, {"IPL.AR", SC_ITEM_IPL_AR}, + {"IPL.ARN", SC_ITEM_IPL_ARN}, {"IPL.CD", SC_ITEM_IPL_CD}, + {"IPL.CD2", SC_ITEM_IPL_CD2}, {"IPL.DH", SC_ITEM_IPL_DH}, + {"IPL.E60", SC_ITEM_IPL_E60}, {"IPL.EULA", SC_ITEM_IPL_EULA}, + {"IPL.FRC", SC_ITEM_IPL_FRC}, {"IPL.IDL", SC_ITEM_IPL_IDL}, + {"IPL.INC", SC_ITEM_IPL_INC}, {"IPL.LNG", SC_ITEM_IPL_LNG}, + {"IPL.NIK", SC_ITEM_IPL_NIK}, {"IPL.PC", SC_ITEM_IPL_PC}, + {"IPL.PGS", SC_ITEM_IPL_PGS}, {"IPL.SSV", SC_ITEM_IPL_SSV}, + {"IPL.SADR", SC_ITEM_IPL_SADR}, {"IPL.SND", SC_ITEM_IPL_SND}, + {"IPL.UPT", SC_ITEM_IPL_UPT}, {"NET.CNF", SC_ITEM_NET_CNF}, + {"NET.CTPC", SC_ITEM_NET_CTPC}, {"NET.PROF", SC_ITEM_NET_PROF}, + {"NET.WCPC", SC_ITEM_NET_WCPC}, {"NET.WCFG", SC_ITEM_NET_WCFG}, + {"DEV.BTM", SC_ITEM_DEV_BTM}, {"DEV.VIM", SC_ITEM_DEV_VIM}, + {"DEV.CTC", SC_ITEM_DEV_CTC}, {"DEV.DSM", SC_ITEM_DEV_DSM}, + {"BT.DINF", SC_ITEM_BT_DINF}, {"BT.SENS", SC_ITEM_BT_SENS}, + {"BT.SPKV", SC_ITEM_BT_SPKV}, {"BT.MOT", SC_ITEM_BT_MOT}, + {"BT.BAR", SC_ITEM_BT_BAR}, {"DVD.CNF", SC_ITEM_DVD_CNF}, + {"WWW.RST", SC_ITEM_WWW_RST}}; + +static void SetBgJobStatus(SCStatus status); +static s32 SCReloadConfFileAsync(u8* buf, u32 size, SCAsyncCallback callback); +static void OpenCallbackFromReload(s32 result, NANDCommandBlock* block); +static void ReadCallbackFromReload(s32 result, NANDCommandBlock* block); +static void CloseCallbackFromReload(s32 result, NANDCommandBlock* block); +static void FinishFromReload(void); +static void ErrorFromReload(s32 result); +static void CloseCallbackFromReloadError(s32 result, NANDCommandBlock* block); +static void ClearConfBuf(u8* conf); +static SCStatus ParseConfBuf(u8* conf, u32 size); +static BOOL ParseGetBEValue(const u8* start, const u8* end, u32* out, u32 size); +static BOOL UnpackItem(const SCConfItem* raw, SCItem* item); +static void MyNandCallback(s32 result, NANDCommandBlock* block); +static void FinishFromFlush(void); +static void ErrorFromFlush(void); + +BOOL __SCIsDirty(void); +void __SCSetDirtyFlag(void); +void __SCClearDirtyFlag(void); +u8* __SCGetConfBuf(void); +u32 __SCGetConfBufSize(void); + +void SCInit(void) { + BOOL enabled = OSDisableInterrupts(); + + if (Initialized) { + OSRestoreInterrupts(enabled); + return; + } + + Initialized = TRUE; + + SetBgJobStatus(SC_STATUS_BUSY); + OSRestoreInterrupts(enabled); + + OSRegisterVersion(__SCVersion); + OSInitThreadQueue(&Control.threadQueue); + + if (OSGetConsoleType() & OS_CONSOLE_MASK_EMU) { + IsDevKit = TRUE; + } + + if (NANDInit() != NAND_RESULT_OK || + SCReloadConfFileAsync(__SCGetConfBuf(), __SCGetConfBufSize(), NULL) != + NAND_RESULT_OK) { + + SetBgJobStatus(SC_STATUS_FATAL); + } +} + +static void SetBgJobStatus(SCStatus status) { + BgJobStatus = status; +} + +u32 SCCheckStatus(void) { + BOOL enabled; + u32 status; + + enabled = OSDisableInterrupts(); + status = BgJobStatus; + + if (status == SC_STATUS_PARSE) { + SetBgJobStatus(SC_STATUS_BUSY); + OSRestoreInterrupts(enabled); + + if (ParseConfBuf(Control.fileBuffers[SC_CONF_FILE_SYSTEM], + Control.fileSizes[SC_CONF_FILE_SYSTEM]) == 0) { + enabled = OSDisableInterrupts(); + + if (__SCGetConfBuf() != Control.fileBuffers[SC_CONF_FILE_SYSTEM]) { + memcpy(__SCGetConfBuf(), + Control.fileBuffers[SC_CONF_FILE_SYSTEM], + __SCGetConfBufSize()); + } + __SCClearDirtyFlag(); + + OSRestoreInterrupts(enabled); + } else { + enabled = OSDisableInterrupts(); + + ClearConfBuf(Control.fileBuffers[SC_CONF_FILE_SYSTEM]); + __SCClearDirtyFlag(); + + OSRestoreInterrupts(enabled); + } + + status = SC_STATUS_OK; + SetBgJobStatus(SC_STATUS_OK); + } else { + OSRestoreInterrupts(enabled); + } + + return status; +} + +static s32 SCReloadConfFileAsync(u8* buf, u32 size, SCAsyncCallback callback) { + int i; + + if (size < __SCGetConfBufSize()) { + return NAND_RESULT_FATAL_ERROR; + } + + SetBgJobStatus(SC_STATUS_BUSY); + Control.asyncCallback = callback; + Control.asyncResult = NAND_RESULT_OK; + Control.openFileType = 0; + + for (i = 0; i < SC_CONF_FILE_MAX; i++) { + Control.fileSizes[i] = 0; + } + + Control.filePaths[SC_CONF_FILE_SYSTEM] = ConfFileName; + Control.filePaths[SC_CONF_FILE_PRODUCT] = ProductInfoFileName; + + Control.fileBuffers[SC_CONF_FILE_SYSTEM] = buf; + Control.fileBuffers[SC_CONF_FILE_PRODUCT] = OS_SC_PRDINFO; + + Control.bufferSizes[SC_CONF_FILE_SYSTEM] = __SCGetConfBufSize(); + Control.bufferSizes[SC_CONF_FILE_PRODUCT] = LENGTHOF(OS_SC_PRDINFO); + + ClearConfBuf(buf); + + ItemIDOffsetTblOffset = 0; + ItemNumTotal = 0; + ItemRestSize = 0; + + Control.isFileOpen = FALSE; + + return NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], + &Control.fileInfo, NAND_ACCESS_READ, + OpenCallbackFromReload, &Control.commandBlock); +} + +static void OpenCallbackFromReload(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == NAND_RESULT_OK) { + Control.isFileOpen = TRUE; + + if (NANDReadAsync(&Control.fileInfo, + Control.fileBuffers[Control.openFileType], + Control.bufferSizes[Control.openFileType], + ReadCallbackFromReload, + &Control.commandBlock) == NAND_RESULT_OK) { + return; + } + } + + ErrorFromReload(result); +} + +static void ReadCallbackFromReload(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == Control.bufferSizes[Control.openFileType]) { + Control.fileSizes[Control.openFileType] = result; + Control.isFileOpen = FALSE; + + if (NANDCloseAsync(&Control.fileInfo, CloseCallbackFromReload, + &Control.commandBlock) == NAND_RESULT_OK) { + return; + } + } + + ErrorFromReload(result != NAND_RESULT_OK ? result + : NAND_RESULT_FATAL_ERROR); +} + +static void CloseCallbackFromReload(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + if (result == NAND_RESULT_OK) { + FinishFromReload(); + } else { + ErrorFromReload(result); + } +} + +static void FinishFromReload(void) { + SCStatus status; + +_openFile: + Control.openFileType++; + + if (Control.openFileType < SC_CONF_FILE_MAX) { + Control.isFileOpen = FALSE; + + if (NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], + &Control.fileInfo, NAND_ACCESS_READ, + OpenCallbackFromReload, + &Control.commandBlock) == NAND_RESULT_OK) { + return; + } + + goto _openFile; + } + + switch (Control.asyncResult) { + case NAND_RESULT_OK: + status = SC_STATUS_PARSE; + break; + case NAND_RESULT_NOEXISTS: + default: + ClearConfBuf(Control.fileBuffers[SC_CONF_FILE_SYSTEM]); + status = SC_STATUS_PARSE; + + Control.fileSizes[SC_CONF_FILE_SYSTEM] = + Control.bufferSizes[SC_CONF_FILE_SYSTEM]; + break; + } + + OS_SC_PRDINFO[LENGTHOF(OS_SC_PRDINFO) - 1] = '\0'; + + if (Control.asyncCallback != NULL) { + Control.asyncCallback(Control.asyncResult); + Control.asyncCallback = NULL; + } + + SetBgJobStatus(status); +} + +static void ErrorFromReload(s32 result) { + if (Control.openFileType == SC_CONF_FILE_SYSTEM) { + Control.asyncResult = result; + } + + Control.fileSizes[Control.openFileType] = 0; + + if (!Control.isFileOpen || + NANDCloseAsync(&Control.fileInfo, CloseCallbackFromReloadError, + &Control.commandBlock) != NAND_RESULT_OK) { + FinishFromReload(); + } +} + +static void CloseCallbackFromReloadError(s32 result, NANDCommandBlock* block) { +#pragma unused(result) +#pragma unused(block) + + FinishFromReload(); +} + +static void ClearConfBuf(u8* conf) { + u8* end; + u32 size; + SCConfHeader* header; + + header = (SCConfHeader*)conf; + size = __SCGetConfBufSize(); + memset(conf, 0, size); + + if (size > SC_CONF_MIN_SIZE) { + memcpy(conf, SC_CONF_BEGIN_MAGIC, 4); + + end = conf + size - sizeof(u32); + memcpy(end, SC_CONF_END_MAGIC, 4); + + header->itemOffsets[0] = sizeof(SCConfHeader); + } +} + +static SCStatus ParseConfBuf(u8* conf, u32 size) { + int i; + + u8* confBegin; + u8* confEnd; + u32 itemOffset; + + u32 numItems; + u16* confItems; + u32 itemRest; + + u8* confLutEnd; + u8* confLutBegin; + + SCNameAndID* tblIter; + SCNameAndID* tblEnd; + const char* itName; + + tblIter = NameAndIDTbl; + + /** + * Config parameters + */ + + if (size < SC_CONF_MIN_SIZE) { + goto _error; + } + + if (size > __SCGetConfBufSize()) { + goto _error; + } + + confBegin = conf; + confEnd = conf + size - sizeof(u32); + ItemIDMaxPlus1 = SC_ITEM_MAX; + + /** + * File magic + */ + + if (memcmp(conf, SC_CONF_BEGIN_MAGIC, sizeof(u32)) != 0) { + goto _error; + } + + if (memcmp(confEnd, SC_CONF_END_MAGIC, sizeof(u32)) != 0) { + goto _error; + } + + conf += sizeof(u32); + + if (size < __SCGetConfBufSize()) { + u32 confRest = __SCGetConfBufSize() - size; + memset(confEnd, 0, confRest); + confEnd += confRest; + memcpy(confEnd, SC_CONF_END_MAGIC, sizeof(u32)); + } + + /** + * Item count + */ + + if (!ParseGetBEValue(conf, confEnd, &numItems, sizeof(u16))) { + goto _error; + } + + conf += sizeof(u16); + + /** + * Item data + */ + + confItems = (u16*)conf; + itemOffset = (u8*)(confItems + numItems + 1) - confBegin; + + for (i = 0; i < numItems; i++) { + SCItem item; + + if (itemOffset > size) { + goto _error; + } + + if ((u8*)&confItems[i] - confBegin > size) { + goto _error; + } + + if (itemOffset != confItems[i]) { + goto _error; + } + + if (!UnpackItem((SCConfItem*)(confBegin + itemOffset), &item)) { + goto _error; + } + + itemOffset += item.itemLen; + } + + if (itemOffset > size || itemOffset != confItems[i]) { + goto _error; + } + + /** + * Item lookup table + */ + + confLutEnd = confEnd - (SC_ITEM_MAX - 1) * sizeof(u16); + + if (confBegin + itemOffset > confLutEnd) { + goto _error; + } + + itemRest = confLutEnd - (confBegin + itemOffset); + memset(confLutEnd, 0, confEnd - confLutEnd); + + // First LUT entry (grows upward) + confLutBegin = confEnd - sizeof(u16); + + /** + * Build lookup table + */ + + for (tblEnd = &tblIter[ItemIDMaxPlus1]; + tblIter < tblEnd && (itName = tblIter->name) != (void*)NULL; + tblIter++) { + + u32 itNameLen = strlen(itName); + + for (i = 0; i < numItems; i++) { + SCConfItem* itData = (SCConfItem*)(confBegin + confItems[i]); + + // Item length doesn't include terminator + if (itNameLen != (itData->desc & 0b00011111) + 1) { + continue; + } + + if (memcmp(itName, itData->name, itNameLen) != 0) { + continue; + } + + // LUT items are in reverse order + ((u16*)confLutBegin)[-tblIter->id] = + (u8*)(confItems + i) - confBegin; + + break; + } + } + + ItemIDOffsetTblOffset = confLutBegin - confBegin; + ItemNumTotal = numItems; + ItemRestSize = itemRest; + return SC_STATUS_OK; + +_error: + return SC_STATUS_FATAL; +} + +static BOOL ParseGetBEValue(const u8* start, const u8* end, u32* out, + u32 size) { + u32 imm = 0; + + if (start + size > end) { + return FALSE; + } + + for (; size > 0; start++, size--) { + imm = imm << 8 | *start; + } + + *out = imm; + return TRUE; +} + +static BOOL UnpackItem(const SCConfItem* raw, SCItem* item) { + u8 type; + + memset(item, 0, sizeof(SCItem)); + type = raw->desc & 0b11100000; + item->name = raw->name; + item->nameLen = (raw->desc & 0b00011111) + 1; + item->data = (u8*)raw + item->nameLen + 1; + + switch (type) { + case SC_ITEM_BYTE: + case SC_ITEM_BOOL: + item->dataLen = sizeof(u8); + break; + case SC_ITEM_SHORT: + item->dataLen = sizeof(u16); + break; + case SC_ITEM_LONG: + item->dataLen = sizeof(u32); + break; + case SC_ITEM_LONGLONG: + item->dataLen = sizeof(u64); + break; + case SC_ITEM_SMALLARRAY: + item->dataLen = *item->data + sizeof(u8); + item->data = item->data + sizeof(u8); + item->itemLen += sizeof(u8); + break; + case SC_ITEM_BIGARRAY: + item->dataLen = (item->data[0] << 8 | item->data[1]) + sizeof(u8); + item->data = item->data + sizeof(u16); + item->itemLen += sizeof(u16); + break; + default: + goto _exit; + } + + if (type == SC_ITEM_SMALLARRAY || type == SC_ITEM_BIGARRAY) { + item->arrayType = SC_ITEM_SMALLARRAY; + } else { + item->primType = type; + memcpy(item, item->data, item->dataLen); + } + + item->itemLen += item->nameLen + item->dataLen + sizeof(u8); + +_exit: + return item->dataLen != 0; +} + +static BOOL FindItemByID(SCItemID id, SCItem* item) { + u8* conf; + u16* ofsTbl; + u16 itemOfsOfs; + + conf = __SCGetConfBuf(); + if (id < ItemIDMaxPlus1 && ItemIDOffsetTblOffset > 0) { + ofsTbl = (u16*)(conf + ItemIDOffsetTblOffset); + + // LUT items are in reverse order + itemOfsOfs = ofsTbl[-id]; + + if (itemOfsOfs > 0) { + return UnpackItem((SCConfItem*)(conf + *(u16*)(conf + itemOfsOfs)), + item); + } + } + + return FALSE; +} + +static void DeleteItemByID(SCItemID id) { + u8* conf; + u16* itemOfs; + u32 itemOfsOfs; + u32 itemsEndOfs; + u32 itemSize; + u16* confLut; + u16* confItemsBegin; + u16* confItemsEnd; + u32 sp14; + u16* it; + int i; + + conf = __SCGetConfBuf(); + + if (id >= ItemIDMaxPlus1) { + return; + } + + if (ItemIDOffsetTblOffset == 0) { + return; + } + + confLut = (u16*)(conf + ItemIDOffsetTblOffset); + // LUT items are in reverse order + itemOfsOfs = confLut[-id]; + + if (itemOfsOfs == 0) { + return; + } + + if (ItemNumTotal == 0) { + return; + } + + confItemsBegin = ((SCConfHeader*)conf)->itemOffsets; + + // LUT -> Item offset -> Item data + itemOfs = (u16*)(conf + itemOfsOfs); + + // Last offset -> past end of items + confItemsEnd = &confItemsBegin[ItemNumTotal]; + itemsEndOfs = *confItemsEnd; + + // Offset from next item + itemSize = itemOfs[1] - itemOfs[0] + sizeof(u16); + + sp14 = *itemOfs - (itemOfsOfs + sizeof(u16)); + memmove(conf + itemOfsOfs, conf + itemOfsOfs + sizeof(u16), sp14); + + // Adjust item offsets + for (it = confItemsEnd - 1; it >= confItemsBegin; it--) { + if (it < itemOfs) { + // After deleted item + *it -= sizeof(u16); + } else { + // Before deleted item + *it -= itemSize; + } + } + + memmove(conf + *itemOfs, conf + itemSize + *itemOfs, + itemsEndOfs - (*itemOfs + itemSize)); + + memset(conf + (itemsEndOfs - itemSize), 0, itemSize); + + // Adjust item lookup table + for (i = 0; i < ItemIDMaxPlus1; i++) { + // Before deleted slot + if (confLut[-i] < itemOfsOfs) { + continue; + } + + // After deleted slot + if (confLut[-i] > itemOfsOfs) { + confLut[-i] -= sizeof(u16); + } else { + confLut[-i] = 0; + } + } + + ItemRestSize += itemSize; + ItemNumTotal--; + ((SCConfHeader*)conf)->numItems = ItemNumTotal; + __SCSetDirtyFlag(); +} + +static BOOL CreateItemByID(SCItemID id, u8 primType, const void* src, u32 len) { + u8* conf; + u32 itemNameLen; + u32 itemSize; + u32 itemsEndOfs; + const char* itemName; + u8* newItem; + u16* confItemsBegin; + u16* confItemsEnd; + u16* confLut; + SCNameAndID* it; + u16* ofsIter; + + conf = __SCGetConfBuf(); + itemSize = 1; + it = NameAndIDTbl; + + if (id >= ItemIDMaxPlus1) { + goto _error; + } + + if (src == (void*)NULL) { + goto _error; + } + + if (ItemNumTotal >= 0xFFFF) { + goto _error; + } + + if (ItemIDOffsetTblOffset == 0) { + goto _error; + } + + switch (primType) { + case SC_ITEM_BYTE: + case SC_ITEM_BOOL: + len = sizeof(u8); + break; + case SC_ITEM_SHORT: + len = sizeof(u16); + break; + case SC_ITEM_LONG: + len = sizeof(u32); + break; + case SC_ITEM_LONGLONG: + len = sizeof(u64); + break; + case SC_ITEM_SMALLARRAY: + if (len == 0) { + goto _error; + } + + // Length is stored minus one + if (len > SC_BIGARRAY_MAX + 1) { + goto _error; + } + + // Length is stored minus one + if (len > SC_SMALLARRAY_MAX + 1) { + itemSize += 2; + primType = SC_ITEM_BIGARRAY; + } else { + itemSize += 1; + } + break; + default: + goto _error; + } + + itemSize += len; + + for (; (itemName = it->name) != (void*)NULL; it++) { + if (it->id == id) { + break; + } + } + + if (itemName == (void*)NULL) { + goto _error; + } + + // Only five bits reserved for name length (minus one) + itemNameLen = strlen(itemName); + if (itemNameLen > 0b00011111 + 1) { + goto _error; + } + + itemSize += itemNameLen; + if (ItemRestSize < itemSize + sizeof(u16)) { + goto _error; + } + + confItemsBegin = ((SCConfHeader*)conf)->itemOffsets; + confItemsEnd = &confItemsBegin[ItemNumTotal]; + itemsEndOfs = *confItemsEnd; + + // Make room for new item + memmove(confItemsBegin[0] + sizeof(u16) + conf, confItemsBegin[0] + conf, + itemsEndOfs - confItemsBegin[0]); + + // Adjust offsets + ofsIter = confItemsBegin; + do { + *ofsIter++ += sizeof(u16); + } while (ofsIter <= confItemsEnd); + + itemsEndOfs = *confItemsEnd; + newItem = conf + itemsEndOfs; + + *newItem = primType | (itemNameLen - 1); + memcpy(newItem + 1, itemName, itemNameLen); + newItem += itemNameLen + 1; + + if (primType == SC_ITEM_SMALLARRAY) { + *newItem++ = len - 1; + } else if (primType == SC_ITEM_BIGARRAY) { + *newItem++ = (len - 1) >> 8 & 0xFF; + *newItem++ = (len - 1) >> 0 & 0xFF; + } + + memcpy(newItem, src, len); + newItem += len; + + confLut = (u16*)(conf + ItemIDOffsetTblOffset); + confLut[-id] = (u8*)confItemsEnd - conf; + confItemsEnd[1] = confItemsEnd[0] + itemSize; + + ItemRestSize -= itemSize + sizeof(u16); + ItemNumTotal++; + ((SCConfHeader*)conf)->numItems = ItemNumTotal; + __SCSetDirtyFlag(); + return TRUE; + +_error: + return FALSE; +} + +BOOL SCFindByteArrayItem(void* dst, u32 len, SCItemID id) { + BOOL success; + BOOL enabled; + SCItem item; + + success = FALSE; + enabled = OSDisableInterrupts(); + + if (dst != ((void*)NULL) && FindItemByID(id, &item) && + item.arrayType != 0 && item.dataLen == len) { + memcpy(dst, item.data, len); + success = TRUE; + } + + OSRestoreInterrupts(enabled); + return success; +} + +BOOL SCReplaceByteArrayItem(const void* src, u32 len, SCItemID id) { + BOOL success; + BOOL enabled; + SCItem item; + + success = FALSE; + enabled = OSDisableInterrupts(); + + if (src != ((void*)NULL)) { + if (FindItemByID(id, &item)) { + if (item.arrayType != 0 && item.dataLen == len) { + if (memcmp(item.data, src, len) != 0) { + memcpy(item.data, src, len); + __SCSetDirtyFlag(); + } + + success = TRUE; + goto _exit; + + } else { + DeleteItemByID(id); + } + } + + success = CreateItemByID(id, SC_ITEM_SMALLARRAY, src, len); + } + +_exit: + OSRestoreInterrupts(enabled); + return success; +} + +static BOOL SCFindIntegerItem(void* dst, SCItemID id, u8 primType) { + BOOL success; + BOOL enabled; + SCItem item; + + success = FALSE; + enabled = OSDisableInterrupts(); + + if (FindItemByID(id, &item) && item.primType == primType) { + memcpy(dst, item.data, item.dataLen); + success = TRUE; + } + + OSRestoreInterrupts(enabled); + return success; +} + +static BOOL SCReplaceIntegerItem(const void* src, SCItemID id, u8 primType) + DECOMP_DONT_INLINE { + BOOL success; + BOOL enabled; + SCItem item; + + success = FALSE; + enabled = OSDisableInterrupts(); + + if (FindItemByID(id, &item)) { + if (item.primType == primType) { + if (memcmp(item.data, src, item.dataLen) != 0) { + memcpy(item.data, src, item.dataLen); + __SCSetDirtyFlag(); + } + + success = TRUE; + goto _exit; + + } else { + DeleteItemByID(id); + } + } + + success = CreateItemByID(id, primType, src, 0); + +_exit: + OSRestoreInterrupts(enabled); + return success; +} + +BOOL SCFindU8Item(u8* dst, SCItemID id) { + return SCFindIntegerItem(dst, id, SC_ITEM_BYTE); +} + +BOOL SCFindS8Item(s8* dst, SCItemID id) { + return SCFindIntegerItem(dst, id, SC_ITEM_BYTE); +} + +BOOL SCFindU32Item(u32* dst, SCItemID id) { + return SCFindIntegerItem(dst, id, SC_ITEM_LONG); +} + +BOOL SCReplaceU8Item(u8 data, SCItemID id) { + return SCReplaceIntegerItem(&data, id, SC_ITEM_BYTE); +} + +static void __SCFlushSyncCallback(SCStatus status) { +#pragma unused(status) + + OSWakeupThread(&Control.threadQueue); +} + +void SCFlushAsync(SCFlushCallback callback) { + SCControl* ctrl; + BOOL enabled; + u8 status; + + ctrl = &Control; + enabled = OSDisableInterrupts(); + status = BgJobStatus; + + if (status == SC_STATUS_OK) { + SetBgJobStatus(SC_STATUS_BUSY); + + if (callback == ((void*)NULL)) { + callback = __SCFlushSyncCallback; + } + + ctrl->flushCallback = callback; + ctrl->flushStatus = SC_STATUS_OK; + ctrl->isFileOpen = FALSE; + ctrl->flushSize = __SCGetConfBufSize(); + + if (!__SCIsDirty()) { + OSRestoreInterrupts(enabled); + FinishFromFlush(); + } else { + __SCClearDirtyFlag(); + memcpy(ConfBufForFlush, __SCGetConfBuf(), __SCGetConfBufSize()); + + OSRestoreInterrupts(enabled); + ctrl->nandCbState = NAND_CB_STATE_0; + + if (NANDPrivateGetTypeAsync(ConfFileName, &ctrl->fileType, + MyNandCallback, &ctrl->commandBlock) != + NAND_RESULT_OK) { + ErrorFromFlush(); + } + } + } else { + if (callback != NULL) { + callback(status == SC_STATUS_BUSY ? status : SC_STATUS_FATAL); + } + + OSRestoreInterrupts(enabled); + } +} + +static void MyNandCallback(s32 result, NANDCommandBlock* block) { +#pragma unused(block) + + SCControl* ctrl = &Control; + + switch (ctrl->nandCbState) { + case NAND_CB_STATE_0: + if (result == NAND_RESULT_OK && ctrl->fileType == NAND_FILE_TYPE_FILE) { + ctrl->nandCbState = NAND_CB_STATE_1; + + if (NANDPrivateGetStatusAsync( + ConfFileName, &ctrl->fileAttr, MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + } else { + goto _case_1_lbl; + } + return; + + case NAND_CB_STATE_1: + if (result == NAND_RESULT_OK && + ctrl->fileAttr.perm == NAND_PERM_RWALL) { + goto _case_5_lbl; + } + _case_1_lbl: + ctrl->nandCbState = NAND_CB_STATE_2; + + if (NANDPrivateDeleteAsync(ConfFileName, MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_2: + ctrl->nandCbState = NAND_CB_STATE_3; + + if (NANDPrivateGetTypeAsync(ConfDirName, &ctrl->fileType, + MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_3: + if (result == NAND_RESULT_OK && ctrl->fileType == NAND_FILE_TYPE_DIR) { + goto _case_4_lbl; + } + + ctrl->nandCbState = NAND_CB_STATE_4; + + if (NANDPrivateCreateDirAsync(ConfDirName, NAND_PERM_RWALL, 0, + MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_4: + _case_4_lbl: + ctrl->nandCbState = NAND_CB_STATE_5; + if (NANDPrivateCreateAsync(ConfFileName, NAND_PERM_RWALL, 0, + MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_5: + _case_5_lbl: + ctrl->nandCbState = NAND_CB_STATE_6; + if (NANDPrivateOpenAsync(ConfFileName, &ctrl->fileInfo, + NAND_ACCESS_WRITE, MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_6: + if (result != NAND_RESULT_OK) { + goto _error; + } + + ctrl->isFileOpen = TRUE; + ctrl->nandCbState = NAND_CB_STATE_7; + + if (NANDWriteAsync(&ctrl->fileInfo, ConfBufForFlush, ctrl->flushSize, + MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_7: + if (result != ctrl->flushSize) { + goto _error; + } + + ctrl->isFileOpen = FALSE; + ctrl->nandCbState = NAND_CB_STATE_8; + + if (NANDCloseAsync(&ctrl->fileInfo, MyNandCallback, + &ctrl->commandBlock) != NAND_RESULT_OK) { + goto _error; + } + return; + + case NAND_CB_STATE_8: + if (result != NAND_RESULT_OK) { + goto _error; + } + // FALLTHROUGH + + case NAND_CB_STATE_9: + FinishFromFlush(); + // FALLTHROUGH + + default: + return; + } + +_error: + ErrorFromFlush(); +} + +static void FinishFromFlush(void) { + SCControl* ctrl; + SCFlushCallback callback; + + ctrl = &Control; + if (ctrl->flushStatus != SC_STATUS_OK) { + __SCSetDirtyFlag(); + } + + callback = ctrl->flushCallback; + if (callback != NULL) { + ctrl->flushCallback = NULL; + callback(ctrl->flushStatus); + + if (ctrl->threadQueue.head != ((void*)NULL)) { + OSWakeupThread(&ctrl->threadQueue); + } + } + + SetBgJobStatus(ctrl->flushStatus); +} + +static void ErrorFromFlush(void) { + SCControl* ctrl; + + ctrl = &Control; + ctrl->flushStatus = SC_STATUS_FATAL; + + if (ctrl->isFileOpen) { + ctrl->nandCbState = NAND_CB_STATE_9; + + if (NANDCloseAsync(&ctrl->fileInfo, MyNandCallback, + &ctrl->commandBlock) == NAND_RESULT_OK) { + return; + } + } + + FinishFromFlush(); +} + +BOOL __SCIsDirty(void) { + return DirtyFlag ? TRUE : FALSE; +} + +void __SCSetDirtyFlag(void) { + DirtyFlag = TRUE; +} + +void __SCClearDirtyFlag(void) { + DirtyFlag = FALSE; +} + +u8* __SCGetConfBuf(void) { + return ConfBuf; +} + +u32 __SCGetConfBufSize(void) { + return SC_CONF_MAX_SIZE; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SIBios.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SIBios.c new file mode 100644 index 0000000000..ce3e9a7ae8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SIBios.c @@ -0,0 +1,291 @@ +#include +#include + +typedef enum { + SI_ERROR_NOREP = (1 << 3), + SI_ERROR_BUSY = (1 << 7), + SI_WIRELESS_LITE = (1 << 18), + SI_WIRELESS_CONT = (1 << 19), +} SIStatus; + +typedef struct SIMain { + s32 chan; // at 0x0 + u32 poll; // at 0x4 + u32 inSize; // at 0x8 + void* inAddr; // at 0xC + SICallback callback; // at 0x10 +} SIMain; + +typedef struct SIPacket { + s32 chan; // at 0x0 + void* outAddr; // at 0x4 + u32 outSize; // at 0x8 + void* inAddr; // at 0xC + u32 inSize; // at 0x10 + SICallback callback; // at 0x14 + s64 fire; // at 0x18 +} SIPacket; + +const char* __SIVersion = + "<< RVL_SDK - SI \trelease build: Nov 30 2006 03:31:44 (0x4199_60831) >>"; + +static SIMain Si = {SI_CHAN_NONE}; +static u32 Type[SI_MAX_CHAN] = {SI_ERROR_NOREP, SI_ERROR_NOREP, SI_ERROR_NOREP, + SI_ERROR_NOREP}; + +static SIPacket Packet[SI_MAX_CHAN]; +static s64 XferTime[SI_MAX_CHAN]; +static s64 TypeTime[SI_MAX_CHAN]; +static SICallback TypeCallback[SI_MAX_TYPE][SI_MAX_CHAN]; +static BOOL InputBufferValid[SI_MAX_CHAN]; +static u32 InputBuffer[SI_MAX_CHAN][2]; +static OSInterruptHandler RDSTHandler[SI_MAX_CHAN]; +static u32 InputBufferVcount[SI_MAX_CHAN]; +static OSAlarm Alarm[SI_MAX_CHAN]; + +static void SIClearTCInterrupt(void) { + u32 csr = SI_HW_REGS[SI_SICOMSCR]; + + csr |= SI_SICOMCSR_TCINT; + csr &= ~SI_SICOMCSR_TSTART; + + SI_HW_REGS[SI_SICOMSCR] = csr; +} + +static u32 CompleteTransfer(void) { + u32 i; + u32 sr; + u8* dst; + u32 size; + u32 imm; + + sr = SI_HW_REGS[SI_SISR]; + SIClearTCInterrupt(); + + if (Si.chan != SI_CHAN_NONE) { + XferTime[Si.chan] = __OSGetSystemTime(); + + dst = (u8*)Si.inAddr; + + size = Si.inSize / sizeof(u32); + for (i = 0; i < size; dst += sizeof(u32), i++) { + *(u32*)dst = SI_HW_REGS[SI_RAM_BASE + i]; + } + + size = Si.inSize % sizeof(u32); + if (size > 0) { + imm = SI_HW_REGS[SI_RAM_BASE + i]; + + for (i = 0; i < size; dst++, i++) { + *dst = imm >> (3 - i) * 8; + } + } + + if (SI_HW_REGS[SI_SICOMSCR] & SI_SICOMCSR_COMERR) { + // Flags relative to channel ID + sr >>= ((SI_MAX_CHAN - 1) - Si.chan) * 8; + sr &= (SI_UNRUN | SI_OVRUN | SI_COLL | SI_NOREP); + + if ((sr & SI_NOREP) && (Type[Si.chan] & SI_ERROR_BUSY) == 0) { + Type[Si.chan] = SI_ERROR_NOREP; + } + + if (sr == 0) { + sr = SI_COLL; + } + } else { + TypeTime[Si.chan] = __OSGetSystemTime(); + sr = 0; + } + + Si.chan = SI_CHAN_NONE; + } + + return sr; +} + +// TODO +static void SIInterruptHandler(s16 intr, OSContext* ctx) { + ; +} + +void SIInit(void) { + static BOOL Initialized = FALSE; + + if (Initialized) { + return; + } + + OSRegisterVersion(__SIVersion); + + Packet[SI_CHAN_0].chan = Packet[SI_CHAN_1].chan = Packet[SI_CHAN_2].chan = + Packet[SI_CHAN_3].chan = SI_CHAN_NONE; + + Si.poll = 0; + SISetSamplingRate(0); + + while (SI_HW_REGS[SI_SICOMSCR] & SI_SICOMCSR_TSTART) { + ; + } + + SI_HW_REGS[SI_SICOMSCR] = SI_SICOMCSR_TCINT; + + __OSSetInterruptHandler(OS_INTR_PI_SI, SIInterruptHandler); + __OSUnmaskInterrupts(OS_INTR_MASK(OS_INTR_PI_SI)); + + SIGetType(SI_CHAN_0); + SIGetType(SI_CHAN_1); + SIGetType(SI_CHAN_2); + SIGetType(SI_CHAN_3); + + Initialized = TRUE; +} + +static BOOL __SITransfer(s32 chan, void* outAddr, u32 outSize, void* inAddr, + u32 inSize, SICallback callback) { + BOOL enabled; + u32 sr; + u32 alignSize; + u32 i; + + union { + struct { + u32 TCINT : 1; + u32 TCINTMSK : 1; + u32 COMERR : 1; + u32 RDSTINT : 1; + u32 RDSTINTMSK : 1; + u32 reserved2 : 4; + u32 OUTLNGTH : 7; + u32 reserved1 : 1; + u32 INLNGTH : 7; + u32 reserved0 : 5; + u32 CHANNEL : 2; + u32 TSTART : 1; + }; + + u32 reg; + } comscr; + + enabled = OSDisableInterrupts(); + + if (Si.chan != SI_CHAN_NONE) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + sr = SI_HW_REGS[SI_SISR]; + sr &= (SI_SISR_UNRUN0 | SI_SISR_OVRUN0 | SI_SISR_COLL0 | SI_SISR_NOREP0) >> + (chan * 8); + SI_HW_REGS[SI_SISR] = sr; + + Si.chan = chan; + Si.callback = callback; + Si.inSize = inSize; + Si.inAddr = inAddr; + + alignSize = (outSize + 3) / 4; + for (i = 0; i < alignSize; i++) { + SI_HW_REGS[SI_RAM_BASE + i] = ((u32*)outAddr)[i]; + } + + comscr.reg = SI_HW_REGS[SI_SICOMSCR]; + + comscr.TCINT = TRUE; + comscr.TCINTMSK = callback != NULL; + // Minimum transfer is 1 byte. 0x00 will transfer 128 bytes + comscr.OUTLNGTH = outSize == 128 ? 0 : outSize; + comscr.INLNGTH = inSize == 128 ? 0 : inSize; + comscr.CHANNEL = chan; + comscr.TSTART = TRUE; + + SI_HW_REGS[SI_SICOMSCR] = comscr.reg; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +u32 SISetXY(u32 lines, u32 times) { + BOOL enabled; + u32 poll; + + poll = lines << 16; + poll |= times << 8; + + enabled = OSDisableInterrupts(); + + Si.poll &= ~(SI_SIPOLL_X | SI_SIPOLL_Y); + Si.poll |= poll; + + poll = Si.poll; + SI_HW_REGS[SI_SIPOLL] = poll; + + OSRestoreInterrupts(enabled); + return poll; +} + +static void AlarmHandler(OSAlarm* alarm, OSContext* ctx) { + s32 chan; + SIPacket* packet; + + chan = alarm - Alarm; + packet = &Packet[chan]; + + if (packet->chan != SI_CHAN_NONE) { + if (__SITransfer(packet->chan, packet->outAddr, packet->outSize, + packet->inAddr, packet->inSize, packet->callback)) { + packet->chan = SI_CHAN_NONE; + } + } +} + +BOOL SITransfer(s32 chan, void* outAddr, u32 outSize, void* inAddr, u32 inSize, + SICallback callback, s64 wait) { + SIPacket* packet; + BOOL enabled; + s64 start; + s64 fire; + + packet = &Packet[chan]; + enabled = OSDisableInterrupts(); + + if (packet->chan != SI_CHAN_NONE || Si.chan == packet->chan) { + OSRestoreInterrupts(enabled); + return FALSE; + } + + start = __OSGetSystemTime(); + fire = wait == 0 ? start : wait + XferTime[chan]; + + if (start < fire) { + OSSetAlarm(&Alarm[chan], fire - start, AlarmHandler); + } else if (__SITransfer(chan, outAddr, outSize, inAddr, inSize, callback)) { + OSRestoreInterrupts(enabled); + return TRUE; + } + + packet->chan = chan; + packet->outAddr = outAddr; + packet->outSize = outSize; + packet->inAddr = inAddr; + packet->inSize = inSize; + packet->callback = callback; + packet->fire = fire; + + OSRestoreInterrupts(enabled); + return TRUE; +} + +// TODO +static void GetTypeCallback(s32 chan, u32 status) { + // static u32 cmdFixDevice[SI_MAX_CHAN]; + + // Type[chan] &= ~SI_ERROR_BUSY; + // Type[chan] |= status; + // TypeTime[chan] = __OSGetSystemTime(); +} + +// TODO +u32 SIGetType(s32 chan) { + ; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SISamplingRate.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SISamplingRate.c new file mode 100644 index 0000000000..fe2d32a976 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/SI/SISamplingRate.c @@ -0,0 +1,85 @@ +#include +#include +#include + +typedef struct SIPollSetting { + struct { + u16 lines; // at 0x0 + u8 times; // at 0x2 + } params[SI_MAX_SAMPLE_RATE + 1]; +} SIPollSetting; + +static u32 SamplingRate = 0; + +static SIPollSetting XYNTSC = { + // clang-format off + 246, 2, // 0 msec + 14, 19, // 1 msec + 30, 9, // 2 msec + 44, 6, // 3 msec + 52, 5, // 4 msec + 65, 4, // 5 msec + 87, 3, // 6 msec + 87, 3, // 7 msec + 87, 3, // 8 msec + 131, 2, // 9 msec + 131, 2, // 10 msec + 131, 2 // 11 msec + // clang-format on +}; + +static SIPollSetting XYPAL = { + // clang-format off + 296, 2, // 0 msec + 15, 21, // 1 msec + 29, 11, // 2 msec + 45, 7, // 3 msec + 52, 6, // 4 msec + 63, 5, // 5 msec + 78, 4, // 6 msec + 104, 3, // 7 msec + 104, 3, // 8 msec + 104, 3, // 9 msec + 104, 3, // 10 msec + 156, 2 // 11 msec + // clang-format on +}; + +void SISetSamplingRate(u32 msec) { + BOOL enabled; + SIPollSetting* xy; + s32 m; + + if (msec > SI_MAX_SAMPLE_RATE) { + msec = SI_MAX_SAMPLE_RATE; + } + + enabled = OSDisableInterrupts(); + + SamplingRate = msec; + + switch (VIGetTvFormat()) { + case VI_TV_FMT_NTSC: + case VI_TV_FMT_MPAL: + case VI_TV_FMT_EURGB60: + xy = &XYNTSC; + break; + case VI_TV_FMT_PAL: + xy = &XYPAL; + break; + default: + OSReport("SISetSamplingRate: unknown TV format. Use default."); + msec = 0; + xy = &XYNTSC; + break; + } + + m = (VI_HW_REGS[VI_VICLK] & VI_VICLK_SPEED) != VI_VICLK_27MHZ ? 2 : 1; + SISetXY(m * xy->params[msec].lines, xy->params[msec].times); + + OSRestoreInterrupts(enabled); +} + +void SIRefreshSamplingRate(void) { + SISetSamplingRate(SamplingRate); +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/TPL/TPL.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/TPL/TPL.c new file mode 100644 index 0000000000..f0521da38d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/TPL/TPL.c @@ -0,0 +1,50 @@ +#include +#include + +#define TPL_VERSION 0x0020AF30 + +void TPLBind(TPLPalette* pal) { + u16 i; + + // clang-format off +#line 25 + OS_ASSERT(pal->version == TPL_VERSION, "invalid version number for texture palette"); + // clang-format on + + pal->descriptors = (TPLDescriptor*)((char*)pal->descriptors + (u32)pal); + + for (i = 0; i < pal->numImages; i++) { + if (pal->descriptors[i].texHeader != NULL) { + // Convert header offset into pointer + pal->descriptors[i].texHeader = + (TPLHeader*)((char*)pal + (u32)pal->descriptors[i].texHeader); + + if (!pal->descriptors[i].texHeader->unpacked) { + // Convert data offset into pointer + pal->descriptors[i].texHeader->data = + (char*)pal + (u32)pal->descriptors[i].texHeader->data; + + pal->descriptors[i].texHeader->unpacked = TRUE; + } + } + + if (pal->descriptors[i].clutHeader != NULL) { + // Convert header offset into pointer + pal->descriptors[i].clutHeader = + (TPLClutHeader*)((char*)pal + + (u32)pal->descriptors[i].clutHeader); + + if (!pal->descriptors[i].clutHeader->unpacked) { + // Convert data offset into pointer + pal->descriptors[i].clutHeader->data = + (char*)pal + (u32)pal->descriptors[i].clutHeader->data; + + pal->descriptors[i].clutHeader->unpacked = TRUE; + } + } + } +} + +TPLDescriptor* TPLGet(TPLPalette* pal, u32 id) { + return &pal->descriptors[id % pal->numImages]; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/USB/usb.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/USB/usb.c new file mode 100644 index 0000000000..f530f79606 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/USB/usb.c @@ -0,0 +1,507 @@ +#include +#include +#include +#include + +#define USB_HEAP_SIZE 0x1000 + +typedef enum { + USB_NCLEAN_CLOSEDEVICE = 0, + USB_NCLEAN_BULKMSG = 3, + USB_NCLEAN_CTRLMSG = 7, + USB_NCLEAN_MAX = 8 +} USBNClean; + +typedef enum { + USB_IOCTLV_CTRLMSG, + USB_IOCTLV_BLKMSG, + USB_IOCTLV_INTRMSG +} USBIoctl; + +typedef struct USBMsg { + void* buffer; // at 0x0 + u16 length; // at 0x4 +} USBMsg; + +typedef struct USBCommandBlock { + USBCallback callback; // at 0x0 + void* callbackArg; // at 0x4 + char UNK_0x8[0x4]; + void* clean[USB_NCLEAN_MAX]; // at 0xC + u32 nclean; // at 0x2C + char UNK_0x30[0x40 - 0x30]; + union { + char path[FS_MAX_PATH]; + USBMsg msg; + }; // at 0x40 +} USBCommandBlock; + +static s32 hId = -1; + +static void* lo = NULL; +static void* hi = NULL; + +static u8 s_usb_log = FALSE; + +static void USB_LOG(const char* fmt, ...) { + va_list list; + + if (s_usb_log) { + OSReport("USB: "); + va_start(list, fmt); + vprintf(fmt, list); + va_end(list); + } +} + +static void USB_ERR(const char* fmt, ...) { + va_list list; + + if (s_usb_log) { + OSReport("USB ERR: "); + va_start(list, fmt); + vprintf(fmt, list); + va_end(list); + } +} + +static void* IOSAlloc(size_t size) { + void* mem; + + mem = iosAllocAligned(hId, size, 32); + + if (mem == NULL) { + USB_ERR("iosAllocAligned(%d, %u) failed: %d\n", hId, size, mem); + } + + return mem; +} + +static void IOSFree(void* mem) { + s32 result; + + if (mem != NULL) { + result = iosFree(hId, mem); + + if (result < 0) { + USB_ERR("iosFree(%d, 0x%x) failed: %d\n", hId, mem, result); + } + } +} + +IPCResult IUSB_OpenLib(void) { + IPCResult result; + BOOL enabled; + + result = IPC_RESULT_OK; + enabled = OSDisableInterrupts(); + + if (hId != -1) { + USB_LOG("Library is already initialized. Heap Id = %d\n", hId); + goto end; + } + + if (lo == NULL) { + lo = IPCGetBufferLo(); + hi = IPCGetBufferHi(); + + USB_LOG("iusb size: %d lo: %x hi: %x\n", sizeof(USBCommandBlock), lo, + hi); + + if ((u8*)lo + USB_HEAP_SIZE > hi) { + USB_ERR("Not enough IPC arena\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + IPCSetBufferLo((u8*)lo + USB_HEAP_SIZE); + } + + hId = iosCreateHeap(lo, USB_HEAP_SIZE); + if (hId < 0) { + USB_ERR("Not enough heaps\n"); + result = IPC_RESULT_ALLOC_FAILED; + } + +end: + OSRestoreInterrupts(enabled); + return result; +} + +IPCResult IUSB_CloseLib(void) { + return IPC_RESULT_OK; +} + +static s32 _intBlkCtrlCb(s32 result, void* arg) { + int i; + USBCommandBlock* block = (USBCommandBlock*)arg; + + USB_LOG("_intrBlkCtrlCb returned: %d\n", result); + USB_LOG("_intrBlkCtrlCb: nclean = %d\n", block->nclean); + + if (block->nclean != USB_NCLEAN_CTRLMSG && + block->nclean != USB_NCLEAN_BULKMSG && + block->nclean != USB_NCLEAN_CLOSEDEVICE) { + USB_ERR("__intBlkCtrlCb: got invalid nclean\n"); + } else { + for (i = 0; i < block->nclean; i++) { + USB_LOG("Freeing clean[%d] = %x\n", i, block->clean[i]); + IOSFree(block->clean[i]); + } + } + + USB_LOG("cb = %x cbArg = %x\n", block->callback, block->callbackArg); + + if (block->callback != NULL) { + block->callback(result, block->callbackArg); + } + + IOSFree(block); + return result; +} + +IPCResult IUSB_OpenDeviceIds(const char* interface, u16 vid, u16 pid, + IPCResult* resultOut) { + IPCResult result; + USBCommandBlock* block; + + block = NULL; + + if (resultOut == NULL) { + result = IPC_RESULT_INVALID_INTERNAL; + goto end; + } + + block = IOSAlloc(sizeof(USBCommandBlock)); + if (block == NULL) { + USB_ERR("OpenDeviceIds: Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + snprintf(block->path, sizeof(block->path), "/dev/usb/%s/%x/%x", interface, + vid, pid); + USB_LOG("OpenDevice - %s\n", block->path); + + result = IOS_Open(block->path, IPC_OPEN_NONE); + USB_LOG("OpenDevice returned: %d\n", result); + + *resultOut = result; + +end: + IOSFree(block); + return result; +} + +// clang-format off +DECOMP_FORCEACTIVE(usb_c, + "OpenDevice\n", + "OpenDeviceIdsAsync: Not enough memory\n", + "CloseDevice\n", + "CloseDevice returned: %d\n"); +// clang-format on + +IPCResult IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, + void* callbackArg) { + IPCResult result; + USBCommandBlock* block; + + USB_LOG("CloseDevice\n"); + + block = IOSAlloc(sizeof(USBCommandBlock)); + if (block == NULL) { + USB_ERR("CloseDeviceAsync: Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + block->callback = callback; + block->callbackArg = callbackArg; + block->nclean = USB_NCLEAN_CLOSEDEVICE; + + result = IOS_CloseAsync(fd, _intBlkCtrlCb, block); + USB_LOG("CloseDevice returned: %d\n", result); + + if (result < 0) { + IOSFree(block); + } + +end: + return result; +} + +// clang-format off +DECOMP_FORCEACTIVE(usb_c, + "openDevice: Not enough memory\n", + "getDeviceList: Not enough memory\n"); +// clang-format on + +static IPCResult __IntrBlkMsgInt(s32 fd, u32 endpoint, u32 length, void* buffer, + u8 ioctl, USBCallback callback, + void* callbackArg, u8 async) { + IPCResult result; + IPCIOVector* vectors; + u8* endpointWork; + u16* lengthWork; + USBCommandBlock* block; + + vectors = (IPCIOVector*)IOSAlloc(0x60); + endpointWork = (u8*)IOSAlloc(32); + lengthWork = (u16*)IOSAlloc(32); + + if (vectors == NULL || endpointWork == NULL || lengthWork == NULL) { + USB_ERR("__IntrBlkMsgInt: Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + *endpointWork = (u8)endpoint; + *lengthWork = (u16)length; + + // Input vector 1: Transfer endpoint + vectors[0].base = endpointWork; + vectors[0].length = sizeof(u8); + + // Input vector 2: Transfer length + vectors[1].base = lengthWork; + vectors[1].length = sizeof(u16); + + // Output vector 1: Transfer buffer + vectors[2].base = buffer; + vectors[2].length = length; + + DCFlushRange(endpointWork, 32); + DCFlushRange(lengthWork, 32); + DCFlushRange(vectors, 0x60); + + if (!async) { + result = IOS_Ioctlv(fd, ioctl, 2, 1, vectors); + USB_LOG("intr/blk ioctl returned: %d\n", result); + goto end; + } + + block = IOSAlloc(sizeof(USBCommandBlock)); + if (block == NULL) { + USB_ERR("IntBlkMsgInt (async): Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + block->callback = callback; + block->callbackArg = callbackArg; + USB_LOG("intrblkmsg: cb = 0x%x cbArg = 0x%x\n", block->callback, + block->callbackArg); + + // Mark memory for deletion + block->nclean = USB_NCLEAN_BULKMSG; + block->clean[0] = endpointWork; + block->clean[1] = lengthWork; + block->clean[2] = vectors; + + block->msg.buffer = buffer; + block->msg.length = length; + + result = IOS_IoctlvAsync(fd, ioctl, 2, 1, vectors, _intBlkCtrlCb, block); + if (result >= IPC_RESULT_OK) { + goto end_async; + } + + IOSFree(block); + +// Non-async (or unsuccessful async) means we must manually free memory +end: + IOSFree(endpointWork); + IOSFree(lengthWork); + IOSFree(vectors); + +// Async callback automatically freed the memory marked in block->clean +end_async: + return result; +} + +IPCResult IUSB_ReadIntrMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, + USBCallback callback, void* callbackArg) { + DCInvalidateRange(buffer, length); + return __IntrBlkMsgInt(fd, endpoint, length, buffer, USB_IOCTLV_INTRMSG, + callback, callbackArg, TRUE); +} + +IPCResult IUSB_ReadBlkMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, + USBCallback callback, void* callbackArg) { + DCInvalidateRange(buffer, length); + return __IntrBlkMsgInt(fd, endpoint, length, buffer, USB_IOCTLV_BLKMSG, + callback, callbackArg, TRUE); +} + +IPCResult IUSB_WriteBlkMsgAsync(s32 fd, u32 endpoint, u32 length, + const void* buffer, USBCallback callback, + void* callbackArg) { + DCFlushRange(buffer, length); + return __IntrBlkMsgInt(fd, endpoint, length, (void*)buffer, + USB_IOCTLV_BLKMSG, callback, callbackArg, TRUE); +} + +static IPCResult __CtrlMsgInt(s32 fd, u8 requestType, u8 request, u16 value, + u16 index, u16 length, void* buffer, + USBCallback callback, void* callbackArg, + u8 async) { + IPCResult result; + IPCIOVector* vectors; + u8* requestTypeWork; + u8* requestWork; + u8* unkWork; + u16* valueWork; + u16* indexWork; + u16* lengthWork; + USBCommandBlock* block; + + if ((buffer == NULL && length != 0) || (u32)buffer % 32 != 0) { + result = IPC_RESULT_INVALID_INTERNAL; + USB_ERR("ctrlmsg: bad data buffer\n"); + goto end_async; + } + + vectors = (IPCIOVector*)IOSAlloc(0xE0); + requestTypeWork = (u8*)IOSAlloc(32); + requestWork = (u8*)IOSAlloc(32); + unkWork = (u8*)IOSAlloc(32); + valueWork = (u16*)IOSAlloc(32); + indexWork = (u16*)IOSAlloc(32); + lengthWork = (u16*)IOSAlloc(32); + + if (requestTypeWork == NULL || requestWork == NULL || unkWork == NULL || + valueWork == NULL || indexWork == NULL || lengthWork == NULL || + vectors == NULL) { + USB_ERR("Ctrl Msg: Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + *requestTypeWork = requestType; + *requestWork = request; + *valueWork = (value & 0xFF) << 8 | value >> 8 & 0xFF; + *indexWork = (index & 0xFF) << 8 | index >> 8 & 0xFF; + *lengthWork = (length & 0xFF) << 8 | length >> 8 & 0xFF; + *unkWork = 0; + + // Input vector 1: bmRequestType + vectors[0].base = requestTypeWork; + vectors[0].length = sizeof(u8); + + // Input vector 2: bmRequest + vectors[1].base = requestWork; + vectors[1].length = sizeof(u8); + + // Input vector 3: wValue + vectors[2].base = valueWork; + vectors[2].length = sizeof(u16); + + // Input vector 4: wIndex + vectors[3].base = indexWork; + vectors[3].length = sizeof(u16); + + // Input vector 5: wLength + vectors[4].base = lengthWork; + vectors[4].length = sizeof(u16); + + // Input vector 6: Unknown data + vectors[5].base = unkWork; + vectors[5].length = sizeof(u8); + + // Output vector 1: Transfer buffer + vectors[6].base = buffer; + vectors[6].length = length; + + DCFlushRange(requestTypeWork, 32); + DCFlushRange(requestWork, 32); + DCFlushRange(unkWork, 32); + DCFlushRange(valueWork, 32); + DCFlushRange(indexWork, 32); + DCFlushRange(lengthWork, 32); + DCFlushRange(vectors, 0xE0); + + if (!async) { + result = IOS_Ioctlv(fd, USB_IOCTLV_CTRLMSG, 6, 1, vectors); + goto end; + } + + block = IOSAlloc(sizeof(USBCommandBlock)); + if (block == NULL) { + USB_ERR("CtrlMsgInt (async): Not enough memory\n"); + result = IPC_RESULT_ALLOC_FAILED; + goto end; + } + + block->callback = callback; + block->callbackArg = callbackArg; + USB_LOG("ctrlmsgint: cb = 0x%x cbArg = 0x%x\n", block->callback, + block->callbackArg); + + // Mark memory for deletion + block->nclean = USB_NCLEAN_CTRLMSG; + block->clean[0] = requestTypeWork; + block->clean[1] = requestWork; + block->clean[2] = valueWork; + block->clean[3] = indexWork; + block->clean[4] = lengthWork; + block->clean[5] = unkWork; + block->clean[6] = vectors; + + block->msg.buffer = buffer; + block->msg.length = length; + + result = IOS_IoctlvAsync(fd, USB_IOCTLV_CTRLMSG, 6, 1, vectors, + _intBlkCtrlCb, block); + USB_LOG("Ctrl Msg async returned: %d\n", result); + + if (result >= IPC_RESULT_OK) { + goto end_async; + } + + IOSFree(block); + +// Non-async (or unsuccessful async) means we must manually free memory +end: + IOSFree(requestTypeWork); + IOSFree(requestWork); + IOSFree(valueWork); + IOSFree(indexWork); + IOSFree(lengthWork); + IOSFree(unkWork); + IOSFree(vectors); + +// Async callback automatically freed the memory marked in block->clean +end_async: + return result; +} + +IPCResult IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, + u16 index, u16 length, void* buffer, + USBCallback callback, void* callbackArg) { + DCFlushRange(buffer, length); + return __CtrlMsgInt(fd, requestType, request, value, index, length, buffer, + callback, callbackArg, TRUE); +} + +// clang-format off +DECOMP_FORCEACTIVE(usb_c, + "GetStrCb returned: %d\n", + "GetStrCb: buf = 0x%x buflen = %u\n", + "Failed to convert buffer from unicode 2 ascii\n", + "calling cb 0x%x with arg 0x%x\n", + "Failed __CtrlMsg: %d", + "Failed to convert unicode 2 ascii\n", + "GetStr - _GetStrCb\n", + " GetAsciiStrAsync: Not enough memory\n", + "__CtrlMsgInt failed %d\n", + "GetDescrCb returned: %d\n", + "GetDevDescr\n", + "GetDevDescr: Not enough memory\n", + "GetDevDescr: %d\n", + "GetDevDescr - _GetDescrCb\n", + "GetDevDescrAsync: Not enough memory\n", + "DeviceRemovalNotifyAsync\n", + "Invalid parameters for ISO transfer request\n", + "IUSB_IsoMsgAsync: Not enough memory\n", + "Open(%s) failed\n"); +// clang-format on diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_clib.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_clib.c new file mode 100644 index 0000000000..ba83d06e69 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_clib.c @@ -0,0 +1,97 @@ +#include + +int VFipf_toupper(int c) { + if (c >= 'a' && c <= 'z') { + return c - ('a' - 'A'); + } + + return c; +} + +void* VFipf_memcpy(void* dst, const void* src, size_t n) { + // Preserve original pointer + void* work_dst = dst; + + // Word-aligned copy + if ((u32)work_dst % 4 == 0 && (u32)src % 4 == 0) { + for (; n > 3; n -= 4) { + *((u32*)work_dst)++ = *((u32*)src)++; + } + } + + // Unaligned copy + for (; n > 0; n--) { + *((u8*)work_dst)++ = *((u8*)src)++; + } + + return dst; +} + +void* VFipf_memset(void* dst, int ch, size_t n) { + // Preserve original pointer + void* work_dst = dst; + + // Align dest pointer + for (; (u32)work_dst % 4 != 0 && n > 0; n--) { + *((u8*)work_dst)++ = ch; + } + + // Word aligned store + for (; n > 3; n -= 4) { + *((u32*)work_dst)++ = ch << 24 | ch << 16 | ch << 8 | ch; + } + + // Unaligned store + for (; n > 0; n--) { + *((u8*)work_dst)++ = ch; + } + + return dst; +} + +size_t VFipf_strlen(const char* str) { + const char* it = str; + + // Find end of string + for (; *it != '\0'; it++) { + ; + } + + // Calculate size + return (uintptr_t)it - (uintptr_t)str; +} + +char* VFipf_strcpy(char* dst, const char* src) { + // Preserve original pointer + char* work_dst = dst; + + for (; *work_dst = *src, *work_dst != '\0'; src++, work_dst++) { + ; + } + + return dst; +} + +int VFipf_strcmp(const char* s1, const char* s2) { + const u8* b1 = (const u8*)s1; + const u8* b2 = (const u8*)s2; + + for (; *b1 != '\0' && *b2 != '\0' && *b1 == *b2; b1++, b2++) { + ; + } + + return *b1 - *b2; +} + +int VFipf_strncmp(const char* s1, const char* s2, size_t n) { + const u8* b1 = (const u8*)s1; + const u8* b2 = (const u8*)s2; + + for (; n > 0; n--, b1++, b2++) { + if (*b1 == '\0' || *b2 == '\0' || *b1 != *b2) { + return *b1 - *b2; + } + } + + return 0; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_code.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_code.c new file mode 100644 index 0000000000..e18f8f4c48 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_code.c @@ -0,0 +1,109 @@ +#include + +int VFiPFCODE_Combine_Width(s16 oem_width, s16 uni_width) { + return (oem_width << 16) + uni_width; +} + +void VFiPFCODE_Divide_Width(u32 width, s16* oem_width, s16* uni_width) { + *oem_width = width >> 16; + *uni_width = width; +} + +const u8 VFipf_valid_fn_char[VF_FN_MAX_CHAR - VF_FN_MIN_CHAR] = { + PFCODE_FN_VALID_LONG, //!< (Space) + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ! + PFCODE_FN_INVALID, //!< " + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< # + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< $ + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< % + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< & + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ' + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ( + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ) + PFCODE_FN_INVALID, //!< * + PFCODE_FN_VALID_LONG, //!< + + PFCODE_FN_VALID_LONG, //!< , + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< - + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< . + PFCODE_FN_INVALID, //!< / + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 0 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 1 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 2 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 3 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 4 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 5 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 6 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 7 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 8 + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< 9 + PFCODE_FN_INVALID, //!< : + PFCODE_FN_VALID_LONG, //!< ; + PFCODE_FN_INVALID, //!< < + PFCODE_FN_VALID_LONG, //!< = + PFCODE_FN_INVALID, //!< > + PFCODE_FN_INVALID, //!< ? + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< @ + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< A + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< B + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< C + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< D + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< E + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< F + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< G + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< H + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< I + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< J + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< K + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< L + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< M + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< N + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< O + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< P + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< Q + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< R + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< S + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< T + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< U + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< V + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< W + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< X + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< Y + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< Z + PFCODE_FN_VALID_LONG, //!< [ + PFCODE_FN_INVALID, //!< \ (Backslash) + PFCODE_FN_VALID_LONG, //!< ] + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ^ + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< _ + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ` + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< a + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< b + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< c + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< d + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< e + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< f + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< g + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< h + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< i + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< j + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< k + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< l + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< m + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< n + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< o + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< p + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< q + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< r + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< s + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< t + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< u + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< v + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< w + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< x + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< y + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< z + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< { + PFCODE_FN_INVALID, //!< | + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< } + (PFCODE_FN_VALID_LONG | PFCODE_FN_VALID_SHORT), //!< ~ + PFCODE_FN_INVALID //!< DEL +}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_service.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_service.c new file mode 100644 index 0000000000..6156ecb6a8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_service.c @@ -0,0 +1,13 @@ +#include + +u16 VFiPF_GET_LE_U16(const u8* buf) { return buf[0] | buf[1] << 8; } + +void VFiPF_LE16_TO_U16_STR(u8* str, u32 n) { + u32 i; + + for (i = 0; i < n; i += sizeof(u16)) { + const char tmp = str[i]; + str[i] = str[i + 1]; + str[i + 1] = tmp; + } +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_str.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_str.c new file mode 100644 index 0000000000..696233e794 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_str.c @@ -0,0 +1,187 @@ +#include + +void VFiPFSTR_SetCodeMode(PF_STR* str, u32 mode) { str->mode = mode; } + +u32 VFiPFSTR_GetCodeMode(PF_STR* str) { return str->mode; } + +void VFiPFSTR_SetLocalStr(PF_STR* str, char* local) { + if (VFiPFSTR_GetCodeMode(str) == PFSTR_CODEMODE_OEM || local == NULL) { + str->local = str->head; + } else { + str->local = local; + } +} + +char* VFiPFSTR_GetStrPos(PF_STR* str, u32 target) { + if (target == PFSTR_CODEMODE_OEM) { + return (char*)str->head; + } + + if (target == PFSTR_CODEMODE_UNICODE) { + return (char*)str->tail; + } + + return (char*)str->local; +} + +void VFiPFSTR_MoveStrPos(PF_STR* str, s16 n) { + s16 i; + s16 dist = 0; + + if (VFiPFSTR_GetCodeMode(str) == PFSTR_CODEMODE_OEM) { + const char* data = (const char*)str->head; + + for (; n != 0; dist++, n--) { + if (VFipf_vol_set.codeset.is_oem_mb_char(*data, 1)) { + dist++; + } + } + } else { + wchar_t* data = (wchar_t*)str->head; + + for (i = 0; i < n; i++) { + const size_t width = VFipf_vol_set.codeset.unicode_char_width(data); + data += width; + dist += (s16)width; + } + } + + str->head += dist; +} + +s32 VFiPFSTR_InitStr(PF_STR* str, const char* s, u32 mode) { + if (str == NULL || s == NULL) { + return PF_RESULT_INVALID; + } + + if (mode == PFSTR_CODEMODE_OEM) { + str->head = s; + str->tail = s + VFipf_strlen(s); + } else if (mode == PFSTR_CODEMODE_UNICODE) { + str->head = s; + str->tail = s + VFipf_w_strlen((wchar_t*)s) * sizeof(wchar_t); + } else { + return PF_RESULT_INVALID; + } + + VFiPFSTR_SetCodeMode(str, mode); + return PF_RESULT_OK; +} + +u16 VFiPFSTR_StrLen(PF_STR* str) { + return (uintptr_t)str->tail - (uintptr_t)str->head; +} + +u16 VFiPFSTR_StrNumChar(PF_STR* str, u32 target) { + const char* data; + size_t width; + u16 length; + + if (target == PFSTR_CODEMODE_OEM) { + data = str->head; + } else { + data = str->tail; + } + + if (VFiPFSTR_GetCodeMode(str) == PFSTR_CODEMODE_OEM) { + length = 0; + for (; *data != '\0'; data++, length++) { + if (VFipf_vol_set.codeset.is_oem_mb_char(*data, + PFSTR_CODEMODE_OEM)) { + data++; + } + } + } else { + length = 0; + for (; data[0] != '\0' || data[1] != '\0'; data += width, length++) { + width = VFipf_vol_set.codeset.unicode_char_width((wchar_t*)data); + } + } + + return length; +} + +s32 VFiPFSTR_StrCmp(const PF_STR* str, const char* cmp) { + const wchar_t* data; + wchar_t out; + + if (VFiPFSTR_GetCodeMode((PF_STR*)str) == PFSTR_CODEMODE_OEM) { + return VFipf_strcmp(str->head, cmp); + } + + data = (const wchar_t*)str->head; + do { + VFipf_vol_set.codeset.oem2unicode((char*)cmp, &out); + cmp++; + } while (*data++ == out && data[-1] != L'\0' && out != L'\0'); + + return data[-1] - out; +} + +int VFiPFSTR_StrNCmp(PF_STR* str, const char* cmp, u32 target, s16 offset, + u16 n) { + const wchar_t* wdata; + const char* data; + wchar_t out; + + if (VFiPFSTR_GetCodeMode(str) == PFSTR_CODEMODE_OEM || + target == PFSTR_CODEMODE_LOCAL) { + + if (target == PFSTR_CODEMODE_OEM) { + data = str->head + offset; + } else if (target == PFSTR_CODEMODE_UNICODE) { + data = str->tail + offset; + } else { + data = str->local + offset; + } + + return VFipf_strncmp(data, cmp, n); + } + + if (target == PFSTR_CODEMODE_OEM) { + wdata = (wchar_t*)(str->head + offset * sizeof(wchar_t)); + } else { + wdata = (wchar_t*)(str->tail + offset * sizeof(wchar_t)); + } + + do { + VFipf_vol_set.codeset.oem2unicode((char*)cmp, &out); + cmp++; + n--; + } while (*wdata++ == out && n > 0 && wdata[-1] != L'\0' && out != L'\0'); + + return wdata[-1] - out; +} + +void VFiPFSTR_ToUpperNStr(PF_STR* str, u16 n, char* out) { + const char* data; + const wchar_t* wdata; + u32 ch; + BOOL letter; + + if (str->mode == PFSTR_CODEMODE_OEM) { + for (data = (const char*)str->head; n > 0 && *data != '\0'; + data++, n--) { + *out++ = VFipf_toupper(*data); + } + } else { + for (wdata = (const wchar_t*)str->head; n > 0 && *wdata != L'\0'; + n--, wdata++) { + letter = *wdata >= 'a' && *wdata <= 'z'; + + if (letter) { + ch = *wdata - ('a' - 'A'); + } else { + ch = *wdata; + } + + out[0] = ch >> 0 & 0xFF; + out[1] = ch >> 8 & 0xFF; + out += sizeof(wchar_t); + } + + *out = '\0'; + } + + *out = '\0'; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_w_clib.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_w_clib.c new file mode 100644 index 0000000000..af17f287b5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/VF/pf_w_clib.c @@ -0,0 +1,37 @@ +#include + +size_t VFipf_w_strlen(const wchar_t* str) { + const wchar_t* it = str; + ptrdiff_t diff; + + // Find end of string + for (; *it != L'\0'; it++) { + ; + } + + // Calculate size + diff = (uintptr_t)it - (uintptr_t)str; + return diff >> 1; +} + +wchar_t* VFipf_w_strcpy(wchar_t* dst, const wchar_t* src) { + // Preserve original pointer + wchar_t* work_dst = dst; + + for (; *work_dst = *src, *work_dst != L'\0'; src++, work_dst++) { + ; + } + + return dst; +} + +int VFipf_w_strncmp(const wchar_t* s1, const wchar_t* s2, size_t n) { + + for (; n > 0; n--, s1++, s2++) { + if (*s1 == '\0' || *s2 == '\0' || *s1 != *s2) { + return *s1 - *s2; + } + } + + return 0; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/revolution/WENC/wenc.c b/include/lib/BrawlHeaders/OpenRVL/src/revolution/WENC/wenc.c new file mode 100644 index 0000000000..9ffdf9c68d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/revolution/WENC/wenc.c @@ -0,0 +1,121 @@ +#include +#include + +s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pcmData, s32 samples, + u8* adpcmData) { + const f64 table[] = {0.89843750, 0.89843750, 0.89843750, 0.89843750, + 1.19921875, 1.59765625, 2.00000000, 2.39843750}; + + u8* dst; + const s16* src; + int i; + s32 da; + s32 l3, l2, l1, l0; + s32 dlx; + s32 xnc; + s32 offset; + s32 index; + s32 encodeSize; + s32 xn; + s32 dl; + s32 qn; + s32 dn; + s32 dlh; + s32 dlq; + u8 by; + + encodeSize = (samples + 1) / 2; + memset(adpcmData, 0, encodeSize); + + src = pcmData; + dst = adpcmData; + + if ((flag & WENC_FLAG_USER_INFO) == 0) { + xn = 0; + dl = 127; + qn = 0; + dn = 0; + dlh = 0; + dlq = 0; + } else { + xn = info->xn; + dl = info->dl; + qn = info->qn; + dn = info->dn; + dlh = info->dlh; + dlq = info->dlq; + } + + for (i = 0; i < samples; i++) { + l0 = 0; + l1 = 0; + l2 = 0; + l3 = 0; + + da = *src++; + if (da < xn) { + l3 = 1; + } + + dn = __abs(da - xn); + if (dn >= dl) { + l2 = 1; + dn -= dl; + } + + dlh = dl / 2; + if (dn >= dlh) { + l1 = 1; + dn -= dlh; + } + + dlq = dlh / 2; + if (dn >= dlq) { + l0 = 1; + dn -= dlq; + } + + dlx = dlq / 2; + qn = (1 - l3 * 2) * (dl * l2 + dlh * l1 + dlq * l0 + dlx); + + if (qn > 0xFFFF) { + qn = 0xFFFF; + } + if (qn < -0x10000) { + qn = -0x10000; + } + + xnc = xn + qn; + if (xnc > 0x7FFF) { + xnc = 0x7FFF; + } + if (xnc < -0x8000) { + xnc = -0x8000; + } + + xn = xnc; + offset = (i & 1) == 0 ? 4 : 0; + + by = l3 * 8 + l2 * 4 + l1 * 2 + l0; + dst[i / 2] |= by << offset; + + index = l2 * 4 + l1 * 2 + l0; + dl *= table[index]; + + if (dl <= 127) { + dl = 127; + } + if (dl >= 0x6000) { + dl = 0x6000; + } + } + + info->xn = xn; + info->dl = dl; + info->qn = qn; + info->dn = dn; + info->dlh = dlh; + info->dlq = dlq; + + return samples; +} diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_acos.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_acos.c new file mode 100644 index 0000000000..21bcdef218 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_acos.c @@ -0,0 +1,109 @@ + +/* @(#)e_acos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_acos(x) + * Method : + * acos(x) = pi/2 - asin(x) + * acos(-x) = pi/2 + asin(x) + * For |x|<=0.5 + * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) + * For x>0.5 + * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) + * = 2asin(sqrt((1-x)/2)) + * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) + * = 2f + (2c + 2s*z*R(z)) + * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term + * for f so that f+c ~ sqrt(z). + * For x<-0.5 + * acos(x) = pi - 2asin(sqrt((1-|x|)/2)) + * = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + * Function needed: sqrt + */ + +#include +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif + one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ + pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ + pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ + pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ + pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ + pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ + pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ + pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ + pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ + qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ + qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ + qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ + qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ +double __ieee754_acos(double x) +#else +double __ieee754_acos(x) +double x; +#endif +{ + double z, p, q, r, w, s, c, df; + int hx, ix; + hx = __HI(x); + ix = hx & 0x7fffffff; + if (ix >= 0x3ff00000) { /* |x| >= 1 */ + if (((ix - 0x3ff00000) | __LO(x)) == 0) { /* |x|==1 */ + if (hx > 0) + return 0.0; /* acos(1) = 0 */ + else + return pi + 2.0 * pio2_lo; /* acos(-1)= pi */ + } + return NAN; /* acos(|x|>1) is NaN */ + } + if (ix < 0x3fe00000) { /* |x| < 0.5 */ + if (ix <= 0x3c600000) + return pio2_hi + pio2_lo; /*if|x|<2**-57*/ + z = x * x; + p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5))))); + q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4))); + r = p / q; + return pio2_hi - (x - (pio2_lo - x * r)); + } else if (hx < 0) { /* x < -0.5 */ + z = (one + x) * 0.5; + p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5))))); + q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4))); + s = sqrt(z); + r = p / q; + w = r * s - pio2_lo; + return pi - 2.0 * (s + w); + } else { /* x > 0.5 */ + z = (one - x) * 0.5; + s = sqrt(z); + df = s; + __LO(df) = 0; + c = (z - df * df) / (s + df); + p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5))))); + q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4))); + r = p / q; + w = r * s + c; + return 2.0 * (df + w); + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_asin.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_asin.c new file mode 100644 index 0000000000..1b5c4c1360 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_asin.c @@ -0,0 +1,118 @@ + +/* @(#)e_asin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_asin(x) + * Method : + * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... + * we approximate asin(x) on [0,0.5] by + * asin(x) = x + x*x^2*R(x^2) + * where + * R(x^2) is a rational approximation of (asin(x)-x)/x^3 + * and its remez error is bounded by + * |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75) + * + * For x in [0.5,1] + * asin(x) = pi/2-2*asin(sqrt((1-x)/2)) + * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2; + * then for x>0.98 + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) + * For x<=0.98, let pio4_hi = pio2_hi/2, then + * f = hi part of s; + * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) + * and + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) + * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + */ + +#include +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif + one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + huge = 1.000e+300, + pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ + pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ + pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ + /* coefficient for R(x^2) */ + pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ + pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ + pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ + pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ + pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ + pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ + qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ + qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ + qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ + qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ +double __ieee754_asin(double x) +#else +double __ieee754_asin(x) +double x; +#endif +{ + double t, w, p, q, c, r, s; + int hx, ix; + hx = __HI(x); + ix = hx & 0x7fffffff; + if (ix >= 0x3ff00000) { /* |x|>= 1 */ + if (((ix - 0x3ff00000) | __LO(x)) == 0) + /* asin(1)=+-pi/2 with inexact */ + return x * pio2_hi + x * pio2_lo; + return NAN; /* asin(|x|>1) is NaN */ + } else if (ix < 0x3fe00000) { /* |x|<0.5 */ + if (ix < 0x3e400000) { /* if |x| < 2**-27 */ + if (huge + x > one) + return x; /* return x with inexact if x!=0*/ + } else + t = x * x; + p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5))))); + q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4))); + w = p / q; + return x + x * w; + } + /* 1> |x|>= 0.5 */ + w = one - fabs(x); + t = w * 0.5; + p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5))))); + q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4))); + s = sqrt(t); + if (ix >= 0x3FEF3333) { /* if |x| > 0.975 */ + w = p / q; + t = pio2_hi - (2.0 * (s + s * w) - pio2_lo); + } else { + w = s; + __LO(w) = 0; + c = (t - w * w) / (s + w); + r = p / q; + p = 2.0 * s * r - (pio2_lo - 2.0 * c); + q = pio4_hi - 2.0 * w; + t = pio4_hi - (p - q); + } + if (hx > 0) + return t; + else + return -t; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_atan2.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_atan2.c new file mode 100644 index 0000000000..140f515c2a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_atan2.c @@ -0,0 +1,145 @@ + +/* @(#)e_atan2.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_atan2(y,x) + * Method : + * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). + * 2. Reduce x to positive by (if x and y are unexceptional): + * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, + * + * Special cases: + * + * ATAN2((anything), NaN ) is NaN; + * ATAN2(NAN , (anything) ) is NaN; + * ATAN2(+-0, +(anything but NaN)) is +-0 ; + * ATAN2(+-0, -(anything but NaN)) is +-pi ; + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; + * ATAN2(+-INF,+INF ) is +-pi/4 ; + * ATAN2(+-INF,-INF ) is +-3pi/4; + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif + tiny = 1.0e-300, + zero = 0.0, pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ + pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ + pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ + pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ + +#ifdef __STDC__ +double __ieee754_atan2(double y, double x) +#else +double __ieee754_atan2(y, x) +double y, x; +#endif +{ + double z; + int k, m, hx, hy, ix, iy; + unsigned lx, ly; + + hx = __HI(x); + ix = hx & 0x7fffffff; + lx = __LO(x); + hy = __HI(y); + iy = hy & 0x7fffffff; + ly = __LO(y); + if (((ix | ((lx | -lx) >> 31)) > 0x7ff00000) || + ((iy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* x or y is NaN */ + return x + y; + if ((hx - 0x3ff00000 | lx) == 0) + return atan(y); /* x=1.0 */ + m = ((hy >> 31) & 1) | ((hx >> 30) & 2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if ((iy | ly) == 0) { + switch (m) { + case 0: + case 1: + return y; /* atan(+-0,+anything)=+-0 */ + case 2: + return pi + tiny; /* atan(+0,-anything) = pi */ + case 3: + return -pi - tiny; /* atan(-0,-anything) =-pi */ + } + } + /* when x = 0 */ + if ((ix | lx) == 0) + return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny; + + /* when x is INF */ + if (ix == 0x7ff00000) { + if (iy == 0x7ff00000) { + switch (m) { + case 0: + return pi_o_4 + tiny; /* atan(+INF,+INF) */ + case 1: + return -pi_o_4 - tiny; /* atan(-INF,+INF) */ + case 2: + return 3.0 * pi_o_4 + tiny; /*atan(+INF,-INF)*/ + case 3: + return -3.0 * pi_o_4 - tiny; /*atan(-INF,-INF)*/ + } + } else { + switch (m) { + case 0: + return zero; /* atan(+...,+INF) */ + case 1: + return -zero; /* atan(-...,+INF) */ + case 2: + return pi + tiny; /* atan(+...,-INF) */ + case 3: + return -pi - tiny; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if (iy == 0x7ff00000) + return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny; + + /* compute y/x */ + k = (iy - ix) >> 20; + if (k > 60) + z = pi_o_2 + 0.5 * pi_lo; /* |y/x| > 2**60 */ + else if (hx < 0 && k < -60) + z = 0.0; /* |y|/x < -2**60 */ + else + z = atan(fabs(y / x)); /* safe to do y/x */ + switch (m) { + case 0: + return z; /* atan(+,+) */ + case 1: + __HI(z) ^= 0x80000000; + return z; /* atan(-,+) */ + case 2: + return pi - (z - pi_lo); /* atan(+,-) */ + default: /* case 3 */ + return (z - pi_lo) - pi; /* atan(-,-) */ + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_fmod.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_fmod.c new file mode 100644 index 0000000000..cb7a54617f --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_fmod.c @@ -0,0 +1,140 @@ + +/* @(#)e_fmod.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __ieee754_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include + +#ifdef __STDC__ +static const double one = 1.0, Zero[] = {0.0, -0.0,}; +#else +static double one = 1.0, Zero[] = {0.0, -0.0,}; +#endif + +#ifdef __STDC__ + double __ieee754_fmod(double x, double y) +#else + double __ieee754_fmod(x,y) + double x,y ; +#endif +{ + int n,hx,hy,hz,ix,iy,sx,i; + unsigned lx,ly,lz; + + hx = __HI(x); /* high word of x */ + lx = __LO(x); /* low word of x */ + hy = __HI(y); /* high word of y */ + ly = __LO(y); /* low word of y */ + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ + ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x00100000) { /* subnormal x */ + if(hx==0) { + for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } + } else ix = (hx>>20)-1023; + + /* determine iy = ilogb(y) */ + if(hy<0x00100000) { /* subnormal y */ + if(hy==0) { + for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } + } else iy = (hy>>20)-1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -1022) + hx = 0x00100000|(0x000fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + if(n<=31) { + hx = (hx<>(32-n)); + lx <<= n; + } else { + hx = lx<<(n-32); + lx = 0; + } + } + if(iy >= -1022) + hy = 0x00100000|(0x000fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + if(n<=31) { + hy = (hy<>(32-n)); + ly <<= n; + } else { + hy = ly<<(n-32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(unsigned)sx>>31]; + hx = hz+hz+(lz>>31); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=0) {hx=hz;lx=lz;} + + /* convert back to floating value and restore the sign */ + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(unsigned)sx>>31]; + while(hx<0x00100000) { /* normalize x */ + hx = hx+hx+(lx>>31); lx = lx+lx; + iy -= 1; + } + if(iy>= -1022) { /* normalize output */ + hx = ((hx-0x00100000)|((iy+1023)<<20)); + __HI(x) = hx|sx; + __LO(x) = lx; + } else { /* subnormal output */ + n = -1022 - iy; + if(n<=20) { + lx = (lx>>n)|((unsigned)hx<<(32-n)); + hx >>= n; + } else if (n<=31) { + lx = (hx<<(32-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-32); hx = sx; + } + __HI(x) = hx|sx; + __LO(x) = lx; + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_pow.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_pow.c new file mode 100644 index 0000000000..b52da87fe2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_pow.c @@ -0,0 +1,313 @@ + +#ifndef lint +static char sccsid[] = "@(#)e_pow.c 1.5 04/04/22 SMI"; +#endif + +/* + * ==================================================== + * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. + * + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_pow(x,y) return x**y + * + * n + * Method: Let x = 2 * (1+f) + * 1. Compute and return log2(x) in two pieces: + * log2(x) = w1 + w2, + * where w1 has 53-24 = 29 bit trailing zeros. + * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * arithmetic, where |y'|<=0.5. + * 3. Return x**y = 2**n*exp(y'*log2) + * + * Special cases: + * 1. (anything) ** 0 is 1 + * 2. (anything) ** 1 is itself + * 3. (anything) ** NAN is NAN + * 4. NAN ** (anything except 0) is NAN + * 5. +-(|x| > 1) ** +INF is +INF + * 6. +-(|x| > 1) ** -INF is +0 + * 7. +-(|x| < 1) ** +INF is +0 + * 8. +-(|x| < 1) ** -INF is +INF + * 9. +-1 ** +-INF is NAN + * 10. +0 ** (+anything except 0, NAN) is +0 + * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 12. +0 ** (-anything except 0, NAN) is +INF + * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 15. +INF ** (+anything except 0,NAN) is +INF + * 16. +INF ** (-anything except 0,NAN) is +0 + * 17. -INF ** (anything) = -0 ** (-anything) + * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * + * Accuracy: + * pow(x,y) returns x**y nearly rounded. In particular + * pow(integer,integer) + * always returns the correct integer provided it is + * representable. + * + * Constants : + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include +#include +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ +huge = 1.0e300, +tiny = 1.0e-300, + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ +L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ +L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ +L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ +L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ +L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ +lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ +lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ +ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ +cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ +cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ +cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ +ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ +ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ +ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ + +#ifdef __STDC__ + double __ieee754_pow(double x, double y) +#else + double __ieee754_pow(x,y) + double x, y; +#endif +{ + double z,ax,z_h,z_l,p_h,p_l; + double y1,t1,t2,r,s,t,u,v,w; + int i0,i1,i,j,k,yisint,n; + int hx,hy,ix,iy; + unsigned lx,ly; + + i0 = ((*(int*)&one)>>29)^1; i1=1-i0; + hx = __HI(x); lx = __LO(x); + hy = __HI(y); ly = __LO(y); + ix = hx&0x7fffffff; iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if((iy|ly)==0) return one; + + /* +-NaN return x+y */ + if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x43400000) yisint = 2; /* even integer y */ + else if(iy>=0x3ff00000) { + k = (iy>>20)-0x3ff; /* exponent */ + if(k>20) { + j = ly>>(52-k); + if((j<<(52-k))==ly) yisint = 2-(j&1); + } else if(ly==0) { + j = iy>>(20-k); + if((j<<(20-k))==iy) yisint = 2-(j&1); + } + } + } + + /* special value of y */ + if(ly==0) { + if (iy==0x7ff00000) { /* y is +-inf */ + if(((ix-0x3ff00000)|lx)==0) + return y - y; /* inf**+-1 is NaN */ + else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ + return (hy>=0)? y: zero; + else /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0)?-y: zero; + } + if(iy==0x3ff00000) { /* y is +-1 */ + if(hy<0) return one/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3fe00000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return sqrt(x); + } + } + + ax = fabs(x); + /* special value of x */ + if(lx==0) { + if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3ff00000)|yisint)==0) { + // Why wasn't this replaced with the constant NAN too? + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + if((((hx>>31)+1)|yisint)==0) { + errno = EDOM; + return NAN; + } + + /* |y| is huge */ + if(iy>0x41e00000) { /* if |y| > 2**31 */ + if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ + if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + } + /* over/underflow if x is not close to one */ + if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-one; /* t has 20 trailing zeros */ + w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + __LO(t1) = 0; + t2 = v-(t1-u); + } else { + double ss,s2,s_h,s_l,t_h,t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00100000) + {ax *= two53; n -= 53; ix = __HI(ax); } + n += ((ix)>>20)-0x3ff; + j = ix&0x000fffff; + /* determine interval */ + ix = j|0x3ff00000; /* normalize ix */ + if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = ss*ss; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+ss); + s2 = s_h*s_h; + t_h = 3.0+s2+r; + __LO(t_h) = 0; + t_l = r-((t_h-3.0)-s2); + /* u+v = ss*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*ss; + /* 2/(3log2)*(ss+...) */ + p_h = u+v; + __LO(p_h) = 0; + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + __LO(t1) = 0; + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if((((hx>>31)+1)|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + __LO(y1) = 0; + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + j = __HI(z); + i = __LO(z); + if (j>=0x40900000) { /* z >= 1024 */ + if(((j-0x40900000)|i)!=0) /* if z > 1024 */ + return s*huge*huge; /* overflow */ + else { + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ + if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ + return s*tiny*tiny; /* underflow */ + else { + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>20)-0x3ff; + n = 0; + if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00100000>>(k+1)); + k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ + t = zero; + __HI(t) = (n&~(0x000fffff>>k)); + n = ((n&0x000fffff)|0x00100000)>>(20-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + __LO(t) = 0; + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + j = __HI(z); + j += (n<<20); + if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ + else __HI(z) += (n<<20); + return s*z; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_rem_pio2.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_rem_pio2.c new file mode 100644 index 0000000000..e13a2eaac1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_rem_pio2.c @@ -0,0 +1,176 @@ + +/* @(#)e_rem_pio2.c 1.4 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_rem_pio2(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2() + */ + +#include +#include + +/* + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + */ +#ifdef __STDC__ +static const int two_over_pi[] = { +#else +static int two_over_pi[] = { +#endif +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; + +#ifdef __STDC__ +static const int npio2_hw[] = { +#else +static int npio2_hw[] = { +#endif +0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, +0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, +0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, +0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, +0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, +0x404858EB, 0x404921FB, +}; + +/* + * invpio2: 53 bits of 2/pi + * pio2_1: first 33 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 33 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 33 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +#ifdef __STDC__ +static const double +#else +static double +#endif +zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ +pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ +pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ +pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ +pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ +pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ +pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ + +#ifdef __STDC__ + int __ieee754_rem_pio2(double x, double *y) +#else + int __ieee754_rem_pio2(x,y) + double x,y[]; +#endif +{ + double z,w,t,r,fn; + double tx[3]; + int e0,i,j,nx,n,ix,hx; + + hx = __HI(x); /* high word of x */ + ix = hx&0x7fffffff; + if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int) (t*invpio2+half); + fn = (double)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 85 bit */ + if(n<32&&ix!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + j = ix>>20; + y[0] = r-w; + i = j-(((__HI(y[0]))>>20)&0x7ff); + if(i>16) { /* 2nd iteration needed, good to 118 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + i = j-(((__HI(y[0]))>>20)&0x7ff); + if(i>49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7ff00000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + /* set z = scalbn(|x|,ilogb(x)-23) */ + __LO(z) = __LO(x); + e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ + __HI(z) = ix - (e0<<20); + for(i=0;i<2;i++) { + tx[i] = (double)((int)(z)); + z = (z-tx[i])*two24; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/e_sqrt.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_sqrt.c new file mode 100644 index 0000000000..9cd9e19255 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/e_sqrt.c @@ -0,0 +1,455 @@ +/* @(#)e_sqrt.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_sqrt(x) + * Return correctly rounded sqrt. + * ------------------------------------------ + * | Use the hardware sqrt if you have one | + * ------------------------------------------ + * Method: + * Bit by bit method using integer arithmetic. (Slow, but portable) + * 1. Normalization + * Scale x to y in [1,4) with even powers of 2: + * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then + * sqrt(x) = 2^k * sqrt(y) + * 2. Bit by bit computation + * Let q = sqrt(y) truncated to i bit after binary point (q = 1), + * i 0 + * i+1 2 + * s = 2*q , and y = 2 * ( y - q ). (1) + * i i i i + * + * To compute q from q , one checks whether + * i+1 i + * + * -(i+1) 2 + * (q + 2 ) <= y. (2) + * i + * -(i+1) + * If (2) is false, then q = q ; otherwise q = q + 2 . + * i+1 i i+1 i + * + * With some algebric manipulation, it is not difficult to see + * that (2) is equivalent to + * -(i+1) + * s + 2 <= y (3) + * i i + * + * The advantage of (3) is that s and y can be computed by + * i i + * the following recurrence formula: + * if (3) is false + * + * s = s , y = y ; (4) + * i+1 i i+1 i + * + * otherwise, + * -i -(i+1) + * s = s + 2 , y = y - s - 2 (5) + * i+1 i i+1 i i + * + * One may easily use induction to prove (4) and (5). + * Note. Since the left hand side of (3) contain only i+2 bits, + * it does not necessary to do a full (53-bit) comparison + * in (3). + * 3. Final rounding + * After generating the 53 bits result, we compute one more bit. + * Together with the remainder, we can decide whether the + * result is exact, bigger than 1/2ulp, or less than 1/2ulp + * (it will never equal to 1/2ulp). + * The rounding mode can be detected by checking whether + * huge + tiny is equal to huge, and whether huge - tiny is + * equal to huge for some floating point number "huge" and "tiny". + * + * Special cases: + * sqrt(+-0) = +-0 ... exact + * sqrt(inf) = inf + * sqrt(-ve) = NaN ... with invalid signal + * sqrt(NaN) = NaN ... with invalid signal for signaling NaN + * + * Other methods : see the appended file at the end of the program below. + *--------------- + */ + +#include +#include +#include + +#ifdef __STDC__ +static const double one = 1.0, tiny=1.0e-300; +#else +static double one = 1.0, tiny=1.0e-300; +#endif + +#ifdef __STDC__ + double __ieee754_sqrt(double x) +#else + double __ieee754_sqrt(x) + double x; +#endif +{ + double z; + int sign = (int)0x80000000; + unsigned r,t1,s1,ix1,q1; + int ix0,s0,q,m,t,i; + + ix0 = __HI(x); /* high word of x */ + ix1 = __LO(x); /* low word of x */ + + /* take care of Inf and NaN */ + if((ix0&0x7ff00000)==0x7ff00000) { + errno = EDOM; + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } + /* take care of zero */ + if(ix0<=0) { + if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix0<0) { + errno = EDOM; + return NAN; /* sqrt(-ve) = sNaN */ + } + } + /* normalize x */ + m = (ix0>>20); + if(m==0) { /* subnormal x */ + while(ix0==0) { + m -= 21; + ix0 |= (ix1>>11); ix1 <<= 21; + } + for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; + m -= i-1; + ix0 |= (ix1>>(32-i)); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if(m&1){ /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ + + /* generate sqrt(x) bit by bit */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ + + while(r!=0) { + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r>>=1; + } + + r = sign; + while(r!=0) { + t1 = s1+r; + t = s0; + if((t>31); + ix1 += ix1; + r>>=1; + } + + /* use floating add to find out rounding direction */ + if((ix0|ix1)!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (q1==(unsigned)0xffffffff) { q1=0; q += 1;} + else if (z>one) { + if (q1==(unsigned)0xfffffffe) q+=1; + q1+=2; + } else + q1 += (q1&1); + } + } + ix0 = (q>>1)+0x3fe00000; + ix1 = q1>>1; + if ((q&1)==1) ix1 |= sign; + ix0 += (m <<20); + __HI(z) = ix0; + __LO(z) = ix1; + return z; +} + +/* +Other methods (use floating-point arithmetic) +------------- +(This is a copy of a drafted paper by Prof W. Kahan +and K.C. Ng, written in May, 1986) + + Two algorithms are given here to implement sqrt(x) + (IEEE double precision arithmetic) in software. + Both supply sqrt(x) correctly rounded. The first algorithm (in + Section A) uses newton iterations and involves four divisions. + The second one uses reciproot iterations to avoid division, but + requires more multiplications. Both algorithms need the ability + to chop results of arithmetic operations instead of round them, + and the INEXACT flag to indicate when an arithmetic operation + is executed exactly with no roundoff error, all part of the + standard (IEEE 754-1985). The ability to perform shift, add, + subtract and logical AND operations upon 32-bit words is needed + too, though not part of the standard. + +A. sqrt(x) by Newton Iteration + + (1) Initial approximation + + Let x0 and x1 be the leading and the trailing 32-bit words of + a floating point number x (in IEEE double format) respectively + + 1 11 52 ...widths + ------------------------------------------------------ + x: |s| e | f | + ------------------------------------------------------ + msb lsb msb lsb ...order + + + ------------------------ ------------------------ + x0: |s| e | f1 | x1: | f2 | + ------------------------ ------------------------ + + By performing shifts and subtracts on x0 and x1 (both regarded + as integers), we obtain an 8-bit approximation of sqrt(x) as + follows. + + k := (x0>>1) + 0x1ff80000; + y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits + Here k is a 32-bit integer and T1[] is an integer array containing + correction terms. Now magically the floating value of y (y's + leading 32-bit word is y0, the value of its trailing word is 0) + approximates sqrt(x) to almost 8-bit. + + Value of T1: + static int T1[32]= { + 0, 1024, 3062, 5746, 9193, 13348, 18162, 23592, + 29598, 36145, 43202, 50740, 58733, 67158, 75992, 85215, + 83599, 71378, 60428, 50647, 41945, 34246, 27478, 21581, + 16499, 12183, 8588, 5674, 3403, 1742, 661, 130,}; + + (2) Iterative refinement + + Apply Heron's rule three times to y, we have y approximates + sqrt(x) to within 1 ulp (Unit in the Last Place): + + y := (y+x/y)/2 ... almost 17 sig. bits + y := (y+x/y)/2 ... almost 35 sig. bits + y := y-(y-x/y)/2 ... within 1 ulp + + + Remark 1. + Another way to improve y to within 1 ulp is: + + y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x) + y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x) + + 2 + (x-y )*y + y := y + 2* ---------- ...within 1 ulp + 2 + 3y + x + + + This formula has one division fewer than the one above; however, + it requires more multiplications and additions. Also x must be + scaled in advance to avoid spurious overflow in evaluating the + expression 3y*y+x. Hence it is not recommended uless division + is slow. If division is very slow, then one should use the + reciproot algorithm given in section B. + + (3) Final adjustment + + By twiddling y's last bit it is possible to force y to be + correctly rounded according to the prevailing rounding mode + as follows. Let r and i be copies of the rounding mode and + inexact flag before entering the square root program. Also we + use the expression y+-ulp for the next representable floating + numbers (up and down) of y. Note that y+-ulp = either fixed + point y+-1, or multiply y by nextafter(1,+-inf) in chopped + mode. + + I := FALSE; ... reset INEXACT flag I + R := RZ; ... set rounding mode to round-toward-zero + z := x/y; ... chopped quotient, possibly inexact + If(not I) then { ... if the quotient is exact + if(z=y) { + I := i; ... restore inexact flag + R := r; ... restore rounded mode + return sqrt(x):=y. + } else { + z := z - ulp; ... special rounding + } + } + i := TRUE; ... sqrt(x) is inexact + If (r=RN) then z=z+ulp ... rounded-to-nearest + If (r=RP) then { ... round-toward-+inf + y = y+ulp; z=z+ulp; + } + y := y+z; ... chopped sum + y0:=y0-0x00100000; ... y := y/2 is correctly rounded. + I := i; ... restore inexact flag + R := r; ... restore rounded mode + return sqrt(x):=y. + + (4) Special cases + + Square root of +inf, +-0, or NaN is itself; + Square root of a negative number is NaN with invalid signal. + + +B. sqrt(x) by Reciproot Iteration + + (1) Initial approximation + + Let x0 and x1 be the leading and the trailing 32-bit words of + a floating point number x (in IEEE double format) respectively + (see section A). By performing shifs and subtracts on x0 and y0, + we obtain a 7.8-bit approximation of 1/sqrt(x) as follows. + + k := 0x5fe80000 - (x0>>1); + y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits + + Here k is a 32-bit integer and T2[] is an integer array + containing correction terms. Now magically the floating + value of y (y's leading 32-bit word is y0, the value of + its trailing word y1 is set to zero) approximates 1/sqrt(x) + to almost 7.8-bit. + + Value of T2: + static int T2[64]= { + 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866, + 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f, + 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d, + 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0, + 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989, + 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd, + 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e, + 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,}; + + (2) Iterative refinement + + Apply Reciproot iteration three times to y and multiply the + result by x to get an approximation z that matches sqrt(x) + to about 1 ulp. To be exact, we will have + -1ulp < sqrt(x)-z<1.0625ulp. + + ... set rounding mode to Round-to-nearest + y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x) + y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x) + ... special arrangement for better accuracy + z := x*y ... 29 bits to sqrt(x), with z*y<1 + z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x) + + Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that + (a) the term z*y in the final iteration is always less than 1; + (b) the error in the final result is biased upward so that + -1 ulp < sqrt(x) - z < 1.0625 ulp + instead of |sqrt(x)-z|<1.03125ulp. + + (3) Final adjustment + + By twiddling y's last bit it is possible to force y to be + correctly rounded according to the prevailing rounding mode + as follows. Let r and i be copies of the rounding mode and + inexact flag before entering the square root program. Also we + use the expression y+-ulp for the next representable floating + numbers (up and down) of y. Note that y+-ulp = either fixed + point y+-1, or multiply y by nextafter(1,+-inf) in chopped + mode. + + R := RZ; ... set rounding mode to round-toward-zero + switch(r) { + case RN: ... round-to-nearest + if(x<= z*(z-ulp)...chopped) z = z - ulp; else + if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp; + break; + case RZ:case RM: ... round-to-zero or round-to--inf + R:=RP; ... reset rounding mod to round-to-+inf + if(x=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp; + break; + case RP: ... round-to-+inf + if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else + if(x>z*z ...chopped) z = z+ulp; + break; + } + + Remark 3. The above comparisons can be done in fixed point. For + example, to compare x and w=z*z chopped, it suffices to compare + x1 and w1 (the trailing parts of x and w), regarding them as + two's complement integers. + + ...Is z an exact square root? + To determine whether z is an exact square root of x, let z1 be the + trailing part of z, and also let x0 and x1 be the leading and + trailing parts of x. + + If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0 + I := 1; ... Raise Inexact flag: z is not exact + else { + j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2 + k := z1 >> 26; ... get z's 25-th and 26-th + fraction bits + I := i or (k&j) or ((k&(j+j+1))!=(x1&3)); + } + R:= r ... restore rounded mode + return sqrt(x):=z. + + If multiplication is cheaper then the foregoing red tape, the + Inexact flag can be evaluated by + + I := i; + I := (z*z!=x) or I. + + Note that z*z can overwrite I; this value must be sensed if it is + True. + + Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be + zero. + + -------------------- + z1: | f2 | + -------------------- + bit 31 bit 0 + + Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd + or even of logb(x) have the following relations: + + ------------------------------------------------- + bit 27,26 of z1 bit 1,0 of x1 logb(x) + ------------------------------------------------- + 00 00 odd and even + 01 01 even + 10 10 odd + 10 00 even + 11 01 even + ------------------------------------------------- + + (4) Special cases (see (4) of Section A). + + */ + \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/float.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/float.c new file mode 100644 index 0000000000..38220d1b7a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/float.c @@ -0,0 +1,5 @@ +#include + +unsigned long __float_nan[] = {0x7FFFFFFF}; +unsigned long __float_huge[] = {0x7F800000}; +unsigned long __double_huge[] = {0x7FF00000, 0x00000000}; diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/k_cos.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_cos.c new file mode 100644 index 0000000000..2a6e7d04df --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_cos.c @@ -0,0 +1,92 @@ + +/* @(#)k_cos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __kernel_cos( x, y ) + * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * + * Algorithm + * 1. Since cos(-x) = cos(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0. + * 3. cos(x) is approximated by a polynomial of degree 14 on + * [0,pi/4] + * 4 14 + * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x + * where the remez error is + * + * | 2 4 6 8 10 12 14 | -58 + * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 + * | | + * + * 4 6 8 10 12 14 + * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then + * cos(x) = 1 - x*x/2 + r + * since cos(x+y) ~ cos(x) - sin(x)*y + * ~ cos(x) - x*y, + * a correction term is necessary in cos(x) and hence + * cos(x+y) = 1 - (x*x/2 - (r - x*y)) + * For better accuracy when x > 0.3, let qx = |x|/4 with + * the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125. + * Then + * cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)). + * Note that 1-qx and (x*x/2-qx) is EXACT here, and the + * magnitude of the latter is at least a quarter of x*x/2, + * thus, reducing the rounding error in the subtraction. + */ + +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ +C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ +C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ +C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ +C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ +C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ + +#ifdef __STDC__ + double __kernel_cos(double x, double y) +#else + double __kernel_cos(x, y) + double x,y; +#endif +{ + double a,hz,z,r,qx; + int ix; + ix = __HI(x)&0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x3e400000) { /* if x < 2**27 */ + if(((int)x)==0) return one; /* generate inexact */ + } + z = x*x; + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); + if(ix < 0x3FD33333) /* if |x| < 0.3 */ + return one - (0.5*z - (z*r - x*y)); + else { + if(ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + __HI(qx) = ix-0x00200000; /* x/4 */ + __LO(qx) = 0; + } + hz = 0.5*z-qx; + a = one-qx; + return a - (hz - (z*r-x*y)); + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/k_rem_pio2.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_rem_pio2.c new file mode 100644 index 0000000000..5fe9e98305 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_rem_pio2.c @@ -0,0 +1,316 @@ + +/* @(#)k_rem_pio2.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + * double x[],y[]; int e0,nx,prec; int ipio2[]; + * + * __kernel_rem_pio2 return the last three digits of N with + * y = x - N*pi/2 + * so that |y| < pi/2. + * + * The method is to compute the integer (mod 8) and fraction parts of + * (2/pi)*x without doing the full multiplication. In general we + * skip the part of the product that are known to be a huge integer ( + * more accurately, = 0 mod 8 ). Thus the number of operations are + * independent of the exponent of the input. + * + * (2/pi) is represented by an array of 24-bit integers in ipio2[]. + * + * Input parameters: + * x[] The input value (must be positive) is broken into nx + * pieces of 24-bit integers in double precision format. + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * match x's up to 24 bits. + * + * Example of breaking a double positive z into x[0]+x[1]+x[2]: + * e0 = ilogb(z)-23 + * z = scalbn(z,-e0) + * for i = 0,1,2 + * x[i] = floor(z) + * z = (z-x[i])*2**24 + * + * + * y[] ouput result in an array of double precision numbers. + * The dimension of y[] is: + * 24-bit precision 1 + * 53-bit precision 2 + * 64-bit precision 2 + * 113-bit precision 3 + * The actual value is the sum of them. Thus for 113-bit + * precison, one may have to do something like: + * + * long double t,w,r_head, r_tail; + * t = (long double)y[2] + (long double)y[1]; + * w = (long double)y[0]; + * r_head = t+w; + * r_tail = w - (r_head - t); + * + * e0 The exponent of x[0] + * + * nx dimension of x[] + * + * prec an integer indicating the precision: + * 0 24 bits (single) + * 1 53 bits (double) + * 2 64 bits (extended) + * 3 113 bits (quad) + * + * ipio2[] + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding + * floating value is + * + * ipio2[i] * 2^(-24(i+1)). + * + * External function: + * double scalbn(), floor(); + * + * + * Here is the description of some local variables: + * + * jk jk+1 is the initial number of terms of ipio2[] needed + * in the computation. The recommended value is 2,3,4, + * 6 for single, double, extended,and quad. + * + * jz local integer variable indicating the number of + * terms of ipio2[] used. + * + * jx nx - 1 + * + * jv index for pointing to the suitable ipio2[] for the + * computation. In general, we want + * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 + * is an integer. Thus + * e0-3-24*jv >= 0 or (e0-3)/24 >= jv + * Hence jv = max(0,(e0-3)/24). + * + * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. + * + * q[] double array with integral value, representing the + * 24-bits chunk of the product of x and 2/pi. + * + * q0 the corresponding exponent of q[0]. Note that the + * exponent for q[i] would be q0-24*i. + * + * PIo2[] double precision array, obtained by cutting pi/2 + * into 24 bits chunks. + * + * f[] ipio2[] in floating point + * + * iq[] integer array by breaking up q[] in 24-bits chunk. + * + * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] + * + * ih integer. If >0 it indicates q[] is >= 0.5, hence + * it also indicates the *sign* of the result. + * + */ + + +/* + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include + +#ifdef __STDC__ +static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ +#else +static int init_jk[] = {2,3,4,6}; +#endif + +#ifdef __STDC__ +static const double PIo2[] = { +#else +static double PIo2[] = { +#endif + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ +}; + +#ifdef __STDC__ +static const double +#else +static double +#endif +zero = 0.0, +one = 1.0, +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ + +#ifdef __STDC__ + int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) +#else + int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + double x[], y[]; int e0,nx,prec; int ipio2[]; +#endif +{ + int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + double z,fw,f[20],fq[20],q[20]; + + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx-1; + jv = (e0-3)/24; if(jv<0) jv=0; + q0 = e0-24*(jv+1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (double)((int)(twon24* z)); + iq[i] = (int)(z-two24*fw); + z = q[j-1]+fw; + } + + /* compute n */ + z = scalbn(z,q0); /* actual value of z */ + z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ + n = (int) z; + z -= (double)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(24-q0)); n += i; + iq[jz-1] -= i<<(24-q0); + ih = iq[jz-1]>>(23-q0); + } + else if(q0==0) ih = iq[jz-1]>>23; + else if(z>=0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7fffff; break; + case 2: + iq[jz-1] &= 0x3fffff; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= scalbn(one,q0); + } + } + + /* check if recomputation is needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ + + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (double) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if(z==0.0) { + jz -= 1; q0 -= 24; + while(iq[jz]==0) { jz--; q0-=24;} + } else { /* break z into 24-bit if necessary */ + z = scalbn(z,-q0); + if(z>=two24) { + fw = (double)((int)(twon24*z)); + iq[jz] = (int)(z-two24*fw); + jz += 1; q0 += 24; + iq[jz] = (int) fw; + } else iq[jz] = (int) z ; + } + + /* convert integer "bit" chunk to floating-point value */ + fw = scalbn(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(double)iq[i]; fw*=twon24; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } + + /* compress fq[] into y[] */ + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/k_sin.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_sin.c new file mode 100644 index 0000000000..8316b49ff4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_sin.c @@ -0,0 +1,74 @@ + +/* @(#)k_sin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __kernel_sin( x, y, iy) + * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). + * + * Algorithm + * 1. Since sin(-x) = -sin(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. + * 3. sin(x) is approximated by a polynomial of degree 13 on + * [0,pi/4] + * 3 13 + * sin(x) ~ x + S1*x + ... + S6*x + * where + * + * |sin(x) 2 4 6 8 10 12 | -58 + * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 + * | x | + * + * 4. sin(x+y) = sin(x) + sin'(x')*y + * ~ sin(x) + (1-x*x/2)*y + * For better accuracy, let + * 3 2 2 2 2 + * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) + * then 3 2 + * sin(x) = x + (S1*x + (x *(r-y/2)+y)) + */ + +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ +S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ +S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ +S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ +S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ +S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ + +#ifdef __STDC__ + double __kernel_sin(double x, double y, int iy) +#else + double __kernel_sin(x, y, iy) + double x,y; int iy; /* iy=0 if y is zero */ +#endif +{ + double z,r,v; + int ix; + ix = __HI(x)&0x7fffffff; /* high word of x */ + if(ix<0x3e400000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/k_tan.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_tan.c new file mode 100644 index 0000000000..c916700470 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/k_tan.c @@ -0,0 +1,137 @@ +#pragma ident "@(#)k_tan.c 1.5 04/04/22 SMI" + +/* + * ==================================================== + * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* INDENT OFF */ +/* __kernel_tan( x, y, k ) + * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input k indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned. + * + * Algorithm + * 1. Since tan(-x) = -tan(x), we need only to consider positive x. + * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0. + * 3. tan(x) is approximated by a odd polynomial of degree 27 on + * [0,0.67434] + * 3 27 + * tan(x) ~ x + T1*x + ... + T13*x + * where + * + * |tan(x) 2 4 26 | -59.2 + * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 + * | x | + * + * Note: tan(x+y) = tan(x) + tan'(x)*y + * ~ tan(x) + (1+x*x)*y + * Therefore, for better accuracy in computing tan(x+y), let + * 3 2 2 2 2 + * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) + * then + * 3 2 + * tan(x+y) = x + (T1*x + (x *(r+y)+y)) + * + * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then + * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) + * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) + */ + +#include +#include + +static const double T[] = { + 3.33333333333334091986e-01, /* 3FD55555, 55555563 */ + 1.33333333333201242699e-01, /* 3FC11111, 1110FE7A */ + 5.39682539762260521377e-02, /* 3FABA1BA, 1BB341FE */ + 2.18694882948595424599e-02, /* 3F9664F4, 8406D637 */ + 8.86323982359930005737e-03, /* 3F8226E3, E96E8493 */ + 3.59207910759131235356e-03, /* 3F6D6D22, C9560328 */ + 1.45620945432529025516e-03, /* 3F57DBC8, FEE08315 */ + 5.88041240820264096874e-04, /* 3F4344D8, F2F26501 */ + 2.46463134818469906812e-04, /* 3F3026F7, 1A8D1068 */ + 7.81794442939557092300e-05, /* 3F147E88, A03792A6 */ + 7.14072491382608190305e-05, /* 3F12B80F, 32F0A7E9 */ + -1.85586374855275456654e-05, /* BEF375CB, DB605373 */ + 2.59073051863633712884e-05 /* 3EFB2A70, 74BF7AD4 */ +}; +#define one 1.00000000000000000000e+00 +#define pio4 7.85398163397448278999e-01 +#define pio4lo 3.06161699786838301793e-17 +/* INDENT ON */ + +double +__kernel_tan(double x, double y, int iy) { + double z, r, v, w, s; + int ix, hx; + + hx = __HI(x); /* high word of x */ + ix = hx & 0x7fffffff; /* high word of |x| */ + if (ix < 0x3e300000) { /* x < 2**-28 */ + if ((int) x == 0) { /* generate inexact */ + if (((ix | __LO(x)) | (iy + 1)) == 0) + return one / fabs(x); + else { + if (iy == 1) + return x; + else { /* compute -1 / (x+y) carefully */ + return -1 / x; + } + } + } + } + if (ix >= 0x3FE59428) { /* |x| >= 0.6744 */ + if (hx < 0) { + x = -x; + y = -y; + } + z = pio4 - x; + w = pio4lo - y; + x = z + w; + y = 0.0; + } + z = x * x; + w = z * z; + /* + * Break x^5*(T[1]+x^2*T[2]+...) into + * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + + * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) + */ + r = T[1] + w * (T[3] + w * (T[5] + w * (T[7] + w * (T[9] + + w * T[11])))); + v = z * (T[2] + w * (T[4] + w * (T[6] + w * (T[8] + w * (T[10] + + w * T[12]))))); + s = z * x; + r = y + z * (s * (r + v) + y); + r += T[0] * s; + w = x + r; + if (ix >= 0x3FE59428) { + v = (double) iy; + return (double) (1 - ((hx >> 30) & 2)) * + (v - 2.0 * (x - (w * w / (w + v) - r))); + } + if (iy == 1) + return w; + else { + /* + * if allow error up to 2 ulp, simply return + * -1.0 / (x+r) here + */ + /* compute -1.0 / (x+r) accurately */ + double a, t; + z = w; + __LO(z) = 0; + v = r - (z - x); /* z+v = r+x */ + t = a = -1.0 / w; /* a = -1.0/w */ + __LO(t) = 0; + s = 1.0 + t * z; + return t + a * (s + t * v); + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/math_ppc.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/math_ppc.c new file mode 100644 index 0000000000..839aa10c06 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/math_ppc.c @@ -0,0 +1,5 @@ +#include + +double nan(const char* arg) { +#pragma unused(arg) +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_atan.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_atan.c new file mode 100644 index 0000000000..126152c3fe --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_atan.c @@ -0,0 +1,135 @@ + +/* @(#)s_atan.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* atan(x) + * Method + * 1. Reduce x to positive by atan(x) = -atan(-x). + * 2. According to the integer k=4t+0.25 chopped, t=x, the argument + * is further reduced to one of the following intervals and the + * arctangent of t is evaluated by the corresponding formula: + * + * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) + * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) ) + * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) + * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) ) + * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include +#include + +#ifdef __STDC__ +static const double atanhi[] = { +#else +static double atanhi[] = { +#endif + 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ + 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ + 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ + 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ +}; + +#ifdef __STDC__ +static const double atanlo[] = { +#else +static double atanlo[] = { +#endif + 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ + 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ + 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ + 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ +}; + +#ifdef __STDC__ +static const double aT[] = { +#else +static double aT[] = { +#endif + 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ + -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ + 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ + -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ + 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ + -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ + 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ + -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ + 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ + -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ + 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ +}; + +#ifdef __STDC__ + static const double +#else + static double +#endif +one = 1.0, +huge = 1.0e300; + +#ifdef __STDC__ + double atan(double x) +#else + double atan(x) + double x; +#endif +{ + double w,s1,s2,z; + int ix,hx,id; + + hx = __HI(x); + ix = hx&0x7fffffff; + if(ix>=0x44100000) { /* if |x| >= 2^66 */ + if(ix>0x7ff00000|| + (ix==0x7ff00000&&(__LO(x)!=0))) + return x+x; /* NaN */ + if(hx>0) return atanhi[3]+atanlo[3]; + else return -atanhi[3]-atanlo[3]; + } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ + if (ix < 0x3e200000) { /* |x| < 2^-29 */ + if(huge+x>one) return x; /* raise inexact */ + } + id = -1; + } else { + x = fabs(x); + if (ix < 0x3ff30000) { /* |x| < 1.1875 */ + if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ + id = 0; x = (2.0*x-one)/(2.0+x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; x = (x-one)/(x+one); + } + } else { + if (ix < 0x40038000) { /* |x| < 2.4375 */ + id = 2; x = (x-1.5)/(one+1.5*x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; x = -1.0/x; + } + }} + /* end of argument reduction */ + z = x*x; + w = z*z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ + s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); + s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); + if (id<0) return x - x*(s1+s2); + else { + z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); + return (hx<0)? -z:z; + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ceil.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ceil.c new file mode 100644 index 0000000000..f8c7337eb0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ceil.c @@ -0,0 +1,78 @@ + +/* @(#)s_ceil.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * ceil(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to ceil(x). + */ + +#include + +#ifdef __STDC__ +static const double huge = 1.0e300; +#else +static double huge = 1.0e300; +#endif + +#ifdef __STDC__ + double ceil(double x) +#else + double ceil(x) + double x; +#endif +{ + int i0,i1,j0; + unsigned i,j; + i0 = __HI(x); + i1 = __LO(x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=0x80000000;i1=0;} + else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((unsigned)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0>0) { + if(j0==20) i0+=1; + else { + j = i1 + (1<<(52-j0)); + if(j + +#ifdef __STDC__ + double copysign(double x, double y) +#else + double copysign(x,y) + double x,y; +#endif +{ + __HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000); + return x; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_cos.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_cos.c new file mode 100644 index 0000000000..2a185bda5a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_cos.c @@ -0,0 +1,78 @@ + +/* @(#)s_cos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* cos(x) + * Return cosine function of x. + * + * kernel function: + * __kernel_sin ... sine function on [-pi/4,pi/4] + * __kernel_cos ... cosine function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include + +#ifdef __STDC__ + double cos(double x) +#else + double cos(x) + double x; +#endif +{ + double y[2],z=0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_cos(x,z); + + /* cos(Inf or NaN) is NaN */ + else if (ix>=0x7ff00000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_cos(y[0],y[1]); + case 1: return -__kernel_sin(y[0],y[1],1); + case 2: return -__kernel_cos(y[0],y[1]); + default: + return __kernel_sin(y[0],y[1],1); + } + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_floor.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_floor.c new file mode 100644 index 0000000000..fabaaa581c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_floor.c @@ -0,0 +1,79 @@ + +/* @(#)s_floor.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * floor(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include + +#ifdef __STDC__ +static const double huge = 1.0e300; +#else +static double huge = 1.0e300; +#endif + +#ifdef __STDC__ + double floor(double x) +#else + double floor(x) + double x; +#endif +{ + int i0,i1,j0; + unsigned i,j; + i0 = __HI(x); + i1 = __LO(x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((unsigned)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==20) i0+=1; + else { + j = i1+(1<<(52-j0)); + if(j + +#ifdef __STDC__ +static const double +#else +static double +#endif +two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ + +#ifdef __STDC__ + double frexp(double x, int *eptr) +#else + double frexp(x, eptr) + double x; int *eptr; +#endif +{ + int hx, ix, lx; + hx = __HI(x); + ix = 0x7fffffff&hx; + lx = __LO(x); + *eptr = 0; + if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ + if (ix<0x00100000) { /* subnormal */ + x *= two54; + hx = __HI(x); + ix = hx&0x7fffffff; + *eptr = -54; + } + *eptr += (ix>>20)-1022; + hx = (hx&0x800fffff)|0x3fe00000; + __HI(x) = hx; + return x; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ldexp.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ldexp.c new file mode 100644 index 0000000000..99af37b196 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_ldexp.c @@ -0,0 +1,70 @@ + +/* @(#)s_ldexp.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * scalbn (double x, int n) + * scalbn(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include +#include + +#ifdef __STDC__ +static const double +#else +static double +#endif +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; + +#ifdef __STDC__ + double ldexp(double value, int exp) +#else + double ldexp(value, exp) + double value; int exp; +#endif +{ + int k,hx,lx; + + if(!isfinite(value)||value==0.0) return value; + + // scalbn manually inlined from FDLIBM (s_scalbn.c) + hx = __HI(value); + lx = __LO(value); + k = (hx&0x7ff00000)>>20; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((lx|(hx&0x7fffffff))==0) return value; /* +-0 */ + value *= two54; + hx = __HI(value); + k = ((hx&0x7ff00000)>>20) - 54; + if (exp< -50000) return tiny*value; /*underflow*/ + } + if (k==0x7ff) return value+value; /* NaN or Inf */ + k = k+exp; + if (k > 0x7fe) return huge*copysign(huge,value); /* overflow */ + if (k > 0) /* normal result */ + {__HI(value) = (hx&0x800fffff)|(k<<20); return value;} + if (k <= -54) + if (exp > 50000) /* in case integer overflow in n+k */ + return huge*copysign(huge,value); /*overflow*/ + else return tiny*copysign(tiny,value); /*underflow*/ + k += 54; /* subnormal result */ + __HI(value) = (hx&0x800fffff)|(k<<20); + return value*twom54; + + return value; +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_modf.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_modf.c new file mode 100644 index 0000000000..35162715c0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_modf.c @@ -0,0 +1,80 @@ + +/* @(#)s_modf.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * modf(double x, double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include + +#ifdef __STDC__ +static const double one = 1.0; +#else +static double one = 1.0; +#endif + +#ifdef __STDC__ + double modf(double x, double *iptr) +#else + double modf(x, iptr) + double x,*iptr; +#endif +{ + int i0,i1,j0; + unsigned i; + i0 = __HI(x); /* high x */ + i1 = __LO(x); /* low x */ + j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ + if(j0<20) { /* integer part in high x */ + if(j0<0) { /* |x|<1 */ + __HIp(iptr) = i0&0x80000000; + __LOp(iptr) = 0; /* *iptr = +-0 */ + return x; + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) { /* x is integral */ + *iptr = x; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { + __HIp(iptr) = i0&(~i); + __LOp(iptr) = 0; + return x - *iptr; + } + } + } else if (j0>51) { /* no fraction part */ + *iptr = x*one; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { /* fraction part in low x */ + i = ((unsigned)(0xffffffff))>>(j0-20); + if((i1&i)==0) { /* x is integral */ + *iptr = x; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { + __HIp(iptr) = i0; + __LOp(iptr) = i1&(~i); + return x - *iptr; + } + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_sin.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_sin.c new file mode 100644 index 0000000000..87f56c77a8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_sin.c @@ -0,0 +1,78 @@ + +/* @(#)s_sin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* sin(x) + * Return sine function of x. + * + * kernel function: + * __kernel_sin ... sine function on [-pi/4,pi/4] + * __kernel_cos ... cose function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include + +#ifdef __STDC__ + double sin(double x) +#else + double sin(x) + double x; +#endif +{ + double y[2],z=0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (ix>=0x7ff00000) return x-x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_sin(y[0],y[1],1); + case 1: return __kernel_cos(y[0],y[1]); + case 2: return -__kernel_sin(y[0],y[1],1); + default: + return -__kernel_cos(y[0],y[1]); + } + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/s_tan.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_tan.c new file mode 100644 index 0000000000..8a9c944b25 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/s_tan.c @@ -0,0 +1,72 @@ + +/* @(#)s_tan.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* tan(x) + * Return tangent function of x. + * + * kernel function: + * __kernel_tan ... tangent function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include + +#ifdef __STDC__ + double tan(double x) +#else + double tan(x) + double x; +#endif +{ + double y[2],z=0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1); + + /* tan(Inf or NaN) is NaN */ + else if (ix>=0x7ff00000) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x,y); + return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_acos.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_acos.c new file mode 100644 index 0000000000..02785fdeea --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_acos.c @@ -0,0 +1,39 @@ + +/* @(#)w_acos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrap_acos(x) + */ + +#include +#include + +#ifdef __STDC__ + double acos(double x) /* wrapper acos */ +#else + double acos(x) /* wrapper acos */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acos(x); +#else + double z; + z = __ieee754_acos(x); + if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(fabs(x)>1.0) { + return __kernel_standard(x,x,1); /* acos(|x|>1) */ + } else + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_asin.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_asin.c new file mode 100644 index 0000000000..ce50279bf1 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_asin.c @@ -0,0 +1,42 @@ + +/* @(#)w_asin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* + * wrapper asin(x) + */ + + +#include +#include + + +#ifdef __STDC__ + double asin(double x) /* wrapper asin */ +#else + double asin(x) /* wrapper asin */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_asin(x); +#else + double z; + z = __ieee754_asin(x); + if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(fabs(x)>1.0) { + return __kernel_standard(x,x,2); /* asin(|x|>1) */ + } else + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_atan2.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_atan2.c new file mode 100644 index 0000000000..3cacd6b8e2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_atan2.c @@ -0,0 +1,41 @@ + +/* @(#)w_atan2.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* + * wrapper atan2(y,x) + */ + +#include +#include + + +#ifdef __STDC__ + double atan2(double y, double x) /* wrapper atan2 */ +#else + double atan2(y,x) /* wrapper atan2 */ + double y,x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atan2(y,x); +#else + double z; + z = __ieee754_atan2(y,x); + if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z; + if(x==0.0&&y==0.0) { + return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */ + } else + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_fmod.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_fmod.c new file mode 100644 index 0000000000..980e5e1d17 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_fmod.c @@ -0,0 +1,40 @@ + +/* @(#)w_fmod.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper fmod(x,y) + */ + +#include +#include + + +#ifdef __STDC__ + double fmod(double x, double y) /* wrapper fmod */ +#else + double fmod(x,y) /* wrapper fmod */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_fmod(x,y); +#else + double z; + z = __ieee754_fmod(x,y); + if(_LIB_VERSION == _IEEE_ ||isnan(y)||isnan(x)) return z; + if(y==0.0) { + return __kernel_standard(x,y,27); /* fmod(x,0) */ + } else + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_pow.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_pow.c new file mode 100644 index 0000000000..4e5278a786 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_pow.c @@ -0,0 +1,61 @@ + + +/* @(#)w_pow.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper pow(x,y) return x**y + */ + +#include +#include + + +#ifdef __STDC__ + double pow(double x, double y) /* wrapper pow */ +#else + double pow(x,y) /* wrapper pow */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_pow(x,y); +#else + double z; + z=__ieee754_pow(x,y); + if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; + if(isnan(x)) { + if(y==0.0) + return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ + else + return z; + } + if(x==0.0){ + if(y==0.0) + return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ + if(finite(y)&&y<0.0) + return __kernel_standard(x,y,23); /* pow(0.0,negative) */ + return z; + } + if(!finite(z)) { + if(finite(x)&&finite(y)) { + if(isnan(z)) + return __kernel_standard(x,y,24); /* pow neg**non-int */ + else + return __kernel_standard(x,y,21); /* pow overflow */ + } + } + if(z==0.0&&finite(x)&&finite(y)) + return __kernel_standard(x,y,22); /* pow underflow */ + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/w_sqrt.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_sqrt.c new file mode 100644 index 0000000000..7f4614c3fd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/w_sqrt.c @@ -0,0 +1,39 @@ + +/* @(#)w_sqrt.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper sqrt(x) + */ + +#include +#include + +#ifdef __STDC__ + double sqrt(double x) /* wrapper sqrt */ +#else + double sqrt(x) /* wrapper sqrt */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sqrt(x); +#else + double z; + z = __ieee754_sqrt(x); + if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; + if(x<0.0) { + return __kernel_standard(x,x,26); /* sqrt(negative) */ + } else + return z; +#endif +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/OpenRVL/src/stl/wstring.c b/include/lib/BrawlHeaders/OpenRVL/src/stl/wstring.c new file mode 100644 index 0000000000..3323a2f202 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/src/stl/wstring.c @@ -0,0 +1,16 @@ +#include "internal/wstring.h" + +int wcscmp(const wchar_t* s1, const wchar_t* s2) { + wchar_t c1, c2; + + do + { + c1 = *s1++; + c2 = *s2++; + if (c2 == L'\0') + return c1 - c2; + } + while (c1 == c2); + + return c1 < c2 ? -1 : 1; +}; diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_Icon.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_Icon.c.json new file mode 100644 index 0000000000..232f673ec3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_Icon.c.json @@ -0,0 +1,8 @@ +{ + ".text": [ + [ + "RFLSetIconDrawDoneCallback", + "10f9ac8723db42cd16dc763de365a6001255f82e0467bdcdcec3d2b64cd11da0" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDAccess.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDAccess.c.json new file mode 100644 index 0000000000..a45970045a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDAccess.c.json @@ -0,0 +1,116 @@ +{ + ".text": [ + [ + "RFLiInitAccessInfo", + "3cbb4bb04154485303044170fb2a4ff3eccec0222d1c653fb8663d8589ec9096" + ], + [ + "RFLiExitAccessInfo", + "2e6d6b15c5a810b1dda14bbc9ea5021c939a58d501ebbc839f7eecf6e3e5c32d" + ], + [ + "RFLiIsWorking", + "97f3f29734d22b764958054cf0fcce9cb81a679be081fb982af63bf246237d49" + ], + [ + "RFLiStartWorking", + "cacf2f03d348ea7a5fdd2dcccfd5e171c64c956536890b6244235f18f0fe11a0" + ], + [ + "RFLiEndWorkingReason", + "57a6963b4e853eb9e10368929e99b60e453dea30c2865ca68ae6158a2a93f746" + ], + [ + "RFLiEndWorking", + "099e1854e1802cf1e5b9c8dc619347fdc4788c2451bc9deab7370b8ef2584aff" + ], + [ + "alarmCallback_", + "b84616ccc6b47b817fea3ddc8170d4cd21583d1a0ef629cc65d58fd1216e3225" + ], + [ + "opencallback_", + "cf60a0b9a0bff2561ab1cc10728d1027b3b0940ea180b39b2f7fa34ff1e00b43" + ], + [ + "createcallback_", + "972ec9c26e045945fdec9626e5e347f660e0547e733d65eecac7ebbcd239ef82" + ], + [ + "close2opencallback_", + "e2376a887f29d5644067c26179196c592a884a7b71508088b5abf412cf724098" + ], + [ + "RFLiOpenAsync", + "88c9bc878a8f36d7372042b84cf742c617423f12747c52d12e79655d375cf39b" + ], + [ + "readcallback_", + "12c5c90b0e35841c5bae11ada34a826d4f0818c708dc16b316038a140346616c" + ], + [ + "readseekcallback_", + "bdf3b3e7573cb209acb89c45c1d7054fc0163980a80fc288a5058c8e4720d7bc" + ], + [ + "RFLiReadAsync", + "f505277472d19a5fe6b820125768b6237b0570c901d8b44a50c65727335591f2" + ], + [ + "retryWrite_", + "6ad55bef80ed324dba157710df9af74dfdf20ef9f584d530a08c08072e838bf4" + ], + [ + "writecallback_", + "60ccc49988a9c34bbfc186598065ce4cbc0b021a0d3428e5561297c08867fb98" + ], + [ + "retryWriteSeek_", + "da178bc41b4eaaae9b947f842e3bce1511718a72e95ad5e1c3241c441b9a9974" + ], + [ + "writeseekcallback_", + "872045a4276a393082c568781a74a592027d79d31f3fb1f03ad795a122e35d62" + ], + [ + "RFLiWriteAsync", + "5e14652a51ee3ea34200fb873adfae7616823d0d9d47db21dc444c1d935d84cf" + ], + [ + "closecallback_", + "e27cab67fae8478e2e12480983e79fb4841119199ef0638492733eda8be5e991" + ], + [ + "RFLiCloseAsync", + "7bf658fee808845f6e527fde6066abf5aa2fd563d3812c6ce44cafa7851e115c" + ], + [ + "getlengthcallback_", + "194cb2ba0ba42d961b225cf15d18416a427db475c56b5fda68712c84dfc59eec" + ], + [ + "RFLiGetLengthAsync", + "7cccf86c636cb1a36c5c12274f9f130b7f70661782a49dcf58256fad5daf973d" + ], + [ + "deletecallback_", + "97da5fd7afc56320b049df1e8363c545dcfcee89bcaee1c7f2696a10813cdc7a" + ], + [ + "RFLiDeleteAsync", + "78cbfd82ffe512ea0e621d2c54a9c80d90db7ff7083ebe70bf9517f703851a57" + ], + [ + "createdircallback2_", + "12f00304f8cf4df2bcfee16084bce079354e8fe9eb584afe281585ed4a126292" + ], + [ + "createdircallback1_", + "ec17f3b1e68b067140beb16873720361930fde4faaf351643b724ea714236003" + ], + [ + "RFLiCreateSaveDirAsync", + "dfdc1333fec5aeb5d7fee14e4874fdd5da3970af5d01df38de38c999acb2ff28" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDLoader.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDLoader.c.json new file mode 100644 index 0000000000..27f33c37ca --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_NANDLoader.c.json @@ -0,0 +1,72 @@ +{ + ".text": [ + [ + "RFLiInitLoader", + "e0b2171e08dc55a1f38e12170f8e761376d7dc8c8d6dd7f71a4b430df08f2ade" + ], + [ + "parseOnmemoryRes_", + "7e33cef71e6b0686fb8a0f7661ca819b49df274ec0fcef69a0aed0e66f4dba19" + ], + [ + "loadResRead2ndcallback_", + "99cad299d095ecdac933f6e48ff04051a3d57a38990376b34abbb172c24984ca" + ], + [ + "errclosecallback_", + "97f3f29734d22b764958054cf0fcce9cb81a679be081fb982af63bf246237d49" + ], + [ + "loadResRead1stcallback_", + "850f3affaac701af2fc4103c902b83db9e9786396f6bdcb7a92db5ea4c848fc3" + ], + [ + "loadResGetlengthcallback_", + "54bebeb8f0ceba6a6677c0d5d4ba6b5ef7f0b2961273fba6c130df8b193c2ca7" + ], + [ + "loadResOpencallback_", + "2a8c877caccf20bbcce9c9ab775e6b011add5dd140cbf8a7c47f01fff776158e" + ], + [ + "RFLiLoadResourceHeaderAsync", + "2fe7640f240d2987d6e850d5f50b471ff95008a2e24e7067a51fb1885c48c07a" + ], + [ + "getNANDFile_", + "fe2b9c228fec7f80b06e356fe4d78288608373d36994565c7947b0183c157d56" + ], + [ + "RFLiGetTexSize", + "f3cc2e7892128204e2919bc2f17472415e0e328be03b378ea680b45991619f17" + ], + [ + "RFLiLoadTexture", + "022bb0e16c3be9683f1a289aeda4cb0a43b089f6a75e541f569c0af31e3fdea2" + ], + [ + "RFLiGetShpTexSize", + "f3cc2e7892128204e2919bc2f17472415e0e328be03b378ea680b45991619f17" + ], + [ + "RFLiLoadShpTexture", + "022bb0e16c3be9683f1a289aeda4cb0a43b089f6a75e541f569c0af31e3fdea2" + ], + [ + "RFLiGetShapeSize", + "f3cc2e7892128204e2919bc2f17472415e0e328be03b378ea680b45991619f17" + ], + [ + "RFLiLoadShape", + "022bb0e16c3be9683f1a289aeda4cb0a43b089f6a75e541f569c0af31e3fdea2" + ], + [ + "RFLFreeCachedResource", + "b7224fd017935a732c8163cce7ac555b059bdf676f865399053f6f7a336f4687" + ], + [ + "RFLIsResourceCached", + "51f454a2966847d26b82bc3c46542065e84f4d735f95c50ca6b5697807bab80b" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_System.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_System.c.json new file mode 100644 index 0000000000..f44c3075d5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/RVLFaceLib/RFL_System.c.json @@ -0,0 +1,112 @@ +{ + ".text": [ + [ + "RFLGetWorkSize", + "e044af53a255384b9821bfc27c37b8298e0469984e79a57225a5a2caa90c8562" + ], + [ + "RFLInitResAsync", + "da153bd0e6ac0732af4bc21075eb5506e90f10849ca6e27f5f0285b2f5c32156" + ], + [ + "RFLInitRes", + "a9e76979ed03881572859c9c632eb6acfd2503771a250c6af60fe53afce13ece" + ], + [ + "RFLExit", + "d9b5e6b8f27e8d6aa833d039926ddb9c685080f40c133cd455d3310cca581ff4" + ], + [ + "bootloadDB2Res_", + "58c013c3e2d276ae2162437a48f46a7256e12970acb1425babf43a3d1f65b2ad" + ], + [ + "RFLAvailable", + "a2da2ec78910954cd1de343211349769a56f5acd383489762fa01a83a80f211e" + ], + [ + "RFLiAlloc", + "1dbd5558c96aeff9b7f2114ab0953a0072faf9a8e48cb17692da6339208e5805" + ], + [ + "RFLiAlloc32", + "371fa3a42650311a71e5858bf29babc1cabd7d2ee665485b17fe555619c39c64" + ], + [ + "RFLiFree", + "9a0bf9539b89cc8bc35e5dfde2eeb777bdd42c3d19ff3fff44a8cf13fdcc8f65" + ], + [ + "RFLiGetDBManager", + "cf5c526dba3037046a6ba37a395b1f650efec653b43adca624a2e1661f1d439a" + ], + [ + "RFLiGetHDBManager", + "45ae1650773b70fcc85e245d81c4a4c1996c2b97c2dd3f14fb9e7ad43f4cd92e" + ], + [ + "RFLiGetLoader", + "9faa3448a8952ca4cb5aa072ea242c6a16ea13afc1a17133fcb6eef5e68679e5" + ], + [ + "RFLiGetWorking", + "29c4c6ee56f0793767b4233b1bc47e7a1aa8865b6b94d6e3016e001ed4c6522c" + ], + [ + "RFLiSetWorking", + "81299cdad759fc4d00677fd4e566d7cc7942fc266ba77b68bea5d25c3d922bf1" + ], + [ + "RFLiGetManager", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "RFLGetAsyncStatus", + "86e11ac2dd943cc074d95ec019761407e9f410152236937eae4bfd20a73db39d" + ], + [ + "RFLGetLastReason", + "bf098e8aceffae7e1be176251fd1fbeec016f62891ee82f0464156d36551568b" + ], + [ + "RFLWaitAsync", + "68916deeba9b292b1c921a55da7d813c039bcdfc0cdf7a616c21cd5ae14f8609" + ], + [ + "RFLiGetAccInfo", + "a0970716486ba1398b44e6ec5c8ce125ce78ab64bf9801c2c6b62dd34e48034a" + ], + [ + "RFLiGetCtrlBufManager", + "65f24d9ed5d2821c2e8040c4aa306b03cb4664f8c3a64f194bfdd3ac32837331" + ], + [ + "RFLiGetLastReason", + "ccdf51df4c4869abd85602c42979a7eb698718df3b3e2b663436edbae631293a" + ], + [ + "RFLiSetFileBroken", + "bee7dd1340320041d106a481b27a2cc5278621fcd9e7cbc49534764baa5f8637" + ], + [ + "RFLiNotFoundError", + "1ed2d790070f957225aef1b2611b801f66955eb8c83fdccb0b993e3b1aa0b654" + ], + [ + "RFLiNeedRepairError", + "616b68ba44e8cc9b15fe2dd02313bedb5da243c80cd052031edf7f37c47bc3df" + ] + ], + ".sdata": [ + [ + "sRFLLastErrCode", + "b40711a88c7039756fb8a73827eabe2c0fe5a0346ca7e0a104adc0fc764f528d" + ] + ], + ".rodata": [ + [ + "scCoordinate", + "83ca965ae4faa5ac5c86354830577b3afd077481f243ded24f6705f507945661" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/AI/ai.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/AI/ai.c.json new file mode 100644 index 0000000000..3917acbaf7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/AI/ai.c.json @@ -0,0 +1,84 @@ +{ + ".text": [ + [ + "AIRegisterDMACallback", + "4f3f7174bdcc129724938a4733492348ff933fafc914f6d9c812b8a76d3fc680" + ], + [ + "AIInitDMA", + "37ce062f04a4608b0349a76cca73dea21b5310ec75b84c5b7ea62486a84ef373" + ], + [ + "AIStartDMA", + "b6cf9bc94b5f5b7176640b13a3fd35aa7b8dc603384d593725e55812280078e5" + ], + [ + "AIGetDMABytesLeft", + "5f82456b08aeaed4607c4f1ded6072067df3568a4d0052b2733bc4f17183ff0b" + ], + [ + "AIInit", + "21d3b5cf64da183a7939b367b58dbc77758ec0b3fa367e85158cafd396697d67" + ], + [ + "__AIDHandler", + "164e33c78cc216f56e940ce86cecda6bbc0fe0909e7d90fd5ac5af7b5361e158" + ], + [ + "__AICallbackStackSwitch", + "dd16cb76f406e39adbf778280fbfd30fc423afbf6d985bd8c9af1ed12eb9fdc2" + ], + [ + "__AI_SRC_INIT", + "4722c796ba36f840ed941b38da3ceb4e9ff8b1014d81e9cad08ff57bbe650b0f" + ] + ], + ".sdata": [ + [ + "__AIVersion", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ], + ".sbss": [ + [ + "__AI_init_flag", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__AID_Active", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "buffer", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "max_wait", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "min_wait", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "bound_48KHz", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "bound_32KHz", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "__OldStack", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__CallbackStack", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__AID_Callback", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/ARC/arc.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/ARC/arc.c.json new file mode 100644 index 0000000000..9256ac7858 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/ARC/arc.c.json @@ -0,0 +1,56 @@ +{ + ".text": [ + [ + "ARCInitHandle", + "97a3d450142464099bf474dbf53fc1d2e4ad636bf4d52871e941f13dec4ec43d" + ], + [ + "ARCOpen", + "1f5fbcb76a02cdf8e0a9e5fc94acc8763c4e54c891ec044ae0836b7d5ca99369" + ], + [ + "ARCFastOpen", + "6ab16a4bf919fc1100a7e1ec5cbaf9cfa167aeee5f56553ebf1a04cddf6610c8" + ], + [ + "ARCConvertPathToEntrynum", + "d4298135f35a889358e68742447994c353e77bd8eeafeb6d317a4855e416eb4a" + ], + [ + "entryToPath", + "1efdb7014ad23c939b1418abc78ca2f8b718e259a30b7821444d22ca8a75ae7b" + ], + [ + "ARCGetStartAddrInMem", + "4dafee4563a09c50930d3a547b6676d9fecae13aa905160ba7b8c6c4de9d695d" + ], + [ + "ARCGetStartOffset", + "f01b2bfb22bc411597341b812af51c385bc67bd50c60fd4d40fb07557d52b19a" + ], + [ + "ARCGetLength", + "59fdcae5f48fe0f3f53325d0a334381138490d2632049b646d44c2cb75668e68" + ], + [ + "ARCClose", + "2bf7a94759a252fd0d2af700ff876c19ab13998fb28ac5b0db3c70cdbc9ef8d6" + ], + [ + "ARCChangeDir", + "7212203edc72c955284501030dcfa933335a6d20e0abefd87e7a6cfdedafc695" + ], + [ + "ARCOpenDir", + "a686903d7fef5819d3f20d8a01f26e72bcb0aaed8e7dee7cba1277c75687c4b6" + ], + [ + "ARCReadDir", + "548b4a200bb1cca32dd5eed16ab60918a312718431734a20f6f178e38ec618db" + ], + [ + "ARCCloseDir", + "2bf7a94759a252fd0d2af700ff876c19ab13998fb28ac5b0db3c70cdbc9ef8d6" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/BASE/PPCArch.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/BASE/PPCArch.c.json new file mode 100644 index 0000000000..9d5d8f19e0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/BASE/PPCArch.c.json @@ -0,0 +1,100 @@ +{ + ".text": [ + [ + "PPCMfmsr", + "9525674a8026401744bba68614e1dea4655093ed62cdb568a98574f057908fa4" + ], + [ + "PPCMtmsr", + "d159b9c1f958da638d09cf0a3030cc82707d6bdf5f4f0b2738d4463ddf892d07" + ], + [ + "PPCMfhid0", + "019ef0a25f76e3dc388ef40339f8d5032c52a9175fdf10b47e3f74e1f882f4e1" + ], + [ + "PPCMthid0", + "0716be168dabcdcbeb9e3c9075e08eab49608ca56e933ad47bef7e0c225db14d" + ], + [ + "PPCMfl2cr", + "3349d0bfe36355c04a26c64815f1a74b84e496fd4569897dafb16a4f4a447cec" + ], + [ + "PPCMtl2cr", + "ab1fd97c7f94fab60ba1005fda514cac689552ea5dcaf6e271a180adb0f32eac" + ], + [ + "PPCMtdec", + "7577c8f662ee24b9b8894da65ee531acf41c4da458f7674e1e89e9be0f767a52" + ], + [ + "PPCSync", + "1560a9543d41d35b61c288453bb0972cfd1359499e5fcc7ef1e2c52391fa12cb" + ], + [ + "PPCHalt", + "f4b43fa59915634078204eae0ddf139031b1cf65049a8590fd3b1b0318de0d58" + ], + [ + "PPCMtmmcr0", + "cbaa9749f12ceb65805ce0006509634acade9f80ebc2ae008dce537d711d6314" + ], + [ + "PPCMtmmcr1", + "0237d18f9dc1e62b50679e83e7450439330e0dba4a58224e9ccb2506dd4e53c6" + ], + [ + "PPCMtpmc1", + "5aa2c1c07e2e2a930356a13dda51093fa1a55f881f9660d75bbadf840d5101e2" + ], + [ + "PPCMtpmc2", + "5119a324df6ee894ab0c95a5311d56c00622efc52a12cc88ce5ed9cf8fe377c1" + ], + [ + "PPCMtpmc3", + "71c9a3e24c82ee289579ce908e25dc3f9a8181a226d0c3369e8085c9072f3d91" + ], + [ + "PPCMtpmc4", + "fee989f48c823834f3bfc59321ce7e001bea5d55c499a5fada637858a3192adc" + ], + [ + "PPCMffpscr", + "799488d2ba85d1f4af9e609c1380c2ed06a7dc0af36caae5f29be315b1432714" + ], + [ + "PPCMtfpscr", + "2d4dd336ea3465b72633c1d21bcd8ed27520595541278575b86ca7bc960993f5" + ], + [ + "PPCMfhid2", + "3aab7bf4121c214ff068df6a3326e2a637f2abb7a40064fc0516847d629ff51a" + ], + [ + "PPCMthid2", + "90e4eba9f31aa2885c8f5ada6b3c5d6f694b9e54f362b8af02e12abde054b599" + ], + [ + "PPCMfwpar", + "5882ed333d61193341c80c4ba985212a8ee2d26c8837820d429867c27c160a14" + ], + [ + "PPCMtwpar", + "67fa43b7cdebc70d41db82010c290cea0385b707d272548f1545438cc79ea89e" + ], + [ + "PPCDisableSpeculation", + "5187ec07ff4757ffd3f1a1a7364596d6e289b453a12e0a5646b7c6f1ab4daf43" + ], + [ + "PPCSetFpNonIEEEMode", + "3a6126d0086eb435cc6fd88862e12f7ff23f4d494b89f9ba8177b2adcfce8dab" + ], + [ + "PPCMthid4", + "ddd63a64ad1b3c17c83ad13ace90b6c47a296b8ac9bda230763f5fd6872652e5" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/CNT/cnt.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/CNT/cnt.c.json new file mode 100644 index 0000000000..169e9ecd81 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/CNT/cnt.c.json @@ -0,0 +1,24 @@ +{ + ".text": [ + [ + "contentFastOpenNAND", + "fbc49806d4392b94af3500278cf6a7497c715c113ba6e0e4558689d8e4352c75" + ], + [ + "contentConvertPathToEntrynumNAND", + "97f3f29734d22b764958054cf0fcce9cb81a679be081fb982af63bf246237d49" + ], + [ + "contentGetLengthNAND", + "59fdcae5f48fe0f3f53325d0a334381138490d2632049b646d44c2cb75668e68" + ], + [ + "contentReadNAND", + "2c0acbf1cf1c0fcc5159d2af915c19812c3bac63618009ee863678c38de233d7" + ], + [ + "contentCloseNAND", + "d4e9e7520ef19698837e384bfe1708ac4b91fcf26b16ec098ec21c1e344ad3db" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DB/db.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DB/db.c.json new file mode 100644 index 0000000000..cc4c26c99c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DB/db.c.json @@ -0,0 +1,34 @@ +{ + ".text": [ + [ + "DBInit", + "b318375e5b8408ba797f0370190db5126000d173bed561cd73655d23a1c88d9c" + ], + [ + "__DBExceptionDestinationAux", + "9eff0b344ce8140f911fe3d54f280aae629cd61f0b4406b5c625c6e0149f79d1" + ], + [ + "__DBExceptionDestination", + "a4378129d140f048f62ba047db86366798ca000dbc4315bad1c7591bb0fd5bc4" + ], + [ + "__DBIsExceptionMarked", + "acec917b0d1debeb6ade842c58c4b358774e459727597106b19dcd8a2218c774" + ], + [ + "DBPrintf", + "d0cae8c3f5437f967d82becb892c3c5344c4113435cef83642dc602d29052bbe" + ] + ], + ".sbss": [ + [ + "__DBInterface", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "DBVerbose", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp.c.json new file mode 100644 index 0000000000..52a423694c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp.c.json @@ -0,0 +1,48 @@ +{ + ".text": [ + [ + "DSPCheckMailToDSP", + "ae4fc63c6f48b4aa4780f7d72d0d4be5669f495137d0f85cb80aae48a2beee0c" + ], + [ + "DSPCheckMailFromDSP", + "cf9ea172dbe050d433b32136a0bea65f7c4b6eb1f8aa8ac1f4b1b5ba0f444535" + ], + [ + "DSPReadMailFromDSP", + "8fac338b1042c48fbcbee22d9cf85688aa8d490d1f6db49215e53912854a8e6f" + ], + [ + "DSPSendMailToDSP", + "a2dec6876012061b2e98d37c9fec3da99f7ea1ca34ca9197be7486488e8c3f42" + ], + [ + "DSPInit", + "79c8a233d7ee809c72edf7d153b058007cd8bd8116fd54bf675ecda0bf9538a2" + ], + [ + "DSPCheckInit", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "DSPAddTask", + "0ffa10d650b138644e15b69d5e99cb4ba8c8793efe9506dadc2333f35ab85e4e" + ], + [ + "DSPAssertTask", + "25cc5af710109d2f2e9cab34efc7cfecbb6c2c796cd0b7f396bb64ccb6d58a6d" + ] + ], + ".sbss": [ + [ + "__DSP_init_flag", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ], + ".sdata": [ + [ + "__DSPVersion", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_debug.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_debug.c.json new file mode 100644 index 0000000000..91a0a0c0c2 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_debug.c.json @@ -0,0 +1,8 @@ +{ + ".text": [ + [ + "__DSP_debug_printf", + "d0cae8c3f5437f967d82becb892c3c5344c4113435cef83642dc602d29052bbe" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_task.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_task.c.json new file mode 100644 index 0000000000..7e970f0576 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DSP/dsp_task.c.json @@ -0,0 +1,50 @@ +{ + ".text": [ + [ + "__DSPHandler", + "b6ab67014cbe7f5e7f4b04ae516260b85d5b322feafb9f88787a7877e83a5ed3" + ], + [ + "__DSP_exec_task", + "4c8dcd02c33061074af4a62e57789ac3a9a9e36d37b91ab4fe963cad18786d85" + ], + [ + "__DSP_boot_task", + "b2fa8cca89bd07e966cf1d46ebae5df73f75ef2538b23cfe105d824ace8bc934" + ], + [ + "__DSP_insert_task", + "5960b3325df1a91b4abf0994d3e24f4728d9e6c1055ea5899a8c1891a8367af7" + ], + [ + "__DSP_remove_task", + "9e1ea4762827db17167b0ff261f00712900d6c853fcaab4a2a9b0e9b4eb72bed" + ] + ], + ".sbss": [ + [ + "__DSP_rude_task_pending", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__DSP_rude_task", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__DSP_tmp_task", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__DSP_last_task", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__DSP_first_task", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__DSP_curr_task", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvd_broadway.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvd_broadway.c.json new file mode 100644 index 0000000000..32900a6038 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvd_broadway.c.json @@ -0,0 +1,170 @@ +{ + ".text": [ + [ + "doTransactionCallback", + "c274119af0a08c3edca3bd31f054b3efa4a26c08215f84a9c1bf8b86fb97b233" + ], + [ + "doPrepareCoverRegisterCallback", + "b845272d66c9b265ceba46b02c27f2c49b4f85b41d700d87ff27b87d016808ee" + ], + [ + "DVDLowInit", + "c60f7aff49782e6454e84e3bc6e4cbf16b85a7a18241a558872d64a1a936324f" + ], + [ + "DVDLowReadDiskID", + "8587a4dd8e6adda4db37c3e0839ee2a131942d702c3fb9fbda5a254e5ee8badc" + ], + [ + "DVDLowOpenPartition", + "787e4ce4b4f1cf1583a7f4b5bd853a54e03fd313fc056f6d6a64a8e5afcac9c3" + ], + [ + "DVDLowClosePartition", + "df59a725b50ac8da5d3c0e5aac6ab82ce4e39cf009f4de129aa09e40c9e4468c" + ], + [ + "DVDLowUnencryptedRead", + "9aec9456dd8f7e979584cf245906c61b4dbe0b04dff4fc1b578fda6d9b201ac5" + ], + [ + "DVDLowStopMotor", + "5daa9d034e194a9636cf8e06f8fd81a0ece8a9a59b0f77eaf540c2933254fa5c" + ], + [ + "DVDLowInquiry", + "a5461660c579016097725dc8c6f28c23aa1b343f06ebefca58d952210509630e" + ], + [ + "DVDLowRequestError", + "47533624d4b8080c967126b73a6d5d89babf30867c8bc7e714c6d18fa6a9862d" + ], + [ + "DVDLowSetSpinupFlag", + "be3c5ef3c7837a12c21cacff735cdce8c69c9c533bf34c5c027f074f1e45f12a" + ], + [ + "DVDLowReset", + "b7be49372c9ded7036e55e8b71d2c223c3756358136f5530590bd4703edd3740" + ], + [ + "DVDLowAudioBufferConfig", + "d22a28610a483fedc185f04874575719ecd6aa4c13283ff5abf37cc8fd4c4c0d" + ], + [ + "DVDLowSetMaximumRotation", + "6052b29d9546e0afa40660151027cc4898c89578c893c78246d62495adb92899" + ], + [ + "DVDLowRead", + "71fe2a254a4cbb553b8601a2f87a753bfa6dea0067800e229bdef85d6d20a1d6" + ], + [ + "DVDLowSeek", + "2139ee7e32939e834143aae5fbf190bf6a6ddededd9a03394fe4f099d96778d2" + ], + [ + "DVDLowGetCoverRegister", + "64c3b28b871a1aaadc1f1edf588b109ef560f0a1f70f29e011a5154dcef701f1" + ], + [ + "DVDLowPrepareCoverRegister", + "8aadb4345f0c323c7eaf29e4622b4abda338408181284fbb8612e36eb9aa70fc" + ], + [ + "DVDLowGetImmBufferReg", + "c3c3c300c6263b7b19f1562336ddc2d1cdef718a09324c98bc1150052f9e5b86" + ], + [ + "DVDLowUnmaskStatusInterrupts", + "2bf7a94759a252fd0d2af700ff876c19ab13998fb28ac5b0db3c70cdbc9ef8d6" + ], + [ + "DVDLowMaskCoverInterrupt", + "2bf7a94759a252fd0d2af700ff876c19ab13998fb28ac5b0db3c70cdbc9ef8d6" + ], + [ + "DVDLowClearCoverInterrupt", + "84cfd1768b6fc456940c54e46f046ebd01b49f6c761c997b85c7ee45a7a4c413" + ], + [ + "__DVDLowTestAlarm", + "d4e9e7520ef19698837e384bfe1708ac4b91fcf26b16ec098ec21c1e344ad3db" + ] + ], + ".bss": [ + [ + "dvdContexts", + "38723a2e5e8a17aa7950dc008209944e898f69a7bd10a23c839d341e935fd5ca" + ], + [ + "diRegValCache", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "registerBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "ioVec", + "2c34ce1df23b838c5abf2a7f6437cca3d3067ed509ff25f11df6b11b582b51eb" + ], + [ + "lastTicketError", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ] + ], + ".sbss": [ + [ + "requestInProgress", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ], + [ + "callbackInProgress", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ], + [ + "freeCommandBuf", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "freeDvdContext", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "dvdContextsInited", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ], + [ + "DVDLowInitCalled", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ], + [ + "spinUpValue", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "readLength", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "pathBuf", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "diCommand", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "breakRequested", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ] + ], + ".sdata": [ + [ + "DiFD", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdfatal.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdfatal.c.json new file mode 100644 index 0000000000..15463f5754 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdfatal.c.json @@ -0,0 +1,26 @@ +{ + ".text": [ + [ + "__DVDShowFatalMessage", + "60f1c1e713b4026355f5db172546498ace5c4680ea587b2a744c74f4a715d85a" + ], + [ + "DVDSetAutoFatalMessaging", + "588df802dbe51b548e84724f0dc3765b14c278caac05bf4a19137f45f3cb5dec" + ], + [ + "__DVDGetAutoFatalMessaging", + "a2da2ec78910954cd1de343211349769a56f5acd383489762fa01a83a80f211e" + ], + [ + "__DVDPrintFatalMessage", + "54240e801bba26d2da5445f86a2aa28e40fc7c1d98ac81dc29e4ae498596b232" + ] + ], + ".rodata": [ + [ + "__DVDErrorMessage", + "3addfb141cd7c9c4c6543a82191a3707ac29c7a041217782e61d4d91c691aee8" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdidutils.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdidutils.c.json new file mode 100644 index 0000000000..55c22eef7c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/DVD/dvdidutils.c.json @@ -0,0 +1,8 @@ +{ + ".text": [ + [ + "DVDCompareDiskID", + "5ddf4791f0d5bd1df600aa6e0c1df4feb84061de8ec703f551cd9e4a66a11f62" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXIBios.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXIBios.c.json new file mode 100644 index 0000000000..eba242dc47 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXIBios.c.json @@ -0,0 +1,81 @@ +{ + "OPT": "-O3", + ".text": [ + [ + "SetExiInterruptMask", + "212f228f81680b6e4dec77f18191072b2ccc1f1033df606912abb7934271a065" + ], + [ + "EXIImm", + "9fbe8f9fb1f9af944f2ddb88a6524fa63c375af1925332613f540ffcc172dfb4" + ], + [ + "EXIImmEx", + "dcce0ce96ea8224a85e6112ec085d5f3ef72b88454393725e7fd9f14da377347" + ], + [ + "EXIDma", + "9abb3fb2262b438d3b664bcd917e031740563ac32e5c4705d7d98b607bfa69fd" + ], + [ + "EXISync", + "df319e6957867f18df70542cbc3801ff260cd311fcd1ce52bc0afb22c9fb28f2" + ], + [ + "EXISetExiCallback", + "0b070642e5a7bdf6d25f92f44cd83974c94bc89246cc6d037023ed1492e561b0" + ], + [ + "__EXIProbe", + "931b9a344354277a80bb49e2c5f4c3ddd2b1ecf98ea08eed95faaef9138dd24b" + ], + [ + "EXIAttach", + "dc8b3cc2db52323e9001034e6a90c3986e0587524934e19c4320e7cc94911ce2" + ], + [ + "EXIDetach", + "70e373b4042073ba728e1a7b0055c805ef923f181de552aef9beedd78e829ced" + ], + [ + "EXISelect", + "436b31d982d842219d84fce6d3f993c606d820b842c86bb5456f6bd16f314336" + ], + [ + "EXIDeselect", + "7a0c3a92718acdd5df0662842fffc350f246d7d1eaa34d5abd70a041d35a4005" + ], + [ + "EXIIntrruptHandler", + "2652fe50569c157c7d21b8708b0cf19fa8988dcb2bff2856bd7dba256b0c5bb1" + ], + [ + "TCIntrruptHandler", + "c337bd8f9290fa97244d42a34cdfeea3a9ec25b0ca0bdc69dfa3dab64eeaf5ac" + ], + [ + "EXTIntrruptHandler", + "098cf519921cbcdf5235567480f4fd107f58675ab73f5a89250ee62a0edd7052" + ], + [ + "EXIInit", + "022c630fad7e7aa8da6f21cedf4910658f14e1d679ca2b526fd631ca2799dbee" + ], + [ + "EXILock", + "fe5ee24a3136a893195d12a8db276913b02a1c6f6a7b8138e1a131ed92c16508" + ], + [ + "EXIUnlock", + "8e46435e25839a0a79245f93c214336c6f7f69fbc7ceab2449659768b7205038" + ], + [ + "UnlockedHandler", + "90057cdbaec2e9382dd2117ee9be22b8b21f29ce9c20a4de1479c04629cef896" + ], + [ + "EXIGetID", + "5512c97eb7272cd60b3466a96361201fa58203e7ace49e24f0c930f316073daa" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXICommon.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXICommon.c.json new file mode 100644 index 0000000000..04001e3109 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/EXI/EXICommon.c.json @@ -0,0 +1,14 @@ +{ + ".text": [ + [ + "EXIWriteReg", + "8a71818702c74d4a08fc75e6f4a07376577074b96f2729e109813dad57ac3870" + ] + ], + ".sdata2": [ + [ + "__EXIFreq", + "1bc5d0e3df0ea12c4d0078668d14924f95106bbe173e196de50fe13a900b0937" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/FS/fs.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/FS/fs.c.json new file mode 100644 index 0000000000..fa9afd0101 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/FS/fs.c.json @@ -0,0 +1,136 @@ +{ + ".text": [ + [ + "ISFS_OpenLib", + "e52415fae4c31f2b1950cd18591587afbeb5a13a31f7143272295eb529806e88" + ], + [ + "_isfsFuncCb", + "d69cc872ec34a0c97560397481a12c20b5d6f51b9d265f2b056e6abefcd91a09" + ], + [ + "ISFS_CreateDir", + "12b10f0b7fe446619d6acfd657af0dd2a0fad6f7b7cca3f2e511b863371121f3" + ], + [ + "ISFS_CreateDirAsync", + "f5a4b480901bf586eb17baa9a26edbd7d6c0aa1b1c07ba67f4cbea00125d8f1b" + ], + [ + "ISFS_ReadDir", + "9476dd7ffa208c21b37ca057750321223dafc43286b11ab8ea69de4ae18583da" + ], + [ + "ISFS_ReadDirAsync", + "1c85c1f7b073124af80c839daf8c1e2d13778a678d8d76397a1ea15e0f7b087d" + ], + [ + "ISFS_GetAttr", + "10afc9d485b8b95ce797d88d37ac121a4c3f63a2858c421e4f82eaa73168de6c" + ], + [ + "ISFS_GetAttrAsync", + "2ea678d0845ef76130bc1c84ef92b192f9b654e4b5c5690b6fc8ff6835e12798" + ], + [ + "ISFS_Delete", + "d220601782c8e65ae15f6713870513b6e76f1d93fa334088d15aacf7387038da" + ], + [ + "ISFS_DeleteAsync", + "e0e98674a55f05e0f20ac4e3ad77b022e589116ac2df6ebb9cc5cc679ed83f37" + ], + [ + "ISFS_Rename", + "be103effcb6308a9b4b5bb629441bc0fe39603899da33159fbd20a8865558253" + ], + [ + "ISFS_RenameAsync", + "9bf9f8d4ecf0829bcc3f6af67c0119602dddb0801cb35d441fd655e1858a186a" + ], + [ + "ISFS_GetUsage", + "c533dba54d0a6ed96b110703a448390c1daa76037681468be72683a941fdcd94" + ], + [ + "ISFS_CreateFile", + "bf7daa8cd88b7f72550320b4d3d0ee6d94fe2a47ab54b5364d8a8214bceedfe2" + ], + [ + "ISFS_CreateFileAsync", + "98d80eec34d7a5586798916e524cbaad38a95b33de89712dec8c40f7a99e5d3a" + ], + [ + "ISFS_Open", + "99e91e339dcb4d77896fa0dd8b233d79363734f75a4e872e8f03b8cc742f72b8" + ], + [ + "ISFS_OpenAsync", + "18fbdddf3e723f8676653d68d1a13bf184dc6076d12656b4f946f500fddf2d64" + ], + [ + "ISFS_GetFileStats", + "31d99dca11ad76710228b2b19e69e91c11cf71a806f9ccc18345c1b980a19fae" + ], + [ + "ISFS_GetFileStatsAsync", + "a32970373c597f0c2fd31616486c4f1044d90160985dcec14ed4466d7f7420a6" + ], + [ + "ISFS_Seek", + "97f3f29734d22b764958054cf0fcce9cb81a679be081fb982af63bf246237d49" + ], + [ + "ISFS_SeekAsync", + "1340486b9a080c98daa18834062a31d2ed7faab9b81499bc1e8bd93b0bc4b5f1" + ], + [ + "ISFS_Read", + "516f1dc9369b1db0f14dfd436f352ae4b29c8f6edbf33c464d97dbc6d7b64dda" + ], + [ + "ISFS_ReadAsync", + "c6e0a4b8a6e3dba2b831f21d177c1b7429411338ce12b5cd60dd447fa87abfbe" + ], + [ + "ISFS_Write", + "516f1dc9369b1db0f14dfd436f352ae4b29c8f6edbf33c464d97dbc6d7b64dda" + ], + [ + "ISFS_WriteAsync", + "c6e0a4b8a6e3dba2b831f21d177c1b7429411338ce12b5cd60dd447fa87abfbe" + ], + [ + "ISFS_Close", + "97f3f29734d22b764958054cf0fcce9cb81a679be081fb982af63bf246237d49" + ], + [ + "ISFS_CloseAsync", + "8261ea69c509853c0a226c8698e1a0422a4dfb5f36a836ea2fd7ef2c8315c02d" + ], + [ + "ISFS_ShutdownAsync", + "d384c5e9a3404abbf8ce5e65b9c5752a4d7f2ba8b857d700f941d850df564547" + ] + ], + ".sdata": [ + [ + "__fsFd", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ], + ".sbss": [ + [ + "__devfs", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "_asynCnt", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "hId", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXAttr.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXAttr.c.json new file mode 100644 index 0000000000..90458cc1b7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXAttr.c.json @@ -0,0 +1,68 @@ +{ + ".text": [ + [ + "GXSetVtxDesc", + "42b88300111e7d3b8bacc118f2e647b92bfd401270a0a799e1fe9d46fed8cad7" + ], + [ + "GXSetVtxDescv", + "f3c606fa153fb1114c7e693cb673f16011279cb4bcb19f5dab2c24006c65a837" + ], + [ + "__GXSetVCD", + "32ce0058d76c3a24bfddfafc2e653606b64420849bc533437fc8b10887b90997" + ], + [ + "__GXCalculateVLim", + "17c0ca7845037ecce7ddd8d57151e07a141baab1d312abb0b99be756f089c430" + ], + [ + "GXGetVtxDesc", + "2c4080bc33244cf01b54e50014a7d25af8ce0b2808468ae7e3b4015cfb4e9e1d" + ], + [ + "GXGetVtxDescv", + "f7efafc73d7183cbcc9f188c559df27ba1f9054cacd6c2ca4258cc81e78bd2db" + ], + [ + "GXClearVtxDesc", + "1397f3a52a7d933ddc747625157e12f46253d3c34620a5319ca487ff6563abc7" + ], + [ + "GXSetVtxAttrFmt", + "a72b75a352aff4cd4841f2076ad645fe24d8d5d3b80d416696531769b71695ad" + ], + [ + "GXSetVtxAttrFmtv", + "43a94530b8528320db3110bd91ff5789e289deb965cf0d95b8ceaf99d4ab0868" + ], + [ + "__GXSetVAT", + "e31c46d87728c39e6f6b7dd1081f1120a606f823cb31d25ed75e2ffe06aa3c0e" + ], + [ + "GXGetVtxAttrFmt", + "7898b1d346e931f3bc463197cc6be12180f7d74953e5237a97d27c5cb3d20db9" + ], + [ + "GXGetVtxAttrFmtv", + "277b8232b438161d39d5e556fede906a1de7438f138824d8def38974f7be27f0" + ], + [ + "GXSetArray", + "5d6a577be4c1d31e70ed06ee0bf514c17e3b3fc2fd3e41ac896cdcd07540c7b8" + ], + [ + "GXInvalidateVtxCache", + "c4aae338623df64fd243b0dd6530a21e0f7070dc4c53c09b10e0d337a185a9c0" + ], + [ + "GXSetTexCoordGen2", + "0dc691d95b07ba61d970c287505e667fa25a55d6a156c2d21bc9ddff8538b0ef" + ], + [ + "GXSetNumTexGens", + "802e53ce7b7d86d0c6f808c67e257ad48741c9414c12269296695fb0d0b119a9" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXBump.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXBump.c.json new file mode 100644 index 0000000000..6c28ceb86b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXBump.c.json @@ -0,0 +1,40 @@ +{ + ".text": [ + [ + "GXSetTevIndirect", + "abfd729212d36931f293a19ebbecd46f58e66e67bca9f7d85b0ca41802742c6a" + ], + [ + "GXSetIndTexMtx", + "b08a80b9bd808738980a1fc15989fbe9ac272e0f70087f1287d4ba77b59d33be" + ], + [ + "GXSetIndTexCoordScale", + "1b00c76fae4f8765c7e17af1cf158e75856953cace9fd0078ce4c9b15d20bb0d" + ], + [ + "GXSetIndTexOrder", + "ba1351ce0c1a50cb3ee98636a27b5aa6766e9fd3ab6245abe0327c1a42e82e88" + ], + [ + "GXSetNumIndStages", + "1dc2092f84ad63f7606419a120b357be360ffffa2570ca5d9ae08daf94ca1bfc" + ], + [ + "GXSetTevDirect", + "15f569357f34602c8ba0bfd830fe5c5d9891291e85f9fb9f4ed967fca48787df" + ], + [ + "__GXUpdateBPMask", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "__GXSetIndirectMask", + "51102ff00d08a3c9315b50a2a011df292fcef61e27566a18d9b71aa86eaa789d" + ], + [ + "__GXFlushTextureState", + "f65e963ff58c13d2cbbb8adf04059e22d6daafca5e2ec616132b8d929d0e149d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDisplayList.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDisplayList.c.json new file mode 100644 index 0000000000..9a5ee50341 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDisplayList.c.json @@ -0,0 +1,16 @@ +{ + ".text": [ + [ + "GXBeginDisplayList", + "99095e8a5e08bfa0dfd2bcc123fe49be91064a24e2b1c83297c82912dda6ca79" + ], + [ + "GXEndDisplayList", + "d00b16312554d967adfa0b85acb6ae0369b2e95fb98381b58d60d11408017ce3" + ], + [ + "GXCallDisplayList", + "341870824f16df2aed5fd08f73784e300e8bb0f0d78fa8973f8f17132acbd7ff" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDraw.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDraw.c.json new file mode 100644 index 0000000000..da6b60386d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXDraw.c.json @@ -0,0 +1,22 @@ +{ + ".text": [ + [ + "GXDrawCylinder", + "399966dfd2805f52212416f8921c89b88ed2bad96819000370933f219b44db84" + ], + [ + "GXDrawSphere", + "03a25c98044bd734abd24e4936f5f6378ad054c63b7b2d43d528c36241298869" + ] + ], + ".bss": [ + [ + "vcd", + "a5645e7a3fa0866cde8842c4dab96567507c3d1a3c028b816bc63f6966367b70" + ], + [ + "vat", + "1fe2373734955e60c172999142934b52e69ba7ab9039b3c18ea54082ba32afcd" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXGeometry.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXGeometry.c.json new file mode 100644 index 0000000000..9cb4a237fb --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXGeometry.c.json @@ -0,0 +1,40 @@ +{ + ".text": [ + [ + "__GXSetDirtyState", + "0377377f7d3b7c4ba0e9799516006ac017ebad3bbc195d8870da194450497323" + ], + [ + "GXBegin", + "1c79e88b4fbac2782c0f5b434cb52db5e24d87577d61aa5754e9022592caed1b" + ], + [ + "__GXSendFlushPrim", + "dbe9673afa6e9f063bf932455164aecba873a27da7c16bc98e54c31db1900072" + ], + [ + "GXSetLineWidth", + "0d186e23cccb3d899791236b464be0a73a50263ca26aea9971fe6c4caaf6aae4" + ], + [ + "GXSetPointSize", + "0c0ce252c1552fac24e9152fb99d5072bd5a5972e788084874c12699820b6d48" + ], + [ + "GXEnableTexOffsets", + "ee96e6a353ffe930515a01afb56f3b9d466ea2f136b24bb80b7e11c0020c46ba" + ], + [ + "GXSetCullMode", + "0e91c1580de01cad37394c41ae5c2513f40fab238326aeb1430d4a51831fdde1" + ], + [ + "GXGetCullMode", + "38995ce89e4eb5aa2045caacc1e51e401b258c99bb715c1d9af465c323d5413d" + ], + [ + "GXSetCoPlanar", + "f113286a6052c5d421f3757d95858c481571faa5c479c5644e0265df9c5e6934" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXLight.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXLight.c.json new file mode 100644 index 0000000000..347b208647 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXLight.c.json @@ -0,0 +1,72 @@ +{ + ".text": [ + [ + "GXInitLightAttn", + "2beb9b433edffbd232621e9ef2aa2e3cd41d59c658715360b454782f5358c2a4" + ], + [ + "GXInitLightAttnA", + "59bd9d11733616320545b6edfd7fc59cc531db42bde5e89f82cc34b2d9d2aec6" + ], + [ + "GXInitLightAttnK", + "3ae997fb4071b15893d59c11f1992497a9f17941228ff702e5ea6eb07dc2347a" + ], + [ + "GXInitLightSpot", + "b85ec5aa20f8f5b89c8e7f4e5212b1269ee7e409c61189d3671b1ff031dfb55f" + ], + [ + "GXInitLightDistAttn", + "34c89d0b4828a1958161cd592535588b351b6d51b40bdc7bd9582bbde6bccc9e" + ], + [ + "GXInitLightPos", + "7cfe78d4756fd9047b23ccc6a249eea9d1f1534925eca2c252293a57ded120cf" + ], + [ + "GXGetLightPos", + "6085a46d254ce589e6bf6c9d562972c33705972dfac55c352e9eed399600fb15" + ], + [ + "GXInitLightDir", + "ba29e7ed1bb8e8aba3964101197af44bf15856c2f8ca1ad3935c98c6590a0331" + ], + [ + "GXGetLightDir", + "766ac5536f383c15f3770d75e34e92e41eaf6271d4cebb2b8705e4e6623aa1fc" + ], + [ + "GXInitSpecularDir", + "b80c04c48f00785c5df9bea5fb33221f20f4abde612d2a458d5d0e6ad5528db3" + ], + [ + "GXInitLightColor", + "9d5dfde48f0b38987d218fbec67b36e8f843473b6e4dfc136823943f3fb648f6" + ], + [ + "GXLoadLightObjImm", + "c401ed8cfd840975a42f63d0e1b0a8a52c99d93fb71e0b94e974e22237b160e6" + ], + [ + "GXLoadLightObjIndx", + "393719634283d9bff4ecac6df110507dd40ce77e0bc0eaf3ffc4a3c39fa9b2b9" + ], + [ + "GXSetChanAmbColor", + "a897ba2b008b0dba905a664dd1ef8b0ca6081d076a509fd816521e17273aeca5" + ], + [ + "GXSetChanMatColor", + "804c2e4d8e2808599f280c88124581b31fdfa05bf3d84ea043b817bfae25c376" + ], + [ + "GXSetNumChans", + "1badde8eb4f35091954aa2bfa2bfc93b96c169c7416ec02e87571f2c076073f4" + ], + [ + "GXSetChanCtrl", + "c319bc64ce8fe93f954a46951915cc4d3dec46f8861bd7212a9e954db0361c38" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXPixel.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXPixel.c.json new file mode 100644 index 0000000000..39eebc7d60 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXPixel.c.json @@ -0,0 +1,56 @@ +{ + ".text": [ + [ + "GXSetFog", + "a9de457a2b93b8a53107971668d4cca7bac9ac24fd41190ab87d5527ff46dcd9" + ], + [ + "GXInitFogAdjTable", + "0036ed45e3ef84859c2e601f9d4f5cc4332a72271446277a2dca9f16f47f0f4c" + ], + [ + "GXSetFogRangeAdj", + "2c7d8d7b9c1cf75c2b1a1fc51c4b3432217f6b2076a36f6e9bf4dfec0c286cdd" + ], + [ + "GXSetBlendMode", + "486458aea73280235a83f88bd8f533469c927fb211464b292b8f9bdba9a28fbb" + ], + [ + "GXSetColorUpdate", + "be74a7a22f542c01a5275754c401cf12b5d3197a747e2cd9a7e7074a793c1dc3" + ], + [ + "GXSetAlphaUpdate", + "596382593ad4f40236079dde886915c68d9c652d9297552035a7628ee19ebcab" + ], + [ + "GXSetZMode", + "9ab1cad6b8f16fd6d3ca41f6e4c80d87416eee5d5fa68b65cd8c5aa86bf2965b" + ], + [ + "GXSetZCompLoc", + "5288187c83dcb4e34799af5e03b0592c4d96bc460465bd8a9ce2da103593efbe" + ], + [ + "GXSetPixelFmt", + "dc815ae75f82d1638579d083fdb12cb419696ba1467c7b5469abed06aebbae33" + ], + [ + "GXSetDither", + "f306027a8e167766267e9b9a3f7c2741c213ddeac60c0f78e5144f21d12e0a8d" + ], + [ + "GXSetDstAlpha", + "ce9cde0a935b12c57547ccd0550f6d449cf5976b41e5e03497ab496142c5ef2c" + ], + [ + "GXSetFieldMask", + "fd98f5c647490c57d8ef819ba235bc25fa541614537c5923ba4e195b93a1ef00" + ], + [ + "GXSetFieldMode", + "ceab01bf0c70b9bb99e22ecd370d41bf3fbf53bf9de840b8dfde15eefcd48479" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXTransform.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXTransform.c.json new file mode 100644 index 0000000000..cc2f21b00d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/GX/GXTransform.c.json @@ -0,0 +1,84 @@ +{ + ".text": [ + [ + "__GXSetProjection", + "c5f692e010820a029db19168a57c0892d26469bdd915966d324753304f3ed9d7" + ], + [ + "GXSetProjection", + "9a15da8a98fb6af0ee694997c34dd9e3fd181c8b37397de85b9b1bc8ebda3ed6" + ], + [ + "GXSetProjectionv", + "32f016ea53a4fb0007318a223a6240ac7c00023d80527d4093137deeef2e70b3" + ], + [ + "GXGetProjectionv", + "6227e4423f1d04549765cebf503891f789e6fdd68a1b74872494bce06c3a8a22" + ], + [ + "GXLoadPosMtxImm", + "cc6b4a890c58e6aa4b012c9af0b7d5ed7e6cc02f2a1d01c39379697a817e5e56" + ], + [ + "GXLoadPosMtxIndx", + "503e078373d2f667e52f8b3bf93f5dda7cd7a8a91e4890dab93308c629a245ea" + ], + [ + "GXLoadNrmMtxImm", + "3c5071db94423e4c6eeb911a14a92fe9e466f85c956d8a1052b90a6677a459e5" + ], + [ + "GXLoadNrmMtxIndx3x3", + "5a67a84f83b9a01acfd30b5ad32e9255d33c218faea6eb3014304d4a5a36e323" + ], + [ + "GXSetCurrentMtx", + "5006a7a66b4c0ec191fff8432eb218a0ca8a3ce335fc7d723ddc262c7e536369" + ], + [ + "GXLoadTexMtxImm", + "0b15b1dc686e69e76c6bed71b88c9c81a233c4eb1b2d14bcd5251116873ccb9b" + ], + [ + "__GXSetViewport", + "07c5c6729a0f9aff9ce93af4f80756e745b3fbbef605df382fd99945e511b487" + ], + [ + "GXSetViewportJitter", + "7511012360fdd1db5ec179607e002cbb0d19cf5208249f0b92e868714f37f703" + ], + [ + "GXSetViewport", + "e5e7ec0fa1ecb59f66d9cd578624881398b9e0c8d7174f395c30ed4f5b48e3d6" + ], + [ + "GXGetViewportv", + "3b2e6ab1ddced2c9cc3cde3035dd61820571b1baa3bb1baf23107c779b162a22" + ], + [ + "GXSetZScaleOffset", + "f0181b12677cd0d03cb8989562f9f0f870eba49498ab19b24d1d787cfefb9935" + ], + [ + "GXSetScissor", + "a406d778df0442027815e860fe8ca2efc5614c907d710dfb6e05b3fef9f4fcd9" + ], + [ + "GXGetScissor", + "fdc4782a759a6db608665942a5d6bfcbd1bcc18a40003894555273c163d1abef" + ], + [ + "GXSetScissorBoxOffset", + "4e1c2b5e861059d8752bc978ce06eb76e5aca2ae3a1d93019f96f53106cec0c2" + ], + [ + "GXSetClipMode", + "0d2b870bbc4f1bc078e684c0c553711ea87a1fd54a6d093b1a57c55832cc3247" + ], + [ + "__GXSetMatrixIndex", + "2d6bda2ab8084344c1cf03ab9940c6d701e16f1fefca4cfd7c33de7a09a38abe" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcProfile.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcProfile.c.json new file mode 100644 index 0000000000..6edf028479 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcProfile.c.json @@ -0,0 +1,40 @@ +{ + ".text": [ + [ + "IPCiProfInit", + "d7fee2fcb20ba65375ee523a0279a01aa27003bb776e09211c518481ad03fcf4" + ], + [ + "IPCiProfQueueReq", + "91228b6d16ddc0a0088987c6b8038f93f0c07c87776108830a4ba5e3b1915adf" + ], + [ + "IPCiProfAck", + "da7f8cc3f159afdc6b721b222bb055a5b7529042d121dec89606e60d686535bd" + ], + [ + "IPCiProfReply", + "5dd647db3373a890d76c60cf1a34430e00e4f05604ee5c230620de66e43fde48" + ] + ], + ".bss": [ + [ + "IpcFdArray", + "38723a2e5e8a17aa7950dc008209944e898f69a7bd10a23c839d341e935fd5ca" + ], + [ + "IpcReqPtrArray", + "38723a2e5e8a17aa7950dc008209944e898f69a7bd10a23c839d341e935fd5ca" + ] + ], + ".sbss": [ + [ + "IpcNumPendingReqs", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "IpcNumUnIssuedReqs", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcclt.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcclt.c.json new file mode 100644 index 0000000000..970003a119 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcclt.c.json @@ -0,0 +1,98 @@ +{ + ".text": [ + [ + "strnlen", + "e3f8c2ae68c2f2216c7fd4552d66d62f71ee2c56a53d39d67a57c86a32777fb2" + ], + [ + "IpcReplyHandler", + "bc944ddf486d4a44f849de36cd77ea4b78330195e1212df9c36b54df727d95cc" + ], + [ + "IPCInterruptHandler", + "710b234b7a9d90b61c3b48dd915484b73fb1918ab73ce8e38895fa767ae1f032" + ], + [ + "IPCCltInit", + "a831ebed4a4e607f2c17a8adae499bf1750f485e4f7a5dcc3875e4578e80a357" + ], + [ + "__ios_Ipc2", + "627f555dc5bd8beeff6caf6848c82472fcaf6580e2165250fcb0bd2b1693b8fb" + ], + [ + "IOS_OpenAsync", + "3fbc58e217c97aae6f9686262add663c1fcb05d46483b52a55b089abc9318454" + ], + [ + "IOS_Open", + "2ed190cb61845ba92c94562ee0f00440bcdc2769459e40f0bed077883415b856" + ], + [ + "IOS_CloseAsync", + "af80f78b9c62baea153cf94080715fe5d0291bc7be6a51ea54d0366f7c104544" + ], + [ + "IOS_Close", + "f1412c18afb92c20ffa7926ff5ff496b232a5a871c734c18130bcd2953d5d2c3" + ], + [ + "IOS_ReadAsync", + "9d0ea3fe665419217d1790a183b5dcafe49af7ab05875818cb5371e6785fb3af" + ], + [ + "IOS_Read", + "89dd26a528c4ec2096f0af3893c52d863f0191d8181bd81db6d0790c6a11d1ad" + ], + [ + "IOS_WriteAsync", + "3aa5fd38c993cf9a3b5a05d54519e84f3f03198c40b90f94fae73430479b2b2b" + ], + [ + "IOS_Write", + "93a9e7e100064ce0dba9d2f09c7d0b1799058172c909cb4f118aa04f80404d81" + ], + [ + "IOS_SeekAsync", + "6d6bdf064135711fec6c28e260fdbbe253635d445218f91b5f2c26af287510a9" + ], + [ + "IOS_Seek", + "ea182318a6b3f73028a229290dc52d71281d631615f5b3ec6fc3d80f9e66b052" + ], + [ + "IOS_IoctlAsync", + "d3ec0967bdc6520732a88934dd1616157aebfa38795d210208880f6a3f66169a" + ], + [ + "IOS_Ioctl", + "0c87a92672815445bf34b49ca64ffd9e78d8638f0cad073684338a38b4e4758f" + ], + [ + "__ios_Ioctlv", + "a1dd615feb458f9b284a9146173294ab0a9257cdda16223aa99020a5212882d0" + ], + [ + "IOS_IoctlvAsync", + "7e02fc8af0ad3eb9bff6f480302262e87a563e1f260a05c44119c91df542da10" + ], + [ + "IOS_Ioctlv", + "d94ec084ee3989e1a2c51ea689ded7dcb060f8e36c70fccfe6b5fbee60ae28cf" + ], + [ + "IOS_IoctlvReboot", + "b301ccf7945792cfd5dcac93ad69e5c1c15dd078ec811df16050af8031d4f41a" + ] + ], + ".sdata": [ + [ + "__mailboxAck", + "b40711a88c7039756fb8a73827eabe2c0fe5a0346ca7e0a104adc0fc764f528d" + ], + [ + "hid", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcmain.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcmain.c.json new file mode 100644 index 0000000000..23b0906db3 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/IPC/ipcmain.c.json @@ -0,0 +1,28 @@ +{ + ".text": [ + [ + "IPCInit", + "42fc2805daf6c7d117d37a7bfd2bf1d428e96859d3fdf5ec2cb89f271c90cc99" + ], + [ + "IPCReadReg", + "cbabbcabf0c883057e3316b1ad3cf6f5ddd1872dc6f0616f26ef29335e122d34" + ], + [ + "IPCWriteReg", + "8c0d989c794716e7177a77f633ed9b5359f297a5967751a0389fd0e2dd986070" + ], + [ + "IPCGetBufferHi", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "IPCGetBufferLo", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "IPCSetBufferLo", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_allocator.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_allocator.c.json new file mode 100644 index 0000000000..ca460fd0db --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_allocator.c.json @@ -0,0 +1,36 @@ +{ + ".text": [ + [ + "AllocatorAllocForExpHeap_", + "5889047716c20d71379d6755afccf13c8c824177d983f609c5b7931d5d37dc05" + ], + [ + "AllocatorFreeForExpHeap_", + "96162ade3e59824aae794e16fd741d495af9e9580e4d457573a1e5c829e92f4c" + ], + [ + "AllocatorAllocForFrmHeap_", + "5889047716c20d71379d6755afccf13c8c824177d983f609c5b7931d5d37dc05" + ], + [ + "AllocatorFreeForFrmHeap_", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "MEMAllocFromAllocator", + "5a5c195c1c30c4d6d51be84d80d191f85fd67065a656d009445d5b0cc3505e68" + ], + [ + "MEMFreeToAllocator", + "2b4320e54d3ad7735501706a97e78dbebabc438d0205f22717f916a80db1c4b8" + ], + [ + "MEMInitAllocatorForExpHeap", + "b27561a940a09d240f559688eb22b96713c8acb791599336a27fad41f2379e6b" + ], + [ + "MEMInitAllocatorForFrmHeap", + "b27561a940a09d240f559688eb22b96713c8acb791599336a27fad41f2379e6b" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_frameHeap.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_frameHeap.c.json new file mode 100644 index 0000000000..78471e9e35 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_frameHeap.c.json @@ -0,0 +1,40 @@ +{ + ".text": [ + [ + "MEMCreateFrmHeapEx", + "68043b98dc42550dd79b877772c7184684308ceeb9afafc7f8e5a0585462945f" + ], + [ + "MEMDestroyFrmHeap", + "e40633dbfa30c980bdf959c29f467fb5ba3e5d68456059ff0193830719d1d362" + ], + [ + "MEMAllocFromFrmHeapEx", + "ebf5e72966734a037a1d91b6bd9e281e51229281051dfd3dda494442c9a5fef9" + ], + [ + "MEMFreeToFrmHeap", + "d37b8c3c909dbd15fbff1fc67358de8a8013bef94daaf610df6eba8ece332fc9" + ], + [ + "MEMGetAllocatableSizeForFrmHeapEx", + "efa9cf8d584071e9ba4761366b9c31c3079a7ab9d62aa613edff6abf32da51b9" + ], + [ + "MEMRecordStateForFrmHeap", + "2451a64b24640e3667984876602efd56c822729093ee683f0dccbc50b10776db" + ], + [ + "MEMFreeByStateToFrmHeap", + "661ec60806390f3920d7f9510c9c153d840a7a8f282d1a98b8f6f3ae134ffcc5" + ], + [ + "MEMAdjustFrmHeap", + "c95c652b7431c8eeaef1eaea29fbfca9caf3db38f61ad72630e37978a6c2f42c" + ], + [ + "MEMResizeForMBlockFrmHeap", + "0455a1fabd46dcaf9076f7a9b1ad5e131b85e2b04a0fddf6284cb0240326b77d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_heapCommon.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_heapCommon.c.json new file mode 100644 index 0000000000..0e68d484f8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_heapCommon.c.json @@ -0,0 +1,36 @@ +{ + ".text": [ + [ + "FindContainHeap_", + "7a53924c51db03ab4be03b7e1d6ac564932fb349ab839ec22c63b6e2c657378d" + ], + [ + "MEMiInitHeapHead", + "6e71ca0a65ebd420fe0cf3ded851a6655463aad50aea36d8ff2f80541c8d9d92" + ], + [ + "MEMiFinalizeHeap", + "fa8476f8ce0a0626cfed635a6d9d05dedf8b0b38ba61937a5a584df2aa1ac29e" + ], + [ + "MEMFindContainHeap", + "5a0c4e4e14542ad9ea7b83062f418f8283a1d1d9a79dafc12118fa137a932178" + ] + ], + ".bss": [ + [ + "sRootList", + "15ec7bf0b50732b49f8228e07d24365338f9e3ab994b00af08e5a3bffe55fd8b" + ], + [ + "sRootMutex", + "9d908ecfb6b256def8b49a7c504e6c889c4b0e41fe6ce3e01863dd7b61a20aa0" + ] + ], + ".sbss": [ + [ + "sRootListInitialized", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_list.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_list.c.json new file mode 100644 index 0000000000..6693b9572c --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/MEM/mem_list.c.json @@ -0,0 +1,20 @@ +{ + ".text": [ + [ + "MEMInitList", + "6ba38f406c6d151e28cb478d6a46b4dab07ae2cb6a1ec0c306b12f29c6725c3c" + ], + [ + "MEMAppendListObject", + "70b5dc1ce9a698f972589cd196db7514cb6006139d019412c82f440463cfdb14" + ], + [ + "MEMRemoveListObject", + "263c27507bc0c021d80467d9b0398c50389d0532b9bcac1e3fa38fdf32d52e28" + ], + [ + "MEMGetNextListObject", + "c5ac5996743f308a9db097069c2dfd8b663062279d8fab7226f7190f363aa72e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCheck.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCheck.c.json new file mode 100644 index 0000000000..06806915d8 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCheck.c.json @@ -0,0 +1,12 @@ +{ + ".text": [ + [ + "nandCalcUsage", + "8923be690b390f1b8e0e56cf76fa52ce5884bdafb7a9b108189fad785af2bf32" + ], + [ + "NANDCheck", + "73489b27aa9aed32211353a7b8ce5822af199d5cefd4ae1cc5cb6612bf07aed6" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCore.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCore.c.json new file mode 100644 index 0000000000..7031d9fbce --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDCore.c.json @@ -0,0 +1,110 @@ +{ + ".text": [ + [ + "nandRemoveTailToken", + "75591804554bd7dde29ada94eca1e203b1518bb13ca86b5cd066709cad4c0bbc" + ], + [ + "nandGetHeadToken", + "80224bb11d10ff60b788fb1d5c1471d9ad7439288c10e4a51b41258a2837f4cf" + ], + [ + "nandGetRelativeName", + "f4cfcf95834e6d27bb30bdc8f222fa153949c117da5f3e856ccc86c83b93d913" + ], + [ + "nandConvertPath", + "3d7d628d65d414dbd89820fe3b967ec6491eb39c4db28a42b42d65b6b611755f" + ], + [ + "nandIsPrivatePath", + "8ff7fcdd6de7e07482f7c3c50b875df39a1f1b459d2dda38364de041f0b9f8c1" + ], + [ + "nandIsUnderPrivatePath", + "36e81702d37fa79172e087e4a30d3fffe2314b6a9935865cca657ba3278f4c98" + ], + [ + "nandIsInitialized", + "9a590b9957e7a141337491a071ba77a76b7b0f1c4410e08453bdfae565093b9f" + ], + [ + "nandReportErrorCode", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "nandConvertErrorCode", + "8078e19e204e0e6e125a5e7d00f2a01bf7d0d94546e3ea07d22da8a869524277" + ], + [ + "nandGenerateAbsPath", + "4dd59890c0c26492967e9b831633a69e84cf6bcd10b9cb8804469e3176f356e1" + ], + [ + "nandGetParentDirectory", + "0a528ec08f7a79f39b6ff8563fd5c10afa0b45814a4a0c2271daa6e9f976795c" + ], + [ + "NANDInit", + "e13f345d59adaf7648049f13c983aba835cc1f4d965426eb190322df797c1c5e" + ], + [ + "nandOnShutdown", + "76b8bac6564afcc87a706f8a9e63d58ad44f5ae10eebea489ca5efd1662277b9" + ], + [ + "nandShutdownCallback", + "7d3126fb8155aa096ac0f4e93a60a3aef80c169433e1697e5e0779a5d05ddd4d" + ], + [ + "NANDGetCurrentDir", + "0b664c4d36eeabe5d5b1f2110854fbe25325f2e23f45bb4d5f571add1b605a75" + ], + [ + "NANDGetHomeDir", + "3d3012d0cfdd5786565c4464a8fb3f57c1138d590a6aeb293fc83d18e04d3e8a" + ], + [ + "nandCallback", + "0267ee67fdb77e8e108580b6d3e20e0aa5a3220d30ab69d03fd18426a3539e06" + ], + [ + "nandGetType", + "da431b4dfcc3b474e42b2c28961a8ceff8f240aa4e9812e42e3fb36e7ef5011d" + ], + [ + "NANDGetType", + "dce2064c71b21059f8e2a7310a7d3d9eedbb0859717a370e7a69118e82f3adc6" + ], + [ + "NANDPrivateGetTypeAsync", + "4c5384c0a3bf6945073740bbed0154ebd57e050df764c790e6e4abb31caa719c" + ], + [ + "nandGetTypeCallback", + "e554719c4543a132faf21549a38a543f5154a70b29c61b7646dd3a5004be0c2a" + ], + [ + "nandGetHomeDir", + "4e0d0c82b70486ea1cf76f73112b19abe42018409528dd83dece64dee0b5a18e" + ], + [ + "NANDInitBanner", + "18c21378608618e33c3c882f013683af636bed13974b781c561f4a0a88936675" + ], + [ + "_ES_GetDataDir", + "ffbb4c75c853d90c0ca7940c042e00bbfcbad275f654e43bcff03d5b775d9d42" + ] + ], + ".data": [ + [ + "s_currentDir", + "920411e94cfe05fefbd4969dbac3ba24f9844174dd033d1d8ac8e7b8668b1760" + ], + [ + "s_shutdownFuncInfo", + "4f8c41de8f5a165d4e2c0a31710654155ada52853cf5a26321f9d0c8d498062e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDOpenClose.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDOpenClose.c.json new file mode 100644 index 0000000000..50ab7f4e6a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/NANDOpenClose.c.json @@ -0,0 +1,68 @@ +{ + ".text": [ + [ + "nandOpen", + "af1e67fcf12a1820b4f02d21b7e0c1eb632e4746ce6a329665c62c9e17bb6c49" + ], + [ + "NANDOpen", + "52c67789f2a596cde9cc3ab5a705dca15e0d68ce5fc3607e4e58b71f0a93eca9" + ], + [ + "NANDPrivateOpen", + "1446914f4ebc84dac3e9f5c04ad85d3a222f4eb02ef0b5c561988b67d11b7cce" + ], + [ + "NANDOpenAsync", + "b1f9f94e0541033b25de13aecc8cd2aa12a88bfd19626713f7ef382e11f97e83" + ], + [ + "NANDPrivateOpenAsync", + "be9ce4815f4f1b644656e8e0c55a8118bf6fcbaf0abd9e0a8abf738c40ec05b2" + ], + [ + "nandOpenCallback", + "8d32bd9f1902d25d4cf47a5cccaee7ebb95aa9e24b83c92a548bbdbeedbd2999" + ], + [ + "NANDClose", + "e2b16535c021443c2c1d0845896486850f7c51fb1520d2f4117f3b1abc76990f" + ], + [ + "NANDCloseAsync", + "3a74a3cbe70d7147a8748c5454d930f88d91fc1d2881ee8cb5af22cab9cfa311" + ], + [ + "NANDPrivateSafeOpenAsync", + "cf344c2e4aa2a48277ce903fbae5dac7800234e8b665b1a1e740f60fa77fbb78" + ], + [ + "nandSafeOpenAsync", + "d08d022c066dc573ccab159a3a307d8e0ae28337a49bc9effd0327811558b8c9" + ], + [ + "nandSafeOpenCallback", + "bd42850c6bc1cb37620b7e9cc98ad20cfb50eb34d169b16a421fc8559d09182e" + ], + [ + "nandReadOpenCallback", + "f1723f17a145d82af11f374d1a6b8f7b0492f366f3d0cbf1ca77632154abbecf" + ], + [ + "NANDSafeCloseAsync", + "79f36d61edc8a5229433e1b67cfa6efcaf7603ae99e4f3d44ab560fc4524b9db" + ], + [ + "nandSafeCloseCallback", + "82d2b282360bcebfe7a1c94501a5948e948ab1ee30e2f59e50b82d92804950fa" + ], + [ + "nandReadCloseCallback", + "4e91e64eec96a9a21eeafce24f27a1e0fd78a51294a714a55d381c4dbd8bb66b" + ], + [ + "nandCloseCallback", + "0fc6cbe76151c345a24bc7003840e39edc548d6d052f07e1e29a18c4c1825c0d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/nand.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/nand.c.json new file mode 100644 index 0000000000..376a41693a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NAND/nand.c.json @@ -0,0 +1,120 @@ +{ + ".text": [ + [ + "nandCreate", + "744279dc262cbed5186f52a16ef3846176eebf932c8840f2308b992209260a15" + ], + [ + "NANDCreate", + "a575042e3207943ec1cffbb53b833fed5a8114d5c6a1f0ea2c3b9eefbdf51c26" + ], + [ + "NANDPrivateCreate", + "31937d39cf252ce1373db2b4edd591601f11a638ad125eee05e0ac9a50f6800c" + ], + [ + "NANDPrivateCreateAsync", + "ed27bb60ef6eca5ace9c34b90e100c489a9a4f7ccbd121d0b0a3dc8627893ed5" + ], + [ + "NANDDelete", + "eb0d746b278424c9812d39fa966eff2f2458567b564302686914a9103658479b" + ], + [ + "NANDPrivateDelete", + "7221ea5d13a7ce88dad375360592ea7e1dd52dd225298bb5d2ab74434b7d8b27" + ], + [ + "NANDPrivateDeleteAsync", + "8725b00748468e916e6d9d2dad96b6b37dd9e91039f0d7691f1c8c54d028cba4" + ], + [ + "NANDRead", + "869425cc1b8e981585615daa78a79ffbc6ce8e1b558eeda0389c663d88fa9e9f" + ], + [ + "NANDReadAsync", + "630bc38c3d0cb90d37764ecb2eabe62a8cd32a046edbd141f5e7a88519e06a06" + ], + [ + "NANDWrite", + "869425cc1b8e981585615daa78a79ffbc6ce8e1b558eeda0389c663d88fa9e9f" + ], + [ + "NANDWriteAsync", + "630bc38c3d0cb90d37764ecb2eabe62a8cd32a046edbd141f5e7a88519e06a06" + ], + [ + "NANDSeek", + "e616607fd5b8af5ccc72fe1e49c0657ab13b3161435917e27f7cb0e7811a458e" + ], + [ + "NANDSeekAsync", + "c9e05795e9a1787be5cdb60a882c15e4cd06b23eb28458199e0d86e223230506" + ], + [ + "nandCreateDir", + "85ea6beccda19d9a660b82c698968ee6076f76499dcacc2df6bfc9296780a51a" + ], + [ + "NANDPrivateCreateDir", + "31937d39cf252ce1373db2b4edd591601f11a638ad125eee05e0ac9a50f6800c" + ], + [ + "NANDPrivateCreateDirAsync", + "ed27bb60ef6eca5ace9c34b90e100c489a9a4f7ccbd121d0b0a3dc8627893ed5" + ], + [ + "nandMove", + "866811020078b8d527992399bac0c8b5e95eb19a361b1e766f4446672d3ca517" + ], + [ + "NANDMove", + "dee98d3db21d0bd8a25ce021211c000a1d64f1ff3180f6932608a0d633edf8cc" + ], + [ + "NANDGetLength", + "09414a5c75329598b61e8c70ac7c2cab04d239a541ecb02f5374f9880cc715d7" + ], + [ + "nandGetFileStatusAsyncCallback", + "0794fb614b766e11cb9d31453839b07587e8382acbb17a4c34933b87cf8137a8" + ], + [ + "NANDGetLengthAsync", + "42e1045d7adbba48827cfcf3760b2149d980923a22357bb2f98de0a6d7eb8935" + ], + [ + "nandComposePerm", + "36ff541d42796b06b6fd08ad08bef4b726e39236f710c7e84b0384bd7decf89b" + ], + [ + "nandSplitPerm", + "2e8159e4423fda5be0e852ee4c42c3b30ec43c4715cf9618b0b30eb7ddd251df" + ], + [ + "nandGetStatus", + "29fedc8952cff5093175eec311e2f6015f532ea07c0cba0434610698fbdcd476" + ], + [ + "nandGetStatusCallback", + "f5b1a9995bc23f750cd018882eacea597be4d159ae6a15b47aab7fa7b84bdcf6" + ], + [ + "NANDGetStatus", + "dee98d3db21d0bd8a25ce021211c000a1d64f1ff3180f6932608a0d633edf8cc" + ], + [ + "NANDPrivateGetStatusAsync", + "fdb8aa78539e356307b9088352c85ac0ffdfa2c01ddfdaef122f11647cf309f0" + ], + [ + "NANDSetUserData", + "fab91cd52eeb64feaaba001f6898f1d230704b8e6d1b10bb40d46f6fdadba847" + ], + [ + "NANDGetUserData", + "04834c66884d176e4f76752cc58565fdd1e537c7cca20926b3f9ac9320460541" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NdevExi2AD/exi2.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NdevExi2AD/exi2.c.json new file mode 100644 index 0000000000..bfee57d530 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/NdevExi2AD/exi2.c.json @@ -0,0 +1,28 @@ +{ + ".text": [ + [ + "__EXI2Imm", + "ef0bec65688f20bcd48bf24620fbe8da3adccc1d29c465c42f378e81eeff1a25" + ], + [ + "__DBEXIInit", + "2252d97a6964d1fddd0cc0661b93521dcc80c2c3bd9eccfb50759c621afcaeb7" + ], + [ + "__DBEXIReadReg", + "74fe7cf6e5f0b43e49bfdfba442266d20ac21a5589689877dbe9641ab29696e6" + ], + [ + "__DBEXIWriteReg", + "29454bb97dcb99e56ffc570f7116916622093eab56f99a40bd91ae35c261aa69" + ], + [ + "__DBEXIReadRam", + "a89608ee7ded7db1a2893a574214dd82b1aa19e5ff74d81dcc90218083b7a276" + ], + [ + "__DBEXIWriteRam", + "9203365ec3b06d96a2c660f94dca377f26e6ddeb686ad49dd55e486cdb84f0ad" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OS.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OS.c.json new file mode 100644 index 0000000000..3ed06f4638 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OS.c.json @@ -0,0 +1,164 @@ +{ + ".text": [ + [ + "__OSFPRInit", + "6cc8deba8729e7dd206803c78a9cc88ddaa4aac9ca37f988f926bea2df78daf2" + ], + [ + "__OSGetIOSRev", + "5f0e1d27fef645e0e1de293c46a97debcf17edb72c7cf5aec4c90701cdc527ea" + ], + [ + "OSGetConsoleType", + "3a3650b6258a6ddaedce1eb11447fb97fb29c26c0ab323e50689036aa17e526c" + ], + [ + "ClearArena", + "11885049f4e58e4e4d713d77457deb07e8a2a0a20bd48fe67ec20e10c1c1836e" + ], + [ + "ClearMEM2Arena", + "46c990c80625a969851b43b2420d88a3aeee797b7e3a1083222d2a2567492e6f" + ], + [ + "InquiryCallback", + "339b018050af93559241f1d992c8c6b1472586fa9334deeea5f25961ca5e4ebc" + ], + [ + "ReportOSInfo", + "30daf9a69316be0116fecac3092e0c7e95d3d9f5a61c6ae54f6f9dd089e5ce14" + ], + [ + "OSInit", + "92048fa9f36805b924245e5bfb96e953d6b2f7f070abcfacefac8695ea1124dc" + ], + [ + "OSExceptionInit", + "06eafd9d14d84b3eb7d76a16bc79483ac36fb215e6d7d1176ad9961043e63a2d" + ], + [ + "__OSDBIntegrator", + "16dceeac1e1a97db2baffbf4c4666b58c09a8e68a53568f5c0c96d6a1b22d617" + ], + [ + "__OSDBJump", + "04b258f1558fae015390d4784861c3d7e04b257e09410013ae31893d46d5d49e" + ], + [ + "__OSSetExceptionHandler", + "f6feadcaf6683587beaa023ecf32f3265aa69a3142024fe70320d448978d523e" + ], + [ + "__OSGetExceptionHandler", + "b7c2d4440f0209f2e86d3c1b8b6b4e5340c569de004d2c406cf2fbb214a4988e" + ], + [ + "OSExceptionVector", + "31233d7c7778b4625dc4fc4e18f055ec17ef5578146582db8a7d3f22192dee25" + ], + [ + "OSDefaultExceptionHandler", + "1aaa3d59c190fbf234773c5c89b3000f70d2d47a573d02f6ee43015556a68342" + ], + [ + "__OSPSInit", + "a25855eb32078214a9b017505321f862f80dd9af9886b36e6f41286f8665c53c" + ], + [ + "__OSGetDIConfig", + "3ad10f436ffe1435fef44997dd5e10d5ab3a5de2c2c40b909c7ae11f29c5465e" + ], + [ + "OSRegisterVersion", + "b28ba2d4d06f856d2e8907bca749f4dd5e739e71666b7a2144250e5e3dcdbd8c" + ], + [ + "OSGetAppGamename", + "d1cb099d17ed5148789518d55b8a9d97ae9707930d6878ef06af9cb43438696f" + ], + [ + "OSGetAppType", + "a59aa157ae073e560574f9eb50f814766ed1abbb1d1e7ceeb3fd5f095b16a761" + ] + ], + ".data": [ + [ + "__OSExceptionLocations", + "0bcef3a2062fdc323b234164802cc522007cc519314912175e44c196a8a3d0f6" + ] + ], + ".bss": [ + [ + "__OSRebootParams", + "3addfb141cd7c9c4c6543a82191a3707ac29c7a041217782e61d4d91c691aee8" + ], + [ + "DriveInfo", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "DriveBlock", + "17b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1" + ] + ], + ".sdata": [ + [ + "__OSVersion", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "AppGameNameForSysMenu", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ], + ".sbss": [ + [ + "__OSInIPL", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__OSInNandBoot", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__OSIsGcam", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "AreWeInitialized", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "OSExceptionTable", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "ZeroPS", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "ZeroF", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ], + [ + "GameNameBuffer", + "8855508aade16ec573d21e6a485dfd0a7624085c1a14b5ecdd6485de0c6839a4" + ], + [ + "BI2DebugFlagHolder", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "BI2DebugFlag", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "BootInfo", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "__OSStartTime", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlarm.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlarm.c.json new file mode 100644 index 0000000000..ef50f46660 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlarm.c.json @@ -0,0 +1,58 @@ +{ + ".text": [ + [ + "__OSInitAlarm", + "5e1ba7c0ead532ad05b8e9ffb1934de00050d6d828ef6acec0030f7af8a5b80c" + ], + [ + "OSCreateAlarm", + "765d467aef28897a16c69e550974242c7e115dedbd156d3e0451e5ebd9b2e0b8" + ], + [ + "InsertAlarm", + "717baf82e6762aa7b6360916f7849841385b4f9d29481232032a922bb6a2b847" + ], + [ + "OSSetAlarm", + "afa352b9c070a1ecd952498dba476349e67c7ab75ff8cd4d01d0268512169e56" + ], + [ + "OSSetPeriodicAlarm", + "a0a82ebe2d75981165d86929653c5e6fec0cff3c0a51122443af8e4e8f833089" + ], + [ + "OSCancelAlarm", + "f306ca0d382c6b01be11970bfd9747eccd7a22062fb2cff979bfffe530018a70" + ], + [ + "DecrementerExceptionCallback", + "5e8c1f8f08903e8327f74cf61c524f111ab08de9307eddcaec3bdbff6dd00f2b" + ], + [ + "DecrementerExceptionHandler", + "56a0645deae561ac89ef32c2d422a4714e029d8f0be12300b05a203b482a80c2" + ], + [ + "OSSetAlarmTag", + "80966d67214da37bdaf414292e997fa52df02f7e2d3f41d6d6717bd109e66dd9" + ], + [ + "OnReset", + "d3a0d5aa2c0d7ac1f4fb7ab2e698fe9958156550dd1e91eeb73211356b43f1bf" + ], + [ + "OSSetAlarmUserData", + "7cd13bd9fdecc92336573e4748ad4a90566fb0729b54490db3afa81d71e59a78" + ], + [ + "OSGetAlarmUserData", + "96293476da493925790c4e6f8a57d01c8a933a247d8b04f434f9945f91ae95f9" + ] + ], + ".data": [ + [ + "ShutdownFunctionInfo", + "d96ae899ea88facf7fec045a72592167d3f21dea43e606bcdecdaa646f1c1f43" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlloc.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlloc.c.json new file mode 100644 index 0000000000..a87bbb0c98 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAlloc.c.json @@ -0,0 +1,34 @@ +{ + ".text": [ + [ + "DLInsert", + "f9db1b31c20224e94cc5cec691f35e0851769743941a9ed098fd577a9e8b4816" + ], + [ + "OSAllocFromHeap", + "e20644a3cbac917b6c574fb1f22e646057b84e667fe17763a4c1e28c5e65f66f" + ], + [ + "OSFreeToHeap", + "a4985979b85d0de5813514968cb5f2929547e72a65048bef3b4dac1a31eb8836" + ], + [ + "OSSetCurrentHeap", + "8bdd8cd80745733f555a3cf9132e54bd6b07b672f69733560cb57f337c8ba8a8" + ], + [ + "OSInitAlloc", + "c3dc35506d03de997d65a0e6ba05be9c715c60547c9136906cac644182eb3058" + ], + [ + "OSCreateHeap", + "8a6aec06c366a8f335d0fad411ec13b47bf36fb6780d39e3b293fb133f64c2ab" + ] + ], + ".sdata": [ + [ + "__OSCurrHeap", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSArena.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSArena.c.json new file mode 100644 index 0000000000..0c7b95c025 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSArena.c.json @@ -0,0 +1,66 @@ +{ + ".text": [ + [ + "OSGetMEM1ArenaHi", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSGetMEM2ArenaHi", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSGetArenaHi", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSGetMEM1ArenaLo", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSGetMEM2ArenaLo", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSGetArenaLo", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "OSSetMEM1ArenaHi", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSSetMEM2ArenaHi", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSSetArenaHi", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSSetMEM1ArenaLo", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSSetMEM2ArenaLo", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSSetArenaLo", + "a524996eabad25b8ed709d7327dc46efa7b4d2a33d818112b794fc0048809ecd" + ], + [ + "OSAllocFromMEM1ArenaLo", + "ef4348230133154adbb8fc12bc65b6a496bbe46cd6b3f61ba571fe1a501ff410" + ] + ], + ".sdata": [ + [ + "__OSArenaLo", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ], + [ + "s_mem2ArenaLo", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAudioSystem.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAudioSystem.c.json new file mode 100644 index 0000000000..39c76c14e9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSAudioSystem.c.json @@ -0,0 +1,22 @@ +{ + ".text": [ + [ + "__AIClockInit", + "5c1c385d30359e050d9abc8c8c451e3b1ea8bb3e44325fb7c1edcca552cfd27a" + ], + [ + "__OSInitAudioSystem", + "7e33a01d48f6e0e9f289ae08b77270b0d2415ffcc2f28ebea2aef2c55a9e5ac1" + ], + [ + "__OSStopAudioSystem", + "3828676aa0134de6a87407a45e89bac8b5214d5abd11137027bcb023b10dc1a8" + ] + ], + ".data": [ + [ + "DSPInitCode", + "5b873ee91f33b0884574b814d7f46d81e283394de91b8b2ea9073ac218dee350" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSCache.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSCache.c.json new file mode 100644 index 0000000000..8cb3dc602a --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSCache.c.json @@ -0,0 +1,84 @@ +{ + ".text": [ + [ + "DCEnable", + "412e37a8a108a8797cbfb607f5a28e6878a676c836e10ad603aecc9ced1a4db0" + ], + [ + "DCInvalidateRange", + "4f84050b94b4b2c17ad350c4a1a3eac215276b3af65d3fbc0d7b4bc615ff36a5" + ], + [ + "DCFlushRange", + "93cccdef2db2d4edd330b23e345500e30ae5ead17cfaea13e3c8ac963a39ab33" + ], + [ + "DCStoreRange", + "18ef22fd876c32a67466e960df329bb94c9dadfa38bf622fc296ed027e174912" + ], + [ + "DCFlushRangeNoSync", + "609869ef211e15fd73610a3431bcdf99f1597d86ee3854f6bba65fd3b0b6d226" + ], + [ + "DCStoreRangeNoSync", + "a7929eb21f752bcfe4a57ddaa40202556220e1d633448f8e100a662a807a5d10" + ], + [ + "DCZeroRange", + "84c8564bddc61bb9cdea8028ee66b57402afed7c6598efc0754b5df949ce38bc" + ], + [ + "ICInvalidateRange", + "5c0cb4f4df95f7fb600123d9052dc8dea26ad6a963dc0108ac7fbc388d76b975" + ], + [ + "ICFlashInvalidate", + "39b9a984c5b6e34e41be9debb420b45a14f102213a7c508f67e77dbfffd9d543" + ], + [ + "ICEnable", + "5114a5b2b80d952418262456adca1c811390e09838bca51731160921e91550ac" + ], + [ + "__LCEnable", + "c47bc5494d5886ee2a8436ba477cc7b969baa7b0adda3ff3e52774bed932063d" + ], + [ + "LCEnable", + "b0cedf01f8f5f182fd81a6328368f665a058d0c4872bd50bca8d96d274d98f49" + ], + [ + "LCDisable", + "3fb12fb28a2043f1d3d4b4af3d7ae6310a60828d3ae86ddbf2c37865539106dd" + ], + [ + "LCLoadBlocks", + "1d1bd683a1685d80ec2f43b0f85f558fb850c51ecb25e1d85d3742da89fe8389" + ], + [ + "LCStoreBlocks", + "28fc07cc3d029f40a5ffafa21d676b13940a916eed2dffa964d3c17e43941259" + ], + [ + "LCStoreData", + "0a86335e02395346af1955312935d127619ad64eb90d49029b8afd58a2d24012" + ], + [ + "LCQueueLength", + "9c3d5ae5acdae7584e52cf43720db7d52a9cd3b617074a7a63d0b1d868683268" + ], + [ + "LCQueueWait", + "1828ba063c6cfd703b42345267165200ca52014d9270ef0938d36276c6ca58c8" + ], + [ + "DMAErrorHandler", + "f51a94adc3b4e68eb9ff6cef9ed5bdffa8b49188740799a17a29efdb5bbaa7a4" + ], + [ + "__OSCacheInit", + "885c895e73f02d5e2ff48f7cebe18056408009ec2a9b623b7c65d8dc56385d2f" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSContext.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSContext.c.json new file mode 100644 index 0000000000..82258c2eec --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSContext.c.json @@ -0,0 +1,64 @@ +{ + ".text": [ + [ + "__OSLoadFPUContext", + "c825336bd508f9d56b1f122453041d8f9b3908f7a662d4f03cc3d299aa4daeed" + ], + [ + "__OSSaveFPUContext", + "f9ca2a0ec217c8f84583f4fdfc2f7c9345b0aa150e9d79c55f2aeaa8d767b5f7" + ], + [ + "OSSaveFPUContext", + "04c7ee6b1e9c7af85ef476a9bde8573c9a91b467cd689cd2e499644ed083d9db" + ], + [ + "OSSetCurrentContext", + "574f06429fe6a36a360f8d6010c7879996b2aa5c588dcc55ff4f25973e4dd51a" + ], + [ + "OSGetCurrentContext", + "0edd5e8c32234b1b1586ec1ac843d70a9668c00b64c05a98a2ee9531fb76eebc" + ], + [ + "OSSaveContext", + "5076f0fde2d065938e8f0b535ed2f71516e6923fe2b9c1a97ea2f853a2bcd713" + ], + [ + "OSLoadContext", + "5788572647adc0029b20eefe69915bfdbdd90ba95703388ff19dc67f171d82ad" + ], + [ + "OSGetStackPointer", + "0ab2171617ce228332e86b39ead8b43c35d074cb961f84388aa4b544baac5f34" + ], + [ + "OSSwitchFiber", + "e14eea130b1720c6d89e08e6448620c1e0f0a4c993dd2108d7973b0eced853be" + ], + [ + "OSSwitchFiberEx", + "09fa142da013affad38ce9f13a8fa6b593fb38ecd727e0a368e5cc5c1d998438" + ], + [ + "OSClearContext", + "26ee23eec8ca1a6ecc754cf96912dbd0558696d849d0f463ba2443df14678555" + ], + [ + "OSInitContext", + "8c2d2c0a67bb99e781a4ebe9d885d37f6832e82fff2448cf01f3497b87cc3081" + ], + [ + "OSDumpContext", + "80fe993c86f6ccd5743ee6abe7cde653ac0d800317854c5f1fe0fd0a2a3e9419" + ], + [ + "OSSwitchFPUContext", + "3bf3dc75ae41776b8dc6e8cbf674d40d7f972b88c79f7c610e422207637e6407" + ], + [ + "__OSContextInit", + "d196a55cc85347d77832621e03630b24695c3b92d83e0c69512b9baed44e6074" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSError.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSError.c.json new file mode 100644 index 0000000000..d051ed5be5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSError.c.json @@ -0,0 +1,22 @@ +{ + ".text": [ + [ + "OSPanic", + "b27e387accb99b7161d5d2953d5ecbf397e1b252bdb712cd91e90ecb161faff7" + ], + [ + "OSSetErrorHandler", + "1afa9d6bcf135bebaa199b2ac830dedd753708fdfad3a3f7782c95d9b713829d" + ], + [ + "__OSUnhandledException", + "2ee3427955bab10762e14bb716a9e308b00c430518b6f82703a60c5fdf8975e7" + ] + ], + ".sdata": [ + [ + "__OSFpscrEnableBits", + "e2afaadfcf68ad12fd6c76d38c64f0e582b18ab13204f7d3e4021058d15a6bd2" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSExec.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSExec.c.json new file mode 100644 index 0000000000..b83432d7dd --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSExec.c.json @@ -0,0 +1,32 @@ +{ + ".text": [ + [ + "__OSGetExecParams", + "cd38ae3fefd82cbe95061e92ec0cbecda9c626f08f0e32f5fbc15263a2350133" + ], + [ + "__OSLaunchMenu", + "a64f69c997c13d115c4c3e582f25b3c38cc6650197755551dbc9113d2510a55a" + ], + [ + "_ES_GetTicketViews", + "6e206db2bbe3e2c4b27e5a04f8cfaa4d402f128139117687ea27c82a718da8de" + ], + [ + "_ES_LaunchTitle", + "d79c4ba5476997df2c6e795f06c7932b8e49419add2cb5f84b863a56d48e137f" + ] + ], + ".bss": [ + [ + "views", + "c91a0743fb643fb644a520b49e9f9f8ffaa1f371b33b6526ae4587c7d29e03ad" + ] + ], + ".sbss": [ + [ + "__OSInReboot", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFatal.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFatal.c.json new file mode 100644 index 0000000000..4603edd75e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFatal.c.json @@ -0,0 +1,30 @@ +{ + ".text": [ + [ + "ScreenReport", + "cfe20ab7c953bafba9d766b5d50998a3b82966b736803b6501e38874eca96401" + ], + [ + "ConfigureVideo", + "0e17bdd440366554652e24fa2d72ee99d74a37f52421535a6eead29b11f3a3c1" + ], + [ + "OSFatal", + "15988a7c83f21a2fa6a487fcf82e8f459bb4bf993ff6f96b96f43c26f828d1e3" + ], + [ + "Halt", + "5ed1bb91f1fc7b8e762305b0c4cf2190883045a9dd7f34b421c2a8b71d61a632" + ] + ], + ".bss": [ + [ + "FatalContext", + "283de789c3f9ae6115e627ecb921b7b39bdaa1b82289eca5e60da0b76d07a502" + ], + [ + "FatalParam", + "15ec7bf0b50732b49f8228e07d24365338f9e3ab994b00af08e5a3bffe55fd8b" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFont.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFont.c.json new file mode 100644 index 0000000000..2821adecb0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSFont.c.json @@ -0,0 +1,90 @@ +{ + ".text": [ + [ + "GetFontCode", + "0efc54cf3b43f808ed671604a2462b1d07e6e5beda9cf7148036f4e59f08010d" + ], + [ + "Decode", + "0ebb12a546658b6b0814fcf9de265334da1fcd1559c7a587350e3ecbe5837c25" + ], + [ + "OSGetFontEncode", + "1eaec1d0196767ef1220342d5d914aaa0221403ca97f293c8e05db0b9bd0239b" + ], + [ + "OSSetFontEncode", + "d7d8169da8e7aa2e80bb68a96fdebc2a46389edbbaa650dadccb250e5452be6e" + ], + [ + "ReadFont", + "078b7436cb3cacbf2942ede3debf0f4aac1032a5f15bc101d8bd0034a017edba" + ], + [ + "OSLoadFont", + "b187db0954785cd6463bb000a48a296ecce31d35a6aaa1e8fa279e8dc0ddff20" + ], + [ + "ParseStringS", + "52a707e51f9a585fbc4729777b6db33a7e2c80b2b58bb50e6ac357ec8568092e" + ], + [ + "ParseStringW", + "b320d6ae37972fd8906e865a9b908f436f8e12f9693354f9f91769951ace6636" + ], + [ + "OSGetFontTexel", + "76f0a04f2db4bcdab3664d55813dde929abe924db89f706840b7790473d12e1f" + ], + [ + "ExpandFontSheet", + "5546a16686f8ed0420a57e50b0f084174850b50eeb22321c918edef4683d8487" + ], + [ + "OSInitFont", + "9646e2e1659f99ee7d3c14c774a9acc9a149384aa53acf66ee7193d013d80d2d" + ], + [ + "OSGetFontTexture", + "de268377bc6168ff499d1e9edfe30c4934fc79da6d483c23a68a950e724a388d" + ], + [ + "OSGetFontWidth", + "44086fc35546cf6202bc8795f978695695476fe693804c5e6236b2a7908874a3" + ] + ], + ".data": [ + [ + "HankakuToCode", + "131393704f27b69f38e9c06bad282abd966c78792fb98ae7bc6575f55e41d8d6" + ], + [ + "Zenkaku2Code", + "5af835652deff0acf8d6bdff973961a0e5a42d26512959528afa32708c75adad" + ] + ], + ".sdata": [ + [ + "FontEncode", + "ca2fd00fa001190744c15c317643ab092e7048ce086a243e2be9437c898de1bb" + ] + ], + ".sbss": [ + [ + "ParseString", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "FixedPitch", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "FontDataSjis", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "FontDataAnsi", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSInterrupt.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSInterrupt.c.json new file mode 100644 index 0000000000..43fd4b7374 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSInterrupt.c.json @@ -0,0 +1,54 @@ +{ + ".text": [ + [ + "OSDisableInterrupts", + "91253610f8caa4988f3df8595ccfc6e5eafaf0b6df1b302668555ab7d528b1bc" + ], + [ + "OSEnableInterrupts", + "fc3bb9e8a3a33462577b4b59ca6d5e07c3a146205838d416cf9b11972894aed6" + ], + [ + "OSRestoreInterrupts", + "54db610a580003e2db23e460425f4662f4f4e7a4da3ae6f89a632df9e52b427a" + ], + [ + "__OSSetInterruptHandler", + "9217d7e02b52d30db56b8bd1bb8b7566081aff8efc43f6f9e2fa4944429d1c85" + ], + [ + "__OSGetInterruptHandler", + "25765be01b05f1055ff95fc1797d182bc84d18aae6664b5042359e4320538966" + ], + [ + "__OSInterruptInit", + "66366127db7add06289830e7eabd190a4268b86ecf65688a1924068bf53b5342" + ], + [ + "SetInterruptMask", + "e5326a35c5e3acaa4b42a803a14f94f3390c13252da9396a713f09f71c5e8e51" + ], + [ + "__OSMaskInterrupts", + "d266fa15531cbd0b898a48fd557a8067355aa7eafdff9c8d30d8b16a11e49ccc" + ], + [ + "__OSUnmaskInterrupts", + "bfaa970a1851418c0aec28b9ec613cade68d972668a9ba150c8dd7d958dcd9b5" + ], + [ + "__OSDispatchInterrupt", + "569ed657f59f346128c2b7b9aaeb75c7a94f9bbe891a4ee85ff215d52ff34601" + ], + [ + "ExternalInterruptHandler", + "56a0645deae561ac89ef32c2d422a4714e029d8f0be12300b05a203b482a80c2" + ] + ], + ".data": [ + [ + "InterruptPrioTable", + "d9ff6f5630c570c2ce03b84c41e1549ae5b4c124125ec9ab00bf09e3270c859d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSIpc.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSIpc.c.json new file mode 100644 index 0000000000..d1126a265d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSIpc.c.json @@ -0,0 +1,22 @@ +{ + ".text": [ + [ + "__OSGetIPCBufferHi", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "__OSGetIPCBufferLo", + "f78779fa6642dbd2b4d4ae9f3fedc3eadacc658e46762d9b5183001b44bbfc30" + ], + [ + "__OSInitIPCBuffer", + "8901a8722a42a2d49e514d08154aa11ecfbf001e53e056603baa7c4cf7efc4ab" + ] + ], + ".sdata": [ + [ + "IpcBufferLo", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSLink.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSLink.c.json new file mode 100644 index 0000000000..92ba60159d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSLink.c.json @@ -0,0 +1,8 @@ +{ + ".text": [ + [ + "__OSModuleInit", + "0c92302656f5a459132247f0fd48f22d7fe8c75f6480e2922ddb4f3e5ac230af" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMemory.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMemory.c.json new file mode 100644 index 0000000000..e4937c7d70 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMemory.c.json @@ -0,0 +1,78 @@ +{ + ".text": [ + [ + "OSGetPhysicalMem1Size", + "552dfac1293bf86c91fd5f9d63a7cb193c1ddb74a629340806f098aa93f63ffb" + ], + [ + "OSGetPhysicalMem2Size", + "64d858ed899efc33e769ef799ce56b0327ae4d35ce5ff991e4e668cd46bfcd7c" + ], + [ + "OSGetConsoleSimulatedMem1Size", + "f7a7f5db56123ca73cb156f0ea10ff7302ff4cf19570ff2a399484870586741b" + ], + [ + "OSGetConsoleSimulatedMem2Size", + "3addbf25e191087e1b7bd1a5e860ed366a0d5efb13aa5f5aba541c757d3b12e1" + ], + [ + "OnShutdown", + "7bd422700d66fcd2ab719f995a86246682b40ed8490c894ee8de304ded25aff8" + ], + [ + "MEMIntrruptHandler", + "e7f119d0e4a4bdd5ecfe05314ef9d314cb6b77fc36fcde8344aa66fb45984b6c" + ], + [ + "ConfigMEM1_24MB", + "cf5307b2bf2ebb9f29b2a1fa74971e981dc9378533f47dad0101f39e78d82de7" + ], + [ + "ConfigMEM1_48MB", + "ce2846d9f279361c550616c141344900a77a06ed61016dc6fc326ad396e7b836" + ], + [ + "ConfigMEM2_52MB", + "025f3ab434fe3c905feff142bafa9342442dd66306490f74b04e6f923e38625a" + ], + [ + "ConfigMEM2_56MB", + "58527119cb2ab9772bd5ea300dabe17615ec2c03d555fad3d8c0abcff631cebf" + ], + [ + "ConfigMEM2_64MB", + "4abb7a0988453a9a6e30ab49009a93b1697622f0e5ccc727fde1a879e2206df5" + ], + [ + "ConfigMEM2_112MB", + "7518397af1551837206da0ef717471dbbb8081df4473d8fcefe0c4efc4a36a2d" + ], + [ + "ConfigMEM2_128MB", + "69874ef3605ac35af3c12c47c5dc692f5e361988b5f8017fd4e44a3e48b40435" + ], + [ + "ConfigMEM_ES1_0", + "63a87a717a70031b1435fdf93380232872b3aac617fd1109139857bd38c535d9" + ], + [ + "RealMode", + "e08f9cdc98e277e6bac6ee3d9ddf3333ed099873eff971f5de39634d3fb07eb1" + ], + [ + "BATConfig", + "42c173a607eb4e62bc99755134b6b615237f08c761ac9d8e09d358068178ec7b" + ], + [ + "__OSInitMemoryProtection", + "9e80154457632c5f91ecbcf19262c46f7f836fb1eedff7997464cf28a16b6f06" + ] + ], + ".data": [ + [ + "ShutdownFunctionInfo", + "59bcd2e305e1155f2829b6b387effc544514a32e7bf02d4078b2e04557f5c8d5" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMessage.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMessage.c.json new file mode 100644 index 0000000000..c6dd2fc94e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMessage.c.json @@ -0,0 +1,20 @@ +{ + ".text": [ + [ + "OSInitMessageQueue", + "5b8753a744675ea002685b8b5d8f1c3d3b450861be5345fb7014601c48623c77" + ], + [ + "OSSendMessage", + "68a3a7d128910ecce54acca5ddb57e60ff5205075b52e5032655d47fd104ab0a" + ], + [ + "OSReceiveMessage", + "2e2344841ae489b333336bf2b7f6acb05c6acd02d3bb7f5196fe0e4961a7f30c" + ], + [ + "OSJamMessage", + "4edb5bdae58967df153dc61f6bd19d6dfd9d804fcd3fd6bc492495dce216155f" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMutex.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMutex.c.json new file mode 100644 index 0000000000..03cb973a69 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSMutex.c.json @@ -0,0 +1,24 @@ +{ + ".text": [ + [ + "OSInitMutex", + "eef51ed2c272e29aafd20c5caab408727dc14c2826065ea34633c45a46af39af" + ], + [ + "OSLockMutex", + "68ee313f50795b760a91b7942cdb8e9f5d5feb41a1fb805c60eaa4b6da836d3d" + ], + [ + "OSUnlockMutex", + "10df813e95b445e11322538ba05bd7c04a211242e5c6cdf217fcff0f50810c18" + ], + [ + "__OSUnlockAllMutex", + "547137f61c9d1ce8c3908ad6db02d7202820794bcd93e7c03bafbdce74467b9b" + ], + [ + "OSTryLockMutex", + "9b5d20d4a68cb21f90c038410175150cbeb974d3ca24419f4d8a97def2ce8841" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSNet.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSNet.c.json new file mode 100644 index 0000000000..29b0f2a168 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSNet.c.json @@ -0,0 +1,8 @@ +{ + ".text": [ + [ + "__OSInitNet", + "c9cc93d5cf984cfafc0e57ff58aa98fadb0edb43e3caf47e85236541f5d622ec" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSPlayRecord.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSPlayRecord.c.json new file mode 100644 index 0000000000..a26f096b36 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSPlayRecord.c.json @@ -0,0 +1,74 @@ +{ + ".text": [ + [ + "PlayRecordAlarmCallback", + "9e68fe3f5332588f20ffa2bd2af8e1a19225ac532cb5bcfc3d70470b49b9253d" + ], + [ + "PlayRecordCallback", + "302cd0b948e44bebdcd7c43ea7555a56a5a4de053f8946de0c84defca3d660dd" + ], + [ + "__OSStartPlayRecord", + "b27d40a620ed2c4352813e7683738b1466af8e877c183a9b5aa0c83b690cb562" + ], + [ + "__OSStopPlayRecord", + "5b694f6736d3f49c5e1005e39c4a65ca04f94a3bee911c788745cab1a669d797" + ] + ], + ".bss": [ + [ + "PlayRecord", + "38723a2e5e8a17aa7950dc008209944e898f69a7bd10a23c839d341e935fd5ca" + ], + [ + "PlayRecordAlarm", + "17b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1" + ], + [ + "FileInfo", + "24045c10c12a89f4c11e3b88ea34558fcdf926a8c1008cd08cc33bc71407c774" + ], + [ + "Block", + "d81bfb50e59a9abbe66f6ae0c6b45c7b9c0bc6eead2cf982118ac4d62b6ffeda" + ] + ], + ".sdata": [ + [ + "PlayRecordState", + "3b28a6c3766c6295adad976d349705ef49393fbfdebe4facb5862d2cdfa285d3" + ] + ], + ".sbss": [ + [ + "PlayRecordGet", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordError", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordTerminate", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordTerminated", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordRetry", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordLastError", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PlayRecordLastCloseTime", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSReset.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSReset.c.json new file mode 100644 index 0000000000..3c1c22abe5 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSReset.c.json @@ -0,0 +1,38 @@ +{ + ".text": [ + [ + "OSRegisterShutdownFunction", + "43565cec4395577ffc09a016be6a6d7f9bb8852c3391adce6384ce30a2596561" + ], + [ + "__OSCallShutdownFunctions", + "fabe1d7c27bfe718392aa50711a97d3b5a8176b335728a37012c407b552fb712" + ], + [ + "__OSShutdownDevices", + "61ac4ad16db19a6440d86aa9cc4e6fda12845cac7035584897da39400666f38c" + ], + [ + "OSShutdownSystem", + "a439e588ec09dc8800f4732757f290ca8e3262e3732aa74eaff77517a3bfbec9" + ], + [ + "OSReturnToMenu", + "762c3ddadace3406c7f129937b30e049136b9a0915327e7886a2c4d7cc22245b" + ], + [ + "OSGetResetCode", + "701a71be50ec6e90bf165804309e351c5751d2608083322be28802f9bda6b46b" + ], + [ + "OSResetSystem", + "8538e80d4bad2a34b36ace0b53e73ee54e7a81796a3906f3866f9496f129897b" + ] + ], + ".sbss": [ + [ + "ShutdownFunctionQueue", + "af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSRtc.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSRtc.c.json new file mode 100644 index 0000000000..2385caa4ad --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSRtc.c.json @@ -0,0 +1,47 @@ +{ + ".text": [ + [ + "WriteSramCallback", + "17aba57018baaa6db5b2b2a125086177fc6018ac6fb06028713c014d5636c2d7" + ], + [ + "__OSInitSram", + "d4f64d0ee69e1fbbdeb149b20168d75ef3273a86eb43a5e84b968c78c2e3a221" + ], + [ + "UnlockSram", + "e1cb8e3b5c3e809d2f40248815063fb4bf8a11f7b3641da08077babacd239713" + ], + [ + "__OSSyncSram", + "fd6bbd5911d7ff13de300366d6aa586b4705c2fbf4f295c26fdd6adc16c6cf62" + ], + [ + "__OSReadROM", + "b505794f1c0e3ad043168e37c5b65731ff39ba2c6e74e0c7f842b3dd42abfd6f" + ], + [ + "OSGetWirelessID", + "31cb49e21da138986b23c7b2fb3f955e36f56413a350296bcd319df6f67f06e1" + ], + [ + "OSSetWirelessID", + "b986427563549f53c06cb45a5a7b5cdcbeb30df2bf9d0ab816c5d004055e4dd1" + ], + [ + "__OSGetRTCFlags", + "2dd5b80ec10b39b94eb3561252092a56e1e9bb48fd52f25959f246982787e583" + ], + [ + "__OSClearRTCFlags", + "cbd97c80fe5ad7d792ad5dec42d908c9609b465fdc0a68f695cdba2a49528236" + ] + ], + ".data": [], + ".bss": [ + [ + "Scb", + "4fea5e6a3ec5f5474a26d858bc77b6d7bd3ab864ea02d988683fdc648602b248" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateFlags.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateFlags.c.json new file mode 100644 index 0000000000..56ec3b7f5d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateFlags.c.json @@ -0,0 +1,12 @@ +{ + ".text": [ + [ + "__OSWriteStateFlags", + "67c0edba30bea741a5d43155b446d3da421bbf1a0b6c823960fb4a4f3a68b16b" + ], + [ + "__OSReadStateFlags", + "0ea2a5ef66c3c3a341177c320e07cc3ee50fa2e526b4859e8a4513222e2d1ee4" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateTM.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateTM.c.json new file mode 100644 index 0000000000..4eea89658e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSStateTM.c.json @@ -0,0 +1,112 @@ +{ + ".text": [ + [ + "OSSetResetCallback", + "ffa8f84fddb08f9421884fe54ce3c371a968a623a3b755431bdcd9dd8f2c9683" + ], + [ + "OSSetPowerCallback", + "ffa8f84fddb08f9421884fe54ce3c371a968a623a3b755431bdcd9dd8f2c9683" + ], + [ + "__OSInitSTM", + "d32d4929ef5d636ad59d65f4976beb4f9086923da3962c6d2fab0d8c2444b81b" + ], + [ + "__OSShutdownToSBY", + "c6cf1d1e0a8f602aaf11a9904bedf6a4ddd99f489c46751f5519661f7c8723be" + ], + [ + "__OSHotReset", + "9f9263fd3182b5ec5aa56a7e5987fdfd4a1458983445b5ce0ab9a27347ed20ee" + ], + [ + "__OSSetVIForceDimming", + "b4c09d8aeb1eb2916b06a6abe39cee3c80abee385a2dc2cd25816b7629d2d501" + ], + [ + "__OSSetIdleLEDMode", + "7e356f512666c21c586e380b567e641ef9f8e61cd83217605701408bb97bcb7f" + ], + [ + "__OSUnRegisterStateEvent", + "af9582a0d00a9d5e7a54dd7d2ae00dfa45871dd3fd4407a4d4fa2913141b0e70" + ], + [ + "__OSVIDimReplyHandler", + "1a540cdcc9aca9c5be1e462ea845b70127a49b7db0a36599fd76e3d4287ac570" + ], + [ + "__OSDefaultResetCallback", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "__OSDefaultPowerCallback", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "__OSStateEventHandler", + "e6761f2ea00fb74b2737b935b348b1b89311bd78c56389ffe8357c2d5c1c0572" + ] + ], + ".bss": [ + [ + "StmEhInBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "StmEhOutBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "StmImInBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "StmImOutBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "StmVdInBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ], + [ + "StmVdOutBuf", + "66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925" + ] + ], + ".sbss": [ + [ + "ResetDown", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "StmReady", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "StmImDesc", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "StmEhDesc", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "StmEhRegistered", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "StmVdInUse", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "PowerCallback", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "ResetCallback", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSSync.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSSync.c.json new file mode 100644 index 0000000000..c7b7f6c4b0 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSSync.c.json @@ -0,0 +1,12 @@ +{ + ".text": [ + [ + "SystemCallVector", + "645737e26b087a24f1993b8eb5da38794a01734303bbde0cfc1930e8c6261e5e" + ], + [ + "__OSInitSystemCall", + "44c225898e29ebcf04c02428f6926fcfb7100177f2bcc0893588c02add5246cd" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSThread.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSThread.c.json new file mode 100644 index 0000000000..00bb2929ce --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSThread.c.json @@ -0,0 +1,112 @@ +{ + ".text": [ + [ + "DefaultSwitchThreadCallback", + "f332ea5b5437103cbb6f1508679da89eec9288ad775c96c439a17fccabe3de8e" + ], + [ + "OSSetSwitchThreadCallback", + "15f03b3bd9c36c216d1b7bee45217fa950408aa792f6887e4c700ef6aef666a8" + ], + [ + "__OSThreadInit", + "7ca7fc866fab52ef67e33158ce9b2d93ee191add6a58b687ebc09b065f49fe9f" + ], + [ + "OSInitThreadQueue", + "795c186d6dea2619cf5a24ccbafeda1ebe4adefcd6c7d0042d22bc7e51f4736f" + ], + [ + "OSGetCurrentThread", + "31a585b109e5b308785a71615fcd76b34006a2cf34c9584fb803a131037a4e04" + ], + [ + "OSIsThreadTerminated", + "adcd8de55a71aaa85922cf30a985dd89a3483391ba4833e0d9117558922ff092" + ], + [ + "OSDisableScheduler", + "d0532ee93b8cd6057546edc79258e7230637b7cf006b36671974656dd8a9c1be" + ], + [ + "OSEnableScheduler", + "ac45e10a739d5dde47430ed696c68bb4cf03ed0d631571e082648d4ea9032ce6" + ], + [ + "UnsetRun", + "b9a05b444610fd0c0a0060e48dd5233f2dfccac770178025fc47876f2e221948" + ], + [ + "__OSGetEffectivePriority", + "c6c8eea03f84a32a26c41df3c5d9b0a7a8b402d4126c6ac00ee86325e92f2ce1" + ], + [ + "SetEffectivePriority", + "7356df6398cd81ec624b6f7a35c6654d371fe3daf4a660528fc993eb66d3e12b" + ], + [ + "__OSPromoteThread", + "fc238e563ba0794581dd42101e0b0368175c3d89c63c58a2162c9fbbe7096613" + ], + [ + "SelectThread", + "feeae8d9379fc32c230c332a0ed21ead2d75311fc5efba952de8fd23f2c44c21" + ], + [ + "__OSReschedule", + "c88665070203de7d4b25571c9754fe929310056802a3ef2ce94c2dca84166781" + ], + [ + "OSYieldThread", + "3e27b245b22f3d09facb63c287cd887dff4b7474c32922549823b7a70160daa1" + ], + [ + "OSCreateThread", + "93f865932165c222b3b32ede4968bbe4c0595281c48dc58065ea1d80d6077e7e" + ], + [ + "OSExitThread", + "afff43e4c8d2062cac92c8d1e9809863805b6dba350094d496b267732188d39f" + ], + [ + "OSCancelThread", + "25a1e34fcadec3e4917bec074bf9972820eccb52b578e04e6420afc3b1b5d681" + ], + [ + "OSJoinThread", + "a452c13ff8d5ff9bc929eeb4f43d2793770f3d0345f3c0d0b4a24b2e269f8961" + ], + [ + "OSDetachThread", + "1acaba5266c76fad68d8c357310179934ed8faabb1757c3647d2035c1d44a331" + ], + [ + "OSResumeThread", + "fd1df14ff6b0c70b3ac003d3b4c08f15cb77739970b73b3c9023a0181bf6979a" + ], + [ + "OSSuspendThread", + "90704570684385a787f29a7e38cf768b10a08b9e9b678861a062c66b7c07eaf0" + ], + [ + "OSSleepThread", + "bdc3ec4ed04fed8072aa273ad42338809863461b6c294aecab0dc65c305ddf2d" + ], + [ + "OSWakeupThread", + "e12a18f578c21c8b9da4ccc106b717328908e7224dce4ebd24411fdb4193f655" + ], + [ + "OSSetThreadPriority", + "4b2af667b21054c91c76679a167943a00e525181d1e8559e766d6a86042365b0" + ], + [ + "SleepAlarmHandler", + "1ff0633b316d64a922d53b454a757129bfd2e97c35dee6c9b0f4d648a31fd9c3" + ], + [ + "OSSleepTicks", + "66ee8ce9ed46fe1dc05a2ba8df957d867a2202102e42bbdf43e829c8bb3523ed" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSTime.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSTime.c.json new file mode 100644 index 0000000000..ab8c7ce397 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSTime.c.json @@ -0,0 +1,42 @@ +{ + ".text": [ + [ + "OSGetTime", + "33454680e35a0533c69ccfef1fbf684a36c489694a9053a0b012f7943dc214de" + ], + [ + "OSGetTick", + "7836ce7cf2facfcda9d887183c84a835cd71b6de5b52dede3efb27d086a23294" + ], + [ + "__OSGetSystemTime", + "19510767497ad4cb683a355795cb101c6463f6e8bc656867791880cbf90feeeb" + ], + [ + "__OSTimeToSystemTime", + "3b324387a4789da5342c9f3f0bfa4e1a8e8d6ed3fdbf73d5a4b1b591d04d87ba" + ], + [ + "GetDates", + "d15398398af77e3512a8b4edfb180a1979cbc880f41cfa281bf15adf07f550c9" + ], + [ + "OSTicksToCalendarTime", + "939439ebcc282ccd28fab7a524c449ea768eb3ba5c5e0c072497c529415b524e" + ], + [ + "OSCalendarTimeToTicks", + "dd3f166cf1128b510c0c1d46514bd3d065dea5d174a537ba8b91ccfd6028245a" + ] + ], + ".data": [ + [ + "YearDays", + "cfccb814107befbfadf8d3c33a6635ee499d68a7187b6c4ad231c4ad935e2dda" + ], + [ + "LeapYearDays", + "e7ca51f9af3f824f8f5c56a12e71a161cc7d0fdbf4107a6ccf7d8fce92fe94e5" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSUtf.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSUtf.c.json new file mode 100644 index 0000000000..97e164525b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/OSUtf.c.json @@ -0,0 +1,398 @@ +{ + ".text": [ + [ + "OSUTF8to32", + "8a56763dbdb1bd6305ec754ae223803c111266cf7aa7cc1fbbd1a07f677c199f" + ], + [ + "OSUTF16to32", + "ae91dd1ce1b36a829ebaa29558f24e8b8a2157bc68bb13ce98dbc236248b32f7" + ], + [ + "OSUTF32toANSI", + "edd17e58a5ca3a09ccf18e6bbddcf31fca7423d1bed8b1f8737ef07de98b87b4" + ], + [ + "OSUTF32toSJIS", + "244795f88919a170e74a3415a9f718980ae44de4ebf8ec77377ba9bbdcb808bc" + ] + ], + ".data": [ + [ + "UcsAnsiTable", + "479bbe575966606ea9328b489c41c82cf50800295caf7ff5ff0babdc42e28dad" + ], + [ + "Ucs00", + "172957f1def5bc1ca10e9e789a3c08b4ee9bdf40de9da92f1af7b066d7624c89" + ], + [ + "Ucs03", + "10fa6a4e0630176229ea2cbc256f6cbb1e8d8380bbf030cac5d42f5a05cd5da6" + ], + [ + "Ucs04", + "765d60aafefb976b5f875783450dd0188ba2fcb560b059bf88c42adb6ceee2d5" + ], + [ + "Ucs20", + "d50d9caf4801210e2a912d54d81faa5dc020b07ac7286be75c56597cdb86ee32" + ], + [ + "Ucs21", + "bc88adf4ce8a0bc4a5d4eb792cee48b4f9330a40f61d65a0e9b25f42145cf7d0" + ], + [ + "Ucs22", + "7eda440c2fd0bb7cbfd18faab36dc48031e85709170785ea8a6f2bd90ae55ffb" + ], + [ + "Ucs23", + "91ff03646d3dfb696637c060909f9aa6fe6117b8f895d1942c0923886640dc80" + ], + [ + "Ucs25", + "90e15366d10d0ad924bbd13a53dcab044ab7623d979a7912ee9d6023bb1bc072" + ], + [ + "Ucs26", + "20b7fb66f25af4522f88bd1244013d8bafb28ec0dbaa321d6a29ef61074ff063" + ], + [ + "Ucs30", + "b11a01773ffb91ccd87ba9dc681c37840c6b19bf8b9190a8a4c30ea3cbf05a07" + ], + [ + "Ucs4E", + "add98a1b362b6308df79ad42a84e0c04f4a3e930abd639d2d09469a171fbd8f9" + ], + [ + "Ucs4F", + "1fce5237e5689f16eb3bef0073e6179f0ae5df78bbe41914f0ac50f0113562e7" + ], + [ + "Ucs50", + "5fd1e894addaf2ef0c49e1ea741bf2bdd62e2bfc4ce814c7889038e4216bb0e3" + ], + [ + "Ucs51", + "39ce56505148c6f7524c4908350eca87f85d2fbbc1471130a016d310377f7f21" + ], + [ + "Ucs52", + "095b5b18cd35010609280ddde5362db4848f1b575d96840b502df512822ae059" + ], + [ + "Ucs53", + "31959d1f1701a1a42cbd032bd6475bce1a6a9de220f2695f100633edfa8fe846" + ], + [ + "Ucs54", + "baeba40b6dee76fd75055666f6dbc0b74637102b9a0110eef8d7456b139e4709" + ], + [ + "Ucs55", + "84bbb2fe0100bc3dea7ef3735eaefdc83cbacc5f53482f20786603ec82fce50d" + ], + [ + "Ucs56", + "4d9aa0d29659bbdcc02af3863bc2109bf3fbf3390c1e5fbf6d77884856f27d5c" + ], + [ + "Ucs57", + "f184817f67868f68241130963612da9b58f45db5a1a4c4f0e68d83c932348e0f" + ], + [ + "Ucs58", + "55a384d60d1b8d411d78dc6d3661ce98be37d582cc4de21aa6ee39eb5e454b5c" + ], + [ + "Ucs59", + "b7d240b12e946e33087e5c0e9fc2bbcea02965c29ab06ce7f32878adac80f49c" + ], + [ + "Ucs5A", + "283246c597860000ff22503fe4182109d6115bbc387b8220eb1d821d6f6f8f07" + ], + [ + "Ucs5B", + "207ba32e8208a78a39f0a920aff4fe49bfbb42bc267dc30cf5483fdb05ea3d32" + ], + [ + "Ucs5C", + "bab22ab27145d7f4cebe8b21df1870b8643950a4e12bbd09678ef9fb4d607e05" + ], + [ + "Ucs5D", + "8d0f7c76855ade9da204e7d76ee9038f5d2767d5a5bec9b497373d1af125fd12" + ], + [ + "Ucs5E", + "f9a0edcb9ed72e4b96aa8a42701b26c39c87dd0ebbb980b93fef30747455d430" + ], + [ + "Ucs5F", + "0fe244c2798936f63056755e9ae015c23e1370693116c5bbd6d9d748b68be80e" + ], + [ + "Ucs60", + "32ebcee9af3a7d226ea87a0d04fa59b9e535c1d7539fc21b966535e2058bc600" + ], + [ + "Ucs61", + "aea70882e70d5e55a1e4df315c940a811c33559fe10617fcc1d2eb99a6ee1e48" + ], + [ + "Ucs62", + "37c4a822b36e1410b748ba9da0ed4abbd57fec844cc916d5aae8c04d283f3b5d" + ], + [ + "Ucs63", + "04f5e0154f66169ea2b5a3f194a846e5bd9b8d124897f20323b93c975f119415" + ], + [ + "Ucs64", + "29286233afd73fab880dbd6be521c77de1e4dfbcf74638e42321942caeeb691a" + ], + [ + "Ucs65", + "bcc44163adb305079c2dc0df1b14da76874df2c4de1be177982c1401cb31705e" + ], + [ + "Ucs66", + "afdf7166a0209eb07571d92ffc4e07d51d5fb08498ed20facbb510bdb9759bb0" + ], + [ + "Ucs67", + "37b277bf732b633c0ee38c846f3d7209c9b1c72bcfc926154a42cdd23ae01502" + ], + [ + "Ucs68", + "6cca3566a3fefe8518c0ae931758d4aaad1b2f99561c17066df7058d20e91a9f" + ], + [ + "Ucs69", + "83811cc1fff31e1653c51da71fbde22393b49b6a0f60409be183bd2eb15660e9" + ], + [ + "Ucs6A", + "c6c0aaca98173fcf5ca2875cb8b1fd8b0f8205db02f14c5bf90653a8c9d56835" + ], + [ + "Ucs6B", + "53bd169f92fa56e5a56e63a340996a47b65f0af4aa5eee0710609bb37bc70996" + ], + [ + "Ucs6C", + "10c2f6b24e5cb3eb2ad87afcc08d47a546eb60ec21b4b19202e6097bfa397003" + ], + [ + "Ucs6D", + "9afe611d35cc94763325a43c4b93d77323fcada26125e40cc09c5d95f37527a7" + ], + [ + "Ucs6E", + "f9851a642caa2b1a4aaaf2f5b5df5d17146a8df848fd2b8dcb13e2c678a516c3" + ], + [ + "Ucs6F", + "9742d0b88be2a4419cfcf30f1f9eb4bc8e5ba6001a2cb5686b1008b5c1255771" + ], + [ + "Ucs70", + "b0f4efb714e3d494b84067ed23313574fc6fecf933b63b7a144e1e33bf9bcd3a" + ], + [ + "Ucs71", + "d81a98c8a7aeb7b0c44351149b6d5843d03a497cc6d04d590395dab6466876dc" + ], + [ + "Ucs72", + "2abcdfc46c3f8b705b6f603a0702883ca72d4ed8796c524af5f020a7f27e072f" + ], + [ + "Ucs73", + "c3cea578434e79f89c066e4f1ba4cb5fca3bf0379f4efe01c2d892c508921d7a" + ], + [ + "Ucs74", + "1805bcb7dcfb09258000680d654324d181497e81988a4823bb8bcda7e974738d" + ], + [ + "Ucs75", + "218b3b85e07058967f2c21effe56d88a13518c684125b1faf2c4c6b85f56c4ba" + ], + [ + "Ucs76", + "ca2b1e8b10d8780b3c7d6c88c66903b027b9fca2b7479f49441acff74e5be978" + ], + [ + "Ucs77", + "c9edf9d8b982ce1c9c1b15f09e7016e311516d6bb94179e05039bf575a722140" + ], + [ + "Ucs78", + "6697da8895a483395fd3930321ba6a1b47c7db95d41d12020731808488ac080b" + ], + [ + "Ucs79", + "0e00e6226324a8328bde666cd4040632ec0fa96463306476bde880237dda2549" + ], + [ + "Ucs7A", + "527f8a0cfba5be244ac289664bf47d08df98b77a4c70f764064445f7bfbb9c0d" + ], + [ + "Ucs7B", + "0e937ff54e2d3e5089f36bfef1899a56ba0d992f5f0ea548c94db2e234ffc7a9" + ], + [ + "Ucs7C", + "4594fbd82db24b3ed17a67e934b34f873b6490a432b74f869671fbd83350b2ad" + ], + [ + "Ucs7D", + "89fa24afe2bb88386452cd34b6172d23ea61c9b19118d290beea227f8560f09f" + ], + [ + "Ucs7E", + "d6fddc7c763ca636606ca4f29dc0670613b81cc276c93bf3fbda81376846ea75" + ], + [ + "Ucs7F", + "6ec2792194580638a749d745bd3b1a82009146fa232b0adb4f9e86869a46dda5" + ], + [ + "Ucs80", + "00ff83598474b63c9214f062f058a5e48bb61ebf9086dabcc85f7cae0925d0a9" + ], + [ + "Ucs81", + "6cab9c19a0cb542e939931e5f8b40f0afadc991e1bd5ddcf93f32e4c24de12f5" + ], + [ + "Ucs82", + "1ff58e501caad4e963bbde393516ec061ae314759de4557a969a78a0800b93e1" + ], + [ + "Ucs83", + "8767fb62f0f1458eb802106a34d11a706cd73fce7c99cb36fc529d37c3521292" + ], + [ + "Ucs84", + "ac23245e1877ffa1fa953e969c91150c9774876ee8315f73cea64c0dadf32574" + ], + [ + "Ucs85", + "25482238c9b3648fbb913a30d73333f684c1bb6563d41bfb21cd20e2d7770de3" + ], + [ + "Ucs86", + "fe0673246c6265d040404696d372c251444851a596e402dc2409a5629a5f1738" + ], + [ + "Ucs87", + "a57d969f4d1d12d58bc36b55bdf7bf118a0b194fb27a1a90ec8c471176ce4229" + ], + [ + "Ucs88", + "36db959d56caeab59714011820927e5cc3a5133599259ce0baa2744d64224f4f" + ], + [ + "Ucs89", + "3b7be29607ac32206a36f5c7c64c6cd3d7a6f3cb4011dc9a1125220fd09ae9e5" + ], + [ + "Ucs8A", + "d10114193d93fcfa6e4d5d97d0057173b5734ee70236bfb85c12a3090294bc7a" + ], + [ + "Ucs8B", + "24781caf4025e07ca8427bcbe100a660bac68a5264899ce8ee75c6bad5ab0e7e" + ], + [ + "Ucs8C", + "1e33aa6ac2ab296e9fb4419119911e08c19eb3c307becfdb40961a53e2f5aff4" + ], + [ + "Ucs8D", + "02f2caf9842b796cbd6801afed0e193c55822ef444711483c9e5f9c3b10b1942" + ], + [ + "Ucs8E", + "11f97c5c658f57ab632f4e34b9b2a453277c0a3d247ce744c8917e7a25809430" + ], + [ + "Ucs8F", + "627137a54cd81ef4d523c3b7b6c5ac8231a2258838505e90df430267e65b277f" + ], + [ + "Ucs90", + "71a0d9f73c58e6161263d47cf2a551dc56a97b7190759c78d24e18da6eb9cf93" + ], + [ + "Ucs91", + "c7c309599fb98ead285db9c3c8db2dae300616a362408d93c530a86fbe0e10b7" + ], + [ + "Ucs92", + "5f31e4c26371f533d0a8a3674bd1b2d2ed44db3883a46a732552795ea0fce79c" + ], + [ + "Ucs93", + "b70d1a3c46b4e6c8af0e02c4fb894fe9a00017f08662f8986b2117db38fb6eeb" + ], + [ + "Ucs94", + "cd7fc0b180920c9b4bd2d0dd04afcd9a1ebac0f32aa134ce1f8eda534eb282ab" + ], + [ + "Ucs95", + "60f8b9857fd739cc73c33c4c3186d01fd6e3be69efe17af6f35ddb401130f9f0" + ], + [ + "Ucs96", + "6a068d74f6ea83245eed208e5d8cefb1482b241eedb25f3eeac6d2a644d58d17" + ], + [ + "Ucs97", + "ffa1b50e5b182eee63deed374c1f60400f76c542ed7061e62b1da7b5040b5fe6" + ], + [ + "Ucs98", + "d8dc2e7a45b089d4913d89eaf488dae4a32599d570ff6193294c999e0d09bd60" + ], + [ + "Ucs99", + "6db4a90c77d81318f735dd55602fdd90172ac469523cd9da0e6d7502dfdceb27" + ], + [ + "Ucs9A", + "9ea3fcc4b5666150a2a574da8f9ea824f0689691273f0488e4a31ca7db825c12" + ], + [ + "Ucs9B", + "e909758cb4514b72306795ce870855840e88d792769e977e206eaa39d15b5771" + ], + [ + "Ucs9C", + "8e8669dc84f83e0a7a297eeaef804ac79a93e2d2fe48b79d8aef21a9d63eed40" + ], + [ + "Ucs9D", + "c941e673da6e6f4d2a922fb0d405641639f5263929fa4f46ab0d096f6e196963" + ], + [ + "Ucs9E", + "f0ea23d305cf756b1a18beba64d9420b0b89bfea4bba16d9a0a81e8da8d6f895" + ], + [ + "Ucs9F", + "aeeb897c5453911b2f76eb89540fcbaa5d681e7373179a90769883082308a6cd" + ], + [ + "UcsFF", + "f684e56aa092aa8d6fddf8345b5563463c7cbdccfccf36cec1436234eb7561fd" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__ppc_eabi_init.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__ppc_eabi_init.c.json new file mode 100644 index 0000000000..29288b8445 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__ppc_eabi_init.c.json @@ -0,0 +1,26 @@ +{ + ".text": [ + [ + "__init_user", + "2b562031be8f26332eeea771852520e6bc8f40c318b888344801ea51a798cab1" + ], + [ + "__init_cpp", + "65bd7421fa5b71d13be14b26e87bcd7d82e95f83208c96bfb234e96722a46925" + ], + [ + "exit", + "b39701c7342caeae0bd29a7308466ae7850726c0869bd3ae7c94cb4a163d9d12" + ] + ], + ".init": [ + [ + "__init_hardware", + "2dfe4b540ff31a60f87369650022a23cac835d4e51efdf516b64c126ba0692f1" + ], + [ + "__flush_cache", + "f1508c81931b90be8b69ee1efe567f67dc6996ef5c0ce499cc364dab149e3e16" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__start.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__start.c.json new file mode 100644 index 0000000000..a605ac124e --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/OS/__start.c.json @@ -0,0 +1,34 @@ +{ + ".sbss": [ + [ + "Debug_BBA", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ] + ], + ".init": [ + [ + "__check_pad3", + "c5dccf96d2085d9e7cf3949dfca8a1d2765c32f77f06223e67e1f81f1d504b5b" + ], + [ + "__set_debug_bba", + "12ed71d1014a172283f7c9c5f36749b639063ea7d85fefdd5b837d633b1b73b3" + ], + [ + "__get_debug_bba", + "4b667844052e7b2f6db1f7e5140b181a124c742b45c069b0cdc0f77fb3ee84e2" + ], + [ + "__start", + "4787c675d1bb5b8fc1c8f86fe7b51f0d8c8d3f00b20184a3c1deb4a5f8d0eb79" + ], + [ + "__init_registers", + "a738f32281a6f0725a9bcae739cc15f758fcdf8fd335156b80e23631b3d6027b" + ], + [ + "__init_data", + "462712fc1db07f58c12305c8f1c82cf18989b7bd4d755970cb0367ed3cc7fd2d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi.c.json new file mode 100644 index 0000000000..f5b9c3e228 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi.c.json @@ -0,0 +1,72 @@ +{ + ".text": [ + [ + "SCGetAspectRatio", + "3d85ccca39f702671a3d9f97af0daf1d4dabe3a1bf7121f84fcb1ed807ac09f0" + ], + [ + "SCGetDisplayOffsetH", + "13d7db8741fd07462d1be755ae6a8732424c571c02a14a9b6f9fb4139adfb324" + ], + [ + "SCGetEuRgb60Mode", + "89b7fd22c1cb5b77ae8c00788a3e690286cc40578c600420ac7e6185fe17502e" + ], + [ + "SCGetIdleMode", + "c47c8d0c9b58a3c9775326568e5214f6be4fe64b947c9798f0a909c4af245f33" + ], + [ + "SCGetLanguage", + "38807109b46bf0fdc9574f11e169887f45705389b9cf4a9fa0280c6471a045aa" + ], + [ + "SCGetProgressiveMode", + "130ddc2e7ca029d90029928e4b4c1ada2fcf88fc00754b500c9479665e83fc0d" + ], + [ + "SCGetScreenSaverMode", + "05a1347773fb94aed5ca8f9aed71de21597c27c829e043a09a81b81dd9e202ae" + ], + [ + "SCGetSoundMode", + "9e089506e1832f6d5edaddb4123776764856f3fa7cd05885f2ec64c3ee2fa1ae" + ], + [ + "SCGetCounterBias", + "9b5c55b9a7b2a4571609b5ef626bf082933413ca81e6fc3f14df9e330fb93951" + ], + [ + "SCGetBtDeviceInfoArray", + "ed568474df5f3a4b0d44ed053cae4d53d2ba4444163beb9d999b7f7c03606778" + ], + [ + "SCSetBtDeviceInfoArray", + "ed568474df5f3a4b0d44ed053cae4d53d2ba4444163beb9d999b7f7c03606778" + ], + [ + "SCGetBtDpdSensibility", + "b6ba4d6338c6e81c30f67585cf07068b786fab199703355fd830f7094a91e31f" + ], + [ + "SCGetWpadMotorMode", + "de78f9a5c4ce3f7b8debc43a860b73ab67ce65204aba5926f0fb9470544d159c" + ], + [ + "SCSetWpadMotorMode", + "f3c1c2965b7bd19b72b16c7c289e238c9979b8a57361115bdb0b7b1a4873ea62" + ], + [ + "SCGetWpadSensorBarPosition", + "45346d08fb1835c684adb06dde0c815267aa9845b6b5009e8de98406cbc106d1" + ], + [ + "SCGetWpadSpeakerVolume", + "4b614ccc50525d6a53d8b4375cbec5b1348f91386b5a4e4bfef780986cf37eee" + ], + [ + "SCSetWpadSpeakerVolume", + "3634e71b8922f7e199939a7dee4479e754839ea2f4bdd49ea79e3f37890309d0" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi_prdinfo.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi_prdinfo.c.json new file mode 100644 index 0000000000..6bf778a7de --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/SC/scapi_prdinfo.c.json @@ -0,0 +1,18 @@ +{ + ".text": [ + [ + "__SCF1", + "8d8f4d9ac6d94b276512e54a8cda3923c7898266cddae138d43de4b6e3eaa65f" + ], + [ + "SCGetProductArea", + "9401b0ab1516cfae92943cdbe17c34bbf04381f731dd58949c7a4b848fda9f4b" + ] + ], + ".data": [ + [ + "ProductAreaAndStringTbl", + "d805850abe77b70f16911decf5192816933108b4bc85426bb36aa92556d168a4" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/TPL/tpl.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/TPL/tpl.c.json new file mode 100644 index 0000000000..3beab585ce --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/TPL/tpl.c.json @@ -0,0 +1,12 @@ +{ + ".text": [ + [ + "TPLBind", + "d8b5aa35090e70074770c29e6dced58d096beef19b26cf8b034582f3effde175" + ], + [ + "TPLGet", + "f808cdd4ced8c44c1a9593a0a2e70c132e65cce5e65bc447faef3886f89c45fc" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/USB/usb.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/USB/usb.c.json new file mode 100644 index 0000000000..5c660f4530 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/USB/usb.c.json @@ -0,0 +1,76 @@ +{ + ".text": [ + [ + "USB_LOG", + "7a8c7590338114a8c14964b73915a4754a074c5d2f4b4def9e0ddeae1d5cfaaa" + ], + [ + "USB_ERR", + "35afac9590e14f02f67cb82e064bc9032cbfaa64175ccdcda3c57581876b0fad" + ], + [ + "IUSB_OpenLib", + "17cc66bdd2c523599329b7b9a599bf6a2ca63734c52ac3a29dac2b7df3090a90" + ], + [ + "IUSB_CloseLib", + "d4e9e7520ef19698837e384bfe1708ac4b91fcf26b16ec098ec21c1e344ad3db" + ], + [ + "_intBlkCtrlCb", + "aaa0e5dd2cb9c220018e23291c1c62bf3092841228a10ea74662f05767ec37bc" + ], + [ + "IUSB_OpenDeviceIds", + "7cd1f2df2ec0ad087b5fd038a51d530fda82733edc4f6b6ebe82704d049de131" + ], + [ + "IUSB_CloseDeviceAsync", + "71eb52718bba265dd5a4038c104c527ae7fa69148cc0dd35f7b7582bd1f31e5b" + ], + [ + "__IntrBlkMsgInt", + "70a36e3ba57d1465f209e64d2ecfbe66fc0942cc7245213dde2fad213cbdf67b" + ], + [ + "IUSB_ReadIntrMsgAsync", + "ed3607cd58844208d8651c34b1e9ba9cacb8700501ca435fade151adc659e8d9" + ], + [ + "IUSB_ReadBlkMsgAsync", + "b81f1ad42f81cdab6a94ba43eb27e3dd84a85770c8bda2254362a4346d08c00b" + ], + [ + "IUSB_WriteBlkMsgAsync", + "b81f1ad42f81cdab6a94ba43eb27e3dd84a85770c8bda2254362a4346d08c00b" + ], + [ + "__CtrlMsgInt", + "7c3439e9c1ead5bb03fed6945da9ea1bb4cb14a7c67ef2e4cfda3607c39f2077" + ], + [ + "IUSB_WriteCtrlMsgAsync", + "2580fc955f379aded4aaa6924a8f1e6526be30cadc407741de847b56bd6ad1cb" + ] + ], + ".sdata": [ + [ + "hId", + "ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e" + ] + ], + ".sbss": [ + [ + "lo", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "hi", + "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119" + ], + [ + "s_usb_log", + "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_clib.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_clib.c.json new file mode 100644 index 0000000000..980fa6cb16 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_clib.c.json @@ -0,0 +1,32 @@ +{ + ".text": [ + [ + "VFipf_toupper", + "15d687ce644721046f195825c6550d104ac83e4f0b4ec617cddf6e0324260b08" + ], + [ + "VFipf_memcpy", + "0caffad17c290d73888715b2df305f8d04d555b564481d0a6efe190b2b759236" + ], + [ + "VFipf_memset", + "aa4340ebe9b7a48ac181f96b32e1a100677550d0ccf56153f3c5e07e79e88133" + ], + [ + "VFipf_strlen", + "1442e98d9466d24fea9533539c95ad914925131f59db188e4fdd928ef42688ad" + ], + [ + "VFipf_strcpy", + "8380707ae68d1ead7c2912db6255c8fbc4cc5f9d51264bd3f1b24ee355b44ae1" + ], + [ + "VFipf_strcmp", + "2743c41ee687944c26322a467e06d0eeefb338b7c1c17e2f1f3be68c0d6008db" + ], + [ + "VFipf_strncmp", + "02c69cdba678090aec4cf4dac653beada74eb681097081743787bc2572b9fefd" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_code.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_code.c.json new file mode 100644 index 0000000000..9a52f575d7 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_code.c.json @@ -0,0 +1,18 @@ +{ + ".text": [ + [ + "VFiPFCODE_Combine_Width", + "e075debf6ffae12a441c6660d1d4103c9db2fa8e6a5e2c7cdb93d79f72627a78" + ], + [ + "VFiPFCODE_Divide_Width", + "97e8281487ad58582f9dc1fc74c015bb9a91a58e413943b761c394cb2554f4cc" + ] + ], + ".rodata": [ + [ + "VFipf_valid_fn_char", + "303b90d556e35b708c832d44ae630bfbc4da874b074b15917aec0385dd2d9d8c" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_service.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_service.c.json new file mode 100644 index 0000000000..52e1d4eab9 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_service.c.json @@ -0,0 +1,12 @@ +{ + ".text": [ + [ + "VFiPF_GET_LE_U16", + "37c059bd4e9734c756b1e6bf84f611591b2ab13281a40a9c0c5c9ed4ed479ffc" + ], + [ + "VFiPF_LE16_TO_U16_STR", + "8415287c1237a0521b47bb8793e47f9655dc6f93be2d92df9c05ea97f9317809" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_str.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_str.c.json new file mode 100644 index 0000000000..e8624ee8fc --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_str.c.json @@ -0,0 +1,48 @@ +{ + ".text": [ + [ + "VFiPFSTR_SetCodeMode", + "f1309f6b2cfb12dd91ec2f07ea4b087ebb9126181127fe34007d43ffcbfbcae7" + ], + [ + "VFiPFSTR_GetCodeMode", + "5d9a1b452d6935a19a897fdbed86c41fbed9fe502cda3ec46eb9648aa3405b9a" + ], + [ + "VFiPFSTR_SetLocalStr", + "8ad25d267bb34fbbd220c1ee20fdab9e3a79dca000a0b904180797b3fcf6a762" + ], + [ + "VFiPFSTR_GetStrPos", + "1a1dcc9c55de74aad4f67831eb66ca96edef9371d5d2f3b64a964a1cb6fe7f8d" + ], + [ + "VFiPFSTR_MoveStrPos", + "1472d828029efe67b386177d2daed4354fcc5344d956b272e43ec2f547142bcd" + ], + [ + "VFiPFSTR_InitStr", + "6ffa1e0c98208c795d800a53e2d04e5b7093a5b6ec3e4c81f96da9967c2e673a" + ], + [ + "VFiPFSTR_StrLen", + "d51f6ce85098337ef3624c955dce19d061f08207f0e447af33342efb158ebeb6" + ], + [ + "VFiPFSTR_StrNumChar", + "36c216d9e5ac69b2d3a9f7a7954d89e12589af01f97079e9f6e6cd58a516911d" + ], + [ + "VFiPFSTR_StrCmp", + "7519a331a4069daa4371358de5148affeedac55c92f930f081a168113ffb94c3" + ], + [ + "VFiPFSTR_StrNCmp", + "486451454a8d1629696b417d4bc6a724bf0561ec381eca456f9207f98f49365c" + ], + [ + "VFiPFSTR_ToUpperNStr", + "59ccce5c2c1abe024bc1c396580fc27b2c6626f07c0fdd8eb520542ed7c678e1" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_w_clib.c.json b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_w_clib.c.json new file mode 100644 index 0000000000..1b519af237 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tests/revolution/VF/pf_w_clib.c.json @@ -0,0 +1,16 @@ +{ + ".text": [ + [ + "VFipf_w_strlen", + "a1d6c1cbee39102596c50c04577f44ca838850bbd0b154ffd0a41987558d0693" + ], + [ + "VFipf_w_strcpy", + "57d8237714fb8308ecdb7610a894fc6954969b70e0f44f6f4293abc9a34a761b" + ], + [ + "VFipf_w_strncmp", + "a5b1111634e27cd1ecbb040206878abc334e8e0f3ee7ba851ce549d33dc121c8" + ] + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/context.py b/include/lib/BrawlHeaders/OpenRVL/tools/context.py new file mode 100644 index 0000000000..4fbc585826 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/context.py @@ -0,0 +1,161 @@ +##################################################################### +# NOTE: This is a modified version of decompctx.py. # +# Originally written by the PrimeDecomp team: # +# https://github.com/PrimeDecomp/prime/blob/main/tools/decompctx.py # +##################################################################### + +from sys import platform, argv +from subprocess import Popen, PIPE +from os import walk, path +from os.path import join, exists, relpath, dirname, abspath, realpath +from re import compile + +INCLUDE_DIR = "include/" +SRC_DIR = "src/" +STL_INCLUDE_DIR = "include/stl" +RVL_INCLUDE_DIR = "include/revolution" +TYPES_H_PATH = f"{RVL_INCLUDE_DIR}/types.h" +SCRIPT_DIR = dirname(realpath(__file__)) +ROOT_DIR = abspath(join(SCRIPT_DIR, "..")) +SRC_DIR = join(ROOT_DIR, "src") + +INCLUDE_PATTERN = compile(r'^#include\s*[<"](.+?)[>"]$') +GUARD_PATTERN = compile(r"^#ifndef\s+(.*)$") +GUARD_IFDEF_PATTERN = compile(r"^#ifdef\s+(.*)$") +GUARD_ELSE_PATTERN = compile(r"^#else\s*$") +GUARD_END_PATTERN = compile(r"^#endif\s*$") + +DEFINES = set() + + +def main(): + if len(argv) < 2: + print("[FATAL] Please supply a source file name.") + exit(0) + + src_file = resolve_src_name(argv[1]) + + print() + print("[INFO] Generating context...") + + # Generate context file + with open("ctx.c", "w+") as f: + print(import_c_file(src_file), file=f) + print("[INFO] Context written to ./ctx.c!") + + # Copy to clipboard if on Windows + try: + with open("ctx.c", "r") as f: + copy_to_clip("".join(f.readlines())) + except OSError: + # Not a big deal really + pass + + +def copy_to_clip(text: str): + if platform == "win32": + Popen(['CLIP'], stdin=PIPE).communicate(text.encode()) + print("[INFO] Copied to clipboard!") + + +def resolve_src_name(src_file) -> str: + # Is the source file an absolute path? + try: + with open(src_file, "r") as tmp: + return src_file + # Relative path to some directory, try to find that directory + except OSError: + print( + f"[INFO] Source file ({src_file}) appears to be a relative path.") + print("[INFO] Attempting to resolve to an absolute path...") + + # Convert any path separators in the source file to what is expected + src_file = src_file.replace("/", path.sep) + src_file = src_file.replace("\\", path.sep) + + for _root, _dirs, _files in walk(SRC_DIR): + for file in _files: + p = join(_root, file) + # Case sensitive check + found = p.endswith(src_file) + # Case insensitive check (on Windows) + if platform == "win32": + found = found or p.lower().endswith(src_file.lower()) + + if found: + print( + f"[INFO] I think you are referring to this file: {p}") + return p + print("[FATAL] Sorry, but I don't know what file you want.") + exit() + + +def import_h_file(in_file, r_path) -> str: + # Only non-STL relative include should be types.h + if in_file == "revolution/types.h" or in_file == "types.h" and exists(TYPES_H_PATH): + return import_h_file_as_c(TYPES_H_PATH) + + # Try root directory + rel_path = join(ROOT_DIR, r_path, in_file) + if exists(rel_path): + return import_h_file_as_c(rel_path) + + # Try root include directory + inc_path = join(INCLUDE_DIR, in_file) + if exists(inc_path): + return import_h_file_as_c(inc_path) + + # Try root include directory + inc_path = join(STL_INCLUDE_DIR, in_file) + if exists(inc_path): + return import_h_file_as_c(inc_path) + + print(f"Failed to locate header: {in_file}") + return "" + + +def import_h_file_as_c(in_file) -> str: + in_file = relpath(in_file, ROOT_DIR) + out_text = "" + + with open(in_file) as file: + for idx, line in enumerate(file): + # Header guard + guard_match = GUARD_PATTERN.match(line.strip()) + if guard_match: + # At the beginning of the file = actually a header guard + if idx == 0: + if guard_match[1] in DEFINES: + break + DEFINES.add(guard_match[1]) + + # Sub-include + include_match = INCLUDE_PATTERN.match(line.strip()) + if include_match: + out_text += f'/* "{in_file}" line {idx} "{include_match[1]}" */\n' + out_text += import_h_file(include_match[1], dirname(in_file)) + out_text += f'/* end "{include_match[1]}" */\n' + # File text + else: + out_text += line + + return out_text + + +def import_c_file(in_file) -> str: + in_file = relpath(in_file, ROOT_DIR) + out_text = "" + + with open(in_file) as file: + for idx, line in enumerate(file): + # Sub-include + include_match = INCLUDE_PATTERN.match(line.strip()) + if include_match: + out_text += f'/* "{in_file}" line {idx} "{include_match[1]}" */\n' + out_text += import_h_file(include_match[1], dirname(in_file)) + out_text += f'/* end "{include_match[1]}" */\n' + + return out_text + + +main() diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/BPRegisters.json b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/BPRegisters.json new file mode 100644 index 0000000000..527a42fca4 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/BPRegisters.json @@ -0,0 +1,1431 @@ +{ + "module": "GX", + "name": "BP", + "long_name": "Blitting Processor", + "deps": [ + "revolution/GX/GXTypes.h" + ], + "regs": [ + { + "name": "GenMode", + "id": "0x00", + "fields": [ + { + "name": "numTex", + "desc": "Active texture count", + "start": 28, + "end": 31 + }, + { + "name": "numColors", + "desc": "Color/channel count", + "start": 25, + "end": 27 + }, + { + "name": "multisample", + "start": 22, + "end": 22 + }, + { + "name": "cullMode", + "start": 16, + "end": 17 + }, + { + "name": "numIndStages", + "start": 13, + "end": 15 + }, + { + "name": "coPlanar", + "desc": "Toggle co-planar (\"Z freeze\" according to Dolphin)", + "start": 12, + "end": 12 + } + ] + }, + { + "name": "DispCopyFilter0", + "id": "0x01" + }, + { + "name": "DispCopyFilter1", + "id": "0x02" + }, + { + "name": "DispCopyFilter2", + "id": "0x03" + }, + { + "name": "DispCopyFilter3", + "id": "0x04" + }, + { + "name": "IndMtxA", + "fields": [ + { + "name": "m00", + "desc": "Texture offset matrix #0 [0][0]", + "start": 21, + "end": 31 + }, + { + "name": "m10", + "desc": "Texture offset matrix #0 [1][0]", + "start": 10, + "end": 20 + }, + { + "name": "exp", + "desc": "Bits 0-1 of scaling exponent #0 (2^x)", + "start": 8, + "end": 9 + } + ] + }, + { + "name": "IndMtxB", + "fields": [ + { + "name": "m01", + "desc": "Texture offset matrix #0 [0][1]", + "start": 21, + "end": 31 + }, + { + "name": "m11", + "desc": "Texture offset matrix #0 [1][1]", + "start": 10, + "end": 20 + }, + { + "name": "exp", + "desc": "Bits 2-3 of scaling exponent #0 (2^x)", + "start": 8, + "end": 9 + } + ] + }, + { + "name": "IndMtxC", + "fields": [ + { + "name": "m02", + "desc": "Texture offset matrix #0 [0][2]", + "start": 21, + "end": 31 + }, + { + "name": "m12", + "desc": "Texture offset matrix #0 [1][2]", + "start": 10, + "end": 20 + }, + { + "name": "exp", + "desc": "Bit 4 of scaling exponent #0 (2^x)", + "start": 8, + "end": 9 + } + ] + }, + { + "name": "IndMtx0A", + "id": "0x06" + }, + { + "name": "IndMtx0B", + "id": "0x07" + }, + { + "name": "IndMtx0C", + "id": "0x08" + }, + { + "name": "IndMtx1A", + "id": "0x09" + }, + { + "name": "IndMtx1B", + "id": "0x0A" + }, + { + "name": "IndMtx1C", + "id": "0x0B" + }, + { + "name": "IndMtx2A", + "id": "0x0C" + }, + { + "name": "IndMtx2B", + "id": "0x0D" + }, + { + "name": "IndMtx2C", + "id": "0x0E" + }, + { + "name": "IndIMask", + "id": "0x0F", + "fields": [ + { + "name": "imask", + "desc": "Indirect mask for textures", + "start": 24, + "end": 31 + } + ] + }, + { + "name": "IndTevStage", + "fields": [ + { + "name": "stage", + "desc": "Indirect texture stage ID", + "start": 30, + "end": 31 + }, + { + "name": "format", + "desc": "Indirect texture format", + "start": 28, + "end": 29 + }, + { + "name": "bias", + "desc": "Indirect texture bias", + "start": 25, + "end": 27 + }, + { + "name": "alpha", + "desc": "Indirect texture alpha", + "start": 23, + "end": 24 + }, + { + "name": "mtx", + "desc": "Indirect texture matrix", + "start": 19, + "end": 22 + }, + { + "name": "wrapS", + "desc": "S component wrap factor", + "start": 16, + "end": 18 + }, + { + "name": "wrapT", + "desc": "T component wrap factor", + "start": 13, + "end": 15 + }, + { + "name": "utcLod", + "desc": "Whether to use unmodified texcoords for mipmaps", + "start": 12, + "end": 12 + }, + { + "name": "addPrev", + "desc": "Whether to add in results from previous tev stage", + "start": 11, + "end": 11 + } + ] + }, + { + "name": "IndTevStage0", + "id": "0x10" + }, + { + "name": "IndTevStage1", + "id": "0x11" + }, + { + "name": "IndTevStage2", + "id": "0x12" + }, + { + "name": "IndTevStage3", + "id": "0x13" + }, + { + "name": "IndTevStage4", + "id": "0x14" + }, + { + "name": "IndTevStage5", + "id": "0x15" + }, + { + "name": "IndTevStage6", + "id": "0x16" + }, + { + "name": "IndTevStage7", + "id": "0x17" + }, + { + "name": "IndTevStage8", + "id": "0x18" + }, + { + "name": "IndTevStage9", + "id": "0x19" + }, + { + "name": "IndTevStage10", + "id": "0x1A" + }, + { + "name": "IndTevStage11", + "id": "0x1B" + }, + { + "name": "IndTevStage12", + "id": "0x1C" + }, + { + "name": "IndTevStage13", + "id": "0x1D" + }, + { + "name": "IndTevStage14", + "id": "0x1E" + }, + { + "name": "IndTevStage15", + "id": "0x1F" + }, + { + "name": "scissorTL", + "id": "0x20", + "fields": [ + { + "name": "top", + "desc": "Top component", + "start": 21, + "end": 31 + }, + { + "name": "left", + "desc": "Left component", + "start": 9, + "end": 19 + } + ] + }, + { + "name": "scissorBR", + "id": "0x21", + "fields": [ + { + "name": "bot", + "desc": "Bottom component", + "start": 21, + "end": 31 + }, + { + "name": "right", + "desc": "Right component", + "start": 9, + "end": 19 + } + ] + }, + { + "name": "linePtWidth", + "id": "0x22", + "fields": [ + { + "name": "lineSz", + "desc": "Line size/width", + "start": 24, + "end": 31 + }, + { + "name": "pointSz", + "desc": "Point size", + "start": 16, + "end": 23 + }, + { + "name": "lineOfs", + "desc": "Line offset", + "start": 13, + "end": 15 + }, + { + "name": "pointOfs", + "desc": "Point offset", + "start": 10, + "end": 12 + }, + { + "name": "adjust_ar", + "desc": "Interlacing: adjust for pixels having aspect ratio of 1/2", + "start": 9, + "end": 9 + } + ] + }, + { + "name": "perf0Tri", + "id": "0x23" + }, + { + "name": "perf0Quad", + "id": "0x24" + }, + { + "name": "ras1_ss0", + "id": "0x25", + "fields": [ + { + "name": "s0", + "desc": "S-component scale (stage 0)", + "start": 28, + "end": 31 + }, + { + "name": "t0", + "desc": "T-component scale (stage 0)", + "start": 24, + "end": 27 + }, + { + "name": "s1", + "desc": "S-component scale (stage 1)", + "start": 20, + "end": 23 + }, + { + "name": "t1", + "desc": "T-component scale (stage 1)", + "start": 16, + "end": 19 + } + ] + }, + { + "name": "ras1_ss1", + "id": "0x26", + "fields": [ + { + "name": "s2", + "desc": "S-component scale (stage 2)", + "start": 28, + "end": 31 + }, + { + "name": "t2", + "desc": "T-component scale (stage 2)", + "start": 24, + "end": 27 + }, + { + "name": "s3", + "desc": "S-component scale (stage 3)", + "start": 20, + "end": 23 + }, + { + "name": "t3", + "desc": "T-component scale (stage 3)", + "start": 16, + "end": 19 + } + ] + }, + { + "name": "ras1_iref", + "id": "0x27", + "fields": [ + { + "name": "map0", + "desc": "Texmap id (stage 0)", + "start": 29, + "end": 31 + }, + { + "name": "txc0", + "desc": "Texcoord ID (stage 0)", + "start": 26, + "end": 28 + }, + { + "name": "map1", + "desc": "Texmap id (stage 1)", + "start": 23, + "end": 25 + }, + { + "name": "txc1", + "desc": "Texcoord ID (stage 1)", + "start": 20, + "end": 22 + }, + { + "name": "map2", + "desc": "Texmap id (stage 2)", + "start": 17, + "end": 19 + }, + { + "name": "txc2", + "desc": "Texcoord ID (stage 2)", + "start": 14, + "end": 16 + }, + { + "name": "map3", + "desc": "Texmap id (stage 3)", + "start": 11, + "end": 13 + }, + { + "name": "txc3", + "desc": "Texcoord ID (stage 3)", + "start": 8, + "end": 10 + } + ] + }, + { + "name": "ras1_tref0", + "id": "0x28" + }, + { + "name": "ras1_tref1", + "id": "0x29" + }, + { + "name": "ras1_tref2", + "id": "0x2A" + }, + { + "name": "ras1_tref3", + "id": "0x2B" + }, + { + "name": "ras1_tref4", + "id": "0x2C" + }, + { + "name": "ras1_tref5", + "id": "0x2D" + }, + { + "name": "ras1_tref6", + "id": "0x2E" + }, + { + "name": "ras1_tref7", + "id": "0x2F" + }, + { + "name": "su_ssize", + "fields": [ + { + "name": "useLineOfs", + "start": 13, + "end": 13 + }, + { + "name": "usePointOfs", + "start": 12, + "end": 12 + } + ] + }, + { + "name": "su_ssize0", + "id": "0x30" + }, + { + "name": "su_tsize0", + "id": "0x31" + }, + { + "name": "su_ssize1", + "id": "0x32" + }, + { + "name": "su_tsize1", + "id": "0x33" + }, + { + "name": "su_ssize2", + "id": "0x34" + }, + { + "name": "su_tsize2", + "id": "0x35" + }, + { + "name": "su_ssize3", + "id": "0x36" + }, + { + "name": "su_tsize3", + "id": "0x37" + }, + { + "name": "su_ssize4", + "id": "0x38" + }, + { + "name": "su_tsize4", + "id": "0x39" + }, + { + "name": "su_ssize5", + "id": "0x3A" + }, + { + "name": "su_tsize5", + "id": "0x3B" + }, + { + "name": "su_ssize6", + "id": "0x3C" + }, + { + "name": "su_tsize6", + "id": "0x3D" + }, + { + "name": "su_ssize7", + "id": "0x3E" + }, + { + "name": "su_tsize7", + "id": "0x3F" + }, + { + "name": "ZMode", + "id": "0x40", + "fields": [ + { + "name": "test_enable", + "start": 31, + "end": 31 + }, + { + "name": "compare", + "start": 28, + "end": 30 + }, + { + "name": "update_enable", + "start": 27, + "end": 27 + } + ] + }, + { + "name": "BlendMode", + "id": "0x41", + "fields": [ + { + "name": "blend_enable", + "start": 31, + "end": 31 + }, + { + "name": "logic_op_enable", + "start": 30, + "end": 30 + }, + { + "name": "dither", + "start": 29, + "end": 29 + }, + { + "name": "color_update", + "start": 28, + "end": 28 + }, + { + "name": "alpha_update", + "start": 27, + "end": 27 + }, + { + "name": "dst_factor", + "start": 24, + "end": 26 + }, + { + "name": "src_factor", + "start": 21, + "end": 23 + }, + { + "name": "subtract", + "start": 20, + "end": 20 + }, + { + "name": "logic_mode", + "start": 16, + "end": 19 + } + ] + }, + { + "name": "DstAlpha", + "id": "0x42", + "fields": [ + { + "name": "alpha", + "start": 24, + "end": 31 + }, + { + "name": "enable", + "start": 23, + "end": 23 + }, + { + "name": "yuv_fmt", + "start": 21, + "end": 22 + } + ] + }, + { + "name": "ZControl", + "id": "0x43", + "fields": [ + { + "name": "pixel_fmt", + "start": 29, + "end": 31 + }, + { + "name": "z_fmt", + "start": 26, + "end": 28 + }, + { + "name": "before_tex", + "desc": "Determines whether Z-buffering occurs before or after texturing", + "start": 25, + "end": 25 + } + ] + }, + { + "name": "FieldMask", + "id": "0x44", + "fields": [ + { + "name": "odd", + "desc": "Whether to write odd fields to the EFB", + "start": 31, + "end": 31 + }, + { + "name": "even", + "desc": "Whether to write even fields to the EFB", + "start": 30, + "end": 30 + } + ] + }, + { + "name": "DrawDone", + "id": "0x45" + }, + { + "name": "PEToken", + "id": "0x47" + }, + { + "name": "PETokenInt", + "id": "0x48" + }, + { + "name": "TexCopySrcXY", + "id": "0x49" + }, + { + "name": "TexCopySrcWH", + "id": "0x4A" + }, + { + "name": "TexCopyDst", + "id": "0x4B" + }, + { + "name": "DispCopyStride", + "id": "0x4D" + }, + { + "name": "DispCopyScaleY", + "id": "0x4E" + }, + { + "name": "CopyClearAR", + "id": "0x4F" + }, + { + "name": "CopyClearGB", + "id": "0x50" + }, + { + "name": "CopyClearZ", + "id": "0x51" + }, + { + "name": "CopyFilter0", + "id": "0x53" + }, + { + "name": "CopyFilter1", + "id": "0x54" + }, + { + "name": "BoundingBox0", + "id": "0x55" + }, + { + "name": "BoundingBox1", + "id": "0x56" + }, + { + "name": "ScissorOffset", + "id": "0x59", + "fields": [ + { + "name": "ox", + "start": 22, + "end": 31 + }, + { + "name": "oy", + "start": 12, + "end": 21 + } + ] + }, + { + "name": "TMemPreloadAddr", + "id": "0x60" + }, + { + "name": "TMemPreloadEven", + "id": "0x61" + }, + { + "name": "TMemPreloadOdd", + "id": "0x62" + }, + { + "name": "TMemPreloadMode", + "id": "0x63" + }, + { + "name": "TMemTlutSrc", + "id": "0x64" + }, + { + "name": "TMemTlutDst", + "id": "0x65" + }, + { + "name": "TMemTexInvalidate", + "id": "0x66" + }, + { + "name": "Perf1", + "id": "0x67" + }, + { + "name": "FieldMode", + "id": "0x68", + "fields": [ + { + "name": "tex_lod", + "desc": "Adjust vertex tex LOD computation to account for interlacing", + "start": 31, + "end": 31 + } + ] + }, + { + "name": "SetMode0_Tex0", + "id": "0x80" + }, + { + "name": "SetMode0_Tex1", + "id": "0x81" + }, + { + "name": "SetMode0_Tex2", + "id": "0x82" + }, + { + "name": "SetMode0_Tex3", + "id": "0x83" + }, + { + "name": "SetMode1_Tex0", + "id": "0x84" + }, + { + "name": "SetMode1_Tex1", + "id": "0x85" + }, + { + "name": "SetMode1_Tex2", + "id": "0x86" + }, + { + "name": "SetMode1_Tex3", + "id": "0x87" + }, + { + "name": "SetImage0_Tex0", + "id": "0x88" + }, + { + "name": "SetImage0_Tex1", + "id": "0x89" + }, + { + "name": "SetImage0_Tex2", + "id": "0x8A" + }, + { + "name": "SetImage0_Tex3", + "id": "0x8B" + }, + { + "name": "SetImage1_Tex0", + "id": "0x8C" + }, + { + "name": "SetImage1_Tex1", + "id": "0x8D" + }, + { + "name": "SetImage1_Tex2", + "id": "0x8E" + }, + { + "name": "SetImage1_Tex3", + "id": "0x8F" + }, + { + "name": "SetImage2_Tex0", + "id": "0x90" + }, + { + "name": "SetImage2_Tex1", + "id": "0x91" + }, + { + "name": "SetImage2_Tex2", + "id": "0x92" + }, + { + "name": "SetImage2_Tex3", + "id": "0x93" + }, + { + "name": "SetImage3_Tex0", + "id": "0x94" + }, + { + "name": "SetImage3_Tex1", + "id": "0x95" + }, + { + "name": "SetImage3_Tex2", + "id": "0x96" + }, + { + "name": "SetImage3_Tex3", + "id": "0x97" + }, + { + "name": "SetTlut_Tex0", + "id": "0x98" + }, + { + "name": "SetTlut_Tex1", + "id": "0x99" + }, + { + "name": "SetTlut_Tex2", + "id": "0x9A" + }, + { + "name": "SetTlut_Tex3", + "id": "0x9B" + }, + { + "name": "SetMode0_Tex4", + "id": "0xA0" + }, + { + "name": "SetMode0_Tex5", + "id": "0xA1" + }, + { + "name": "SetMode0_Tex6", + "id": "0xA2" + }, + { + "name": "SetMode0_Tex7", + "id": "0xA3" + }, + { + "name": "SetMode1_Tex4", + "id": "0xA4" + }, + { + "name": "SetMode1_Tex5", + "id": "0xA5" + }, + { + "name": "SetMode1_Tex6", + "id": "0xA6" + }, + { + "name": "SetMode1_Tex7", + "id": "0xA7" + }, + { + "name": "SetImage0_Tex4", + "id": "0xA8" + }, + { + "name": "SetImage0_Tex5", + "id": "0xA9" + }, + { + "name": "SetImage0_Tex6", + "id": "0xAA" + }, + { + "name": "SetImage0_Tex7", + "id": "0xAB" + }, + { + "name": "SetImage1_Tex4", + "id": "0xAC" + }, + { + "name": "SetImage1_Tex5", + "id": "0xAD" + }, + { + "name": "SetImage1_Tex6", + "id": "0xAE" + }, + { + "name": "SetImage1_Tex7", + "id": "0xAF" + }, + { + "name": "SetImage2_Tex4", + "id": "0xB0" + }, + { + "name": "SetImage2_Tex5", + "id": "0xB1" + }, + { + "name": "SetImage2_Tex6", + "id": "0xB2" + }, + { + "name": "SetImage2_Tex7", + "id": "0xB3" + }, + { + "name": "SetImage3_Tex4", + "id": "0xB4" + }, + { + "name": "SetImage3_Tex5", + "id": "0xB5" + }, + { + "name": "SetImage3_Tex6", + "id": "0xB6" + }, + { + "name": "SetImage3_Tex7", + "id": "0xB7" + }, + { + "name": "SetTlut_Tex4", + "id": "0xB8" + }, + { + "name": "SetTlut_Tex5", + "id": "0xB9" + }, + { + "name": "SetTlut_Tex6", + "id": "0xBA" + }, + { + "name": "SetTlut_Tex7", + "id": "0xBB" + }, + { + "name": "TevColorCombiner0", + "id": "0xC0" + }, + { + "name": "TevAlphaCombiner0", + "id": "0xC1" + }, + { + "name": "TevColorCombiner1", + "id": "0xC2" + }, + { + "name": "TevAlphaCombiner1", + "id": "0xC3" + }, + { + "name": "TevColorCombiner2", + "id": "0xC4" + }, + { + "name": "TevAlphaCombiner2", + "id": "0xC5" + }, + { + "name": "TevColorCombiner3", + "id": "0xC6" + }, + { + "name": "TevAlphaCombiner3", + "id": "0xC7" + }, + { + "name": "TevColorCombiner4", + "id": "0xC8" + }, + { + "name": "TevAlphaCombiner4", + "id": "0xC9" + }, + { + "name": "TevColorCombiner5", + "id": "0xCA" + }, + { + "name": "TevAlphaCombiner5", + "id": "0xCB" + }, + { + "name": "TevColorCombiner6", + "id": "0xCC" + }, + { + "name": "TevAlphaCombiner6", + "id": "0xCD" + }, + { + "name": "TevColorCombiner7", + "id": "0xCE" + }, + { + "name": "TevAlphaCombiner7", + "id": "0xCF" + }, + { + "name": "TevColorCombiner8", + "id": "0xD0" + }, + { + "name": "TevAlphaCombiner8", + "id": "0xD1" + }, + { + "name": "TevColorCombiner9", + "id": "0xD2" + }, + { + "name": "TevAlphaCombiner9", + "id": "0xD3" + }, + { + "name": "TevColorCombiner10", + "id": "0xD4" + }, + { + "name": "TevAlphaCombiner10", + "id": "0xD5" + }, + { + "name": "TevColorCombiner11", + "id": "0xD6" + }, + { + "name": "TevAlphaCombiner11", + "id": "0xD7" + }, + { + "name": "TevColorCombiner12", + "id": "0xD8" + }, + { + "name": "TevAlphaCombiner12", + "id": "0xD9" + }, + { + "name": "TevColorCombiner13", + "id": "0xDA" + }, + { + "name": "TevAlphaCombiner13", + "id": "0xDB" + }, + { + "name": "TevColorCombiner14", + "id": "0xDC" + }, + { + "name": "TevAlphaCombiner14", + "id": "0xDD" + }, + { + "name": "TevColorCombiner15", + "id": "0xDE" + }, + { + "name": "TevAlphaCombiner15", + "id": "0xDF" + }, + { + "name": "TevReg0Lo", + "id": "0xE0" + }, + { + "name": "TevReg0Hi", + "id": "0xE1" + }, + { + "name": "TevReg1Lo", + "id": "0xE2" + }, + { + "name": "TevReg1Hi", + "id": "0xE3" + }, + { + "name": "TevReg2Lo", + "id": "0xE4" + }, + { + "name": "TevReg2Hi", + "id": "0xE5" + }, + { + "name": "TevReg3Lo", + "id": "0xE6" + }, + { + "name": "TevReg3Hi", + "id": "0xE7" + }, + { + "name": "FogRange", + "id": "0xE8", + "fields": [ + { + "name": "center", + "start": 22, + "end": 31 + }, + { + "name": "enabled", + "start": 21, + "end": 21 + } + ] + }, + { + "name": "FogRangeK", + "fields": [ + { + "name": "hi", + "start": 20, + "end": 31 + }, + { + "name": "lo", + "start": 8, + "end": 19 + } + ] + }, + { + "name": "FogRangeK0", + "id": "0xE9" + }, + { + "name": "FogRangeK1", + "id": "0xEA" + }, + { + "name": "FogRangeK2", + "id": "0xEB" + }, + { + "name": "FogRangeK3", + "id": "0xEC" + }, + { + "name": "FogRangeK4", + "id": "0xED" + }, + { + "name": "FogParam0", + "id": "0xEE", + "fields": [ + { + "name": "a_mant", + "start": 21, + "end": 31 + }, + { + "name": "a_exp", + "start": 13, + "end": 20 + }, + { + "name": "a_sign", + "start": 12, + "end": 12 + } + ] + }, + { + "name": "FogParam1", + "id": "0xEF", + "fields": [ + { + "name": "b_mag", + "start": 8, + "end": 31 + } + ] + }, + { + "name": "FogParam2", + "id": "0xF0", + "fields": [ + { + "name": "b_shift", + "start": 27, + "end": 31 + } + ] + }, + { + "name": "FogParam3", + "id": "0xF1", + "fields": [ + { + "name": "c_mant", + "start": 21, + "end": 31 + }, + { + "name": "c_exp", + "start": 13, + "end": 20 + }, + { + "name": "c_sign", + "start": 12, + "end": 12 + }, + { + "name": "proj", + "start": 11, + "end": 11 + }, + { + "name": "fsel", + "start": 8, + "end": 10 + } + ] + }, + { + "name": "FogColor", + "id": "0xF2", + "fields": [ + { + "name": "rgb", + "start": 8, + "end": 31 + } + ] + }, + { + "name": "AlphaCompare", + "id": "0xF3" + }, + { + "name": "ZTexture0", + "id": "0xF4" + }, + { + "name": "ZTexture1", + "id": "0xF5" + }, + { + "name": "TevKSel0", + "id": "0xF6" + }, + { + "name": "TevKSel1", + "id": "0xF7" + }, + { + "name": "TevKSel2", + "id": "0xF8" + }, + { + "name": "TevKSel3", + "id": "0xF9" + }, + { + "name": "TevKSel4", + "id": "0xFA" + }, + { + "name": "TevKSel5", + "id": "0xFB" + }, + { + "name": "TevKSel6", + "id": "0xFC" + }, + { + "name": "TevKSel7", + "id": "0xFD" + }, + { + "name": "SSMask", + "id": "0xFE" + } + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/CPRegisters.json b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/CPRegisters.json new file mode 100644 index 0000000000..e6bc49d228 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/CPRegisters.json @@ -0,0 +1,400 @@ +{ + "module": "GX", + "name": "CP", + "long_name": "Command Processor", + "deps": [ + "revolution/GX/GXTypes.h" + ], + "regs": [ + { + "name": "MatrixIndexA", + "id": "0x30", + "fields": [ + { + "name": "geom", + "start": 26, + "end": 31 + }, + { + "name": "tex0", + "start": 20, + "end": 25 + }, + { + "name": "tex1", + "start": 14, + "end": 19 + }, + { + "name": "tex2", + "start": 8, + "end": 13 + }, + { + "name": "tex3", + "start": 2, + "end": 7 + } + ] + }, + { + "name": "MatrixIndexB", + "id": "0x40", + "fields": [ + { + "name": "tex4", + "start": 26, + "end": 31 + }, + { + "name": "tex5", + "start": 20, + "end": 25 + }, + { + "name": "tex6", + "start": 14, + "end": 19 + }, + { + "name": "tex7", + "start": 8, + "end": 13 + } + ] + }, + { + "name": "VCD_Lo", + "id": "0x50", + "fields": [ + { + "name": "posMatIdx", + "start": 31, + "end": 31 + }, + { + "name": "tex0MatIdx", + "start": 30, + "end": 30 + }, + { + "name": "tex1MatIdx", + "start": 29, + "end": 29 + }, + { + "name": "tex2MatIdx", + "start": 28, + "end": 28 + }, + { + "name": "tex3MatIdx", + "start": 27, + "end": 27 + }, + { + "name": "tex4MatIdx", + "start": 26, + "end": 26 + }, + { + "name": "tex5MatIdx", + "start": 25, + "end": 25 + }, + { + "name": "tex6MatIdx", + "start": 24, + "end": 24 + }, + { + "name": "tex7MatIdx", + "start": 23, + "end": 23 + }, + { + "name": "position", + "start": 21, + "end": 22 + }, + { + "name": "normal", + "start": 19, + "end": 20 + }, + { + "name": "colorDiffused", + "start": 17, + "end": 18 + }, + { + "name": "colorSpecular", + "start": 15, + "end": 16 + } + ] + }, + { + "name": "VCD_Hi", + "id": "0x60", + "fields": [ + { + "name": "tex0Coord", + "start": 30, + "end": 31 + }, + { + "name": "tex1Coord", + "start": 28, + "end": 29 + }, + { + "name": "tex2Coord", + "start": 26, + "end": 27 + }, + { + "name": "tex3Coord", + "start": 24, + "end": 25 + }, + { + "name": "tex4Coord", + "start": 22, + "end": 23 + }, + { + "name": "tex5Coord", + "start": 20, + "end": 21 + }, + { + "name": "tex6Coord", + "start": 18, + "end": 19 + }, + { + "name": "tex7Coord", + "start": 16, + "end": 17 + } + ] + }, + { + "name": "VAT_group0", + "id": "0x70", + "fields": [ + { + "name": "pos_cnt", + "start": 31, + "end": 31 + }, + { + "name": "pos_type", + "start": 28, + "end": 30 + }, + { + "name": "pos_shift", + "start": 23, + "end": 27 + }, + { + "name": "nrm_cnt", + "start": 22, + "end": 22 + }, + { + "name": "nrm_type", + "start": 19, + "end": 21 + }, + { + "name": "colordiff_cnt", + "start": 18, + "end": 18 + }, + { + "name": "colordiff_type", + "start": 15, + "end": 17 + }, + { + "name": "colorspec_cnt", + "start": 14, + "end": 14 + }, + { + "name": "colorspec_type", + "start": 11, + "end": 13 + }, + { + "name": "txc0_cnt", + "start": 10, + "end": 10 + }, + { + "name": "txc0_type", + "start": 7, + "end": 9 + }, + { + "name": "txc0_shift", + "start": 2, + "end": 6 + }, + { + "name": "byteDequant", + "start": 1, + "end": 1 + }, + { + "name": "normalIndex3", + "desc": "Input will be treated as three staggered indices (one per triple biased by component size) into normal table", + "start": 0, + "end": 0 + } + ] + }, + { + "name": "VAT_group1", + "id": "0x80", + "fields": [ + { + "name": "txc1_cnt", + "start": 31, + "end": 31 + }, + { + "name": "txc1_type", + "start": 28, + "end": 30 + }, + { + "name": "txc1_shift", + "start": 23, + "end": 27 + }, + { + "name": "txc2_cnt", + "start": 22, + "end": 22 + }, + { + "name": "txc2_type", + "start": 19, + "end": 21 + }, + { + "name": "txc2_shift", + "start": 14, + "end": 18 + }, + { + "name": "txc3_cnt", + "start": 13, + "end": 13 + }, + { + "name": "txc3_type", + "start": 10, + "end": 12 + }, + { + "name": "txc3_shift", + "start": 5, + "end": 9 + }, + { + "name": "txc4_cnt", + "start": 4, + "end": 4 + }, + { + "name": "txc4_type", + "start": 1, + "end": 3 + } + ] + }, + { + "name": "VAT_group2", + "id": "0x90", + "fields": [ + { + "name": "txc4_shift", + "start": 27, + "end": 31 + }, + { + "name": "txc5_cnt", + "start": 26, + "end": 26 + }, + { + "name": "txc5_type", + "start": 23, + "end": 25 + }, + { + "name": "txc5_shift", + "start": 18, + "end": 22 + }, + { + "name": "txc6_cnt", + "start": 17, + "end": 17 + }, + { + "name": "txc6_type", + "start": 14, + "end": 16 + }, + { + "name": "txc6_shift", + "start": 9, + "end": 13 + }, + { + "name": "txc7_cnt", + "start": 8, + "end": 8 + }, + { + "name": "txc7_type", + "start": 5, + "end": 7 + }, + { + "name": "txc7_shift", + "start": 0, + "end": 4 + } + ] + }, + { + "name": "ArrayBase", + "id": "0xA0", + "fields": [ + { + "name": "base", + "start": 6, + "end": 31 + } + ] + }, + { + "name": "ArrayStride", + "id": "0xB0", + "fields": [ + { + "name": "stride", + "start": 24, + "end": 31 + } + ] + } + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/XFRegisters.json b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/XFRegisters.json new file mode 100644 index 0000000000..fb57e6c669 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/XFRegisters.json @@ -0,0 +1,403 @@ +{ + "module": "GX", + "name": "XF", + "long_name": "Transform Unit", + "deps": [ + "revolution/GX/GXTypes.h" + ], + "regs": [ + { + "name": "Error", + "id": "0x1000" + }, + { + "name": "Diagnostics", + "id": "0x1001" + }, + { + "name": "State0", + "id": "0x1002" + }, + { + "name": "State1", + "id": "0x1003" + }, + { + "name": "Clock", + "id": "0x1004" + }, + { + "name": "ClipDisable", + "id": "0x1005", + "fields": [ + { + "name": "detect", + "desc": "Disable clipping detection", + "start": 31, + "end": 31 + }, + { + "name": "reject", + "desc": "Disable trivial rejection", + "start": 30, + "end": 30 + }, + { + "name": "accel", + "desc": "Disable cpoly clipping acceleration", + "start": 29, + "end": 29 + } + ] + }, + { + "name": "Perf0", + "id": "0x1006" + }, + { + "name": "Perf1", + "id": "0x1007", + "fields": [ + { + "name": "target", + "desc": "Target performance (Cycles/vertex)", + "start": 25, + "end": 31 + } + ] + }, + { + "name": "InVertexSpec", + "id": "0x1008", + "fields": [ + { + "name": "clr", + "start": 30, + "end": 31 + }, + { + "name": "nrm", + "start": 28, + "end": 29 + }, + { + "name": "txc", + "start": 24, + "end": 27 + } + ] + }, + { + "name": "NumColors", + "id": "0x1009" + }, + { + "name": "Ambient0", + "id": "0x100A" + }, + { + "name": "Ambient1", + "id": "0x100B" + }, + { + "name": "Material0", + "id": "0x100C" + }, + { + "name": "Material1", + "id": "0x100D" + }, + { + "name": "Color0Cntrl", + "id": "0x100E", + "fields": [ + { + "name": "matSrc", + "start": 31, + "end": 31 + }, + { + "name": "light", + "start": 30, + "end": 30 + }, + { + "name": "lmaskHi", + "start": 26, + "end": 29 + }, + { + "name": "ambSrc", + "start": 25, + "end": 25 + }, + { + "name": "diffuseAttn", + "start": 23, + "end": 24 + }, + { + "name": "attnEnable", + "start": 22, + "end": 22 + }, + { + "name": "attnSelect", + "start": 21, + "end": 21 + }, + { + "name": "lmaskLo", + "start": 17, + "end": 20 + } + ] + }, + { + "name": "Color1Cntrl", + "id": "0x100F" + }, + { + "name": "Alpha0Cntrl", + "id": "0x1010" + }, + { + "name": "Alpha1Cntrl", + "id": "0x1011" + }, + { + "name": "DualTexTran", + "id": "0x1012" + }, + { + "name": "MatrixIndex0", + "id": "0x1018", + "fields": [ + { + "name": "geom", + "start": 26, + "end": 31 + }, + { + "name": "tex0", + "start": 20, + "end": 25 + }, + { + "name": "tex1", + "start": 14, + "end": 19 + }, + { + "name": "tex2", + "start": 8, + "end": 13 + }, + { + "name": "tex3", + "start": 2, + "end": 7 + } + ] + }, + { + "name": "MatrixIndex1", + "id": "0x1019", + "fields": [ + { + "name": "tex4", + "start": 26, + "end": 31 + }, + { + "name": "tex5", + "start": 20, + "end": 25 + }, + { + "name": "tex6", + "start": 14, + "end": 19 + }, + { + "name": "tex7", + "start": 8, + "end": 13 + } + ] + }, + { + "name": "ScaleX", + "id": "0x101A" + }, + { + "name": "ScaleY", + "id": "0x101B" + }, + { + "name": "ScaleZ", + "id": "0x101C" + }, + { + "name": "OffsetX", + "id": "0x101D" + }, + { + "name": "OffsetY", + "id": "0x101E" + }, + { + "name": "OffsetZ", + "id": "0x101F" + }, + { + "name": "ProjectionA", + "id": "0x1020" + }, + { + "name": "ProjectionB", + "id": "0x1021" + }, + { + "name": "ProjectionC", + "id": "0x1022" + }, + { + "name": "ProjectionD", + "id": "0x1023" + }, + { + "name": "ProjectionE", + "id": "0x1024" + }, + { + "name": "ProjectionF", + "id": "0x1025" + }, + { + "name": "ProjectOrtho", + "desc": "If set selects orthographic otherwise non-orthographic (Zh or 1.0 select)", + "id": "0x1026" + }, + { + "name": "NumTex", + "id": "0x103F" + }, + { + "name": "Tex", + "fields": [ + { + "name": "projType", + "start": 30, + "end": 30 + }, + { + "name": "inputForm", + "start": 29, + "end": 29 + }, + { + "name": "texgenType", + "start": 25, + "end": 27 + }, + { + "name": "srcRow", + "start": 20, + "end": 24 + }, + { + "name": "bumpSrcTex", + "start": 17, + "end": 19 + }, + { + "name": "bumpSrcLight", + "start": 14, + "end": 16 + } + ] + }, + { + "name": "Tex0", + "id": "0x1040" + }, + { + "name": "Tex1", + "id": "0x1041" + }, + { + "name": "Tex2", + "id": "0x1042" + }, + { + "name": "Tex3", + "id": "0x1043" + }, + { + "name": "Tex4", + "id": "0x1044" + }, + { + "name": "Tex5", + "id": "0x1045" + }, + { + "name": "Tex6", + "id": "0x1046" + }, + { + "name": "Tex7", + "id": "0x1047" + }, + { + "name": "DualTex", + "fields": [ + { + "name": "baseRow", + "desc": "Indicates which is the base row of the transform matrix", + "start": 26, + "end": 31 + }, + { + "name": "normalize", + "desc": "Normalize texcoord before sending transform", + "start": 23, + "end": 23 + } + ] + }, + { + "name": "DualTex0", + "id": "0x1050" + }, + { + "name": "DualTex1", + "id": "0x1051" + }, + { + "name": "DualTex2", + "id": "0x1052" + }, + { + "name": "DualTex3", + "id": "0x1053" + }, + { + "name": "DualTex4", + "id": "0x1054" + }, + { + "name": "DualTex5", + "id": "0x1055" + }, + { + "name": "DualTex6", + "id": "0x1056" + }, + { + "name": "DualTex7", + "id": "0x1057" + } + ] +} diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/makeregs.py b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/makeregs.py new file mode 100644 index 0000000000..f6e29d1bbc --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/makeregs/makeregs.py @@ -0,0 +1,222 @@ +from sys import argv +from argparse import ArgumentParser +from json import loads + + +class Field: + def __init__(self, res): + self.name = get_req(res, "name") + self.desc = res.get("desc") # Description is optional + self.start = get_req(res, "start") + self.end = get_req(res, "end") + + # Sanity check on bounds + if not isinstance(self.start, int) or not isinstance(self.end, int): + raise Exception( + f"[FATAL] Bitfield {self.name} has non-integral bounds: [{self.start}, {self.end}]") + + assert self.start <= self.end, "Bitfield has inverted bounds" + + # +1 for inclusive + self.size = self.end - self.start + 1 + + +class Register: + def __init__(self, res): + self.name = get_req(res, "name") + self.id = res.get("id", "-1") + + # Sanity check on id + try: + self.id = int(self.id, base=0) + except ValueError: + raise Exception( + f"[FATAL] Register {self.name} has invalid ID: {self.id}") + + # "fields" tag is optional, omit if currently empty/todo + self.fields = [Field(f) for f in res.get("fields", [])] + + +def get_req(res, name): + if name not in res: + raise Exception(f"[FATAL] {res.__name__} missing key {name}") + return res[name] + + +def enum_case(name): + new_name = "" + + for c in name: + if c.isalpha(): + new_name += c.upper() + elif c.isnumeric(): + new_name += c + else: + new_name += "_" + + return new_name + + +def load_regs_json(args): + # When not specified, output path is derived from the input path + if args.output == None: + args.output = args.input.replace(".json", ".h") + print(f"[INFO] Output file path not specified, using {args.output}") + + # Read JSON file + try: + with open(args.input, "r") as f: + res = loads(f.read()) + except OSError: + print(f"[FATAL] Could not open JSON file for reading: {args.input}") + return + + # Register info + write_regs_header(args, res, [ + Register(r) for r in get_req(res, "regs")]) + + +def write_regs_header(args, res, regs): + # Main context + module = get_req(res, "module") + name = get_req(res, "name") + long_name = get_req(res, "long_name") + + # Output stream + try: + with open(args.output, "w+") as f: + # Open header guard + f.write( + f"#ifndef RVL_SDK_{module.upper()}_HARDWARE_{name.upper()}_H\n") + f.write( + f"#define RVL_SDK_{module.upper()}_HARDWARE_{name.upper()}_H\n") + + # Include dependencies + for dep in res.get("deps", []): + if dep != "revolution/types.h": + f.write(f"#include <{dep}>\n") + + # Main RVL types header + f.write("#include \n") + + # C++ guard + f.write("#ifdef __cplusplus\n") + f.write("extern \"C\" {\n") + f.write("#endif\n") + + f.write("\n") + + # Begin comment + f.write( + "/******************************************************************************\n") + f.write(" *\n") + f.write(" *\n") + f.write(f" * {module} {long_name} ({name})\n") + f.write(" *\n") + f.write(" *\n") + f.write( + " *****************************************************************************/\n") + + f.write("\n") + + # Register enum comment + f.write("/**\n") + f.write(f" * {name} registers\n") + f.write(" */\n") + + # Register enum + enum_prefix = f"{module.upper()}_{name.upper()}_REG_" + f.write("typedef enum {\n") + for reg in regs: + # Not "real" register (some are used as generic structure definitions) + if reg.id == -1: + continue + + f.write( + f" {enum_case(enum_prefix + reg.name)} = 0x{hex(reg.id)[2:].upper()},\n") + f.write(f"}} {module.upper()}_{name.upper()}_REG;\n") + + f.write("\n") + + # Register field macros + for reg in regs: + # No fields defined for the register + if len(reg.fields) == 0: + continue + + cased_reg = enum_case(reg.name) + + f.write("/**\n") + + if reg.id != -1: + f.write( + f" * {name} register 0x{hex(reg.id)[2:].upper()} - {reg.name}\n") + else: + f.write( + f" * {name} structure - {reg.name}\n") + + f.write(" */\n") + + for field in reg.fields: + cased_field = enum_case(field.name) + + # Field comment + f.write( + f"// {cased_field} [{field.start}:{field.end}] ({field.size})") + if field.desc != None: + f.write(f" - {field.desc}") + f.write("\n") + + macro_prefix = f"{module.upper()}_{name.upper()}" + + # Start/end/size macros for manual use + f.write( + f"#define {macro_prefix}_{cased_reg}_{cased_field}_ST {field.start}\n") + f.write( + f"#define {macro_prefix}_{cased_reg}_{cased_field}_END {field.end}\n") + f.write( + f"#define {macro_prefix}_{cased_reg}_{cased_field}_SZ {field.size}\n") + + # Mask macro for manual use + f.write( + f"#define {macro_prefix}_{cased_reg}_{cased_field}_MASK (((1 << {field.size}) - 1) << 31 - {field.end})\n") + + # Field GET macro + f.write( + f"#define {macro_prefix}_GET_{cased_reg}_{cased_field}(reg) ") + f.write( + f"GX_BITGET(reg, {field.start}, {field.size})\n") + + # Field SET macro + f.write( + f"#define {macro_prefix}_SET_{cased_reg}_{cased_field}(reg, x) ") + f.write( + f"((reg) = GX_BITSET(reg, {field.start}, {field.size}, x))\n") + + f.write("\n") + f.write("\n") + + # Close C++ guard + f.write("#ifdef __cplusplus\n") + f.write("}\n") + f.write("#endif\n") + + # Close header guard + f.write("#endif") + except OSError: + print(f"[FATAL] Failed to open header file for writing: {args.output}") + return + + +def main(): + parser = ArgumentParser() + parser.add_argument("input", nargs="?", type=str, + help="JSON file containing register information") + parser.add_argument("output", nargs="?", type=str, + help="C header file output path (optional)") + args = parser.parse_args(argv[1:]) + + load_regs_json(args) + + +main() diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/include/macros.inc b/include/lib/BrawlHeaders/OpenRVL/tools/tester/include/macros.inc new file mode 100644 index 0000000000..4ff239daee --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/include/macros.inc @@ -0,0 +1,91 @@ +# Macros for emitting proper object file info +# Written by encounter +.macro fn visibility name +.\visibility \name +.type \name, @function +\name: +.endm + +.macro obj visibility name +.\visibility \name +.type \name, @object +\name: +.endm + +.macro end name +.size \name, . - \name +.endm + +# Register macros +.set r0, 0 +.set r1, 1 +.set r2, 2 +.set r3, 3 +.set r4, 4 +.set r5, 5 +.set r6, 6 +.set r7, 7 +.set r8, 8 +.set r9, 9 +.set r10, 10 +.set r11, 11 +.set r12, 12 +.set r13, 13 +.set r14, 14 +.set r15, 15 +.set r16, 16 +.set r17, 17 +.set r18, 18 +.set r19, 19 +.set r20, 20 +.set r21, 21 +.set r22, 22 +.set r23, 23 +.set r24, 24 +.set r25, 25 +.set r26, 26 +.set r27, 27 +.set r28, 28 +.set r29, 29 +.set r30, 30 +.set r31, 31 +.set f0, 0 +.set f1, 1 +.set f2, 2 +.set f3, 3 +.set f4, 4 +.set f5, 5 +.set f6, 6 +.set f7, 7 +.set f8, 8 +.set f9, 9 +.set f10, 10 +.set f11, 11 +.set f12, 12 +.set f13, 13 +.set f14, 14 +.set f15, 15 +.set f16, 16 +.set f17, 17 +.set f18, 18 +.set f19, 19 +.set f20, 20 +.set f21, 21 +.set f22, 22 +.set f23, 23 +.set f24, 24 +.set f25, 25 +.set f26, 26 +.set f27, 27 +.set f28, 28 +.set f29, 29 +.set f30, 30 +.set f31, 31 +.set qr0, 0 +.set qr1, 1 +.set qr2, 2 +.set qr3, 3 +.set qr4, 4 +.set qr5, 5 +.set qr6, 6 +.set qr7, 7 diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/elf.py b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/elf.py new file mode 100644 index 0000000000..117e229f7d --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/elf.py @@ -0,0 +1,326 @@ +"""Minimal ELF implementation to extract information required for testing. +""" + +from dataclasses import dataclass +from typing import List, Dict + +from .stream import InputStream + + +@dataclass +class ELFSection(): + name: str + data: bytearray + symbol_list: "List[ELFSymbol]" + symbol_dict: "Dict[str, ELFSymbol]" + + sh_name: int + sh_type: int + sh_flags: int + sh_addr: int + sh_offset: int + sh_size: int + sh_link: int + sh_info: int + sh_addralign: int + sh_entsize: int + + CODE_SECTIONS = [".init", ".text"] + DATA_SECTIONS = [".ctors", ".dtors", + ".rodata", ".data", ".bss", ".sdata", ".sbss", ".sdata2", ".sbss2"] + BSS_SECTIONS = [".bss", ".sbss", ".sbss2"] + ALL_SECTIONS = [".init", ".text", ".ctors", ".dtors", + ".rodata", ".data", ".bss", ".sdata", ".sbss", ".sdata2", ".sbss2"] + + def __init__(self, strm: InputStream): + """Parse ELF section header from stream + """ + assert not strm.eof() + + # Manually set later + self.name = "NoName" + self.data = None + self.symbol_list = list() + self.symbol_dict = dict() + + self.sh_name = strm.get_u32() + self.sh_type = strm.get_u32() + self.sh_flags = strm.get_u32() + self.sh_addr = strm.get_u32() + self.sh_offset = strm.get_u32() + self.sh_size = strm.get_u32() + self.sh_link = strm.get_u32() + self.sh_info = strm.get_u32() + self.sh_addralign = strm.get_u32() + self.sh_entsize = strm.get_u32() + + # TODO: Actually fix BSS + try: + # Read section data + if self.sh_size > 0: + strm.seek(self.sh_offset, InputStream.SEEK_BEGIN) + self.data = strm.read(self.sh_size) + except Exception: + self.data = bytearray(self.sh_size) + + def all_symbols(self) -> "List[ELFSymbol]": + """Access all ELF symbols in section + """ + return self.symbol_list + + def symbol(self, name: str) -> "ELFSymbol": + """Access ELF symbol by name + """ + return self.symbol_dict.get(name, None) + + def is_code(self) -> bool: + """Check if this section contains code + """ + return self.name in self.CODE_SECTIONS + + def is_data(self) -> bool: + """Check if this section contains data + """ + return self.name in self.DATA_SECTIONS + + def is_bss(self) -> bool: + """Check if this section contains zero-initialized data + """ + return self.name in self.BSS_SECTIONS + + +@dataclass +class ELFSymbol(): + name: str + data: bytearray + parent: ELFSection + + st_name: int + st_value: int + st_size: int + st_info: int + st_other: int + st_shndx: int + + STT_OBJECT = 1 + STT_FUNC = 2 + + def __init__(self, strm: InputStream): + """Parse ELF symbol (.symtab entry) from stream. + NOTE: Symbol data is not read here, because some symbols + need their sizes corrected first. + """ + assert not strm.eof() + + # Manually set later + self.name = "NoName" + self.data = None + self.parent = None + + self.st_name = strm.get_u32() + self.st_value = strm.get_u32() + + # NOTE: Most symbols have zero size for some reason. + # We calculate the size later in the parent ELFFile (if needed) + self.st_size = strm.get_u32() + + self.st_info = strm.get_u8() + self.st_other = strm.get_u8() + self.st_shndx = strm.get_u16() + + +@dataclass +class ELFHeader(): + ei_mag: str + ei_class: int + ei_data: int + ei_version: int + ei_osabi: int + ei_abiversion: int + e_type: int + e_machine: int + e_version: int + e_entry: int + e_phoff: int + e_shoff: int + e_flags: int + e_ehsize: int + e_phentsize: int + e_phnum: int + e_shentsize: int + e_shnum: int + e_shstrndx: int + + E_CLASS_32 = 1 + E_DATA_BE = 2 + E_MACHINE_PPC = 0x14 + + def __init__(self, strm: InputStream): + """Parse ELF file header from stream + """ + assert not strm.eof() + + self.ei_mag = strm.get_string_sz(4) + self.ei_class = strm.get_u8() + self.ei_data = strm.get_u8() + self.ei_version = strm.get_u8() + self.ei_osabi = strm.get_u8() + self.ei_abiversion = strm.get_u8() + + # Skip padding + strm.read(7) + + self.e_type = strm.get_u16() + self.e_machine = strm.get_u16() + self.e_version = strm.get_u32() + self.e_entry = strm.get_u32() + self.e_phoff = strm.get_u32() + self.e_shoff = strm.get_u32() + self.e_flags = strm.get_u32() + self.e_ehsize = strm.get_u16() + self.e_phentsize = strm.get_u16() + self.e_phnum = strm.get_u16() + self.e_shentsize = strm.get_u16() + self.e_shnum = strm.get_u16() + self.e_shstrndx = strm.get_u16() + + def is_valid(self) -> bool: + """Confirm that the ELF header is of the type + expected by this tool (32-bit, PowerPC, Big Endian) + """ + if self.ei_mag != "\x7FELF": + return False + + if self.ei_class != self.E_CLASS_32: + return False + + if self.ei_data != self.E_DATA_BE: + return False + + if self.e_machine != self.E_MACHINE_PPC: + return False + + return self.e_shnum > 0 + + +def sym_sort_key_func(sym: ELFSymbol): + """Sort key for symbol list. + Because we dynamically calculate the size of GAS symbols, + we first need to sort the symbols by their offset. + """ + return sym.st_value + + +@dataclass +class ELFFile(): + header: ELFHeader + section_list: List[ELFSection] + section_dict: Dict[str, ELFSection] + + def __init__(self, strm: InputStream): + """Parse ELF file + """ + assert not strm.eof() + + # File header + self.header = ELFHeader(strm) + assert self.header.is_valid(), "Invalid ELF header" + + # Section headers + self.section_list = list() + for i in range(self.header.e_shnum): + # Seek to section + strm.seek(self.header.e_shoff + + (i * self.header.e_shentsize), InputStream.SEEK_BEGIN) + # Append section to list + self.section_list.append(ELFSection(strm)) + + # Fixup section names using the string table + self.section_dict = dict() + for sect in self.section_list: + sect.name = self.__get_shstrtab_name(sect.sh_name) + # Insert section into dictionary + if sect.name != "": + assert sect.name not in self.section_dict, "Duplicate section?" + self.section_dict[sect.name] = sect + + # Open stream to .symtab data + sh_symtab = self.section_dict[".symtab"] + symtab = InputStream(sh_symtab.data, InputStream.ENDIAN_BIG) + # Parse symbol table data + for i in range(sh_symtab.sh_size // sh_symtab.sh_entsize): + symbol = ELFSymbol(symtab) + # Set parent section (if not special section) + if symbol.st_shndx < self.header.e_shnum: + symbol.parent = self.section_list[symbol.st_shndx] + symbol.parent.symbol_list.append(symbol) + + # Second pass through symbols. + # Here we do the following: + # 1. Apply symbol names from .strtab + # 2. Calculate size of symbols where size=0 + # 3. Read symbol data from stream + for sect in self.section_list: + # Sort symbol list by offset to ensure + # sizes calculated later are correct + sect.symbol_list.sort(key=sym_sort_key_func) + + for i, sym in enumerate(sect.symbol_list): + # Apply symbol name + sym.name = self.__get_strtab_name(sym.st_name) + if sym.name == "": + sym.name = sect.name + + # Store symbol in parent dictionary + if sym.st_shndx < self.header.e_shnum: + sym.parent = self.section_list[sym.st_shndx] + sym.parent.symbol_dict[sym.name] = sym + + # Only read data if there is data to read :) + if sect.data != None: + # Calculate symbol size if it was read as zero + if sym.st_size == 0: + if i + 1 < len(sect.symbol_list): + sym.st_size = sect.symbol_list[i + + 1].st_value - sym.st_value + else: + sym.st_size = sect.sh_size - sym.st_value + + # Read symbol data + if sym.st_size > 0: + # Zero-initialized data + if sect.is_bss(): + sym.data = bytearray(sym.st_size) + else: + strm.seek(sect.sh_offset, InputStream.SEEK_BEGIN) + strm.seek(sym.st_value, InputStream.SEEK_CURRENT) + sym.data = strm.read(sym.st_size) + + def all_sections(self) -> List[ELFSection]: + """Access all ELF sections in file + """ + # Skip UNDEF section + return [x for x in self.section_list if x.name != ""] + + def section(self, name: str) -> ELFSection: + """Access ELF section by name + """ + return self.section_dict.get(name, None) + + def __get_strtab_name(self, ofs: int) -> str: + """Get name from .strtab section, given an offset + """ + assert ".strtab" in self.section_dict, ".strtab section missing?" + strm = InputStream( + self.section_dict[".strtab"].data, InputStream.ENDIAN_BIG) + strm.seek(ofs, InputStream.SEEK_BEGIN) + return strm.get_string() + + def __get_shstrtab_name(self, ofs: int) -> str: + """Get name from .shstrtab section, given an offset + """ + assert self.header.e_shstrndx != -1, ".shstrtab section missing?" + strm = InputStream( + self.section_list[self.header.e_shstrndx].data, InputStream.ENDIAN_BIG) + strm.seek(ofs, InputStream.SEEK_BEGIN) + return strm.get_string() diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/fixer.py b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/fixer.py new file mode 100644 index 0000000000..cad36d6a15 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/fixer.py @@ -0,0 +1,140 @@ +"""Fixes assembly to conform with what the GNU assembler expects. +Used to properly emit symbol type/size in the object file.""" + +from dataclasses import dataclass +from typing import List +from re import match + + +@dataclass() +class Fixer(): + __curr_sect: str + __curr_sym: str + __asm: List[str] + + SECTION_REGEX = r"^\s*.section\s+(?P.[a-zA-Z0-9_$]+)" + LABEL_REGEX = r"^\s*(?P[0-9a-zA-Z_!@#$]+)\s*\:" + GLABEL_REGEX = r"^\s*.global\s*(\")*(?P[0-9A-Za-z_$@()#$]+)" + ADDI_REGEX = r"^\/\*.+\*\/\s+addi\s+(?Pr[0-9]+),\s+(r13)*(r2)*,\s+(?P[a-zA-Z0-9_@$#]+)@sda21" + FUNC_REGEX = r"(?P^\w+):" + BRANCH_REGEX = r"^\/\*.+\*\/\s+(?Pb[+-]?|bne[+-]?|beq[+-]?|bgt[+-]?|blt[+-]?|bge[+-]?|ble[+-]?|bl[+-]?|bdnz[+-]?)\s+(?P\w+\,\s*)?(?P[0-9a-zA-Z_]+)" + + def __init__(self): + self.__curr_sect = None + self.__curr_sym = None + self.__asm = [] + + def fix(self, asm: List[str]) -> List[str]: + self.__asm = [] + + for i, line in enumerate(asm): + # Replace tabs with spaces + line = line.replace("\t", " ") + + sect_match = match(self.SECTION_REGEX, line) + glabel_match = match(self.GLABEL_REGEX, line) + label_match = match(self.LABEL_REGEX, line) + + # Entered a new section + if sect_match != None: + sect_name = sect_match.group("Name") + self.begin_section(sect_name) + self.__asm.append(line) + + # Entered a new global symbol + elif glabel_match != None: + glabel_name = glabel_match.group("Name") + self.begin_symbol(glabel_name) + + # Entered a new symbol + elif label_match != None: + label_name = label_match.group("Name") + # Is it local? + if i > 0 and match(self.GLABEL_REGEX, asm[i - 1]) == None: + # Convert function local label + if self.__curr_sect == ".text" and label_name.startswith("lbl_"): + self.proc_fn_local_lbl(label_name) + # Not fn-local, make it global + else: + self.begin_symbol(label_name) + + # Looking at an instruction? + elif line.startswith("/*"): + self.proc_insn(line) + + # This line does not matter + else: + self.__asm.append(line) + + # End last symbol + self.end_symbol() + return self.__asm + + def begin_section(self, sect: str): + """Begin a new section + """ + self.end_symbol() + self.__curr_sect = sect + + def begin_symbol(self, sym: str): + """Begin a new symbol + """ + self.end_symbol() + self.__curr_sym = sym + + if self.__curr_sect == ".text": + self.__asm.append(f"fn global {self.__curr_sym}\n") + else: + self.__asm.append(f"obj global {self.__curr_sym}\n") + + def end_symbol(self): + """End the current symbol + """ + if self.__curr_sym != None: + # Remove trailing newline + if self.__asm[-1] == "\n": + self.__asm.pop() + self.__asm.append(f"end {self.__curr_sym}\n\n") + self.__curr_sym = None + + def proc_fn_local_lbl(self, lbl: str): + """Convert doldisasm-format local label (lbl_*) + to what GAS expects (.L_*) + """ + self.__asm.append(f"{lbl.replace('lbl_', '.L_')}:\n") + pass + + def proc_insn(self, line: str): + """Fix instruction. + This entails fixing SDA/label relocations and + replacing SDA addi accesses with li accesses. + """ + # Fix SDA relocations + line = line.replace("-_SDA_BASE_", "@sda21") + line = line.replace("-_SDA2_BASE_", "@sda21") + line = line.replace("@sda21(r13)", "@sda21(0)") + line = line.replace("@sda21(r2)", "@sda21(0)") + + addi_match = match(self.ADDI_REGEX, line) + branch_match = match(self.BRANCH_REGEX, line) + + # Convert GAS addi -> CW li + if addi_match != None: + # Insn operands + dst = addi_match.group("dst") + sym = addi_match.group("sym") + line = f"li {dst}, {sym}@sda21\n" + + # Patch local branch destination + elif branch_match != None: + insn = branch_match.group("insn") + cr = branch_match.group("cr") + dst = branch_match.group("dst") + + if cr == None: + cr = "" + + if insn != "bl" and dst.startswith("lbl_"): + line = f"{insn} {cr} {dst.replace('lbl_', '.L_')}\n" + + self.__asm.append(line) diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/hasher.py b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/hasher.py new file mode 100644 index 0000000000..23dc216834 --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/hasher.py @@ -0,0 +1,24 @@ +"""Utilities for hashing ELF code/data +""" + +from dataclasses import dataclass +from hashlib import sha256 + +from .elf import ELFSymbol + + +@dataclass +class Hasher(): + def hash_symbol(self, sym: ELFSymbol): + """Calculate hash of ELF symbol + """ + if sym.data == None: + return None + return self.__hash_data(sym.data) + + def __hash_data(self, data: bytearray) -> bytes: + """Calculate hash of ELF data + """ + sha = sha256() + sha.update(data) + return sha.digest() diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/stream.py b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/stream.py new file mode 100644 index 0000000000..c18c0ab17b --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/src/stream.py @@ -0,0 +1,112 @@ +"""Input file stream with configurable endianness (byteorder). + """ + +from dataclasses import dataclass + + +@dataclass +class InputStream(): + endian: int + pos: int + _size: int + data: bytes + + # Endianness + ENDIAN_LITTLE = 0 + ENDIAN_BIG = 1 + ENDIAN_MAX = 2 + + # Seek type + SEEK_BEGIN = 0 + SEEK_CURRENT = 1 + SEEK_END = 2 + SEEK_MAX = 3 + + def __init__(self, _data: bytes, _endian: int): + """Constructor + _data (bytes): File data + _endian (int): Target endianness (ENDIAN_LITTLE / ENDIAN_BIG) + """ + assert _endian >= InputStream.ENDIAN_LITTLE and _endian < InputStream.ENDIAN_MAX + self.endian = _endian + self.pos = 0 + self._size = len(_data) + self.data = _data + + @staticmethod + def open_file(path: str, _endian: int) -> "InputStream": + """Construct an input stream for the file at the specified path, + using the specified endianness.""" + with open(path, "rb") as f: + return InputStream(f.read(), _endian) + + def eof(self) -> bool: + """Check if the stream has hit the end of the file.""" + return self.pos >= len(self.data) + + def read(self, size: int) -> bytearray: + """Read bytes from the stream.""" + assert self.pos + size <= len(self.data) + data = self.data[self.pos: self.pos + size] + self.pos += size + return data + + def seek(self, ofs: int, whence: int): + """Seek the stream position.""" + if whence == InputStream.SEEK_BEGIN: + self.pos = ofs + elif whence == InputStream.SEEK_CURRENT: + self.pos = self.pos + ofs + elif whence == InputStream.SEEK_END: + self.pos = self._size - ofs + else: + assert False, "Invalid seek whence" + # Clamp position to before EOF + self.pos = min(self.pos, self._size - 1) + + def get_s8(self) -> int: + """Read a signed 8-bit integer from the stream.""" + return self._from_bytes(self.read(1), True) + + def get_u8(self) -> int: + """Read an unsigned 8-bit integer from the stream.""" + return self._from_bytes(self.read(1), False) + + def get_s16(self) -> int: + """Read a signed 16-bit integer from the stream.""" + return self._from_bytes(self.read(2), True) + + def get_u16(self) -> int: + """Read an unsigned 16-bit integer from the stream.""" + return self._from_bytes(self.read(2), False) + + def get_s32(self) -> int: + """Read a signed 32-bit integer from the stream.""" + return self._from_bytes(self.read(4), True) + + def get_u32(self) -> int: + """Read an unsigned 32-bit integer from the stream.""" + return self._from_bytes(self.read(4), False) + + def get_string(self) -> str: + """Read a string from the stream.""" + string = "" + c = self.get_s8() + while c != 0x00: + string += chr(c) + c = self.get_s8() + return string + + def get_string_sz(self, sz: int) -> str: + """Read a string of size 'sz' from the stream.""" + string = "" + while sz > 0: + c = self.get_s8() + string += chr(c) + sz -= 1 + return string + + def _from_bytes(self, data: bytes, _signed: bool) -> int: + """Convert bytes from the stream into an integer""" + endian_str = ("little", "big")[self.endian] + return int.from_bytes(data, byteorder=endian_str, signed=_signed) diff --git a/include/lib/BrawlHeaders/OpenRVL/tools/tester/tester.py b/include/lib/BrawlHeaders/OpenRVL/tools/tester/tester.py new file mode 100644 index 0000000000..54414a69db --- /dev/null +++ b/include/lib/BrawlHeaders/OpenRVL/tools/tester/tester.py @@ -0,0 +1,252 @@ +from sys import argv +from os import remove, walk +from os.path import exists, isdir, join +from json import loads, dumps +from subprocess import run, PIPE +from argparse import ArgumentParser + +from src.elf import ELFFile, ELFSection +from src.stream import InputStream +from src.hasher import Hasher +from src.fixer import Fixer + +# Can be overridden per unit test +DEFAULT_CC_ARCH = "GC" +DEFAULT_CC_VERSION = "3.0a5.2" +DEFAULT_CFLAGS = "-msgstyle gcc -lang c -enum int -inline auto -ipa file -Cpp_exceptions off -RTTI off -proc gekko -fp hard -I- -Iinclude -ir include/stl -ir include/revolution -nodefaults -w unused,missingreturn,err -requireprotos" +DEFAULT_OPT = "-O4,p" + +AS = join("tools", "powerpc-eabi-as.exe") +ASFLAGS = "-mgekko -I tools/tester/include" + +TESTS_DIR = "tests/" +CC_DIR = join("tools", "GC_WII_COMPILERS") + +WIBO = "" + + +def make_obj(obj_file: str) -> str: + """Generate unit test from a given object file + """ + # Parse object file + try: + strm = InputStream.open_file(obj_file, InputStream.ENDIAN_BIG) + elf = ELFFile(strm) + except FileNotFoundError: + print(f"[FATAL] Object file could not be opened: {obj_file}") + return + + hasher = Hasher() + test = {} + # Hash code/data and output to JSON + for sect in elf.all_sections(): + if not sect.is_code() and not sect.is_data(): + continue + + test[sect.name] = list() + for sym in sect.all_symbols(): + digest = hasher.hash_symbol(sym) + if digest != None: + test[sect.name].append([sym.name, digest.hex()]) + + return dumps(test, indent=4) + + +def make_asm(asm_file: str) -> str: + """Generate unit test from a given assembly file + """ + # Fixup assembly for tester + fx = Fixer() + with open(asm_file, "r") as f: + asm = f.readlines() + asm = fx.fix(asm) + # Write to temp file + with open("temp_asm.s", "w+") as f: + f.writelines(asm) + + # Assemble temp file + cmd = f"{AS} {ASFLAGS} -o temp_asm.o temp_asm.s" + result = run(cmd, shell=True, stdout=PIPE, + stderr=PIPE, universal_newlines=True) + if result.returncode != 0: + print("[FATAL] Assembler threw an error:") + print(result.returncode, result.stdout, result.stderr) + return + + # Hand off object to make_obj + test_data = make_obj("temp_asm.o") + + # Delete temp files + if exists("temp_asm.s"): + remove("temp_asm.s") + if exists("temp_asm.o"): + remove("temp_asm.o") + + return test_data + + +def run_test(test_file: str) -> bool: + """Run unit test file + Only returns True if ALL cases pass + """ + + # Open unit test file + try: + with open(test_file, "rb") as f: + test_json = loads(f.read()) + except FileNotFoundError: + print(f"[FATAL] Unit test could not be opened: {test_file}") + return + except UnicodeDecodeError: + print(f"[FATAL] JSON data could not be decoded. {test_file}") + return + + # TU-specific compiler/flags overrides + cc_arch = DEFAULT_CC_ARCH + cc_ver = DEFAULT_CC_VERSION + cflags = DEFAULT_CFLAGS + opt = DEFAULT_OPT + if "CC_ARCH" in test_json: + cc_arch = test_json["CC_ARCH"] + if "CC_VERSION" in test_json: + cc_ver = test_json["CC_VERSION"] + if "CFLAGS" in test_json: + cflags = test_json["CFLAGS"] + if "OPT" in test_json: + opt = test_json["OPT"] + + # Compile source file + src_file = test_file.replace(".json", "") + src_file = src_file.replace("tests", "src") + cc_path = f"{WIBO} {join(CC_DIR, cc_arch, cc_ver, 'mwcceppc.exe')}" + cmd = f"{cc_path} {cflags} {opt} -c -o temp.o {src_file}" + + result = run(cmd, shell=True, stdout=PIPE, + stderr=PIPE, universal_newlines=True) + if result.returncode != 0: + print("[FATAL] Compiler threw an error:") + print(result.returncode, result.stdout, result.stderr) + return + + # Hash stuff in object file + try: + strm = InputStream.open_file("temp.o", InputStream.ENDIAN_BIG) + elf = ELFFile(strm) + except FileNotFoundError: + print("[FATAL] Temporary object file could not be opened") + + # Validate section-by-section + print(f"Unit test: {test_file}") + any_fail = False + for name in ELFSection.ALL_SECTIONS: + # Test cases for this section + cases = test_json.get(name, []) + # Compiled data for this section + my_sect = elf.section(name) + + if len(cases) > 0: + print(f"{name} section:") + + # Compare hashes + for case in cases: + if my_sect == None: + print(f" [WARN] Missing section {name}") + break + + # Expected + test_name = case[0] + test_hash = case[1] + + # Find target symbol in ELF + my_sym = my_sect.symbol(test_name) + if my_sym == None: + # Symbol is missing from user code + print(f" [FAIL] {test_name} (Missing symbol)") + any_fail = True + else: + # Compare hash + hasher = Hasher() + my_hash = hasher.hash_symbol(my_sym) + if my_hash != None and my_hash.hex() == test_hash: + print(f" [OK] {test_name}") + else: + print(f" [FAIL] {test_name} (Hash mismatch)") + any_fail = True + + # Delete temp object file + if exists("temp.o"): + remove("temp.o") + + # The program must know if any case failed, + # so it can return the proper error code + return not any_fail + + +def dir_path(path): + if isdir(path): + return path + else: + raise NotADirectoryError(path) + + +def main(): + global WIBO, CC_DIR + + parser = ArgumentParser() + group = parser.add_mutually_exclusive_group(required=False) + group.add_argument("--make_asm", type=str, required=False, + help="Assembly file (*.s) to create unit test from") + group.add_argument("--make_obj", type=str, required=False, + help="Object file (*.o) to create unit test from") + parser.add_argument("--compilers", type=dir_path, required=False, + help="Path to compilers") + parser.add_argument("--run", type=str, required=False, + help="Unit test to run (specify \"all\" to run everything") + parser.add_argument("--wibo", type=str, required=False, + help="Whether to use WiBo to run CodeWarrior") + args = parser.parse_args(argv[1:]) + + if args.compilers: + CC_DIR = args.compilers + + # Create unit test from object file + if args.make_obj != None: + # Create unit test + test_data = make_obj(args.make_obj) + # Print data to console + print(test_data) + + # Create unit test from assembly file + elif args.make_asm != None: + # Create unit test + test_data = make_asm(args.make_asm) + # Print data to console + print(test_data) + + if args.wibo != None: + WIBO = args.wibo + + # Run unit test + elif args.run != None: + # Run all tests? + if args.run == "all": + # Scan tests root directory + for _path, _dir, _files, in walk(TESTS_DIR, topdown=True): + for file in _files: + if file.endswith(".json"): + test_path = join(_path, file) + if not run_test(test_path): + print(f"[FAIL] {test_path}") + exit(1) + + # Run single test + elif not run_test(args.run): + print(f"[FAIL] {args.run}") + exit(1) + + print("[OK] All tests OK") + + exit(0) + +if __name__ == '__main__': + main() diff --git a/include/lib/BrawlHeaders/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c b/include/lib/BrawlHeaders/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c new file mode 100644 index 0000000000..9ce6debbc0 --- /dev/null +++ b/include/lib/BrawlHeaders/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c @@ -0,0 +1,46 @@ +#include + +typedef struct DestructorChain +{ + struct DestructorChain *next; + void *destructor; + void *object; +} DestructorChain; + + +DestructorChain *__global_destructor_chain; + +extern void *__register_global_object(void *object, void *destructor, DestructorChain *chain) +{ + chain->next = __global_destructor_chain; + chain->destructor = destructor; + chain->object = object; + __global_destructor_chain = chain; + return object; +} + +void __destroy_global_chain(void) +{ + DestructorChain *dc; + + while ((dc = __global_destructor_chain) != NULL) + { + __global_destructor_chain = dc->next; + ((void (*)())dc->destructor)(dc->object, -1); + } +} + +// With MWCC we use their special section directive +// to trigger the compiler's handling of global_destructor_chain. +// For Clang, we emulate it's behavior by placing two references manually. +#ifdef __MWERKS__ +#pragma section ".dtors$10" +__declspec(section ".dtors$10") __declspec(weak) + extern void * const __destroy_global_chain_reference = __destroy_global_chain; +#else +__attribute__((section(".dtors"))) __attribute__((weak)) + void * const __destroy_global_chain_reference = __destroy_global_chain; + +__attribute__((section(".dtors"))) __attribute__((weak)) + void * const __destroy_global_chain_reference2 = __destroy_global_chain; +#endif diff --git a/include/lib/BrawlHeaders/README.md b/include/lib/BrawlHeaders/README.md new file mode 100644 index 0000000000..024414ff5c --- /dev/null +++ b/include/lib/BrawlHeaders/README.md @@ -0,0 +1,43 @@ +> [!WARNING] +> This repository is no longer taking direct contributions. Instead, open a PR to [The decomp repo](https://github.com/doldecomp/brawl) + +# PROJECT UPDATE +To facilitate easier collaboration with [the decomp project](https://github.com/doldecomp/brawl), this repository's contents will be merged directly into that repository. + +#### *This repository will not be closing.* + +Instead, it will become a mirror of the headers from that project so that modders and syriinge developers can pull in the headers as as submodule without pulling in the entire decomp. New PR's for headers should be submit to that repository instead of this one moving forward as this one will no longer be taking direct contributions. + +The original README is kept below for historical purposes. + +--- + +# BrawlHeaders +This is a repository of MWCC compatible header files for use in both decompilation and modding of Super Smash Bros. Brawl for the Nintendo Wii. (SSBB). + +## Project Goal +The goal of this project is to provide a collaborative repository for reverse engineering and documenting the game. These headers are useful for both those interested in a decomp of the game as well as modders, which are the current largest userbase for this project. As more people use tools such as Syriinge or the BrawlModules repo, the greater the scene will benefit. Users may run into things not currently documented here that they need for their project, and if they are so inclined will contribute here to the benefit of all projects using it. + +These headers are specifically designed to be used with MetroWerks TRK compilers. While we make every effort for these to also be compatible with other compilers, we make no guarantees that they will work or be accurate under them. Some other compilers that we know will work with these headers include: + - [Kuribo Clang](https://github.com/DotKuribo/llvm-project) + - Note that at the time of writing there is a bug with the compiler which causes incorrect sizing of derived objects in specific multi-inheritance cases. + +## Other Projects Using This + - [Syriinge](https://github.com/Sammi-Husky/Syriinge) + - Runtime hooking and plugins for Super Smash Bros. Brawl + - [BrawlModules](https://github.com/Sammi-Husky/BrawlModules) + - Repository for brawl module reimplementations and decomps + - [BrawlStageModules](https://github.com/ilazoja/BrawlStageModule) + - Custom stage modules built with C++ for completely custom functionality + - [Brawl Decompilation](https://github.com/doldecomp/brawl) + - A work-in-progress matching decompilation of Super Smash Bros. Brawl + +## Special Thanks +This project would not be possible without the gracious contributions of many wonderful people in the Brawl Modding scene. While i can't list everyone, i've listed the contributors who have had the greatest impact on this specific repo. If you believe your name to be missing please contact me or submit a PR! + + + + + +### This Project also makes use of the following open source projects: + - [OpenRVL](https://github.com/Sammi-Husky/open_rvl), an open source reimplementation of the Revolution SDK diff --git a/include/lib/BrawlHeaders/RSBE01.lst b/include/lib/BrawlHeaders/RSBE01.lst new file mode 100644 index 0000000000..af096cc4dd --- /dev/null +++ b/include/lib/BrawlHeaders/RSBE01.lst @@ -0,0 +1,2073 @@ +// global variables +805a00d0:g_ipSwitch +805a0148: g_ecMgr +8059FFAC: g_gfApplication +805A01D0: g_sndSystem +805a0140: g_efScreen +805A02D0: g_IfMngr +27,6,58D8: g_stTriggerMng +805a00e0:g_GameGlobal +27,6,2E68: g_ftManager +27,6,2E88: g_ftEntryManager +27,6,2E90: g_ftSlotManager +27,6,2EB4: g_ftInstanceManager +27,6,2E70: g_ftAudienceManager +27,6,5518: g_aiMgr +805A0040: g_gfPadSystem +27,6,E8: g_soWorld +27,5,547E0: g_stGameFrame +80494958:g_HeapInfos +8059FF80:g_gfSceneRoot +8049ebe0:g_Network +805a02a4:g_muWifiInterfaceTask +8059fff4:g_gfFileIOManager +805a00b8:g_mtRand +27,6,5910: g_stLoaderManager +8059ff68:__float_nan +8059ff6c:__float_huge +8059ff70:__double_huge +27,5,A6068:g_soGeneralTermCache +27,5,A8B0C:g_soGeneralTermManager +27,6,5B98:g_stEnemyIdManager +27,6,5668:g_Stage + +// Hardware +CC008000:WGPIPE +// CD006C00:AI_HW_REGS +// CC005000:DSP_HW_REGS +// CD000000:IPC_HW_REGS + +// System +803f1254:__save_fpr +803f1278:_savefpr_23 +803f1280:_savefpr_25 +803f1284:_savefpr_26 +803f1288:_savefpr_27 +803f128c:_savefpr_28 +803f1290:_savefpr_29 +803f12a0:__restore_fpr +803f12c4:_restfpr_23 +803f12cc:_restfpr_25 +803f12d0:_restfpr_26 +803f12d4:_restfpr_27 +803f12d8:_restfpr_28 +803f12dc:_restfpr_29 +803f12ec:__save_gpr +803f12ec:_savegpr_14 +803f12f0:_savegpr_15 +803f12f4:_savegpr_16 +803f12f8:_savegpr_17 +803f12fc:_savegpr_18 +803f1300:_savegpr_19 +803f1304:_savegpr_20 +803f1308:_savegpr_21 +803f130c:_savegpr_22 +803f1310:_savegpr_23 +803f1314:_savegpr_24 +803f1318:_savegpr_25 +803f131c:_savegpr_26 +803f1320:_savegpr_27 +803f1324:_savegpr_28 +803f1328:_savegpr_29 +803f1338:__restore_gpr +803f1338:_restgpr_14 +803f133c:_restgpr_15 +803f1340:_restgpr_16 +803f1344:_restgpr_17 +803f1348:_restgpr_18 +803f134c:_restgpr_19 +803f1350:_restgpr_20 +803f1354:_restgpr_21 +803f1358:_restgpr_22 +803f135c:_restgpr_23 +803f1360:_restgpr_24 +803f1364:_restgpr_25 +803f1368:_restgpr_26 +803f136c:_restgpr_27 +803f1370:_restgpr_28 +803f1374:_restgpr_29 +8000c8ac:__nw__FUl +8000c8b8:__nw__FUlQ25Heaps8HeapType +8000c8ac:__nwa__FUl +8000c8cc:__nwa__FUlQ25Heaps8HeapType +8000c8c8:__dl__FPv +8000c8dc:__dla__FPv +803f11f8:__cvt_fp2unsigned +803f0a1c:__construct_new_array +8002632c:free__FPv +80004304:__flush_cache +80403664:TRK_flush_cache +801e892c:VIWaitForRetrace +801d76e8:DCFlushRange +801d77cc:ICInvalidateRange +803f0f44:__dynamic_cast +803f0e38:__ptmf_scall + +// OS +801d8600:OSReport +801e0cfc:OSCreateThread +801e1364:OSResumeThread +801e1224:OSJoinThread +801debb4:OSLockMutex +801dec90:OSUnlockMutex +801deb7c:OSInitMutex +801e1a80:OSSleepTicks__FUlUl +801e1b34:OSGetTime +801e1b4c:OSGetTick +801ddeac:OSUnlink + +// string +803fa3fc:strcmp__FPCcPCc +803fa3fc:strcmp +803fa340:strncpy +803fa340:strncpy__6StringF6StringPCcUl +803fa280:strcpy__FPcPCc +803fa280:strcpy +803f89fc:sprintf +803f8924:snprintf +803f88a4:vsprintf +803fa384:strcat__FPcPc +803fa3b0:strncat__FPcPc +803fa3b0:strncat +803fa518:strncmp__FPcPc +803fa518:strncmp +803fa558:strchr__FPcPc +803fa588:strrchr__FPcPc +803fa5d0:strcspn__FPcPc +803fa674:strtok__FPcPc +803fa798:strstr__FPcPc +803f87a8:vprintf +803f8820:vsnprintf +803fa108:sscanf + +// module +80043b18:moUnResolvedMessage__FPCc + +// strtoul +803fc704:atoi__FPCc +803fc704:atoi + +// extras +803fcb50:itoa__FiPci +803fcb50:itoa +803fc9fc:stricmp + +// __mem +803f0640:strlen__FPc +803f0640:strlen +8000443c:__memfill +8000443c:memset__FPvUcUl +8000443c:memset +80004338:memcpy__FPvPvUl +80004338:memcpy + +// math +804009e0:sin +804004d8:cos +80400b38:atan2 +802a0bcc:fabsf +804005ac:floor +8040036c:ceil + +// arith.h +803f5060:abs + +// crc +8038ed50:NETCalcCRC16 +8038ee84:NETCalcCRC32 + + +// nw4r::g3d::ResFile +8018d2a4:GetResMdlNumEntries__Q34nw4r3g3d7ResFileCFv +8018d770:GetResAnmChrNumEntries__Q34nw4r3g3d7ResFileFv +8018d978:GetResAnmVisNumEntries__Q34nw4r3g3d7ResFileFv +8018dd88:GetResAnmTexPatNumEntries__Q34nw4r3g3d7ResFileFv +8018df90:GetResAnmTexSrtNumEntries__Q34nw4r3g3d7ResFileFv +8018db80:GetResAnmClrNumEntries__Q34nw4r3g3d7ResFileFv +8018e198:GetResAnmShpNumEntries__Q34nw4r3g3d7ResFileFv +8018d640:GetResAnmChr__Q34nw4r3g3d7ResFileFi +8018d6d8:GetResAnmChr__Q34nw4r3g3d7ResFileFi +8018d848:GetResAnmVis__Q34nw4r3g3d7ResFileFi +8018d8e0:GetResAnmVis__Q34nw4r3g3d7ResFileFUl +8018dc58:GetResAnmTexPat__Q34nw4r3g3d7ResFileFi +8018dcf0:GetResAnmTexPat__Q34nw4r3g3d7ResFileFUl +8018de60:GetResAnmTexSrt__Q34nw4r3g3d7ResFileFi +8018def8:GetResAnmTexSrt__Q34nw4r3g3d7ResFileFUl +8018da50:GetResAnmClr__Q34nw4r3g3d7ResFileFi +8018dae8:GetResAnmClr__Q34nw4r3g3d7ResFileFUl +8018e270:GetResAnmScn__Q34nw4r3g3d7ResFileFi +8018d3f0:GetResTex__Q34nw4r3g3d7ResFileFPCc +8018d4d0:GetResTex__Q34nw4r3g3d7ResFileFi +8018e374:HasResTex__Q34nw4r3g3d7ResFileFv +8018e3c0:HasResAnmChr__Q34nw4r3g3d7ResFileFv +8018e40c:HasResAnmVis__Q34nw4r3g3d7ResFileFv +8018e458:HasResAnmClr__Q34nw4r3g3d7ResFileFv +8018e4a4:HasResAnmTexPat__Q34nw4r3g3d7ResFileFv +8018e4f0:HasResAnmTexSrt__Q34nw4r3g3d7ResFileFv +8018e53c:HasResAnmShp__Q34nw4r3g3d7ResFileFv +8018e588:HasResAnmScn__Q34nw4r3g3d7ResFileFv + +// NW4R +8018ee4c:GetResNodeNumEntries__Q34nw4r3g3d6ResMdlFv +801b0520:__ct__Q44nw4r3g3d6ScnMdl15CopiedMatAccessFPQ34nw4r3g3d6ScnMdlUl +8018f258:GetResMat__Q34nw4r3g3d6ResMdlCFPCc +801b00b4:GetResMatTevColor__Q44nw4r3g3d6ScnMdl15CopiedMatAccessFb +801913d0:GXSetTevColor__Q34nw4r3g3d14ResMatTevColorFUl8_GXColor +80190a90:DCStore__Q34nw4r3g3d6ResMatFb +8018eda4:GetResNode__Q34nw4r3g3d6ResMdlCFi +8018edf8:GetResNode__Q34nw4r3g3d6ResMdlCFUl +8018ed10:GetResNode__Q34nw4r3g3d6ResMdlCFPCc +801afaac:EnableScnMdlCallbackTiming__Q34nw4r3g3d12ScnMdlSimpleFUl +801af9f4:UpdateFrame__Q34nw4r3g3d12ScnMdlSimpleFv +80192f70:SetTranslate__Q34nw4r3g3d7ResNodeFfff +80190c2c:GetTexObj__Q34nw4r3g3d9ResTexObjF11_GXTexMapID +80191018:SetMapMode__Q34nw4r3g3d9ResTexSrtFUlUlii +801AAFF0:SetPriorityDrawOpa__Q34nw4r3g3d6ScnObjFi +801AB014:SetPriorityDrawXlu__Q34nw4r3g3d6ScnObjFi + +// GameGlobal +8004e5cc:getGlobalRecordMenuDatap__10GameGlobalFv +8004D9DC:getLanguage__12gmGameGlobalFv + +// ecMgr +8005f774:setDrawPrio__5ecMgrFi +80060d8c:killEffect__5ecMgrFUlUlUl +8005f7a4:setEffect__5ecMgrF4EfID +8005f7b8:setEffect__5ecMgrF4EfIDP5Vec3f +8005f7e0:setEffect__5ecMgrF4EfIDPC5Vec3fPC5Vec3fPC5Vec3f +80060c54:endEffect__5ecMgrFUl +8005fc5c:setParent__5ecMgrFUlPQ34nw4r3g3d6ScnMdlPCcb +8005fcf4:setParent__5ecMgrFUlPQ34nw4r3g3d6ScnMdlUlb +8005fd8c:setParent__5ecMgrFUlUlPCcb +800606a8:preSetAnmIdx__5ecMgrFiiiiii +8006001c:setGroundAttach__5ecMgrFUlP14soGroundModule +800600ec:setGroundAttach__5ecMgrFUlP19grCollisionLineWork +8006017c:setVisible__5ecMgrFUlb +8006020c:setVisibleGroup__5ecMgrFUlbUlUl +800602b0:setPos__5ecMgrFUlP5Vec3f +80060340:setRot__5ecMgrFUlP5Vec3f +800603d0:setScl__5ecMgrFUlP5Vec3f +80060460:setMdlTexpat__5ecMgrFUlUl +800604f0:setMdlAnmIdx__5ecMgrFUlUlSc +80060584:setMdlEnableUpdate__5ecMgrFUlbSc +80060618:setMdlFrame__5ecMgrFUlfSc +8006102C:setSlowRate__5ecMgrFUlUl +8005EC64:searchResourceID__5ecMgrFPc + +// efScreen +8005e0fc:requestFill__8efScreenFfiiP8_GXColor + +// sndSystem +800742b0:playSE__9sndSystemF5SndIDiiii +80077064:setBGMVol__9sndSystemFbf +80077174:setEffectVol__9sndSystemFbbf +80073c98:freeGroup__9sndSystemFii +800742b0:playSE__9sndSystemFiiiii +80073b68:loadSoundGroup__9sndSystemF10SndGroupIDib +80073fe8:getBGMId__9sndSystemFv +80073db0:playBGM__9sndSystemFiUlb +80073d18:isSoundGroupLoaded__9sndSystemF10SndGroupID +80075f1c:stopSE__9sndSystemFll +80077da0:isPlay__9sndSystemFl +80074dec:isPlaySEID__9sndSystemF5SndID + +// FrameHeap +801BFF1C:GetCurrentLevel__Q44nw4r3snd6detail9FrameHeapCFv +801BFF28:GetFreeSize__Q44nw4r3snd6detail9FrameHeapCFv +801BFCF8:LoadState__Q44nw4r3snd6detail9FrameHeapFi +801BF7D0:Create__Q44nw4r3snd6detail9FrameHeapFPvUl +801BFA5C:Clear__Q44nw4r3snd6detail9FrameHeapFv +801BF96C:Destroy__Q44nw4r3snd6detail9FrameHeapFv +801BFC2C:SaveState__Q44nw4r3snd6detail9FrameHeapFv +801BF698:__ct__Q44nw4r3snd6detail9FrameHeapFv +801BF6BC:__dt__Q44nw4r3snd6detail9FrameHeapFv + +// SoundHeap +801CAA28:LoadState__Q34nw4r3snd9SoundHeapFi +801CA8F0:Create__Q34nw4r3snd9SoundHeapFPvUl +801CAA9C:DisposeCallbackFunc__Q34nw4r3snd9SoundHeapFPvUlPv +801CA900:Alloc__Q34nw4r3snd9SoundHeapFUl +801CA970:Clear__Q34nw4r3snd9SoundHeapFv +801CA8F8:Destroy__Q34nw4r3snd9SoundHeapFv +801CA9D4:SaveState__Q34nw4r3snd9SoundHeapFv +801CA838:__ct__Q34nw4r3snd9SoundHeapFv +801CA880:__dt__Q34nw4r3snd9SoundHeapFv + +// snd3DGenerator +80079550:__ct__14snd3DGeneratorFv +800795d4:__dt__14snd3DGeneratorFv +80079718:playSE__14snd3DGeneratorF5SndIDiii +80079660:setPos__14snd3DGeneratorFP5Vec3f +80079788:startSE__14snd3DGeneratorFll +80079794:stopSE__14snd3DGeneratorFll +80079758:prepareSE__14snd3DGeneratorF5SndIDl + +// snd::detail +801D3698:GetDataRefAddressImpl__Q44nw4r3snd6detail4UtilFQ54nw4r3snd6detail4Util7RefTypeUlPCv + +// SoundArchiveLoader +801C8104:__ct__Q44nw4r3snd6detail18SoundArchiveLoaderFRCQ34nw4r3snd12SoundArchive +801C8140:__dt__Q44nw4r3snd6detail18SoundArchiveLoaderFv +801C8180:LoadGroup__Q44nw4r3snd6detail18SoundArchiveLoaderFUlPQ34nw4r3snd22SoundMemoryAllocatablePPvUl + +// SoundArchive +801C6B14:__ct__Q34nw4r3snd12SoundArchiveFv +801C6B38:__dt__Q34nw4r3snd12SoundArchiveFv +801C6B78:IsAvailable__Q34nw4r3snd12SoundArchiveCFv +801C6B8C:Setup__Q34nw4r3snd12SoundArchiveFPQ44nw4r3snd6detail22SoundArchiveFileReader +801C6B94:Shutdown__Q34nw4r3snd12SoundArchiveFv +801C6BAC:GetPlayerCount__Q34nw4r3snd12SoundArchiveCFv +801C6BB4:GetGroupCount__Q34nw4r3snd12SoundArchiveCFv +801C6BBC:ConvertLabelStringToSoundId__Q34nw4r3snd12SoundArchiveCFPCc +801C6BCC:GetSoundUserParam__Q34nw4r3snd12SoundArchiveCFUl +801C6BD4:GetSoundType__Q34nw4r3snd12SoundArchiveCFUl +801C6BDC:ReadSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive9SoundInfo +801C6BE4:detail_ReadSeqSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive12SeqSoundInfo +801C6BEC:detail_ReadStrmSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive13StrmSoundInfo +801C6BF4:detail_ReadWaveSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive13WaveSoundInfo +801C6BFC:ReadPlayerInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive10PlayerInfo +801C6C04:ReadSoundArchivePlayerInfo__Q34nw4r3snd12SoundArchiveCFPQ44nw4r3snd12SoundArchive22SoundArchivePlayerInfo +801C6C0C:detail_ReadSound3DParam__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive12Sound3DParam +801C6C14:detail_ReadBankInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive8BankInfo +801C6C1C:detail_ReadGroupInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive9GroupInfo +801C6C24:detail_ReadGroupItemInfo__Q34nw4r3snd12SoundArchiveCFUlUlPQ44nw4r3snd12SoundArchive13GroupItemInfo +801C6C2C:detail_ReadFileInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive8FileInfo +801C6C34:detail_ReadFilePos__Q34nw4r3snd12SoundArchiveCFUlUlPQ44nw4r3snd12SoundArchive7FilePos +801C6C3C:detail_OpenFileStream__Q34nw4r3snd12SoundArchiveCFUlPvi +801C6E60:detail_OpenGroupStream__Q34nw4r3snd12SoundArchiveCFUlPvi +801C6F78:detail_OpenGroupWaveDataStream__Q34nw4r3snd12SoundArchiveCFUlPvi +801C7090:SetExternalFileRoot__Q34nw4r3snd12SoundArchiveFPCc + +// SoundArchiveFileReader +801C710C:__ct__Q44nw4r3snd6detail22SoundArchiveFileReaderFv +801C7130:Init__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCv +801C71E0:SetStringChunk__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCvUl +801C7288:SetInfoChunk__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCvUl +801C7294:GetSoundType__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl +801C7384:ReadSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive9SoundInfo +801C74A4:ReadSound3DParam__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive12Sound3DParam +801C75A8:ReadSeqSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive12SeqSoundInfo +801C7654:ReadStrmSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive13StrmSoundInfo +801C76A0:ReadWaveSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive13WaveSoundInfo +801C773C:ReadBankInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive8BankInfo +801C77E8:ReadPlayerInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive10PlayerInfo +801C78A0:ReadGroupInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive9GroupInfo +801C79B0:ReadGroupItemInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlUlPQ44nw4r3snd12SoundArchive13GroupItemInfo +801C7AE8:ReadSoundArchivePlayerInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFPQ44nw4r3snd12SoundArchive22SoundArchivePlayerInfo +801C7B6C:GetPlayerCount__Q44nw4r3snd6detail22SoundArchiveFileReaderCFv +801C7BAC:GetGroupCount__Q44nw4r3snd6detail22SoundArchiveFileReaderCFv +801C7BF0:GetSoundUserParam__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl +801C7CA8:ReadFileInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive8FileInfo +801C7DA8:ReadFilePos__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlUlPQ44nw4r3snd12SoundArchive7FilePos +801C7EC8:ConvertLabelStringToId__Q44nw4r3snd6detail22SoundArchiveFileReaderCFPCQ54nw4r3snd6detail16SoundArchiveFile10StringTreePCc +801C8010:impl_GetSoundInfoOffset__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl + +// SoundArchivePlayer +801C8754:__ct__Q34nw4r3snd18SoundArchivePlayerFv +801C8A68:__dt__Q34nw4r3snd18SoundArchivePlayerFv +801C8B20:IsAvailable__Q34nw4r3snd18SoundArchivePlayerCFv +801C8B3C:Setup__Q34nw4r3snd18SoundArchivePlayerFPCQ34nw4r3snd12SoundArchivePvUlPvUl +801C8C14:Shutdown__Q34nw4r3snd18SoundArchivePlayerFv +801C8D38:GetRequiredMemSize__Q34nw4r3snd18SoundArchivePlayerFPCQ34nw4r3snd12SoundArchive +801C8E68:GetRequiredStrmBufferSize__Q34nw4r3snd18SoundArchivePlayerFPCQ34nw4r3snd12SoundArchive +801C8EB4:SetupMram__Q34nw4r3snd18SoundArchivePlayerFPCQ34nw4r3snd12SoundArchivePvUl +801C914C:SetupSoundPlayer__Q34nw4r3snd18SoundArchivePlayerFPCQ34nw4r3snd12SoundArchivePPvPv +801C92E4:Update__Q34nw4r3snd18SoundArchivePlayerFv +801C96A0:GetSoundArchive__Q34nw4r3snd18SoundArchivePlayerCFv +801C96A8:GetSoundPlayer__Q34nw4r3snd18SoundArchivePlayerFUl +801C96B8:detail_GetFileAddress__Q34nw4r3snd18SoundArchivePlayerCFUl +801C9804:detail_GetFileWaveDataAddress__Q34nw4r3snd18SoundArchivePlayerCFUl +801C9950:detail_SetupSound__Q34nw4r3snd18SoundArchivePlayerFPQ34nw4r3snd11SoundHandleUlPQ54nw4r3snd6detail10BasicSound14AmbientArgInfoPQ44nw4r3snd6detail19ExternalSoundPlayerbPCQ44nw4r3snd14SoundStartable9StartInfo +801C9C98:PrepareSeqImpl__Q34nw4r3snd18SoundArchivePlayerFPQ44nw4r3snd6detail8SeqSoundPCQ44nw4r3snd12SoundArchive9SoundInfoPCQ44nw4r3snd12SoundArchive12SeqSoundInfoQ54nw4r3snd14SoundStartable9StartInfo15StartOffsetTypeii +801C9F9C:PrepareStrmImpl__Q34nw4r3snd18SoundArchivePlayerFPQ44nw4r3snd6detail9StrmSoundPCQ44nw4r3snd12SoundArchive9SoundInfoPCQ44nw4r3snd12SoundArchive13StrmSoundInfoQ54nw4r3snd14SoundStartable9StartInfo15StartOffsetTypeii +801CA0FC:PrepareWaveSoundImpl__Q34nw4r3snd18SoundArchivePlayerFPQ44nw4r3snd6detail9WaveSoundPCQ44nw4r3snd12SoundArchive9SoundInfoPCQ44nw4r3snd12SoundArchive13WaveSoundInfoQ54nw4r3snd14SoundStartable9StartInfo15StartOffsetTypeii +801CA274:LoadGroup__Q34nw4r3snd18SoundArchivePlayerFUlPQ34nw4r3snd22SoundMemoryAllocatableUl +801CA3DC:InvalidateData__Q34nw4r3snd18SoundArchivePlayerFPCvPCv +801CA430:InvalidateWaveData__Q34nw4r3snd18SoundArchivePlayerFPCvPCv +801CA6A8:detail_ConvertLabelStringToSoundId__Q34nw4r3snd18SoundArchivePlayerFPCc + +// DvdSoundArchive +801BEB4C:__ct__Q34nw4r3snd15DvdSoundArchiveFv +801BEB98:__dt__Q34nw4r3snd15DvdSoundArchiveFv +801BEC18:Open__Q34nw4r3snd15DvdSoundArchiveFPCc +801BED78:Close__Q34nw4r3snd15DvdSoundArchiveFv +801BEDB8:OpenStream__Q34nw4r3snd15DvdSoundArchiveCFPviUlUl +801BEE70:OpenExtStream__Q34nw4r3snd15DvdSoundArchiveCFPviPCcUlUl +801BEF38:detail_GetRequiredStreamBufferSize__Q34nw4r3snd15DvdSoundArchiveCFv +801BEF40:LoadHeader__Q34nw4r3snd15DvdSoundArchiveFPvUl +801BEFC8:Read__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFPvUl +801BEFF4:Seek__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFlUl +801BF07C:GetSize__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv +801BF084:Tell__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamCFv +801BF094:detail_GetWaveDataFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl +801BF09C:detail_GetFileAddress__Q34nw4r3snd15DvdSoundArchiveCFUl +801BF0A4:__dt__Q44nw4r3snd15DvdSoundArchive13DvdFileStreamFv + +// WsdFileReader +801D3C8C:__ct__Q44nw4r3snd6detail13WsdFileReaderFPCv +801D3D08:ReadWaveSoundInfo__Q44nw4r3snd6detail13WsdFileReaderCFPQ44nw4r3snd6detail13WaveSoundInfoi +801D3E28:ReadWaveSoundNoteInfo__Q44nw4r3snd6detail13WsdFileReaderCFPQ44nw4r3snd6detail17WaveSoundNoteInfoii +801D3F38:ReadWaveParam__Q44nw4r3snd6detail13WsdFileReaderCFiPQ44nw4r3snd6detail8WaveDataPCv + +// IOStream +8015CBF8:ReadAsync__Q34nw4r2ut8IOStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015CC00:Write__Q34nw4r2ut8IOStreamFPCvUl +8015CC04:WriteAsync__Q34nw4r2ut8IOStreamFPCvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015CC0C:IsBusy__Q34nw4r2ut8IOStreamCFv +8015CC14:GetBufferAlign__Q34nw4r2ut8IOStreamCFv +8015CC1C:GetSizeAlign__Q34nw4r2ut8IOStreamCFv +8015CC24:GetOffsetAlign__Q34nw4r2ut8IOStreamCFv + +// FileStream +8015CC38:Cancel__Q34nw4r2ut10FileStreamFv +8015CC3C:CancelAsync__Q34nw4r2ut10FileStreamFPFlPQ34nw4r2ut8IOStreamPv_vPv +8015CC44:Skip__Q44nw4r2ut10FileStream12FilePositionFl +8015CCA8:Seek__Q44nw4r2ut10FileStream12FilePositionFlUl +8015CD40:GetRuntimeTypeInfo__Q34nw4r2ut10FileStreamCFv + +// DvdFileStream +8015CDA8:__ct__Q34nw4r2ut13DvdFileStreamFl +8015CE64:__ct__Q34nw4r2ut13DvdFileStreamFPC11DVDFileInfob +8015CF94:__dt__Q34nw4r2ut13DvdFileStreamFv +8015D00C:Close__Q34nw4r2ut13DvdFileStreamFv +8015D05C:Read__Q34nw4r2ut13DvdFileStreamFPvUl +8015D0E4:ReadAsync__Q34nw4r2ut13DvdFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015D1D8:Peek__Q34nw4r2ut13DvdFileStreamFPvUl +8015D214:PeekAsync__Q34nw4r2ut13DvdFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015D294:Seek__Q34nw4r2ut13DvdFileStreamFlUl +8015D29C:Cancel__Q34nw4r2ut13DvdFileStreamFv +8015D2A4:CancelAsync__Q34nw4r2ut13DvdFileStreamFPFlPQ34nw4r2ut8IOStreamPv_vPv +8015D300:GetBufferAlign__Q34nw4r2ut13DvdFileStreamCFv +8015D308:GetSizeAlign__Q34nw4r2ut13DvdFileStreamCFv +8015D310:GetOffsetAlign__Q34nw4r2ut13DvdFileStreamCFv +8015D318:CanCancel__Q34nw4r2ut13DvdFileStreamCFv +8015D320:CanWrite__Q34nw4r2ut13DvdFileStreamCFv +8015D328:CanRead__Q34nw4r2ut13DvdFileStreamCFv +8015D330:CanSeek__Q34nw4r2ut13DvdFileStreamCFv +8015D338:CanAsync__Q34nw4r2ut13DvdFileStreamCFv +8015D340:GetSize__Q34nw4r2ut13DvdFileStreamCFv +8015D348:Tell__Q34nw4r2ut13DvdFileStreamCFv +8015D350:IsBusy__Q34nw4r2ut13DvdFileStreamCFv +8015D358:GetRuntimeTypeInfo__Q34nw4r2ut13DvdFileStreamCFv + +// DvdLockedFileStream +8015D36C:__ct__Q34nw4r2ut19DvdLockedFileStreamFl +8015D3F0:__ct__Q34nw4r2ut19DvdLockedFileStreamFPC11DVDFileInfob +8015D474:__dt__Q34nw4r2ut19DvdLockedFileStreamFv +8015D500:Read__Q34nw4r2ut19DvdLockedFileStreamFPvUl +8015D5D4:Peek__Q34nw4r2ut19DvdLockedFileStreamFPvUl +8015D700:CanAsync__Q34nw4r2ut19DvdLockedFileStreamCFv +8015D708:PeekAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015D710:ReadAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv +8015D718:GetRuntimeTypeInfo__Q34nw4r2ut19DvdLockedFileStreamCFv + +// gfTask +8002d8b8:__ct__6gfTaskFPCciiii +8002ddc8:processDefault__6gfTaskFv +8002ddd8:processBegin__6gfTaskFv +8002dde8:processAnim__6gfTaskFv +8002ddf8:processUpdate__6gfTaskFv +8002de08:processPreMapCorrection__6gfTaskFv +8002de18:processMapCorrection__6gfTaskFv +8002de28:processFixPosition__6gfTaskFv +8002de38:processPreCollision__6gfTaskFv +8002de48:processCollision__6gfTaskFv +8002de58:processCatch__6gfTaskFv +8002de68:processHit__6gfTaskFv +8002de78:processCamera__6gfTaskFv +8002de88:processFixCamera__6gfTaskFv +8002de98:processEffect__6gfTaskFv +8002dea8:processGameProc__6gfTaskFv +8002deb8:processEnd__6gfTaskFv +8002dec8:renderPre__6gfTaskFv +8002decc:renderOpa__6gfTaskFv +8002ded0:renderXlu__6gfTaskFv +8002ded4:processDebug__6gfTaskFv +8002ded8:renderDebug__6gfTaskFv +8002ddc4:init__6gfTaskFv +8002da1c:__dt__6gfTaskFv +8002dc40:getTask__6gfTaskFi +8002df34:exit__6gfTaskFv + +// gfTaskScheduler +805a0068:g_taskScheduler + + +// gfArchive +8001370c:__ct__9gfArchiveFv +80015e34:getData__9gfArchiveFi11ARCNodeTypeiPiUs +80015ddc:getData__9gfArchiveF11ARCNodeTypeiUs +80015e14:getData__9gfArchiveF11ARCNodeTypeiPiUs +80013b1c:__dt__9gfArchiveFv + +//NMWException +803f0bdc:__construct_array +803f0cd4:__destroy_arr + +// gfModelAnimation +800283bc:getFrameCount__16gfModelAnimationFv +8002858c:getFrame__16gfModelAnimationFv +80028498:setFrame__16gfModelAnimationFf +80028650:setUpdateRate__16gfModelAnimationFf +80028278:setLoop__16gfModelAnimationFb +800278b0:unbindNodeAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80014890:setFileImage__9gfArchiveFPviQ25Heaps8HeapType +80027ba8:unbindShapeAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027c40:__ct__16gfModelAnimationFPQ34nw4r3g3d7ResFilePQ34nw4r3g3d6ResMdlbUlQ25Heaps8HeapType +80027fa4:__ct__16gfModelAnimationFPQ34nw4r3g3d7ResFilePQ34nw4r3g3d6ResMdlbPCcQ25Heaps8HeapType +80028744:getUpdateRate__16gfModelAnimationFv +800282f4:setLoopNode__16gfModelAnimationFb +8002831c:setLoopVisible__16gfModelAnimationFb +80028344:setLoopTex__16gfModelAnimationFb +8002836c:setLoopTexSrt__16gfModelAnimationFb +80028394:setLoopMatCol__16gfModelAnimationFb +80027948:unbindVisibleAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +800279e0:unbindTexAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027a78:unbindTexSrtAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027b10:unbindMatColAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +8002771c:bindNodeAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027748:bindVisibleAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027774:bindTexAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +800277a0:bindTexSrtAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +800277cc:bindMatColAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +800277f8:bindShapeAnim__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027824:unbind__16gfModelAnimationFPQ34nw4r3g3d6ScnMdl +80027610:bind__16gfModelAnimationFPQ34nw4r3g3d6ScnMdlP16gfModelAnimation + +// gfCamera +80018de4:setGX__gfCameraManagerFV +80019fa4:getManager__15gfCameraManagerFv +80019a2c:calcProjection3Dto2D__8gfCameraFP5Vec3fP5Vec2f + +// gfModule +800264d8:create__8gfModuleFPvPvUl + +// gfModuleManager +805A0038:g_gfModuleManager +27,1,00143B14:getInstance__15gfModuleManagerFv +80027060:loadModuleRequestOnImage__15gfModuleManagerFPCcQ25Heaps8HeapTypeP14gfModuleHeaderPi +80026e00:loadModuleRequest__15gfModuleManagerFPQ215gfModuleManager17LoadRequestResultP15gfModuleManagerPCcQ25Heaps8HeapTypebb +80026c78:setTempolaryLoadHeap__15gfModuleManagerFQ25Heaps8HeapType +8002737c:destroy__15gfModuleManagerFPCc +80027300:isLoaded__15gfModuleManagerFPCc + +// gfModuleHeader +80026478:getTextSectionAddr__14gfModuleHeaderFv + +// gfSceneManager +8002cc14:__ct__14gfSceneManagerFv +8002cfd0:create__14gfSceneManagerFv +8002d018:getInstance__14gfSceneManagerFv +8002d020:changeNextScene__14gfSceneManagerFv +8002d160:registScene__14gfSceneManagerFv +8002d180:registSequence__14gfSceneManagerFv +8002d1a0:process__14gfSceneManagerFv +8002d32c:postProcess__14gfSceneManagerFv +8002d3f4:searchScene__14gfSceneManagerFPCc +8002d474:searchSequence__14gfSceneManagerFv +8002d4f4:startSequence__14gfSceneManagerFv +8002d5ac:setNextScene__14gfSceneManagerFv +8002d640:setNextSequence__14gfSceneManagerFv +8002d6d4:setLoadModuleName__14gfSceneManagerFv +8002d73c:loadModule__14gfSceneManagerFv + +// gfSceneRoot +8000d818:setCurrentFrame__11gfSceneRootFf +8000d56c:removeResAnmScn__11gfSceneRootFv + +// gfPadSystem +80028c58:__ct__11gfPadSystemFv +80028c10:create__11gfPadSystemFv +8002b62c:clearPadEdgeRepert__11gfPadSystemFv +80029424:clearPadQueue__11gfPadSystemFv +80029380:createRumbleSystem__11gfPadSystemFv +800293dc:consumeFrameCounter__11gfPadSystemFi +8002b480:disconectWiiControler__11gfPadSystemFv +8002b040:getDebugPadStatus__11gfPadSystemFiP11gfPadStatus +8002ac54:getGamePadStatus__11gfPadSystemFiP11gfPadStatus +8002ae48:getSysPadStatus__11gfPadSystemFiP11gfPadStatus +8002ac2c:getGamePadQueueCount__11gfPadSystemFv +8002a89c:maskMotor__11gfPadSystemFUs +8002b470:merge__11gfPadSystemFP11gfPadStatusiP11gfPadStatus +8002b238:merge__11gfPadSystemFP11gfPadStatusiUlP11gfPadStatus +8002abd0:pauseNotify__11gfPadSystemFv +8002b574:readGameDataRequest__11gfPadSystemFiiii +8002ac4c:setConnectCallback__11gfPadSystemFi +8002b530:startSimpleSync__11gfPadSystemFv +8002a948:startMotor__11gfPadSystemFi +8002a9e8:startMotor__11gfPadSystemFiUs +8002aa8c:stopMotor__11gfPadSystemFi +8002ab74:stopMotorAllForce__11gfPadSystemFv +8002ab00:stopMotorH__11gfPadSystemFi +8002a4f8:updateGame__11gfPadSystemFv +80029438:updateLow__11gfPadSystemFv +80029578:updateLowGC__11gfPadSystemFP11gfPadStatus +80029750:updateLowWii__11gfPadSystemFP11gfPadStatus +8002a210:updateSystem__11gfPadSystemFv +8002b614:wpadGameDataCallback__11gfPadSystemFi +80026c4c:wpadSimpleSyncCallback__11gfPadSystemFv +8002b5c4:writeGameDataRequest__11gfPadSystemFiiii + +// utList +800448f8:addTail__6utListFP10utListNode + +// cmQuake +8009db90:cmReqQuake__FQ27cmQuake9AmplitudeP5Vec3f +8009dd40:cmRemoveQuake__Fi + +// Vec2f +8003dba8:normalize__5Vec2fFP5Vec2f +8003dc00:normalize__5Vec2fFP5Vec2fP5Vec2f +8003dc64:rot__5Vec2fFP5Vec2ff + +// Vec3f +8003de70:normalize__5Vec3fFP5Vec3f +8003dee0:normalize__5Vec3fFP5Vec3fP5Vec3f +27,1,00000E30:__mi__5Vec3fFRC5Vec3f +27,1,00000EF8:__pl__5Vec3fFRC5Vec3f +27,1,00000F1C:__ml__5Vec3fFf +27,1,00000F1C:__ml__FfRC5Vec3f +27,1,00000F38:length__5Vec3fFv + +// Matrix +8003ee18:getRotate__6MatrixFP5Vec3f +8003eb48:rotY__6MatrixFf +8003e35c:setIdentity__6MatrixFv + +// mtCommon +8003db08:mtSqrtf__Ff +8003db58:rsqrtf__Ff + +// mttrig +8003fd5c:mtSinf__Ff +8003fdfc:mtCosf__Ff +8003fea4:mtSinCosf__FfPfPf + +// mtprng +8003fb4c:srandi__Fl +8003fc7c:randi__Fl +8003fb64:randf__Fv + +// rand +803f8c3c:rand + +// mtBezierCurve +8003ffc4:mtBezierCurve__FfP5Vec3fP5Vec3f + +// hkMath +802a0bcc:fabs__6hkMathFf +802a0bcc:__fabs__6hkMathFf +80291dd8:max2f__6hkMathFff +802a0bf8:sqrt__6hkMathFf +8032ca40:acos__6hkMathFf + +// CameraController +8009c69c:changeInput__16CameraControllerFQ216CameraController4Kind +8009be74:getInstance__16CameraControllerFv +8009cf60:setRangeOffset__16CameraControllerFP5Vec2f +8009ca00:getCameraController__16CameraControllerFQ216CameraController4Kind +8009cea8:setCameraRange__16CameraControllerF16CameraControllerP6Rect2D + + +// cmAnimationController +800a624c:setScnAnmRes__21cmAnimationControllerFQ34nw4r3g3d9ResAnmScnUl +800a6348:releaseScnAnmRes__21cmAnimationControllerFv + +// cmSubjectList +8009ece8:getSubjectByPlayerNo__13cmSubjectListFUl + +// clTarget +27,1,00038C68:__ct__8clTargetFv +27,1,00038C78:__dt__8clTargetFv + +// soArrayVectorCalculator +27,1,000C275C:erase__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacelllll +27,1,000C261C:insert__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacelbllll +27,1,000C2954:push__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfaceblll +27,1,000C285C:unshift__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfaceblll +27,1,000C2A88:clear__23soArrayVectorCalculatorFR26soArrayVectorCalcInterface +27,1,000C29F4:pop__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacebll +27,1,000C28EC:shift__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacebll +27,1,000C2AF0:postInitialize__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacell +27,1,000C2B5C:resize__23soArrayVectorCalculatorFR26soArrayVectorCalcInterfacelbblll + +// soArrayList +27,1,0021cb30:at__18soArrayListFl +27,1,0025ea94:clear__18soArrayListFv +27,1,0025ebf8:at__18soArrayListCFl +27,1,0025ec74:unshift__18soArrayListFRCUl +27,1,0025eccc:shift__18soArrayListFv +27,1,0025ed08:push__18soArrayListFRCUl +27,1,0025ed78:pop__18soArrayListFv +27,1,0025edcc:insert__18soArrayListFlRCUl +27,1,0025ee24:erase__18soArrayListFl +27,1,0025ee5c:isFull__18soArrayListCFv +27,1,0025ee6c:set__18soArrayListFlRCUll +27,1,0025ef44:isNull__18soArrayListCFv + +27,1,000735C8:getInt__16soAnimCmdArgListFUl +27,1,000736B8:getFloat__16soAnimCmdArgListFUl +27,1,000737DC:getBool__16soAnimCmdArgListFUl +27,1,0007388C:getValueIndex__16soAnimCmdArgListFUl + +// soEventSystem +27,1,0008F064:getInstance__13soEventSystemFv +27,1,0008F1BC:getManager__13soEventSystemFl + +// soGroundUtil +27,1,00030EC8:checkDeadArea__12soGroundUtilFP5Vec3fff + +// soGroundShapeImpl +27,1,0002F9A4:updateRhombus__17soGroundShapeImplFP16soModuleAccesser +27,1,0002FC10:updateRhombusFollowNode__17soGroundShapeImplFP16soModuleAccesser +27,1,0002F190:updateRhombusModify__17soGroundShapeImplFP16soModuleAccesser + +// soPostureModuleImpl +27,1,00023364:__ct__19soPostureModuleImplFP16soModuleAccesserP34soArray<23soInterpolation<5Vec3f>>P31soEventObserverRegistrationDesc +27,1,000234F0:__dt__19soPostureModuleImplFv + +// soCollisionGroup +27,1,00037C80:__ct__16soCollisionGroupFv +27,1,00037B04:__dt__16soCollisionGroupFv + +// soCollisionAttackModuleImpl +27,1,00039590:__ct__27soCollisionAttackModuleImplFP16soModuleAccesseriQ26gfTask8CategoryP32soArray<21soCollisionAttackPart>P27soArray<16soCollisionGroup>P36soArray<25soCollisionAttackAbsolute>P31soEventObserverRegistrationDescb +27,1,00039968:__dt__27soCollisionAttackModuleImplFv + +// soCollisionAttackAbsolute +27,1,000C94BC:__ct__25soCollisionAttackAbsoluteFv +27,1,00086D0C:__dt__25soCollisionAttackAbsoluteFv + +// soCollisionAttackPart +27,1,00038550:__ct__21soCollisionAttackPartFQ211soCollision8Categoryb +27,1,000CCDA8:__ct__21soCollisionAttackPartFv +27,1,000386B4:__dt__21soCollisionAttackPartFv + +// soCollisionHitGroup +27,1,00041B00:__dt__19soCollisionHitGroupFv +27,1,00041AE0:__ct__19soCollisionHitGroupFv + +// soCollisionHitPart +27,1,000415E4:__dt__18soCollisionHitPartFv +27,1,0004148C:__ct__18soCollisionHitPartFQ211soCollision8CategoryUl +27,1,000CC22C:__ct__18soCollisionHitPartFv + +// soCollisionHitModule +27,1,00042E4C:__dt__24soCollisionHitModuleImplFv +27,1,00042AA4:__ct__24soCollisionHitModuleImplFP16soModuleAccesseriQ26gfTask8CategoryP29soArray<18soCollisionHitPart>P27soArray<16soCollisionGroup>P30soArray<19soCollisionHitGroup>P31soEventObserverRegistrationDescb + +// soTransitionTerm +27,1,000775AC:checkEstablish__16soTransitionTermFP16soModuleAccesserPUlPv +27,1,00077668:addGeneralTerm__16soTransitionTermFP13soGeneralTerm +27,1,0007773C:clearGeneralTerm__16soTransitionTermFv + +// soTransitionTermGroup +27,1,000AB2F4:checkEstablish__21soTransitionTermGroupFP16soModuleAccesserPUlPiPUlPUsPv +27,1,000AB428:enableTerm__21soTransitionTermGroupFi +27,1,000AB550:unableTerm__21soTransitionTermGroupFi +27,1,000AB638:enableTermAll__21soTransitionTermGroupFv +27,1,000AB6C8:unableTermAll__21soTransitionTermGroupFv +27,1,000AB758:addTerm__21soTransitionTermGroupFiUlP16soTransitionTermPUs +27,1,000ABBDC:addGeneralTerm__21soTransitionTermGroupFiP13soGeneralTerm +27,1,000ABD14:addGeneralTermLastTerm__21soTransitionTermGroupFP13soGeneralTerm +27,1,000ABE4C:clearTransitionTermAll__21soTransitionTermGroupFv + +// soGeneralTermCache +27,1,0007B38C:clearAll__18soGeneralTermCacheFv +27,1,0007B3AC:clearController__18soGeneralTermCacheFv +27,1,0007B3C4:isFlag__18soGeneralTermCacheFUlPUc +27,1,0007B418:setFlag__18soGeneralTermCacheFUlb +27,1,0007B468:isButtonOn__18soGeneralTermCacheFUlPUc +27,1,0007B4BC:setButtonOn__18soGeneralTermCacheFUlb +27,1,0007B50C:isButtonTrigger__18soGeneralTermCacheFUlPUc +27,1,0007B560:setButtonTrigger__18soGeneralTermCacheFUlb + +// soDamageUtilActor +27,1,00063558:getDamageAngle__17soDamageUtilActorFP16soModuleAccesserddiP5Vec2f + +// Stage +27,1,002225A8:createObj__5StageFv +27,1,0022269C:createObjPokeTrainer__5StageFP9gfArchiveiPCcP5Vec3fP5Vec3f +27,1,002227b0:addGround__5StageFP6Ground +27,1,00222850:getGround__5StageFi +27,1,00222830:getGroundNum__5StageFv +27,1,00222904:registScnAnim__5StageFPQ34nw4r3g3d11ResFileDataUl +27,1,00222ab0:createCollision__5StageFP9gfArchiveiP6Ground +27,1,00224574:createStagePositions__5StageFv +27,1,00224524:createStagePositions__5StageFPQ34nw4r3g3d7ResFile +27,1,002237D0:loadStageAttrParam__5StageFP9gfArchivei +27,1,002257B4:getPokeTrainerPointNum__5StageFv +27,1,002257B0:getPokeTrainerPointData__5StageFPii +27,1,002257A4:getPokeTrainerPositionZ__5StageFv +27,1,0022579C:getPokeTrainerDrawLayer__5StageFv +27,1,00225794:isAdventureStage__5StageFv +27,1,002225ac:initPosPokeTrainer__5StageFii +27,1,00224AF4:getItemPac__5StageFPP9gfArchivePP9gfArchive6itKindi +27,1,00224AF8:getItemGenPac__5StageFPP9gfArchive +27,1,00224AFC:getItemPacEnemyFigure__5StageFPP9gfArchive +27,1,00224B00:getEnemyPac__5StageFPP9gfArchivePP9gfArchivePP9gfArchivePP9gfArchive6emKind +27,1,00224B04:getAdvRadarData__5StageFPP9gfArchivePP9gfArchive +27,1,00221B68:initializeStage__5StageFv +27,1,00221F80:closeStage__5StageFv +27,1,00222AAC:renderDebugPositions__5StageFv +27,1,00222588:loading__5StageFv +27,1,002227AC:process__5StageFv +27,1,002245B8:updateStagePositions__5StageFv +27,1,002246AC:debugCollision__5StageFv +27,1,001ED054:getAIRange__5StageFv +27,1,0008C01C:getDefaultLightSetIndex__5StageFv +27,1,002227E0:getZoneLightSetIndex__5StageFv +27,1,00225778:getScrollDir__5StageFP5Vec3f +27,1,00222B54:clearCameraParam__5StageFv +27,1,00222B98:initCameraParam__5StageFv +27,1,00222590:startLoadLocalData__5StageFv +27,1,00222594:isLoadLocalData__5StageFv +27,1,0022259C:entryLocalData__5StageFv +27,1,002225A4:removeLocalData__5StageFv +27,1,00225774:appearanceFighterLocal__5StageFv +27,1,0022341C:getFighterStartPos__5StageFP5Vec3fi +27,1,00223458:getFighterReStartPos__5StageFP5Vec3fi +27,1,00223494:isReStartSamePoint__5StageFv +27,1,0022349C:getPokeTrainerStartPos__5StageFP5Vec3fUl +27,1,002234D8:getItemPosCount__5StageFv +27,1,002234F4:getItemPos__5StageFP5Vec3fP5Vec3fUl +27,1,0022353C:getRandItemPos__5StageFP5Vec3f +27,1,00223564:getKirifudaPos__5StageFP5Vec3fUl +27,1,002235D4:getKirifudaAngle__5StageFUl +27,1,00223620:getKirifudaScale__5StageFP5Vec3fUl +27,1,0022368C:getKirifudaModelType__5StageFUl +27,1,002236CC:getPokeTrainerPosCount__5StageFv +27,1,002236D4:getPokeTrainerPos__5StageFP5Vec3fP5Vec3fUl +27,1,002237A0:getFighterDeadEffectSizeRate__5StageFv +27,1,002237A8:getEnemyDeadEffectSizeRate__5StageFv +27,1,002237B0:getEnableZ__5StageFv +27,1,00225764:getBgmID__5StageFv +27,1,0022576C:getBgmID__5StageCFv +27,1,0022575C:getNowStepBgmID__5StageFv +27,1,00225754:getBgmOptionID__5StageFv +27,1,0022574C:isBgmChange__5StageFv +27,1,00225738:getBgmChangeID__5StageFPUlPf +27,1,00225728:setBgmChange__5StageFfbUl +27,1,0022571C:getBgmVolume__5StageFv +27,1,00225710:getBgmPlayOffsetFrame__5StageFv +27,1,00225708:isNextStepBgmEqualNowStepBgmFromFlag__5StageFv +27,1,00225700:setFrameRuleTime__5StageFf +27,1,001E9658:getFrameRuleTime__5StageFv +27,1,002256FC:notifyTimmingGameStart__5StageFv +27,1,0022487C:isEnd__5StageFv +27,1,00224884:isEventEnd__5StageFiPiPi +27,1,00224798:enableDevil__5StageFv +27,1,002247B8:disableDevil__5StageFv +27,1,002247D8:isDevil__5StageFv +27,1,002247E0:setDevilScrool__5StageFff +27,1,0022485C:getLucarioFinalTechniquePosition__5StageFP5Vec3f +27,1,00224B40:startAppear__5StageFv +27,1,00224B5C:setAppearKind__5StageFUc +27,1,00224B58:endAppear__5StageFv +27,1,00224DAC:getAppearTask__5StageFv +27,1,00224DB4:forceStopAppear__5StageFv +27,1,0022488C:getFinalTechniqColor__5StageFv +27,1,00224898:setMotionRatio__5StageFff +27,1,002248F0:saveMotionRatio__5StageFi +27,1,00224914:restoreMotionRatio__5StageFi +27,1,00224938:setMotionSubRatio__5StageFff +27,1,00224990:saveMotionSubRatio__5StageFi +27,1,002249B4:restoreMotionSubRatio__5StageFi +27,1,000B319C:isCameraLocked__5StageFv +27,1,002256F4:isBossBattleMode__5StageFv +27,1,002256EC:isSimpleBossBattleMode__5StageFv +27,1,00224B48:isAppear__5StageFv +27,1,00224B50:isStartAppearTimming__5StageFv +27,1,00224B60:getMadeinAiData__5StageFv +27,1,00224B68:isBamperVector__5StageFv +27,1,00224B70:getBamperVector__5StageFP5Vec3f +27,1,002249D8:notifyEventInfoReady__5StageFv +27,1,002249DC:notifyEventInfoGo__5StageFv +27,1,00224B08:getDestroyBossParamCommon__5StageFUl +27,1,00224B3C:stAdventureEventGetItem__5StageFi6itKindiii +27,1,00224D88:setStageOutEffectInit__5StageFv +27,1,00224D98:setStageInEffectInit__5StageFv +27,1,002256E4:helperStarWarp__5StageFv +27,1,002256DC:initializeFighterAttackRatio__5StageFv +27,1,002256D8:startFighterEvent__5StageFv +27,1,00224D5C:getZoneState__5StageFv +27,1,00224D64:getZonePos__5StageFP5Vec3f +27,1,00224D68:getMagmaHeight__5StageFv +27,1,00224D74:getAcidHeight__5StageFv +27,1,00224D80:getIteamDropStatus__5StageFv +27,1,002256D0:createWind2ndOnly__5StageFv +27,1,002256C8:getWind2ndOnlyData__5StageFv +27,1,002256C4:updateWind2ndOnly__5StageFv +27,1,00224DA8:setVision__5StageFUc +27,1,00222190:processBegin__5StageFv +27,1,00222288:processAnim__5StageFv +27,1,002224cc:processUpdate__5StageFv +27,1,002224d0:processMapCorrection__5StageFv +27,1,002224d4:processFixCamera__5StageFv +27,1,00222520:processEnd__5StageFv +27,1,00222574:renderPre__5StageFv +27,1,00222aa8:renderDebug__5StageFv +27,1,00221d48:__dt__5StageFv +27,1,00223140:testStageParamInit__5StageFP9gfArchivei +27,1,00223320:stageParamChange__5StageF +27,1,00223398:testStageDataInit__5StageFP9gfArchiveii +27,1,00223A10:initSoundParameters__5StageFv +27,1,00223B6C:setSoundParameters__5StageFP7stParam +27,1,0022269c:createObjPokeTrainer__5StageFP9gfArchiveiPCcii +27,1,002227E8:removeGround__5StageFP6Ground +27,1,00223A08:setStageAttackData__5StageFP20grGimmickDamageFloorUl +27,1,00222794:setStageData__6GroundFPv +27,1,002249E0:isPokemonTrainer__5StageFP5Stage + +// stCommonGimmick +27,1,002380b0:releaseArchive__15stCommonGimmickFv +27,1,00238018:createGimmickCollision__15stCommonGimmickFUlP6GroundP9gfArchive +27,1,00237E18:createGimmickBeltConveyor2__15stCommonGimmickFP25grGimmickBeltConveyorData +27,1,00237D20:createGimmickLadder__15stCommonGimmickFP19grGimmickLadderDataP9gfArchive +27,1,00237E60:createGimmickWaterArea__15stCommonGimmickFP18grGimmickWaterData +27,1,00237DD0:createGimmickWind2__15stCommonGimmickFP17grGimmickWindData +27,1,00237EA8:createGimmickHitPointEffectArea__15stCommonGimmickFP27grGimmickHitPointEffectData + +// stClassInfo +27,1,002257bc:__ct__11stClassInfoFv +27,1,002258fc:setClassInfo__11stClassInfoFQ26Stages11srStageKindP11stClassInfo +27,1,002258a8:__dt__11stClassInfoFv + +// stMelee +27,1,00238bdc:__ct__7stMeleeFPCcQ26Stages11srStageKind +27,1,002395bc:processBegin__7stMeleeFv +27,1,002395c0:processUpdate__7stMeleeFv +27,1,00239660:update__7stMeleeFf +27,1,002394cc:setCameraLimitRange__7stMeleeFffff +27,1,00239534:resetCameraLimitRange__7stMeleeFv +27,1,00239ae4:checkChangeScene__7stMeleeFv +27,1,00239aec:resetChangeScene__7stMeleeFv +27,1,00239af0:setChangeSceneNumber__7stMeleeFl +27,1,00238dec:__dt__7stMeleeFv +27,1,0023A068:getItemGenPac__7stMeleeFPP9gfArchive +27,1,002398E0:getFighterStartPos__7stMeleeFP5Vec3fi +27,1,00239974:getFighterReStartPos__7stMeleeFP5Vec3fi +27,1,00239274:createWind2ndOnly__7stMeleeFv +27,1,002394A4:updateWind2ndOnly__7stMeleeFv +27,1,0023959C:zoomInCamera__7stMeleeFv +27,1,00239574:zoomOutCamera__7stMeleeFff +27,1,00238DB4:setPlayerPositionIndexSerial__7stMeleeFv +27,1,002399FC:playSeBasic__7stMeleeF5SndIDf +27,1,00239A84:stopSeBasic__7stMeleeFif +21,1,00239ACC:setSePan__7stMeleeFif +27,1,002398C8:getPlayerPosition__7stMeleeFiP5Vec3f +27,1,00238EB0:setGravityHalf__7stMeleeFv +27,1,00238E90:setGravityNormal__7stMeleeFv +27,1,00238ED0:createCollisionSelf__7stMeleeFP15stCollisionWorkP6GroundPCcPCcUs + +// stEnemyIdManager +27,1,0025e71c:create__16stEnemyIdManagerFv +27,1,0025e7e0:remove__16stEnemyIdManagerFv + +// stUtility +27,1,00227BEC:stRayCheck__FP5Vec3fP5Vec3fbP11grCollisionbUc +27,1,00227CC4:stRayCheck__FP5Vec3fP5Vec3fP5Vec3fP5Vec3fbP11grCollisionbUc +27,1,00227DD8:stRayCheck__FP5Vec3fP5Vec3fPiP5Vec3fP5Vec3fbbUc + +// grCollision +80111958:getJoint__11grCollisionFUs +80111b50:getLine__11grCollisionFUs +801119bc:getSegment__11grCollisionFP11clSegment2DP15grCollisionLine + +// grCollisionJoint +80112ea0:getLine__16grCollisionJointFUs + +// grCollStatus +801342c8:getPos__12grCollStatusFP5Vec2f + +// stCollision +27,1,00239F50:initialize__15stCollisionWorkFv + +// Ground +27,1,00261b50:setDontMoveGround__6GroundFv +27,1,0025f64c:loadGroundData__6GroundFQ34nw4r3g3d7ResFileUlQ211gfSceneRoot9LayerType +27,1,0025fbcc:setupMelee__6GroundFv +27,1,0025fbe8:processAnim__6GroundFv +27,1,00260834:processGameProc__6GroundFv +27,1,00261d70:renderPre__6GroundFv +27,1,00260534:setVisibilityByClipping__6GroundFUl +27,1,002606a0:setVisibilityAttachedEffect__6GroundFUl +27,1,00260838:receiveCollMsg__6GroundFiP12grCollStatusP16grCollisionJoint +27,1,00260910:receiveCollMsg_Landing__6GroundFP12grCollStatusP16grCollisionJointb +27,1,00260914:receiveCollMsg_Heading__6GroundFP12grCollStatusP16grCollisionJointb +27,1,00260918:receiveCollMsg_Wall__6GroundFP12grCollStatusP16grCollisionJointb +27,1,0026091c:receiveCollMsg_Attack__6GroundFP12grCollStatusP16grCollisionJoint +27,1,00228dd8:getModelCount__6GroundFv +27,1,0025fa34:unloadData__6GroundFv +27,1,00230728:setMdlIndex__6GroundFi +27,1,00260B48:getNodeIndex__6GroundFUlPCc +27,1,00260BDC:getNodeIndex__6GroundFPUlUlPCc +27,1,00260c84:getNodePosition__6GroundFP5Vec3fUlUl +27,1,00260d78:getNodePosition__6GroundFP5Vec3fUlPCc +27,1,00260e88:getNodeMatrix__6GroundFP6MatrixUlUl +27,1,00260f48:getNodeMatrix__6GroundFP6MatrixUlPCc +27,1,0026102c:setNodeVisibility__6GroundFbUlUlbb +27,1,002611dc:setNodeVisibility__6GroundFbUlPCcbb +27,1,002612ac:setNodeVisibilityAll__6GroundFbUl +27,1,002613ac:isNodeVisible__6GroundFUlUl +27,1,00261434:setNodeCollision__6GroundFbUlUlb +27,1,002615ec:setNodeCollision__6GroundFbUlPCcb +27,1,00261718:getNodeScale__6GroundFP5Vec3fUlUl +27,1,002617d8:getNodeScale__6GroundFP5Vec3fUlPCc +27,1,00231b80:setInitializeInfo__6GroundFi +27,1,00231b78:getInitializeInfo__6GroundFi +27,1,0025fd1c:setMotionFrame__6GroundFfUl +27,1,0025fd38:getMotionFrame__6GroundFUl +27,1,0025fd60:setMotionLoop__6GroundFbUl +27,1,0025fd7c:setMatAlphaMul__6GroundFUlUl +27,1,0025feec:setMatAlpha__6GroundFUlUl +27,1,0025ffe0:updateG3dProcCalcWorld__6GroundFv +27,1,00231b70:adventureEventGetItem__6GroundFiP13stTriggerData +27,1,00231BBC:getStageData__6GroundFv +27,1,00231BB8:initStageData__6GroundFv +27,1,00231BB0:getMdlIndex__6GroundFv +27,1,00231BA4:isEnableCalcCollision__6GroundFv +27,1,00231B94:enableCalcCollision__6GroundFv +27,1,00231B84:disableCalcCollision__6GroundFv +27,1,00261EA8:setInitializeFlag__6GroundFv +27,1,002618c0:setEnableCollisionStatus__6GroundFb +27,1,00261a90:isCollisionStatusOwnerTask__6GroundFP12grCollStatusPQ26Ground16CollCategoryFlag +27,1,0026022C:setVisibility__6GroundFUl +27,1,00261950:setValid__6GroundFUl +27,1,002619F0:setValidAttachedEffect__6GroundFUl +27,1,00261B3C:preExit__6GroundFv +27,1,00260924:startup__6GroundFP9gfArchiveUlQ211gfSceneRoot9LayerType + +// grGimmick +27,1,0026A314:__ct__9grGimmickFPCc +27,1,0026A450:__dt__9grGimmickFv +27,1,0026A790:processUpdate__9grGimmickFv +27,1,0026A804:update__9grGimmickFf +27,1,0026A5E4:startup__9grGimmickFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,0026DE2C:renderDebug__9grGimmickFv +27,1,0026daf4:setTransparency__9grGimmickFUl +27,1,0026C8C8:bindData__9grGimmickFP9gfArchive +27,1,0026D798:setVisibilityAttachedEffect__9grGimmickFUl +27,1,0026b25c:setNode__9grGimmickFv +27,1,0026b1c0:setTgtNode__9grGimmickFPCc +27,1,0026c2f8:setMotionRatio__9grGimmickFf +27,1,0026d940:invalidatedByCameraClipping__9grGimmickFv +27,1,0026DAF4:setTransparency__9grGimmickFUlUl +27,1,0026d938:setTransparencyFlag__9grGimmickFc +27,1,0026b0f8:updateCallback__9grGimmickFUl +27,1,0026b17c:fixedPosition__9grGimmickFf +27,1,0026b254:getTgtNode__9grGimmickFv +27,1,00231bcc:getGimmickData__9grGimmickFv +27,1,0026bcc0:changeNodeAnim__9grGimmickFUlUl +27,1,0026BFBC:changeTexSrtAnim__9grGimmickFUlUl +27,1,0026BDC0:changeVisibleAnim__9grGimmickFUlUl +27,1,0026a5e8:createFadeVisibleProduction__9grGimmickFf +27,1,0026a664:createSoundEffectVisibleProductionForExcel__9grGimmickFUlUlUl +27,1,0026a6b8:createEffectVisibleProductionForExcel__9grGimmickFPQ29grGimmick16SimpleEffectDataPUlPP19grVisibleProduction +27,1,0026a708:setSimpleEffectVisibleProduction__9grGimmickFv +27,1,0026daf0:dbDispInvalidatedByCameraClippingSphere__9grGimmickFv +27,1,002304CC:setGimmickData__9grGimmickFPv +27,1,00231BC4:getTransparencyFlag__9grGimmickFv +27,1,0026BB1C:makeCalcuCallback__9grGimmickFUlQ25Heaps8HeapType +27,1,0026BC9C:setCalcuCallbackRoot__9grGimmickFUl +27,1,0026dbd0:getPos__9grGimmickFv +27,1,0026db8c:setPos__9grGimmickFP5Vec3f +27,1,0026DBB4:setPos__9grGimmickFfff +27,1,0026DC7C:getRot__9grGimmickFv +27,1,0026DC38:setRot__9grGimmickFP5Vec3f +27,1,0026DC60:setRot__9grGimmickFfff +27,1,0026DD00:getScale__9grGimmickFv +27,1,0026DCBC:setScale__9grGimmickFP5Vec3f +27,1,0026DCE4:setScale__9grGimmickFfff +27,1,0026B34C:createAttachMotionPath__9grGimmickFP23grGimmickMotionPathInfoP13stTriggerDataPCc +27,1,0026DA8C:createSimpleEffectData__9grGimmickFPQ29grGimmick16SimpleEffectDataiPCc +27,1,0026CB94:createIsValidTrigger__9grGimmickFP13stTriggerData +27,1,0026D124:createEffectWork__9grGimmickFi +27,1,0026D22C:startGimmickEffect__9grGimmickFUl +27,1,0026CE10:startGimmickSE__9grGimmickFUl +27,1,0026D264:stopGimmickEffect__9grGimmickFUl +27,1,0026D08C:stopGimmickSE__9grGimmickFUl +27,1,0026ACA8:updataGimmickEffect__9grGimmickFf +27,1,0026CCA0:createSoundWork__9grGimmickFUlUl +27,1,0026C1BC:changeShapeAnim__9grGimmickFUlUl +27,1,0026C0BC:changeMatColAnim__9grGimmickFUlUl +27,1,0026BEBC:changeTexAnim__9grGimmickFUlUl + +// grYakumono +27,1,00264c80:__ct__10grYakumonoFPCc +27,1,00264cc4:__dt__10grYakumonoFv +27,1,00264d1c:processUpdate__10grYakumonoFv +27,1,00264f58:startup__10grYakumonoFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,00264f5c:setValid__10grYakumonoFUl +27,1,0026501c:setValidAttachedEffect__10grYakumonoFUl +27,1,00267ab8:preExit__10grYakumonoFv +27,1,00267a10:setTransparency__10grYakumonoFUlUl +27,1,00264dd4:onDamage__10grYakumonoFiP8soDamageP20soDamageAttackerInfo +27,1,00264DE4:onInflict__10grYakumonoFP14soCollisionLogUlf +27,1,00264DE8:onInflictEach__10grYakumonoFP14soCollisionLogf +27,1,00264DEC:onGimmickEvent__10grYakumonoFP18soGimmickEventArgsPi +27,1,002650DC:enableYakumono__10grYakumonoFUl +27,1,00265160:disableYakumono__10grYakumonoFUlUl +27,1,002651D4:enableHit__10grYakumonoFUlUl +27,1,00265214:disableHit__10grYakumonoFUlUl +27,1,00265254:disableAttack__10grYakumonoFUl +27,1,002652BC:enableArea__10grYakumonoFv +27,1,00265300:disableArea__10grYakumonoFv +27,1,00265344:setSleepArea__10grYakumonoFb +27,1,00265390:setTeamYakumonoOwnerId__10grYakumonoFUl +27,1,002653C8:setTeamYakumono__10grYakumonoFUlUl +27,1,00265424:getTeamYakumono__10grYakumonoFPi +27,1,0026546C:setOffsetAttack__10grYakumonoFP5Vec3fi +27,1,00265480:setAreaGimmick__10grYakumonoFP10soAreaDataP19soSet<10soAreaData>P10ykAreaDatab +27,1,00267548:setAttackGimmick__10grYakumonoFiiUlPQ29grGimmick10AttackDataPQ29grGimmick13AttackDetails +27,1,002675E0:setSoCollisionAttackData__10grYakumonoFP21soCollisionAttackDataPQ29grGimmick10AttackDataPQ29grGimmick13AttackDetails +27,1,002677AC:setAttackGimmickDetails__10grYakumonoFP21soCollisionAttackDataffffiP5Vec3fiiiiUlUlUlbUlQ221soCollisionAttackData9AttributeQ221soCollisionAttackData10SoundLevelQ221soCollisionAttackData14SoundAttributebbbbbbUlUlbbbQ221soCollisionAttackData7LrCheckbbbbbQ221soCollisionAttackData6Regionb +27,1,00267924:isEnableAttackPersonAttacked__10grYakumonoFUlUlUl +27,1,002679E8:isEnableAttackAttribute__10grYakumonoFUlUl +27,1,00267AF4:setSituationODD__10grYakumonoFv +27,1,002652A8:setSleepHit__10grYakumonoFb +27,1,00265294:setSleepAttack__10grYakumonoFb +27,1,00264EE4:getPlayerNumber__10grYakumonoFP12grCollStatus +27,1,00264DF0:getPlayerNumber__10grYakumonoFPi +27,1,00264E5C:isSubFighter__10grYakumonoFPi + +// grGimmickSpring +27,1,0026FC6C:__ct__15grGimmickSpringFPCc +27,1,0026FCC8:__dt__15grGimmickSpringFv +27,1,0026FD20:update__15grGimmickSpringFf +27,1,0026FFC4:startup__15grGimmickSpringFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,0027020C:setInitializeFlag__15grGimmickSpringFv +27,1,002702A8:disableArea__15grGimmickSpringFv +27,1,00270310:setSleepArea__15grGimmickSpringFb +27,1,00270384:onGimmickEvent__15grGimmickSpringFP18soGimmickEventArgsPi +27,1,0026FFB4:getTopNode__15grGimmickSpringFP5Vec3f +27,1,00270464:presentPosEvent__15grGimmickSpringFv +27,1,0026FF18:setMotionOff__15grGimmickSpringFv + +// grGimmickLadder +27,1,0026F6C4:__ct__15grGimmickLadderFPCc +27,1,0026F734:__dt__15grGimmickLadderFv +27,1,0026F940:setInitializeFlag__15grGimmickLadderFv +27,1,0026F78C:startup__15grGimmickLadderFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,0026F9DC:update__15grGimmickLadderFf +27,1,0026FA14:getUpperNode__15grGimmickLadderFP5Vec3f +27,1,0026FA84:getUnderNode__15grGimmickLadderFP5Vec3f +27,1,0026FAF4:disableArea__15grGimmickLadderFv +27,1,0026FB5C:setSleepArea__15grGimmickLadderFb + +// grGimmickCatapult +27,1,00274708:__dt__17grGimmickCatapultFv +27,1,00274824:processFixPosition__17grGimmickCatapultFv +27,1,00274760:update__17grGimmickCatapultFf +27,1,002749CC:startup__17grGimmickCatapultFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,00274DF4:onGimmickEvent__17grGimmickCatapultFP18soGimmickEventArgsPi +27,5,58B78:__vt__17grGimmickCatapult + +// grGimmickWarpZone +27,1,00274078:__ct__17grGimmickWarpZoneFPCc +27,1,002740EC:__dt__17grGimmickWarpZoneFv +27,1,0027455C:update__17grGimmickWarpZoneFf +27,1,00274168:startup__17grGimmickWarpZoneFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,002744C0:setInitializeFlag__17grGimmickWarpZoneFv +27,1,00274594:onGimmickEvent__17grGimmickWarpZoneFP18soGimmickEventArgsPi +27,1,00274144:setWarpAttrData__17grGimmickWarpZoneFP5Vec3fUcb + +// grYakumonoPunchSlider +27,1,00268B18:__ct__21grYakumonoPunchSliderFPCc +27,1,00268BCC:__dt__21grYakumonoPunchSliderFv +27,1,00268C24:update__21grYakumonoPunchSliderFf +27,1,0026907C:startup__21grYakumonoPunchSliderFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,002698C0:onDamage__21grYakumonoPunchSliderFiP8soDamageP20soDamageAttackerInfo +27,1,00269A6C:onInflict__21grYakumonoPunchSliderFP14soCollisionLogUlf +27,1,00268F5C:updateMove__21grYakumonoPunchSliderFf +27,1,00268FE4:createMotionPath__21grYakumonoPunchSliderFv +27,1,00269830:setCulcCallback__21grYakumonoPunchSliderFP9gfArchive + +// grMadein +27,1,0027583C:__ct__8grMadeinFPCc +27,1,00275928:__dt__8grMadeinFv +27,1,00275A98:startup__8grMadeinFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,00279D50:onDamage__8grMadeinFiP8soDamageP20soDamageAttackerInfo +27,1,00279E04:onInflictEach__8grMadeinFP14soCollisionLogf +27,1,00278c54:update__8grMadeinFf +27,1,00275778:create__8grMadeinFiPCcPCcQ25Heaps8HeapType +27,1,00279f14:receiveCollMsg_Landing__8grMadeinFP12grCollStatusP16grCollisionJointb +27,1,00278DC4:setTgtNode__8grMadeinFPCc +27,1,00278DC8:getTgtNode__8grMadeinFv +27,1,00278494:setHitPoint__8grMadeinFfP5Vec3fP5Vec3fbi +27,1,00278584:setAttack__8grMadeinFfP5Vec3f +27,1,002759D8:getOverwriteAttackData__8grMadeinFv +27,1,00278DD0:initializeEntity__8grMadeinFv +27,1,00278618:createAttackPointNormal__8grMadeinFP21soCollisionAttackData +27,1,00278E38:startEntity__8grMadeinFv +27,1,0027928C:startEntityAutoLoop__8grMadeinFv +27,1,00279590:setMotion__8grMadeinFUl +27,1,00279968:setMotionDetails__8grMadeinFUlUlUlUlUl +27,1,0027855C:deleteHitPoint__8grMadeinFv +27,1,00278C30:deleteAttackPoint__8grMadeinFv +27,1,00279044:endEntity__8grMadeinFv +27,1,002792C8:isEndEntity__8grMadeinFv +27,1,002794CC:getEntityFrame__8grMadeinFv +27,1,002794F0:isFrameOffset__8grMadeinFf + +// grGimmickMotionPath +27,1,0026E1C8:__ct__19grGimmickMotionPathFPCcPCc +27,1,0026E90C:update__19grGimmickMotionPathFf +27,1,0026E2A4:__dt__19grGimmickMotionPathFv +27,1,0026E43C:processAnim__19grGimmickMotionPathFv +27,1,0026EE70:loadGroundData__19grGimmickMotionPathFQ34nw4r3g3d7ResFileUlQ211gfSceneRoot9LayerType +27,1,0026F064:getModelCount__19grGimmickMotionPathFv +27,1,0026E2FC:startup__19grGimmickMotionPathFP9gfArchiveUlQ211gfSceneRoot9LayerType +27,1,0026EAE4:isMoveEnd__19grGimmickMotionPathFv +27,1,0026EB00:isReturnEnd__19grGimmickMotionPathFv +27,1,0026E964:setFrameModelAnim__19grGimmickMotionPathFv +27,1,0026F03C:clearFrame__19grGimmickMotionPathFv +27,1,0026EB3C:setFrameUpdate__19grGimmickMotionPathFf +27,1,0026E13C:create__19grGimmickMotionPathFiPCcPCc +27,1,0026EB5C:setFrame__19grGimmickMotionPathFf +27,1,0026EB64:getFrame__19grGimmickMotionPathFv +27,1,0026EC24:startMove__19grGimmickMotionPathFv +27,1,0026ECCC:startMove__19grGimmickMotionPathFf +27,1,0026EFF4:isEndFrame__19grGimmickMotionPathFv +27,1,0026EFD8:isStartFrame__19grGimmickMotionPathFv +27,1,0026EFA0:applyEndFrame__19grGimmickMotionPathFv +27,1,0026EB6C:getTRS__19grGimmickMotionPathFP5Vec3fP5Vec3fP5Vec3f +27,1,0026EDF0:stopStartSE__19grGimmickMotionPathFv + +// grStadiumVision +27,1,0027AAF8:create__15grStadiumVisionFiPCcPCc +27,1,0027ADF8:setDisplay__15grStadiumVisionFb + +// StageObject +27,1,00003C64:activate__11StageObjectFffP5Vec3fb + +// soCollisionHitGroup +27,1,000426AC:setInvincibleGlobal__19soCollisionHitGroupFv + +// soValueAccesser +27,1,0008C0D8:getVariableFloat__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C158:getVariableInt__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C1D8:getVariableIndefinite__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C258:getConstantFloat__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C338:getConstantInt__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C418:getConstantIndefinite__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C500:getValueFloat__15soValueAccesserFP16soModuleAccesserUlUl +27,1,0008C6F0:getValueInt__15soValueAccesserFP16soModuleAccesserUlUl + +// soExternalValueAccesser +27,1,0008CB0C:getTeamNo__23soExternalValueAccesserFP11StageObject +27,1,0008C9CC:getModuleAccesser__23soExternalValueAccesserFP11StageObject +27,1,0008C9D4:getPos__23soExternalValueAccesserFP11StageObject +27,1,0008CAB4:getLr__23soExternalValueAccesserFP11StageObject +27,1,0008CBF4:getStatusKind__23soExternalValueAccesserFP11StageObject +27,1,0008CC4C:getSituationKind__23soExternalValueAccesserFP11StageObject +27,1,0008CCFC:getWorkFlag__23soExternalValueAccesserFP11StageObjectUl +27,1,0008CCC4:getWorkInt__23soExternalValueAccesserFP11StageObjectUl +27,1,0008CB9C:getTeamOwnerId__23soExternalValueAccesserFP11StageObject + +// ftExternalValueAccesser +27,1,0014d4b8:getWeight__23ftExternalValueAccesserFP7Fighter +27,1,0014D19C:getHipPos__23ftExternalValueAccesserFP7Fighter + +// soAnimCmdEventObserver +27,5,00000358:__vt__22soAnimCmdEventObserver +27,5,00000494:__vt__41soEventObserver<22soAnimCmdEventObserver>Fii +27,1,000077B8:addObserver__41soEventObserver<22soAnimCmdEventObserver>Fii + +// soStatusEventObserver +27,5,00000F98:__vt__21soStatusEventObserver +27,1,000133C8:addObserver__21soStatusEventObserverFsSc +27,1,00013628:notifyEventChangeStatus__21soStatusEventObserverFiiP12soStatusDataP16soModuleAccesser +27,1,000136E4:addObserver__40soEventObserver<21soStatusEventObserver>FsSc + +// soCollisionReflectorEventObserver +27,1,00129818:addObserver__33soCollisionReflectorEventObserverFsSc +27,1,0004838C:notifyEventCollisionReflectorCheck__33soCollisionReflectorEventObserverFv +27,1,000D5460:addObserver__52soEventObserver<33soCollisionReflectorEventObserver>FsSc + +// ftOutsideEventObserver +27,1,00108BD0:addObserver__22ftOutsideEventObserverFsSc +27,1,0010DBFC:notifyEventOnDamage__22ftOutsideEventObserverFiUlP8soDamage +27,1,0010DBF8:notifyEventSetDamage__22ftOutsideEventObserverFifUlbb +27,1,0010DBF4:notifyEventRecover__22ftOutsideEventObserverFii +27,1,0010DBF0:notifyEventOutsideDeadArea__22ftOutsideEventObserverFiQ212soGroundUtil19DeadAreaCheckResultPb +27,1,0010DBEC:notifyEventAppeal__22ftOutsideEventObserverFii +27,1,0010DBE8:notifyEventDead__22ftOutsideEventObserverFiiQ37Fighter4Dead6Reasoni +27,1,0010DBE4:notifyEventBeat__22ftOutsideEventObserverFii +27,1,0010DBE0:notifyEventSuicide__22ftOutsideEventObserverFi +27,1,0010DBDC:notifyEventChangeStart__22ftOutsideEventObserverFiii6ftKind +27,1,0010DBD8:notifyEventChangeEnd__22ftOutsideEventObserverFiii6ftKind +27,1,0010DBD4:notifyEventChangeAppear__22ftOutsideEventObserverFv +27,1,0010DBD0:notifyEventAddDragoonParts__22ftOutsideEventObserverFii +27,1,0010DBCC:notifyEventCompDragoonParts__22ftOutsideEventObserverFi +27,1,0010DBC8:notifyEventRemoveDragoonParts__22ftOutsideEventObserverFii +27,1,0010DBC4:notifyEventResetDragoonParts__22ftOutsideEventObserverFi +27,1,0010DBC0:notifyEventReEntryRequestFighter__22ftOutsideEventObserverFv +27,1,0010DBBC:notifyEventSetCursor__22ftOutsideEventObserverFiUl +27,1,0010DBB8:notifyEventSetNameCursor__22ftOutsideEventObserverFiUl +27,1,0010DBB4:notifyEventSetLoupe__22ftOutsideEventObserverFiUl +27,1,0010DBB0:notifyEventStartFinal__22ftOutsideEventObserverFi +27,1,0010DBAC:notifyEventEndFinal__22ftOutsideEventObserverFi +27,1,0010DBA8:notifyEventRemoveEntry__22ftOutsideEventObserverFi +27,1,0010DBA4:notifyEventFinalSlow__22ftOutsideEventObserverFifi +27,1,0010DBA0:notifyEventFinalSlowCancel__22ftOutsideEventObserverFi +27,1,0010DB9C:notifyEventFinalStop__22ftOutsideEventObserverFi +27,1,0010DB98:notifyEventFinalStopCancel__22ftOutsideEventObserverFi +27,1,0010DE68:notifyEventEntryEnd__22ftOutsideEventObserverFi +27,1,0010DE64:notifyEventResultEnd__22ftOutsideEventObserverFi +27,1,0010DB94:notifyEventGetItem__22ftOutsideEventObserverFi6itKindiii +27,1,0010DB90:notifyEventSucceedHit__22ftOutsideEventObserverFiUlf +27,1,0010DB8C:notifyEventResultWin__22ftOutsideEventObserverFii +27,1,0010DB88:notifyEventYoshiEggStart__22ftOutsideEventObserverFi +27,1,0010DB84:notifyEventYoshiEggEnd__22ftOutsideEventObserverFi +27,1,0010DB80:notifyEventOnInput__22ftOutsideEventObserverFi +27,1,0010DB7C:notifyEventPikminMakeBloomAll__22ftOutsideEventObserverFi +27,1,0010DE60:notifyEventKirbyCopySetup__22ftOutsideEventObserverFii +27,1,0010DE5C:notifyEventKirbyCopyCancel__22ftOutsideEventObserverFii +27,1,0010DB78:notifyEventKnockout__22ftOutsideEventObserverFi +27,1,0010DB74:notifyEventHeartSwapStart__22ftOutsideEventObserverFii +27,1,0010DB70:notifyEventHeartSwapEnd__22ftOutsideEventObserverFii +27,1,0010E030:addObserver__41soEventObserver<22ftOutsideEventObserver>FsSc +27,5,26540:__vt__22ftOutsideEventObserver + +// soColorBlendModuleImpl +27,1,000c0ef0:setSubColor__soColorBlendModuleImplFQ17GXColorUc +27,1,000c0ee8:isEnableSubColor__soColorBlendModuleImplFv +27,1,000c0ee0:getSubColor__soColorBlendModuleImplFv + +// soController +27,1,0005AA38:getButtonMask__12soControllerFQ212soController9PadButton + +// ftKindConversion +27,1,00149BD8:convertKind__16ftKindConversionF15gmCharacterKindP6ftKind + +// ftInfo +27,1,00143B34:getInstance__6ftInfoFv +27,1,0014DEC4:getNamePtr__6ftInfoFi + +// ftEntryManager +27,1,00119110:getEntity__14ftEntryManagerFUl + +// ftSlotManager +27,1,001248C0:create__17ftInstanceManagerFP8ftCreate + +// ftManager +27,1,00109BCC:isValidEntryId__9ftManagerFi +27,1,0010B1E4:getEntryIdFromIndex__9ftManagerFi +27,1,0010A50C:getFighter__9ftManagerFii +27,1,0010A5A4:getSubFighter__9ftManagerFi +27,1,0010B1D0:getEntryCount__9ftManagerFv +27,1,0010B22C:getEntryId__9ftManagerFi +27,1,0010B29C:getEntryIdFromTaskId__9ftManagerFiPi +27,1,0010B234:getScoreEntryId__9ftManagerFi +27,1,0010A620:isFighterActivate__9ftManagerFii +27,1,0010B0BC:getPlayerNo__9ftManagerFi +27,1,0010A02C:getTeam__9ftManagerFibb +27,1,0010AFD0:getOwner__9ftManagerFi +27,1,0010CF6C:setCurry__9ftManagerFi +27,1,0010D234:setSlow__9ftManagerFibii +27,1,0010D0D8:setHeal__9ftManagerFif +27,1,0010CA00:searchNearFighter__9ftManagerFffP5Vec3fib +27,1,0010B604:setDead__9ftManagerFiii +27,1,0010C7FC:isProcessHeartSwap__9ftManagerFi +27,1,0010C834:toKnockOutHeartSwapOpposite__9ftManagerFiP20soDamageAttackerInfo +27,1,0010B8F8:setBeat__9ftManagerFii +27,1,0010BCF4:setSuicide__9ftManagerFi +27,1,0010BF4C:pickupCoin__9ftManagerFii +27,1,00109E14:setWarpFighter__9ftManagerFiP5Vec3ffUl +27,1,0010ADE8:getFighterCenterPos__9ftManagerFii +27,1,0010AF34:getFighterLr__9ftManagerFii +27,1,0010a164:getFighterOperationStatus__9ftManagerFi +27,1,0010a248:getFighterOperationType__9ftManagerFi +27,1,0010D034:setInfiniteScaling__9ftManagerFiQ37Fighter7Scaling4KindQ37Fighter7Scaling4Type +27,1,0010C2B8:addDragoon__9ftManagerFiUl +27,1,001095ac:removeSlot__9ftManagerFi +27,1,00109490:isReadySlot__9ftManagerFi +27,1,001094EC:isReadyRemoveSlot__9ftManagerFi +21,1,0010D4A4:notifyReplacePokeTrainer__9ftManagerFi + +// Fighter +27,1,00138900:setCurry__7FighterFbi +27,1,00138F64:setSuperStar__7FighterFbib +27,1,0013C860:warp__7FighterFP5Vec3ffUl +27,1,0012B4F0:start__7FighterFP5Vec3fffib +27,1,001370C0:startScaling__7FighterFQ27Fighter11ScalingKindQ27Fighter11ScalingType +27,1,0012CD58:setupEquipment__7FighterFv + +// ftOwner +27,1,001119A0:getHitPointMax__7ftOwnerFv +27,1,00111B2C:getStockCount__7ftOwnerFv +27,1,00111DEC:setMetal__7ftOwnerFb +27,1,00111EDC:setFinal__7ftOwnerFbb +27,1,0011204C:setInfiniteScaling__7ftOwnerFQ37Fighter7Scaling4KindQ37Fighter7Scaling4Type +27,1,00111DBC:setRabbitCap__7ftOwnerFb +27,1,00111E7C:setReflector__7ftOwnerFb +27,1,00111EAC:setFlower__7ftOwnerFb +27,1,00111E4C:setCurry__7ftOwnerFb +27,1,00111994:setHitPointMax__7ftOwnerFf +27,1,00112108:setSlipMul__7ftOwnerFf +27,1,00112128:setSlipInterval__7ftOwnerFb +27,1,00111A68:getBeatCount__7ftOwnerFi +27,1,00111AEC:getSuicideCount__7ftOwnerFv +27,1,00111A08:getDeadCount__7ftOwnerFv +27,1,001119E0:setDeadCount__7ftOwnerFi +27,1,00112c4c:getCoin__7ftOwnerFv +27,1,00112cc4:addLostCoin__7ftOwnerFi +27,1,00112c10:addCoin__7ftOwnerFi +27,1,00111358:setTeam__7ftOwnerFi +27,1,00111370:setPointTeam__7ftOwnerFi +27,1,00112d18:getCoinDropRate__7ftOwnerFv +27,1,00112c04:setResultWinRotY__7ftOwnerFf +27,1,00112bf8:getResultWinRotY__7ftOwnerFv + +// ftLogDataAccesser +27,1,001D53C8:addFloat__17ftLogDataAccesserFfUlUl +27,1,001D5414:addInt__17ftLogDataAccesserFiUlUl +27,1,001D53A0:getFloat__17ftLogDataAccesserFUlUl +27,1,001D53E4:getInt__17ftLogDataAccesserFUlUl +27,1,001D5434:isFlag__17ftLogDataAccesserFUlUl +27,1,001D5474:offFlag__17ftLogDataAccesserFUlUl +27,1,001D545C:onFlag__17ftLogDataAccesserFUlUl +27,1,001D5448:setFlag__17ftLogDataAccesserFbUlUl +27,1,001D53B4:setFloat__17ftLogDataAccesserFfUlUl +27,1,001D53FC:setInt__17ftLogDataAccesserFiUlUl +27,1,001D4B80:setup__17ftLogDataAccesserFP9ftLogData +27,1,001D512C:reset__17ftLogDataAccesserFv + +// ftLogAttackInfoModule +27,1,001D727C:addAttackInfo__21ftLogAttackInfoModuleFRC15soLogAttackInfo +27,1,001D72F4:getAttackInfo__21ftLogAttackInfoModuleFUl + +// ftLogPatternModule +27,1,001D556C:addAttackPattern__18ftLogPatternModuleFRC15soLogAttackInfo +27,1,001D57D0:clearPattern__18ftLogPatternModuleFv +27,1,001D5658:getPowerMul__18ftLogPatternModuleFRC15soLogAttackInfo + +// ftOutsideEventPresenter +27,1,0015B0C8:notifyOutsideEventKnockout__23ftOutsideEventPresenterFv + +// aiMgr +27,1,001F27DC:setDangerZone__5aiMgrFP5Vec2fP5Vec2fibb +27,1,001F299C:delDangerZone__5aiMgrFi + +// itManager +27,1,002A1718:getInstance__9itManagerFv +27,1,002A55CC:isCompItemKindArchive__9itManagerF6itKindUlb +27,1,002A3F4C:preloadItemKindArchive__9itManagerF6itKindUlQ29itArchive4Typeb +27,1,002A9E50:getLotOneItemKind__9itManagerFP14itGenSheetKind7itGenIdPQ29itManager10ItemSwitchb +27,1,002A6FB8:createItem__9itManagerFP5Vec3fP5Vec3ff6itKindUliP16soResourceModuleUciii +27,1,002A7004:createItem__9itManagerFP5Vec3ff6itKindUliP16soResourceModuleUciii +27,1,002A7070:createItem__9itManagerF6itKindUliP16soResourceModuleUciii +27,1,002A8124:createItemInstance__9itManagerFP8itCreate +27,1,002A8550:getItemNum__9itManagerF6itKindiii +27,1,002A8640:getItemNum__9itManagerF6itKind +27,1,002A7BA0:removeItem__9itManagerFP8BaseItem +27,1,002A8828:getItemFromInstanceId__9itManagerFi +27,1,0010D878:setFinal__9ftManagerFib +27,1,002A4FF8:preloadAssist__9itManagerF6itKind +27,1,002a9928:createMoney__9itManagerFPcP5Vec3fP5Vec2fUlUlUl + +// BaseItem +27,1,0027F564:__ct__8BaseItemFP8itCreate +27,1,0028C834:getParam__8BaseItemFQ215itValueAccesser10ParamFloat +27,1,0028C85C:getParam__8BaseItemFQ215itValueAccesser8ParamInt +27,1,0028C884:getParamFloat__8BaseItemFUl +27,1,0028DE00:warp__8BaseItemFP5Vec3f +27,1,0028C7E8:setVanishMode__8BaseItemFb +27,1,0028FF6C:setSafePos__8BaseItemFP5Vec2f +27,1,0028DBA4:isHaved__8BaseItemFv +27,1,0028F518:getTeamOwnerTaskId__8BaseItemFv +27,1,0028F06C:setTeamOwnerTaskId__8BaseItemFi +27,1,0028FE5C:sendTouchMessage__8BaseItemFiP5Vec3ff + +// itCustomizer +27,1,00281B1C:onConstruct__21itCustomizerInterfaceFP8BaseItem +27,1,002839BC:onDestruct__21itCustomizerInterfaceFP8BaseItem +27,1,00284EA0:onReset__21itCustomizerInterfaceFP8BaseItem +27,1,00289454:onProcessUpdate__21itCustomizerInterfaceFP8BaseItem +27,1,00289FAC:onProcessFixPosition__21itCustomizerInterfaceFP8BaseItem +27,1,0028A178:onProcessHit__21itCustomizerInterfaceFP8BaseItem +27,1,0028A1C4:onProcessFixCamera__21itCustomizerInterfaceFP8BaseItem +27,1,0028A4F4:onProcessGameProc__21itCustomizerInterfaceFP8BaseItem +27,1,00289518:onRenderPre__21itCustomizerInterfaceFP8BaseItem +27,1,00289560:onRenderDebug__21itCustomizerInterfaceFP8BaseItem +27,1,0028903C:onNotifyEventChangeStatus__21itCustomizerInterfaceFP8BaseItemiiP12soStatusDataP16soModuleAccesser +27,1,00287730:onNotifyEventAnimCmd__21itCustomizerInterfaceFP8BaseItemP9acAnimCmdP16soModuleAccesseri +27,1,0028B33C:onNotifyEventCollisionAttackCheck__21itCustomizerInterfaceFP8BaseItemi +27,1,0028BBA0:onNotifyEventCollisionSearch__21itCustomizerInterfaceFP8BaseItemP14soCollisionLog +27,1,0028BDA8:onNotifyEventCollisionSearchCheck__21itCustomizerInterfaceFP8BaseItemiUcP5Vec3f +27,1,0028C004:onNotifyEventLink__21itCustomizerInterfaceFP8BaseItemPvP16soModuleAccesserP11StageObjecti +27,1,002905E8:onNotifyEventCaptureStatus__21itCustomizerInterfaceFP8BaseItem +27,1,0028C0E0:onNotifyEventGimmick__21itCustomizerInterfaceFP8BaseItemP18soGimmickEventArgsPi +27,1,002886CC:onUpdateAiDir__21itCustomizerInterfaceFP8BaseItemP5Vec2fP5Vec2fP5Vec2fP5Vec2f +27,1,00288700:onUpdateAiMove__21itCustomizerInterfaceFP8BaseItemP5Vec2fP5Vec2fP5Vec2f +27,1,00288610:onSearchTarget__21itCustomizerInterfaceFP8BaseItemPi5Vec3fi +27,1,0028F610:onShoot__21itCustomizerInterfaceFP8BaseItemUlff +27,1,0028F638:onShootBlanks__21itCustomizerInterfaceFP8BaseItemUl +27,1,0028F540:onGetBullet__21itCustomizerInterfaceFP8BaseItem +27,1,0028E104:onThrowAttack__21itCustomizerInterfaceFP8BaseItemfPfP5Vec3fP5Vec3fPfPb +27,1,0028FC10:onAction__21itCustomizerInterfaceFP8BaseItemUlf +27,1,0028FC2C:onResult__21itCustomizerInterfaceFP8BaseItem +27,1,0028DB5C:onHave__21itCustomizerInterfaceFP8BaseItemi +27,1,0028B988:onReflect__21itCustomizerInterfaceFP8BaseItem +27,1,00288748:onPreBound__21itCustomizerInterfaceFP8BaseItemP5Vec2fUl +27,1,0028C7C8:onRemoveModelConstraint__21itCustomizerInterfaceFP8BaseItemi +27,1,00287888:onEnumFighter__21itCustomizerInterfaceFP8BaseItemP7Fighter +27,1,002974B0:onGetLayerType__21itCustomizerInterfaceFP8BaseItem +27,1,0028C020:isTreadPassive__21itCustomizerInterfaceFP8BaseItem +27,1,002887C4:isUseTurnDamage__21itCustomizerInterfaceFP8BaseItem +27,1,002887E4:isUseSpeedDamage__21itCustomizerInterfaceFP8BaseItem +27,1,00288804:isUseShake__21itCustomizerInterfaceFP8BaseItem +27,1,00284E90:isUseScaleZ__21itCustomizerInterfaceFP8BaseItem +27,1,0028E0FC:isUseThrowRotParam__21itCustomizerInterfaceFP8BaseItem +27,1,0028DDB8:isSafe__21itCustomizerInterfaceFP8BaseItem +27,1,0028C410:isConstraintHave__21itCustomizerInterfaceFP8BaseItem +27,1,0028DB64:isReferenceControlerHave__21itCustomizerInterfaceFP8BaseItem +27,1,00284E98:getKineticFlags__21itCustomizerInterfaceFP8BaseItem +27,1,00281ABC:isUsePhysics__21itCustomizerInterfaceFP8BaseItem +27,1,0029D100:onUpdateKinetic__21itCustomizerInterfaceFP8BaseItem +27,1,00288774:onPreDamageCheck__21itCustomizerInterfaceFP8BaseItemiP11soDamageLog +27,1,002887A4:onDamage__21itCustomizerInterfaceFP8BaseItemiP11soDamageLog + +// ykData +27,1,00275FDC:__ct__6ykDataFv + +// Yakumono +27,1,0026383C:setReactionFrame__8YakumonoFi +27,1,002638DC:setCollisionHitSelfCatagory__8YakumonoFQ211soCollision8Category +27,1,00263854:setCollisionHitOpponentCategory__8YakumonoFib +27,1,002639D0:setTeam__8YakumonoFi +27,1,002639EC:getTeam__8YakumonoFv +27,1,00263C64:setSituationKind__8YakumonoFi + +// stPositions +27,1,00226794:getDeadRange__11stPositionsFP6Rect2D +27,1,00226584:getCameraRange__11stPositionsFP6Rect2D +27,1,00225CE8:loadPositionData__11stPositionsFPQ34nw4r3g3d7ResFile +27,1,002274dc:getKirifudaPos__11stPositionsFUlP5Vec3f +27,1,00226494:getCameraCenter__11stPositionsFP5Vec3f + +// stTriggerMng +27,1,00231FDC:createTrigger__12stTriggerMngFQ27Gimmick8AreaKindi +27,1,00232118:createTrigger__12stTriggerMngFQ27Gimmick8AreaKindP13stTriggerData +27,1,00232D4C:setTriggerFlag__12stTriggerMngFP13stTriggerData +27,1,00232F28:getTriggerFlag__12stTriggerMngFP13stTriggerDatab + +// stTrigger +27,1,00233640:setObserveYakumono__9stTriggerFP8Yakumono +27,1,00233778:setBeltConveyorTrigger__9stTriggerFP25grGimmickBeltConveyorData +27,1,002339B8:setHitPointEffectTrigger__9stTriggerFP27grGimmickHitPointEffectData +27,1,00233928:setWaterTrigger__9stTriggerFP18grGimmickWaterData +27,1,00233658:setWindTrigger__9stTriggerFP17grGimmickWindData +27,1,00234040:setAreaSleep__9stTriggerFb +27,1,00233A48:setWindParam__9stTriggerFP20grGimmickWindData2ndl + +// stDataContainer +8015bacc:__dt__15stDataContainerFv + +// stDataMultiContainer +8015bbf4:create__20stDataMultiContainerFPvQ25Heaps8HeapType + + +// SeSeq +27,1,00224e44:__ct__Q28StSeUtil5SeSeqFPQ28StSeUtil10UnkStruct2UlPQ28StSeUtil10UnkStruct3Ul +27,1,0022506c:__dt__Q28StSeUtil5SeSeqFv +27,1,002252e0:playFrame__Q28StSeUtil5SeSeqFlf +27,1,002252d8:playFrame__Q28StSeUtil5SeSeqFlff +27,1,00225108:registId__Q28StSeUtil5SeSeqFP5SndIDUl +27,1,0022517c:registSeq__Q28StSeUtil5SeSeqFiPQ28StSeUtil9UnkStructUlQ25Heaps8HeapType + +// emManager +41,1,0000C6B0:create__9emManagerFUlUlUc +41,1,0000C804:getInstance__9emManagerFv +41,1,0000D20C:preloadArchive__9emManagerFP9gfArchiveP9gfArchiveP9gfArchiveP9gfArchive6emKindb +41,1,0000C9D4:createEnemy__9emManagerFP8emCreate +41,1,0000D6B8:getPreloadArchiveCountFromKind__9emManagerF6emKind +41,1,0000CCE4:removeEnemyAll__9emManagerFv +41,1,0000D528:removeArchiveAll__9emManagerFv +41,1,0000cbd4:removeEnemy__9emManagerFi +41,1,0000d0a8:isEnemyExist__9emManagerFi +41,1,0000C7B4:remove__9emManagerFv +41,1,0000CF18:getEnemyCount__9emManagerFv +41,1,0000CF8C:getEnemyCountFromKind__9emManagerF6emKind +41,1,0000d380:isCompArchive__9emManagerFi +41,1,0000D42C:isCompArchiveAll__9emManagerFv +41,1,0000CE84:getEnemyPtrFromId__9emManagerFi +41,1,0000d4b8:removeArchive__9emManagerFi +41,1,0000d828:getPreloadArchiveCreateIdFromKind__9emManagerF6emKind +41,1,0000D5C4:getEntryPreloadArchivePtrFromId__9emManagerFi +41,1,0000D770:getPreloadArchivePtrFromKind__9emManagerF6emKind + +//gfFileIO +8001bf0c:readFile__8gfFileIOFP15gfFileIORequest +8001cbf4:readSDFile__8gfFileIOFP15gfFileIORequest +8001f5a0:checkFileSD__8gfFileIOFP15gfFileIORequest +8001ce40:writeFile__8gfFileIOFP15gfFileIORequest + +// gfFileIORequest +8002241c:setWriteParam__15gfFileIORequestFPCcPvii + +// gfFileIOHandle +80020b38:__dt__14gfFileIOHandleFv +80020b98:setNotify__14gfFileIOHandleFPv +80020bec:createDirRequest__14gfFileIOHandleFPCc +80020c88:checkFileRequest__14gfFileIOHandleFPCc +80020d20:findfirstRequest__14gfFileIOHandleFPCcQ25Heaps8HeapType +80020dc8:findFileCountRequest__14gfFileIOHandleFPCc +80020e54:checkDirRequest__14gfFileIOHandleFPCc +80020ef0:createVFSystemFile__14gfFileIOHandleFPCci +80020f90:mountVF__14gfFileIOHandleFUcPCc +80021038:unmountVF__14gfFileIOHandleFUc +800210d4:formatVF__14gfFileIOHandleFi +80021170:mountSD__14gfFileIOHandleFv +80021210:unmountSD__14gfFileIOHandleFv +800212b0:checkFreeSize__14gfFileIOHandleFPCc +8002134c:del__14gfFileIOHandleFPCc +800213e8:writeNAND__14gfFileIOHandleFPviPCc +800219e0:read__14gfFileIOHandleFPCcQ25Heaps8HeapTypei +80021b0c:read__14gfFileIOHandleFPCcPCvi +80021c30:read__14gfFileIOHandleFPCcPvi +80021498:readRequest__14gfFileIOHandleFPCcQ25Heaps8HeapTypeii +80021540:readRequest__14gfFileIOHandleFPCcPCvii +800215e0:readRequest__14gfFileIOHandleFPCcPvii +80021680:readRequestCached__14gfFileIOHandleFPCcQ25Heaps8HeapTypeii +80021738:readRequestCached__14gfFileIOHandleFPCcPCvii +800217e8:readRequestCached__14gfFileIOHandleFPCcPvii +80021898:readRequestNoSync__14gfFileIOHandleFPCcQ25Heaps8HeapTypeii +80021940:readRequestNoSync__14gfFileIOHandleFPCcPvii +80021d54:writeRequest__14gfFileIOHandleFPCcPvii +80021de4:cancelRequest__14gfFileIOHandleFv +80021ef8:isCancelRequested__14gfFileIOHandleCFv +80021f1c:isCanceled__14gfFileIOHandleCFv +80021f38:isReady__14gfFileIOHandleCFv +80021f68:getReturnStatus__14gfFileIOHandleCFv +80021f88:getSize__14gfFileIOHandleCFv +80021f94:getBuffer__14gfFileIOHandleCFv +80021fa0:getPool__14gfFileIOHandleCFv +80021fac:release__14gfFileIOHandleFv +8002239c:setReadParam__15gfFileIORequestFP15gfFileIORequestPCcPvii +8001be00:gfFACreateDir__8gfFileIOFPCc + +// gfSlowManager +80033360:requestSlow__13gfSlowManagerFUc + +// gameGlobal +8004D9DC:getLanguage__10GameGlobalFv + +// G3dObj +8019d8d8:Destroy__Q34nw4r3g3d6G3dObjFv + +// ScnMdl +801b4af4:Construct__Q34nw4r3g3d6ScnMdlFPviiPv +801b4d94:Pushback__Q34nw4r3g3d6ScnMdlFPvPvPc + +// AnmObjChrRes +8019aed4:Construct__Q34nw4r3g3d12AnmObjChrResFP12MEMAllocatorPiQ34nw4r3g3d9ResAnmChrQ34nw4r3g3d6ResMdlb + +// AnmObjVisRes +801976c8:Construct__Q34nw4r3g3d12AnmObjVisResFP12MEMAllocatorPiQ34nw4r3g3d9ResAnmVisQ34nw4r3g3d6ResMdl + +// AnmObjTexPatRes +80198a70:Construct__Q34nw4r3g3d15AnmObjTexPatResFP12MEMAllocatorPiQ34nw4r3g3d12ResAnmTexPatQ34nw4r3g3d6ResMdlb + +// AnmObjTexSrtRes +801993e0:Construct__Q34nw4r3g3d15AnmObjTexSrtResFP12MEMAllocatorPiQ34nw4r3g3d12ResAnmTexSrtQ34nw4r3g3d6ResMdlb + +// AnmObjMatClrRes +80197da8:Construct__Q34nw4r3g3d15AnmObjMatClrResFP12MEMAllocatorPiQ34nw4r3g3d9ResAnmClrQ34nw4r3g3d6ResMdlb + +// gfHeapManager +80024a50:dumpAll__13gfHeapManagerFv +80024b08:dumpList__13gfHeapManagerFv +80024544:createHeap__13gfHeapManagerFiPCcii +80024430:getMEMAllocator__13gfHeapManagerFQ25Heaps8HeapType +800249cc:getHeap__13gfHeapManagerFQ25Heaps8HeapType +800249e4:alloc__13gfHeapManagerFQ25Heaps8HeapTypeUl +80024a4c:free__13gfHeapManagerFPv +80024a34:getMaxFreeSize__13gfHeapManagerFQ25Heaps8HeapType + +// gfKeepFrameBuffer +80024d6c:update__17gfKeepFrameBufferFv +80024dc0:render__17gfKeepFrameBufferFv +8002b61c:startKeepScreen__17gfKeepFrameBufferFv +80024e38:endKeepScreen__17gfKeepFrameBufferFv + +// gfCopyEFBMgr +8002fe48:getInstance__12gfCopyEFBMgrFv +8002ff34:isValid__12gfCopyEFBMgrFi +8002ffb8:getCopyEFBTex__12gfCopyEFBMgrFi +8002fe50:createCopyEFB__12gfCopyEFBMgrFiQ25Heaps8HeapType +8002ff44:getEFB__12gfCopyEFBMgrFi +8002ffc8:drawCopyEFB__12gfCopyEFBMgrFiP8_GXColor + +// MuMsg +800b8930:create__5MuMsgFUlQ25Heaps8HeapTypeQ25Heaps8HeapType +800b8b08:allocMsgBuf__5MuMsgFUlUl +800b8c7c:setMsgData__5MuMsgFPv +800b8c90:attachScnMdlSimple__5MuMsgFUlPQ34nw4r3g3d12ScnMdlSimpleUlf +800b93f4:setFontWidthModeAuto__5MuMsgFUl +800b93c4:setAlignMode__5MuMsgFUlQ25MuMsg9AlignMode +800b93a4:setFontColor__5MuMsgFUlUcUcUcUc +800b9448:FUN_800b9448__5MuMsgFUlb +800b9460:FUN_800b9460__5MuMsgFUlUcUcUcf +800b9230:printf__5MuMsgFUlPCce +800b91b8:printIndex__5MuMsgFUlUlPv +800b9348:getMsgData__5MuMsgFUlPi +800b8be0:initWindowSetting__5MuMsgFPQ25MuMsg13WindowSetting +800b94a0:setHSpace__5MuMsgFUlf +800b94b4:setWScale__5MuMsgFUlf +800b94c8:getWScale__5MuMsgFUlf +800b94dc:setHScale__5MuMsgFUlf +800b94f0:getHScale__5MuMsgFUlf +800b9504:setDelayPrint__5MuMsgFUlffff +800b9524:isEndDelayPrint__5MuMsgFUl +800b8ee8:beginPrint__5MuMsgFUl +800b938c:setWindowRectVisible__5MuMsgFUlb +800b8dec:attachMuObject__5MuMsgFUlP8MuObjectPCcfffff +800b8edc:detachMuObject__5MuMsgFP8MuObject +800b940c:setFontWidthModeProportional__5MuMsgFUl +800b9428:setFontWidthModeFixed__5MuMsgFUl +800b93dc:setVerticalMode__5MuMsgFUlb +800b9448:setEdgeEnable__5MuMsgFUlb +800b9460:setEdge__5MuMsgFUlUcUcUcf +800b9488:setFontType__5MuMsgFUlUl +800b8a0c:__dt__5MuMsgFv + +// MuObject +800b534c:changeAnimN__8MuObjectFPCc +800b45a8:changeNodeAnimN__8MuObjectFPCc +800b46f0:changeNodeAnimNIf__8MuObjectFPCc +800b4844:changeVisAnimN__8MuObjectFPCc +800b4988:changeVisAnimNIf__8MuObjectFPCc +800b4ad8:changeTexPatAnim__8MuObjectFPCc +800b4c14:changeTexPatAnimN__8MuObjectFPCc +800b4d3c:changeTexPatAnimNIf__8MuObjectFPCc +800b4e70:changeTexSrtAnimN__8MuObjectFPCc +800b4f98:changeTexSrtAnimNIf__8MuObjectFPCc +800b50cc:changeClrAnimN__8MuObjectFPCc +800b51f4:changeClrAnimNIf__8MuObjectFPCc +800b784c:setFrameVisible__8MuObjectFf +800b7a18:setFrameMatCol__8MuObjectFf +800b7900:setFrameTex__8MuObjectFf +800b2394:create__8MuObjectFPQ34nw4r3g3d7ResFilePCciPQ34nw4r3g3d7ResFileQ25Heaps8HeapType +800b2404:create__8MuObjectFPQ34nw4r3g3d7ResFileiPQ34nw4r3g3d7ResFileiQ25Heaps8HeapType +800b7184:changeMaterialTex__8MuObjectFiiPQ34nw4r3g3d7ResFile +800b7224:changeMaterialTex__8MuObjectFiPCcPQ34nw4r3g3d7ResFile +800b2318:copy__8MuObjectFiiQ25Heaps8HeapType +800b20b0:enableSkipMatrix__8MuObjectFb +800b21c4:enableSkipMaterial__8MuObjectFb +800b22b8:calcMatrix__8MuObjectFv +800b4f98:changeTexSrtAnimNIf__8MuObjectFPCc +800b753c:setFrame__8MuObjectFf +800b798c:setFrameTexSrt__8MuObjectFf +800b7aa4:setFrameFlg__8MuObjectFfUc +800b7f38:setUpdateRateFlg__8MuObjectFfUc +800b6ac0:getNode__8MuObjectFi +800b6af0:getNodeID__8MuObjectFPCc +800b6a04:getRect3D__8MuObjectFP6Rect2Dii +800b68f0:getRect3D__8MuObjectFP6Rect2DPCcPCc +800b66d0:getPos__8MuObjectFP5Vec3f +800b672c:getPos__8MuObjectFP5Vec3fPCc +800b6784:setPos__8MuObjectFP5Vec3f +800b67e0:setPos__8MuObjectFP5Vec3fPCc +800b6838:setTrans__8MuObjectFP5Vec3f +800b6c30:getGlobalPosition__8MuObjectFi +800b6ca4:getGlobalPosition__8MuObjectFv +800b6d68:getAnimScale__8MuObjectFP5Vec3fPCc +800b6ebc:setScale__8MuObjectFP5Vec3f +800b6f18:setScale__8MuObjectFPCcP5Vec3f +800b6d10:getScale__8MuObjectFP5Vec3fPCc +800b6e08:setObjScale__8MuObjectFP5Vec3f +800b6e84:getObjScale__8MuObjectFv +800b6f6c:setObjRotate__8MuObjectFP5Vec3f +800b7024:getRotate__8MuObjectFP5Vec3fPCc +800b707c:setRotate__8MuObjectFP5Vec3fPCc +800b60a8:getNodeAnimName__8MuObjectFv +800b60e0:getVisAnimName__8MuObjectFv +800b6118:getTexPatAnimName__8MuObjectFv +800b6150:getTexSrtAnimName__8MuObjectFv +800b6188:getClrAnimName__8MuObjectFv +800b61c0:isNodeAnimFinished__8MuObjectFv +800b6268:isVisAnimFinished__8MuObjectFv +800b6310:isClrAnimFinished__8MuObjectFv +800b63b8:isAnimFinished__8MuObjectFv +800b66a0:isNodeAnimLoop__8MuObjectFv + +//gfModelAnimation +80027c40:__ct__16gfModelAnimationFd +80027fa4:__ct1__16gfModelAnimationFd +80028278:setLoop__16gfModelAnimationFd +800282f4:setLoopNode__16gfModelAnimationFd +8002831c:setLoopVisible__16gfModelAnimationFd +80028344:setLoopTex__16gfModelAnimationFd +8002836c:setLoopTexSrt__16gfModelAnimationFd +80028394:setLoopMatCol__16gfModelAnimationFd +800283bc:getFrameCount__16gfModelAnimationFd +80028498:setFrame__16gfModelAnimationFd +8002858c:getFrame__16gfModelAnimationFd +80028650:setUpdateRate__16gfModelAnimationFd +80028744:getUpdateRate__16gfModelAnimationFd + +//muMenu +800af088:init__6muMenuFiii +800af08c:start__6muMenuFiii +800af0f0:process__6muMenuFiii +800af140:exit__6muMenuFiii +800af148:exchangeMuCharKindToGmCharacterKind__6muMenuFiii +800af160:exchangeGmCharacterKindToMuCharKind__6muMenuFiii +800af258:exchangeMuCharKindToMuSelchkind__6muMenuFiii +800af31c:exchangeMuSelchkindToMuCharKind__6muMenuFiii +800af334:exchangeMuCharKindToMuStockchkind__6muMenuFiii +800af350:isCharUsable__6muMenuFiii +800af3ec:isCharRefered__6muMenuFiii +800af490:setCharRefered__6muMenuFiii +800af520:findCharTeamColorNo__6muMenuFiii +800af58c:exchangeMuStageKindToGmHideStageKind__6muMenuFiii +800af5a4:getInfoMsgID__6muMenuFiii +800af5b4:exchangeGmCharacterKind2MuStockchkind__6muMenuFi +800acdec:getStockFrameID__6muMenuFiii +800af600:getStockFrameID__6muMenuFi +800af614:exchangeMuStageKindToSrStageKind__6muMenuFiii +800af628:exchangeSrStageKindToMuStageKind__6muMenuFiii +800af6a0:getStageFrameNo__6muMenuFiii +800af6d8:exchangeMuStageKindToMsgID__6muMenuFiii +800acf28:exchangeMuStockchkind2GmNativeGame__6muMenuFiii +800af708:exchangeGmCharacterKind2MuSelchkind__6muMenuFiii +800af80c:exchangeMuSelchkind2GmCharacterKind__6muMenuFiii +800af844:exchangeMuSelchkind2MuStockchkind__6muMenuFiii +800af82c:exchangeMuSelchkind2MuStockchkind__6muMenuFi +800af85c:exchangeSelchkind2SelCharVoice__6muMenuFi +800ae4a0:exchangeStockchkind2SelCharNarrationSndID__6muMenuFiii +800af874:exchangeSelchkind2SelCharNarrationSndID__6muMenuFiii +800ad6fc:exchangeStockchkind2SelCharNarrationFrameEN__6muMenuFiii +800af8d0:getNumCharColor__6muMenuFiii +800aefc4:getNumStockCharColor__6muMenuFiii +800af91c:getCharColor__6muMenuFiii +800af93c:getFighterColorFileNo__6muMenuFii +800af960:getCharColorNo__6muMenuFiii +800af9c4:isCharLargeSize__6muMenuFiii +800af9ec:getCpLevelMessageId__6muMenuFiii +800afab0:getItemNameID__6muMenuFiii +800afac8:exchangeMuItemKindToItKind__6muMenuFiii +800b82ac:getChkindCharaName__6muMenuFiii +800b30cc:getChkindCharaNameInEn__6muMenuFiii +800afafc:startRumbleController__6muMenuFiii +800afb80:loadMenuSound__6muMenuFiii +800afb88:isLoadFinishMenuSound__6muMenuFiii +800afb90:freeMenuSound__6muMenuFiii +800afb80:loadMenuSound__6muMenuFv +800afb88:isLoadFinishMenuSound__6muMenuFv +8018ea08:Init__Q34nw4r3g3d7ResFileFPv +800af8a0:exchangeSelCharVoice2SelCharVoiceLengthE__6muMenuFi +800AF8B8:exchangeSelCharVoice2SelCharVoiceLengthJ__6muMenuFi +800af600:exchangeGmCharacterKind2Something__6muMenuFi +800afa30:exchangeMuStockchkind2MuCharName__6muMenuFi + +// Message +80454120:__vt__7Message +80069860:__dt__7MessageFv +800696b4:__ct__7MessageFUlQ25Heaps8HeapType +8006b400:allocMsgBuf__7MessageFUlUlQ25Heaps8HeapType +8006b518:attachMsgBuf__7MessageFUlPQ34nw4r3g3d12ScnMdlSimplePCcUcif +8006a674:changeMsgBuf__7MessageFi +8006b674:clearMsgBuf__7MessageFv +80069af0:setWindow__7MessageFffff +8006a550:setFace__7MessageFUc +8006a600:setFixedWidth__7MessageFf +8006a200:setColor__7MessageFi +8006a018:setScale__7MessageFff +80069970:setCursorX__7MessageFf +80069a30:setCursorY__7MessageFf +80069d40:printf__7MessageFPCce +8006b134:getPrintIndexData__7MessageFPvUlPPcPUl +8006bc10:utf8to16__7MessageFPwPCc +8006bca8:utf16to8__7MessageFPcPCw + +// grTenganEvent +27,1,0027BBD8:__ct__13grTenganEventFv +27,1,0027BBF8:__dt__13grTenganEventFv +27,1,0027BC4C:update__13grTenganEventFf +27,1,0027BCA0:set__13grTenganEventFff +27,1,0027BCEC:start__13grTenganEventFv +27,1,0027BD68:end__13grTenganEventFv +27,1,0027BD80:isEvent__13grTenganEventCFv +27,1,0027BD94:isReadyEnd__13grTenganEventCFv +27,1,0027BDA8:getPhase__13grTenganEventCFv +27,1,0027BDB0:setPhase__13grTenganEventFl + +// IfPlayer +800e1384:disappear__8IfPlayerFv +800e19ec:updateStockCoin__8IfPlayerFUc +800e22a0:updateCoinScoreSub__8IfPlayerFUc + +// IfFoxSmashAppearTask +800F6374:create__20IfFoxSmashAppearTaskFP9gfArchive + +// SOCommon.h +803a5e40:SOInit +803a6104:SOStartupEx + +// SOBasic.h +803a6f68:SOSocket +803a7058:SOClose +803a7b00:SOHtoNl +803a7b04:SOHtoNs +803a72f0:SOBind +803a7b0c:SORecvFrom +803a7aa0:SOInetNtoA +803a7608:SOSendTo +80151098:SOAlloc +801510c4:SOFree +803a7af8:SONtoHs + +// more socket stuff (nonport.h) +8035c26c:socket +8035c30c:bind +8035c4b0:recvfrom +8035c544:sendto +8035c2a4:closesocket +8035cefc:CanReceiveOnSocket +8035cf44:CanSendOnSocket +8035c3e8:listen +8035c478:recv +8035c41c:accept +8035c510:send +8035c5c4:getsockname +8035cd7c:SetReceiveBufferSize +8035cdd8:SetSendBufferSize + +// FA.h +803ebf6c:FAFstat +803ebeb8:FAFopen +803ebee8:FAFseek +803ebee4:FAFread +803ebf98:FAFwrite +803ebe8c:FAFclose +803ec200:FARemove +803ec128:FAOpendir +803ebe20:FAClosedir +803ebf14:FAFsfirst +803ebf40:FAFsnext + +// PF.h +803d6830:PFSTR_InitStr +803e7234:PFPATH_GetVolumeFromPath +803ebaac:PF_enterCritical +803df748:PFENT_ITER_GetEntryOfPath +803e8e84:PFSEC_ReadData +803e4cc4:PFFILE_p_remove +803db1e0:PFDIR_p_mkdir +803e9260:PFSEC_WriteData +803da850:PFCACHE_FlushFATCache +803da884:PFCACHE_FlushDataCacheSpecific +803ebb28:PF_exitCritical +803eb4dc:PFAPI_convertReturnValue +803ddde4:PFENT_RemoveEntry +803e18b0:PFFAT_FreeChain +803ddd60:PFENT_getcurrentDateTimeForEnt + +// NHTTP +80396248:NHTTPStartup +80396510:NHTTPCreateRequest +80396774:NHTTPSendRequestAsync +80396860:NHTTPDestroyResponse +803969b8:NHTTPGetResultCode +80396950:NHTTPGetBodyAll + +// DWC +80335264:DWC_Init +803557a0:DWCi_NdAlloc +803557b0:DWCi_NdFree + +// muWifiInterfaceTask +800c7410:create__19muWifiInterfaceTaskFv +800c9b44:connect__19muWifiInterfaceTaskFb + +// dNetConnect +8014cc4c:dNetConnect_Start__Fv + +// Network +801462c0:create__7NetworkFb + +// nteDWC +80150ba8:AllocEx__6nteDWCFiUli +80150c20:FreeEx__6nteDWCFiPv + +// sora_men_sel_char +10,1,00014b68:setCharPic__19muSelCharPlayerAreaFiiibii +10,1,00015238:isTeamBattle__19muSelCharPlayerAreaFv +10,1,0000FEDC:dispHighScore__13muSelCharTaskFiii +10,1,00014858:dispMarkKind__19muSelCharPlayerAreaF11MuSelchkind +10,1,00012010:exchangeCharKindDetail__19muSelCharPlayerAreaF11MuSelchkind + +// gfMemoryPool +80025c58:alloc__12gfMemoryPoolFPvUli +800259a4:create__12gfMemoryPoolFPvUlPCc +8002606c:getMaxFreeBlockSize__12gfMemoryPoolFv + +// OpenRVL CX (Compression) functions. +80206018:CXUncompressLZ + +// OpenRVL GX functions. +801f1088:GXBegin +801f4774:GXSetZMode +801f136c:GXSetCullMode +801f3fd8:GXSetAlphaCompare +801f12fc:GXSetPointSize +801f12ac:GXSetLineWidth +80018de4:setGX__8gfCameraFv + +// gf/gf_draw +8001abbc:gfDrawSetupCoord2D__Fv +8001a5c0:gfDrawSetVtxPosColorPrimEnvironment__Fv +8001a7ac:gfDrawSetVtxPosColorTexPrimEnvironment__Fv +8001a980:gfDrawResetLight__Fv + + +// ms::CharWriter +8006ebcc:__ct__Q22ms10CharWriterFv +8006ee1c:__dt__Q22ms10CharWriterFv +8006fe50:Print__Q22ms10CharWriterFUs +8007001c:PrintGlyph__Q22ms10CharWriterFfffCPv +8006eeec:SetupGX__Q22ms10CharWriterFv +8006eeec:SetupGXWithColorMapping__Q22ms10CharWriterFQ34nw4r2ut5ColorQ34nw4r2ut5Color +8006ffb0:SetCursor__Q22ms10CharWriterFff +8006ffbc:SetCursor__Q22ms10CharWriterFfff +8006ffcc:SetCursorX__Q22ms10CharWriterFf +8006ffd4:SetCursorY__Q22ms10CharWriterFf +8006ffdc:SetCursorZ__Q22ms10CharWriterFf +8006ab20:SetEdge__Q22ms10CharWriterFfQ34nw4r2ut5Color +8006fe48:SetFixedWidth__Q22ms10CharWriterFf +8006fc60:SetScale__Q22ms10CharWriterFff +8006fc6c:SetScale__Q22ms10CharWriterFf +8006f988:SetAlpha__Q22ms10CharWriterFUc +8006f944:SetColorMapping__Q22ms10CharWriterFQ34nw4r2ut5ColorQ34nw4r2ut5Color +8006fadc:SetTextColor__Q22ms10CharWriterFQ34nw4r2ut5Color +8006fe38:EnableFixedWidth__Q22ms10CharWriterFb +8006ffe4:MoveCursorX__Q22ms10CharWriterFf +8006fff4:MoveCursorY__Q22ms10CharWriterFf + +8006fc88:getAdjustFontScale__Q22ms10CharWrifterCFv +80070004:GetCursorX__Q22ms10CharWriterCFv +8007000c:GetCursorY__Q22ms10CharWriterCFv +80070014:GetCursorZ__Q22ms10CharWriterCFv +8006fe40:GetFixedWidth__Q22ms10CharWriterCfv +8006eee4:GetFont__Q22ms10CharWriterCFv +8006fd60:GetFontAscent__Q22ms10CharWriterCFv +8006fdc8:GetFontDescent_Q22ms10CharWriterCFv +8006fcf8:GetFontHeight__Q22ms10CharWriterCFv +8006fc90:GetFontWidth__Q22ms10CharWriterCFv +8006fc78:GetScaleH__Q22ms10CharWriterCFv +8006fc80:GetScaleV__Q22ms10CharWriterCFv +8006fc3c:GetTextColor__Q22ms10CharWriterCFv + +// CUSTOM +27,5,73648:g_commonSndGroupOverrideName +27,5,736B0:g_commonSndGroupHeapLevels +80406920:MOD_PATCH_DIR +27,1,00224AF4:getItemPac__5StageFPP9gfArchivePP9gfArchive6itKindiPP9gfArchivePP21itCustomizerInterface +27,1,002A904C:getRandBasicItemSheet__9itManagerF7itGenId +27,1,002A4FF8:preloadAssist__9itManagerF6itKindi +27,1,00224B08:getDestroyBossParamCommon__5StageFUlii + + diff --git a/include/lib/BrawlHeaders/fix_asserts.py b/include/lib/BrawlHeaders/fix_asserts.py new file mode 100644 index 0000000000..9513fb1659 --- /dev/null +++ b/include/lib/BrawlHeaders/fix_asserts.py @@ -0,0 +1,19 @@ +import os +import sys +import re +import subprocess + +from pathlib import Path +result = list(Path(".").rglob("*.[hH]")) + +for path in result: + print(path) + f = open(path, 'a+') + f.seek(0) + data = f.read() + f.truncate(0) + data = re.sub(r'STATIC_CHECK\((.*)\)\s*\};', r'};\nstatic_assert(\1, "Class is wrong size!");',data,flags=re.MULTILINE) + f.write(data) + f.close() + res=subprocess.run(["clang-format", "-i","--style=file", path], check=True) + \ No newline at end of file diff --git a/include/lib/BrawlHeaders/hk410/include/hkmath/hkMath.h b/include/lib/BrawlHeaders/hk410/include/hkmath/hkMath.h new file mode 100644 index 0000000000..b5e029494c --- /dev/null +++ b/include/lib/BrawlHeaders/hk410/include/hkmath/hkMath.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace hkMath { + float fabs(float); + float sqrt(float); + float acos(float); + float asin(float); + + template + T min2(T val1, T val2) { + if (val2 > val1) { + return val1; + } + return val2; + } + + template + T max2(T val1, T val2) { + if (val1 > val2) { + return val1; + } + return val2; + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/macros.h b/include/lib/BrawlHeaders/nw4r/include/macros.h new file mode 100644 index 0000000000..402972ac55 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/macros.h @@ -0,0 +1,95 @@ +/** + * Common macros + */ + +#ifndef MACROS_H +#define MACROS_H + +/****************************************************************************** + * + * Strings + * + ******************************************************************************/ + +// Stringify expression +#define __STR(x) #x +#define STR(x) __STR(x) + +// Concatenate strings +#define __CONCAT(x, y) x##y +#define CONCAT(x, y) __CONCAT(x, y) + +// Multi-character character constants +// clang-format off +#define TWOCC(c0, c1) \ + (u32)((c0 & 0xFF) << 8 | (c1 & 0xFF)) +#define THREECC(c0, c1, c2) \ + (u32)((c0 & 0xFF) << 16 | (c1 & 0xFF) << 8 | (c2 & 0xFF)) +#define FOURCC(c0, c1, c2, c3) \ + (u32)((c0 & 0xFF) << 24 | (c1 & 0xFF) << 16 | (c2 & 0xFF) << 8 | (c3 & 0xFF)) +// clang-format on + +/****************************************************************************** + * + * Arithmetic + * + ******************************************************************************/ + +// Min/max expression +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#define MIN(x, y) ((x) < (y) ? (x) : (y)) + +// Clamp to a range +#define CLAMP(low, high, x) \ + ((x) > (high) ? (high) : ((x) < (low) ? (low) : (x))) + +// Round up value +#define ROUND_UP(x, align) (((x) + (align) - 1) & (-(align))) +#define ROUND_UP_PTR(x, align) \ + ((void*)((((u32)(x)) + (align) - 1) & (~((align) - 1)))) + +// Round down value +#define ROUND_DOWN(x, align) ((x) & (-(align))) +#define ROUND_DOWN_PTR(x, align) ((void*)(((u32)(x)) & (~((align) - 1)))) + +// Distance between pointers +#define PTR_DISTANCE(start, end) ((u8*)(end) - (u8*)(start)) + +/****************************************************************************** + * + * Arrays + * + ******************************************************************************/ + +// Size of compile-time arrays +#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) +#define LENGTHOF(x) ARRAY_SIZE(x) + +// Declare an array of hardware registers +#define DECL_HW_REGS(NAME) FLEXIBLE_ARRAY(NAME##_HW_REGS) + +/****************************************************************************** + * + * Intrinsics + * + ******************************************************************************/ + +// Memory clear intrinsic +#define MEMCLR(x) __memclr((x), sizeof(*(x))) + +/****************************************************************************** + * + * Attributes + * + ******************************************************************************/ + +// Alignment attribute +#define ALIGN(x) __attribute__((aligned(x))) + +// Place a symbol in a specific ELF section +#define DECL_SECTION(x) __declspec(section x) + +// Give a symbol weak linkage +#define DECL_WEAK __declspec(weak) + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmchr.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmchr.h new file mode 100644 index 0000000000..69036713a9 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmchr.h @@ -0,0 +1,59 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + struct ResAnmChrData { + u8 _spacer[0x14]; + u32 m_stringOffset; + u8 _spacer2[0x4]; + u16 m_animLength; + }; + class ResAnmChr : public ResCommon { + public: + inline ResAnmChr() : ResCommon() {} + inline ResAnmChr(void* data) : ResCommon(data) {} + }; + static_assert(sizeof(ResAnmChr) == 4, "Class is wrong size!"); + + class AnmObjChrRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + virtual void G3dProc(int unk1, int unk2, int unk3); + virtual ~AnmObjChrRes(); + virtual int* GetTypeObj(); + virtual int GetTypeName(); + virtual void SetFrame(float frame); + virtual float GetFrame(); + virtual void UpdateFrame(); + virtual void SetUpdateRate(float updateRate); + virtual float GetUpdateRate(); + virtual int Bind(ResMdl mdl); + virtual void Release(); + virtual int* GetResult(int* unk1, int unk2); + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + virtual void SetWeight(float unk1, int* unk2); // TODO + virtual float GetWeight(int unk1); // TODO + virtual int Bind(int* unk1, u32 unk2, int unk3); + virtual void Release(int* unk1, u32 unk2, int unk3); + void DisableID(u32 id); + + static AnmObjChrRes* Construct(MEMAllocator* allocator, int* size, ResAnmChr anim, ResMdl mdl, bool hasCache); + + char _spacer[40]; + + ResAnmChr m_anmChrFile; + + char _spacer2[4]; + }; + } +} + +// Size: 52 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmclr.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmclr.h new file mode 100644 index 0000000000..cc7afb285e --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmclr.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmClrData { + char _spacer2[0x1C]; + unsigned short m_animLength; + }; + class ResAnmClr : public ResCommon { + public: + inline ResAnmClr() : ResCommon() {} + inline ResAnmClr(void* data) : ResCommon(data) {} + }; + + class AnmObjMatClrRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmObjMatClrRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(ResMdl mdl); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + + static AnmObjMatClrRes* Construct(MEMAllocator* allocator, int* size, ResAnmClr anim, ResMdl mdl, bool hasCache); + + char _spacer[40]; + + ResAnmClr m_anmMatClrFile; + + char _spacer2[4]; + }; + } +} + +// Size: 52 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmscn.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmscn.h new file mode 100644 index 0000000000..8826945519 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmscn.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmScnData { + char _spacer2[0x30]; + unsigned short m_animLength; + }; + class ResAnmScn : public ResCommon { + public: + inline ResAnmScn() : ResCommon() {} + inline ResAnmScn(void* data) : ResCommon(data) {} + }; + + class AnmScnRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmScnRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(int* unk1); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + + static AnmScnRes* Construct(MEMAllocator* allocator, int* instanceSize, ResAnmScn scn, bool hasCache); + + char _spacer[52]; + }; + } +} + +// Size: 56 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmshp.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmshp.h new file mode 100644 index 0000000000..7306775944 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmshp.h @@ -0,0 +1,69 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmShpData { + char _spacer2[0x20]; + unsigned short m_animLength; + }; + class ResAnmShp : public ResCommon { + public: + inline ResAnmShp() : ResCommon() {} + inline ResAnmShp(void* data) : ResCommon(data) {} + }; + + class AnmObjShpRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmObjShpRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(ResMdl mdl); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + + virtual void SetWeight(float unk1, int* unk2); // TODO + virtual float GetWeight(int unk1); // TODO + + static AnmObjShpRes* Construct(MEMAllocator* allocator, int* instanceSize, ResAnmShp anim, ResMdl mdl, bool hasCache); + + char _spacer[40]; + + ResAnmShp m_anmShpFile; + + char _spacer3[8]; + }; + static_assert(sizeof(AnmObjShpRes) == 56, "Class is wrong size!"); + } +} + +// Size: 56 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexpat.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexpat.h new file mode 100644 index 0000000000..ba75e5bb16 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexpat.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmTexPatData { + char _spacer2[0x2C]; + unsigned short m_animLength; + }; + class ResAnmTexPat : public ResCommon { + public: + inline ResAnmTexPat() : ResCommon() {} + inline ResAnmTexPat(void* data) : ResCommon(data) {} + }; + + class AnmObjTexPatRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmObjTexPatRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(ResMdl mdl); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + + static AnmObjTexPatRes* Construct(MEMAllocator* allocator, int* instanceSize, ResAnmTexPat anim, ResMdl mdl, bool hasCache); + + char _spacer[40]; + + ResAnmTexPat m_anmTexPatFile; + + char _spacer2[4]; + }; + } +} + +// Size: 52 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexsrt.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexsrt.h new file mode 100644 index 0000000000..0e7ad08205 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmtexsrt.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmTexSrtData { + char _spacer2[0x1C]; + unsigned short m_animLength; + }; + class ResAnmTexSrt : public ResCommon { + public: + inline ResAnmTexSrt() : ResCommon() {} + inline ResAnmTexSrt(void* data) : ResCommon(data) {} + }; + + class AnmObjTexSrtRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmObjTexSrtRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(ResMdl mdl); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + virtual void DetachAll(); + + static AnmObjTexSrtRes* Construct(MEMAllocator* allocator, int* instanceSize, ResAnmTexSrt anim, ResMdl mdl, bool hasCache); + + char _spacer[40]; + + ResAnmTexSrt m_anmTexSrtFile; + + char _spacer2[4]; + }; + } +} + +// Size: 52 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmvis.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmvis.h new file mode 100644 index 0000000000..522ce5046c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_anmvis.h @@ -0,0 +1,62 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResAnmVisData { + char _spacer2[0x1C]; + unsigned short m_animLength; + }; + class ResAnmVis : public ResCommon { + public: + inline ResAnmVis() : ResCommon() {} + inline ResAnmVis(void* data) : ResCommon(data) {} + }; + + class AnmObjVisRes : public G3dObj { + public: + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~AnmObjVisRes(); + + virtual int* GetTypeObj(); + + virtual int GetTypeName(); + + virtual void SetFrame(float frame); + + virtual float GetFrame(); + + virtual void UpdateFrame(); + + virtual void SetUpdateRate(float updateRate); + + virtual float GetUpdateRate(); + + virtual int Bind(ResMdl mdl); + + virtual void Release(); + + virtual int* GetResult(int* unk1, int unk2); + + virtual int Attach(int unk1, int* unk2); // TODO + virtual int* Detach(int unk1); // TODO + + static AnmObjVisRes* Construct(MEMAllocator* allocator, int* instanceSize, ResAnmVis anim, ResMdl mdl); + + char _spacer[40]; + + ResAnmVis m_anmVisFile; + }; + } +} + +// Size: 48 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_calcworldcallback.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_calcworldcallback.h new file mode 100644 index 0000000000..48d54d8fe2 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_calcworldcallback.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace nw4r { + namespace g3d { + + class ICalcWorldCallBack { + + public: + virtual ~ICalcWorldCallBack(); + virtual void ExecCallbackA(int* unk1, int unk2, int* unk3); // TODO + virtual void ExecCallbackB(int* unk1, int unk2, int* unk3); // TODO + virtual void ExecCallbackC(); // TODO + }; + + } // namespace g3d +} // namespace nw4r \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_light.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_light.h new file mode 100644 index 0000000000..352c256423 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_light.h @@ -0,0 +1,7 @@ +#pragma once + +namespace nw4r { namespace g3d { + class LightObj { + // NW4R TODO + }; +}} diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_obj.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_obj.h new file mode 100644 index 0000000000..264a3a66c6 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_obj.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +namespace nw4r { + namespace g3d { + class G3dObj { + public: + void Destroy(); + G3dObj* DetachFromParent(); + + virtual u32 IsDerivedFrom(int* unk1); + virtual void G3dProc(int unk1, int unk2, int unk3); + virtual ~G3dObj(); + }; + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_rescommon.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_rescommon.h new file mode 100644 index 0000000000..1b3cdfe62d --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_rescommon.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +namespace nw4r { + namespace g3d { + struct ResBlockHeaderData { + char kind[4]; + u32 size; + }; + + template + class ResCommon { + T* m_dataPtr; + + public: + inline ResCommon() { m_dataPtr = NULL; } + inline ResCommon(void* data) : m_dataPtr(static_cast(data)) {} + inline ResCommon(const void* data) : m_dataPtr(static_cast(data)) {} + + inline T& ref() const { return *m_dataPtr; } + inline T* ptr() const { return m_dataPtr; } + T& operator*() const { return *m_dataPtr; } + T* operator->() const { return m_dataPtr; } + inline bool IsValid() const { return m_dataPtr != NULL; } + }; + + } // namespace g3d +} // namespace nw4r diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resdict.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resdict.h new file mode 100644 index 0000000000..f21f145cd0 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resdict.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace nw4r { + namespace g3d { + struct ResDicData { + u32 size; + u32 numData; + struct ResDicNodeData { + u16 ref; + u16 flag; + u16 idxLeft; + u16 idxRight; + s32 ofsString; + s32 ofsData; + } data[1]; + }; + + } +} \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resfile.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resfile.h new file mode 100644 index 0000000000..c1c98d7bbb --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resfile.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + struct ResFileHeaderData { + char magic[4]; + u16 endian; + u16 version; + u32 fileSize; + u16 headerSize; + u16 dataBlocks; + }; + + struct ResTopLevelDictData { + ResBlockHeaderData header; + ResDicData data; + }; + + struct ResFileData { + ResFileHeaderData fileHeader; + ResTopLevelDictData dict; + }; + + // NOTE: + // This is supposed to be a class, + // but until we know ResFile's size + // we can treat it as an opaque pointer + class ResFile : public ResCommon { + /* data */ + public: + inline ResFile() : ResCommon() {} + inline ResFile(ResFileData* data) : ResCommon(data) {} + inline ResFile(void* data) : ResCommon(data) {} + + static void Init(void* arg); + void Release(); + + u32 GetResMdlNumEntries() const; + u32 GetResAnmChrNumEntries(); + u32 GetResAnmClrNumEntries(); + u32 GetResAnmVisNumEntries(); + u32 GetResAnmTexPatNumEntries(); + u32 GetResAnmTexSrtNumEntries(); + u32 GetResAnmShpNumEntries(); + u32 GetResAnmScnNumEntries(); + + ResAnmChr GetResAnmChr(int index); + ResAnmChr GetResAnmChr(u32 index); + ResAnmClr GetResAnmClr(int index); + ResAnmClr GetResAnmClr(u32 index); + ResAnmVis GetResAnmVis(int index); + ResAnmVis GetResAnmVis(u32 index); + ResAnmTexPat GetResAnmTexPat(int index); + ResAnmTexPat GetResAnmTexPat(u32 index); + ResAnmTexSrt GetResAnmTexSrt(int index); + ResAnmTexSrt GetResAnmTexSrt(u32 index); + ResAnmShp GetResAnmShp(int index); + ResAnmScn GetResAnmScn(int index); + + ResTex GetResTex(int index); + ResTex GetResTex(const char* name); + + bool HasResTex(); + bool HasResAnmChr(); + bool HasResAnmClr(); + bool HasResAnmVis(); + bool HasResAnmTexPat(); + bool HasResAnmTexSrt(); + bool HasResAnmShp(); + bool HasResAnmScn(); + }; + } // namespace g3d +} // namespace nw4r diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmat.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmat.h new file mode 100644 index 0000000000..833fe613d7 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmat.h @@ -0,0 +1,138 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + +// Forward declarations +class ResFile; + + struct ResTexSrtData { + union { + struct { + int _pad : 25; + bool m_flag6 : 1; // & 0x40 + bool m_flag5 : 1; // & 0x20 + bool m_flag4 : 1; // & 0x10 + bool m_flag3 : 1; // & 8 + bool m_flag2 : 1; // & 4 + bool m_flag1 : 1; // & 2 + bool m_flag0 : 1; // & 1 + }; + u32 m_flags; + }; + char _4[4]; + Vec2f m_range; + char _16[4]; + Vec2f m_pos; + char _28[560]; + }; + + class ResTexSrt : public ResCommon { + public: + inline ResTexSrt(void* data) : ResCommon(data) {} + + bool SetMapMode(u32, u32, int, int); + }; + + + struct ResTexObjData { + int _0; + GXTexObj m_texObjs[8]; + }; + + class ResTexObj : public ResCommon { + public: + inline ResTexObj(void* data) : ResCommon(data) {} + + GXTexObj* GetTexObj(GXTexMapID); + }; + + struct GenModeData { + u8 m_numTexGens; + u8 m_numLightChans; + u8 m_activeTevStages; + u8 m_numIndTexStages; + }; + struct MiscData { + u8 m_depthTestBeforeTexture; + s8 m_lightSet; + s8 m_fogSet; + u8 m_pad; + u8 m_indirectMethod1; + u8 m_indirectMethod2; + u8 m_indirectMethod3; + u8 m_indirectMethod4; + s8 m_normMapRefLight1; + s8 m_normMapRefLight2; + s8 m_normMapRefLight3; + s8 m_normMapRefLight4; + }; + + struct ResMatData { + u32 m_size; + s32 m_offToMdl; + s32 m_name; + u32 m_id; + u32 m_flags; + + GenModeData m_genData; + MiscData m_misc; + + s32 m_offToShaders; + u32 m_numTextures; + s32 m_offToMatRefs; + + s32 m_offToFurData; + s32 m_offToUserDataoffToUserData; + s32 m_offToDisplayLists; + + ResTexObjData m_resTexObjData; + + char _320[100]; + + ResTexSrtData m_resTexSrtData; + + + }; + static_assert(sizeof(ResMatData) == 1008, "Class is wrong size!"); + // there may be more after this? Check the file format. This is just to verify that offsets are correct + // Needs verification + + struct ResTevColorDL { + union { + struct + { + u8 m_tevColor[3][20]; + u8 _padding[4]; + u8 m_tevKColor[4][10]; + u8 _padding2[0x18]; + } dl; + u8 data[0x80]; + }; + }; + + class ResMatTevColor : public ResCommon { + private: + public: + void GXSetTevColor(u32 id, GXColor color); + }; + + class ResMat : public ResCommon { + public: + inline ResMat() : ResCommon() {} + inline ResMat(void* data) : ResCommon(data) {} + + void Bind(const nw4r::g3d::ResFile file); + void Release(); + void ForceBindTex(ResTex,const char*); + void DCStore(bool sync); + }; + } // namespace g3d +} // namespace nw4r diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmdl.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmdl.h new file mode 100644 index 0000000000..dcea3e88cf --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resmdl.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResMdlData; // TODO + + class ResMdl : public ResCommon { + + /* data */ + public: + inline ResMdl() : ResCommon() {} + inline ResMdl(void* data) : ResCommon(data) {} + + ResMat GetResMat(const char* name) const; + u32 GetResNodeNumEntries(); + ResNode GetResNode(const int nodeIndex) const; + ResNode GetResNode(const u32 nodeIndex) const; + ResNode GetResNode(const char* nodeName) const; + }; + + } // namespace g3d +} // namespace nw4r diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resnode.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resnode.h new file mode 100644 index 0000000000..0f4fe5e76f --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_resnode.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResNodeData { + public: + char _0[8]; + u32 m_nodeNameStrOffset; + u32 m_nodeIndex; + char _32[16]; + Vec3f m_scale; + Vec3f m_rotation; + Vec3f m_translation; + char _68[140]; + }; + static_assert(sizeof(ResNodeData) == 208, "Class is wrong size!"); + + class ResNode : public ResCommon { + /* data */ + public: + void SetTranslate(float x, float y, float z); + }; + + } // namespace g3d +} // namespace nw4 \ No newline at end of file diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_restex.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_restex.h new file mode 100644 index 0000000000..81cc15c45d --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_restex.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + + struct ResTexData; // TODO + + class ResTex : public ResCommon { + + /* data */ + public: + inline ResTex() : ResCommon() {} + inline ResTex(void* data) : ResCommon(data) {} + }; + + } // namespace g3d +} // namespace nw4r diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scngroup.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scngroup.h new file mode 100644 index 0000000000..1a677ee46b --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scngroup.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include + +namespace nw4r { +namespace g3d { +class ScnGroup { + +public: + // TODO + virtual u32 IsDerivedFrom(int* unk1); + virtual void G3dProc(int unk1, int unk2, int unk3); + virtual ~ScnGroup(); + virtual void* GetTypeObj(); + virtual char* GetTypeName(); + virtual void ForEach(); + virtual void SetScnObjOption(); + virtual int GetScnObjOption(); + virtual void GetValueForSortOpa(); + virtual void GetValueForSortXlu(); + virtual void CalcWorldMtx(); + virtual void Insert(int sceneId, nw4r::g3d::ScnObj* scnObj); + virtual void Remove(u32); + virtual void Remove(nw4r::g3d::ScnObj* obj); + // 0x4 (coz vtable above it) + char spacer2[0xE0]; + int sceneItemsCount; +}; +} +} +// Size: 220 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdl.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdl.h new file mode 100644 index 0000000000..13750ef831 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdl.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include + +namespace nw4r { + namespace g3d { + + // TODO ScnMdlSimple and all subsequent classes + class ScnMdl : public ScnMdlSimple { + private: + char _spacer[80]; + + public: + class CopiedMatAccess { + private: + ScnMdl* m_scnMdl; + u32 m_MatID; + char spacer[0x28]; + + public: + CopiedMatAccess(ScnMdl* scnMdl, u32 matID); + ResMatTevColor GetResMatTevColor(bool sync); + }; + + class CopiedVisAccess { + public: + CopiedVisAccess(ScnMdl* pScnMdl, u32 id); + + bool IsVisible() const; + bool SetVisibility(bool visible); + + private: + ScnMdl* mpScnMdl; // at 0x0 + u32 mNodeID; // at 0x4 + u8* mpVis; // at 0x8 + }; + + // TODO + virtual u32 IsDerivedFrom(int* unk1); + virtual void G3dProc(int unk1, int unk2, int unk3); + virtual ~ScnMdl(); + + static ScnMdl* Construct(void* memAllocator, int x, int y, void* scnModel); + static void Pushback(void* thing, void* thing2, const char* str); // PushBack/[nw4r3g3d12ScnMdlExpandFPQ34nw4r3g3]/(g3d_scnmdlexpand.o) + }; + } +} + +// Size: 392 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdlsmpl.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdlsmpl.h new file mode 100644 index 0000000000..12e7694425 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnmdlsmpl.h @@ -0,0 +1,61 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace nw4r { + namespace g3d { + class AnmObj; + + class ScnMdlSimple : public ScnObj { + public: + enum AnmObjType { + ANMOBJTYPE_CHR, + ANMOBJTYPE_VIS, + ANMOBJTYPE_MATCLR, + ANMOBJTYPE_TEXPAT, + ANMOBJTYPE_TEXSRT, + ANMOBJTYPE_SHP, + ANMOBJTYPE_NOT_SPECIFIED, + + ANMOBJTYPE_VTX = ANMOBJTYPE_SHP + }; + + // FIXME: placeholders for inherited members until nw4r is updated + virtual void vfunc1(); + virtual void vfunc2(); + virtual void G3dProc(u32 task, u32 param, void* pInfo); // at 0xC + virtual ~ScnMdlSimple(); // at 0x10 + + virtual bool SetScnObjOption(u32 option, u32 value); // at 0x20 + virtual bool GetScnObjOption(u32 option, u32* pValue) const; // at 0x24 + + // FIXME: placeholders for inherited members until nw4r is updated + virtual void vfunc3(); + virtual void vfunc4(); + virtual void vfunc5(); + virtual bool SetAnmObj(AnmObj* pObj, AnmObjType type); // at 0x34 + virtual bool RemoveAnmObj(AnmObj* pObj); // at 0x38 + virtual AnmObj* RemoveAnmObj(AnmObjType type); // at 0x3C + virtual AnmObj* GetAnmObj(AnmObjType type); // at 0x40 + virtual const AnmObj* GetAnmObj(AnmObjType type) const; // at 0x44 + + char _spacer[12]; + ResMdl m_resMdl; // +0xE8 + char _spacer2[48]; + ICalcWorldCallBack* m_calcWorldCallBack; + char _spacer3[2]; + short m_nodeIndex; + char _spacer4[20]; + + void EnableScnMdlCallbackTiming(u32 flags); + void UpdateFrame(); + bool GetScnMtxPos(math::MTX34* pMtx, ScnObjMtxType type, u32 idx) const; + }; + } +} + +// Size: 312 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnobj.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnobj.h new file mode 100644 index 0000000000..2f3ca331d1 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/g3d/g3d_scnobj.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include + +namespace nw4r { + namespace g3d { + + class ScnObj { + public: + enum ScnObjMtxType { MTX_LOCAL, MTX_WORLD, MTX_VIEW, MTX_TYPE_MAX }; + // TODO + virtual u32 IsDerivedFrom(int* unk1); + + virtual void G3dProc(int unk1, int unk2, int unk3); + + virtual ~ScnObj(); + + char _spacer[216]; + + void SetPriorityDrawOpa(int prio); + + void SetPriorityDrawXlu(int prio); + + }; + } +} +//// Size: 220 diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math.h new file mode 100644 index 0000000000..ea99d35f23 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math.h @@ -0,0 +1,9 @@ +#ifndef NW4R_PUBLIC_MATH_H +#define NW4R_PUBLIC_MATH_H + +#include +#include +#include +#include + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_arithmetic.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_arithmetic.h new file mode 100644 index 0000000000..b82d341cac --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_arithmetic.h @@ -0,0 +1,154 @@ +#ifndef NW4R_MATH_ARITHMETIC_H +#define NW4R_MATH_ARITHMETIC_H +#include + +#include + +#include + +#include + +namespace nw4r { +namespace math { + +/****************************************************************************** + * + * Implementation details + * + ******************************************************************************/ +namespace detail { + +f32 FExp(f32 x); +f32 FLog(f32 x); + +} // namespace detail + +/****************************************************************************** + * + * Arithmetic functions + * + ******************************************************************************/ +f32 FrSqrt(f32 x); + +inline f32 FAbs(register f32 x) { + register f32 ax; + + // clang-format off + asm { + fabs ax, x + } + // clang-format on + + return ax; +} + +inline f32 FCeil(f32 x) { + return std::ceilf(x); +} + +inline f32 FExp(f32 x) { + return detail::FExp(x); +} + +inline f32 FFloor(f32 x) { + return std::floorf(x); +} + +inline f32 FInv(register f32 x) { + register f32 work0, work1, work2, work3; + + // clang-format off + asm { + fmr work1, x // x + fres work0, work1 // 1/x + + // Refine estimate + ps_add work2, work0, work0 // 2/x + ps_mul work3, work0, work0 // 1/x^2 + ps_nmsub work0, work1, work3, work2 // -(x * 1/x^2 - 2/x) + } + // clang-format on + + return work0; +} + +inline f32 FMod(f32 x, f32 y) { + return std::fmodf(x, y); +} + +inline f32 FModf(f32 x, f32* pY) { + return std::modff(x, pY); +} + +inline f32 FSqrt(f32 x) { + return x <= 0.0f ? 0.0f : x * FrSqrt(x); +} + +inline f32 FLog(f32 x) { + if (x > 0.0f) { + return detail::FLog(x); + } + + return NW4R_MATH_QNAN; +} + +inline f32 FSelect(register f32 value, register f32 ge_zero, + register f32 lt_zero) { + register f32 ret; + + // clang-format off + asm { + fsel ret, value, ge_zero, lt_zero + } + // clang-format on + + return ret; +} + +/****************************************************************************** + * + * Fastcast functions + * + ******************************************************************************/ +inline f32 U16ToF32(u16 arg) { + f32 ret; + OSu16tof32(&arg, &ret); + return ret; +} +inline u16 F32ToU16(f32 arg) { + u16 ret; + OSf32tou16(&arg, &ret); + return ret; +} + +inline f32 S16ToF32(s16 arg) { + f32 ret; + OSs16tof32(&arg, &ret); + return ret; +} +inline s16 F32ToS16(f32 arg) { + s16 ret; + OSf32tos16(&arg, &ret); + return ret; +} + +inline u32 F32AsU32(f32 arg) { + return *reinterpret_cast(&arg); +} +inline f32 U32AsF32(u32 arg) { + return *reinterpret_cast(&arg); +} + +inline s32 FGetExpPart(f32 x) { + s32 s = F32AsU32(x); + return ((s >> 23) & 0xFF) - 127; +} +inline f32 FGetMantPart(f32 x) { + u32 u = F32AsU32(x); + return U32AsF32((u & 0x807FFFFF) | 0x3F800000); +} + +} // namespace math +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_constant.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_constant.h new file mode 100644 index 0000000000..95640d44b3 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_constant.h @@ -0,0 +1,43 @@ +#ifndef NW4R_MATH_CONSTANT_H +#define NW4R_MATH_CONSTANT_H +#include + +#include + +/****************************************************************************** + * + * Mathematical constants + * + ******************************************************************************/ +// Pi mathematical constant +#define NW4R_MATH_PI M_PI + +// ln(2) +#define NW4R_MATH_LN_2 0.69314718056f + +// 1 / sqrt(3) +#define NW4R_MATH_INVSQRT3 0.577350258f + +/****************************************************************************** + * + * Not-a-number (NaN) types + * + ******************************************************************************/ +// Quiet NaN (0x7FC00000) +#define NW4R_MATH_QNAN (-(0.0f / 0.0f)) + +/****************************************************************************** + * + * Float limits + * + ******************************************************************************/ +// Smallest finite floating-point value +#define NW4R_MATH_FLT_MIN 1.175494350e-38f + +// Largest finite floating-point value +#define NW4R_MATH_FLT_MAX 3.402823466e+38f + +// Difference between 1.0 and the next representable value +#define NW4R_MATH_FLT_EPSILON 1.192092895e-7f + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_geometry.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_geometry.h new file mode 100644 index 0000000000..9b8615fce5 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_geometry.h @@ -0,0 +1,115 @@ +#ifndef NW4R_MATH_GEOMETRY_H +#define NW4R_MATH_GEOMETRY_H +#include + +#include + +namespace nw4r { +namespace math { + +// Forward declarations +struct AABB; + +enum IntersectionResult { + INTERSECTION_NONE, + INTERSECTION_1, + INTERSECTION_2, + + INTERSECTION_LINE3_ON_PLANE = INTERSECTION_2, + INTERSECTION_RAY3_ON_PLANE = INTERSECTION_2, + INTERSECTION_SEGMENT3_ON_PLANE = INTERSECTION_2, + + INTERSECTION_OUTSIDE = 0, + INTERSECTION_INSIDE, + INTERSECTION_INTERSECT +}; + +bool IntersectionAABB(const AABB* pA, const AABB* pB); + +/****************************************************************************** + * + * Plane + * + ******************************************************************************/ +struct PLANE { + PLANE() {} + + f32 Test(const VEC3& rPoint) const { + return d + VEC3Dot(&n, &rPoint); + } + + void Set(const VEC3* p0, const VEC3* p1, const VEC3* p2); + + VEC3 n; // at 0x0 + f32 d; // at 0xC +}; + +/****************************************************************************** + * + * Axis-aligned bounding box + * + ******************************************************************************/ +struct AABB { + AABB() {} + + void Set(const VEC3* pPoints, unsigned int num); + void Set(const AABB* pBox, const MTX34* pMtx); + + VEC3 min; // at 0x0 + VEC3 max; // at 0xC +}; + +/****************************************************************************** + * + * Frustum + * + ******************************************************************************/ +class FRUSTUM { +private: + enum Point { + POINT_NEAR_TL, + POINT_NEAR_TR, + POINT_NEAR_BR, + POINT_NEAR_BL, + + POINT_FAR_TL, + POINT_FAR_TR, + POINT_FAR_BR, + POINT_FAR_BL, + + POINT_MAX + }; + + enum Plane { + PLANE_L, + PLANE_R, + PLANE_N, + PLANE_F, + PLANE_T, + PLANE_B, + + PLANE_MAX + }; + +public: + void Set(f32 fovy, f32 aspect, f32 n, f32 f, const MTX34& rCamMtx); + void Set(f32 t, f32 b, f32 l, f32 r, f32 n, f32 f, const MTX34& rCamMtx); + + IntersectionResult IntersectAABB_Ex(const AABB* pBox) const; + +private: + MTX34 mCamMtx; // at 0x0 + PLANE mPlaneL; // at 0x30 + PLANE mPlaneR; // at 0x40 + PLANE mPlaneT; // at 0x50 + PLANE mPlaneB; // at 0x60 + f32 mNearZ; // at 0x70 + f32 mFarZ; // at 0x74 + AABB mBox; // at 0x78 + PLANE mPlanes[PLANE_MAX]; // at 0x90 +}; + +} // namespace math +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_triangular.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_triangular.h new file mode 100644 index 0000000000..572c965492 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_triangular.h @@ -0,0 +1,122 @@ +#ifndef NW4R_MATH_TRIANGULAR_H +#define NW4R_MATH_TRIANGULAR_H +#include + +#include +#include + +/****************************************************************************** + * + * Macros to convert between units + * + ******************************************************************************/ +// [0, 65535] -> [0.0, 256.0f] +#define NW4R_MATH_IDX_TO_FIDX(x) ((x) * (1.0f / 256.0f)) + +// Convert degrees <-> lookup-table index +#define NW4R_MATH_DEG_TO_FIDX(x) ((x) * (256.0f / 360.0f)) +#define NW4R_MATH_FIDX_TO_DEG(x) ((x) * (360.0f / 256.0f)) + +// Convert radians <-> lookup-table index +#define NW4R_MATH_RAD_TO_FIDX(x) ((x) * (128.0f / NW4R_MATH_PI)) +#define NW4R_MATH_FIDX_TO_RAD(x) ((x) * (NW4R_MATH_PI / 128.0f)) + +// Convert degrees <-> radians +#define NW4R_MATH_DEG_TO_RAD(x) ((x) * (NW4R_MATH_PI / 180.0f)) +#define NW4R_MATH_RAD_TO_DEG(x) ((x) * (180.0f / NW4R_MATH_PI)) + +namespace nw4r { +namespace math { + +/****************************************************************************** + * + * Sin functions + * + ******************************************************************************/ +f32 SinFIdx(f32 fidx); + +inline f32 SinIdx(u16 idx) { + return SinFIdx(NW4R_MATH_IDX_TO_FIDX(U16ToF32(idx))); +} +inline f32 SinDeg(f32 deg) { + return SinFIdx(NW4R_MATH_DEG_TO_FIDX(deg)); +} +inline f32 SinRad(f32 rad) { + return SinFIdx(NW4R_MATH_RAD_TO_FIDX(rad)); +} + +/****************************************************************************** + * + * Cosine functions + * + ******************************************************************************/ +f32 CosFIdx(f32 fidx); + +inline f32 CosDeg(f32 deg) { + return CosFIdx(NW4R_MATH_DEG_TO_FIDX(deg)); +} +inline f32 CosRad(f32 rad) { + return CosFIdx(NW4R_MATH_RAD_TO_FIDX(rad)); +} + +/****************************************************************************** + * + * Tangent functions + * + ******************************************************************************/ +inline f32 TanFIdx(f32 fidx) { + return std::tanf(NW4R_MATH_FIDX_TO_RAD(fidx)); +} +inline f32 TanDeg(f32 deg) { + return TanFIdx(NW4R_MATH_DEG_TO_FIDX(deg)); +} +inline f32 TanRad(f32 rad) { + return TanFIdx(NW4R_MATH_RAD_TO_FIDX(rad)); +} + +/****************************************************************************** + * + * Sin & cosine functions + * + ******************************************************************************/ +void SinCosFIdx(f32* pSin, f32* pCos, f32 fidx); + +inline void SinCosDeg(f32* pSin, f32* pCos, f32 deg) { + return SinCosFIdx(pSin, pCos, NW4R_MATH_DEG_TO_FIDX(deg)); +} +inline void SinCosRad(f32* pSin, f32* pCos, f32 rad) { + return SinCosFIdx(pSin, pCos, NW4R_MATH_RAD_TO_FIDX(rad)); +} + +/****************************************************************************** + * + * Arc-tangent functions + * + ******************************************************************************/ +f32 AtanFIdx(f32 x); + +inline f32 AtanDeg(f32 x) { + return NW4R_MATH_FIDX_TO_DEG(AtanFIdx(x)); +} +inline f32 AtanRad(f32 x) { + return NW4R_MATH_FIDX_TO_RAD(AtanFIdx(x)); +} + +/****************************************************************************** + * + * Arc-tangent (2-argument) functions + * + ******************************************************************************/ +f32 Atan2FIdx(f32 y, f32 x); + +inline f32 Atan2Deg(f32 y, f32 x) { + return NW4R_MATH_FIDX_TO_DEG(Atan2FIdx(y, x)); +} +inline f32 Atan2Rad(f32 y, f32 x) { + return NW4R_MATH_FIDX_TO_RAD(Atan2FIdx(y, x)); +} + +} // namespace math +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_types.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_types.h new file mode 100644 index 0000000000..81a4436c4d --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/math/math_types.h @@ -0,0 +1,596 @@ +#ifndef NW4R_MATH_TYPES_H +#define NW4R_MATH_TYPES_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace math { + +/****************************************************************************** + * + * VEC2 structure + * + ******************************************************************************/ +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _VEC2 { + f32 x, y; +}; + +struct VEC2 : _VEC2 { + VEC2() {} + VEC2(f32 fx, f32 fy) { + x = fx; + y = fy; + } + + operator f32*() { + return reinterpret_cast(this); + } + operator const f32*() const { + return reinterpret_cast(this); + } + + VEC2 operator+(const VEC2& rRhs) const { + return VEC2(x + rRhs.x, y + rRhs.y); + } + VEC2 operator-(const VEC2& rRhs) const { + return VEC2(x - rRhs.x, y - rRhs.y); + } + + VEC2& operator+=(const VEC2& rRhs) { + x += rRhs.x; + y += rRhs.y; + return *this; + } + VEC2& operator-=(const VEC2& rRhs) { + x -= rRhs.x; + y -= rRhs.y; + return *this; + } + + bool operator==(const VEC2& rRhs) const { + return x == rRhs.x && y == rRhs.y; + } + bool operator!=(const VEC2& rRhs) const { + return x != rRhs.x || y != rRhs.y; + } +}; + +/****************************************************************************** + * + * VEC3 structure + * + ******************************************************************************/ +// Forward declarations +struct VEC3; +VEC3* VEC3Add(VEC3* pOut, const VEC3* pA, const VEC3* pB); +VEC3* VEC3Sub(VEC3* pOut, const VEC3* pA, const VEC3* pB); +VEC3* VEC3Scale(VEC3* pOut, const VEC3* pIn, f32 scale); + +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _VEC3 { + f32 x, y, z; +}; + +struct VEC3 : _VEC3 { + VEC3() {} + VEC3(f32 fx, f32 fy, f32 fz) { + x = fx; + y = fy; + z = fz; + } + VEC3(const _VEC3& rVec) { + x = rVec.x; + y = rVec.y; + z = rVec.z; + } + VEC3(const Vec& rVec) { + x = rVec.x; + y = rVec.y; + z = rVec.z; + } + VEC3(const f32* pData) { + x = pData[0]; + y = pData[1]; + z = pData[2]; + } + + operator Vec*() { + return reinterpret_cast(this); + } + operator const Vec*() const { + return reinterpret_cast(this); + } + + f32 LenSq() const { + return x * x + y * y + z * z; + } + + VEC3 operator-() const { + return VEC3(-x, -y, -z); + } + + VEC3 operator+(const VEC3& rRhs) const { + VEC3 out; + VEC3Add(&out, this, &rRhs); + return out; + } + VEC3 operator-(const VEC3& rRhs) const { + VEC3 out; + VEC3Sub(&out, this, &rRhs); + return out; + } + VEC3 operator*(f32 x) const { + VEC3 out; + VEC3Scale(&out, this, x); + return out; + } + VEC3 operator/(f32 x) const { + f32 r = 1 / x; + return *this * r; + } + + VEC3& operator+=(const VEC3& rRhs) { + VEC3Add(this, this, &rRhs); + return *this; + } + VEC3& operator-=(const VEC3& rRhs) { + VEC3Sub(this, this, &rRhs); + return *this; + } + VEC3& operator*=(f32 x) { + VEC3Scale(this, this, x); + return *this; + } + VEC3& operator/=(f32 x) { + return *this *= (1 / x); + } + + bool operator==(const VEC3& rRhs) const { + return x == rRhs.x && y == rRhs.y && z == rRhs.z; + } + bool operator!=(const VEC3& rRhs) const { + return x != rRhs.x || y != rRhs.y || z != rRhs.z; + } +}; + +/****************************************************************************** + * + * MTX33 structure + * + ******************************************************************************/ +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _MTX33 { + union { + struct { + f32 _00, _01, _02; + f32 _10, _11, _12; + f32 _20, _21, _22; + }; + + f32 m[3][3]; + f32 a[3 * 3]; + }; +}; + +struct MTX33 : _MTX33 { + MTX33() {} +}; + +/****************************************************************************** + * + * MTX34 structure + * + ******************************************************************************/ +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _MTX34 { + union { + struct { + f32 _00, _01, _02, _03; + f32 _10, _11, _12, _13; + f32 _20, _21, _22, _23; + }; + + f32 m[3][4]; + f32 a[3 * 4]; + Mtx mtx; + }; +}; + +struct MTX34 : _MTX34 { + typedef f32 (*MtxRef)[4]; + typedef const f32 (*MtxRefConst)[4]; + + MTX34() {} + + // clang-format off + MTX34(f32 f00, f32 f01, f32 f02, f32 f03, + f32 f10, f32 f11, f32 f12, f32 f13, + f32 f20, f32 f21, f32 f22, f32 f23) { + _00 = f00; _01 = f01; _02 = f02; _03 = f03; + _10 = f10; _11 = f11; _12 = f12; _13 = f13; + _20 = f20; _21 = f21; _22 = f22; _23 = f23; + } + // clang-format on + + operator MtxRef() { + return mtx; + } + operator MtxRefConst() const { + return mtx; + } +}; + +/****************************************************************************** + * + * MTX44 structure + * + ******************************************************************************/ +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _MTX44 { + union { + struct { + f32 _00, _01, _02, _03; + f32 _10, _11, _12, _13; + f32 _20, _21, _22, _23; + f32 _30, _31, _32, _33; + }; + + f32 m[4][4]; + f32 a[4 * 4]; + Mtx44 mtx; + }; +}; + +struct MTX44 : _MTX44 { + typedef f32 (*Mtx44Ref)[4]; + typedef const f32 (*Mtx44RefConst)[4]; + + MTX44() {} + + operator Mtx44Ref() { + return mtx; + } + operator Mtx44RefConst() const { + return mtx; + } +}; + +/****************************************************************************** + * + * QUAT structure + * + ******************************************************************************/ +// Provides a POD type that can be upcasted to the real structure. +// (Has the added benefit of forcing struct copies to use lwz/stw.) +struct _QUAT { + f32 x, y, z, w; +}; + +struct QUAT : _QUAT { + QUAT() {} + QUAT(f32 fx, f32 fy, f32 fz, f32 fw) { + x = fx; + y = fy; + z = fz; + w = fw; + } + + // TODO: These are not real AFAIK. Do they really manually cast the QUAT? + operator Quaternion*() { + return reinterpret_cast(this); + } + operator const Quaternion*() const { + return reinterpret_cast(this); + } +}; + +/****************************************************************************** + * + * VEC2 functions + * + ******************************************************************************/ +inline f32 VEC2Len(const VEC2* pVec) { + return FSqrt(pVec->x * pVec->x + pVec->y * pVec->y); +} + +/****************************************************************************** + * + * VEC3 functions + * + ******************************************************************************/ +VEC3* VEC3Maximize(VEC3* pOut, const VEC3* pA, const VEC3* pB); +VEC3* VEC3Minimize(VEC3* pOut, const VEC3* pA, const VEC3* pB); +VEC3* VEC3TransformNormal(VEC3* pOut, const MTX34* pMtx, const VEC3* pVec); + +inline VEC3* VEC3Add(register VEC3* pOut, register const VEC3* pA, + register const VEC3* pB) { + register f32 work0, work1, work2; + + // clang-format off + asm { + // Add XY + psq_l work0, VEC3.x(pA), 0, 0 + psq_l work1, VEC3.x(pB), 0, 0 + ps_add work2, work0, work1 + psq_st work2, VEC3.x(pOut), 0, 0 + + // Add Z + psq_l work0, VEC3.z(pA), 1, 0 + psq_l work1, VEC3.z(pB), 1, 0 + ps_add work2, work0, work1 + psq_st work2, VEC3.z(pOut), 1, 0 + } + // clang-format on + + return pOut; +} + +inline f32 VEC3Dot(register const VEC3* pA, register const VEC3* pB) { + register f32 dot; + register f32 work0, work1, work2, work3; + + // clang-format off + asm { + // YZ product + psq_l work0, VEC3.y(pA), 0, 0 + psq_l work1, VEC3.y(pB), 0, 0 + ps_mul work0, work0, work1 + + // X product + YZ product + psq_l work3, VEC3.x(pA), 1, 0 + psq_l work2, VEC3.x(pB), 1, 0 + ps_madd work1, work3, work2, work0 + + // Dot product + ps_sum0 dot, work1, work0, work0 + } + // clang-format on + + return dot; +} + +inline f32 VEC3LenSq(register const VEC3* pVec) { + register f32 work0, work1, work2; + + // clang-format off + asm { + // Square XY + psq_l work0, VEC3.x(pVec), 0, 0 + ps_mul work0, work0, work0 + + // Square Z + lfs work1, VEC3.z(pVec) + ps_madd work2, work1, work1, work0 + + // Sum products + ps_sum0 work2, work2, work0, work0 + } + // clang-format on + + return work2; +} + +inline VEC3* VEC3Lerp(register VEC3* pOut, register const VEC3* pVec1, + register const VEC3* pVec2, register f32 t) { + register f32 work0, work1, work2; + + // clang-format off + asm { + // X/Y delta + psq_l work0, VEC3.x(pVec1), 0, 0 + psq_l work1, VEC3.x(pVec2), 0, 0 + ps_sub work2, work1, work0 + // Scale with time and add to v0 + ps_madds0 work2, work2, t, work0 + psq_st work2, VEC3.x(pOut), 0, 0 + + // Z delta + psq_l work0, VEC3.z(pVec1), 1, 0 + psq_l work1, VEC3.z(pVec2), 1, 0 + ps_sub work2, work1, work0 + // Scale with time and add to v0 + ps_madds0 work2, work2, t, work0 + psq_st work2, VEC3.z(pOut), 1, 0 + } + // clang-format on + + return pOut; +} + +inline VEC3* VEC3Scale(register VEC3* pOut, register const VEC3* pIn, + register f32 scale) { + register f32 work0, work1; + + // clang-format off + asm { + // Scale XY + psq_l work0, VEC3.x(pIn), 0, 0 + ps_muls0 work1, work0, scale + psq_st work1, VEC3.x(pOut), 0, 0 + + // Scale Z + psq_l work0, VEC3.z(pIn), 1, 0 + ps_muls0 work1, work0, scale + psq_st work1, VEC3.z(pOut), 1, 0 + } + // clang-format on + + return pOut; +} + +inline VEC3* VEC3Sub(register VEC3* pOut, register const VEC3* pA, + register const VEC3* pB) { + register f32 work0, work1, work2; + + // clang-format off + asm { + // Sub XY + psq_l work0, VEC3.x(pA), 0, 0 + psq_l work1, VEC3.x(pB), 0, 0 + ps_sub work2, work0, work1 + psq_st work2, VEC3.x(pOut), 0, 0 + + // Sub Z + psq_l work0, VEC3.z(pA), 1, 0 + psq_l work1, VEC3.z(pB), 1, 0 + ps_sub work2, work0, work1 + psq_st work2, VEC3.z(pOut), 1, 0 + } + // clang-format on + + return pOut; +} + +inline VEC3* VEC3Cross(VEC3* pOut, const VEC3* pA, const VEC3* pB) { + PSVECCrossProduct(*pA, *pB, *pOut); + return pOut; +} + +inline f32 VEC3DistSq(const VEC3* pA, const VEC3* pB) { + return PSVECSquareDistance(*pA, *pB); +} + +inline f32 VEC3Len(const VEC3* pVec) { + return PSVECMag(*pVec); +} + +inline VEC3* VEC3Normalize(VEC3* pOut, const VEC3* pIn) { + PSVECNormalize(*pIn, *pOut); + return pOut; +} + +inline VEC3* VEC3Transform(VEC3* pOut, const MTX34* pMtx, const VEC3* pVec) { + PSMTXMultVec(*pMtx, *pVec, *pOut); + return pOut; +} + +inline VEC3* VEC3TransformCoord(VEC3* pOut, const MTX34* pMtx, + const VEC3* pVec) { + PSMTXMultVec(*pMtx, *pVec, *pOut); + return pOut; +} + +/****************************************************************************** + * + * MTX33 functions + * + ******************************************************************************/ +MTX33* MTX33Identity(MTX33* pMtx); + +/****************************************************************************** + * + * MTX34 functions + * + ******************************************************************************/ +MTX33* MTX34ToMTX33(MTX33* pOut, const MTX34* pIn); +u32 MTX34InvTranspose(MTX33* pOut, const MTX34* pIn); +MTX34* MTX34Zero(MTX34* pMtx); +MTX34* MTX34Scale(MTX34* pOut, const MTX34* pIn, const VEC3* pScale); +MTX34* MTX34Trans(MTX34* pOut, const MTX34* pIn, const VEC3* pTrans); +MTX34* MTX34RotAxisFIdx(MTX34* pMtx, const VEC3* pAxis, f32 fidx); +MTX34* MTX34RotXYZFIdx(MTX34* pMtx, f32 fx, f32 fy, f32 fz); + +inline MTX34* MTX34Copy(MTX34* pOut, const MTX34* pIn) { + PSMTXCopy(*pIn, *pOut); + return pOut; +} + +inline MTX34* MTX34Identity(MTX34* pMtx) { + PSMTXIdentity(*pMtx); + return pMtx; +} + +inline u32 MTX34Inv(MTX34* pOut, const MTX34* pIn) { + return PSMTXInverse(*pIn, *pOut); +} + +inline u32 MTX34InvTranspose(MTX34* pOut, const MTX34* pIn) { + return PSMTXInvXpose(*pIn, *pOut); +} + +inline MTX34* MTX34LookAt(MTX34* pMtx, const VEC3* pPos, const VEC3* pUp, + const VEC3* pTarget) { + C_MTXLookAt(*pMtx, *pPos, *pUp, *pTarget); + return pMtx; +} + +inline MTX34* MTX34Mult(MTX34* pOut, const MTX34* pA, const MTX34* pB) { + PSMTXConcat(*pA, *pB, *pOut); + return pOut; +} + +inline MTX34* MTX34MultArray(MTX34* pOut, const MTX34* p1, const MTX34* pSrc, + u32 len) { + PSMTXConcatArray(*p1, *pSrc, *pOut, len); + return pOut; +} + +inline MTX34* MTX34RotAxisRad(MTX34* pOut, const VEC3* pAxis, f32 frad) { + return MTX34RotAxisFIdx(pOut, pAxis, NW4R_MATH_RAD_TO_FIDX(frad)); +} + +inline MTX34* MTX34RotXYZDeg(MTX34* pMtx, f32 dx, f32 dy, f32 dz) { + return MTX34RotXYZFIdx(pMtx, NW4R_MATH_DEG_TO_FIDX(dx), + NW4R_MATH_DEG_TO_FIDX(dy), + NW4R_MATH_DEG_TO_FIDX(dz)); +} + +inline MTX34* MTX34RotXYZRad(MTX34* pMtx, f32 rx, f32 ry, f32 rz) { + return MTX34RotXYZFIdx(pMtx, NW4R_MATH_RAD_TO_FIDX(rx), + NW4R_MATH_RAD_TO_FIDX(ry), + NW4R_MATH_RAD_TO_FIDX(rz)); +} + +inline MTX34* MTX34Scale(MTX34* pOut, const VEC3* pScale, const MTX34* pIn) { + PSMTXScaleApply(*pIn, *pOut, pScale->x, pScale->y, pScale->z); + return pOut; +} + +inline QUAT* MTX34ToQUAT(QUAT* pQuat, const MTX34* pMtx) { + C_QUATMtx(*pQuat, *pMtx); + return pQuat; +} + +inline MTX34* MTX34Trans(MTX34* pOut, const VEC3* pTrans, const MTX34* pIn) { + PSMTXTransApply(*pIn, *pOut, pTrans->x, pTrans->y, pTrans->z); + return pOut; +} + +/****************************************************************************** + * + * MTX44 functions + * + ******************************************************************************/ +MTX44* MTX44Identity(MTX44* pMtx); +MTX44* MTX44Copy(MTX44* pDst, const MTX44* pSrc); + +/****************************************************************************** + * + * QUAT functions + * + ******************************************************************************/ +inline MTX34* QUATToMTX34(MTX34* pMtx, const QUAT* pQuat) { + PSMTXQuat(*pMtx, *pQuat); + return pMtx; +} + +// @bug QUATSlerp macro changes this function name! +inline QUAT* C_QUATSlerp(QUAT* pOut, const QUAT* p1, const QUAT* p2, f32 t) { + ::C_QUATSlerp(*p1, *p2, *pOut, t); + return pOut; +} + +} // namespace math +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd.h new file mode 100644 index 0000000000..47147c7aa7 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd.h @@ -0,0 +1,78 @@ +#ifndef NW4R_PUBLIC_SND_H +#define NW4R_PUBLIC_SND_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxManager.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxManager.h new file mode 100644 index 0000000000..026db1f856 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxManager.h @@ -0,0 +1,112 @@ +#ifndef NW4R_SND_AX_MANAGER_H +#define NW4R_SND_AX_MANAGER_H +#include + +#include +#include +#include + +#include + +#include +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class AxManager { +public: + struct CallbackListNode { + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + AXOutCallback callback; // at 0x8 + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(CallbackListNode); + +public: + static AxManager& GetInstance(); + + void Init(); + void Shutdown(); + void Update(); + void PrepareReset(); + + bool CheckInit() { + return mInitialized; + } + + bool IsDiskError() const { + return mDiskError; + } + + bool IsResetReady() const { + return mResetReadyCounter == 0; + } + + f32 GetOutputVolume() const; + void* GetZeroBufferAddress(); + + void RegisterCallback(CallbackListNode* pNode, AXOutCallback pCallback); + void UnregisterCallback(CallbackListNode* pNode); + + void SetOutputMode(OutputMode mode); + OutputMode GetOutputMode(); + + f32 GetMasterVolume() const { + return mMasterVolume.GetValue(); + } + void SetMasterVolume(f32 volume, int frame); + + bool AppendEffect(AuxBus bus, FxBase* pFx); + void ClearEffect(AuxBus bus, int frame); + void ShutdownEffect(AuxBus bus); + + FxBaseList& GetEffectList(AuxBus bus) { + return mFxList[bus]; + } + +private: + static const u8 AUX_CALLBACK_WAIT_FRAME = 6; + + static const int FX_SAMPLE_RATE = AX_SAMPLE_RATE; + static const SampleFormat FX_SAMPLE_FORMAT = SAMPLE_FORMAT_PCM_S32; + static const int FX_BUFFER_SIZE = AX_FRAME_SIZE; + + static const int ZERO_BUFFER_SIZE = 256; + +private: + AxManager(); + + static void AxCallbackFunc(); + static void AuxCallbackFunc(void* pChans, void* pContext); + static void AiDmaCallbackFunc(); + +private: + OutputMode mOutputMode; // at 0x0 + void* mZeroBufferAddress; // at 0x4 + CallbackListNodeList mCallbackList; // at 0x8 + AXOutCallback mNextAxRegisterCallback; // at 0x14 + bool mInitialized; // at 0x18 + bool mUpdateVoicePrioFlag; // at 0x19 + bool mDiskError; // at 0x1A + MoveValue mMasterVolume; // at 0x1C + MoveValue mMainOutVolume; // at 0x2C + MoveValue mVolumeForReset; // at 0x3C + AIDMACallback mOldAidCallback; // at 0x4C + volatile s32 mResetReadyCounter; // at 0x50 + MoveValue mAuxFadeVolume[AUX_BUS_NUM]; // at 0x54 + MoveValue mAuxUserVolume[AUX_BUS_NUM]; // at 0x84 + FxBaseList mFxList[AUX_BUS_NUM]; // at 0xB4 + AXAuxCallback mAuxCallback[AUX_BUS_NUM]; // at 0xD8 + void* mAuxCallbackContext[AUX_BUS_NUM]; // at 0xE4 + u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // at 0xF0 + + static u8 sZeroBuffer[ZERO_BUFFER_SIZE]; +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxVoice.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxVoice.h new file mode 100644 index 0000000000..768a7a6344 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_AxVoice.h @@ -0,0 +1,295 @@ +#ifndef NW4R_SND_AX_VOICE_H +#define NW4R_SND_AX_VOICE_H +#include + +#include + +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +inline int CalcAxvpbDelta(u16 init, u16 target) { + return (target - init) / AX_SAMPLES_PER_FRAME; +} + +inline u16 CalcMixVolume(f32 volume) { + return ut::Min(USHRT_MAX, AX_MAX_VOLUME * volume); +} + +/****************************************************************************** + * + * AxVoiceParamBlock + * + ******************************************************************************/ +class AxVoiceParamBlock { +public: + AxVoiceParamBlock(); + + operator AXVPB*() { + return mVpb; + } + + bool IsAvailable() const { + return mVpb != NULL; + } + + bool IsRun() const { + return IsAvailable() && mVpb->pb.state == AX_VOICE_RUN; + } + + bool IsLpfEnable() const { + return IsAvailable() && mVpb->pb.lpf.on == AX_PB_LPF_ON; + } + + bool IsBiquadEnable() const { + return IsAvailable() && mVpb->pb.biquad.on == AX_PB_BIQUAD_ON; + } + + u32 GetCurrentAddress() const { + if (!IsAvailable()) { + return 0; + } + + return (mVpb->pb.addr.currentAddressHi << 16) + + mVpb->pb.addr.currentAddressLo; + } + + u32 GetLoopAddress() const { + if (!IsAvailable()) { + return 0; + } + + return (mVpb->pb.addr.loopAddressHi << 16) + + mVpb->pb.addr.loopAddressLo; + } + + u32 GetEndAddress() const { + if (!IsAvailable()) { + return 0; + } + + return (mVpb->pb.addr.endAddressHi << 16) + mVpb->pb.addr.endAddressLo; + } + + void SetVoiceAddr(const AXPBADDR& rAddr) { + if (IsAvailable()) { + // AXSetVoiceAddr doesn't actually modify the object + AXSetVoiceAddr(mVpb, const_cast(&rAddr)); + } + } + + void SetVoicePriority(u32 priority) { + if (IsAvailable()) { + AXSetVoicePriority(mVpb, priority); + } + } + + void SetVoiceStateRun() { + if (IsAvailable()) { + AXSetVoiceState(mVpb, AX_VOICE_RUN); + } + } + + void SetVoiceStateStop() { + if (IsRun()) { + AXSetVoiceState(mVpb, AX_VOICE_STOP); + } + } + + void Sync(); + bool IsRmtIirEnable() const; + + void Set(AXVPB* pVpb); + void Clear(); + + void SetVoiceType(u16 type); + void SetVoiceVe(u16 volume, u16 initVolume); + void SetVoiceMix(const AXPBMIX& rMix, bool syncNow); + void SetVoiceLoop(u16 loop); + void SetVoiceLoopAddr(u32 addr); + void SetVoiceEndAddr(u32 addr); + void SetVoiceAdpcm(const AXPBADPCM& rAdpcm); + void SetVoiceSrcType(u32 type); + void SetVoiceSrc(const AXPBSRC& rSrc); + void SetVoiceSrcRatio(f32 ratio); + void SetVoiceAdpcmLoop(const AXPBADPCMLOOP& rLoop); + void SetVoiceLpf(const AXPBLPF& rLpf); + void SetVoiceLpfCoefs(u16 a0, u16 b0); + void SetVoiceRmtOn(u16 on); + void SetVoiceRmtMix(const AXPBRMTMIX& rMix); + void SetVoiceRmtIIR(const AXPBRMTIIR& rIir); + void SetVoiceRmtIIRCoefs(u16 type, ...); + void UpdateDelta(); + +private: + static const u16 DEFAULT_VOLUME = AX_MAX_VOLUME; + +private: + AXVPB* mVpb; // at 0x0 + u32 mSync; // at 0x4 + volatile AXPBVE mPrevVeSetting; // at 0x8 + bool mFirstVeUpdateFlag; // at 0xC + u16 mVolume; // at 0xE +}; + +/****************************************************************************** + * + * AxVoice + * + ******************************************************************************/ +class AxVoice { + friend class AxVoiceManager; + +public: + enum AxVoiceCallbackStatus { + CALLBACK_STATUS_CANCEL, + CALLBACK_STATUS_DROP_DSP + }; + + typedef void (*AxVoiceCallback)(AxVoice* pDropVoice, + AxVoiceCallbackStatus status, void* pArg); + + enum Format { + FORMAT_ADPCM = 0, + FORMAT_PCM16 = 10, + FORMAT_PCM8 = 25, + }; + + enum VoiceType { + VOICE_TYPE_NORMAL, + VOICE_TYPE_STREAM, + }; + + enum SrcType { + SRC_NONE, + SRC_LINEAR, + SRC_4TAP_8K, + SRC_4TAP_12K, + SRC_4TAP_16K, + SRC_4TAP_AUTO, + }; + + struct MixParam { + u16 vL; // at 0x0 + u16 vR; // at 0x2 + u16 vS; // at 0x4 + u16 vAuxAL; // at 0x6 + u16 vAuxAR; // at 0x8 + u16 vAuxAS; // at 0xA + u16 vAuxBL; // at 0xC + u16 vAuxBR; // at 0xE + u16 vAuxBS; // at 0x10 + u16 vAuxCL; // at 0x12 + u16 vAuxCR; // at 0x14 + u16 vAuxCS; // at 0x16 + }; + + struct RemoteMixParam { + u16 vMain0; // at 0x0 + u16 vAux0; // at 0x2 + u16 vMain1; // at 0x4 + u16 vAux1; // at 0x6 + u16 vMain2; // at 0x8 + u16 vAux2; // at 0xA + u16 vMain3; // at 0xC + u16 vAux3; // at 0xE + }; + +public: + AxVoice(); + ~AxVoice(); + + bool IsRun() const { + return mVpb.IsRun(); + } + void Run() { + mVpb.SetVoiceStateRun(); + } + void Stop() { + mVpb.SetVoiceStateStop(); + } + void Sync() { + mVpb.Sync(); + } + + Format GetFormat() const { + return mFormat; + } + + void SetBaseAddress(const void* pBase) { + mWaveData = pBase; + } + + f32 GetDspRatio(f32 ratio) const { + return (ratio * mSampleRate) / AX_SAMPLE_RATE; + } + + void Setup(const void* pWave, Format fmt, int rate); + + bool IsPlayFinished() const; + void SetLoopStart(const void* pBase, u32 samples); + void SetLoopEnd(const void* pBase, u32 samples); + void SetLoopFlag(bool loop); + void StopAtPoint(const void* pBase, u32 samples); + + bool IsDataAddressCoverd(const void* pBegin, const void* pEnd) const; + u32 GetCurrentPlayingSample() const; + u32 GetCurrentPlayingDspAddress() const; + u32 GetLoopEndDspAddress() const; + + void SetPriority(u32 priority); + void SetVoiceType(VoiceType type); + void EnableRemote(bool enable); + void ResetDelta(); + void SetAddr(bool loop, const void* pWave, u32 offset, u32 loopStart, + u32 loopEnd); + void SetSrcType(SrcType type, f32 pitch); + void SetAdpcm(const AdpcmParam* pParam); + void SetAdpcmLoop(const AdpcmLoopParam* pParam); + bool SetMix(const MixParam& rParam); + void SetRmtMix(const RemoteMixParam& rParam); + void SetSrc(f32 ratio, bool initial); + void SetVe(f32 volume, f32 initVolume); + void SetLpf(u16 freq); + void SetRemoteFilter(u8 filter); + + static u32 GetDspAddressBySample(const void* pBase, u32 samples, + Format fmt); + static u32 GetSampleByDspAddress(const void* pBase, u32 addr, Format fmt); + static u32 GetSampleByByte(u32 addr, Format fmt); + + static void CalcOffsetAdpcmParam(u16* pPredScale, u16* pYN1, u16* pYN2, + u32 offset, const void* pData, + const AdpcmParam& rParam); + +private: + static void VoiceCallback(void* pArg); + +private: + AxVoiceParamBlock mVpb; // at 0x0 + const void* mWaveData; // at 0x10 + Format mFormat; // at 0x14 + int mSampleRate; // at 0x18 + bool mFirstMixUpdateFlag; // at 0x1C + bool mReserveForFreeFlag; // at 0x1D + MixParam mMixPrev; // at 0x1E + AxVoiceCallback mCallback; // at 0x38 + void* mCallbackData; // at 0x3C + +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x40 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(AxVoice); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicPlayer.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicPlayer.h new file mode 100644 index 0000000000..c03889b266 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicPlayer.h @@ -0,0 +1,148 @@ +#ifndef NW4R_SND_BASIC_PLAYER_H +#define NW4R_SND_BASIC_PLAYER_H +#include + +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class BasicPlayer { +public: + BasicPlayer(); + virtual ~BasicPlayer() {} // at 0x8 + + virtual bool Start() = 0; // at 0xC + virtual void Stop() = 0; // at 0x10 + virtual void Pause(bool flag) = 0; // at 0x14 + virtual bool IsActive() const = 0; // at 0x18 + virtual bool IsStarted() const = 0; // at 0x1C + virtual bool IsPause() const = 0; // at 0x20 + + void InitParam(); + + u32 GetId() const { + return mId; + } + void SetId(u32 id) { + mId = id; + } + + f32 GetVolume() const { + return mVolume; + } + void SetVolume(f32 volume) { + mVolume = volume; + } + + f32 GetPitch() const { + return mPitch; + } + void SetPitch(f32 pitch) { + mPitch = pitch; + } + + f32 GetPan() const { + return mPan; + } + void SetPan(f32 pan) { + mPan = pan; + } + + f32 GetSurroundPan() const { + return mSurroundPan; + } + void SetSurroundPan(f32 pan) { + mSurroundPan = pan; + } + + f32 GetLpfFreq() const { + return mLpfFreq; + } + void SetLpfFreq(f32 freq) { + mLpfFreq = freq; + } + + int GetOutputLine() const { + return mOutputLine; + } + void SetOutputLine(int flags) { + mOutputLine = flags; + } + + f32 GetMainOutVolume() const { + return mMainOutVolume; + } + void SetMainOutVolume(f32 volume) { + mMainOutVolume = volume; + } + + f32 GetMainSend() const { + return mMainSend; + } + void SetMainSend(f32 send) { + mMainSend = send; + } + + void SetFxSend(AuxBus bus, f32 send); + f32 GetFxSend(AuxBus bus) const; + + void SetRemoteOutVolume(int remote, f32 volume); + f32 GetRemoteOutVolume(int remote) const; + + f32 GetRemoteSend(int remote) const; + f32 GetRemoteFxSend(int remote) const; + + int GetRemoteFilter() const { + return mRemoteFilter; + } + void SetRemoteFilter(int filter) { + mRemoteFilter = ut::Clamp(filter, 0, REMOTE_FILTER_MAX); + } + + PanMode GetPanMode() const { + return mPanMode; + } + void SetPanMode(PanMode mode) { + mPanMode = mode; + } + + PanCurve GetPanCurve() const { + return mPanCurve; + } + void SetPanCurve(PanCurve curve) { + mPanCurve = curve; + } + +private: + u32 mId; // at 0x4 + + f32 mVolume; // at 0x8 + f32 mPitch; // at 0xC + f32 mPan; // at 0x10 + f32 mSurroundPan; // at 0x14 + f32 mLpfFreq; // at 0x18 + char UNK_0x1C[0x4]; + + int mOutputLine; // at 0x20 + f32 mMainOutVolume; // at 0x24 + f32 mMainSend; // at 0x28 + f32 mFxSend[AUX_BUS_NUM]; // at 0x2C + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // at 0x38 + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // at 0x48 + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // at 0x58 + u8 mRemoteFilter; // at 0x68 + PanMode mPanMode; // at 0x6C + PanCurve mPanCurve; // at 0x70 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicSound.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicSound.h new file mode 100644 index 0000000000..35a738fcd9 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_BasicSound.h @@ -0,0 +1,245 @@ +#ifndef NW4R_SND_BASIC_SOUND_H +#define NW4R_SND_BASIC_SOUND_H +#include + +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SoundHandle; +class SoundPlayer; + +namespace detail { +class BasicPlayer; +class ExternalSoundPlayer; +class PlayerHeap; +} // namespace detail + +namespace detail { + +class BasicSound { + friend class nw4r::snd::SoundHandle; + +public: + NW4R_UT_RTTI_DECL(BasicSound); + + struct AmbientParamUpdateCallback { + enum ParamUpdateFlags { + PARAM_UPDATE_VOLUME = (1 << 0), + PARAM_UPDATE_PAN = (1 << 1), + PARAM_UPDATE_SURROUND_PAN = (1 << 2), + PARAM_UPDATE_PRIORITY = (1 << 3), + }; + + virtual void detail_Update(SoundParam* pParam, u32 id, + BasicSound* pSound, const void* pArg, + u32 flags) = 0; // at 0xC + }; + + struct AmbientArgUpdateCallback { + virtual void detail_Update(void* pArg, + const BasicSound* pSound) = 0; // at 0xC + }; + + struct AmbientArgAllocaterCallback { + virtual void* detail_AllocAmbientArg(u32 size) = 0; // at 0xC + + virtual void + detail_FreeAmbientArg(void* pArg, + const BasicSound* pSound) = 0; // at 0x10 + }; + + struct AmbientArgInfo { + AmbientParamUpdateCallback* paramUpdateCallback; // at 0x0 + AmbientArgUpdateCallback* argUpdateCallback; // at 0x4 + AmbientArgAllocaterCallback* argAllocaterCallback; // at 0x8 + void* arg; // at 0xC + u32 argSize; // at 0x10 + }; + + static const u32 INVALID_ID = 0xFFFFFFFF; + static const int PRIORITY_MAX = 127; + +public: + BasicSound(); + virtual ~BasicSound() {} // at 0xC + + virtual void Update(); // at 0x10 + virtual void StartPrepared(); // at 0x14 + virtual void Stop(int frames); // at 0x18 + virtual void Pause(bool flag, int frames); // at 0x1C + virtual void SetAutoStopCounter(int count); // at 0x20 + virtual void FadeIn(int frames); // at 0x24 + virtual void Shutdown(); // at 0x28 + virtual bool IsPrepared() const = 0; // at 0x2C + virtual bool IsPause() const; // at 0x30 + + virtual void SetInitialVolume(f32 vol); // at 0x34 + virtual void SetVolume(f32 vol, int frames); // at 0x38 + virtual void SetPitch(f32 pitch); // at 0x3C + virtual void SetPan(f32 pan); // at 0x40 + virtual void SetSurroundPan(f32 pan); // at 0x44 + virtual void SetLpfFreq(f32 freq); // at 0x48 + virtual void SetPlayerPriority(int priority); // at 0x4C + virtual void SetRemoteFilter(int filter); // at 0x50 + virtual void SetPanMode(PanMode mode); // at 0x54 + virtual void SetPanCurve(PanCurve curve); // at 0x58 + + virtual bool IsAttachedTempSpecialHandle() = 0; // at 0x5C + virtual void DetachTempSpecialHandle() = 0; // at 0x60 + + virtual void InitParam(); // at 0x64 + virtual BasicPlayer& GetBasicPlayer() = 0; // at 0x68 + virtual const BasicPlayer& GetBasicPlayer() const = 0; // at 0x6C + + PlayerHeap* GetPlayerHeap() { + return mHeap; + } + void SetPlayerHeap(PlayerHeap* pHeap) { + mHeap = pHeap; + } + + bool IsAttachedGeneralHandle(); + void DetachGeneralHandle(); + + bool IsAttachedTempGeneralHandle(); + void DetachTempGeneralHandle(); + + SoundPlayer* GetSoundPlayer() { + return mSoundPlayer; + } + void SetSoundPlayer(SoundPlayer* pPlayer) { + mSoundPlayer = pPlayer; + } + + ExternalSoundPlayer* GetExternalSoundPlayer() { + return mExtSoundPlayer; + } + void SetExternalSoundPlayer(ExternalSoundPlayer* pExtPlayer) { + mExtSoundPlayer = pExtPlayer; + } + + AmbientParamUpdateCallback* GetAmbientParamUpdateCallback() { + return mAmbientParamUpdateCallback; + } + + AmbientArgUpdateCallback* GetAmbientArgUpdateCallback() { + return mAmbientArgUpdateCallback; + } + void ClearAmbientArgUpdateCallback() { + mAmbientArgUpdateCallback = NULL; + } + + AmbientArgAllocaterCallback* GetAmbientArgAllocaterCallback() { + return mAmbientArgAllocaterCallback; + } + + void* GetAmbientArg() { + return mAmbientArg; + } + + SoundParam& GetAmbientParam() { + return mAmbientParam; + } + + void SetAmbientParamCallback(AmbientParamUpdateCallback* pParamUpdate, + AmbientArgUpdateCallback* pArgUpdate, + AmbientArgAllocaterCallback* pArgAlloc, + void* pArg); + + void SetPriority(int priority) { + mPriority = priority; + } + + u32 GetId() const { + return mId; + } + void SetId(u32 id); + + f32 GetMoveVolume() { + return mExtMoveVolume.GetValue(); + } + + f32 GetInitialVolume() const; + f32 GetPan() const; + f32 GetSurroundPan() const; + f32 GetPitch() const; + + void SetOutputLine(int flag); + bool IsEnabledOutputLine() const; + int GetOutputLine() const; + + f32 GetMainOutVolume() const; + void SetMainOutVolume(f32 vol); + + f32 GetRemoteOutVolume(int remote) const; + void SetRemoteOutVolume(int remote, f32 vol); + + void SetFxSend(AuxBus bus, f32 send); + + int CalcCurrentPlayerPriority() const { + return ut::Clamp(mPriority + mAmbientParam.priority, 0, PRIORITY_MAX); + } + +private: + PlayerHeap* mHeap; // at 0x4 + SoundHandle* mGeneralHandle; // at 0x8 + SoundHandle* mTempGeneralHandle; // at 0xC + SoundPlayer* mSoundPlayer; // at 0x10 + ExternalSoundPlayer* mExtSoundPlayer; // at 0x14 + + AmbientParamUpdateCallback* mAmbientParamUpdateCallback; // at 0x18 + AmbientArgUpdateCallback* mAmbientArgUpdateCallback; // at 0x1C + AmbientArgAllocaterCallback* mAmbientArgAllocaterCallback; // at 0x20 + void* mAmbientArg; // at 0x24 + SoundParam mAmbientParam; // at 0x28 + + MoveValue mFadeVolume; // at 0x44 + MoveValue mPauseFadeVolume; // at 0x54 + bool mStartFlag; // at 0x64 + bool mStartedFlag; // at 0x65 + bool mAutoStopFlag; // at 0x66 + bool mPauseFlag; // at 0x67 + bool mPauseFadeFlag; // at 0x68 + bool mFadeOutFlag; // at 0x69 + int mAutoStopCounter; // at 0x6C + u32 mUpdateCounter; // at 0x70 + + u8 mPriority; // at 0x74 + u32 mId; // at 0x78 + + MoveValue mExtMoveVolume; // at 0x7C + f32 mInitVolume; // at 0x8C + f32 mExtPan; // at 0x90 + f32 mExtSurroundPan; // at 0x94 + f32 mExtPitch; // at 0x98 + + bool mOutputLineFlagEnable; // at 0x9C + int mOutputLineFlag; // at 0xA0 + f32 mMainOutVolume; // at 0xA4 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // at 0xA8 + +public: + NW4R_UT_LINKLIST_NODE_DECL_EX(Prio); // at 0xB8 + NW4R_UT_LINKLIST_NODE_DECL_EX(PlayerPlay); // at 0xC0 + NW4R_UT_LINKLIST_NODE_DECL_EX(PlayerPrio); // at 0xC8 + NW4R_UT_LINKLIST_NODE_DECL_EX(ExtPlay); // at 0xD0 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(BasicSound, Prio); +NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(BasicSound, PlayerPlay); +NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(BasicSound, PlayerPrio); +NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(BasicSound, ExtPlay); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Channel.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Channel.h new file mode 100644 index 0000000000..4cb3b5b02c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Channel.h @@ -0,0 +1,259 @@ +#ifndef NW4R_SND_CHANNEL_H +#define NW4R_SND_CHANNEL_H +#include + +#include +#include +#include +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +struct WaveData; + +class Channel { +public: + enum ChannelCallbackStatus { + CALLBACK_STATUS_STOPPED, + CALLBACK_STATUS_DROP, + CALLBACK_STATUS_FINISH, + CALLBACK_STATUS_CANCEL + }; + + typedef void (*ChannelCallback)(Channel* pDropChannel, + ChannelCallbackStatus status, + u32 callbackArg); + + enum LfoTarget { LFO_TARGET_PITCH, LFO_TARGET_VOLUME, LFO_TARGET_PAN }; + +public: + Channel(); + ~Channel(); + + void InitParam(ChannelCallback pCallback, u32 callbackArg); + void Update(bool periodic); + void Start(const WaveData& rData, int length, u32 offset); + void Release(); + void Stop(); + + void SetAttack(int attack) { + mEnvelope.SetAttack(attack); + } + void SetDecay(int decay) { + mEnvelope.SetDecay(decay); + } + void SetSustain(int sustain) { + mEnvelope.SetSustain(sustain); + } + void SetRelease(int release) { + mEnvelope.SetRelease(release); + } + bool IsRelease() const { + return mEnvelope.GetStatus() == EnvGenerator::STATUS_RELEASE; + } + + void SetLfoParam(const LfoParam& rParam) { + mLfo.SetParam(rParam); + } + void SetLfoTarget(LfoTarget target) { + mLfoTarget = target; + } + + void Pause(bool pause) { + mPauseFlag = pause; + mVoice->Pause(pause); + } + void SetReleasePriorityFix(bool fix) { + mReleasePriorityFixFlag = fix; + } + + bool IsPause() const { + return mPauseFlag != false; + } + bool IsActive() const { + return mActiveFlag; + } + bool IsAutoUpdateSweep() const { + return mAutoSweep; + } + + void SetUserVolume(f32 volume) { + mUserVolume = volume; + } + void SetUserPitch(f32 pitch) { + mUserPitch = pitch; + } + void SetUserPitchRatio(f32 ratio) { + mUserPitchRatio = ratio; + } + void SetUserPan(f32 pan) { + mUserPan = pan; + } + void SetUserSurroundPan(f32 pan) { + mUserSurroundPan = pan; + } + void SetUserLpfFreq(f32 freq) { + mUserLpfFreq = freq; + } + + void SetRemoteFilter(int filter) { + mRemoteFilter = filter; + } + void SetOutputLine(int flag) { + mOutputLineFlag = flag; + } + + void SetMainOutVolume(f32 volume) { + mMainOutVolume = volume; + } + void SetMainSend(f32 send) { + mMainSend = send; + } + void SetFxSend(AuxBus bus, f32 send) { + mFxSend[bus] = send; + } + + void SetRemoteOutVolume(int remote, f32 volume) { + mRemoteOutVolume[remote] = volume; + } + void SetRemoteSend(int remote, f32 send) { + mRemoteSend[remote] = send; + } + void SetRemoteFxSend(int remote, f32 send) { + mRemoteFxSend[remote] = send; + } + + void UpdateSweep(int count); + void SetSweepParam(f32 pitch, int time, bool autoUpdate); + f32 GetSweepValue() const; + + void SetInitVolume(f32 volume) { + mInitVolume = volume; + } + void SetInitPan(f32 pan) { + mInitPan = pan; + } + void SetInitSurroundPan(f32 pan) { + mInitSurroundPan = pan; + } + void SetTune(f32 tune) { + mTune = tune; + } + void SetSilence(bool silence, int fadeTime) { + mSilenceVolume.SetTarget(silence ? 0 : SILENCE_VOLUME_MAX, fadeTime); + } + + void SetKey(int key) { + mKey = key; + } + void SetOriginalKey(int key) { + mOriginalKey = key; + } + + s32 GetLength() const { + return mLength; + } + void SetLength(s32 length) { + mLength = length; + } + + void SetPanMode(PanMode mode) { + mPanMode = mode; + } + void SetPanCurve(PanCurve curve) { + mPanCurve = curve; + } + + Channel* GetNextTrackChannel() const { + return mNextLink; + } + void SetNextTrackChannel(Channel* pChannel) { + mNextLink = pChannel; + } + + static Channel* AllocChannel(int channels, int voices, int priority, + ChannelCallback pCallback, u32 callbackArg); + static void FreeChannel(Channel* pChannel); + +private: + static const u8 SILENCE_VOLUME_MAX = 255; + + static const int KEY_INIT = 60; + static const int ORIGINAL_KEY_INIT = 60; + + static const int PRIORITY_RELEASE = 1; + +private: + static void VoiceCallbackFunc(Voice* pDropVoice, + Voice::VoiceCallbackStatus status, + void* pCallbackArg); + +private: + EnvGenerator mEnvelope; // at 0x0 + Lfo mLfo; // at 0x18 + u8 mLfoTarget; // at 0x30 + + bool mPauseFlag; // at 0x31 + bool mActiveFlag; // at 0x32 + bool mAllocFlag; // at 0x33 + bool mAutoSweep; // at 0x34 + bool mReleasePriorityFixFlag; // at 0x35 + + f32 mUserVolume; // at 0x38 + f32 mUserPitchRatio; // at 0x3C + f32 mUserPan; // at 0x40 + f32 mUserSurroundPan; // at 0x44 + f32 mUserLpfFreq; // at 0x48 + + int mRemoteFilter; // at 0x4C + int mOutputLineFlag; // at 0x50 + + f32 mMainOutVolume; // at 0x54 + f32 mMainSend; // at 0x58 + f32 mFxSend[AUX_BUS_NUM]; // at 0x5C + + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // at 0x68 + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // at 0x78 + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // at 0x88 + + f32 mUserPitch; // at 0x98 + f32 mSweepPitch; // at 0x9C + int mSweepCounter; // at 0xA0 + int mSweepLength; // at 0xA4 + + f32 mInitVolume; // at 0xA8 + f32 mInitPan; // at 0xAC + f32 mInitSurroundPan; // at 0xB0 + f32 mTune; // at 0xB4 + MoveValue mSilenceVolume; // at 0xB8 + + int mKey; // at 0xC0 + int mOriginalKey; // at 0xC4 + int mLength; // at 0xC8 + + PanMode mPanMode; // at 0xCC + PanCurve mPanCurve; // at 0xD0 + + ChannelCallback mCallback; // at 0xD4 + u32 mCallbackData; // at 0xD8 + + Voice* mVoice; // at 0xDC + Channel* mNextLink; // at 0xE0 + +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0xE4 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(Channel); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DisposeCallback.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DisposeCallback.h new file mode 100644 index 0000000000..433560957e --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DisposeCallback.h @@ -0,0 +1,30 @@ +#ifndef NW4R_SND_DISPOSE_CALLBACK_H +#define NW4R_SND_DISPOSE_CALLBACK_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class DisposeCallback { +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + +public: + virtual ~DisposeCallback() {} // at 0x8 + + virtual void InvalidateData(const void* pStart, + const void* pEnd) = 0; // at 0xC + virtual void InvalidateWaveData(const void* pStart, + const void* pEnd) = 0; // at 0x10 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(DisposeCallback); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DvdSoundArchive.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DvdSoundArchive.h new file mode 100644 index 0000000000..45a10675f3 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_DvdSoundArchive.h @@ -0,0 +1,67 @@ +#ifndef NW4R_SND_DVD_SOUND_ARCHIVE_H +#define NW4R_SND_DVD_SOUND_ARCHIVE_H +#include + +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +class DvdSoundArchive : public SoundArchive { +private: + class DvdFileStream; + +public: + DvdSoundArchive(); + virtual ~DvdSoundArchive(); // at 0x8 + + virtual const void* detail_GetFileAddress(u32 /* id */) const { + return NULL; + } // at 0xC + + virtual const void* detail_GetWaveDataFileAddress(u32 /* id */) const { + return NULL; + } // at 0x10 + + virtual int detail_GetRequiredStreamBufferSize() const; // at 0x14 + + virtual ut::FileStream* OpenStream(void* pBuffer, int size, u32 offset, + u32 length) const; // at 0x18 + + virtual ut::FileStream* OpenExtStream(void* pBuffer, int size, + const char* pExtPath, u32 offset, + u32 length) const; // at 0x1C + + bool Open(s32 entrynum); + bool Open(const char* pPath); + + void Close(); + + bool LoadHeader(void* pBuffer, u32 size); + bool LoadLabelStringData(void* pBuffer, u32 size); + + u32 GetHeaderSize() const { + return mFileReader.GetInfoChunkSize(); + } + u32 GetLabelStringDataSize() const { + return mFileReader.GetLabelStringChunkSize(); + } + +private: + bool LoadFileHeader(); + +public: + detail::SoundArchiveFileReader mFileReader; // at 0x108 + DVDFileInfo mFileInfo; // at 0x14C + bool mOpen; // at 0x188 +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_EnvGenerator.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_EnvGenerator.h new file mode 100644 index 0000000000..f98a8721a7 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_EnvGenerator.h @@ -0,0 +1,61 @@ +#ifndef NW4R_SND_ENV_GENERATOR_H +#define NW4R_SND_ENV_GENERATOR_H +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class EnvGenerator { +public: + enum Status { STATUS_ATTACK, STATUS_DECAY, STATUS_SUSTAIN, STATUS_RELEASE }; + +public: + EnvGenerator(); + + void Init(f32 db = VOLUME_INIT); + void Reset(f32 db = VOLUME_INIT); + f32 GetValue() const; + void Update(int msec); + + Status GetStatus() const { + return mStatus; + } + void SetStatus(Status status) { + mStatus = status; + } + + void SetAttack(int attack); + void SetDecay(int decay); + void SetSustain(int sustain); + void SetRelease(int release); + +private: + static const int DECIBEL_SQUARE_TABLE_SIZE = 128; + + static const volatile f32 VOLUME_INIT; + static const int ATTACK_INIT = 127; + static const int DECAY_INIT = 127; + static const int SUSTAIN_INIT = 127; + static const int RELEASE_INIT = 127; + +private: + f32 CalcRelease(int release); + int CalcDecibelSquare(int scale); + +private: + Status mStatus; // at 0x0 + f32 mValue; // at 0x4 + f32 mDecay; // at 0x8 + f32 mRelease; // at 0xC + f32 mAttack; // at 0x10 + u8 mSustain; // at 0x14 + + static const s16 DecibelSquareTable[DECIBEL_SQUARE_TABLE_SIZE]; +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FrameHeap.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FrameHeap.h new file mode 100644 index 0000000000..e8cc15ce76 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FrameHeap.h @@ -0,0 +1,100 @@ +#ifndef NW4R_SND_FRAME_HEAP_H +#define NW4R_SND_FRAME_HEAP_H +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class FrameHeap { +public: + typedef void (*FreeCallback)(void* pBuffer, u32 size, void* pCallbackArg); + +public: + FrameHeap(); + ~FrameHeap(); + + bool Create(void* pBase, u32 size); + void Destroy(); + void Clear(); + void* Alloc(u32 size, FreeCallback pCallback, void* pCallbackArg); + + int SaveState(); + void LoadState(int id); + + int GetCurrentLevel() const; + u32 GetFreeSize() const; + + bool IsValid() const { + return mHandle != NULL; + } + +private: + /****************************************************************************** + * Block + ******************************************************************************/ + struct Block { + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + u32 mSize; // at 0x8 + FreeCallback mCallback; // at 0xC + void* mCallbackArg; // at 0x10 + + Block(u32 size, FreeCallback pCallback, void* pCallbackArg) + : mSize(size), mCallback(pCallback), mCallbackArg(pCallbackArg) {} + + ~Block() { + if (mCallback != NULL) { + mCallback(GetBufferAddr(), mSize, mCallbackArg); + } + } + + void* GetBufferAddr() { + return ut::AddOffsetToPtr(this, BLOCK_BUFFER_SIZE); + } + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(Block); + + /****************************************************************************** + * Section + ******************************************************************************/ + struct Section { + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + BlockList mBlockList; // at 0x8 + + ~Section() { + for (BlockList::Iterator it = mBlockList.GetEndIter(); + it != mBlockList.GetBeginIter();) { + + (--it)->~Block(); + } + } + + void AppendBlock(Block* pBlock) { + mBlockList.PushBack(pBlock); + } + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(Section); + + static const int BLOCK_BUFFER_SIZE = ROUND_UP(sizeof(Block), 32); + static const int HEAP_ALIGN = 32; + +private: + bool NewSection(); + void ClearSection(); + +private: + MEMiHeapHead* mHandle; // at 0x0 + SectionList mSectionList; // at 0x4 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FxBase.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FxBase.h new file mode 100644 index 0000000000..c8e4361a8f --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_FxBase.h @@ -0,0 +1,43 @@ +#ifndef NW4R_SND_FX_BASE_H +#define NW4R_SND_FX_BASE_H +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +enum SampleFormat { + SAMPLE_FORMAT_PCM_S32, + SAMPLE_FORMAT_PCM_S16, + SAMPLE_FORMAT_PCM_S8, + SAMPLE_FORMAT_DSP_ADPCM +}; + +class FxBase : private ut::NonCopyable { +public: + virtual ~FxBase() {} // at 0x8 + + virtual bool StartUp() { + return true; + } // at 0xC + + virtual void Shutdown() {} // at 0x10 + + virtual void UpdateBuffer(int /* channels */, void** /* ppBuffer */, + u32 /* size */, SampleFormat /* format */, + f32 /* sampleRate */, OutputMode /* mode */) { + } // at 0x14 + +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x4 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(FxBase); + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_InstancePool.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_InstancePool.h new file mode 100644 index 0000000000..1501253b53 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_InstancePool.h @@ -0,0 +1,98 @@ +#ifndef NW4R_SND_INSTANCE_POOL_H +#define NW4R_SND_INSTANCE_POOL_H +#include + +namespace nw4r { +namespace snd { +namespace detail { + +/****************************************************************************** + * + * PoolImpl + * + ******************************************************************************/ +class PoolImpl { +public: + PoolImpl() : mNext(NULL) {} + +protected: + u32 CreateImpl(void* pBuffer, u32 size, u32 stride); + void DestroyImpl(void* pBuffer, u32 size); + int CountImpl() const; + + void* AllocImpl(); + void FreeImpl(void* pElem); + +private: + PoolImpl* mNext; // at 0x0 +}; + +/****************************************************************************** + * + * InstancePool + * + ******************************************************************************/ +template class InstancePool : private PoolImpl { +public: + u32 Create(void* pBuffer, u32 size) { + return CreateImpl(pBuffer, size, sizeof(T)); + } + + void Destroy(void* pPtr, u32 size) { + DestroyImpl(pPtr, size); + } + + int Count() const { + return CountImpl(); + } + + T* Alloc() { + void* pPtr = AllocImpl(); + if (pPtr == NULL) { + return NULL; + } + + return new (pPtr) T; + } + + void Free(T* pElem) { + if (pElem != NULL) { + pElem->~T(); + FreeImpl(pElem); + } + } +}; + +/****************************************************************************** + * + * MemoryPool + * + ******************************************************************************/ +template class MemoryPool : private PoolImpl { +public: + u32 Create(void* pBuffer, u32 size) { + return CreateImpl(pBuffer, size, sizeof(T)); + } + + void Destroy(void* pPtr, u32 size) { + DestroyImpl(pPtr, size); + } + + int Count() const { + return CountImpl(); + } + + T* Alloc() { + return static_cast(AllocImpl()); + } + + void Free(T* pElem) { + FreeImpl(pElem); + } +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Lfo.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Lfo.h new file mode 100644 index 0000000000..fbcad6342a --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Lfo.h @@ -0,0 +1,65 @@ +#ifndef NW4R_SND_LFO_H +#define NW4R_SND_LFO_H +#include + +namespace nw4r { +namespace snd { +namespace detail { + +/****************************************************************************** + * + * LfoParam + * + ******************************************************************************/ +struct LfoParam { + LfoParam() { + Init(); + } + + void Init(); + + f32 depth; // at 0x0 + f32 speed; // at 0x4 + u32 delay; // at 0x8 + u8 range; // at 0xC + u8 PADDING_0xD[0x10 - 0xD]; // at 0xD +}; + +/****************************************************************************** + * + * Lfo + * + ******************************************************************************/ +class Lfo { +public: + Lfo() : mDelayCounter(0), mCounter(0.0f) {} + + LfoParam& GetParam() { + return mParam; + } + void SetParam(const LfoParam& rParam) { + mParam = rParam; + } + + void Reset(); + void Update(int msec); + + f32 GetValue() const; + +private: + static const int TABLE_SIZE = 32; + +private: + static s8 GetSinIdx(int idx); + +private: + LfoParam mParam; // at 0x0 + u32 mDelayCounter; // at 0x10 + f32 mCounter; // at 0x14 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlParser.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlParser.h new file mode 100644 index 0000000000..35841df8d2 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlParser.h @@ -0,0 +1,161 @@ +#ifndef NW4R_SND_MML_PARSER_H +#define NW4R_SND_MML_PARSER_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class MmlSeqTrack; +class SeqPlayer; + +class MmlParser { +public: + enum SeqArgType { + SEQ_ARG_U8, + SEQ_ARG_S16, + SEQ_ARG_VMIDI, + SEQ_ARG_RANDOM, + SEQ_ARG_VARIABLE + }; + + static const int CALL_STACK_MAX_DEPTH = 3; + +public: + virtual void CommandProc(MmlSeqTrack* pTrack, u32 command, s32 arg1, + s32 arg2) const; // at 0x8 + + virtual Channel* NoteOnCommandProc(MmlSeqTrack* pTrack, int key, + int velocity, s32 length, + bool tie) const; // at 0xC + + ParseResult Parse(MmlSeqTrack* pTrack, bool doNoteOn) const; + + volatile s16* GetVariablePtr(SeqPlayer* pPlayer, SeqTrack* pTrack, + int idx) const; + + static void EnablePrintVar(bool enable) { + mPrintVarEnabledFlag = enable; + } + +private: + enum MmlSeqData { + MML_CMD_MIN = 0x80, // <80 -> MML note, not a command + + MML_WAIT = 0x80, // 0x80 + MML_SET_PRGNO, // 0x81 + MML_OPENTRACK = 0x88, // 0x88 + MML_JUMP, // 0x89 + MML_CALL, // 0x8A + + MML_RNDPARAM = 0xA0, // 0xA0 + MML_INDPARAM, // 0xA1 + MML_EXECIF, // 0xA2 + + MML_SET_TIMEBASE = 0xB0, // 0xB0 + + MML_SET_PAN = 0xC0, // 0xC0 + MML_SET_TRACK_VOLUME, // 0xC1 + MML_SET_PLAYER_VOLUME, // 0xC2 + MML_SET_TRANSPOSE, // 0xC3 + MML_SET_PITCHBEND, // 0xC4 + MML_SET_BENDRANGE, // 0xC5 + MML_SET_PRIORITY, // 0xC6 + MML_SET_NOTEWAIT, // 0xC7 + MML_SET_TIE, // 0xC8 + MML_SET_PORTAMENTO, // 0xC9 + MML_SET_LFODEPTH, // 0xCA + MML_SET_LFOSPEED, // 0xCB + MML_SET_LFOTARGET, // 0xCC + MML_SET_LFORANGE, // 0xCD + MML_SET_PORTASPEED, // 0xCE + MML_SET_PORTATIME, // 0xCF + + MML_SET_ATTACK = 0xD0, // 0xD0 + MML_SET_DECAY, // 0xD1 + MML_SET_SUSTAIN, // 0xD2 + MML_SET_RELEASE, // 0xD3 + MML_LOOP_START, // 0xD4 + MML_SET_TRACK_VOLUME2, // 0xD5 + MML_PRINTVAR, // 0xD6 + MML_SET_SURROUNDPAN, // 0xD7 + MML_SET_LPFFREQ, // 0xD8 + MML_SET_FXSEND_A, // 0xD9 + MML_SET_FXSEND_B, // 0xDA + MML_SET_MAINSEND, // 0xDB + MML_SET_INITPAN, // 0xDC + MML_SET_MUTE, // 0xDD + MML_SET_FXSEND_C, // 0xDE + MML_SET_DAMPER, // 0xDF + + MML_SET_LFODELAY = 0xE0, // 0xE0 + MML_SET_TEMPO, // 0xE1 + MML_CMD_E2h, // 0xE2 + MML_SET_SWEEPPITCH, // 0xE3 + + MML_LOOP_END = 0xFC, // 0xFC + MML_RET, // 0xFD + MML_ALLOCTRACK, // 0xFE + MML_EOF, // 0xFF + + MML_CMD_MASK = 0x80, + MML_CMD_SET_MASK = 0xF0, + + MML_CMD_MAX = 0xFF, // >FF -> EX command + + // (MML_EX_COMMAND << 8) | Command + MML_EX_COMMAND = 0xF0, + + // MML EX arithmetic command set + MML_EX_ARITHMETIC = 0x80, // 0xF0 0x8X + MML_EX_SET = 0x80, // 0xF0 0x80 + MML_EX_APL, // 0xF0 0x81 + MML_EX_AMI, // 0xF0 0x82 + MML_EX_AMU, // 0xF0 0x83 + MML_EX_ADV, // 0xF0 0x84 + MML_EX_ALS, // 0xF0 0x85 + MML_EX_RND, // 0xF0 0x86 + MML_EX_AAD, // 0xF0 0x87 + MML_EX_AOR, // 0xF0 0x88 + MML_EX_AER, // 0xF0 0x89 + MML_EX_ACO, // 0xF0 0x8A + MML_EX_AMD, // 0xF0 0x8B + + // MML EX logic command set + MML_EX_LOGIC = 0x90, // 0xF0 0x9X + MML_EX_EQ = 0x90, // 0xF0 0x90 + MML_EX_GE, // 0xF0 0x91 + MML_EX_GT, // 0xF0 0x92 + MML_EX_LE, // 0xF0 0x93 + MML_EX_LT, // 0xF0 0x94 + MML_EX_NE, // 0xF0 0x95 + + // MML EX userproc callback + MML_EX_USERPROC = 0xE0, // 0xF0 0xE0 + + MML_EX_CMD_MAX = 0xFFFF, // >FFFF -> Invalid command + }; + +private: + u8 ReadByte(const u8** ppData) const { + return *(*ppData)++; + } + + u16 Read16(const u8** ppData) const; + u32 Read24(const u8** ppData) const; + s32 ReadVar(const u8** ppData) const; + s32 ReadArg(const u8** ppData, SeqPlayer* pPlayer, SeqTrack* pTrack, + SeqArgType type) const; + +private: + static bool mPrintVarEnabledFlag; +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlSeqTrackAllocator.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlSeqTrackAllocator.h new file mode 100644 index 0000000000..c2e13271e3 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MmlSeqTrackAllocator.h @@ -0,0 +1,41 @@ +#ifndef NW4R_SND_MML_SEQ_TRACK_ALLOCATOR_H +#define NW4R_SND_MML_SEQ_TRACK_ALLOCATOR_H +#include + +#include +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class MmlParser; +class MmlSeqTrack; +class SeqPlayer; +class SeqTrack; + +class MmlSeqTrackAllocator : public SeqTrackAllocator { +public: + explicit MmlSeqTrackAllocator(MmlParser* pParser) : mParser(pParser) {} + + virtual SeqTrack* AllocTrack(SeqPlayer* pPlayer); // at 0xC + virtual void FreeTrack(SeqTrack* pTrack); // at 0x10 + + virtual int GetAllocatableTrackCount() const { + return mTrackPool.Count(); + } // at 0x14 + + u32 Create(void* pBuffer, u32 size); + void Destroy(void* pBuffer, u32 size); + +private: + MmlParser* mParser; // at 0x4 + InstancePool mTrackPool; // at 0x8 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MoveValue.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MoveValue.h new file mode 100644 index 0000000000..750a5e79c8 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_MoveValue.h @@ -0,0 +1,60 @@ +#ifndef NW4R_SND_MOVE_VALUE_H +#define NW4R_SND_MOVE_VALUE_H +#include + +namespace nw4r { +namespace snd { +namespace detail { + +template class MoveValue { +public: + MoveValue() + : mOrigin(TValue()), + mTarget(TValue()), + mFrame(TTime()), + mCounter(TTime()) {} + + void InitValue(TValue t1) { + mOrigin = t1; + mTarget = t1; + mFrame = 0; + mCounter = 0; + } + + bool IsFinished() const { + return mCounter >= mFrame; + } + + TValue GetValue() const { + if (IsFinished()) { + return mTarget; + } + + return mOrigin + mCounter * (mTarget - mOrigin) / mFrame; + } + + void Update() { + if (mCounter < mFrame) { + mCounter++; + } + } + + void SetTarget(TValue target, TTime frame) { + mOrigin = GetValue(); + mTarget = target; + mFrame = frame; + mCounter = 0; + } + +private: + TValue mOrigin; // at 0x0 + TValue mTarget; // at 0x4 + TTime mFrame; // at 0x8 + TTime mCounter; // at 0xC +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_NoteOnCallback.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_NoteOnCallback.h new file mode 100644 index 0000000000..5f4cd6202c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_NoteOnCallback.h @@ -0,0 +1,48 @@ +#ifndef NW4R_SND_NOTE_ON_CALLBACK_H +#define NW4R_SND_NOTE_ON_CALLBACK_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class SeqPlayer; + +/****************************************************************************** + * + * NoteOnInfo + * + ******************************************************************************/ +struct NoteOnInfo { + int prgNo; // at 0x0 + int key; // at 0x4 + int velocity; // at 0x8 + int length; // at 0xC + int initPan; // at 0x10 + int priority; // at 0x14 + int voiceOutCount; // at 0x18 + Channel::ChannelCallback channelCallback; // at 0x1C + u32 channelCallbackData; // at 0x20 +}; + +/****************************************************************************** + * + * NoteOnCallback + * + ******************************************************************************/ +class NoteOnCallback { +public: + virtual ~NoteOnCallback() {} // at 0x8 + + virtual Channel* NoteOn(SeqPlayer* pPlayer, int bankNo, + const NoteOnInfo& rInfo) = 0; // at 0xC +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqPlayer.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqPlayer.h new file mode 100644 index 0000000000..dd5e9591d5 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqPlayer.h @@ -0,0 +1,193 @@ +#ifndef NW4R_SND_SEQ_PLAYER_H +#define NW4R_SND_SEQ_PLAYER_H +#include + +#include +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class Channel; +struct NoteOnInfo; +class NoteOnCallback; +class SeqTrack; +class SeqTrackAllocator; + +class SeqPlayer : public BasicPlayer, + public DisposeCallback, + public SoundThread::PlayerCallback { +public: + struct ParserPlayerParam { + u8 volume; // at 0x0 + u8 priority; // at 0x1 + u8 timebase; // at 0x2 + u16 tempo; // at 0x4 + NoteOnCallback* callback; // at 0x8 + }; + + enum OffsetType { OFFSET_TYPE_TICK, OFFSET_TYPE_MILLISEC }; + + enum SetupResult { + SETUP_SUCCESS, + SETUP_ERR_CANNOT_ALLOCATE_TRACK, + SETUP_ERR_UNKNOWN + }; + + static const int LOCAL_VARIABLE_NUM = 16; + static const int GLOBAL_VARIABLE_NUM = 16; + static const int VARIABLE_NUM = LOCAL_VARIABLE_NUM + GLOBAL_VARIABLE_NUM; + + static const int TRACK_NUM = 16; + +public: + SeqPlayer(); + virtual ~SeqPlayer(); // at 0x8 + + virtual bool Start(); // at 0xC + virtual void Stop(); // at 0x10 + virtual void Pause(bool flag); // at 0x14 + + virtual bool IsActive() const { + return mActiveFlag; + } // at 0x18 + + virtual bool IsStarted() const { + return mStartedFlag; + } // at 0x1C + + virtual bool IsPause() const { + return mPauseFlag; + } // at 0x20 + + virtual void InvalidateData(const void* pStart, + const void* pEnd); // at 0x50 + + virtual void InvalidateWaveData(const void* /* pStart */, + const void* /* pEnd */) {} // at 0x54 + + virtual void ChannelCallback(Channel* /* pChannel */) {} // at 0x58 + + virtual void OnUpdateFrameSoundThread() { + Update(); + } // at 0x5C + + virtual void OnShutdownSoundThread() { + Stop(); + } // at 0x60 + + void InitParam(int voices, NoteOnCallback* pCallback); + + SetupResult Setup(SeqTrackAllocator* pAllocator, u32 allocTrackFlags, + int voices, NoteOnCallback* pCallback); + void SetSeqData(const void* pBase, s32 offset); + + void Skip(OffsetType type, int offset); + + void SetTempoRatio(f32 tempo); + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); + + void SetLocalVariable(int idx, s16 value); + static void SetGlobalVariable(int idx, s16 value); + + void SetTrackVolume(u32 trackFlags, f32 volume); + void SetTrackPitch(u32 trackFlags, f32 pitch); + + SeqTrack* GetPlayerTrack(int idx); + volatile s16* GetVariablePtr(int idx); + void Update(); + + Channel* NoteOn(int bankNo, const NoteOnInfo& rInfo); + + template + void SetTrackParam(u32 trackFlags, void (SeqTrack::*pSetter)(T), T param) { + ut::AutoInterruptLock lock; + + for (int i = 0; i < TRACK_NUM && trackFlags != 0; + trackFlags >>= 1, i++) { + + if (trackFlags & 1) { + SeqTrack* pTrack = GetPlayerTrack(i); + + if (pTrack != NULL) { + (pTrack->*pSetter)(param); + } + } + } + } + + bool IsReleasePriorityFix() const { + return mReleasePriorityFixFlag; + } + + f32 GetPanRange() const { + return mPanRange; + } + + f32 GetBaseTempo() const { + return mTempoRatio * (mParserParam.timebase * mParserParam.tempo) / + 60000.0f; + } + + int GetVoiceOutCount() const { + return mVoiceOutCount; + } + + ParserPlayerParam& GetParserPlayerParam() { + return mParserParam; + } + +private: + static const int DEFAULT_TEMPO = 120; + static const int DEFAULT_TIMEBASE = 48; + static const int DEFAULT_PRIORITY = 64; + static const int DEFAULT_VARIABLE_VALUE = -1; + + static const int MAX_SKIP_TICK_PER_FRAME = 768; + +private: + void CloseTrack(int idx); + void SetPlayerTrack(int idx, SeqTrack* pTrack); + + void FinishPlayer(); + void UpdateChannelParam(); + int ParseNextTick(bool doNoteOn); + + void UpdateTick(int msec); + void SkipTick(); + + static void InitGlobalVariable(); + +private: + bool mActiveFlag; // at 0x8C + bool mStartedFlag; // at 0x8D + bool mPauseFlag; // at 0x8E + bool mReleasePriorityFixFlag; // at 0x8F + + f32 mPanRange; // at 0x90 + f32 mTempoRatio; // at 0x94 + f32 mTickFraction; // at 0x98 + u32 mSkipTickCounter; // at 0x9C + f32 mSkipTimeCounter; // at 0xA0 + int mVoiceOutCount; // at 0xA4 + ParserPlayerParam mParserParam; // at 0xA8 + SeqTrackAllocator* mSeqTrackAllocator; // at 0xB4 + SeqTrack* mTracks[TRACK_NUM]; // at 0xB8 + volatile s16 mLocalVariable[LOCAL_VARIABLE_NUM]; // at 0xF8 + u32 mTickCounter; // at 0x118 + + static volatile s16 mGlobalVariable[LOCAL_VARIABLE_NUM]; + static bool mGobalVariableInitialized; // @typo +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqSound.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqSound.h new file mode 100644 index 0000000000..383caae7d9 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqSound.h @@ -0,0 +1,136 @@ +#ifndef NW4R_SND_SEQ_SOUND_H +#define NW4R_SND_SEQ_SOUND_H +#include + +#include +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SeqSoundHandle; + +namespace detail { +class NoteOnCallback; +class SeqTrackAllocator; +template class SoundInstanceManager; +} // namespace detail + +namespace detail { + +class SeqSound : public BasicSound { + friend class nw4r::snd::SeqSoundHandle; + +public: + NW4R_UT_RTTI_DECL(SeqSound); + +public: + explicit SeqSound(SoundInstanceManager* pManager); + + virtual void Shutdown(); // at 0x28 + virtual bool IsPrepared() const { + return mPreparedFlag; + } // at 0x2C + + virtual void SetPlayerPriority(int priority); // at 0x4C + + virtual bool IsAttachedTempSpecialHandle(); // at 0x5C + virtual void DetachTempSpecialHandle(); // at 0x60 + + virtual void InitParam(); // at 0x64 + + virtual BasicPlayer& GetBasicPlayer() { + return mSeqPlayer; + } // at 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { + return mSeqPlayer; + } // at 0x6C + + SeqPlayer::SetupResult Setup(SeqTrackAllocator* pAllocator, + u32 allocTrackFlags, int voices, + NoteOnCallback* pCallback); + + void Prepare(const void* pBase, s32 seqOffset, + SeqPlayer::OffsetType startType, int startOffset); + + void Prepare(ut::FileStream* pStream, s32 seqOffset, + SeqPlayer::OffsetType startType, int startOffset); + + void Skip(SeqPlayer::OffsetType offsetType, int offset); + + void SetTempoRatio(f32 tempo); + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); + + void SetTrackVolume(u32 trackFlags, f32 volume); + void SetTrackPitch(u32 trackFlags, f32 pitch); + + bool WriteVariable(int idx, s16 value); + static bool WriteGlobalVariable(int idx, s16 value); + + void* GetFileStreamBuffer() { + return mFileStreamBuffer; + } + s32 GetFileStreamBufferSize() { + return sizeof(mFileStreamBuffer); + } + +private: + typedef void (*SeqLoadCallback)(bool success, const void* pBase, + void* pCallbackArg); + + /****************************************************************************** + * SeqLoadTask + ******************************************************************************/ + struct SeqLoadTask : public Task { + SeqLoadTask(); + + virtual void Execute(); // at 0xC + virtual void Cancel(); // at 0x10 + virtual void OnCancel(); // at 0x14 + + ut::FileStream* fileStream; // at 0x10 + void* buffer; // at 0x14 + int bufferSize; // at 0x18 + SeqLoadCallback callback; // at 0x1C + SeqSound* callbackData; // at 0x20 + }; + + static const int FILE_STREAM_BUFFER_SIZE = 512; + +private: + bool LoadData(SeqLoadCallback pCalllback, void* pCallbackArg); + + static void NotifyLoadAsyncEndSeqData(bool success, const void* pBase, + void* pCallbackArg); + +private: + SeqPlayer mSeqPlayer; // at 0xD8 + SeqSoundHandle* mTempSpecialHandle; // at 0x1F4 + SoundInstanceManager* mManager; // at 0x1F8 + + s32 mSeqOffset; // at 0x1FC + SeqPlayer::OffsetType mStartOffsetType; // at 0x200 + int mStartOffset; // at 0x204 + + bool mLoadingFlag; // at 0x208 + volatile bool mPreparedFlag; // at 0x209 + + ut::FileStream* mFileStream; // at 0x20C + char mFileStreamBuffer[FILE_STREAM_BUFFER_SIZE]; // at 0x210 + + SeqLoadTask mSeqLoadTask; // at 0x410 + mutable OSMutex mMutex; // at 0x434 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrack.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrack.h new file mode 100644 index 0000000000..4bbace2b0d --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrack.h @@ -0,0 +1,164 @@ +#ifndef NW4R_SND_SEQ_TRACK_H +#define NW4R_SND_SEQ_TRACK_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SeqPlayer; + +enum SeqMute { MUTE_OFF, MUTE_NO_STOP, MUTE_RELEASE, MUTE_STOP }; + +enum ParseResult { PARSE_RESULT_CONTINUE, PARSE_RESULT_FINISH }; + +namespace detail { + +class SeqTrack { +public: + static const int VARIABLE_NUM = 16; + static const int PRGNO_MAX = 0xFFFF; + + struct ParserTrackParam { + const u8* baseAddr; // at 0x0 + const u8* currentAddr; // at 0x4 + s32 wait; // at 0x8 + + bool muteFlag; // at 0xC + bool silenceFlag; // at 0xD + bool noteFinishWait; // at 0xE + bool portaFlag; // at 0xF + bool damperFlag; // at 0x10 + + int bankNo; // at 0x14 + int prgNo; // at 0x18 + + LfoParam lfoParam; // at 0x1C + + u8 lfoTarget; // at 0x2C + f32 sweepPitch; // at 0x30 + + u8 volume; // at 0x34 + u8 volume2; // at 0x35 + + s8 pitchBend; // at 0x36 + u8 bendRange; // at 0x37 + + s8 pan; // at 0x38 + s8 initPan; // at 0x39 + s8 surroundPan; // at 0x3A + + s8 transpose; // at 0x3B + u8 priority; // at 0x3C + + u8 portaKey; // at 0x3D + u8 portaTime; // at 0x3E + + u8 attack; // at 0x3F + u8 decay; // at 0x40 + u8 sustain; // at 0x41 + u8 release; // at 0x42 + + u8 mainSend; // at 0x43 + u8 fxSend[AUX_BUS_NUM]; // at 0x44 + u8 lpfFreq; // at 0x47 + }; + +public: + SeqTrack(); + virtual ~SeqTrack(); // at 0x8 + + virtual ParseResult Parse(bool doNoteOn) = 0; // at 0xC + + bool IsOpened() const { + return mOpenFlag; + } + + void SetPlayerTrackNo(int no); + u8 GetPlayerTrackNo() const { + return mPlayerTrackNo; + } + + void InitParam(); + void SetSeqData(const void* pBase, s32 offset); + + void Open(); + void Close(); + + void UpdateChannelLength(); + void UpdateChannelRelease(Channel* pChannel); + + int ParseNextTick(bool doNoteOn); + + void StopAllChannel(); + void ReleaseAllChannel(int release); + void PauseAllChannel(bool flag); + void AddChannel(Channel* pChannel); + void UpdateChannelParam(); + void FreeAllChannel(); + + void SetMute(SeqMute mute); + void SetVolume(f32 volume); + void SetPitch(f32 pitch); + + ParserTrackParam& GetParserTrackParam() { + return mParserTrackParam; + } + + volatile s16* GetVariablePtr(int idx); + + SeqPlayer* GetSeqPlayer() { + return mPlayer; + } + void SetSeqPlayer(SeqPlayer* pPlayer) { + mPlayer = pPlayer; + } + + Channel* GetLastChannel() const { + return mChannelList; + } + + Channel* NoteOn(int key, int velocity, s32 length, bool tie); + +private: + static const int DEFAULT_PRIORITY = 64; + static const int DEFAULT_BENDRANGE = 2; + static const int DEFAULT_PORTA_KEY = 60; + static const int DEFAULT_VARIABLE_VALUE = -1; + +private: + static void ChannelCallbackFunc(Channel* pDropChannel, + Channel::ChannelCallbackStatus status, + u32 callbackArg); + +private: + u8 mPlayerTrackNo; // at 0x4 + bool mOpenFlag; // at 0x5 + + f32 mExtVolume; // at 0x8 + f32 mExtPitch; // at 0xC + f32 mExtPan; // at 0x10 + f32 mExtSurroundPan; // at 0x14 + f32 mPanRange; // at 0x18 + f32 mExtLpfFreq; // at 0x1C + f32 mExtMainSend; // at 0x20 + f32 mExtFxSend[AUX_BUS_NUM]; // at 0x24 + f32 mExtRemoteSend[WPAD_MAX_CONTROLLERS]; // at 0x30 + f32 mExtRemoteFxSend[WPAD_MAX_CONTROLLERS]; // at 0x40 + + ParserTrackParam mParserTrackParam; // at 0x50 + volatile s16 mTrackVariable[VARIABLE_NUM]; // at 0x98 + SeqPlayer* mPlayer; // at 0xB8 + Channel* mChannelList; // at 0xBC +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrackAllocator.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrackAllocator.h new file mode 100644 index 0000000000..92413ce0ba --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SeqTrackAllocator.h @@ -0,0 +1,26 @@ +#ifndef NW4R_SND_SEQ_TRACK_ALLOCATOR_H +#define NW4R_SND_SEQ_TRACK_ALLOCATOR_H +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class SeqPlayer; +class SeqTrack; + +class SeqTrackAllocator { +public: + virtual ~SeqTrackAllocator() {} // at 0x8 + + virtual SeqTrack* AllocTrack(SeqPlayer* pPlayer) = 0; // at 0xC + virtual void FreeTrack(SeqTrack* pTrack) = 0; // at 0x10 + virtual int GetAllocatableTrackCount() const = 0; // at 0x14 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DActor.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DActor.h new file mode 100644 index 0000000000..751268a9df --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DActor.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +namespace nw4r { + namespace snd { + class Sound3DActor { + private: + char _spacer[0xC4]; + + public: + }; + } +} diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DListener.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DListener.h new file mode 100644 index 0000000000..4ca04932fd --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DListener.h @@ -0,0 +1,52 @@ +#ifndef NW4R_SND_SOUND_3D_LISTENER_H +#define NW4R_SND_SOUND_3D_LISTENER_H +#include + +#include + +namespace nw4r { +namespace snd { + +class Sound3DListener { +public: + Sound3DListener(); + + const math::MTX34& GetMatrix() const { + return mMtx; + } + void SetMatrix(const math::MTX34& rMtx) { + mMtx = rMtx; + } + + f32 GetInteriorSize() const { + return mInteriorSize; + } + void SetInteriorSize(f32 size) { + mInteriorSize = size; + } + + f32 GetMaxVolumeDistance() const { + return mMaxVolumeDistance; + } + void SetMaxVolumeDistance(f32 distance) { + mMaxVolumeDistance = distance; + } + + f32 GetUnitDistance() const { + return mUnitDistance; + } + void SetUnitDistance(f32 distance) { + mUnitDistance = distance; + } + +private: + math::MTX34 mMtx; // at 0x0 + f32 mInteriorSize; // at 0x30 + f32 mMaxVolumeDistance; // at 0x34 + f32 mUnitDistance; // at 0x38 +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DManager.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DManager.h new file mode 100644 index 0000000000..e1ec10e898 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Sound3DManager.h @@ -0,0 +1,91 @@ +#ifndef NW4R_SND_SOUND_3D_MANAGER_H +#define NW4R_SND_SOUND_3D_MANAGER_H +#include + +#include +#include +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class Sound3DListener; +class SoundHandle; +struct SoundParam; + +class Sound3DManager : public detail::BasicSound::AmbientParamUpdateCallback, + public detail::BasicSound::AmbientArgAllocaterCallback { +public: + struct Sound3DActorParam { + u32 userParam; // at 0x0 + SoundArchive::Sound3DParam soundParam; // at 0x4 + math::VEC3 position; // at 0xC + + Sound3DActorParam(); + }; + +public: + Sound3DManager(); + + virtual void detail_Update(SoundParam* pParam, u32 id, + detail::BasicSound* pSound, const void* pArg, + u32 flags); // at 0x8 + + virtual void Update(SoundParam* pParam, u32 id, SoundHandle* pHandle, + const void* pArg, + u32 flags); // at 0x10 + + virtual void* detail_AllocAmbientArg(u32 size); // at 0x14 + + virtual void + detail_FreeAmbientArg(void* pArg, + const detail::BasicSound* pSound); // at 0x18 + + u32 GetRequiredMemSize(const SoundArchive* pArchive); + bool Setup(const SoundArchive* pArchive, void* pBuffer, u32 size); + + Sound3DListener* GetListener() const { + return mListener; + } + void AddListener(Sound3DListener* pListener) { + mListener = pListener; + } + + int GetMaxPriorityReduction() const { + return mMaxPriorityReduction; + } + void SetMaxPriorityReduction(int max) { + mMaxPriorityReduction = max; + } + + f32 GetPanRange() const { + return mPanRange; + } + +private: + enum ParamDecayCurve { + DECAY_CURVE_NONE, + DECAY_CURVE_LOGARITHMIC, + DECAY_CURVE_LINEAR, + }; + +private: + detail::InstancePool mParamPool; // at 0x8 + Sound3DListener* mListener; // at 0xC + s32 mMaxPriorityReduction; // at 0x10 + + f32 mSpeakerAngleStereo; // at 0x14 + f32 mFrontSpeakerAngleDpl2; // at 0x18 + f32 mRearSpeakerAngleDpl2; // at 0x1C + + f32 mInitPan; // at 0x20 + f32 mPanRange; // at 0x24 +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchive.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchive.h new file mode 100644 index 0000000000..3af47f5e54 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchive.h @@ -0,0 +1,183 @@ +#ifndef NW4R_SND_SOUND_ARCHIVE_H +#define NW4R_SND_SOUND_ARCHIVE_H +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +namespace detail { +class SoundArchiveFileReader; +} // namespace detail + +enum SoundType { + SOUND_TYPE_INVALID, + SOUND_TYPE_SEQ, + SOUND_TYPE_STRM, + SOUND_TYPE_WAVE +}; + +class SoundArchive { +public: + struct SoundInfo { + u32 fileId; // at 0x0 + u32 playerId; // at 0x4 + int playerPriority; // at 0x8 + int volume; // at 0xC + int remoteFilter; // at 0x10 + detail::PanMode panMode; // at 0x14 + detail::PanCurve panCurve; // at 0x18 + }; + + struct SeqSoundInfo { + u32 dataOffset; // at 0x0 + u32 bankId; // at 0x4 + u32 allocTrack; // at 0x8 + int channelPriority; // at 0xC + bool releasePriorityFixFlag; // at 0x10 + }; + + struct StrmSoundInfo {}; + + struct WaveSoundInfo { + int subNo; // at 0x0 + int channelPriority; // at 0x4 + bool releasePriorityFixFlag; // at 0x8 + }; + + struct Sound3DParam { + u32 flags; // at 0x0 + u8 decayCurve; // at 0x4 + u8 decayRatio; // at 0x5 + }; + + struct BankInfo { + u32 fileId; // at 0x0 + }; + + struct PlayerInfo { + int playableSoundCount; // at 0x0 + u32 heapSize; // at 0x4 + }; + + struct GroupInfo { + u32 itemCount; // at 0x0 + const char* extFilePath; // at 0x4 + u32 offset; // at 0x8 + u32 size; // at 0xC + u32 waveDataOffset; // at 0x10 + u32 waveDataSize; // at 0x14 + }; + struct GroupItemInfo { + u32 fileId; // at 0x0 + u32 offset; // at 0x4 + u32 size; // at 0x8 + u32 waveDataOffset; // at 0xC + u32 waveDataSize; // at 0x10 + }; + + struct FileInfo { + u32 fileSize; // at 0x0 + u32 waveDataFileSize; // at 0x4 + const char* extFilePath; // at 0x8 + u32 filePosCount; // at 0xC + }; + struct FilePos { + u32 groupId; // at 0x0 + u32 index; // at 0x4 + }; + + struct SoundArchivePlayerInfo { + int seqSoundCount; // at 0x0 + int seqTrackCount; // at 0x4 + int strmSoundCount; // at 0x8 + int strmTrackCount; // at 0xC + int strmChannelCount; // at 0x10 + int waveSoundCount; // at 0x14 + int waveTrackCount; // at 0x18 + }; + + static const u32 INVALID_ID = 0xFFFFFFFF; + +public: + SoundArchive(); + virtual ~SoundArchive(); // at 0x8 + + virtual const void* detail_GetFileAddress(u32 id) const = 0; // at 0xC + + virtual const void* + detail_GetWaveDataFileAddress(u32 id) const = 0; // at 0x10 + + virtual int detail_GetRequiredStreamBufferSize() const = 0; // at 0x14 + + virtual ut::FileStream* OpenStream(void* pBuffer, int bufferSize, + u32 offset, + u32 length) const = 0; // at 0x18 + + virtual ut::FileStream* OpenExtStream(void* pBuffer, int bufferSize, + const char* pExtPath, u32 offset, + u32 length) const = 0; // at 0x1C + + bool IsAvailable() const; + + void Setup(detail::SoundArchiveFileReader* pReader); + void Shutdown(); + + u32 GetPlayerCount() const; + u32 GetGroupCount() const; + + const char* GetSoundLabelString(u32 id) const; + u32 ConvertLabelStringToSoundId(const char* pLabel) const; + u32 ConvertLabelStringToPlayerId(const char* pLabel) const; + u32 ConvertLabelStringToGroupId(const char* pLabel) const; + + u32 GetSoundUserParam(u32 id) const; + SoundType GetSoundType(u32 id) const; + + bool ReadSoundInfo(u32 id, SoundInfo* pInfo) const; + bool detail_ReadSeqSoundInfo(u32 id, SeqSoundInfo* pInfo) const; + bool detail_ReadStrmSoundInfo(u32 id, StrmSoundInfo* pInfo) const; + bool detail_ReadWaveSoundInfo(u32 id, WaveSoundInfo* pInfo) const; + + bool ReadPlayerInfo(u32 id, PlayerInfo* pInfo) const; + bool ReadSoundArchivePlayerInfo(SoundArchivePlayerInfo* pInfo) const; + + bool detail_ReadSound3DParam(u32 id, Sound3DParam* pParam) const; + bool detail_ReadBankInfo(u32 id, BankInfo* pInfo) const; + bool detail_ReadGroupInfo(u32 id, GroupInfo* pInfo) const; + bool detail_ReadGroupItemInfo(u32 groupId, u32 itemId, + GroupItemInfo* pInfo) const; + + bool detail_ReadFileInfo(u32 id, FileInfo* pInfo) const; + bool detail_ReadFilePos(u32 fileId, u32 posId, FilePos* pPos) const; + + ut::FileStream* detail_OpenFileStream(u32 id, void* pBuffer, + int bufferSize) const; + ut::FileStream* detail_OpenGroupStream(u32 id, void* pBuffer, + int bufferSize) const; + ut::FileStream* detail_OpenGroupWaveDataStream(u32 id, void* pBuffer, + int bufferSize) const; + + void SetExternalFileRoot(const char* pExtFileRoot); + +protected: + static const int FILE_PATH_MAX = 256; + +private: + ut::FileStream* OpenExtStreamImpl(void* pBuffer, int bufferSize, + const char* pExtPath, u32 offset, + u32 size) const; + +private: + detail::SoundArchiveFileReader* mFileReader; // at 0x4 + char mExtFileRoot[FILE_PATH_MAX]; // at 0x8 +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveFile.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveFile.h new file mode 100644 index 0000000000..add74af782 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveFile.h @@ -0,0 +1,307 @@ +#ifndef NW4R_SND_SOUND_ARCHIVE_FILE_H +#define NW4R_SND_SOUND_ARCHIVE_FILE_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { +namespace SoundArchiveFile { + +/****************************************************************************** + * + * Symbol (SYMB) block + * + ******************************************************************************/ +struct StringTreeNode { + u16 flags; // at 0x0 + u16 bit; // at 0x2 + u32 leftIdx; // at 0x4 + u32 rightIdx; // at 0x8 + u32 strIdx; // at 0xC + u32 id; // at 0x10 +}; + +struct StringTree { + u32 rootIdx; // at 0x0 + Util::Table nodeTable; // at 0x4 +}; + +struct StringTable { + Util::Table offsetTable; // at 0x0 +}; + +struct StringChunk { + u32 tableOffset; // at 0x0 + u32 soundTreeOffset; // at 0x4 + u32 playerTreeOffset; // at 0x8 + u32 groupTreeOffset; // at 0xC + u32 bankTreeOffset; // at 0x10 +}; + +struct StringBlock { + union { + StringTable stringTable; + StringChunk stringChunk; + }; // at 0x0 +}; + +struct SymbolBlock { + ut::BinaryBlockHeader blockHeader; // at 0x0 + StringBlock stringBlock; // at 0x8 +}; + +/****************************************************************************** + * + * Info (INFO) block + * + ******************************************************************************/ +struct SeqSoundInfo { + u32 dataOffset; // at 0x0 + u32 bankId; // at 0x4 + u32 allocTrack; // at 0x8 + u8 channelPriority; // at 0xC + u8 releasePriorityFix; // at 0xD +}; + +struct StrmSoundInfo {}; + +struct WaveSoundInfo { + s32 subNo; // at 0x0 + u32 allocTrack; // at 0x4 + u8 channelPriority; // at 0x8 + u8 releasePriorityFix; // at 0x9 +}; +typedef Util::DataRef + SoundInfoOffset; + +struct Sound3DParam { + u32 flags; // at 0x0 + u8 decayCurve; // at 0x4 + u8 decayRatio; // at 0x5 +}; + +struct SoundCommonInfo { + u32 stringId; // at 0x0 + u32 fileId; // at 0x4 + u32 playerId; // at 0x8 + Util::DataRef param3dRef; // at 0xC + u8 volume; // at 0x14 + u8 playerPriority; // at 0x15 + u8 soundType; // at 0x16 + u8 remoteFilter; // at 0x17 + SoundInfoOffset soundInfoRef; // at 0x18 + u32 userParam[2]; // at 0x20 + u8 panMode; // at 0x28 + u8 panCurve; // at 0x29 +}; +typedef Util::Table > SoundCommonTable; + +struct BankInfo { + u32 stringId; // at 0x0 + u32 fileId; // at 0x4 +}; +typedef Util::Table > BankTable; + +struct PlayerInfo { + u32 stringId; // at 0x0 + u8 playableSoundCount; // at 0x4 + u32 heapSize; // at 0x8 +}; +typedef Util::Table > PlayerTable; + +typedef Util::Table > FilePosTable; + +struct FileInfo { + u32 fileSize; // at 0x0 + u32 waveDataSize; // at 0x4 + s32 entryNum; // at 0x8 + Util::DataRef extFilePathRef; // at 0xC + Util::DataRef filePosTableRef; // at 0x14 +}; +typedef Util::Table > FileTable; + +struct GroupItemInfo { + u32 fileId; // at 0x0 + u32 offset; // at 0x4 + u32 size; // at 0x8 + u32 waveDataOffset; // at 0xC + u32 waveDataSize; // at 0x10 +}; +typedef Util::Table > GroupItemTable; + +struct GroupInfo { + u32 stringId; // at 0x0 + s32 entryNum; // at 0x4 + Util::DataRef extFilePathRef; // at 0x8 + u32 offset; // at 0x10 + u32 size; // at 0x14 + u32 waveDataOffset; // at 0x18 + u32 waveDataSize; // at 0x1C + Util::DataRef itemTableRef; // at 0x20 +}; +typedef Util::Table > GroupTable; + +struct SoundArchivePlayerInfo { + u16 seqSoundCount; // at 0x0 + u16 seqTrackCount; // at 0x2 + u16 strmSoundCount; // at 0x4 + u16 strmTrackCount; // at 0x6 + u16 strmChannelCount; // at 0x8 + u16 waveSoundCount; // at 0xA + u16 waveTrackCount; // at 0xC +}; + +struct Info { + Util::DataRef soundTableRef; // at 0x0 + Util::DataRef bankTableRef; // at 0x8 + Util::DataRef playerTableRef; // at 0x10 + Util::DataRef fileTableRef; // at 0x18 + Util::DataRef groupTableRef; // at 0x20 + Util::DataRef soundArchivePlayerInfoRef; // at 0x28 +}; + +struct InfoBlock { + ut::BinaryBlockHeader blockHeader; // at 0x0 + Info info; // at 0x8 +}; + +/****************************************************************************** + * + * File header + * + ******************************************************************************/ +struct Header { + ut::BinaryFileHeader fileHeader; // at 0x0 + u32 symbolDataOffset; // at 0x10 + u32 symbolDataSize; // at 0x14 + u32 infoOffset; // at 0x18 + u32 infoSize; // at 0x1C + u32 fileImageOffset; // at 0x20 + u32 fileImageSize; // at 0x24 +}; + +// TODO(kiwi) How is this calculated? +static const int HEADER_AREA_SIZE = ROUND_UP(sizeof(Header), 32) + 40; + +} // namespace SoundArchiveFile + +/****************************************************************************** + * + * SoundArchiveFileReader + * + ******************************************************************************/ +class SoundArchiveFileReader { +public: + static const u32 SIGNATURE = FOURCC('R', 'S', 'A', 'R'); + static const int VERSION = NW4R_VERSION(1, 3); + +public: + SoundArchiveFileReader(); + + void Init(const void* pSoundArchiveBin); + bool IsValidFileHeader(const void* pSoundArchiveBin); + + void SetStringChunk(const void* pChunk, u32 size); + void SetInfoChunk(const void* pChunk, u32 size); + + SoundType GetSoundType(u32 id) const; + bool ReadSoundInfo(u32 id, SoundArchive::SoundInfo* pInfo) const; + bool ReadSound3DParam(u32 id, SoundArchive::Sound3DParam* pParam) const; + bool ReadSeqSoundInfo(u32 id, SoundArchive::SeqSoundInfo* pInfo) const; + bool ReadStrmSoundInfo(u32 id, SoundArchive::StrmSoundInfo* pInfo) const; + bool ReadWaveSoundInfo(u32 id, SoundArchive::WaveSoundInfo* pInfo) const; + bool ReadBankInfo(u32 id, SoundArchive::BankInfo* pInfo) const; + bool ReadPlayerInfo(u32 id, SoundArchive::PlayerInfo* pInfo) const; + bool ReadGroupInfo(u32 id, SoundArchive::GroupInfo* pInfo) const; + bool ReadGroupItemInfo(u32 groupId, u32 itemId, + SoundArchive::GroupItemInfo* pInfo) const; + bool ReadSoundArchivePlayerInfo( + SoundArchive::SoundArchivePlayerInfo* pInfo) const; + + u32 GetSoundStringId(u32 id) const; + u32 GetPlayerCount() const; + u32 GetGroupCount() const; + + const char* GetSoundLabelString(u32 id) const; + u32 GetSoundUserParam(u32 id) const; + + bool ReadFileInfo(u32 id, SoundArchive::FileInfo* pInfo) const; + bool ReadFilePos(u32 fileId, u32 id, SoundArchive::FilePos* pPos) const; + + const char* GetString(u32 id) const; + + u32 ConvertLabelStringToSoundId(const char* pLabel) const { + return ConvertLabelStringToId(mStringTreeSound, pLabel); + } + u32 ConvertLabelStringToPlayerId(const char* pLabel) const { + return ConvertLabelStringToId(mStringTreePlayer, pLabel); + } + u32 ConvertLabelStringToGroupId(const char* pLabel) const { + return ConvertLabelStringToId(mStringTreeGroup, pLabel); + } + + u16 GetVersion() const { + return mHeader.fileHeader.version; + } + + u32 GetLabelStringChunkOffset() const { + return mHeader.symbolDataOffset; + } + + u32 GetLabelStringChunkSize() const { + return mHeader.symbolDataSize; + } + + u32 GetInfoChunkOffset() const { + return mHeader.infoOffset; + } + + u32 GetInfoChunkSize() const { + return mHeader.infoSize; + } + +private: + u32 ConvertLabelStringToId(const SoundArchiveFile::StringTree* pTree, + const char* pLabel) const; + + const SoundArchiveFile::SoundCommonInfo* impl_GetSoundInfo(u32 id) const; + SoundArchiveFile::SoundInfoOffset impl_GetSoundInfoOffset(u32 id) const + DECOMP_DONT_INLINE; + + const SoundArchiveFile::SeqSoundInfo* impl_GetSeqSoundInfo(u32 id) const; + const SoundArchiveFile::StrmSoundInfo* impl_GetStrmSoundInfo(u32 id) const; + const SoundArchiveFile::WaveSoundInfo* impl_GetWaveSoundInfo(u32 id) const; + + const SoundArchiveFile::BankInfo* impl_GetBankInfo(u32 id) const; + const SoundArchiveFile::PlayerInfo* impl_GetPlayerInfo(u32 id) const; + const SoundArchiveFile::GroupInfo* impl_GetGroupInfo(u32 id) const; + + const void* GetPtrConst(const void* pBase, u32 offset) const { + if (offset == 0) { + return NULL; + } + + return ut::AddOffsetToPtr(pBase, offset); + } + +public: + SoundArchiveFile::Header mHeader; // at 0x0 + const SoundArchiveFile::Info* mInfo; // at 0x28 + const void* mStringBase; // at 0x2C + const SoundArchiveFile::StringTable* mStringTable; // at 0x30 + const SoundArchiveFile::StringTree* mStringTreeSound; // at 0x34 + const SoundArchiveFile::StringTree* mStringTreePlayer; // at 0x38 + const SoundArchiveFile::StringTree* mStringTreeGroup; // at 0x3C + const SoundArchiveFile::StringTree* mStringTreeBank; // at 0x40 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveLoader.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveLoader.h new file mode 100644 index 0000000000..49e9f7bf2e --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchiveLoader.h @@ -0,0 +1,73 @@ +#ifndef NW4R_SND_SOUND_ARCHIVE_LOADER_H +#define NW4R_SND_SOUND_ARCHIVE_LOADER_H +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SoundArchive; +class SoundMemoryAllocatable; + +namespace detail { + +/****************************************************************************** + * + * FileStreamHandle + * + ******************************************************************************/ +class FileStreamHandle { +public: + FileStreamHandle(ut::FileStream* pStream) : mStream(pStream) {} + + ~FileStreamHandle() { + if (mStream != NULL) { + mStream->Close(); + } + } + + ut::FileStream* GetFileStream() { + return mStream; + } + + ut::FileStream* operator->() { + return mStream; + } + + operator bool() const { + return mStream; + } + +private: + ut::FileStream* mStream; // at 0x0 +}; + +/****************************************************************************** + * + * SoundArchiveLoader + * + ******************************************************************************/ +class SoundArchiveLoader { +public: + explicit SoundArchiveLoader(const SoundArchive& rArchive); + ~SoundArchiveLoader(); + + void* LoadGroup(u32 id, SoundMemoryAllocatable* pAllocatable, + void** ppWaveBuffer, u32 blockSize); + +private: + mutable OSMutex mMutex; // at 0x0 + const SoundArchive& mArc; // at 0x18 + u8 mStreamArea[512]; // at 0x1C + ut::FileStream* mStream; // at 0x21C +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchivePlayer.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchivePlayer.h new file mode 100644 index 0000000000..069f19b209 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundArchivePlayer.h @@ -0,0 +1,241 @@ +#ifndef NW4R_SND_SOUND_ARCHIVE_PLAYER_H +#define NW4R_SND_SOUND_ARCHIVE_PLAYER_H +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SoundMemoryAllocatable; +class SoundPlayer; + +namespace detail { +class SeqTrackAllocator; +} // namespace detail + +/****************************************************************************** + * + * SoundArchivePlayer_FileManager + * + ******************************************************************************/ +class SoundArchivePlayer_FileManager { +public: + virtual const void* GetFileAddress(u32 id) = 0; // at 0x8 + virtual const void* GetFileWaveDataAddress(u32 id) = 0; // at 0x8 +}; + +/****************************************************************************** + * + * SoundArchivePlayer + * + ******************************************************************************/ +class SoundArchivePlayer : public detail::DisposeCallback, + public SoundStartable { +public: + SoundArchivePlayer(); + virtual ~SoundArchivePlayer(); // at 0x8 + + virtual void InvalidateData(const void* pStart, + const void* pEnd); // at 0xC + + virtual void InvalidateWaveData(const void* pStart, + const void* pEnd); // at 0x10 + + virtual StartResult + detail_SetupSound(SoundHandle* pHandle, u32 id, + detail::BasicSound::AmbientArgInfo* pArgInfo, + detail::ExternalSoundPlayer* pPlayer, bool hold, + const StartInfo* pStartInfo); // at 0x28 + + virtual u32 detail_ConvertLabelStringToSoundId(const char* pLabel) { + return mSoundArchive->ConvertLabelStringToSoundId(pLabel); + } // at 0x2C + + bool IsAvailable() const; + + bool Setup(const SoundArchive* pArchive, void* pMramBuffer, + u32 mramBufferSize, void* pStrmBuffer, u32 strmBufferSize); + + void Shutdown(); + + u32 GetRequiredMemSize(const SoundArchive* pArchive); + u32 GetRequiredStrmBufferSize(const SoundArchive* pArchive); + + void Update(); + + const SoundArchive& GetSoundArchive() const; + + SoundPlayer& GetSoundPlayer(u32 idx); + SoundPlayer& GetSoundPlayer(int idx) { + return GetSoundPlayer(static_cast(idx)); + } + + const void* detail_GetFileAddress(u32 id) const; + const void* detail_GetFileWaveDataAddress(u32 id) const; + + const void* GetGroupAddress(u32 id) const; + void SetGroupAddress(u32 id, const void* pAddr); + + const void* GetGroupWaveDataAddress(u32 id) const; + void SetGroupWaveDataAddress(u32 id, const void* pAddr); + + bool LoadGroup(u32 id, SoundMemoryAllocatable* pAllocatable, u32 blockSize); + bool LoadGroup(const char* pLabel, SoundMemoryAllocatable* pAllocatable, + u32 blockSize); + + bool LoadGroup(int id, SoundMemoryAllocatable* pAllocatable, + u32 blockSize) { + return LoadGroup(static_cast(id), pAllocatable, blockSize); + } + bool LoadGroup(unsigned int id, SoundMemoryAllocatable* pAllocatable, + u32 blockSize) { + return LoadGroup(static_cast(id), pAllocatable, blockSize); + } + + u32 GetSoundPlayerCount() const { + return mSoundPlayerCount; + } + + u32 GetFreeSeqSoundCount() const { + return mSeqSoundInstanceManager.GetFreeCount(); + } + u32 GetFreeStrmSoundCount() const { + return mStrmSoundInstanceManager.GetFreeCount(); + } + u32 GetFreeWaveSoundCount() const { + return mWaveSoundInstanceManager.GetFreeCount(); + } + +private: + struct Group { + const void* address; // at 0x0 + const void* waveDataAddress; // at 0x4 + }; + + typedef detail::Util::Table GroupTable; + + /****************************************************************************** + * SeqNoteOnCallback + ******************************************************************************/ + class SeqNoteOnCallback : public detail::NoteOnCallback { + public: + explicit SeqNoteOnCallback(const SoundArchivePlayer& rPlayer) + : mSoundArchivePlayer(rPlayer) {} + + virtual detail::Channel* + NoteOn(detail::SeqPlayer* pPlayer, int bankNo, + const detail::NoteOnInfo& rInfo); // at 0xC + + private: + const SoundArchivePlayer& mSoundArchivePlayer; // at 0x0 + }; + + /****************************************************************************** + * WsdCallback + ******************************************************************************/ + class WsdCallback : public detail::WsdPlayer::WsdCallback { + public: + explicit WsdCallback(const SoundArchivePlayer& rPlayer) + : mSoundArchivePlayer(rPlayer) {} + + virtual bool GetWaveSoundData(detail::WaveSoundInfo* pSoundInfo, + detail::WaveSoundNoteInfo* pNoteInfo, + detail::WaveData* pWaveData, + const void* pWsdData, int index, + int noteIndex, + u32 callbackArg) const; // at 0xC + + private: + const SoundArchivePlayer& mSoundArchivePlayer; // at 0x0 + }; + +private: + bool SetupMram(const SoundArchive* pArchive, void* pBuffer, u32 bufferSize); + + detail::PlayerHeap* CreatePlayerHeap(void* pBuffer, u32 bufferSize); + + bool SetupSoundPlayer(const SoundArchive* pArchive, void** ppBuffer, + void* pEnd); + + bool CreateGroupAddressTable(const SoundArchive* pArchive, void** ppBuffer, + void* pEnd); + + bool SetupSeqSound(const SoundArchive* pArchive, int sounds, + void** ppBuffer, void* pEnd); + bool SetupWaveSound(const SoundArchive* pArchive, int sounds, + void** ppBuffer, void* pEnd); + bool SetupStrmSound(const SoundArchive* pArchive, int sounds, + void** ppBuffer, void* pEnd); + bool SetupSeqTrack(const SoundArchive* pArchive, int tracks, + void** ppBuffer, void* pEnd); + bool SetupStrmBuffer(const SoundArchive* pArchive, void* pBuffer, + u32 bufferSize); + + StartResult + PrepareSeqImpl(detail::SeqSound* pSound, + const SoundArchive::SoundInfo* pSndInfo, + const SoundArchive::SeqSoundInfo* pSeqInfo, + SoundStartable::StartInfo::StartOffsetType startType, + int startOffset, int voices); + + StartResult + PrepareStrmImpl(detail::StrmSound* pSound, + const SoundArchive::SoundInfo* pSndInfo, + const SoundArchive::StrmSoundInfo* pStrmInfo, + SoundStartable::StartInfo::StartOffsetType startType, + int startOffset, int voices); + + StartResult + PrepareWaveSoundImpl(detail::WaveSound* pSound, + const SoundArchive::SoundInfo* pSndInfo, + const SoundArchive::WaveSoundInfo* pWsdInfo, + SoundStartable::StartInfo::StartOffsetType startType, + int startOffset, int voices); + +private: + const SoundArchive* mSoundArchive; // at 0x10 + GroupTable* mGroupTable; // at 0x14 + SoundArchivePlayer_FileManager* mFileManager; // at 0x18 + + detail::SeqTrackAllocator* mSeqTrackAllocator; // at 0x1C + SeqNoteOnCallback mSeqCallback; // at 0x20 + WsdCallback mWsdCallback; // at 0x28 + + u32 mSoundPlayerCount; // at 0x30 + SoundPlayer* mSoundPlayers; // at 0x34 + + detail::SoundInstanceManager + mSeqSoundInstanceManager; // at 0x38 + + detail::SoundInstanceManager + mStrmSoundInstanceManager; // at 0x60 + + detail::SoundInstanceManager + mWaveSoundInstanceManager; // at 0x88 + + detail::MmlSeqTrackAllocator mMmlSeqTrackAllocator; // at 0xB0 + detail::StrmBufferPool mStrmBufferPool; // at 0xBC + detail::MmlParser mMmlParser; // at 0xD4 + + void* mSetupBufferAddress; // at 0xD8 + u32 mSetupBufferSize; // at 0xDC +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundHeap.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundHeap.h new file mode 100644 index 0000000000..ac67d7085b --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundHeap.h @@ -0,0 +1,59 @@ +#ifndef NW4R_SND_SOUND_HEAP_H +#define NW4R_SND_SOUND_HEAP_H +#include + +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { + +class SoundHeap : public SoundMemoryAllocatable { +public: + SoundHeap(); + virtual ~SoundHeap(); // at 0x8 + + virtual void* Alloc(u32 size); // at 0xC + + void* Alloc(u32 size, detail::FrameHeap::FreeCallback pCallback, + void* pCallbackArg); + + bool Create(void* pBase, u32 size); + void Destroy(); + + void Clear(); + + int SaveState(); + void LoadState(int id); + + bool IsValid() { + return mFrameHeap.IsValid(); + } + + int GetCurrentLevel() const { + ut::detail::AutoLock lock(mMutex); + return mFrameHeap.GetCurrentLevel(); + } + + u32 GetFreeSize() const { + ut::detail::AutoLock lock(mMutex); + return mFrameHeap.GetFreeSize(); + } + +private: + static void DisposeCallbackFunc(void* pBuffer, u32 size, + void* pCallbackArg); + +private: + mutable OSMutex mMutex; // at 0x0 + detail::FrameHeap mFrameHeap; // at 0x1C +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundInstanceManager.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundInstanceManager.h new file mode 100644 index 0000000000..10e28dad7d --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundInstanceManager.h @@ -0,0 +1,144 @@ +#ifndef NW4R_SND_SOUND_INSTANCE_MANAGER_H +#define NW4R_SND_SOUND_INSTANCE_MANAGER_H +#include + +#include +#include + +#include + + +namespace nw4r { +namespace snd { +namespace detail { + +template class SoundInstanceManager { +public: + SoundInstanceManager() { + OSInitMutex(&mMutex); + } + + u32 Create(void* pBuffer, u32 size) { + ut::detail::AutoLock lock(mMutex); + return mPool.Create(pBuffer, size); + } + + void Destroy(void* pBuffer, u32 size) { + ut::detail::AutoLock lock(mMutex); + mPool.Destroy(pBuffer, size); + } + + T* Alloc(int priority) { + ut::detail::AutoLock lock(mMutex); + T* pSound = NULL; + + while (pSound == NULL) { + void* pBuffer = mPool.Alloc(); + + if (pBuffer != NULL) { + pSound = new (pBuffer) T(this); + } else { + T* pLowest = GetLowestPrioritySound(); + + if (pLowest == NULL) { + return NULL; + } + + if (priority < pLowest->CalcCurrentPlayerPriority()) { + return NULL; + } + + OSUnlockMutex(&mMutex); + pLowest->Stop(0); + OSLockMutex(&mMutex); + } + } + + InsertPriorityList(pSound, priority); + return pSound; + } + + void Free(T* pSound) { + ut::detail::AutoLock lock(mMutex); + + if (mPriorityList.IsEmpty()) { + return; + } + + RemovePriorityList(pSound); + pSound->~T(); + mPool.Free(pSound); + } + + u32 GetActiveCount() const { + return mPriorityList.GetSize(); + } + + u32 GetFreeCount() const { + return mPool.Count(); + } + + T* GetLowestPrioritySound() { + if (mPriorityList.IsEmpty()) { + return NULL; + } + + return static_cast(&mPriorityList.GetFront()); + } + + void InsertPriorityList(T* pSound, int priority) { + typename TPrioList::Iterator it = mPriorityList.GetBeginIter(); + + for (; it != mPriorityList.GetEndIter(); ++it) { + if (priority < it->CalcCurrentPlayerPriority()) { + break; + } + } + + mPriorityList.Insert(it, pSound); + } + + void RemovePriorityList(T* pSound) { + mPriorityList.Erase(pSound); + } + + void SortPriorityList() { + TPrioList listsByPrio[T::PRIORITY_MAX + 1]; + ut::detail::AutoLock lock(mMutex); + + while (!mPriorityList.IsEmpty()) { + T& rSound = mPriorityList.GetFront(); + mPriorityList.PopFront(); + listsByPrio[rSound.CalcCurrentPlayerPriority()].PushBack(&rSound); + } + + for (int i = 0; i < T::PRIORITY_MAX + 1; i++) { + while (!listsByPrio[i].IsEmpty()) { + T& rSound = listsByPrio[i].GetFront(); + listsByPrio[i].PopFront(); + mPriorityList.PushBack(&rSound); + } + } + } + + void UpdatePriority(T* pSound, int priority) { + ut::detail::AutoLock lock(mMutex); + + RemovePriorityList(pSound); + InsertPriorityList(pSound, priority); + } + +private: + NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(T, Prio); + +private: + MemoryPool mPool; // at 0x0 + TPrioList mPriorityList; // at 0x4 + mutable OSMutex mMutex; // at 0x10 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundMemoryAllocatable.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundMemoryAllocatable.h new file mode 100644 index 0000000000..9f5c0edf71 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundMemoryAllocatable.h @@ -0,0 +1,17 @@ +#ifndef NW4R_SND_SOUND_MEMORY_ALLOCATABLE_H +#define NW4R_SND_SOUND_MEMORY_ALLOCATABLE_H +#include + +namespace nw4r { +namespace snd { + +class SoundMemoryAllocatable { +public: + virtual ~SoundMemoryAllocatable() {} // at 0x8 + virtual void* Alloc(u32 size) = 0; // at 0xC +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundStartable.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundStartable.h new file mode 100644 index 0000000000..eb415316f9 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundStartable.h @@ -0,0 +1,127 @@ +#ifndef NW4R_SND_SOUND_STARTABLE_H +#define NW4R_SND_SOUND_STARTABLE_H +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class SoundHandle; + +namespace detail { +class ExternalSoundPlayer; +} // namespace detail + +class SoundStartable { +public: + enum StartResult { + START_SUCCESS, + START_ERR_LOW_PRIORITY, + START_ERR_INVALID_LABEL_STRING, + START_ERR_INVALID_SOUNDID, + START_ERR_NOT_DATA_LOADED, + START_ERR_NOT_ENOUGH_PLAYER_HEAP, + START_ERR_CANNOT_OPEN_FILE, + START_ERR_NOT_AVAILABLE, + START_ERR_CANNOT_ALLOCATE_TRACK, + START_ERR_NOT_ENOUGH_INSTANCE, + START_ERR_INVALID_PARAMETER, + START_ERR_INVALID_SEQ_START_LOCATION_LABEL, + + START_ERR_USER = 128, + START_ERR_UNKNOWN = 255, + }; + + struct StartInfo { + enum EnableFlag { + ENABLE_START_OFFSET = (1 << 0), + ENABLE_PLAYER_ID = (1 << 1), + ENABLE_PLAYER_PRIORITY = (1 << 2) + }; + + enum StartOffsetType { + START_OFFSET_TYPE_MILLISEC, + START_OFFSET_TYPE_TICK, + START_OFFSET_TYPE_SAMPLE + }; + + u32 enableFlag; // at 0x0 + StartOffsetType startOffsetType; // at 0x4 + int startOffset; // at 0x8 + u32 playerId; // at 0xC + int playerPriority; // at 0x10 + int voiceOutCount; // at 0x14 + }; + +public: + virtual ~SoundStartable() {} // at 0x8 + + virtual StartResult + detail_SetupSound(SoundHandle* pHandle, u32 id, + detail::BasicSound::AmbientArgInfo* pArgInfo, + detail::ExternalSoundPlayer* pPlayer, bool hold, + const StartInfo* pStartInfo) = 0; // at 0xC + + virtual u32 + detail_ConvertLabelStringToSoundId(const char* pLabel) = 0; // at 0x10 + + bool StartSound(SoundHandle* pHandle, u32 id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + bool StartSound(SoundHandle* pHandle, unsigned int id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + bool StartSound(SoundHandle* pHandle, int id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + + bool HoldSound(SoundHandle* pHandle, u32 id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool HoldSound(SoundHandle* pHandle, unsigned int id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool HoldSound(SoundHandle* pHandle, int id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + + bool PrepareSound(SoundHandle* pHandle, u32 id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + bool PrepareSound(SoundHandle* pHandle, unsigned int id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + bool PrepareSound(SoundHandle* pHandle, int id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == + START_SUCCESS; + } + +private: + StartResult detail_StartSound(SoundHandle* pHandle, u32 id, + detail::BasicSound::AmbientArgInfo* pArgInfo, + detail::ExternalSoundPlayer* pPlayer, + const StartInfo* pStartInfo); + + StartResult detail_HoldSound(SoundHandle* pHandle, u32 id, + detail::BasicSound::AmbientArgInfo* pArgInfo, + detail::ExternalSoundPlayer* pPlayer, + const StartInfo* pStartInfo); + + StartResult + detail_PrepareSound(SoundHandle* pHandle, u32 id, + detail::BasicSound::AmbientArgInfo* pArgInfo, + detail::ExternalSoundPlayer* pPlayer, + const StartInfo* pStartInfo); +}; + +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundThread.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundThread.h new file mode 100644 index 0000000000..b17317b412 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_SoundThread.h @@ -0,0 +1,116 @@ +#ifndef NW4R_SND_SOUND_THREAD_H +#define NW4R_SND_SOUND_THREAD_H +#include + +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class SoundThread { + friend class AutoLock; // Prevent locking without AutoLock + +public: + /****************************************************************************** + * SoundFrameCallback + ******************************************************************************/ + class SoundFrameCallback { + public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + + virtual ~SoundFrameCallback() {} // at 0x8 + virtual void OnBeginSoundFrame() {} // at 0xC + virtual void OnEndSoundFrame() {} // at 0x10 + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(SoundFrameCallback); + + /****************************************************************************** + * PlayerCallback + ******************************************************************************/ + class PlayerCallback { + public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x0 + + virtual ~PlayerCallback() {} // at 0x8 + virtual void OnUpdateFrameSoundThread() {} // at 0xC + virtual void OnUpdateVoiceSoundThread() {} // at 0x10 + virtual void OnShutdownSoundThread() {} // at 0x14 + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(PlayerCallback); + + /****************************************************************************** + * AutoLock + ******************************************************************************/ + class AutoLock : private ut::NonCopyable { + public: + AutoLock() { + SoundThread::GetInstance().Lock(); + } + + ~AutoLock() { + SoundThread::GetInstance().Unlock(); + } + }; + +public: + static SoundThread& GetInstance(); + + bool Create(s32 priority, void* pStack, u32 stackSize); + void Shutdown(); + + void RegisterPlayerCallback(PlayerCallback* pCallback); + void UnregisterPlayerCallback(PlayerCallback* pCallback); + +private: + enum ThreadMessage { + MSG_NONE, + MSG_AX_CALLBACK, + MSG_SHUTDOWN, + }; + + static const int MSG_QUEUE_CAPACITY = 4; + +private: + SoundThread(); + + static void AxCallbackFunc(); + void AxCallbackProc(); + + static void* SoundThreadFunc(void* pArg); + void SoundThreadProc(); + + void Lock() { + OSLockMutex(&mMutex); + } + void Unlock() { + OSUnlockMutex(&mMutex); + } + +private: + OSThread mThread; // at 0x0 + OSThreadQueue mThreadQueue; // at 0x318 + OSMessageQueue mMsgQueue; // at 0x320 + OSMessage mMsgBuffer[MSG_QUEUE_CAPACITY]; // at 0x340 + void* mStackEnd; // at 0x350 + mutable OSMutex mMutex; // at 0x354 + + AxManager::CallbackListNode mAxCallbackNode; // at 0x36C + SoundFrameCallbackList mSoundFrameCallbackList; // at 0x378 + PlayerCallbackList mPlayerCallbackList; // at 0x384 + + u32 mProcessTick; // at 0x390 + bool mCreateFlag; // at 0x394 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmChannel.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmChannel.h new file mode 100644 index 0000000000..5f66a18186 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmChannel.h @@ -0,0 +1,48 @@ +#ifndef NW4R_SND_STRM_CHANNEL_H +#define NW4R_SND_STRM_CHANNEL_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +struct StrmChannel { + void* bufferAddress; // at 0x0 + u32 bufferSize; // at 0x4 + AdpcmInfo adpcmInfo; // at 0x8 +}; + +class StrmBufferPool { +public: + void Setup(void* pBase, u32 size, int count); + void Shutdown(); + + void* Alloc(); + void Free(void* pBuffer); + + u32 GetBlockSize() const { + return mBlockSize; + } + +private: + static const int BLOCK_MAX = 32; + static const int BITS_PER_BYTE = 8; + +private: + void* mBuffer; // at 0x0 + u32 mBufferSize; // at 0x4 + + u32 mBlockSize; // at 0x8 + int mBlockCount; // at 0xC + + int mAllocCount; // at 0x10 + u8 mAllocFlags[BLOCK_MAX / BITS_PER_BYTE]; // at 0x14 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmFile.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmFile.h new file mode 100644 index 0000000000..96e2a46a5c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmFile.h @@ -0,0 +1,177 @@ +#ifndef NW4R_SND_STRM_FILE_H +#define NW4R_SND_STRM_FILE_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +/****************************************************************************** + * + * RSTM binary layout + * + ******************************************************************************/ +namespace StrmFile { + +struct StrmDataInfo { + u8 format; // at 0x0 + u8 loopFlag; // at 0x1 + u8 numChannels; // at 0x2 + u8 sampleRate24; // at 0x3 + u16 sampleRate; // at 0x4 + u16 blockHeaderOffset; // at 0x6 + u32 loopStart; // at 0x8 + u32 loopEnd; // at 0xC + u32 dataOffset; // at 0x10 + u32 numBlocks; // at 0x14 + u32 blockSize; // at 0x18 + u32 blockSamples; // at 0x1C + u32 lastBlockSize; // at 0x20 + u32 lastBlockSamples; // at 0x24 + u32 lastBlockPaddedSize; // at 0x28 + u32 adpcmDataInterval; // at 0x2C + u32 adpcmDataSize; // at 0x30 +}; + +struct TrackInfo { + u8 channelCount; // at 0x0 + u8 channelIndexTable[]; // at 0x1 +}; + +struct TrackTable { + u8 trackCount; // at 0x0 + u8 trackDataType; // at 0x1 + Util::DataRef refTrackHeader[]; // at 0x4 +}; + +struct ChannelInfo { + Util::DataRef refAdpcmInfo; // at 0x0 +}; + +struct ChannelTable { + u8 channelCount; // at 0x0 + Util::DataRef refChannelHeader[]; // at 0x4 +}; + +struct Header { + ut::BinaryFileHeader fileHeader; // at 0x0 + u32 headBlockOffset; // at 0x10 + u32 headBlockSize; // at 0x14 + u32 adpcBlockOffset; // at 0x18 + u32 adpcBlockSize; // at 0x1C + u32 dataBlockOffset; // at 0x20 + u32 dataBlockSize; // at 0x24 +}; + +struct HeadBlock { + ut::BinaryBlockHeader blockHeader; // at 0x0 + Util::DataRef refDataHeader; // at 0x8 + Util::DataRef refTrackTable; // at 0x10 + Util::DataRef refChannelTable; // at 0x18 +}; + +} // namespace StrmFile + +/****************************************************************************** + * + * StrmFileReader + * + ******************************************************************************/ +struct StrmInfo { + u8 format; // at 0x0 + u8 loopFlag; // at 0x1 + u8 numChannels; // at 0x2 + int sampleRate; // at 0x4 + u16 blockHeaderOffset; // at 0x8 + u32 loopStart; // at 0xC + u32 loopEnd; // at 0x10 + u32 dataOffset; // at 0x14 + u32 numBlocks; // at 0x18 + u32 blockSize; // at 0x1C + u32 blockSamples; // at 0x20 + u32 lastBlockSize; // at 0x24 + u32 lastBlockSamples; // at 0x28 + u32 lastBlockPaddedSize; // at 0x2C + u32 adpcmDataInterval; // at 0x30 + u32 adpcmDataSize; // at 0x34 +}; + +class StrmFileReader { +public: + static const u32 SIGNATURE = FOURCC('R', 'S', 'T', 'M'); + static const int VERSION = NW4R_VERSION(1, 0); + +public: + StrmFileReader(); + + bool IsAvailable() const { + return mHeader != NULL; + } + + bool IsValidFileHeader(const void* pStrmBin); + void Setup(const void* pStrmBin); + + bool ReadStrmInfo(StrmInfo* pStrmInfo) const; + bool ReadAdpcmInfo(AdpcmInfo* pAdpcmInfo, int channels) const; + + u32 GetAdpcBlockOffset() const { + if (IsAvailable()) { + return mHeader->adpcBlockOffset; + } + + return 0; + } + +private: + const StrmFile::Header* mHeader; // at 0x0 + const StrmFile::HeadBlock* mHeadBlock; // at 0x4 +}; + +/****************************************************************************** + * + * StrmFileLoader + * + ******************************************************************************/ +class StrmFileLoader { +public: + explicit StrmFileLoader(ut::FileStream& rFileStream) + : mStream(rFileStream) {} + + bool LoadFileHeader(void* pStrmBin, u32 size); + bool ReadAdpcBlockData(u16* pYN1, u16* pYN2, int block, int channels); + + bool ReadStrmInfo(StrmInfo* pStrmInfo) const { + if (!mReader.IsAvailable()) { + return false; + } + + return mReader.ReadStrmInfo(pStrmInfo); + } + + bool ReadAdpcmInfo(AdpcmInfo* pAdpcmInfo, int channel) const { + if (!mReader.IsAvailable()) { + return false; + } + + return mReader.ReadAdpcmInfo(pAdpcmInfo, channel); + } + +private: + static const int HEADER_ALIGNED_SIZE = + ROUND_UP(sizeof(StrmFile::Header), 32); + +private: + ut::FileStream& mStream; // at 0x0 + StrmFileReader mReader; // at 0x4 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmPlayer.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmPlayer.h new file mode 100644 index 0000000000..bbde731182 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmPlayer.h @@ -0,0 +1,231 @@ +#ifndef NW4R_SND_STRM_PLAYER_H +#define NW4R_SND_STRM_PLAYER_H +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class StrmPlayer : public BasicPlayer, public SoundThread::PlayerCallback { + friend class StrmHeaderLoadTask; + friend class StrmDataLoadTask; + +public: + enum StartOffsetType { + START_OFFSET_TYPE_SAMPLE, + START_OFFSET_TYPE_MILLISEC + }; + + struct StrmHeader { + // TODO(kiwi) Why 8 if the player only supports 2??? + static const int STRM_CHANNEL_MAX = 8; + + StrmInfo strmInfo; // at 0x0 + AdpcmInfo adpcmInfo[STRM_CHANNEL_MAX]; // at 0x38 + u16 loopYn1[STRM_CHANNEL_MAX]; // at 0x1B8 + u16 loopYn2[STRM_CHANNEL_MAX]; // at 0x1D8 + }; + +public: + StrmPlayer(); + virtual ~StrmPlayer(); // at 0x8 + + virtual bool Start(); // at 0xC + virtual void Stop(); // at 0x10 + virtual void Pause(bool flag); // at 0x14 + + virtual bool IsActive() const { + return mActiveFlag; + } // at 0x18 + virtual bool IsStarted() const { + return mStartedFlag; + } // at 0x1C + virtual bool IsPause() const { + return mPauseFlag; + }; // at 0x20 + + virtual void OnUpdateFrameSoundThread() { + Update(); + } // at 0xC + virtual void OnUpdateVoiceSoundThread() { + UpdateBuffer(); + } // at 0x10 + virtual void OnShutdownSoundThread() { + Stop(); + } // at 0x14 + + bool IsPrepared() const { + return mPreparedFlag; + } + + void SetTaskErrorFlag() { + mTaskErrorFlag = true; + } + void SetTaskCancelFlag() { + mTaskCancelFlag = true; + } + + bool Setup(StrmBufferPool* pBufferPool); + void Shutdown(); + + bool Prepare(ut::FileStream* pFileStream, int voices, + StartOffsetType offsetType, int offset); + void InitParam(); + + void Update(); + +private: + /****************************************************************************** + * StrmHeaderLoadTask + ******************************************************************************/ + struct StrmHeaderLoadTask : public Task { + StrmHeaderLoadTask(); + + virtual void Execute(); // at 0xC + virtual void Cancel(); // at 0x10 + virtual void OnCancel(); // at 0x14 + + StrmPlayer* strmPlayer; // at 0x10 + ut::FileStream* fileStream; // at 0x14 + StartOffsetType startOffsetType; // at 0x18 + s32 startOffset; // at 0x1C + }; + + /****************************************************************************** + * StrmDataLoadTask + ******************************************************************************/ + struct StrmDataLoadTask : public Task { + StrmDataLoadTask(); + + virtual void Execute(); // at 0xC + virtual void Cancel(); // at 0x10 + virtual void OnCancel(); // at 0x14 + + StrmPlayer* strmPlayer; // at 0x10 + ut::FileStream* fileStream; // at 0x14 + u32 size; // at 0x18 + s32 offset; // at 0x1C + u32 blockSize; // at 0x20 + s32 bufferBlockIndex; // at 0x24 + bool needUpdateAdpcmLoop; // at 0x28 + + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x2C + }; + + NW4R_UT_LINKLIST_TYPEDEF_DECL(StrmDataLoadTask); + + static const int DATA_BLOCK_COUNT_MIN = 4; + static const int DATA_BLOCK_COUNT_MAX = 32; + static const int DATA_BLOCK_SIZE_MAX = 0x2000; + + // TODO(kiwi) How is this calculated? + static const int LOAD_BUFFER_SIZE = 0x4000 + 32; + +private: + bool LoadHeader(ut::FileStream* pFileStream, StartOffsetType offsetType, + int offset); + bool LoadStreamData(ut::FileStream* pFileStream, int offset, u32 size, + u32 blockSize, int blockIndex, + bool needUpdateAdpcmLoop); + + bool SetupPlayer(const StrmHeader* pStrmHeader); + + bool AllocChannels(int channels, int voices); + void FreeChannels(); + + void UpdateBuffer(); + void UpdateLoopAddress(u32 startSample, u32 endSample); + void UpdatePlayingBlockIndex(); + void UpdateDataLoopAddress(s32 endBlock); + void SetLoopEndToZeroBuffer(int endBlock); + void UpdateLoadingBlockIndex(); + void UpdatePauseStatus(); + + int CalcLoadingBufferBlockCount() const; + bool CalcStartOffset(s32* pBlockIndex, u32* pBlockOffset, s32* pLoopCount); + + static void VoiceCallbackFunc(Voice* pDropVoice, + Voice::VoiceCallbackStatus status, + void* pCallbackArg); + + void SetAdpcmLoopContext(int channels, u16* pPredScale); + +private: + StrmInfo mStrmInfo; // at 0x80 + + bool mSetupFlag; // at 0xB8 + bool mActiveFlag; // at 0xB9 + bool mStartedFlag; // at 0xBA + bool mPreparedFlag; // at 0xBB + bool mTaskErrorFlag; // at 0xBC + bool mTaskCancelFlag; // at 0xBD + bool mLoadingDelayFlag; // at 0xBE + bool mPauseFlag; // at 0xBF + bool mPauseStatus; // at 0xC0 + bool mLoadWaitFlag; // at 0xC1 + bool mNoRealtimeLoadFlag; // at 0xC2 + bool mSkipUpdateAdpcmLoop; // at 0xC3 + bool mValidAdpcmLoop; // at 0xC4 + bool mPlayFinishFlag; // at 0xC5 + bool mLoadFinishFlag; // at 0xC6 + + s32 mLoopCounter; // at 0xC8 + int mPrepareCounter; // at 0xCC + + int mChangeNumBlocks; // at 0xD0 + int mDataBlockSize; // at 0xD4 + int mBufferBlockCount; // at 0xD8 + int mBufferBlockCountBase; // at 0xDC + + int mLoadingBufferBlockCount; // at 0xE0 + int mLoadingBufferBlockIndex; // at 0xE4 + int mLoadingDataBlockIndex; // at 0xE8 + + int mPlayingBufferBlockCount; // at 0xEC + int mPlayingBufferBlockIndex; // at 0xF0 + int mPlayingDataBlockIndex; // at 0xF4 + int mLoopStartBlockIndex; // at 0xF8 + int mLastBlockIndex; // at 0xFC + + StartOffsetType mStartOffsetType; // at 0x100 + int mStartOffset; // at 0x104 + + StrmHeaderLoadTask mStrmHeaderLoadTask; // at 0x108 + StrmDataLoadTaskList mStrmDataLoadTaskList; // at 0x128 + InstancePool mStrmDataLoadTaskPool; // at 0x134 + StrmDataLoadTask mStrmDataLoadTaskArea[DATA_BLOCK_COUNT_MAX]; // at 0x138 + + StrmBufferPool* mBufferPool; // at 0x7B8 + ut::FileStream* mFileStream; // at 0x7BC + Voice* mVoice; // at 0x7C0 + s32 mChannelCount; // at 0x7C4 + s32 mVoiceOutCount; // at 0x7C8 + + StrmChannel mChannels[CHANNEL_MAX]; // at 0x7CC + u16 mAdpcmLoopPredScale[CHANNEL_MAX]; // at 0x83C + u16 mAdpcmLoopYn1[CHANNEL_MAX]; // at 0x840 + u16 mAdpcmLoopYn2[CHANNEL_MAX]; // at 0x844 + + static u8 sLoadBuffer[LOAD_BUFFER_SIZE] ALIGN(32); + static OSMutex sLoadBufferMutex; + + static bool sStaticInitFlag; +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmSound.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmSound.h new file mode 100644 index 0000000000..b52ad00032 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_StrmSound.h @@ -0,0 +1,73 @@ +#ifndef NW4R_SND_STRM_SOUND_H +#define NW4R_SND_STRM_SOUND_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class StrmSoundHandle; + +namespace detail { +template class SoundInstanceManager; +class StrmBufferPool; +} // namespace detail + +namespace detail { + +class StrmSound : public BasicSound { + friend class nw4r::snd::StrmSoundHandle; + +public: + NW4R_UT_RTTI_DECL(StrmSound); + +public: + explicit StrmSound(SoundInstanceManager* pManager); + + virtual void Shutdown(); // at 0x28 + virtual bool IsPrepared() const { + return mStrmPlayer.IsPrepared(); + } // at 0x2C + + virtual void SetPlayerPriority(int priority); // at 0x4C + virtual bool IsAttachedTempSpecialHandle(); // at 0x5C + virtual void DetachTempSpecialHandle(); // at 0x60 + + virtual BasicPlayer& GetBasicPlayer() { + return mStrmPlayer; + } // at 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { + return mStrmPlayer; + } // at 0x6C + + bool Prepare(StrmBufferPool* pPool, StrmPlayer::StartOffsetType offsetType, + s32 offset, int voices, ut::FileStream* pStream); + + void* GetFileStreamBuffer() { + return mFileStreamBuffer; + } + s32 GetFileStreamBufferSize() { + return sizeof(mFileStreamBuffer); + } + +private: + static const int FILE_STREAM_BUFFER_SIZE = 512; + +private: + StrmPlayer mStrmPlayer; // at 0xD8 + StrmSoundHandle* mTempSpecialHandle; // at 0x920 + SoundInstanceManager* mManager; // at 0x924 + char UNK_0x928[0x93C - 0x928]; + char mFileStreamBuffer[FILE_STREAM_BUFFER_SIZE]; // at 0x93C +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Task.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Task.h new file mode 100644 index 0000000000..a142919340 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Task.h @@ -0,0 +1,35 @@ +#ifndef NW4R_SND_TASK_H +#define NW4R_SND_TASK_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class Task : private ut::NonCopyable { + friend class TaskManager; + +public: + Task() : mBusyFlag(false) {} + virtual ~Task(); // at 0x8 + + virtual void Execute() = 0; // at 0xC + virtual void Cancel() = 0; // at 0x10 + virtual void OnCancel() = 0; // at 0x14 + +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x4 + +private: + bool mBusyFlag; // at 0xC +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(Task); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Types.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Types.h new file mode 100644 index 0000000000..8f3c67e24f --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Types.h @@ -0,0 +1,86 @@ +#ifndef NW4R_SND_TYPES_H +#define NW4R_SND_TYPES_H +#include + +namespace nw4r { +namespace snd { + +static const int CHANNEL_MIN = 1; +static const int CHANNEL_MAX = 2; + +static const int REMOTE_FILTER_MAX = 127; + +// Volume in range [-90.4db, 6.0db] +static const f32 VOLUME_MIN_DB = -90.4f; +static const f32 VOLUME_MAX_DB = 6.0f; +static const f32 VOLUME_RANGE_DB = -(VOLUME_MIN_DB - VOLUME_MAX_DB); +static const int VOLUME_RANGE_MB = static_cast(10 * VOLUME_RANGE_DB); + +enum OutputLineFlag { + OUTPUT_LINE_MAIN = (1 << 0), + OUTPUT_LINE_REMOTE_N = (1 << 1), +}; + +enum AuxBus { AUX_A, AUX_B, AUX_C, AUX_BUS_NUM }; + +enum OutputMode { + OUTPUT_MODE_STEREO, + OUTPUT_MODE_SURROUND, + OUTPUT_MODE_DPL2, + OUTPUT_MODE_MONO +}; + +struct SoundParam { + f32 volume; // at 0x0 + f32 pitch; // at 0x4 + f32 pan; // at 0x8 + f32 surroundPan; // at 0xC + f32 fxSend; // at 0x10 + f32 lpf; // at 0x14 + int priority; // at 0x18 +}; + +namespace detail { + +enum PanMode { + PAN_MODE_DUAL, + PAN_MODE_BALANCE, +}; + +enum PanCurve { + PAN_CURVE_SQRT, + PAN_CURVE_SQRT_0DB, + PAN_CURVE_SQRT_0DB_CLAMP, + PAN_CURVE_SINCOS, + PAN_CURVE_SINCOS_0DB, + PAN_CURVE_SINCOS_0DB_CLAMP, + PAN_CURVE_LINEAR, + PAN_CURVE_LINEAR_0DB, + PAN_CURVE_LINEAR_0DB_CLAMP, +}; + +struct AdpcmParam { + u16 coef[16]; // at 0x0 + u16 gain; // at 0x20 + u16 pred_scale; // at 0x22 + u16 yn1; // at 0x24 + u16 yn2; // at 0x26 +}; + +struct AdpcmLoopParam { + u16 loop_pred_scale; // at 0x0 + u16 loop_yn1; // at 0x2 + u16 loop_yn2; // at 0x4 +}; + +struct AdpcmInfo { + AdpcmParam param; // at 0x0 + AdpcmLoopParam loopParam; // at 0x28 + u16 PADDING_0x2E; // at 0x2E +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Util.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Util.h new file mode 100644 index 0000000000..396e7b4fdc --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Util.h @@ -0,0 +1,191 @@ +#ifndef NW4R_SND_UTIL_H +#define NW4R_SND_UTIL_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +class Util { +public: + // 12 notes each with 256 microtones + static const int SEMITONE_MAX = 12; + static const int MICROTONE_MAX = 256; + + static const int VOLUME_MIN = + static_cast(10.0f * VOLUME_MIN_DB); // -90.4db + static const int VOLUME_MAX = + static_cast(10.0f * VOLUME_MAX_DB); // +6.0db + +public: + /****************************************************************************** + * + * Pan info + * + ******************************************************************************/ + enum PanCurve { + PAN_CURVE_SQRT, + PAN_CURVE_SINCOS, + PAN_CURVE_LINEAR, + }; + + struct PanInfo { + PanCurve curve; // at 0x0 + bool centerZero; // at 0x4 + bool zeroClamp; // at 0x5 + + PanInfo() + : curve(PAN_CURVE_SQRT), centerZero(false), zeroClamp(false) {} + }; + + /****************************************************************************** + * + * DataRef + * + ******************************************************************************/ + enum RefType { + REFTYPE_ADDRESS, + REFTYPE_OFFSET, + }; + + enum DataType { + DATATYPE_T0, + DATATYPE_T1, + DATATYPE_T2, + DATATYPE_T3, + DATATYPE_INVALID + }; + + template + struct DataRef { + u8 refType; // at 0x0 + u8 dataType; // at 0x1 + u16 reserved; // at 0x2 + u32 value; // at 0x4 + }; + + template + static inline T0* + GetDataRefAddress0(const DataRef& rRef, const void* pBase) { + return static_cast(GetDataRefAddressImpl( + static_cast(rRef.refType), rRef.value, pBase)); + } + + template + static inline T1* + GetDataRefAddress1(const DataRef& rRef, const void* pBase) { + return static_cast(GetDataRefAddressImpl( + static_cast(rRef.refType), rRef.value, pBase)); + } + + template + static inline T2* + GetDataRefAddress2(const DataRef& rRef, const void* pBase) { + return static_cast(GetDataRefAddressImpl( + static_cast(rRef.refType), rRef.value, pBase)); + } + + template + static inline T3* + GetDataRefAddress3(const DataRef& rRef, const void* pBase) { + return static_cast(GetDataRefAddressImpl( + static_cast(rRef.refType), rRef.value, pBase)); + } + + /****************************************************************************** + * + * Table + * + ******************************************************************************/ + template struct Table { + u32 count; // at 0x0 + T items[1]; // at 0x4 + }; + + /****************************************************************************** + * + * Read big endian value + * + ******************************************************************************/ +#if defined(NW4R_LITLE_ENDIAN) + static inline u16 ReadBigEndian(u16 x) { + return x >> 8 | x << 8; + } + + static inline u32 ReadBigEndian(u32 x) { + return (x >> 24) & 0x000000FF | (x >> 8) & 0x0000FF00 | + (x << 8) & 0x00FF0000 | (x << 24) & 0xFF000000; + } +#else + static inline u16 ReadBigEndian(u16 x) { + return x; + } + + static inline u32 ReadBigEndian(u32 x) { + return x; + } +#endif + + /****************************************************************************** + * + * Utility functions + * + ******************************************************************************/ + static f32 CalcPitchRatio(int pitch); + static f32 CalcVolumeRatio(f32 db); + static f32 CalcPanRatio(f32 pan, const PanInfo& rInfo); + static f32 CalcSurroundPanRatio(f32 pan, const PanInfo& rInfo); + static int CalcLpfFreq(f32 scale); + static void GetRemoteFilterCoefs(int filter, u16* pB0, u16* pB1, u16* pB2, + u16* pA1, u16* pA2); + static u16 CalcRandom(); + +private: + static void* GetDataRefAddressImpl(RefType type, u32 value, + const void* pBase); + +private: + // Chromatic scale (tbl[idx] / tbl[idx-1] == ~1.06) + static const f32 NoteTable[SEMITONE_MAX]; + // Each note contains 256 microtones + static const f32 PitchTable[MICROTONE_MAX]; + + // Table index is the millibel / hundredth-of-a-decibel + // dB(idx) = VOLUME_MIN_DB + (idx / 10) + // tbl[idx] = 10 ** (dB(idx) / 20) + static const int VOLUME_TABLE_SIZE = VOLUME_RANGE_MB + 1; + // NOLINTNEXTLINE (vla-cxx-extension) + static const f32 Decibel2RatioTable[VOLUME_TABLE_SIZE]; + + // 1/256 step + static const int PAN_TABLE_MIN = 0; + static const int PAN_TABLE_MAX = 256; + static const int PAN_TABLE_CENTER = PAN_TABLE_MAX / 2; + static const int PAN_TABLE_SIZE = PAN_TABLE_MAX + 1; + // tbl[idx] = sqrt(1 - (idx / PAN_TABLE_MAX)) + static const f32 Pan2RatioTableSqrt[PAN_TABLE_SIZE]; + // tbl[idx] = cos(idx * (PI / (2 * PAN_TABLE_MAX))) + static const f32 Pan2RatioTableSinCos[PAN_TABLE_SIZE]; + // tbl[idx] = 1 - (idx * (1 / PAN_TABLE_MAX)) + static const f32 Pan2RatioTableLinear[PAN_TABLE_SIZE]; + + // Pan curve tables + static const int PAN_CURVE_NUM = PAN_CURVE_LINEAR + 1; + static const f32* PanTableTable[PAN_CURVE_NUM]; + + // Biquad filter coefficients (b0, b1, b2, a1, a2) + static const int COEF_TABLE_MIN = 0; + static const int COEF_TABLE_MAX = REMOTE_FILTER_MAX; + static const int COEF_TABLE_SIZE = COEF_TABLE_MAX + 1; + static const int IIR_COEF_COUNT = 5; + static const u16 RemoteFilterCoefTable[COEF_TABLE_SIZE][IIR_COEF_COUNT]; +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Voice.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Voice.h new file mode 100644 index 0000000000..eacf710a79 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_Voice.h @@ -0,0 +1,194 @@ +#ifndef NW4R_SND_VOICE_H +#define NW4R_SND_VOICE_H +#include + +#include +#include +#include + +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +class WaveData; + +class Voice : public DisposeCallback { + friend class VoiceManager; + +public: + enum VoiceCallbackStatus { + CALLBACK_STATUS_FINISH_WAVE, + CALLBACK_STATUS_CANCEL, + CALLBACK_STATUS_DROP_VOICE, + CALLBACK_STATUS_DROP_DSP, + }; + + typedef void (*VoiceCallback)(Voice* pDropVoice, VoiceCallbackStatus status, + void* pCallbackArg); + + enum VoiceSyncFlag { + SYNC_AX_SRC_INITIAL = (1 << 0), + SYNC_AX_VOICE = (1 << 1), + SYNC_AX_SRC = (1 << 2), + SYNC_AX_VE = (1 << 3), + SYNC_AX_MIX = (1 << 4), + SYNC_AX_LPF = (1 << 5), + SYNC_AX_REMOTE = (1 << 7), + SYNC_AX_BIQUAD = (1 << 8), + }; + + static const int PRIORITY_MAX = 255; + +public: + Voice(); + virtual ~Voice(); // at 0x8 + + virtual void InvalidateData(const void* /* pStart */, + const void* /* pEnd */) {} // at 0xC + + virtual void InvalidateWaveData(const void* pStart, + const void* pEnd); // at 0x10 + + int GetPriority() const { + return mPriority; + } + int GetAxVoiceCount() const { + return mChannelCount * mVoiceOutCount; + } + + bool IsActive() const { + return mAxVoice[0][0] != NULL; + } + bool IsPlayFinished() const { + return IsActive() && mAxVoice[0][0]->IsPlayFinished(); + } + + void InitParam(int channels, int voices, VoiceCallback pCallback, + void* pCallbackArg); + void StopFinished(); + + void Calc(); + void Update(); + + bool Acquire(int channels, int voices, int priority, + VoiceCallback pCallback, void* pCallbackArg); + void Free(); + + void Setup(const WaveData& rData, u32 offset); + + void Start(); + void Stop(); + void Pause(bool flag); + + AxVoice::Format GetFormat() const; + + void SetVolume(f32 volume); + void SetVeVolume(f32 target, f32 init); + void SetPitch(f32 pitch); + + void SetPanMode(PanMode mode); + void SetPanCurve(PanCurve curve); + void SetPan(f32 pan); + void SetSurroundPan(f32 pan); + + void SetLpfFreq(f32 freq); + void SetRemoteFilter(int filter); + void SetOutputLine(int flag); + + void SetMainOutVolume(f32 volume); + void SetMainSend(f32 send); + void SetFxSend(AuxBus bus, f32 send); + + void SetRemoteOutVolume(int remote, f32 volume); + void SetRemoteSend(int remote, f32 send); + void SetRemoteFxSend(int remote, f32 send); + + void SetPriority(int priority); + void UpdateVoicesPriority(); + + void SetAdpcmLoop(int channel, const AdpcmLoopParam* pParam); + u32 GetCurrentPlayingSample() const; + void SetLoopStart(int channel, const void* pBase, u32 samples); + void SetLoopEnd(int channel, const void* pBase, u32 samples); + void SetLoopFlag(bool loop); + void StopAtPoint(int channel, const void* pBase, u32 samples); + void SetVoiceType(AxVoice::VoiceType type); + + void CalcAxSrc(bool initial); + void CalcAxVe(); + bool CalcAxMix(); + void CalcAxLpf(); + void CalcAxRemoteFilter(); + +private: + static const int VOICES_MIN = 1; + static const int VOICES_MAX = 4; + +private: + void SyncAxVoice(); + void ResetDelta(); + + static void AxVoiceCallbackFunc(AxVoice* pVoice, + AxVoice::AxVoiceCallbackStatus status, + void* pCallbackArg); + + void TransformDpl2Pan(f32* pPan, f32* pSurroundPan, f32 pan, + f32 surroundPan); + void CalcMixParam(int channel, int voice, AxVoice::MixParam* pMix, + AxVoice::RemoteMixParam* pRmtMix); + + void RunAllAxVoice(); + void StopAllAxVoice(); + +private: + AxVoice* mAxVoice[CHANNEL_MAX][VOICES_MAX]; // at 0xC + SoundParam mVoiceOutParam[VOICES_MAX]; // at 0x2C + int mChannelCount; // at 0x9C + int mVoiceOutCount; // at 0xA0 + + VoiceCallback mCallback; // at 0xA4 + void* mCallbackArg; // at 0xA8 + + bool mIsActive; // at 0xAC + bool mIsStarting; // at 0xAD + bool mIsStarted; // at 0xAE + bool mIsPause; // at 0xAF + bool mIsPausing; // at 0xB0 + + u8 mSyncFlag; // at 0xB1 + u8 mRemoteFilter; // at 0xB2 + u8 mBiquadType; // at 0xB3 + int mPriority; // at 0xB4 + f32 mPan; // at 0xB8 + f32 mSurroundPan; // at 0xBC + f32 mLpfFreq; // at 0xC0 + int mOutputLineFlag; // at 0xC4 + f32 mMainOutVolume; // at 0xC8 + f32 mMainSend; // at 0xCC + f32 mFxSend[AUX_BUS_NUM]; // at 0xD0 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // at 0xDC + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // at 0xEC + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // at 0xFC + f32 mPitch; // at 0x10C + f32 mVolume; // at 0x110 + f32 mVeInitVolume; // at 0x114 + f32 mVeTargetVolume; // at 0x118 + PanMode mPanMode; // at 0x11C + PanCurve mPanCurve; // at 0x120 + +public: + NW4R_UT_LINKLIST_NODE_DECL(); // at 0x124 +}; + +NW4R_UT_LINKLIST_TYPEDEF_DECL(Voice); + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveFile.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveFile.h new file mode 100644 index 0000000000..3d8064b545 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveFile.h @@ -0,0 +1,101 @@ +#ifndef NW4R_SND_WAVE_FILE_H +#define NW4R_SND_WAVE_FILE_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +/****************************************************************************** + * + * RWAV binary layout + * + ******************************************************************************/ +namespace WaveFile { + +enum Format { FORMAT_PCM8, FORMAT_PCM16, FORMAT_ADPCM }; + +struct WaveInfo { + u8 format; // at 0x0 + u8 loopFlag; // at 0x1 + u8 numChannels; // at 0x2 + u8 sampleRate24; // at 0x3 + u16 sampleRate; // at 0x4 + u16 PADDING_0x6; // at 0x6 + u32 loopStart; // at 0x8 + u32 loopEnd; // at 0xC + u32 channelInfoTableOffset; // at 0x10 + u32 dataOffset; // at 0x14 + u32 reserved; // at 0x18 +}; + +struct WaveChannelInfo { + u32 channelDataOffset; // at 0x0 + u32 adpcmOffset; // at 0x4 + u32 volumeFrontLeft; // at 0x8 + u32 volumeFrontRight; // at 0xC + u32 volumeRearLeft; // at 0x10 + u32 volumeRearRight; // at 0x14 + u32 reserved; // at 0x18 +}; + +}; // namespace WaveFile + +/****************************************************************************** + * + * WaveFileReader + * + ******************************************************************************/ +struct ChannelParam { + void* dataAddr; // at 0x0 + u32 volumeFrontLeft; // at 0x4 + u32 volumeFrontRight; // at 0x8 + u32 volumeRearLeft; // at 0xC + u32 volumeRearRight; // at 0x10 + AdpcmInfo adpcmInfo; // at 0x14 +}; + +struct WaveData { + u8 sampleFormat; // at 0x0 + u8 loopFlag; // at 0x1 + u8 numChannels; // at 0x2 + u32 sampleRate; // at 0x4 + u32 loopStart; // at 0x8 + u32 loopEnd; // at 0xC + ChannelParam channelParam[CHANNEL_MAX]; // at 0x10 +}; + +class WaveFileReader { +public: + explicit WaveFileReader(const WaveFile::WaveInfo* pWaveInfo); + + bool ReadWaveParam(WaveData* pWaveData, const void* pWaveAddr) const; + + static AxVoice::Format GetAxVoiceFormatFromWaveFileFormat(u32 format); + +private: + const WaveFile::WaveInfo* mWaveInfo; // at 0x0 +}; + +inline AxVoice::Format WaveFormatToAxFormat(u32 format) { + if (format == WaveFile::FORMAT_PCM16) { + return AxVoice::FORMAT_PCM16; + } + + if (format == WaveFile::FORMAT_PCM8) { + return AxVoice::FORMAT_PCM8; + } + + return AxVoice::FORMAT_ADPCM; +} + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveSound.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveSound.h new file mode 100644 index 0000000000..0c24e939f4 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WaveSound.h @@ -0,0 +1,66 @@ +#ifndef NW4R_SND_WAVE_SOUND_H +#define NW4R_SND_WAVE_SOUND_H +#include + +#include +#include + +#include + +namespace nw4r { +namespace snd { + +// Forward declarations +class WaveSoundHandle; + +namespace detail { +template class SoundInstanceManager; +} // namespace detail + +namespace detail { + +class WaveSound : public BasicSound { + friend class nw4r::snd::WaveSoundHandle; + +public: + NW4R_UT_RTTI_DECL(WaveSound); + +public: + explicit WaveSound(SoundInstanceManager* pManager); + + virtual void Shutdown(); // at 0x28 + virtual bool IsPrepared() const { + return mPreparedFlag; + } // at 0x2C + + virtual void SetPlayerPriority(int priority); // at 0x4C + virtual bool IsAttachedTempSpecialHandle(); // at 0x5C + virtual void DetachTempSpecialHandle(); // at 0x60 + + virtual BasicPlayer& GetBasicPlayer() { + return mWsdPlayer; + } // at 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { + return mWsdPlayer; + } // at 0x6C + + bool Prepare(const void* pWsdData, s32 wsdOffset, + WsdPlayer::StartOffsetType startType, s32 startOffset, + int voices, const WsdPlayer::WsdCallback* pCallback, + u32 callbackArg); + + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); + +private: + WsdPlayer mWsdPlayer; // at 0xD8 + WaveSoundHandle* mTempSpecialHandle; // at 0x1B0 + SoundInstanceManager* mManager; // at 0x1B4 + bool mPreparedFlag; // at 0x1B8 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdFile.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdFile.h new file mode 100644 index 0000000000..44bd6c8239 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdFile.h @@ -0,0 +1,147 @@ +#ifndef NW4R_SND_WSD_FILE_H +#define NW4R_SND_WSD_FILE_H +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +struct WaveData; + +/****************************************************************************** + * + * RWSD binary layout + * + ******************************************************************************/ +namespace WsdFile { + +struct WsdInfo { + f32 pitch; // at 0x0 + u8 pan; // at 0x4 + u8 surroundPan; // at 0x5 + u8 fxSendA; // at 0x6 + u8 fxSendB; // at 0x7 + u8 fxSendC; // at 0x8 + u8 mainSend; // at 0x9 + Util::DataRef graphEnvTableRef; // at 0xC + Util::DataRef randomizerTableRef; // at 0x14 + u32 reserved; // at 0x1C +}; + +struct TrackInfo {}; + +struct NoteInfo { + s32 waveIndex; // at 0x0 + u8 attack; // at 0x4 + u8 decay; // at 0x5 + u8 sustain; // at 0x6 + u8 release; // at 0x7 + u16 hold; // at 0x8 + u16 PADDING_0xA; // at 0xA + u8 originalKey; // at 0xC + u8 volume; // at 0xD + u8 pan; // at 0xE + u8 surroundPan; // at 0xF + f32 pitch; // at 0x10 + Util::DataRef lfoTableRef; // at 0x14 + Util::DataRef graphEnvTablevRef; // at 0x1C + Util::DataRef randomizerTableRef; // at 0x24 + u32 reserved; // at 0x2C +}; + +typedef Util::Table > TrackTable; + +typedef Util::Table > NoteTable; + +struct Wsd { + Util::DataRef refWsdInfo; // at 0x0 + Util::DataRef refTrackTable; // at 0x8 + Util::DataRef refNoteTable; // at 0x10 +}; + +struct Header { + ut::BinaryFileHeader fileHeader; // at 0x0 + u32 dataBlockOffset; // at 0x10 + u32 dataBlockSize; // at 0x14 + u32 waveBlockOffset; // at 0x18 + u32 waveBlockSize; // at 0x1C +}; + +struct DataBlock { + ut::BinaryBlockHeader blockHeader; // at 0x0 + u32 wsdCount; // at 0x8 + Util::DataRef refWsd[]; // at 0xC +}; + +struct WaveBlock { + ut::BinaryBlockHeader blockHeader; // at 0x0 + u32 waveCount; // at 0x8 + u32 offsetTable[]; // at 0xC +}; + +// <= NW4R_VERSION(1, 0) +struct WaveBlockOld { + ut::BinaryBlockHeader blockHeader; // at 0x0 + u32 offsetTable[]; // at 0x8 +}; + +}; // namespace WsdFile + +/****************************************************************************** + * + * WsdFileReader + * + ******************************************************************************/ +struct WaveSoundInfo { + f32 pitch; // at 0x0 + u8 pan; // at 0x4 + u8 surroundPan; // at 0x5 + u8 fxSendA; // at 0x6 + u8 fxSendB; // at 0x7 + u8 fxSendC; // at 0x8 + u8 mainSend; // at 0x9 +}; + +struct WaveSoundNoteInfo { + s32 waveIndex; // at 0x0 + u8 attack; // at 0x4 + u8 decay; // at 0x6 + u8 sustain; // at 0x7 + u8 release; // at 0x8 + u8 originalKey; // at 0x9 + u8 pan; // at 0xA + u8 surroundPan; // at 0xB + u8 volume; // at 0xC + f32 pitch; // at 0x10 +}; + +class WsdFileReader { +public: + static const u32 SIGNATURE = FOURCC('R', 'W', 'S', 'D'); + static const int VERSION = NW4R_VERSION(1, 2); + +public: + explicit WsdFileReader(const void* pWsdBin); + + bool IsValidFileHeader(const void* pWsdBin); + + bool ReadWaveSoundInfo(WaveSoundInfo* pSoundInfo, int id) const; + bool ReadWaveSoundNoteInfo(WaveSoundNoteInfo* pSoundNoteInfo, int id, + int note) const; + bool ReadWaveParam(int id, WaveData* pWaveData, + const void* pWaveAddr) const; + +private: + const WsdFile::Header* mHeader; // at 0x0 + const WsdFile::DataBlock* mDataBlock; // at 0x4 + const WsdFile::WaveBlock* mWaveBlock; // at 0x8 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdPlayer.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdPlayer.h new file mode 100644 index 0000000000..51ca7a4f1f --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/snd/snd_WsdPlayer.h @@ -0,0 +1,147 @@ +#ifndef NW4R_SND_WSD_PLAYER_H +#define NW4R_SND_WSD_PLAYER_H +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace nw4r { +namespace snd { +namespace detail { + +// Forward declarations +struct WaveData; + +class WsdPlayer : public BasicPlayer, + public DisposeCallback, + public SoundThread::PlayerCallback { +public: + class WsdCallback { + public: + virtual ~WsdCallback() {} // at 0x8 + + virtual bool GetWaveSoundData(WaveSoundInfo* pSoundInfo, + WaveSoundNoteInfo* pNoteInfo, + WaveData* pWaveData, const void* pWsdData, + int index, int noteIndex, + u32 callbackArg) const = 0; // at 0xC + }; + + enum StartOffsetType { + START_OFFSET_TYPE_SAMPLE, + START_OFFSET_TYPE_MILLISEC + }; + +public: + WsdPlayer(); + + virtual bool Start(); // at 0xC + virtual void Stop(); // at 0x10 + virtual void Pause(bool flag); // at 0x14 + + virtual bool IsActive() const { + return mActiveFlag != 0; + } // at 0x18 + + virtual bool IsStarted() const { + return mStartedFlag != 0; + } // at 0x1C + + virtual bool IsPause() const { + return mPauseFlag != 0; + } // at 0x20 + + virtual void InvalidateData(const void* pStart, + const void* pEnd); // at 0x50 + + virtual void InvalidateWaveData(const void* /* pStart */, + const void* /* pEnd */) {} // at 0x54 + + virtual void OnUpdateFrameSoundThread() { + Update(); + } // at 0x58 + + virtual void OnShutdownSoundThread() { + Stop(); + } // at 0x60 + + void InitParam(int voices, const WsdCallback* pCallback, u32 callbackArg); + + bool Prepare(const void* pWsdData, int index, StartOffsetType startType, + int startOffset, int voices, const WsdCallback* pCallback, + u32 callbackArg); + + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); + + f32 GetPanRange() const { + return mPanRange; + } + + int GetVoiceOutCount() const { + return mVoiceOutCount; + } + + int GetChannelPriority() const { + return mPriority; + } + + const void* GetWsdDataAddress() const { + return mWsdData; + } + + bool IsChannelActive() const { + return mChannel != NULL && mChannel->IsActive(); + } + +private: + static const int DEFAULT_PRIORITY = 64; + +private: + void FinishPlayer(); + void Update(); + + bool StartChannel(const WsdCallback* pCallback, u32 callbackArg); + void CloseChannel(); + void UpdateChannel(); + + static void ChannelCallbackFunc(Channel* pDropChannel, + Channel::ChannelCallbackStatus status, + u32 callbackArg); + +private: + bool mActiveFlag; // at 0x8C + bool mStartedFlag; // at 0x8D + bool mPauseFlag; // at 0x8E + bool mWavePlayFlag; // at 0x8F + bool mReleasePriorityFixFlag; // at 0x90 + + f32 mPanRange; // at 0x94 + int mVoiceOutCount; // at 0x98 + u8 mPriority; // at 0x9C + + const WsdCallback* mCallback; // at 0xA0 + u32 mCallbackData; // at 0xA4 + + const void* mWsdData; // at 0xA8 + int mWsdIndex; // at 0xAC + + StartOffsetType mStartOffsetType; // at 0xB0 + int mStartOffset; // at 0xB4 + + LfoParam mLfoParam; // at 0xB8 + WaveSoundInfo mWaveSoundInfo; // at 0xC8 + Channel* mChannel; // at 0xD4 +}; + +} // namespace detail +} // namespace snd +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/types_nw4r.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/types_nw4r.h new file mode 100644 index 0000000000..47fe82b782 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/types_nw4r.h @@ -0,0 +1,21 @@ +#ifndef NW4R_TYPES_H +#define NW4R_TYPES_H +#include + +#define NW4R_BYTEORDER_BIG 0xFEFF +#define NW4R_BYTEORDER_LITTLE 0xFFFE + +#ifdef NW4R_LITTLE_ENDIAN +#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_LITTLE +#else +#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_BIG +#endif + +#define NW4R_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) + +#define NW4R_LIB_VERSION(NAME, ORIGINAL_DATE, ORIGINAL_TIME, ORIGINAL_CWCC) \ + const char* NW4R_##NAME##_Version_ = \ + "<< NW4R - " #NAME " \tfinal build: " ORIGINAL_DATE \ + " " ORIGINAL_TIME " (" ORIGINAL_CWCC ") >>" + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut.h new file mode 100644 index 0000000000..a06875d986 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut.h @@ -0,0 +1,32 @@ +#ifndef NW4R_PUBLIC_UT_H +#define NW4R_PUBLIC_UT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharStrmReader.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharStrmReader.h new file mode 100644 index 0000000000..a6da865461 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharStrmReader.h @@ -0,0 +1,55 @@ +#ifndef NW4R_UT_CHAR_STRM_READER_H +#define NW4R_UT_CHAR_STRM_READER_H +#include + +namespace nw4r { +namespace ut { + +class CharStrmReader { +public: + typedef u16 (CharStrmReader::*ReadFunc)(); + +public: + explicit CharStrmReader(ReadFunc pFunc) + : mCharStrm(NULL), mReadFunc(pFunc) {} + + ~CharStrmReader() {} + + u16 ReadNextCharUTF8(); + u16 ReadNextCharUTF16(); + u16 ReadNextCharCP1252(); + u16 ReadNextCharSJIS(); + + u16 Next() { + return (this->*mReadFunc)(); + } + + const void* GetCurrentPos() const { + return mCharStrm; + } + + void Set(const char* pStrm) { + mCharStrm = pStrm; + } + void Set(const wchar_t* pStrm) { + mCharStrm = pStrm; + } + +private: + template T GetChar(int offset) const { + return static_cast(mCharStrm)[offset]; + } + + template void StepStrm(int offset) { + static_cast(mCharStrm) += offset; + } + +private: + const void* mCharStrm; // at 0x0 + ReadFunc mReadFunc; // at 0x4 +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharWriter.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharWriter.h new file mode 100644 index 0000000000..6e35075350 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_CharWriter.h @@ -0,0 +1,221 @@ +#ifndef NW4R_UT_CHAR_WRITER_H +#define NW4R_UT_CHAR_WRITER_H +#include + +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +// Forward declarations +class Font; +struct Glyph; + +class CharWriter { +public: + enum GradationMode { + GRADMODE_NONE, + GRADMODE_H, + GRADMODE_V, + + GRADMODE_MAX + }; + +public: + CharWriter(); + ~CharWriter(); + + void SetupGX(); + void EnableLinearFilter(bool atSmall, bool atLarge); + f32 Print(u16 ch); + + void SetColorMapping(Color min, Color max) { + mColorMapping.min = min; + mColorMapping.max = max; + } + + void ResetColorMapping() { + SetColorMapping(DEFAULT_COLOR_MAPPING_MIN, DEFAULT_COLOR_MAPPING_MAX); + } + + void SetTextColor(Color start) { + mTextColor.start = start; + UpdateVertexColor(); + } + + void SetTextColor(Color start, Color end) { + mTextColor.start = start; + mTextColor.end = end; + UpdateVertexColor(); + } + + void SetGradationMode(GradationMode mode) { + mTextColor.gradationMode = mode; + UpdateVertexColor(); + } + + f32 GetScaleH() const { + return mScale.x; + } + f32 GetScaleV() const { + return mScale.y; + } + + void SetScale(f32 x, f32 y) { + mScale.x = x; + mScale.y = y; + } + + f32 GetCursorX() const { + return mCursorPos.x; + } + void SetCursorX(f32 x) { + mCursorPos.x = x; + } + + f32 GetCursorY() const { + return mCursorPos.y; + } + void SetCursorY(f32 y) { + mCursorPos.y = y; + } + + void SetCursor(f32 x, f32 y) { + mCursorPos.x = x; + mCursorPos.y = y; + } + void SetCursor(f32 x, f32 y, f32 z) { + mCursorPos.x = x; + mCursorPos.y = y; + mCursorPos.z = z; + } + + void MoveCursorX(f32 dx) { + mCursorPos.x += dx; + } + void MoveCursorY(f32 dy) { + mCursorPos.y += dy; + } + + void SetAlpha(u8 alpha) { + mAlpha = alpha; + UpdateVertexColor(); + } + u8 GetAlpha() const { + return mAlpha; + } + + void EnableFixedWidth(bool enable) { + mIsWidthFixed = enable; + } + bool IsWidthFixed() const { + return mIsWidthFixed; + } + + void SetFixedWidth(f32 width) { + mFixedWidth = width; + } + f32 GetFixedWidth() const { + return mFixedWidth; + } + + void SetFont(const Font& rFont) { + mFont = &rFont; + } + const Font* GetFont() const { + return mFont; + } + + void SetFontSize(f32 width, f32 height); + + f32 GetFontWidth() const; + f32 GetFontHeight() const; + f32 GetFontAscent() const; + f32 GetFontDescent() const; + +private: + struct ColorMapping { + Color min; // at 0x0 + Color max; // at 0x4 + }; + + struct VertexColor { + Color lu; // at 0x0 + Color ru; // at 0x4 + Color ld; // at 0x8 + Color rd; // at 0xC + }; + + struct TextColor { + Color start; // at 0x0 + Color end; // at 0x4 + GradationMode gradationMode; // at 0x8 + }; + + struct TextureFilter { + GXTexFilter atSmall; // at 0x0 + GXTexFilter atLarge; // at 0x4 + + bool operator!=(const TextureFilter& rOther) const { + return atSmall != rOther.atSmall || atLarge != rOther.atLarge; + } + }; + + struct LoadingTexture { + GXTexMapID slot; // at 0x0 + void* texture; // at 0x4 + TextureFilter filter; // at 0x8 + + bool operator!=(const LoadingTexture& rOther) const { + return slot != rOther.slot || texture != rOther.texture || + filter != rOther.filter; + } + + void Reset() { + slot = GX_TEXMAP_NULL; + texture = NULL; + } + }; + + static const u32 DEFAULT_COLOR_MAPPING_MIN = 0x00000000; + static const u32 DEFAULT_COLOR_MAPPING_MAX = 0xFFFFFFFF; + +private: + static void SetupVertexFormat(); + static void SetupGXDefault(); + static void SetupGXWithColorMapping(Color min, Color max); + static void SetupGXForI(); + static void SetupGXForRGBA(); + + void UpdateVertexColor(); + void PrintGlyph(f32 x, f32 y, f32 z, const Glyph& rGlyph); + + void LoadTexture(const Glyph& rGlyph, GXTexMapID slot); + void ResetTextureCache() { + mLoadingTexture.Reset(); + } + +private: + ColorMapping mColorMapping; // at 0x0 + VertexColor mVertexColor; // at 0x8 + TextColor mTextColor; // at 0x18 + math::VEC2 mScale; // at 0x24 + math::VEC3 mCursorPos; // at 0x2C + TextureFilter mFilter; // at 0x38 + u8 PADDING_0x40[0x42 - 0x40]; // at 0x40 + u8 mAlpha; // at 0x42 + bool mIsWidthFixed; // at 0x43 + f32 mFixedWidth; // at 0x44 + const Font* mFont; // at 0x48 + + static LoadingTexture mLoadingTexture; +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Color.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Color.h new file mode 100644 index 0000000000..7c598e82d1 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Color.h @@ -0,0 +1,86 @@ +#ifndef NW4R_UT_COLOR_H +#define NW4R_UT_COLOR_H +#include + +#include + +namespace nw4r { +namespace ut { + +struct Color : public GXColor { +public: + Color() { + *this = WHITE; + } + Color(u32 color) { + *this = color; + } + Color(int red, int green, int blue, int alpha) { + Set(red, green, blue, alpha); + } + Color(const GXColor& rColor) { + *this = rColor; + } + + ~Color() {} + + void Set(int red, int green, int blue, int alpha) { + r = red; + g = green; + b = blue; + a = alpha; + } + + Color& operator=(u32 color) { + ToU32ref() = color; + return *this; + } + Color& operator=(const GXColor& rColor) { + *this = *reinterpret_cast(&rColor); + return *this; + } + + Color operator|(u32 color) const { + return Color(ToU32() | color); + } + Color operator&(u32 color) const { + return Color(ToU32() & color); + } + + u32& ToU32ref() { + return *reinterpret_cast(this); + } + const u32& ToU32ref() const { + return *reinterpret_cast(this); + } + + u32 ToU32() const { + return ToU32ref(); + } + + operator u32() const { + return ToU32ref(); + } + + // clang-format off + static const u32 RED = 0xFF0000FF; + static const u32 GREEN = 0x00FF00FF; + static const u32 BLUE = 0x0000FFFF; + + static const u32 CYAN = 0x00FFFFFF; + static const u32 MAGENTA = 0xFF00FFFF; + static const u32 YELLOW = 0xFFFF00FF; + + static const u32 BLACK = 0x000000FF; + static const u32 GRAY = 0x808080FF; + static const u32 WHITE = 0xFFFFFFFF; + + static const u32 ELEMENT_MIN = 0x00000000; + static const u32 ELEMENT_MAX = 0xFFFFFFFF; + // clang-format on +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdFileStream.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdFileStream.h new file mode 100644 index 0000000000..a4d85dad43 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdFileStream.h @@ -0,0 +1,108 @@ +#ifndef NW4R_UT_DVD_FILE_STREAM_H +#define NW4R_UT_DVD_FILE_STREAM_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +class DvdFileStream : public FileStream { +public: + NW4R_UT_RTTI_DECL(DvdFileStream); + +public: + explicit DvdFileStream(s32 entrynum); + DvdFileStream(const DVDFileInfo* pInfo, bool close); + virtual ~DvdFileStream(); // at 0xC + + bool Open(s32 entrynum); + bool Open(const DVDFileInfo* pInfo, bool close); + + void SetPriority(s32 priority) { + mPriority = priority; + } + + virtual void Close(); // at 0x10 + + virtual s32 Read(void* pDst, u32 size); // at 0x14 + virtual bool ReadAsync(void* pDst, u32 size, StreamCallback pCallback, + void* pCallbackArg); // at 0x18 + + virtual s32 Peek(void* pDst, u32 size); // at 0x5C + virtual bool PeekAsync(void* pDst, u32 size, StreamCallback pCallback, + void* pCallbackArg); // at 0x60 + + virtual void Seek(s32 offset, u32 origin); // at 0x44 + + virtual void Cancel(); // at 0x48 + virtual bool CancelAsync(StreamCallback pCallback, + void* pCallbackArg); // at 0x4C + + virtual bool IsBusy() const { + return mIsBusy; + } // at 0x24 + + virtual u32 Tell() const { + return mFilePosition.Tell(); + } // at 0x58 + virtual u32 GetSize() const { + return mFilePosition.GetFileSize(); + } // at 0x40 + + virtual bool CanAsync() const { + return true; + } // at 0x28 + virtual bool CanSeek() const { + return true; + } // at 0x50 + virtual bool CanRead() const { + return true; + } // at 0x2C + virtual bool CanWrite() const { + return false; + } // at 0x30 + virtual bool CanCancel() const { + return true; + } // at 0x54 + + virtual u32 GetOffsetAlign() const { + return 4; + } // at 0x34 + virtual u32 GetSizeAlign() const { + return 32; + } // at 0x38 + virtual u32 GetBufferAlign() const { + return 32; + } // at 0x3C + +private: + struct DvdFileStreamInfo { + DVDFileInfo dvdInfo; // at 0x0 + DvdFileStream* stream; // at 0x3C + }; + +private: + static void DvdAsyncCallback_(s32 result, DVDFileInfo* pInfo); + static void DvdCBAsyncCallback_(s32 result, DVDCommandBlock* pBlock); + + void Initialize_(); + u32 AdjustReadLength_(u32 len); + +private: + FilePosition mFilePosition; // at 0x14 + StreamCallback mCancelCallback; // at 0x1C + void* mCancelArg; // at 0x20 + volatile bool mIsCanceling; // at 0x24 + DvdFileStreamInfo mFileInfo; // at 0x28 + s32 mPriority; // at 0x68 + volatile bool mIsBusy; // at 0x6C + bool mCloseOnDestroyFlg; // at 0x6D + bool mCloseEnableFlg; // at 0x6E +}; + +} // namespace ut +} // namespace nw4r +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdLockedFileStream.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdLockedFileStream.h new file mode 100644 index 0000000000..44360fa6dc --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_DvdLockedFileStream.h @@ -0,0 +1,55 @@ +#ifndef NW4R_UT_DVD_LOCKED_FILE_STREAM_H +#define NW4R_UT_DVD_LOCKED_FILE_STREAM_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +class DvdLockedFileStream : public DvdFileStream { +public: + NW4R_UT_RTTI_DECL(DvdLockedFileStream); + +public: + explicit DvdLockedFileStream(s32 entrynum); + DvdLockedFileStream(const DVDFileInfo* pInfo, bool close); + virtual ~DvdLockedFileStream(); // at 0xC + + virtual s32 Read(void* pDst, u32 size); // at 0x14 + + virtual bool ReadAsync(void* /* pDst */, u32 /* size */, + StreamCallback /* pCallback */, + void* /* pCallbackArg */) { + + return false; + } // at 0x18 + + virtual s32 Peek(void* pDst, u32 size); // at 0x5C + + virtual bool PeekAsync(void* /* pDst */, u32 /* size */, + StreamCallback /* pCallback */, + void* /* pCallbackArg */) { + + return false; + } // at 0x60 + + virtual bool CanAsync() const { + return false; + } // at 0x28 + +private: + static void InitMutex_(); + +private: + bool mCancelFlag; // at 0x6F + + static bool sInitialized; + static OSMutex sMutex; +}; + +} // namespace ut +} // namespace nw4r +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_FileStream.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_FileStream.h new file mode 100644 index 0000000000..40a1f45fa8 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_FileStream.h @@ -0,0 +1,62 @@ +#ifndef NW4R_UT_FILE_STREAM_H +#define NW4R_UT_FILE_STREAM_H +#include + +#include + +namespace nw4r { +namespace ut { + +class FileStream : public IOStream { +public: + NW4R_UT_RTTI_DECL(FileStream); + + enum SeekOrigin { SEEK_ORIGIN_BEG, SEEK_ORIGIN_CUR, SEEK_ORIGIN_END }; + +public: + FileStream() {} + virtual ~FileStream() {} // at 0xC + + virtual u32 GetSize() const = 0; // at 0x40 + + virtual void Seek(s32 offset, u32 origin); // at 0x44 + + virtual void Cancel(); // at 0x48 + virtual bool CancelAsync(StreamCallback pCallback, + void* pCallbackArg); // at 0x4C + + virtual bool CanSeek() const = 0; // at 0x50 + virtual bool CanCancel() const = 0; // at 0x54 + + virtual u32 Tell() const = 0; // at 0x58 + +protected: + class FilePosition { + public: + FilePosition() : mFileSize(0), mPosition(0) {} + + u32 GetFileSize() const { + return mFileSize; + } + void SetFileSize(u32 size) { + mFileSize = size; + } + + u32 Tell() const { + return mPosition; + } + + u32 Skip(s32 offset); + u32 Append(s32 offset); + void Seek(s32 offset, u32 origin); + + private: + u32 mFileSize; // at 0x0 + u32 mPosition; // at 0x4 + }; +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Font.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Font.h new file mode 100644 index 0000000000..d783141a2c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Font.h @@ -0,0 +1,90 @@ +#ifndef NW4R_UT_FONT_H +#define NW4R_UT_FONT_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +enum FontEncoding { + FONT_ENCODING_UTF8, + FONT_ENCODING_UTF16, + FONT_ENCODING_SJIS, + FONT_ENCODING_CP1252, + + FONT_ENCODING_MAX +}; + +struct CharWidths { + s8 left; // at 0x0 + u8 glyphWidth; // at 0x1 + s8 charWidth; // at 0x2 +}; + +struct Glyph { + void* pTexture; // at 0x0 + CharWidths widths; // at 0x4 + u8 height; // at 0x7 + GXTexFmt texFormat; // at 0x8 + u16 texWidth; // at 0xC + u16 texHeight; // at 0xE + u16 cellX; // at 0x10 + u16 cellY; // at 0x12 +}; + +/****************************************************************************** + * + * Font + * + ******************************************************************************/ +class Font { +public: + enum Type { TYPE_NULL, TYPE_ROM, TYPE_RESOURCE, TYPE_PAIR }; + +public: + Font() : mReadFunc(&CharStrmReader::ReadNextCharCP1252) {} + virtual ~Font() {} // at 0x8 + + virtual int GetWidth() const = 0; // at 0xC + virtual int GetHeight() const = 0; // at 0x10 + + virtual int GetAscent() const = 0; // at 0x14 + virtual int GetDescent() const = 0; // at 0x18 + virtual int GetBaselinePos() const = 0; // at 0x1C + + virtual int GetCellHeight() const = 0; // at 0x20 + virtual int GetCellWidth() const = 0; // at 0x24 + virtual int GetMaxCharWidth() const = 0; // at 0x28 + + virtual Type GetType() const = 0; // at 0x2C + virtual GXTexFmt GetTextureFormat() const = 0; // at 0x30 + virtual int GetLineFeed() const = 0; // at 0x34 + + virtual CharWidths GetDefaultCharWidths() const = 0; // at 0x38 + virtual void SetDefaultCharWidths(const CharWidths& rWidths) = 0; // at 0x3C + + virtual bool SetAlternateChar(u16 ch) = 0; // at 0x40 + virtual void SetLineFeed(int lf) = 0; // at 0x44 + + virtual int GetCharWidth(u16 ch) const = 0; // at 0x48 + virtual CharWidths GetCharWidths(u16 ch) const = 0; // at 0x4C + virtual void GetGlyph(Glyph* pGlyph, u16 ch) const = 0; // at 0x50 + virtual FontEncoding GetEncoding() const = 0; // at 0x54 + + void InitReaderFunc(FontEncoding encode); + + CharStrmReader GetCharStrmReader() const { + return CharStrmReader(mReadFunc); + } + +private: + CharStrmReader::ReadFunc mReadFunc; // at 0x4 +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_IOStream.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_IOStream.h new file mode 100644 index 0000000000..5705cbc303 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_IOStream.h @@ -0,0 +1,62 @@ +#ifndef NW4R_UT_IO_STREAM_H +#define NW4R_UT_IO_STREAM_H +#include + +#include + +namespace nw4r { +namespace ut { + +class IOStream { +public: + NW4R_UT_RTTI_DECL(IOStream); + + typedef void (*StreamCallback)(s32 result, IOStream* pStream, + void* pCallbackArg); + +public: + IOStream() : mAvailable(false), mCallback(NULL), mArg(NULL) {} + virtual ~IOStream() {} // at 0xC + + virtual void Close() = 0; // at 0x10 + + virtual s32 Read(void* pDst, u32 size) = 0; // at 0x14 + virtual bool ReadAsync(void* pDst, u32 size, StreamCallback pCallback, + void* pCallbackArg); // at 0x18 + + virtual void Write(const void* pSrc, u32 size); // at 0x1C + virtual bool WriteAsync(const void* pSrc, u32 size, + StreamCallback pCallback, + void* pCallbackArg); // at 0x20 + + virtual bool IsBusy() const; // at 0x24 + + virtual bool CanAsync() const = 0; // at 0x28 + virtual bool CanRead() const = 0; // at 0x2C + virtual bool CanWrite() const = 0; // at 0x30 + + virtual u32 GetOffsetAlign() const { + return 1; + } // at 0x34 + virtual u32 GetSizeAlign() const { + return 1; + } // at 0x38 + virtual u32 GetBufferAlign() const { + return 1; + } // at 0x3C + + bool IsAvailable() const { + return mAvailable; + } + +protected: + bool mAvailable; // at 0x4 + s32 mAsyncResult; // at 0x8 + StreamCallback mCallback; // at 0xC + void* mArg; // at 0x10 +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LinkList.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LinkList.h new file mode 100644 index 0000000000..c3871b9178 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LinkList.h @@ -0,0 +1,492 @@ +#ifndef NW4R_UT_LINK_LIST_H +#define NW4R_UT_LINK_LIST_H +#include + +#include + +namespace nw4r { +namespace ut { + +// Forward declarations +namespace detail { +class LinkListImpl; +} // namespace detail + +/****************************************************************************** + * + * Linked list node + * + ******************************************************************************/ +class LinkListNode : private NonCopyable { + friend class detail::LinkListImpl; + +public: + LinkListNode() : mNext(NULL), mPrev(NULL) {} + + LinkListNode* GetNext() const { + return mNext; + } + LinkListNode* GetPrev() const { + return mPrev; + } + +private: + LinkListNode* mNext; // at 0x0 + LinkListNode* mPrev; // at 0x4 +}; + +namespace detail { + +/****************************************************************************** + * + * Linked list implementation + * + ******************************************************************************/ +class LinkListImpl : private NonCopyable { +public: + // Forward declarations + class ConstIterator; + + /****************************************************************************** + * Iterator implementation + ******************************************************************************/ + class Iterator { + friend class LinkListImpl; + friend class ConstIterator; + + public: + Iterator() : mNode(NULL) {} + explicit Iterator(LinkListNode* pNode) : mNode(pNode) {} + + Iterator& operator++() { + mNode = mNode->GetNext(); + return *this; + } + + Iterator& operator--() { + mNode = mNode->GetPrev(); + return *this; + } + + LinkListNode* operator->() const { + return mNode; + } + + friend bool operator==(LinkListImpl::Iterator lhs, + LinkListImpl::Iterator rhs) { + return lhs.mNode == rhs.mNode; + } + + private: + LinkListNode* mNode; // at 0x0 + }; + + /****************************************************************************** + * Iterator implementation (const-view) + ******************************************************************************/ + class ConstIterator { + friend class LinkListImpl; + + public: + explicit ConstIterator(Iterator it) : mNode(it.mNode) {} + + ConstIterator& operator++() { + mNode = mNode->GetNext(); + return *this; + } + + ConstIterator& operator--() { + mNode = mNode->GetPrev(); + return *this; + } + + const LinkListNode* operator->() const { + return mNode; + } + + friend bool operator==(LinkListImpl::ConstIterator lhs, + LinkListImpl::ConstIterator rhs) { + return lhs.mNode == rhs.mNode; + } + + private: + LinkListNode* mNode; // at 0x0 + }; + +protected: + static Iterator GetIteratorFromPointer(LinkListNode* pNode) { + return Iterator(pNode); + } + + LinkListImpl() { + Initialize_(); + } + ~LinkListImpl(); + + Iterator GetBeginIter() { + return Iterator(mNode.GetNext()); + } + Iterator GetEndIter() { + return Iterator(&mNode); + } + + Iterator Insert(Iterator it, LinkListNode* pNode); + + Iterator Erase(Iterator it); + Iterator Erase(LinkListNode* pNode); + Iterator Erase(Iterator begin, Iterator end); + +public: + u32 GetSize() const { + return mSize; + } + bool IsEmpty() const { + return mSize == 0; + } + + void PopFront() { + Erase(GetBeginIter()); + } + void PopBack() { + Erase(--GetEndIter()); + } + + void Clear(); + +private: + void Initialize_() { + mSize = 0; + mNode.mNext = &mNode; + mNode.mPrev = &mNode; + } + +private: + u32 mSize; // at 0x0 + LinkListNode mNode; // at 0x4 +}; + +/****************************************************************************** + * + * Reverse iterator + * + ******************************************************************************/ +template class ReverseIterator { +public: + explicit ReverseIterator(TIter it) : mCurrent(it) {} + + TIter GetBase() const { + return mCurrent; + } + + ReverseIterator& operator++() { + --mCurrent; + return *this; + } + + const typename TIter::TElem* operator->() const { + return &this->operator*(); + } + + typename TIter::TElem& operator*() const { + TIter it = mCurrent; + return *--it; + } + + friend bool operator==(const ReverseIterator& rLhs, + const ReverseIterator& rRhs) { + return rLhs.mCurrent == rRhs.mCurrent; + } + + friend bool operator!=(const ReverseIterator& rLhs, + const ReverseIterator& rRhs) { + return !(rLhs.mCurrent == rRhs.mCurrent); + } + +private: + TIter mCurrent; // at 0x0 +}; + +} // namespace detail + +/****************************************************************************** + * + * Templated linked list + * + ******************************************************************************/ +template class LinkList : public detail::LinkListImpl { +public: + // Forward declarations + class ConstIterator; + + /****************************************************************************** + * Templated iterator + ******************************************************************************/ + class Iterator { + friend class LinkList; + friend class ConstIterator; + + public: + // Element type must be visible to ReverseIterator + typedef T TElem; + + public: + Iterator() : mIterator(NULL) {} + explicit Iterator(LinkListImpl::Iterator it) : mIterator(it) {} + + Iterator& operator++() { + ++mIterator; + return *this; + } + + Iterator& operator--() { + --mIterator; + return *this; + } + + Iterator operator++(int) { + Iterator ret = *this; + ++*this; + return ret; + } + + T* operator->() const { + return GetPointerFromNode(mIterator.operator->()); + } + + T& operator*() const { + return *this->operator->(); + } + + friend bool operator==(Iterator lhs, Iterator rhs) { + return lhs.mIterator == rhs.mIterator; + } + + friend bool operator!=(Iterator lhs, Iterator rhs) { + return !(lhs == rhs); + } + + private: + LinkListImpl::Iterator mIterator; // at 0x0 + }; + + /****************************************************************************** + * Templated iterator (const-view) + ******************************************************************************/ + class ConstIterator { + friend class LinkList; + + public: + // Element type must be visible to ReverseIterator + typedef T TElem; + + public: + explicit ConstIterator(LinkListImpl::Iterator it) : mIterator(it) {} + explicit ConstIterator(Iterator it) : mIterator(it.mIterator) {} + + ConstIterator& operator++() { + ++mIterator; + return *this; + } + + ConstIterator& operator--() { + --mIterator; + return *this; + } + + ConstIterator operator++(int) { + ConstIterator ret = *this; + ++*this; + return ret; + } + + const T* operator->() const { + return GetPointerFromNode(mIterator.operator->()); + } + + const T& operator*() const { + return *this->operator->(); + } + + friend bool operator==(ConstIterator lhs, ConstIterator rhs) { + return lhs.mIterator == rhs.mIterator; + } + + friend bool operator!=(ConstIterator lhs, ConstIterator rhs) { + return !(lhs == rhs); + } + + private: + LinkListImpl::ConstIterator mIterator; // at 0x0 + }; + +public: + // Shorthand names for reverse iterator types + typedef detail::ReverseIterator RevIterator; + typedef detail::ReverseIterator ConstRevIterator; + +public: + LinkList() {} + + Iterator GetBeginIter() { + return Iterator(LinkListImpl::GetBeginIter()); + } + ConstIterator GetBeginIter() const { + return ConstIterator(const_cast(this)->GetBeginIter()); + } + RevIterator GetBeginReverseIter() { + return RevIterator(GetBeginIter()); + } + ConstRevIterator GetBeginReverseIter() const { + return ConstRevIterator(GetBeginIter()); + } + + Iterator GetEndIter() { + return Iterator(LinkListImpl::GetEndIter()); + } + ConstIterator GetEndIter() const { + return ConstIterator(const_cast(this)->GetEndIter()); + } + RevIterator GetEndReverseIter() { + return RevIterator(GetEndIter()); + } + ConstRevIterator GetEndReverseIter() const { + return ConstRevIterator(GetEndIter()); + } + + Iterator Insert(Iterator it, T* pElem) { + return Iterator( + LinkListImpl::Insert(it.mIterator, GetNodeFromPointer(pElem))); + } + + Iterator Erase(T* pElem) { + return Iterator(LinkListImpl::Erase(GetNodeFromPointer(pElem))); + } + Iterator Erase(Iterator it) { + return Iterator(LinkListImpl::Erase(it.mIterator)); + } + + void PushBack(T* pElem) { + Insert(GetEndIter(), pElem); + } + + T& GetFront() { + return *GetBeginIter(); + } + const T& GetFront() const { + return *GetBeginIter(); + } + + T& GetBack() { + return *--GetEndIter(); + } + const T& GetBack() const { + return *--GetEndIter(); + } + + static Iterator GetIteratorFromPointer(T* pElem) { + return GetIteratorFromPointer(GetNodeFromPointer(pElem)); + } + + static Iterator GetIteratorFromPointer(LinkListNode* pNode) { + return Iterator(LinkListImpl::GetIteratorFromPointer(pNode)); + } + + static LinkListNode* GetNodeFromPointer(T* pElem) { + return reinterpret_cast(reinterpret_cast(pElem) + + Ofs); + } + + static T* GetPointerFromNode(LinkListNode* pNode) { + return reinterpret_cast(reinterpret_cast(pNode) - Ofs); + } + + static const T* GetPointerFromNode(const LinkListNode* pNode) { + return reinterpret_cast(reinterpret_cast(pNode) - + Ofs); + } +}; + +} // namespace ut +} // namespace nw4r + +/****************************************************************************** + * + * Macros + * + ******************************************************************************/ +/** + * Declare typedef for linked-list specialization. + */ +#define NW4R_UT_LINKLIST_TYPEDEF_DECL(T) \ + typedef nw4r::ut::LinkList T##List; + +/** + * Declare typedef for linked-list specialization. + * + * Use the specified link node (name suffix) for classes with multiple nodes. + */ +#define NW4R_UT_LINKLIST_TYPEDEF_DECL_EX(T, SUFFIX) \ + typedef nw4r::ut::LinkList T##SUFFIX##List; + +/** + * Declare a member LinkListNode for use with the typedef. + */ +#define NW4R_UT_LINKLIST_NODE_DECL() nw4r::ut::LinkListNode node + +/** + * Declare a member LinkListNode for use with the typedef. + * + * Use the specified link node (name suffix) for classes with multiple nodes. + */ +#define NW4R_UT_LINKLIST_NODE_DECL_EX(SUFFIX) \ + nw4r::ut::LinkListNode node##SUFFIX + +/** + * Explicitly instantiate a linked list specialization. + * (RESERVED FOR MATCHING DECOMP HACKS) + */ +#if !defined(NONMATCHING) +#define NW4R_UT_LINKLIST_TYPEDEF_FORCE(T) \ + template struct nw4r::ut::LinkList +#else +#define NW4R_UT_LINKLIST_TYPEDEF_FORCE(T) +#endif + +/** + * Linked-list for-each macro. + * + * @param NAME Element name + * @param LIST Reference to list + * @param ... Statement(s) to execute + */ +#define NW4R_UT_LINKLIST_FOREACH(NAME, LIST, ...) \ + { \ + typedef DECLTYPE((LIST).GetBeginIter()) IterType; \ + \ + for (IterType NAME = (LIST).GetBeginIter(); \ + NAME != (LIST).GetEndIter(); ++NAME) { \ + \ + __VA_ARGS__; \ + } \ + } + +/** + * List for-each macro, with robust iteration. + * + * @param NAME Element name + * @param LIST Reference to list + * @param ... Statement(s) to execute + */ +#define NW4R_UT_LINKLIST_FOREACH_SAFE(NAME, LIST, ...) \ + { \ + typedef DECLTYPE((LIST).GetBeginIter()) IterType; \ + \ + for (IterType __impl__ = (LIST).GetBeginIter(); \ + __impl__ != (LIST).GetEndIter();) { \ + \ + IterType NAME = __impl__++; \ + __VA_ARGS__; \ + } \ + } + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LockedCache.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LockedCache.h new file mode 100644 index 0000000000..1ee4c083eb --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_LockedCache.h @@ -0,0 +1,39 @@ +#ifndef NW4R_UT_LOCKED_CACHE_H +#define NW4R_UT_LOCKED_CACHE_H +#include + +#include + +namespace nw4r { +namespace ut { +namespace LC { + +void Enable(); +void Disable(); + +bool Lock(); +void Unlock(); + +void LoadBlocks(void* pDst, void* pSrc, u32 blocks); +void StoreBlocks(void* pDst, void* pSrc, u32 blocks); +void StoreData(void* pDst, void* pSrc, u32 size); + +inline void* GetBase() { + return reinterpret_cast(OS_CACHE_BASE); +} + +inline void QueueWait(u32 len) { + LCQueueWait(len); +} + +inline void QueueWaitEx(u32 len) { + while (LCQueueLength() != len) { + OSYieldThread(); + } +} + +} // namespace LC +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NandFileStream.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NandFileStream.h new file mode 100644 index 0000000000..89b688a45c --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NandFileStream.h @@ -0,0 +1,100 @@ +#ifndef NW4R_UT_NAND_FILE_STREAM_H +#define NW4R_UT_NAND_FILE_STREAM_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +class NandFileStream : public FileStream { +public: + NW4R_UT_RTTI_DECL(NandFileStream); + +public: + NandFileStream(const char* pPath, u32 mode); + NandFileStream(const NANDFileInfo* pInfo, u32 mode, bool enableClose); + virtual ~NandFileStream(); // at 0xC + + bool Open(const char* pPath, u32 mode); + bool Open(const NANDFileInfo* pInfo, u32 mode, bool enableClose) + DECOMP_DONT_INLINE; + + virtual void Close(); // at 0x10 + + virtual s32 Read(void* pDst, u32 size); // at 0x14 + virtual bool ReadAsync(void* pDst, u32 size, StreamCallback pCallback, + void* pCallbackArg); // at 0x18 + + virtual void Write(const void* pSrc, u32 size); // at 0x1C + virtual bool WriteAsync(const void* pSrc, u32 size, + StreamCallback pCallback, + void* pCallbackArg); // at 0x20 + + virtual void Seek(s32 offset, u32 origin); // at 0x44 + + virtual bool IsBusy() const { + return mIsBusy; + } // at 0x24 + + virtual u32 Tell() const { + return mFilePosition.Tell(); + } // at 0x58 + virtual u32 GetSize() const { + return mFilePosition.GetFileSize(); + } // at 0x40 + + virtual bool CanAsync() const { + return true; + } // at 0x28 + virtual bool CanSeek() const { + return true; + } // at 0x50 + virtual bool CanRead() const { + return mCanRead; + } // at 0x2C + virtual bool CanWrite() const { + return mCanWrite; + } // at 0x30 + virtual bool CanCancel() const { + return false; + } // at 0x54 + + virtual u32 GetOffsetAlign() const { + return 1; + } // at 0x34 + virtual u32 GetSizeAlign() const { + return 32; + } // at 0x38 + virtual u32 GetBufferAlign() const { + return 32; + } // at 0x3C + +private: + struct NandFileStreamInfo { + NANDCommandBlock nandBlock; // at 0x0 + NANDFileInfo nandInfo; // at 0xB8 + NandFileStream* stream; // at 0x144 + }; + +private: + static void NandAsyncCallback_(s32 result, NANDCommandBlock* pBlock); + + void Initialize_(); + +private: + FilePosition mFilePosition; // at 0x14 + NandFileStreamInfo mFileInfo; // at 0x1C + bool mCanRead; // at 0x164 + bool mCanWrite; // at 0x165 + volatile bool mIsBusy; // at 0x166 + bool mCloseOnDestroyFlg; // at 0x167 + bool mCloseEnableFlg; // at 0x168 +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NonCopyable.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NonCopyable.h new file mode 100644 index 0000000000..51e6bf03ef --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_NonCopyable.h @@ -0,0 +1,20 @@ +#ifndef NW4R_UT_NON_COPYABLE_H +#define NW4R_UT_NON_COPYABLE_H +#include + +namespace nw4r { +namespace ut { +namespace { + +class NonCopyable { +protected: + NonCopyable() {} + NonCopyable(const NonCopyable& /* rOther */) {} + ~NonCopyable() {} +}; + +} // namespace +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Rect.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Rect.h new file mode 100644 index 0000000000..227a623681 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_Rect.h @@ -0,0 +1,57 @@ +#ifndef NW4R_UT_RECT_H +#define NW4R_UT_RECT_H +#include + +#include + +namespace nw4r { +namespace ut { + +struct Rect { + f32 left; // at 0x0 + f32 top; // at 0x4 + f32 right; // at 0x8 + f32 bottom; // at 0xC + + Rect() : left(0.0f), top(0.0f), right(0.0f), bottom(0.0f) {} + Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {} + ~Rect() {} + + void SetWidth(f32 width) { + right = left + width; + } + f32 GetWidth() const { + return right - left; + } + + void SetHeight(f32 height) { + bottom = top + height; + } + f32 GetHeight() const { + return bottom - top; + } + + void Normalize() { + f32 l = left; + f32 t = top; + f32 r = right; + f32 b = bottom; + + left = math::FSelect(r - l, l, r); // min(r, l) + right = math::FSelect(r - l, r, l); // max(r, l) + top = math::FSelect(b - t, t, b); // min(b, t) + bottom = math::FSelect(b - t, b, t); // max(b, t) + } + + void MoveTo(f32 x, f32 y) { + right = x + GetWidth(); + left = x; + bottom = y + GetHeight(); + top = y; + } +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFont.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFont.h new file mode 100644 index 0000000000..c5123afde3 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFont.h @@ -0,0 +1,39 @@ +#ifndef NW4R_UT_RES_FONT_H +#define NW4R_UT_RES_FONT_H +#include + +#include + +namespace nw4r { +namespace ut { + +// Forward declarations +struct BinaryFileHeader; + +class ResFont : public detail::ResFontBase { +public: + ResFont(); + virtual ~ResFont(); // at 0x8 + + bool SetResource(void* pBuffer); + +private: + static FontInformation* Rebuild(BinaryFileHeader* pHeader); + +private: + static const u32 SIGNATURE = FOURCC('R', 'F', 'N', 'T'); + static const u32 SIGNATURE_UNPACKED = FOURCC('R', 'F', 'N', 'U'); + + static const u32 SIGNATURE_FONTINFO = FOURCC('F', 'I', 'N', 'F'); + static const u32 SIGNATURE_TEXGLYPH = FOURCC('T', 'G', 'L', 'P'); + static const u32 SIGNATURE_CHARWIDTH = FOURCC('C', 'W', 'D', 'H'); + static const u32 SIGNATURE_CHARMAP = FOURCC('C', 'M', 'A', 'P'); + + // TODO(kiwi) Which block is this? + static const u32 SIGNATURE_GLGR = FOURCC('G', 'L', 'G', 'R'); +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFontBase.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFontBase.h new file mode 100644 index 0000000000..d80e1903ce --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_ResFontBase.h @@ -0,0 +1,134 @@ +#ifndef NW4R_UT_RES_FONT_BASE_H +#define NW4R_UT_RES_FONT_BASE_H +#include + +#include + +namespace nw4r { +namespace ut { + +enum FontMapMethod { + FONT_MAPMETHOD_DIRECT, + FONT_MAPMETHOD_TABLE, + FONT_MAPMETHOD_SCAN +}; + +struct FontTextureGlyph { + u8 cellWidth; // at 0x0 + u8 cellHeight; // at 0x1 + s8 baselinePos; // at 0x2 + u8 maxCharWidth; // at 0x3 + u32 sheetSize; // at 0x4 + u16 sheetNum; // at 0x8 + u16 sheetFormat; // at 0xA + u16 sheetRow; // at 0xC + u16 sheetLine; // at 0xE + u16 sheetWidth; // at 0x10 + u16 sheetHeight; // at 0x12 + u8* sheetImage; // at 0x14 +}; + +struct FontWidth { + u16 indexBegin; // at 0x0 + u16 indexEnd; // at 0x2 + FontWidth* pNext; // at 0x4 + CharWidths widthTable[]; // at 0x8 +}; + +struct FontCodeMap { + u16 ccodeBegin; // at 0x0 + u16 ccodeEnd; // at 0x2 + u16 mappingMethod; // at 0x4 + u16 reserved; // at 0x6 + FontCodeMap* pNext; // at 0x8 + u16 mapInfo[]; // at 0xC +}; + +struct FontInformation { + u8 fontType; // at 0x0 + s8 linefeed; // at 0x1 + u16 alterCharIndex; // at 0x2 + CharWidths defaultWidth; // at 0x4 + u8 encoding; // at 0x7 + FontTextureGlyph* pGlyph; // at 0x8 + FontWidth* pWidth; // at 0xC + FontCodeMap* pMap; // at 0x10 + u8 height; // at 0x14 + u8 width; // at 0x15 + u8 ascent; // at 0x16 +}; + +namespace detail { + +/****************************************************************************** + * + * ResFontBase + * + ******************************************************************************/ +class ResFontBase : public Font { +public: + static const u16 GLYPH_INDEX_NOT_FOUND = 0xFFFF; + +public: + ResFontBase(); + virtual ~ResFontBase(); // at 0x8 + + virtual int GetWidth() const; // at 0xC + virtual int GetHeight() const; // at 0x10 + + virtual int GetAscent() const; // at 0x14 + virtual int GetDescent() const; // at 0x18 + virtual int GetBaselinePos() const; // at 0x1C + + virtual int GetCellHeight() const; // at 0x20 + virtual int GetCellWidth() const; // at 0x24 + virtual int GetMaxCharWidth() const; // at 0x28 + + virtual Type GetType() const; // at 0x2C + virtual GXTexFmt GetTextureFormat() const; // at 0x30 + virtual int GetLineFeed() const; // at 0x34 + + virtual CharWidths GetDefaultCharWidths() const; // at 0x38 + virtual void SetDefaultCharWidths(const CharWidths& rWidths); // at 0x3C + + virtual bool SetAlternateChar(u16 ch); // at 0x40 + virtual void SetLineFeed(int lf); // at 0x44 + + virtual int GetCharWidth(u16 ch) const; // at 0x48 + virtual CharWidths GetCharWidths(u16 ch) const; // at 0x4C + virtual void GetGlyph(Glyph* pGlyph, u16 ch) const; // at 0x50 + virtual FontEncoding GetEncoding() const; // at 0x54 + +protected: + bool IsManaging(const void* pBuffer) const { + return mResource == pBuffer; + } + + void SetResourceBuffer(void* pBuffer, FontInformation* pInfo); + +private: + u16 GetGlyphIndex(u16 ch) const; + + u16 FindGlyphIndex(u16 ch) const; + u16 FindGlyphIndex(const FontCodeMap* pMap, u16 ch) const; + + const CharWidths& GetCharWidthsFromIndex(u16 index) const; + const CharWidths& GetCharWidthsFromIndex(const FontWidth* pWidth, + u16 index) const; + + void GetGlyphFromIndex(Glyph* pGlyph, u16 index) const; + +private: + void* mResource; // at 0x10 + FontInformation* mFontInfo; // at 0x14 + // Undocumented tail the base Font ctor also writes; omitting it leaves + // sizeof() 4 bytes short and that ctor overflows past the object. + u16 _24; // at 0x18 + u16 _26; // at 0x1A, likely a cached alternate-char glyph index +}; + +} // namespace detail +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RomFont.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RomFont.h new file mode 100644 index 0000000000..097f163608 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RomFont.h @@ -0,0 +1,64 @@ +#ifndef NW4R_UT_ROM_FONT_H +#define NW4R_UT_ROM_FONT_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { + +class RomFont : public Font { +public: + RomFont(); + virtual ~RomFont(); // at 0x8 + + virtual int GetWidth() const; // at 0xC + virtual int GetHeight() const; // at 0x10 + + virtual int GetAscent() const; // at 0x14 + virtual int GetDescent() const; // at 0x18 + virtual int GetBaselinePos() const; // at 0x1C + + virtual int GetCellHeight() const; // at 0x20 + virtual int GetCellWidth() const; // at 0x24 + virtual int GetMaxCharWidth() const; // at 0x28 + + virtual Type GetType() const; // at 0x2C + virtual GXTexFmt GetTextureFormat() const; // at 0x30 + virtual int GetLineFeed() const; // at 0x34 + + virtual CharWidths GetDefaultCharWidths() const; // at 0x38 + virtual void SetDefaultCharWidths(const CharWidths& rWidths); // at 0x3C + + virtual bool SetAlternateChar(u16 ch); // at 0x40 + virtual void SetLineFeed(int lf); // at 0x44 + + virtual int GetCharWidth(u16 ch) const; // at 0x48 + virtual CharWidths GetCharWidths(u16 ch) const; // at 0x4C + virtual void GetGlyph(Glyph* pGlyph, u16 ch) const; // at 0x50 + virtual FontEncoding GetEncoding() const; // at 0x54 + + u32 GetRequireBufferSize(); + bool Load(void* pBuffer); + +private: + static const int CHAR_PTR_BUFFER_SIZE = 4; + +private: + void MakeCharPtr(char* pBuffer, u16 ch) const; + u16 HandleUndefinedChar(u16 ch) const; + +private: + OSFontHeader* mFontHeader; // at 0x10 + CharWidths mDefaultWidths; // at 0x14 + u16 mAlternateChar; // at 0x18 + + static u16 mFontEncode; +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RuntimeTypeInfo.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RuntimeTypeInfo.h new file mode 100644 index 0000000000..6ddc7d24bb --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_RuntimeTypeInfo.h @@ -0,0 +1,89 @@ +#ifndef NW4R_UT_RUNTIME_TYPE_INFO_H +#define NW4R_UT_RUNTIME_TYPE_INFO_H +#include + +namespace nw4r { +namespace ut { +namespace detail { + +/****************************************************************************** + * + * RuntimeTypeInfo + * + ******************************************************************************/ +struct RuntimeTypeInfo { + explicit RuntimeTypeInfo(const RuntimeTypeInfo* pBase) + : mParentTypeInfo(pBase) {} + + bool IsDerivedFrom(const RuntimeTypeInfo* pInfo) const { + for (const RuntimeTypeInfo* pIt = this; pIt != NULL; + pIt = pIt->mParentTypeInfo) { + + if (pIt == pInfo) { + return true; + } + } + + return false; + } + + const RuntimeTypeInfo* mParentTypeInfo; // at 0x0 +}; + +template +inline const RuntimeTypeInfo* GetTypeInfoFromPtr_(T* /* pPtr */) { + return &T::typeInfo; +} + +} // namespace detail + +/****************************************************************************** + * + * DynamicCast + * + ******************************************************************************/ +template +inline TDerived DynamicCast(TBase* pPtr) { + const detail::RuntimeTypeInfo* pDerivedTypeInfo = + detail::GetTypeInfoFromPtr_(static_cast(NULL)); + + // Downcast only if possible + if (pPtr->GetRuntimeTypeInfo()->IsDerivedFrom(pDerivedTypeInfo)) { + return static_cast(pPtr); + } + + return NULL; +} + +} // namespace ut +} // namespace nw4r + +/****************************************************************************** + * + * Macros + * + ******************************************************************************/ +/** + * Declare type RTTI and accessor function. + */ +#define NW4R_UT_RTTI_DECL(T) \ + virtual const nw4r::ut::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() \ + const { \ + return &typeInfo; \ + } \ + \ + static nw4r::ut::detail::RuntimeTypeInfo typeInfo; + +/** + * Define type RTTI (base type). + */ +#define NW4R_UT_RTTI_DEF_BASE(T) \ + nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(NULL) + +/** + * Define type RTTI (derived type). + */ +#define NW4R_UT_RTTI_DEF_DERIVED(T, BASE) \ + nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(&BASE::typeInfo) + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessor.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessor.h new file mode 100644 index 0000000000..e811feb845 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessor.h @@ -0,0 +1,15 @@ +#ifndef NW4R_UT_TAG_PROCESSOR_H +#define NW4R_UT_TAG_PROCESSOR_H +#include + +#include + +namespace nw4r { +namespace ut { + +typedef TagProcessorBase TagProcessor; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessorBase.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessorBase.h new file mode 100644 index 0000000000..8a15b74d5b --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TagProcessorBase.h @@ -0,0 +1,62 @@ +#ifndef NW4R_UT_TAG_PROCESSOR_BASE_H +#define NW4R_UT_TAG_PROCESSOR_BASE_H +#include + +namespace nw4r { +namespace ut { + +// Forward declarations +struct Rect; +template class TextWriterBase; + +/****************************************************************************** + * + * PrintContext + * + ******************************************************************************/ +template struct PrintContext { + enum Flags { + FLAGS_CHARSPACE = (1 << 0), + }; + + TextWriterBase* writer; // at 0x0 + const T* str; // at 0x4 + f32 x; // at 0x8 + f32 y; // at 0xC + u32 flags; // at 0x10 +}; + +/****************************************************************************** + * + * TagProcessorBase + * + ******************************************************************************/ +template class TagProcessorBase { +public: + typedef PrintContext ContextType; + + enum Operation { + OPERATION_DEFAULT, + OPERATION_NO_CHAR_SPACE, + OPERATION_CHAR_SPACE, + OPERATION_NEXT_LINE, + OPERATION_END_DRAW + }; + +public: + TagProcessorBase(); + virtual ~TagProcessorBase(); // at 0x8 + + virtual Operation Process(u16 ch, ContextType* pCtx); // at 0xC + virtual Operation CalcRect(Rect* pRect, u16 ch, + ContextType* pCtx); // at 0x10 + +private: + void ProcessTab(ContextType* pCtx); + void ProcessLinefeed(ContextType* pCtx); +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriter.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriter.h new file mode 100644 index 0000000000..d5dfca36ac --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriter.h @@ -0,0 +1,15 @@ +#ifndef NW4R_UT_TEXT_WRITER_H +#define NW4R_UT_TEXT_WRITER_H +#include + +#include + +namespace nw4r { +namespace ut { + +typedef TextWriterBase TextWriter; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriterBase.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriterBase.h new file mode 100644 index 0000000000..a7636af7f2 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_TextWriterBase.h @@ -0,0 +1,176 @@ +#ifndef NW4R_UT_TEXT_WRITER_BASE_H +#define NW4R_UT_TEXT_WRITER_BASE_H +#include + +#include +#include + +#include + +#include +#include + +namespace nw4r { +namespace ut { + +template class TextWriterBase : public CharWriter { +public: + typedef TagProcessorBase TagProcessorType; + +public: + enum DrawFlag { + // Align text lines + DRAWFLAG_ALIGN_TEXT_BASELINE = 0, + DRAWFLAG_ALIGN_TEXT_CENTER = (1 << 0), + DRAWFLAG_ALIGN_TEXT_RIGHT = (1 << 1), + + // Align text block (horizontal) + DRAWFLAG_ALIGN_H_BASELINE = 0, + DRAWFLAG_ALIGN_H_CENTER = (1 << 4), + DRAWFLAG_ALIGN_H_RIGHT = (1 << 5), + + // Align text block (vertical) + DRAWFLAG_ALIGN_V_BASELINE = 0, + DRAWFLAG_ALIGN_V_CENTER = (1 << 8), + DRAWFLAG_ALIGN_V_TOP = (1 << 9), + + // Mask constants + DRAWFLAG_MASK_ALIGN_TEXT = DRAWFLAG_ALIGN_TEXT_BASELINE | + DRAWFLAG_ALIGN_TEXT_CENTER | + DRAWFLAG_ALIGN_TEXT_RIGHT, + + DRAWFLAG_MASK_ALIGN_H = DRAWFLAG_ALIGN_H_BASELINE | + DRAWFLAG_ALIGN_H_CENTER | + DRAWFLAG_ALIGN_H_RIGHT, + + DRAWFLAG_MASK_ALIGN_V = DRAWFLAG_ALIGN_V_BASELINE | + DRAWFLAG_ALIGN_V_CENTER | DRAWFLAG_ALIGN_V_TOP, + }; + +public: + TextWriterBase(); + ~TextWriterBase(); + + f32 GetWidthLimit() const { + return mWidthLimit; + } + void SetWidthLimit(f32 limit) { + mWidthLimit = limit; + } + void ResetWidthLimit() { + mWidthLimit = NW4R_MATH_FLT_MAX; + } + + f32 GetCharSpace() const { + return mCharSpace; + } + void SetCharSpace(f32 space) { + mCharSpace = space; + } + + f32 GetLineSpace() const { + return mLineSpace; + } + void SetLineSpace(f32 space) { + mLineSpace = space; + } + + int GetTabWidth() const { + return mTabWidth; + } + void SetTabWidth(int width) { + mTabWidth = width; + } + + u32 GetDrawFlag() const { + return mDrawFlag; + } + void SetDrawFlag(u32 flag) { + mDrawFlag = flag; + } + + TagProcessorBase* GetTagProcessor() const { + return mTagProcessor; + } + void SetTagProcessor(TagProcessorBase* pProcessor) { + mTagProcessor = pProcessor; + } + void ResetTagProcessor() { + mTagProcessor = &mDefaultTagProcessor; + } + + f32 GetLineHeight() const; + + f32 CalcLineWidth(const T* pStr, int len); + f32 CalcStringWidth(const T* pStr, int len) const; + void CalcStringRect(Rect* pRect, const T* pStr, int len) const; + + int VSNPrintf(T* buffer, u32 count, const T* pStr, std::va_list args); + f32 VPrintf(const T* pStr, std::va_list args); + f32 Print(const T* pStr, int len); + + static T* GetBuffer() { + return mFormatBuffer; + } + static T* SetBuffer(T* pBuffer, u32 size) { + T* pOldBuffer = mFormatBuffer; + mFormatBuffer = pBuffer; + mFormatBufferSize = size; + return pOldBuffer; + } + + static u32 GetBufferSize() { + return mFormatBufferSize; + } + +private: + static const int DEFAULT_FORMAT_BUFFER_SIZE = 256; + + static const u32 DRAWFLAG_MASK_ALL = DRAWFLAG_MASK_ALIGN_TEXT | + DRAWFLAG_MASK_ALIGN_H | + DRAWFLAG_MASK_ALIGN_V; + +private: + bool IsDrawFlagSet(u32 mask, u32 flag) const { + return (mDrawFlag & mask) == flag; + } + + bool CalcLineRectImpl(Rect* pRect, const T** ppStr, int len); + void CalcStringRectImpl(Rect* pRect, const T* pStr, int len); + + f32 PrintImpl(const T* pStr, int len); + f32 AdjustCursor(f32* pX, f32* pY, const T* pStr, int len); + +private: + f32 mWidthLimit; // at 0x4C + f32 mCharSpace; // at 0x50 + f32 mLineSpace; // at 0x54 + int mTabWidth; // at 0x58 + u32 mDrawFlag; // at 0x5C + TagProcessorBase* mTagProcessor; // at 0x60 + + static T* mFormatBuffer; + static u32 mFormatBufferSize; + static TagProcessorBase mDefaultTagProcessor; +}; + +template <> +inline int TextWriterBase::VSNPrintf(char* pBuffer, u32 count, + const char* pStr, + std::va_list args) { + + return std::vsnprintf(pBuffer, count, pStr, args); +} + +template <> +inline int TextWriterBase::VSNPrintf(wchar_t* pBuffer, u32 count, + const wchar_t* pStr, + std::va_list args) { + + return std::vswprintf(pBuffer, count, pStr, args); +} + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTagProcessor.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTagProcessor.h new file mode 100644 index 0000000000..3df1f843b7 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTagProcessor.h @@ -0,0 +1,15 @@ +#ifndef NW4R_UT_WIDE_TAG_PROCESSOR_H +#define NW4R_UT_WIDE_TAG_PROCESSOR_H +#include + +#include + +namespace nw4r { +namespace ut { + +typedef TagProcessorBase WideTagProcessor; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTextWriter.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTextWriter.h new file mode 100644 index 0000000000..73f03c0b03 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_WideTextWriter.h @@ -0,0 +1,15 @@ +#ifndef NW4R_UT_WIDE_TEXT_WRITER_H +#define NW4R_UT_WIDE_TEXT_WRITER_H +#include + +#include + +namespace nw4r { +namespace ut { + +typedef TextWriterBase WideTextWriter; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_algorithm.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_algorithm.h new file mode 100644 index 0000000000..07486e422a --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_algorithm.h @@ -0,0 +1,109 @@ +#ifndef NW4R_UT_ALGORITHM_H +#define NW4R_UT_ALGORITHM_H +#include + +namespace nw4r { +namespace ut { +namespace { + +/****************************************************************************** + * + * Value operations + * + ******************************************************************************/ +template inline T Max(T t1, T t2) { + return (t1 < t2) ? t2 : t1; +} + +template inline T Min(T t1, T t2) { + return (t1 > t2) ? t2 : t1; +} + +template inline T Clamp(T value, T min, T max) { + return value > max ? max : (value < min ? min : value); +} + +template inline T Abs(T x) { + // Static cast needed to break abs optimization + return x < 0 ? static_cast(-x) : static_cast(x); +} + +template <> f32 inline Abs(register f32 x) { + register f32 ax; + + asm { + fabs ax, x + } + + return ax; +} + +/****************************************************************************** + * + * Bit operations + * + ******************************************************************************/ +template inline T BitExtract(T bits, int pos, int len) { + T mask = (1 << len) - 1; + return (bits >> pos) & mask; +} + +template inline bool TestBit(T t, int pos) { + return BitExtract(t, sizeof(T), pos); +} + +/****************************************************************************** + * + * Pointer arithmetic + * + ******************************************************************************/ +inline u32 GetIntPtr(const void* pPtr) { + return reinterpret_cast(pPtr); +} + +template +inline const void* AddOffsetToPtr(const void* pBase, T offset) { + return reinterpret_cast(GetIntPtr(pBase) + offset); +} +template inline void* AddOffsetToPtr(void* pBase, T offset) { + return reinterpret_cast(GetIntPtr(pBase) + offset); +} + +inline s32 GetOffsetFromPtr(const void* pStart, const void* pEnd) { + return static_cast(GetIntPtr(pEnd) - GetIntPtr(pStart)); +} + +inline int ComparePtr(const void* pPtr1, const void* pPtr2) { + return static_cast(GetIntPtr(pPtr1) - GetIntPtr(pPtr2)); +} + +/****************************************************************************** + * + * Rounding + * + ******************************************************************************/ +template inline T RoundUp(T t, unsigned int alignment) { + return (alignment + t - 1) & ~(alignment - 1); +} + +template inline void* RoundUp(T* pPtr, unsigned int alignment) { + u32 value = reinterpret_cast(pPtr); + u32 rounded = (alignment + value - 1) & ~(alignment - 1); + return reinterpret_cast(rounded); +} + +template inline T RoundDown(T t, unsigned int alignment) { + return t & ~(alignment - 1); +} + +template inline void* RoundDown(T* pPtr, unsigned int alignment) { + u32 value = reinterpret_cast(pPtr); + u32 rounded = value & ~(alignment - 1); + return reinterpret_cast(rounded); +} + +} // namespace +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_binaryFileFormat.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_binaryFileFormat.h new file mode 100644 index 0000000000..380a0cee4f --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_binaryFileFormat.h @@ -0,0 +1,28 @@ +#ifndef NW4R_UT_BINARY_FILE_FORMAT_H +#define NW4R_UT_BINARY_FILE_FORMAT_H +#include + +namespace nw4r { +namespace ut { + +struct BinaryBlockHeader { + u32 kind; // at 0x0 + u32 size; // at 0x4 +}; + +struct BinaryFileHeader { + u32 signature; // at 0x0 + u16 byteOrder; // at 0x4 + u16 version; // at 0x6 + u32 fileSize; // at 0x8 + u16 headerSize; // at 0xC + u16 dataBlocks; // at 0xE +}; + +bool IsValidBinaryFile(const BinaryFileHeader* pHeader, u32 signature, + u16 version, u16 minBlocks); + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_list.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_list.h new file mode 100644 index 0000000000..ba7e6a8089 --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_list.h @@ -0,0 +1,152 @@ +#ifndef NW4R_UT_LIST_H +#define NW4R_UT_LIST_H +#include + +namespace nw4r { +namespace ut { + +struct List { + void* headObject; // at 0x0 + void* tailObject; // at 0x4 + u16 numObjects; // at 0x8 + u16 offset; // at 0xA +}; + +struct Link { + void* prevObject; // at 0x0 + void* nextObject; // at 0x4 +}; + +void List_Init(List* pList, u16 offset); + +void List_Append(List* pList, void* pObject); +void List_Prepend(List* pList, void* pObject); + +void List_Insert(List* pList, void* pTarget, void* pObject); +void List_Remove(List* pList, void* pObject); + +void* List_GetNext(const List* pList, const void* pObject); +inline const void* List_GetNextConst(const List* pList, const void* pObject) { + return List_GetNext(pList, pObject); +} + +void* List_GetPrev(const List* pList, const void* pObject); +inline const void* List_GetPrevConst(const List* pList, const void* pObject) { + return List_GetPrev(pList, pObject); +} + +void* List_GetNth(const List* pList, u16 n); +inline const void* List_GetNthConst(const List* pList, u16 n) { + return List_GetNth(pList, n); +} + +inline void* List_GetFirst(const List* pList) { + return List_GetNext(pList, NULL); +} +inline const void* List_GetFirstConst(const List* pList) { + return List_GetFirst(pList); +} + +inline void* List_GetLast(const List* pList) { + return List_GetPrev(pList, NULL); +} +inline const void* List_GetLastConst(const List* pList) { + return List_GetLast(pList); +} + +inline u16 List_GetSize(const List* pList) { + return pList->numObjects; +} + +/****************************************************************************** + * + * Macros + * + ******************************************************************************/ +/** + * Declares a member Link. + */ +#define NW4R_UT_LIST_LINK_DECL() nw4r::ut::Link link + +/** + * Initializes a List object for use with the specified type. + * + * @param LIST Reference to list + * @param T List element type + */ +#define NW4R_UT_LIST_INIT(LIST, T) \ + nw4r::ut::List_Init(&(LIST), offsetof(T, link)) + +/** + * Gets the underlying Link within the specified object. + * + * @param LIST Reference to list + * @param OBJ Pointer to list object + */ +#define NW4R_UT_LIST_GET_LINK(LIST, OBJ) \ + reinterpret_cast((u8*)(OBJ) + (LIST).offset) + +/** + * List for-each macro. + * + * @param TYPE Element type + * @param NAME Element name + * @param LIST Reference to list + * @param ... Statement(s) to execute + */ +#define NW4R_UT_LIST_FOREACH(TYPE, NAME, LIST, ...) \ + { \ + TYPE* NAME = NULL; \ + \ + while ((NAME = static_cast( \ + nw4r::ut::List_GetNext(&(LIST), NAME))) != NULL) { \ + \ + __VA_ARGS__; \ + } \ + } +/** + * List for-each macro (reverse order). + * + * @param TYPE Element type + * @param NAME Element name + * @param LIST Reference to list + * @param ... Statement(s) to execute + */ +#define NW4R_UT_LIST_FOREACH_REV(TYPE, NAME, LIST, ...) \ + { \ + TYPE* NAME = NULL; \ + \ + while ((NAME = static_cast( \ + nw4r::ut::List_GetPrev(&(LIST), NAME))) != NULL) { \ + \ + __VA_ARGS__; \ + } \ + } + +/** + * List for-each macro, with robust iteration. + * + * @param TYPE Element type + * @param NAME Element name + * @param LIST Reference to list + * @param ... Statement(s) to execute + */ +#define NW4R_UT_LIST_FOREACH_SAFE(TYPE, NAME, LIST, ...) \ + { \ + TYPE* NAME; \ + TYPE* __next__; \ + \ + for (NAME = static_cast(nw4r::ut::List_GetFirst(&(LIST))); \ + NAME != NULL; NAME = __next__) { \ + \ + __next__ = \ + static_cast(nw4r::ut::List_GetNext(&(LIST), NAME)); \ + \ + __VA_ARGS__; \ + } \ + } + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_lock.h b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_lock.h new file mode 100644 index 0000000000..dac1ef91cb --- /dev/null +++ b/include/lib/BrawlHeaders/nw4r/include/nw4r/ut/ut_lock.h @@ -0,0 +1,64 @@ +#ifndef NW4R_UT_LOCK_H +#define NW4R_UT_LOCK_H +#include + +#include + +#include + +namespace nw4r { +namespace ut { +namespace detail { + +/****************************************************************************** + * + * Mutex lock functions + * + ******************************************************************************/ +inline void Lock(OSMutex& rMutex) { + OSLockMutex(&rMutex); +} +inline void Unlock(OSMutex& rMutex) { + OSUnlockMutex(&rMutex); +} + +/****************************************************************************** + * + * AutoLock + * + ******************************************************************************/ +template class AutoLock : private NonCopyable { +public: + explicit AutoLock(T& rLockObj) : mLockObj(rLockObj) { + Lock(mLockObj); + } + ~AutoLock() { + Unlock(mLockObj); + } + +private: + T& mLockObj; // at 0x0 +}; + +} // namespace detail + +/****************************************************************************** + * + * AutoInterruptLock + * + ******************************************************************************/ +class AutoInterruptLock : private NonCopyable { +public: + AutoInterruptLock() : mOldState(OSDisableInterrupts()) {} + ~AutoInterruptLock() { + OSRestoreInterrupts(mOldState); + } + +private: + BOOL mOldState; // at 0x0 +}; + +} // namespace ut +} // namespace nw4r + +#endif diff --git a/include/lib/BrawlHeaders/std/Include/__mem.h b/include/lib/BrawlHeaders/std/Include/__mem.h new file mode 100644 index 0000000000..0e50603903 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/__mem.h @@ -0,0 +1,3 @@ +#pragma once + +int strlen(const char* str); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/extras.h b/include/lib/BrawlHeaders/std/Include/extras.h new file mode 100644 index 0000000000..ac78965237 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/extras.h @@ -0,0 +1,5 @@ +#pragma once + +#include "types.h" + +void itoa(int value, char* str, int base); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/map.h b/include/lib/BrawlHeaders/std/Include/map.h new file mode 100644 index 0000000000..430b7f2d6a --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/map.h @@ -0,0 +1,136 @@ +#pragma once + +#include + +/** + * @brief A simple key-value map implementation. + * + * @note The insertion order of the items in the map is not preserved + */ +template +class Map { +private: + struct Pair { + Key key; + Value value; + + Pair() {} + Pair(const Key& k, const Value& v) : key(k), value(v) {} + }; + + Vector pairs; + +public: + Map() {} + + /** + * @brief Inserts a key-value pair into the map. + * + * If the key already exists, the value is updated. + * + * @param key The key to insert. + * @param value The value to associate with the key. + */ + void insert(const Key& key, const Value& value) + { + for (int i = 0; i < pairs.size(); i++) + { + if (pairs[i].key == key) + { + pairs[i].value = value; + return; + } + } + pairs.push(Pair(key, value)); + } + + /** + * @brief Finds the value associated with a key in the map. + */ + Value* find(const Key& key) + { + for (int i = 0; i < pairs.size(); i++) + { + if (pairs[i].key == key) + { + return &pairs[i].value; + } + } + return NULL; + } + + /** + * @brief Removes a key-value pair from the map. + * + * @param key The key of the pair to remove. + * @return true if the pair was removed, false otherwise. + */ + bool remove(const Key& key) + { + for (int i = 0; i < pairs.size(); i++) + { + if (pairs[i].key == key) + { + pairs[i] = pairs[pairs.size() - 1]; + pairs.pop(); + return true; + } + } + return false; + } + + /** + * @brief Returns whether a specified key is present in the map + * + * @param key The key to search for. + * @return true if the key is found, false otherwise. + */ + bool contains(const Key& key) const + { + for (int i = 0; i < pairs.size(); i++) + { + if (pairs[i].key == key) + { + return true; + } + } + return false; + } + + /** + * @brief Returns the number of items in the map. + */ + int size() const + { + return pairs.size(); + } + + /** + * @brief Returns whether the map is empty. + */ + bool empty() const + { + return pairs.size() == 0; + } + + /** + * @brief Clears the map of all entries + */ + void clear() + { + pairs.clear(); + } + + Value& operator[](const Key& key) + { + for (int i = 0; i < pairs.size(); i++) + { + if (pairs[i].key == key) + { + return pairs[i].value; + } + } + pairs.push(Pair(key, Value())); + return pairs[pairs.size() - 1].value; + } +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/string.h b/include/lib/BrawlHeaders/std/Include/string.h new file mode 100644 index 0000000000..0d30636899 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/string.h @@ -0,0 +1,64 @@ +#pragma once + +#include "__mem.h" +#include "extras.h" +#include "stddef.h" +#include "strtoul.h" +#include "types.h" + +class String { + const char* m_string; + +public: + int strcmp(const String str2); + static String strncpy(String destination, const char* source, size_t num); + + inline String(const char* ss) + { + m_string = ss; + }; + + // bool operator==(const String str2); + + inline String operator[](const u32 index) + { + String out = " "; + return strncpy(out, &m_string[index], 1); + }; + + inline int length() + { + return strlen(m_string); + } + inline int stoi() + { + return atoi(m_string); + }; + + template + inline static String to_string(int ii) + { + char ss[I]; + itoa(ii, ss, 10); + String scoreStr(ss); + return scoreStr; + }; +}; + +#ifdef __cplusplus +extern "C" { +#endif +char* strcat(char* output, const char* append); +char* strchr(char* str, int character); +char* strcpy(char* destination, const char* source); +int strcmp(const char* str1, const char* str2); +size_t strcspn(const char* str1, const char* str2); +char* strncat(char* output, const char* append, size_t num); +int strncmp(const char* str1, const char* str2, size_t num); +char* strncpy(char* destination, const char* source, size_t num); +char* strrchr(const char* str, int character); +char* strstr(const char* haystack, const char* needle); +char* strtok(char* str, const char* delimiters); +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/strtoul.h b/include/lib/BrawlHeaders/std/Include/strtoul.h new file mode 100644 index 0000000000..61adbaf430 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/strtoul.h @@ -0,0 +1,5 @@ +#pragma once + +#include "types.h" + +int atoi(const char* str); \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/types.h b/include/lib/BrawlHeaders/std/Include/types.h new file mode 100644 index 0000000000..f236f7c516 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/types.h @@ -0,0 +1,14 @@ +typedef unsigned long u64; +typedef signed long s64; + +typedef unsigned int u32; +typedef signed int s32; + +typedef unsigned short u16; +typedef signed short s16; + +typedef unsigned char u8; +typedef signed char s8; + +typedef float f32; +typedef double f64; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/std/Include/vector.h b/include/lib/BrawlHeaders/std/Include/vector.h new file mode 100644 index 0000000000..9938002cc4 --- /dev/null +++ b/include/lib/BrawlHeaders/std/Include/vector.h @@ -0,0 +1,139 @@ +#pragma once + +#include +#include +#include + +template +class Vector { + + // arr is the integer pointer + // which stores the address of our vector + T* arr; + + // capacity is the total storage + // capacity of the vector + int capacity; + + // current is the number of elements + // currently present in the vector + int current; + + HeapType heapType; + +public: + Vector() + { + this->heapType = Heaps::Tmp; + arr = new (heapType) T[1]; + capacity = 1; + current = 0; + } + + Vector(HeapType heapType) + { + this->heapType = heapType; + arr = new (heapType) T[1]; + capacity = 1; + current = 0; + } + + ~Vector() + { + delete[] arr; + } + + /** + * Clears the vector. + */ + void clear() + { + delete[] arr; + arr = new (heapType) T[1]; + current = 0; + } + + /** + * Removes an element at a specific index. + * + * @param index The index of the element to remove. + */ + void removeAt(int index) + { + if (index < 0 || index >= current) + return; + + arr[index] = arr[current - 1]; + pop(); + } + + // Function to add an element at the last + void push(T data) + { + + // if the number of elements is equal to the + // capacity, that means we don't have space to + // accommodate more elements. We need to double the + // capacity + if (current == capacity) + { + T* temp = new (heapType) T[2 * capacity]; + + // copying old array elements to new array + for (int i = 0; i < capacity; i++) + { + temp[i] = arr[i]; + } + + // deleting previous array + delete[] arr; + capacity *= 2; + arr = temp; + } + + // Inserting data + arr[current] = data; + current++; + } + + // function to add element at any index + void push(T data, int index) + { + + // if index is equal to capacity then this + // function is same as push defined above + if (index == capacity) + { + push(data); + } + else + { + arr[index] = data; + current++; + } + } + + // function to extract element at any index + T get(int index) + { + // if index is within the range + if (index < current) + return arr[index]; + + return NULL; + } + + // function to delete last element + void pop() { current--; } + + // function to get size of the vector + int size() const { return current; } + + // function to get capacity of the vector + int getcapacity() { return capacity; } + + T& operator[](int index) + { + return arr[index]; + } +}; \ No newline at end of file diff --git a/include/lib/BrawlHeaders/utils/include/StaticAssert.h b/include/lib/BrawlHeaders/utils/include/StaticAssert.h new file mode 100644 index 0000000000..a58b475350 --- /dev/null +++ b/include/lib/BrawlHeaders/utils/include/StaticAssert.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +#ifdef __MWERKS__ +#define static_assert(cond, msg) __static_assert(cond, msg) +#endif + +template +struct CompileTimeError; +template <> +struct CompileTimeError { +}; + +#define UNIQUE_NAME(base) CONCAT(base, __LINE__) + +#define STATIC_CHECK(expr) \ + inline void UNIQUE_NAME(StaticCheck)() \ + { \ + ((void)CompileTimeError<(expr) != 0>()); \ + } + +#define PRINT_SIZEOF(typename) \ + inline void UNIQUE_NAME(PrintSizeOf)() \ + { \ + char(*__kaboom)[sizeof(typename)] = 1; \ + } diff --git a/include/lib/BrawlHeaders/utils/include/platform.h b/include/lib/BrawlHeaders/utils/include/platform.h new file mode 100644 index 0000000000..b977928822 --- /dev/null +++ b/include/lib/BrawlHeaders/utils/include/platform.h @@ -0,0 +1,11 @@ +/** + * Platform specific macros, defines, and behavior + */ + +#pragma once + +#ifdef __MWERKS__ +#define ASM asm +#else +#define ASM +#endif \ No newline at end of file