Skip to content

Commit

Permalink
-added rumble support to both mario kart arcade gp and gp 2
Browse files Browse the repository at this point in the history
  • Loading branch information
FIX94 committed Jun 25, 2016
1 parent f249dee commit 90368c8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/include/NintendontVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __NINTENDONT_VERSION_H__

#define NIN_MAJOR_VERSION 4
#define NIN_MINOR_VERSION 410
#define NIN_MINOR_VERSION 411

#define NIN_VERSION ((NIN_MAJOR_VERSION << 16) | NIN_MINOR_VERSION)

Expand Down
15 changes: 11 additions & 4 deletions kernel/TRI.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "asm/RestoreSettingsVS4EXP.h"
#include "asm/RestoreSettingsVS4V06JAP.h"
#include "asm/RestoreSettingsVS4V06EXP.h"
#include "asm/PADControlMotorGP.h"

static const char *SETTINGS_AX_UNK = "/saves/AX_UNKsettings.bin";
static const char *SETTINGS_AX_RVC = "/saves/AX_RVCsettings.bin";
Expand Down Expand Up @@ -156,7 +157,7 @@ void TRISetupGames()
write32( 0x00328F4, 0x38600000 );

//Disable wheel/handle
write32( 0x007909C, 0x98650022 );
//write32( 0x007909C, 0x98650022 );

//Disable cam
write32( 0x00790A0, 0x98650025 );
Expand Down Expand Up @@ -196,7 +197,10 @@ void TRISetupGames()
//memcpy( (void*)0x036369C, (void*)0x040EB88, 0x3C );

//PAD Hook for control updates
PatchBL(PatchCopy(PADReadGP, PADReadGP_size), 0x3C2A0 );
PatchBL( PatchCopy(PADReadGP, PADReadGP_size), 0x3C2A0 );

// Game specific rumble hook
PatchBL( PatchCopy(PADControlMotorGP, PADControlMotorGP_size), 0x3AA40 );

//some report check skip
//write32( 0x00307CC, 0x60000000 );
Expand All @@ -223,7 +227,7 @@ void TRISetupGames()
write32( 0x002F054, 0x38600000 );

//Disable wheel
write32( 0x0073BD4, 0x98650022 );
//write32( 0x0073BD4, 0x98650022 );

//Disable cam
write32( 0x0073BD8, 0x98650025 );
Expand Down Expand Up @@ -263,7 +267,10 @@ void TRISetupGames()
write32( 0x3F1FD0, 0x00 ); //NTSC Interlaced

//PAD Hook for control updates
PatchBL(PatchCopy(PADReadGP, PADReadGP_size), 0x38A34 );
PatchBL( PatchCopy(PADReadGP, PADReadGP_size), 0x38A34 );

// Game specific rumble hook
PatchBL( PatchCopy(PADControlMotorGP, PADControlMotorGP_size), 0x3717C );

//memcpy( (void*)0x002CE3C, OSReportDM, sizeof(OSReportDM) );
//memcpy( (void*)0x002CE8C, OSReportDM, sizeof(OSReportDM) );
Expand Down
29 changes: 29 additions & 0 deletions kernel/asm/PADControlMotorGP.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <asm.h>

PADControlMotorGP:
#original instruction
lbz %r4, 0x2F(%r31)
#load control motor base into r3
lis %r3, 0x9300
ori %r3, %r3, 0x3010
#start by checking if rumble was active
lbz %r5, 0(%r3)
cmpwi %r5, 0
beq checkRumble
#was active, extend rumble
subi %r5, %r5, 1
stb %r5, 0(%r3)
b rumbleOn
checkRumble:
#was not active so check now
li %r0, 0
cmpwi %r4, 0
beq saveRumble
#did not rumble before, set up
li %r5, 15
stb %r5, 0(%r3)
rumbleOn:
li %r0, 1
saveRumble:
stb %r0, 3(%r3)
blr
Binary file modified loader/loader.dol
Binary file not shown.

0 comments on commit 90368c8

Please sign in to comment.