Adjusted some volatile

This commit is contained in:
silv3rwing07 2020-04-03 19:58:50 -07:00
parent 68f2662048
commit cd3927a77f
2 changed files with 10 additions and 20 deletions

View File

@ -25,12 +25,12 @@ typedef struct {
/* 0x02A9 */ u8 ncontrollers;
/* 0x02AA */ u8 Key_switch[4]; //means the controller is connected
/* 0x02AE */ u8 pak_type[4]; //1 if vibration pack, 2 if (maybe controller pack)?
/* 0x02B2 */ u8 rumble_enable[4];
/* 0x02B2 */ volatile u8 rumble_enable[4];
/* 0x02B6 */ u8 rumble_counter[4]; //not clear exact meaning
/* 0x02BA */ char unk_2BA[0x02]; //probably padding
/* 0x02BC */ unk_controller_t unk_controller[4];
/* 0x045C */ u8 rumble_off_frames;
/* 0x045D */ u8 rumble_on_frames;
/* 0x045C */ volatile u8 rumble_off_frames;
/* 0x045D */ volatile u8 rumble_on_frames;
/* 0x045E */ u8 prenmi_shutdown;
/* 0x045F */ u8 unk_45F;
/* 0x0460 */ void (*unk_460)(void* padmgr, u32 unk464);

View File

@ -209,15 +209,11 @@ void padmgr_RumbleSetSingle(PadMgr* padmgr, u32 ctrlr, u32 rumble) {
// 800A23CC in 1.0
void padmgr_RumbleSet(PadMgr* padmgr, u8* ctrlr_rumbles)
{
//This volatile nonsense is probably not what they wrote--
//padmgr_RumbleSetSingle above is never called and its symbol isn't exported,
//so it looks like that was probably inlined. But we couldn't get any of that
//to work or match. This, however, does match.
s32 i;
for(i=0; i<4; ++i){
*(volatile u8*)&padmgr->rumble_enable[i] = ctrlr_rumbles[i];
padmgr->rumble_enable[i] = ctrlr_rumbles[i];
}
*(volatile u8*)&padmgr->rumble_on_frames = 0xF0;
padmgr->rumble_on_frames = 0xF0;
}
#if 0
@ -312,7 +308,7 @@ void padmgr_HandleRetraceMsg(PadMgr *padmgr) {
queue = padmgr_LockSerialMesgQ(padmgr);
osContStartReadData(queue);
if (padmgr->unk_460 != NULL){
if (padmgr->unk_460){
padmgr->unk_460(padmgr, padmgr->unk_464);
}
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
@ -343,18 +339,12 @@ void padmgr_HandleRetraceMsg(PadMgr *padmgr) {
if (gFaultStruct.msgId){
padmgr_RumbleStop(padmgr);
return;
}
if ((s32)(padmgr->rumble_off_frames) > 0){
padmgr->rumble_off_frames = *(volatile u8*)&padmgr->rumble_off_frames - 1;
}else if (padmgr->rumble_off_frames > 0){
--padmgr->rumble_off_frames;
padmgr_RumbleStop(padmgr);
return;
}
if (padmgr->rumble_on_frames == 0){
}else if (padmgr->rumble_on_frames == 0){
padmgr_RumbleStop(padmgr);
return;
}
if (!padmgr->prenmi_shutdown){
}else if (!padmgr->prenmi_shutdown){
padmgr_RumbleControl(padmgr);
--padmgr->rumble_on_frames;
}