Compare commits

...

3 Commits

Author SHA1 Message Date
coah
599d41bda7 link iplControllerManager translation unit 2026-09-28 23:50:54 +00:00
coah
782983dfe1 match controller manager read flow 2026-09-28 23:49:46 +00:00
coah
cc2887e52e link iplController translation unit 2026-09-28 23:44:05 +00:00
4 changed files with 100 additions and 11 deletions

View File

@@ -624,8 +624,8 @@ config.libs = [
Object(Matching, "system/rvl_dec.c"), Object(Matching, "system/rvl_dec.c"),
Object(Matching, "system/RIPL_BoardRecord.c"), Object(Matching, "system/RIPL_BoardRecord.c"),
Object(Matching, "system/iplSystem.cpp"), Object(Matching, "system/iplSystem.cpp"),
Object(NonMatching, "system/iplController.cpp"), Object(Matching, "system/iplController.cpp"),
Object(NonMatching, "system/iplControllerManager.cpp"), Object(Matching, "system/iplControllerManager.cpp"),
Object(Matching, "system/iplChannelManager.cpp"), Object(Matching, "system/iplChannelManager.cpp"),
Object(Matching, "system/iplChannelScriptManager.cpp"), Object(Matching, "system/iplChannelScriptManager.cpp"),
Object(Matching, "system/iplNand.cpp"), Object(Matching, "system/iplNand.cpp"),

View File

@@ -63,10 +63,14 @@ namespace ipl {
// clang-format on // clang-format on
#ifdef IPL_CONTROLLER_NATIVE_HIERARCHY #ifdef IPL_CONTROLLER_NATIVE_HIERARCHY
#ifdef IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#else
#ifdef IPL_CONTROLLER_INLINE_INTERFACE #ifdef IPL_CONTROLLER_INLINE_INTERFACE
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature implementation #define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature implementation
#else #else
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature; #define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#endif
#endif #endif
class Interface { class Interface {
public: public:
@@ -79,7 +83,7 @@ namespace ipl {
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinch() const, { return 0; }) IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinch() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchTrg() const, { return 0; }) IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchTrg() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchOffTrg() const, { return 0; }) IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchOffTrg() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int decide() const, { return 0; }) virtual int decide() const = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool repeat(u32 button) const, { return false; }) IPL_CONTROLLER_DEFAULT_VIRTUAL(bool repeat(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(BOOL rumble(int type = 0), { return FALSE; }) IPL_CONTROLLER_DEFAULT_VIRTUAL(BOOL rumble(int type = 0), { return FALSE; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void cancelRumbling(), { }) IPL_CONTROLLER_DEFAULT_VIRTUAL(void cancelRumbling(), { })

View File

@@ -18,7 +18,9 @@
#define IPL_CONTROLLER_NATIVE_HIERARCHY #define IPL_CONTROLLER_NATIVE_HIERARCHY
#define IPL_CONTROLLER_INLINE_INTERFACE #define IPL_CONTROLLER_INLINE_INTERFACE
#define IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#include "system/iplController.h" #include "system/iplController.h"
#undef IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#undef IPL_CONTROLLER_INLINE_INTERFACE #undef IPL_CONTROLLER_INLINE_INTERFACE
#undef IPL_CONTROLLER_NATIVE_HIERARCHY #undef IPL_CONTROLLER_NATIVE_HIERARCHY
#include "system/iplSystem.h" #include "system/iplSystem.h"
@@ -91,6 +93,21 @@ namespace ipl {
} }
} }
} }
bool ipl::controller::Interface::isValidBtn() const {
return false;
}
bool ipl::controller::Interface::downTrg(u32 button) const {
return false;
}
int ipl::controller::Interface::pinch() const {
return 0;
}
bool ipl::controller::Interface::down(u32 button) const {
return false;
}
KPADStatus* ipl::controller::Interface::getKPADStatus() const {
return NULL;
}
int ipl::controller::Base::decide() const { int ipl::controller::Base::decide() const {
return unk_0x08 == 5; return unk_0x08 == 5;
} }
@@ -325,9 +342,15 @@ namespace ipl {
bool ipl::controller::Master::upTrg(u32 button) const { bool ipl::controller::Master::upTrg(u32 button) const {
return call(button, kUpTrgMember); return call(button, kUpTrgMember);
} }
bool ipl::controller::Interface::upTrg(u32 button) const {
return false;
}
bool ipl::controller::Master::repeat(u32 button) const { bool ipl::controller::Master::repeat(u32 button) const {
return call(button, kRepeatMember); return call(button, kRepeatMember);
} }
bool ipl::controller::Interface::repeat(u32 button) const {
return false;
}
int ipl::controller::Master::decide() const { int ipl::controller::Master::decide() const {
bool current = false; bool current = false;
bool ret = false; bool ret = false;
@@ -365,6 +388,71 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
} }
return ret; return ret;
} }
void ipl::controller::Interface::read() {}
int ipl::controller::Interface::getSubStickY() const {
return 0;
}
int ipl::controller::Interface::getSubStickX() const {
return 0;
}
int ipl::controller::Interface::getMainStickY() const {
return 0;
}
int ipl::controller::Interface::getMainStickX() const {
return 0;
}
bool ipl::controller::Interface::isValidDpd() const {
return false;
}
PADStatus* ipl::controller::Interface::getPADStatus() const {
return NULL;
}
f32 ipl::controller::Interface::getDpdDistance() const {
return 0.0f;
}
ipl::math::VEC2 ipl::controller::Interface::getHorizon() const {
return ipl::math::VEC2(0.0f, 0.0f);
}
ipl::math::VEC2 ipl::controller::Interface::getDpdProjectionPos() const {
return ipl::math::VEC2(0.0f, 0.0f);
}
ipl::math::VEC2 ipl::controller::Interface::getDpdPos() const {
return ipl::math::VEC2(0.0f, 0.0f);
}
int ipl::controller::Interface::getClassicReleaseFlag() const {
return 0;
}
int ipl::controller::Interface::getClassicTrigFlag() const {
return 0;
}
int ipl::controller::Interface::getClassicHoldFlag() const {
return 0;
}
int ipl::controller::Interface::getReleaseFlag() const {
return 0;
}
int ipl::controller::Interface::getTrigFlag() const {
return 0;
}
int ipl::controller::Interface::getHoldFlag() const {
return 0;
}
void ipl::controller::Interface::cancelRumbling() {}
BOOL ipl::controller::Interface::rumble(int type) {
return FALSE;
}
int ipl::controller::Interface::pinchOffTrg() const {
return 0;
}
int ipl::controller::Interface::pinchTrg() const {
return 0;
}
int ipl::controller::Interface::getChannel() const {
return -1;
}
int ipl::controller::Interface::getType() const {
return -1;
}
void ipl::controller::Base::setForceInvalid(bool flag) { void ipl::controller::Base::setForceInvalid(bool flag) {
unk_0x1C = flag; unk_0x1C = flag;
} }

View File

@@ -98,11 +98,7 @@ namespace ipl {
probe_valid: probe_valid:
{ {
s32 read = KPADRead(chan, &mKPADStatus[chan], 1); s32 read = KPADRead(chan, &mKPADStatus[chan], 1);
if (read > 0) { if (read > 0 && mKPADStatus[chan].wpad_err != -4 && deviceType != 0xfd) {
if (mKPADStatus[chan].wpad_err == -4 || deviceType == 0xfd) {
goto store_null;
}
mInvalidCount[chan] = 0; mInvalidCount[chan] = 0;
if (mKPADStatus[chan].wpad_err == -7 || deviceType == 0 || deviceType == 0xfb || if (mKPADStatus[chan].wpad_err == -7 || deviceType == 0 || deviceType == 0xfb ||
deviceType == 0xfc || deviceType == 0xff) { deviceType == 0xfc || deviceType == 0xff) {
@@ -120,7 +116,10 @@ namespace ipl {
} else { } else {
mControllers[chan] = NULL; mControllers[chan] = NULL;
} }
} else if (read == 0) { } else {
if (read != 0) {
goto store_null;
}
mInvalidCount[chan]++; mInvalidCount[chan]++;
if (mInvalidCount[chan] > 0x3c) { if (mInvalidCount[chan] > 0x3c) {
mInvalidCount[chan] = 0x3c; mInvalidCount[chan] = 0x3c;
@@ -129,8 +128,6 @@ namespace ipl {
} }
mControllers[chan] = NULL; mControllers[chan] = NULL;
} }
} else {
goto store_null;
} }
} }
goto channel_done; goto channel_done;