Skip to content

Commit

Permalink
Improve rumble detection
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Aug 30, 2024
1 parent 2e7661e commit 68a14ad
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions universal/source/common/my_rumble.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool my_isRumbleInserted(void) {
//---------------------------------------------------------------------------------
//sysSetCartOwner(BUS_OWNER_ARM9);
// First, make sure DLDI is Slot-1
if ((io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA) || *(u16*)0x020000C0 != 0 || *(vu16*)0x08240000 == 1 || GBA_BUS[0] == 0xFFFE || GBA_BUS[1] == 0xFFFF) {
if ((io_dldi_data->ioInterface.features & FEATURE_SLOT_GBA) || *(u16*)0x020000C0 != 0 || *(vu16*)0x08240000 == 1) {
return false;
}
// Then, check for 0x96 to see if it's a GBA game or flashcart
Expand All @@ -44,11 +44,17 @@ bool my_isRumbleInserted(void) {
return true;
} else {
rumbleType = MY_RUMBLE;
for (int i = 0; i < 10000; i++) { // Run 10000 times to make sure it works
for (int p = 0; p < 0x1000/2; p++) {
if (GBA_BUS[1+(p*2)] == 0xFFFD) {
return true;
}

// Check for DS Phat Rumble Pak
for (int i = 0; i < 0xFFF; i++) {
if (GBA_BUS[i] != 0xFFFD) {
return true;
}
}
// Check for DS Lite Rumble Pak
for (int i = 0; i < 0xFFF; i++) {
if (GBA_BUS[i] != 0xFDFF) {
return true;
}
}
}
Expand All @@ -57,11 +63,9 @@ bool my_isRumbleInserted(void) {
//---------------------------------------------------------------------------------
void my_setRumble(bool position) {
//---------------------------------------------------------------------------------

if ( rumbleType == MY_WARIOWARE) {
if (rumbleType == MY_WARIOWARE) {
WARIOWARE_PAK = (position ? 8 : 0);
} else {
RUMBLE_PAK = (position ? 2 : 0);
}

}

0 comments on commit 68a14ad

Please sign in to comment.