Compare commits

..

23 Commits

Author SHA1 Message Date
coah
6058380058 refine kpad ring buffer matching 2026-09-29 00:04:23 +00:00
coah
4fae302820 match kpad ring buffer traversal 2026-09-29 00:04:23 +00:00
coah
9315a8de10 name kpad calibration fields 2026-09-29 00:04:23 +00:00
coah
062528fb93 clean kpad field names and match repeat setup 2026-09-29 00:04:23 +00:00
coah
9873974f98 align kpad horizon calculation order 2026-09-29 00:04:23 +00:00
coah
5b766e5a4e match kpad probe type dispatch 2026-09-29 00:04:23 +00:00
coah
3104e36858 align kpad init field order 2026-09-29 00:04:23 +00:00
coah
6fd0f8668a match kpad init ring defaults 2026-09-29 00:04:23 +00:00
coah
9fa5af757a refine kpad acceleration format dispatch 2026-09-29 00:04:23 +00:00
coah
66b6256f7f align kpad device sample handling 2026-09-29 00:04:23 +00:00
coah
b8aec37737 preserve dpd sample words 2026-09-29 00:04:23 +00:00
coah
7805572f92 match kpad pointer based dpd scans 2026-09-29 00:04:23 +00:00
coah
49b7ac975c match kpad object candidate loops 2026-09-29 00:04:23 +00:00
coah
e7e6893f97 refine kpad first object selection 2026-09-29 00:04:23 +00:00
coah
b09f4f894f refine kpad acceleration clamps 2026-09-29 00:04:23 +00:00
coah
13256cea1e restore probe callback branch 2026-09-29 00:04:23 +00:00
coah
eb43b4c364 match kpad sampling branches 2026-09-29 00:04:23 +00:00
coah
a16a81e807 restore kpad sample history processing 2026-09-29 00:04:23 +00:00
coah
e7cf0c0675 refine kpad ring buffer matching 2026-09-29 00:04:23 +00:00
coah
4266c0ee92 model kpad sample fields 2026-09-29 00:04:23 +00:00
coah
85a3e8c605 decompile kpad unit 2026-09-29 00:04:23 +00:00
coah
094cfd811e Link iplController and iplControllerManager (#242)
* link iplController translation unit

* match controller manager read flow

* link iplControllerManager translation unit
2026-09-28 18:56:01 -05:00
coah
c98c2010b2 Split iplController into its two real units and decompile its asm (#241)
* decompile controller asm bodies

* model controller inheritance

* decompile controller leaf destructors

* split iplController into controller and manager units, decompile the asm

* fix controller manager readability
2026-09-28 18:24:09 -05:00
5 changed files with 1924 additions and 11 deletions

View File

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

View File

@@ -63,10 +63,14 @@ namespace ipl {
// clang-format on
#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
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature implementation
#else
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#endif
#endif
class Interface {
public:
@@ -79,7 +83,7 @@ namespace ipl {
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinch() 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 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 rumble(int type = 0), { return FALSE; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void cancelRumbling(), { })

1824
libs/RVL_SDK/src/kpad/KPAD.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,9 @@
#define IPL_CONTROLLER_NATIVE_HIERARCHY
#define IPL_CONTROLLER_INLINE_INTERFACE
#define IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#include "system/iplController.h"
#undef IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#undef IPL_CONTROLLER_INLINE_INTERFACE
#undef IPL_CONTROLLER_NATIVE_HIERARCHY
#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 {
return unk_0x08 == 5;
}
@@ -325,9 +342,15 @@ namespace ipl {
bool ipl::controller::Master::upTrg(u32 button) const {
return call(button, kUpTrgMember);
}
bool ipl::controller::Interface::upTrg(u32 button) const {
return false;
}
bool ipl::controller::Master::repeat(u32 button) const {
return call(button, kRepeatMember);
}
bool ipl::controller::Interface::repeat(u32 button) const {
return false;
}
int ipl::controller::Master::decide() const {
bool current = false;
bool ret = false;
@@ -365,6 +388,71 @@ void ipl::controller::Master::setForceInvalid(bool flag) {
}
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) {
unk_0x1C = flag;
}

View File

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