diff options
| author | TakaRikka <takarikka@outlook.com> | 2022-05-28 03:49:55 -0700 |
|---|---|---|
| committer | TakaRikka <takarikka@outlook.com> | 2022-05-28 03:49:55 -0700 |
| commit | 36e62e0b80225b6ef6cbe6a7322397899d3a0ffd (patch) | |
| tree | 78f9950298acfc601001a0da4ab9d46cd04d6de2 /include/JSystem | |
| parent | 9bcbccbeb5966896e10b9f29cc4c69bc49abe20d (diff) | |
npcT / JUTGamePad work
Diffstat (limited to 'include/JSystem')
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DJoint.h | 13 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h | 8 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DModel.h | 1 | ||||
| -rw-r--r-- | include/JSystem/J3DGraphAnimator/J3DModelData.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JSupport/JSUList.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTGamePad.h | 112 |
6 files changed, 89 insertions, 51 deletions
diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index 28cc3b92f0..b0f77631dd 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJoint.h +++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h @@ -19,7 +19,7 @@ public: /* 80014E94 */ virtual bool getAnmTransform(u8); /* 80014EA4 */ virtual void setWeight(u8, f32); /* 80014EA8 */ virtual void getWeight(u8) const; - virtual void init(Vec const&, Mtx*) = 0; + virtual void init(Vec const& param_0, Mtx*) = 0; virtual void calc() = 0; static J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; } @@ -34,8 +34,14 @@ public: /* 8000FA8C */ virtual ~J3DMtxCalcNoAnmBase(); }; -template <typename A, typename B> -class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase, public A, public B {}; +template <class A, class B> +class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase, public A, public B { +public: + J3DMtxCalcNoAnm() {} + virtual ~J3DMtxCalcNoAnm() {} + virtual void init(Vec const& param_0, f32 const (¶m_1)[3][4]); + virtual void calc(); +}; class J3DJoint; typedef int (*J3DJointCallBack)(J3DJoint*, int); @@ -53,6 +59,7 @@ public: J3DJoint* getYounger() { return mYounger; } void setYounger(J3DJoint* pYounger) { mYounger = pYounger; } void setCurrentMtxCalc(J3DMtxCalc* pMtxCalc) { mCurrentMtxCalc = pMtxCalc; } + J3DTransformInfo& getTransformInfo() { return mTransformInfo; } static J3DMtxCalc* mCurrentMtxCalc; diff --git a/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h b/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h index 5802a1040b..d635b91979 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h +++ b/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h @@ -15,10 +15,10 @@ class J3DMaterialTable { public: /* 8032F5A8 */ void clear(); /* 8032F5D0 */ J3DMaterialTable(); - /* 8032F64C */ bool removeMatColorAnimator(J3DAnmColor*); - /* 8032F6F8 */ void removeTexNoAnimator(J3DAnmTexPattern*); - /* 8032F7B4 */ void removeTexMtxAnimator(J3DAnmTextureSRTKey*); - /* 8032F880 */ void removeTevRegAnimator(J3DAnmTevRegKey*); + /* 8032F64C */ int removeMatColorAnimator(J3DAnmColor*); + /* 8032F6F8 */ int removeTexNoAnimator(J3DAnmTexPattern*); + /* 8032F7B4 */ int removeTexMtxAnimator(J3DAnmTextureSRTKey*); + /* 8032F880 */ int removeTevRegAnimator(J3DAnmTevRegKey*); /* 8032F9C0 */ void createTexMtxForAnimator(J3DAnmTextureSRTKey*); /* 8032FAF4 */ void entryMatColorAnimator(J3DAnmColor*); /* 8032FBC8 */ void entryTexNoAnimator(J3DAnmTexPattern*); diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 26c7ec72a2..fbd0a35597 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -68,6 +68,7 @@ public: Mtx33* getBumpMtxPtr(int idx) const { return mMtxBuffer->getBumpMtxPtr(idx); } Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); } void setBaseScale(const Vec& scale) { mBaseScale = scale; } + void setUserArea(u32 area) { mUserArea = area; } // is there a better way to handle inlines with same name as non-inlines? MtxP i_getAnmMtx(int p1) { return mMtxBuffer->getAnmMtx(p1); } diff --git a/include/JSystem/J3DGraphAnimator/J3DModelData.h b/include/JSystem/J3DGraphAnimator/J3DModelData.h index 56b896c926..1bca78e0bf 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -43,6 +43,10 @@ public: bool checkFlag(u32 flag) const { return !!(mFlags & flag); } bool checkBumpFlag() const { return mbHasBumpArray; } bool checkBBoardFlag() const { return mbHasBillboard == 1; } + int removeTexNoAnimator(J3DAnmTexPattern* anm) { return mMaterialTable.removeTexNoAnimator(anm); } + int removeTexMtxAnimator(J3DAnmTextureSRTKey* anm) { return mMaterialTable.removeTexMtxAnimator(anm); } + int removeTevRegAnimator(J3DAnmTevRegKey* anm) { return mMaterialTable.removeTevRegAnimator(anm); } + int removeMatColorAnimator(J3DAnmColor* anm) { return mMaterialTable.removeMatColorAnimator(anm); } private: /* 0x04 */ void* mpRawData; diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h index b0bbdd4fb9..c1deabae92 100644 --- a/include/JSystem/JSupport/JSUList.h +++ b/include/JSystem/JSupport/JSUList.h @@ -52,7 +52,6 @@ public: class JSUPtrList { public: JSUPtrList() { this->initiate(); } - JSUPtrList(bool init); ~JSUPtrList(); @@ -80,7 +79,6 @@ template <typename T> class JSUList : public JSUPtrList { public: JSUList() : JSUPtrList() {} - JSUList(bool init) : JSUPtrList(init) {} ~JSUList() {} diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h index e1b9639df1..b25321d731 100644 --- a/include/JSystem/JUtility/JUTGamePad.h +++ b/include/JSystem/JUtility/JUTGamePad.h @@ -29,26 +29,25 @@ enum { extern bool struct_80451500; extern bool struct_80451501; // sResetOccured +struct JUTGamePadRecordBase { + virtual void unk0() {} + virtual void unk1(PADStatus* pad) {} + virtual void unk2() {} + + /* 0x4 */ bool mActive; +}; + struct JUTGamePad : public JKRDisposer { public: - // TODO: fix types - // static JSUList<JUTGamePad> mPadList; - static u8 mPadList[12]; - static PADStatus mPadStatus[4]; - static u8 mPadButton[192]; - static u8 mPadMStick[64]; - static u8 mPadSStick[64]; - static u32 sStickMode; - static u32 sClampMode; - static u8 mPadAssign[4]; - static u8 sSuppressPadReset[4]; - static s32 sAnalogMode; - static u32 sRumbleSupported; - - enum EStickMode {}; - enum EWhichStick {}; + enum EStickMode { + STICK_MODE_1 = 1, + }; + enum EWhichStick { + WS_MAIN_STICK, + WS_SUB_STICK, + }; enum EPadPort { - Port_Unknown = -1, // used by JUTException + Port_Unknown = -1, Port_1, Port_2, Port_3, @@ -61,15 +60,15 @@ public: void initList(); static s32 init(); void clear(); - static void read(); + static u32 read(); void assign(); - void checkResetCallback(OSTime unk); // todo: weird arg + void checkResetCallback(OSTime unk); void update(); void stopPatternedRumble() { mRumble.stopPatternedRumble(mPortNum); } static void checkResetSwitch(); static void clearForReset(); static JUTGamePad* getGamePad(int pad_index); - static bool recalibrate(/*PADMask*/ u32 pad_mask); + static bool recalibrate(u32 pad_mask); static void setAnalogMode(u32 mode) { sAnalogMode = mode; @@ -112,6 +111,12 @@ public: u8 getAnalogR() const { return mButton.mAnalogR; } s8 getErrorStatus() const { return mErrorStatus; } + + s16 getPortNum() const { return mPortNum; } + + JUTGamePadRecordBase* getPadReplay() const { return mPadReplay; } + + JUTGamePadRecordBase* getPadRecord() const { return mPadRecord; } u32 testTrigger(u32 button) const { return mButton.mTrigger & button; } @@ -124,12 +129,14 @@ public: return isPushingReset; } + void stopMotorHard() { mRumble.stopMotorHard(mPortNum); } + static s8 getPortStatus(u32 port) { return mPadStatus[port].error; } struct CButton { - CButton(); // inline + CButton() { clear(); } void clear(); - u32 update(PADStatus const*, u32 unk); + void update(PADStatus const*, u32 unk); void setRepeat(u32 unk0, u32 unk1, u32 unk2); /* 0x00 */ u32 mButton; @@ -150,7 +157,8 @@ public: }; // Size: 0x30 struct C3ButtonReset { - // TODO: fix types + C3ButtonReset() { mReset = false; } + static u32 sResetPattern; static u32 sResetMaskPattern; static callbackFn sCallback; @@ -165,7 +173,7 @@ public: static f32 sPressPoint; static f32 sReleasePoint; - CStick(); // inline + CStick() { clear(); } void clear(); void clear(JUTGamePad* pad); u32 update(s8 unk0, s8 unk1, JUTGamePad::EStickMode mode, JUTGamePad::EWhichStick stick, @@ -183,6 +191,8 @@ public: void stopMotorWaveHard() { mRumble.stopPatternedRumble(mPortNum); } struct CRumble { + CRumble(JUTGamePad* pad) { clear(pad); } + static PADMask sChannelMask[4]; static bool mStatus[4]; static PADMask mEnabled; @@ -204,6 +214,11 @@ public: void stopPatternedRumbleAtThePeriod(); static void setEnabled(u32 pad_mask); + void stopMotorHard(int portNo) { stopMotor(portNo, true); } + + static bool isEnabled(u32 mask) { return mEnabled & mask; } + static bool isEnabledPort(int port) { return isEnabled(sChannelMask[port]); } + /* 0x00 */ u32 field_0x0; /* 0x04 */ u32 field_0x4; /* 0x08 */ u8* field_0x8; @@ -218,32 +233,45 @@ public: /* 0x7C */ s16 mPortNum; /* 0x7E */ s8 mErrorStatus; /* 0x80 */ JSULink<JUTGamePad> mLink; - /* 0x90 */ u32 mPadRecord; - /* 0x94 */ u32 mPadReplay; + /* 0x90 */ JUTGamePadRecordBase* mPadRecord; + /* 0x94 */ JUTGamePadRecordBase* mPadReplay; /* 0x98 */ C3ButtonReset mButtonReset; /* 0x9C */ u8 field_0x9c[4]; /* 0xA0 */ OSTime mResetTime; /* 0xA8 */ u8 field_0xa8; - friend class CRumble; + static JSUList<JUTGamePad> mPadList; + static bool mListInitialized; + static PADStatus mPadStatus[4]; + static CButton mPadButton[4]; + static CStick mPadMStick[4]; + static CStick mPadSStick[4]; + static EStickMode sStickMode; + static u32 sClampMode; + static u8 mPadAssign[4]; + static u32 sSuppressPadReset; + static s32 sAnalogMode; + static u32 sRumbleSupported; }; struct JUTGamePadLongPress { - // TODO: fix type - // static JSUList<JUTGamePadLongPress> sPatternList; - static u8 sPatternList[12]; - void checkCallback(int unk0, u32 unk2); - - u8 unk0[17]; - bool field_0x11; // bool? - u8 unk1[10]; - u32 field_0x1c; - u8 unk2[28]; - u8 field_0x3c; - u8 unk3[11]; - bool field_0x48[4]; // bool[4]? - void (*callback)(s32, JUTGamePadLongPress*, s32); - s32 field_0x50; + static JSUList<JUTGamePadLongPress> sPatternList; + void checkCallback(int port, u32 timer); + + u32 getMaskPattern() const { return mMaskPattern; } + u32 getPattern() const { return mPattern; } + + /* 0x00 */ u8 field_0x0[0x10]; + /* 0x10 */ bool mValid; + /* 0x11 */ bool field_0x11; + /* 0x14 */ u32 mPattern; + /* 0x18 */ u32 mMaskPattern; + /* 0x1C */ u32 field_0x1c; + /* 0x20 */ bool field_0x20[4]; + /* 0x28 */ OSTime mTimer[4]; + /* 0x48 */ bool field_0x48[4]; + /* 0x4C */ void (*mCallback)(s32, JUTGamePadLongPress*, s32); + /* 0x50 */ s32 field_0x50; }; #endif /* JUTGAMEPAD_H */ |
