Enabled rumble for all versions.

This commit is contained in:
Zerocker 2020-05-24 23:52:03 +09:00
parent 19990cde38
commit ce864043c1
27 changed files with 63 additions and 265 deletions

View File

@ -86,7 +86,7 @@ for i in ${!OPTIONS[@]}; do
done done
printf "\n${YELLOW} Executing: ${CYAN}make ${CMDL} -j${RESET}\n\n" printf "\n${YELLOW} Executing: ${CYAN}make ${CMDL} -j${RESET}\n\n"
PATH=/mingw32/bin:/mingw64/bin:$PATH make $CMDL -j -d PATH=/mingw32/bin:/mingw64/bin:$PATH make $CMDL -j
if [ "${CMDL}" != " clean" ]; then if [ "${CMDL}" != " clean" ]; then

View File

@ -30,9 +30,7 @@ struct Controller
/*0x12*/ u16 buttonPressed; /*0x12*/ u16 buttonPressed;
/*0x14*/ OSContStatus *statusData; /*0x14*/ OSContStatus *statusData;
/*0x18*/ OSContPad *controllerData; /*0x18*/ OSContPad *controllerData;
#ifdef VERSION_SH
/*0x1C*/ int port; /*0x1C*/ int port;
#endif
}; };
typedef f32 Vec2f[2]; typedef f32 Vec2f[2];

View File

@ -31,9 +31,7 @@ void cap_switch_act_2(void) {
cur_obj_shake_screen(SHAKE_POS_SMALL); cur_obj_shake_screen(SHAKE_POS_SMALL);
spawn_mist_particles(); spawn_mist_particles();
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte); spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
} }
} else { } else {
sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0); sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);

View File

@ -78,9 +78,7 @@ void exclamation_box_act_2(void) {
o->oGravity = -8.0f; o->oGravity = -8.0f;
o->oFloorHeight = o->oPosY; o->oFloorHeight = o->oPosY;
o->oAction = 3; o->oAction = 3;
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
} }
load_object_collision_model(); load_object_collision_model();
} }

View File

@ -32,9 +32,7 @@ void bhv_purple_switch_loop(void) {
cur_obj_play_sound_2(SOUND_GENERAL2_PURPLE_SWITCH); cur_obj_play_sound_2(SOUND_GENERAL2_PURPLE_SWITCH);
o->oAction = PURPLE_SWITCH_TICKING; o->oAction = PURPLE_SWITCH_TICKING;
cur_obj_shake_screen(SHAKE_POS_SMALL); cur_obj_shake_screen(SHAKE_POS_SMALL);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
} }
break; break;
/** /**

View File

@ -22,9 +22,7 @@ void bhv_star_door_loop(void) {
case 1: case 1:
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) { if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN); cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN);
#ifdef VERSION_SH
queue_rumble_data(35, 30); queue_rumble_data(35, 30);
#endif
} }
cur_obj_become_intangible(); cur_obj_become_intangible();
o->oUnkBC = -8.0f; o->oUnkBC = -8.0f;
@ -39,9 +37,7 @@ void bhv_star_door_loop(void) {
case 3: case 3:
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) { if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE); cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE);
#ifdef VERSION_SH
queue_rumble_data(35, 30); queue_rumble_data(35, 30);
#endif
} }
o->oUnkBC = 8.0f; o->oUnkBC = 8.0f;
star_door_update_pos(); star_door_update_pos();

View File

@ -40,9 +40,7 @@ void water_level_pillar_undrained(void) {
(s32) approach_f32_symmetric(gEnvironmentLevels[2], -2450.0f, 5.0f); (s32) approach_f32_symmetric(gEnvironmentLevels[2], -2450.0f, 5.0f);
gEnvironmentLevels[0] = gEnvironmentLevels[0] =
(s32) approach_f32_symmetric(gEnvironmentLevels[0], -2450.0f, 5.0f); (s32) approach_f32_symmetric(gEnvironmentLevels[0], -2450.0f, 5.0f);
#ifdef VERSION_SH
reset_rumble_timers_2(2); reset_rumble_timers_2(2);
#endif
} else } else
o->oAction++; o->oAction++;
break; break;

View File

@ -49,9 +49,7 @@ void bhv_water_level_diamond_loop(void) {
cur_obj_play_sound_1(SOUND_ENV_WATER_DRAIN); // same as above cur_obj_play_sound_1(SOUND_ENV_WATER_DRAIN); // same as above
} }
o->oAngleVelYaw = 0x800; o->oAngleVelYaw = 0x800;
#ifdef VERSION_SH
reset_rumble_timers_2(2); reset_rumble_timers_2(2);
#endif
} }
break; break;
case WATER_LEVEL_DIAMOND_ACT_IDLE_SPINNING: case WATER_LEVEL_DIAMOND_ACT_IDLE_SPINNING:

View File

@ -564,9 +564,7 @@ void init_controllers(void) {
// into any port in order to play the game. this was probably // into any port in order to play the game. this was probably
// so if any of the ports didnt work, you can have controllers // so if any of the ports didnt work, you can have controllers
// plugged into any of them and it will work. // plugged into any of them and it will work.
#ifdef VERSION_SH
gControllers[cont].port = port; gControllers[cont].port = port;
#endif
gControllers[cont].statusData = &gControllerStatuses[port]; gControllers[cont].statusData = &gControllerStatuses[port];
gControllers[cont++].controllerData = &gControllerPads[port]; gControllers[cont++].controllerData = &gControllerPads[port];
} }
@ -606,13 +604,9 @@ static struct LevelCommand *levelCommandAddr;
void thread5_game_loop(UNUSED void *arg) { void thread5_game_loop(UNUSED void *arg) {
setup_game_memory(); setup_game_memory();
#ifdef VERSION_SH
init_rumble_pak_scheduler_queue(); init_rumble_pak_scheduler_queue();
#endif
init_controllers(); init_controllers();
#ifdef VERSION_SH
create_thread_6(); create_thread_6();
#endif
save_file_load_all(); save_file_load_all();
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1); set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1);
@ -638,9 +632,7 @@ void game_loop_one_iteration(void) {
// read_controller_inputs is called later. // read_controller_inputs is called later.
if (gControllerBits) { if (gControllerBits) {
#ifdef VERSION_SH // block_until_rumble_pak_free();
block_until_rumble_pak_free();
#endif
osContStartReadData(&gSIEventMesgQueue); osContStartReadData(&gSIEventMesgQueue);
} }

View File

@ -697,9 +697,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
m->hurtCounter += 4 * damage; m->hurtCounter += 4 * damage;
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
set_camera_shake_from_hit(shake); set_camera_shake_from_hit(shake);
return damage; return damage;
} }
@ -747,11 +745,10 @@ u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *
&& m->numCoins >= 100) { && m->numCoins >= 100) {
bhv_spawn_star_no_level_exit(6); bhv_spawn_star_no_level_exit(6);
} }
#ifdef VERSION_SH
if (o->oDamageOrCoinValue >= 2) { if (o->oDamageOrCoinValue >= 2) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#endif
return FALSE; return FALSE;
} }
@ -770,9 +767,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
if (m->health >= 0x100) { if (m->health >= 0x100) {
mario_stop_riding_and_holding(m); mario_stop_riding_and_holding(m);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
if (!noExit) { if (!noExit) {
m->hurtCounter = 0; m->hurtCounter = 0;
@ -874,7 +869,6 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
m->interactObj = o; m->interactObj = o;
m->usedObj = o; m->usedObj = o;
#ifdef VERSION_SH
if (o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)) { if (o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)) {
play_sound(SOUND_MENU_ENTER_PIPE, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MENU_ENTER_PIPE, m->marioObj->header.gfx.cameraToObject);
queue_rumble_data(15, 80); queue_rumble_data(15, 80);
@ -882,12 +876,6 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
play_sound(SOUND_MENU_ENTER_HOLE, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MENU_ENTER_HOLE, m->marioObj->header.gfx.cameraToObject);
queue_rumble_data(12, 80); queue_rumble_data(12, 80);
} }
#else
play_sound(o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)
? SOUND_MENU_ENTER_PIPE
: SOUND_MENU_ENTER_HOLE,
m->marioObj->header.gfx.cameraToObject);
#endif
mario_stop_riding_object(m); mario_stop_riding_object(m);
return set_mario_action(m, ACT_DISAPPEARED, (WARP_OP_WARP_OBJECT << 16) + 2); return set_mario_action(m, ACT_DISAPPEARED, (WARP_OP_WARP_OBJECT << 16) + 2);
@ -1098,9 +1086,8 @@ u32 interact_tornado(struct MarioState *m, UNUSED u32 interactType, struct Objec
marioObj->oMarioTornadoPosY = m->pos[1] - o->oPosY; marioObj->oMarioTornadoPosY = m->pos[1] - o->oPosY;
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(30, 60); queue_rumble_data(30, 60);
#endif
return set_mario_action(m, ACT_TORNADO_TWIRLING, m->action == ACT_TWIRLING); return set_mario_action(m, ACT_TORNADO_TWIRLING, m->action == ACT_TWIRLING);
} }
@ -1121,9 +1108,8 @@ u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Obj
marioObj->oMarioWhirlpoolPosY = m->pos[1] - o->oPosY; marioObj->oMarioWhirlpoolPosY = m->pos[1] - o->oPosY;
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(30, 60); queue_rumble_data(30, 60);
#endif
return set_mario_action(m, ACT_CAUGHT_IN_WHIRLPOOL, 0); return set_mario_action(m, ACT_CAUGHT_IN_WHIRLPOOL, 0);
} }
@ -1157,9 +1143,8 @@ u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object
if (!sInvulnerable && !(m->flags & MARIO_METAL_CAP) && !(m->flags & MARIO_VANISH_CAP) if (!sInvulnerable && !(m->flags & MARIO_METAL_CAP) && !(m->flags & MARIO_VANISH_CAP)
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) { && !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
o->oInteractStatus = INT_STATUS_INTERACTED; o->oInteractStatus = INT_STATUS_INTERACTED;
m->interactObj = o; m->interactObj = o;
@ -1235,9 +1220,7 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
m->interactObj = o; m->interactObj = o;
if (interaction & INT_ATTACK_NOT_FROM_BELOW) { if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
push_mario_out_of_object(m, o, 5.0f); push_mario_out_of_object(m, o, 5.0f);
m->forwardVel = -16.0f; m->forwardVel = -16.0f;
@ -1260,9 +1243,8 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
push_mario_out_of_object(m, o, 5.0f); push_mario_out_of_object(m, o, 5.0f);
drop_and_set_mario_action(m, bully_knock_back_mario(m), 0); drop_and_set_mario_action(m, bully_knock_back_mario(m), 0);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return TRUE; return TRUE;
} }
@ -1279,9 +1261,7 @@ u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object
take_damage_from_interact_object(m); take_damage_from_interact_object(m);
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(70, 60); queue_rumble_data(70, 60);
#endif
if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) { if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) {
return drop_and_set_mario_action(m, ACT_WATER_SHOCKED, 0); return drop_and_set_mario_action(m, ACT_WATER_SHOCKED, 0);
@ -1327,9 +1307,7 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc
} }
if (interaction & INT_ANY_ATTACK) { if (interaction & INT_ANY_ATTACK) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
attack_object(o, interaction); attack_object(o, interaction);
bounce_back_from_attack(m, interaction); bounce_back_from_attack(m, interaction);
@ -1368,9 +1346,7 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob
} }
if (interaction & INT_ATTACK_NOT_FROM_BELOW) { if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
attack_object(o, interaction); attack_object(o, interaction);
bounce_back_from_attack(m, interaction); bounce_back_from_attack(m, interaction);
@ -1487,9 +1463,7 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc
update_mario_sound_and_camera(m); update_mario_sound_and_camera(m);
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return set_mario_action(m, ACT_GRABBED, 0); return set_mario_action(m, ACT_GRABBED, 0);
} }
} }
@ -1538,9 +1512,7 @@ u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *
marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000); marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000);
#endif #endif
reset_mario_pitch(m); reset_mario_pitch(m);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return set_mario_action(m, ACT_GRAB_POLE_FAST, 0); return set_mario_action(m, ACT_GRAB_POLE_FAST, 0);
} }
} }
@ -1560,9 +1532,7 @@ u32 interact_hoot(struct MarioState *m, UNUSED u32 interactType, struct Object *
m->interactObj = o; m->interactObj = o;
m->usedObj = o; m->usedObj = o;
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
update_mario_sound_and_camera(m); update_mario_sound_and_camera(m);
return set_mario_action(m, ACT_RIDING_HOOT, 0); return set_mario_action(m, ACT_RIDING_HOOT, 0);
} }

View File

@ -687,10 +687,8 @@ void initiate_painting_warp(void) {
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
fadeout_music(398); fadeout_music(398);
#ifdef VERSION_SH
queue_rumble_data(80, 70); queue_rumble_data(80, 70);
func_sh_8024C89C(1); func_sh_8024C89C(1);
#endif
} }
} }
} }
@ -1005,9 +1003,7 @@ s32 play_mode_normal(void) {
set_play_mode(PLAY_MODE_CHANGE_AREA); set_play_mode(PLAY_MODE_CHANGE_AREA);
} else if (pressed_pause()) { } else if (pressed_pause()) {
lower_background_noise(1); lower_background_noise(1);
#ifdef VERSION_SH
cancel_rumble(); cancel_rumble();
#endif
gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN; gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN;
set_play_mode(PLAY_MODE_PAUSED); set_play_mode(PLAY_MODE_PAUSED);
} }
@ -1225,11 +1221,10 @@ s32 init_level(void) {
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
} }
} }
#ifdef VERSION_SH
if (gCurrDemoInput == NULL) { if (gCurrDemoInput == NULL) {
cancel_rumble(); cancel_rumble();
} }
#endif
if (gMarioState->action == ACT_INTRO_CUTSCENE) { if (gMarioState->action == ACT_INTRO_CUTSCENE) {
sound_banks_disable(2, 0x0330); sound_banks_disable(2, 0x0330);

View File

@ -25,7 +25,7 @@ OSThread gIdleThread;
OSThread gMainThread; OSThread gMainThread;
OSThread gGameLoopThread; OSThread gGameLoopThread;
OSThread gSoundThread; OSThread gSoundThread;
#ifdef VERSION_SH #ifndef VERSION_SH
OSThread gRumblePakThread; OSThread gRumblePakThread;
s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
@ -38,7 +38,7 @@ OSMesgQueue gSIEventMesgQueue;
OSMesgQueue gPIMesgQueue; OSMesgQueue gPIMesgQueue;
OSMesgQueue gIntrMesgQueue; OSMesgQueue gIntrMesgQueue;
OSMesgQueue gSPTaskMesgQueue; OSMesgQueue gSPTaskMesgQueue;
#ifdef VERSION_SH #ifndef VERSION_SH
OSMesgQueue gRumblePakSchedulerMesgQueue; OSMesgQueue gRumblePakSchedulerMesgQueue;
OSMesgQueue gRumbleThreadVIMesgQueue; OSMesgQueue gRumbleThreadVIMesgQueue;
#endif #endif
@ -47,7 +47,7 @@ OSMesg gPIMesgBuf[32];
OSMesg gSIEventMesgBuf[1]; OSMesg gSIEventMesgBuf[1];
OSMesg gIntrMesgBuf[16]; OSMesg gIntrMesgBuf[16];
OSMesg gUnknownMesgBuf[16]; OSMesg gUnknownMesgBuf[16];
#ifdef VERSION_SH #ifndef VERSION_SH
OSMesg gRumblePakSchedulerMesgBuf[1]; OSMesg gRumblePakSchedulerMesgBuf[1];
OSMesg gRumbleThreadVIMesgBuf[1]; OSMesg gRumbleThreadVIMesgBuf[1];
@ -152,7 +152,7 @@ void create_thread(OSThread *thread, OSId id, void (*entry)(void *), void *arg,
osCreateThread(thread, id, entry, arg, sp, pri); osCreateThread(thread, id, entry, arg, sp, pri);
} }
#ifdef VERSION_SH #ifndef VERSION_SH
extern void func_sh_802F69CC(void); extern void func_sh_802F69CC(void);
#endif #endif
@ -162,7 +162,7 @@ void handle_nmi_request(void) {
func_80320890(); func_80320890();
sound_banks_disable(2, 0x037A); sound_banks_disable(2, 0x037A);
fadeout_music(90); fadeout_music(90);
#ifdef VERSION_SH #ifndef VERSION_SH
func_sh_802F69CC(); func_sh_802F69CC();
#endif #endif
} }
@ -233,7 +233,7 @@ void handle_vblank(void) {
stub_main_3(); stub_main_3();
sNumVblanks++; sNumVblanks++;
#ifdef VERSION_SH #ifndef VERSION_SH
if (gResetTimer > 0 && gResetTimer < 100) { if (gResetTimer > 0 && gResetTimer < 100) {
gResetTimer++; gResetTimer++;
} }
@ -268,9 +268,8 @@ void handle_vblank(void) {
start_sptask(M_GFXTASK); start_sptask(M_GFXTASK);
} }
} }
#ifdef VERSION_SH
rumble_thread_update_vi(); rumble_thread_update_vi();
#endif
// Notify the game loop about the vblank. // Notify the game loop about the vblank.
if (gVblankHandler1 != NULL) { if (gVblankHandler1 != NULL) {

View File

@ -24,7 +24,7 @@ extern OSThread gIdleThread;
extern OSThread gMainThread; extern OSThread gMainThread;
extern OSThread gGameLoopThread; extern OSThread gGameLoopThread;
extern OSThread gSoundThread; extern OSThread gSoundThread;
#ifdef VERSION_SH #ifndef VERSION_SH
extern OSThread gRumblePakThread; extern OSThread gRumblePakThread;
extern s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet extern s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
@ -33,7 +33,7 @@ extern s32 gRumblePakPfs; // Actually an OSPfs but we don't have that header yet
extern OSMesgQueue gPIMesgQueue; extern OSMesgQueue gPIMesgQueue;
extern OSMesgQueue gIntrMesgQueue; extern OSMesgQueue gIntrMesgQueue;
extern OSMesgQueue gSPTaskMesgQueue; extern OSMesgQueue gSPTaskMesgQueue;
#ifdef VERSION_SH #ifndef VERSION_SH
extern OSMesgQueue gRumblePakSchedulerMesgQueue; extern OSMesgQueue gRumblePakSchedulerMesgQueue;
extern OSMesgQueue gRumbleThreadVIMesgQueue; extern OSMesgQueue gRumbleThreadVIMesgQueue;
#endif #endif
@ -46,7 +46,7 @@ extern OSIoMesg gDmaIoMesg;
extern OSMesg D_80339BEC; extern OSMesg D_80339BEC;
extern OSMesgQueue gDmaMesgQueue; extern OSMesgQueue gDmaMesgQueue;
extern OSMesgQueue gSIEventMesgQueue; extern OSMesgQueue gSIEventMesgQueue;
#ifdef VERSION_SH #ifndef VERSION_SH
extern OSMesg gRumblePakSchedulerMesgBuf[1]; extern OSMesg gRumblePakSchedulerMesgBuf[1];
extern OSMesg gRumbleThreadVIMesgBuf[1]; extern OSMesg gRumbleThreadVIMesgBuf[1];
@ -73,6 +73,6 @@ extern s8 gShowDebugText;
extern void set_vblank_handler(s32 a, struct VblankHandler *b, OSMesgQueue *queue, OSMesg *msg); extern void set_vblank_handler(s32 a, struct VblankHandler *b, OSMesgQueue *queue, OSMesg *msg);
extern void dispatch_audio_sptask(struct SPTask *spTask); extern void dispatch_audio_sptask(struct SPTask *spTask);
extern void send_display_list(struct SPTask *a); extern void send_display_list(struct SPTask *a);
extern void main(void); // extern void main(void);
#endif #endif

View File

@ -1534,7 +1534,6 @@ void update_mario_health(struct MarioState *m) {
// Play a noise to alert the player when Mario is close to drowning. // Play a noise to alert the player when Mario is close to drowning.
if (((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) && (m->health < 0x300)) { if (((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) && (m->health < 0x300)) {
play_sound(SOUND_MOVING_ALMOST_DROWNING, gDefaultSoundArgs); play_sound(SOUND_MOVING_ALMOST_DROWNING, gDefaultSoundArgs);
#ifdef VERSION_SH
if (!gRumblePakTimer) { if (!gRumblePakTimer) {
gRumblePakTimer = 36; gRumblePakTimer = 36;
if (is_rumble_finished_and_queue_empty()) { if (is_rumble_finished_and_queue_empty()) {
@ -1543,7 +1542,6 @@ void update_mario_health(struct MarioState *m) {
} }
} else { } else {
gRumblePakTimer = 0; gRumblePakTimer = 0;
#endif
} }
} }
} }
@ -1721,7 +1719,6 @@ static void debug_update_mario_cap(u16 button, s32 flags, u16 capTimer, u16 capM
} }
} }
#ifdef VERSION_SH
void func_sh_8025574C(void) { void func_sh_8025574C(void) {
if (gMarioState->particleFlags & PARTICLE_HORIZONTAL_STAR) { if (gMarioState->particleFlags & PARTICLE_HORIZONTAL_STAR) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
@ -1734,7 +1731,6 @@ void func_sh_8025574C(void) {
reset_rumble_timers(); reset_rumble_timers();
} }
} }
#endif
/** /**
* Main function for executing Mario's behavior. * Main function for executing Mario's behavior.
@ -1831,9 +1827,7 @@ s32 execute_mario_action(UNUSED struct Object *o) {
play_infinite_stairs_music(); play_infinite_stairs_music();
gMarioState->marioObj->oInteractStatus = 0; gMarioState->marioObj->oInteractStatus = 0;
#ifdef VERSION_SH
func_sh_8025574C(); func_sh_8025574C();
#endif
return gMarioState->particleFlags; return gMarioState->particleFlags;
} }

View File

@ -83,18 +83,15 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
if (m->vel[1] < -55.0f) { if (m->vel[1] < -55.0f) {
if (fallHeight > 3000.0f) { if (fallHeight > 3000.0f) {
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24; m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); set_camera_shake_from_hit(SHAKE_FALL_DAMAGE);
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
return drop_and_set_mario_action(m, hardFallAction, 4); return drop_and_set_mario_action(m, hardFallAction, 4);
} else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) { } else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) {
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 8 : 12; m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 8 : 12;
m->squishTimer = 30; m->squishTimer = 30;
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); set_camera_shake_from_hit(SHAKE_FALL_DAMAGE);
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
} }
@ -136,9 +133,8 @@ s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) {
#endif #endif
m->particleFlags |= PARTICLE_MIST_CIRCLE; m->particleFlags |= PARTICLE_MIST_CIRCLE;
drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0); drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return TRUE; return TRUE;
} }
@ -388,9 +384,7 @@ u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation,
set_mario_animation(m, animation); set_mario_animation(m, animation);
if (m->forwardVel > 16.0f) { if (m->forwardVel > 16.0f) {
#ifdef VERSION_SH
queue_rumble_data(5, 40); queue_rumble_data(5, 40);
#endif
mario_bonk_reflection(m, FALSE); mario_bonk_reflection(m, FALSE);
m->faceAngle[1] += 0x8000; m->faceAngle[1] += 0x8000;
@ -496,11 +490,9 @@ s32 act_triple_jump(struct MarioState *m) {
#endif #endif
common_air_action_step(m, ACT_TRIPLE_JUMP_LAND, MARIO_ANIM_TRIPLE_JUMP, 0); common_air_action_step(m, ACT_TRIPLE_JUMP_LAND, MARIO_ANIM_TRIPLE_JUMP, 0);
#ifdef VERSION_SH
if (m->action == ACT_TRIPLE_JUMP_LAND) { if (m->action == ACT_TRIPLE_JUMP_LAND) {
queue_rumble_data(5, 40); queue_rumble_data(5, 40);
} }
#endif
play_flip_sounds(m, 2, 8, 20); play_flip_sounds(m, 2, 8, 20);
return FALSE; return FALSE;
} }
@ -512,11 +504,10 @@ s32 act_backflip(struct MarioState *m) {
play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAH_WAH_HOO); play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAH_WAH_HOO);
common_air_action_step(m, ACT_BACKFLIP_LAND, MARIO_ANIM_BACKFLIP, 0); common_air_action_step(m, ACT_BACKFLIP_LAND, MARIO_ANIM_BACKFLIP, 0);
#ifdef VERSION_SH
if (m->action == ACT_BACKFLIP_LAND) { if (m->action == ACT_BACKFLIP_LAND) {
queue_rumble_data(5, 40); queue_rumble_data(5, 40);
} }
#endif
play_flip_sounds(m, 2, 3, 17); play_flip_sounds(m, 2, 3, 17);
return FALSE; return FALSE;
} }
@ -644,11 +635,10 @@ s32 act_long_jump(struct MarioState *m) {
} }
common_air_action_step(m, ACT_LONG_JUMP_LAND, animation, AIR_STEP_CHECK_LEDGE_GRAB); common_air_action_step(m, ACT_LONG_JUMP_LAND, animation, AIR_STEP_CHECK_LEDGE_GRAB);
#ifdef VERSION_SH
if (m->action == ACT_LONG_JUMP_LAND) { if (m->action == ACT_LONG_JUMP_LAND) {
queue_rumble_data(5, 40); queue_rumble_data(5, 40);
} }
#endif
return FALSE; return FALSE;
} }
@ -749,9 +739,7 @@ s32 act_dive(struct MarioState *m) {
case AIR_STEP_LANDED: case AIR_STEP_LANDED:
if (should_get_stuck_in_ground(m) && m->faceAngle[0] == -0x2AAA) { if (should_get_stuck_in_ground(m) && m->faceAngle[0] == -0x2AAA) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
#ifdef VERSION_JP #ifdef VERSION_JP
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
#else #else
@ -947,9 +935,7 @@ s32 act_ground_pound(struct MarioState *m) {
stepResult = perform_air_step(m, 0); stepResult = perform_air_step(m, 0);
if (stepResult == AIR_STEP_LANDED) { if (stepResult == AIR_STEP_LANDED) {
if (should_get_stuck_in_ground(m)) { if (should_get_stuck_in_ground(m)) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
#ifdef VERSION_JP #ifdef VERSION_JP
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
#else #else
@ -998,9 +984,8 @@ s32 act_burning_jump(struct MarioState *m) {
if (m->health < 0x100) { if (m->health < 0x100) {
m->health = 0xFF; m->health = 0xFF;
} }
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1020,9 +1005,8 @@ s32 act_burning_fall(struct MarioState *m) {
if (m->health < 0x100) { if (m->health < 0x100) {
m->health = 0xFF; m->health = 0xFF;
} }
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1071,9 +1055,7 @@ s32 act_crazy_box_bounce(struct MarioState *m) {
m->heldObj = NULL; m->heldObj = NULL;
set_mario_action(m, ACT_STOMACH_SLIDE, 0); set_mario_action(m, ACT_STOMACH_SLIDE, 0);
} }
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
m->particleFlags |= PARTICLE_MIST_CIRCLE; m->particleFlags |= PARTICLE_MIST_CIRCLE;
break; break;
@ -1103,11 +1085,9 @@ u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFall
break; break;
case AIR_STEP_LANDED: case AIR_STEP_LANDED:
#ifdef VERSION_SH
if (m->action == ACT_SOFT_BONK) { if (m->action == ACT_SOFT_BONK) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#endif
if (!check_fall_damage_or_get_stuck(m, hardFallAction)) { if (!check_fall_damage_or_get_stuck(m, hardFallAction)) {
#ifndef VERSION_JP #ifndef VERSION_JP
if (m->action == ACT_THROWN_FORWARD || m->action == ACT_THROWN_BACKWARD) { if (m->action == ACT_THROWN_FORWARD || m->action == ACT_THROWN_BACKWARD) {
@ -1506,14 +1486,11 @@ s32 act_hold_butt_slide_air(struct MarioState *m) {
} }
s32 act_lava_boost(struct MarioState *m) { s32 act_lava_boost(struct MarioState *m) {
#ifdef VERSION_SH
if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) { if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) {
play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED);
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#else
play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_ON_FIRE, MARIO_MARIO_SOUND_PLAYED);
#endif
if (!(m->input & INPUT_NONZERO_ANALOG)) { if (!(m->input & INPUT_NONZERO_ANALOG)) {
m->forwardVel = approach_f32(m->forwardVel, 0.0f, 0.35f, 0.35f); m->forwardVel = approach_f32(m->forwardVel, 0.0f, 0.35f, 0.35f);
@ -1530,9 +1507,7 @@ s32 act_lava_boost(struct MarioState *m) {
} }
m->vel[1] = 84.0f; m->vel[1] = 84.0f;
play_sound(SOUND_MARIO_ON_FIRE, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ON_FIRE, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
} else { } else {
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND); play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND);
if (m->actionState < 2 && m->vel[1] < 0.0f) { if (m->actionState < 2 && m->vel[1] < 0.0f) {
@ -1568,9 +1543,8 @@ s32 act_lava_boost(struct MarioState *m) {
} }
m->marioBodyState->eyeState = MARIO_EYES_DEAD; m->marioBodyState->eyeState = MARIO_EYES_DEAD;
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1690,9 +1664,7 @@ s32 act_shot_from_cannon(struct MarioState *m) {
gLakituState.mode = CAMERA_MODE_NEWCAM; gLakituState.mode = CAMERA_MODE_NEWCAM;
} }
#endif #endif
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
break; break;
case AIR_STEP_HIT_WALL: case AIR_STEP_HIT_WALL:
@ -1734,9 +1706,8 @@ s32 act_shot_from_cannon(struct MarioState *m) {
if (m->vel[1] > 0.0f) { if (m->vel[1] > 0.0f) {
m->particleFlags |= PARTICLE_DUST; m->particleFlags |= PARTICLE_DUST;
} }
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1839,9 +1810,7 @@ s32 act_flying(struct MarioState *m) {
gLakituState.mode = CAMERA_MODE_NEWCAM; gLakituState.mode = CAMERA_MODE_NEWCAM;
} }
#endif #endif
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
break; break;
case AIR_STEP_HIT_WALL: case AIR_STEP_HIT_WALL:
@ -1904,9 +1873,7 @@ s32 act_flying(struct MarioState *m) {
play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16), play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16),
m->marioObj->header.gfx.cameraToObject); m->marioObj->header.gfx.cameraToObject);
#endif #endif
#ifdef VERSION_SH
queue_rumble_data(50, 40); queue_rumble_data(50, 40);
#endif
} }
play_sound(SOUND_MOVING_FLYING, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MOVING_FLYING, m->marioObj->header.gfx.cameraToObject);
@ -1920,9 +1887,7 @@ s32 act_riding_hoot(struct MarioState *m) {
m->usedObj->oHootMarioReleaseTime = gGlobalTimer; m->usedObj->oHootMarioReleaseTime = gGlobalTimer;
play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED);
#ifdef VERSION_SH
queue_rumble_data(4, 40); queue_rumble_data(4, 40);
#endif
return set_mario_action(m, ACT_FREEFALL, 0); return set_mario_action(m, ACT_FREEFALL, 0);
} }
@ -1988,9 +1953,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
if (is_anim_past_end(m)) { if (is_anim_past_end(m)) {
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING); set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING);
#ifdef VERSION_SH
queue_rumble_data(8, 80); queue_rumble_data(8, 80);
#endif
m->actionState = 1; m->actionState = 1;
} }
} }
@ -2063,9 +2026,7 @@ s32 act_vertical_wind(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP); set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP);
if (m->marioObj->header.gfx.unk38.animFrame == 1) { if (m->marioObj->header.gfx.unk38.animFrame == 1) {
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(8, 80); queue_rumble_data(8, 80);
#endif
} }
if (is_anim_past_end(m)) { if (is_anim_past_end(m)) {

View File

@ -171,9 +171,7 @@ s32 act_holding_pole(struct MarioState *m) {
} }
} }
play_climbing_sounds(m, 2); play_climbing_sounds(m, 2);
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
func_80320A4C(1, marioObj->oMarioPoleYawVel / 0x100 * 2); func_80320A4C(1, marioObj->oMarioPoleYawVel / 0x100 * 2);
} else { } else {
marioObj->oMarioPoleYawVel = 0; marioObj->oMarioPoleYawVel = 0;
@ -385,13 +383,9 @@ void update_hang_stationary(struct MarioState *m) {
} }
s32 act_start_hanging(struct MarioState *m) { s32 act_start_hanging(struct MarioState *m) {
#ifdef VERSION_SH
if (m->actionTimer++ == 0) { if (m->actionTimer++ == 0) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#else
m->actionTimer++;
#endif
if ((m->input & INPUT_NONZERO_ANALOG) && m->actionTimer >= 31) { if ((m->input & INPUT_NONZERO_ANALOG) && m->actionTimer >= 31) {
return set_mario_action(m, ACT_HANGING, 0); return set_mario_action(m, ACT_HANGING, 0);
@ -470,9 +464,7 @@ s32 act_hang_moving(struct MarioState *m) {
if (m->marioObj->header.gfx.unk38.animFrame == 12) { if (m->marioObj->header.gfx.unk38.animFrame == 12) {
play_sound(SOUND_ACTION_HANGING_STEP, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_ACTION_HANGING_STEP, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
queue_rumble_data(5, 30); queue_rumble_data(5, 30);
#endif
} }
if (is_anim_past_end(m)) { if (is_anim_past_end(m)) {
@ -662,9 +654,7 @@ s32 act_grabbed(struct MarioState *m) {
m->faceAngle[1] = m->usedObj->oMoveAngleYaw; m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
vec3f_copy(m->pos, m->marioObj->header.gfx.pos); vec3f_copy(m->pos, m->marioObj->header.gfx.pos);
#ifdef VERSION_SH
queue_rumble_data(5, 60); queue_rumble_data(5, 60);
#endif
return set_mario_action(m, (m->forwardVel >= 0.0f) ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD, return set_mario_action(m, (m->forwardVel >= 0.0f) ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD,
thrown); thrown);
@ -744,17 +734,13 @@ s32 act_in_cannon(struct MarioState *m) {
m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE; m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
set_mario_action(m, ACT_SHOT_FROM_CANNON, 0); set_mario_action(m, ACT_SHOT_FROM_CANNON, 0);
#ifdef VERSION_SH
queue_rumble_data(60, 70); queue_rumble_data(60, 70);
#endif
m->usedObj->oAction = 2; m->usedObj->oAction = 2;
return FALSE; return FALSE;
} else { } else {
if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw) { if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw) {
play_sound(SOUND_MOVING_AIM_CANNON, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MOVING_AIM_CANNON, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
reset_rumble_timers_2(0); reset_rumble_timers_2(0);
#endif
} }
} }
} }
@ -840,9 +826,7 @@ s32 act_tornado_twirling(struct MarioState *m) {
vec3f_copy(m->marioObj->header.gfx.pos, m->pos); vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1] + m->twirlYaw, 0); vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1] + m->twirlYaw, 0);
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }

View File

@ -1178,9 +1178,7 @@ s32 act_death_exit(struct MarioState *m) {
#else #else
play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject);
#endif #endif
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
m->numLives--; m->numLives--;
// restore 7.75 units of health // restore 7.75 units of health
m->healCounter = 31; m->healCounter = 31;
@ -1213,9 +1211,7 @@ s32 act_falling_death_exit(struct MarioState *m) {
#else #else
play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject);
#endif #endif
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
m->numLives--; m->numLives--;
// restore 7.75 units of health // restore 7.75 units of health
m->healCounter = 31; m->healCounter = 31;
@ -1260,9 +1256,7 @@ s32 act_special_death_exit(struct MarioState *m) {
} }
if (launch_mario_until_land(m, ACT_HARD_BACKWARD_GROUND_KB, MARIO_ANIM_BACKWARD_AIR_KB, -24.0f)) { if (launch_mario_until_land(m, ACT_HARD_BACKWARD_GROUND_KB, MARIO_ANIM_BACKWARD_AIR_KB, -24.0f)) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
m->numLives--; m->numLives--;
m->healCounter = 31; m->healCounter = 31;
} }
@ -1346,9 +1340,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
m->flags &= ~MARIO_UNKNOWN_08; m->flags &= ~MARIO_UNKNOWN_08;
if (perform_air_step(m, 0) == AIR_STEP_LANDED) { if (perform_air_step(m, 0) == AIR_STEP_LANDED) {
level_trigger_warp(m, WARP_OP_UNKNOWN_02); level_trigger_warp(m, WARP_OP_UNKNOWN_02);
#ifdef VERSION_SH
queue_rumble_data(15, 80); queue_rumble_data(15, 80);
#endif
m->actionState = 4; m->actionState = 4;
} }
if (m->actionState == 2) { if (m->actionState == 2) {
@ -1414,12 +1406,10 @@ s32 act_teleport_fade_out(struct MarioState *m) {
set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING
: MARIO_ANIM_FIRST_PERSON); : MARIO_ANIM_FIRST_PERSON);
#ifdef VERSION_SH
if (m->actionTimer == 0) { if (m->actionTimer == 0) {
queue_rumble_data(30, 70); queue_rumble_data(30, 70);
func_sh_8024C89C(2); func_sh_8024C89C(2);
} }
#endif
m->flags |= MARIO_TELEPORTING; m->flags |= MARIO_TELEPORTING;
@ -1440,12 +1430,10 @@ s32 act_teleport_fade_in(struct MarioState *m) {
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
#ifdef VERSION_SH
if (m->actionTimer == 0) { if (m->actionTimer == 0) {
queue_rumble_data(30, 70); queue_rumble_data(30, 70);
func_sh_8024C89C(2); func_sh_8024C89C(2);
} }
#endif
if (m->actionTimer < 32) { if (m->actionTimer < 32) {
m->flags |= MARIO_TELEPORTING; m->flags |= MARIO_TELEPORTING;
@ -1534,9 +1522,7 @@ s32 act_squished(struct MarioState *m) {
// Both of the 1.8's are really floats, but one of them has to // Both of the 1.8's are really floats, but one of them has to
// be written as a double for this to match on EU. // be written as a double for this to match on EU.
vec3f_set(m->marioObj->header.gfx.scale, 1.8, 0.05f, 1.8f); vec3f_set(m->marioObj->header.gfx.scale, 1.8, 0.05f, 1.8f);
#ifdef VERSION_SH
queue_rumble_data(10, 80); queue_rumble_data(10, 80);
#endif
m->actionState = 1; m->actionState = 1;
} }
break; break;
@ -1638,9 +1624,7 @@ void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFra
if (animFrame == -1) { if (animFrame == -1) {
play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_STUCK_IN_GROUND, 1); play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_STUCK_IN_GROUND, 1);
} else if (animFrame == unstuckFrame) { } else if (animFrame == unstuckFrame) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
play_sound_and_spawn_particles(m, SOUND_ACTION_UNSTUCK_FROM_GROUND, 1); play_sound_and_spawn_particles(m, SOUND_ACTION_UNSTUCK_FROM_GROUND, 1);
} else if (animFrame == target2 || animFrame == target3) { } else if (animFrame == target2 || animFrame == target3) {
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);

View File

@ -1252,9 +1252,8 @@ s32 act_riding_shell_ground(struct MarioState *m) {
} }
adjust_sound_for_speed(m); adjust_sound_for_speed(m);
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1358,9 +1357,8 @@ s32 act_burning_ground(struct MarioState *m) {
} }
m->marioBodyState->eyeState = MARIO_EYES_DEAD; m->marioBodyState->eyeState = MARIO_EYES_DEAD;
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
return FALSE; return FALSE;
} }
@ -1376,9 +1374,7 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32
vec3f_copy(val14, m->pos); vec3f_copy(val14, m->pos);
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
#ifdef VERSION_SH
reset_rumble_timers(); reset_rumble_timers();
#endif
adjust_sound_for_speed(m); adjust_sound_for_speed(m);
@ -1502,9 +1498,7 @@ s32 act_crouch_slide(struct MarioState *m) {
s32 act_slide_kick_slide(struct MarioState *m) { s32 act_slide_kick_slide(struct MarioState *m) {
if (m->input & INPUT_A_PRESSED) { if (m->input & INPUT_A_PRESSED) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return set_jumping_action(m, ACT_FORWARD_ROLLOUT, 0); return set_jumping_action(m, ACT_FORWARD_ROLLOUT, 0);
} }
@ -1534,9 +1528,7 @@ s32 act_slide_kick_slide(struct MarioState *m) {
s32 stomach_slide_action(struct MarioState *m, u32 stopAction, u32 airAction, s32 animation) { s32 stomach_slide_action(struct MarioState *m, u32 stopAction, u32 airAction, s32 animation) {
if (m->actionTimer == 5) { if (m->actionTimer == 5) {
if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) { if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return drop_and_set_mario_action( return drop_and_set_mario_action(
m, m->forwardVel >= 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT, 0); m, m->forwardVel >= 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT, 0);
} }
@ -1570,9 +1562,7 @@ s32 act_hold_stomach_slide(struct MarioState *m) {
s32 act_dive_slide(struct MarioState *m) { s32 act_dive_slide(struct MarioState *m) {
if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) { if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) {
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
return set_mario_action(m, m->forwardVel > 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT, return set_mario_action(m, m->forwardVel > 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT,
0); 0);
} }
@ -1857,12 +1847,13 @@ s32 act_hold_freefall_land(struct MarioState *m) {
} }
s32 act_long_jump_land(struct MarioState *m) { s32 act_long_jump_land(struct MarioState *m) {
#ifdef VERSION_SH // Stop right there criminal scum!
if (Cheats.EnableCheats == TRUE && Cheats.DisableBLJ == TRUE) {
// BLJ (Backwards Long Jump) speed build up fix, crushing SimpleFlips's dreams since July 1997 // BLJ (Backwards Long Jump) speed build up fix, crushing SimpleFlips's dreams since July 1997
if (m->forwardVel < 0.0f) { if (m->forwardVel < 0.0f) {
m->forwardVel = 0.0f; m->forwardVel = 0.0f;
} }
#endif }
if (!(m->input & INPUT_Z_DOWN)) { if (!(m->input & INPUT_Z_DOWN)) {
m->input &= ~INPUT_A_PRESSED; m->input &= ~INPUT_A_PRESSED;

View File

@ -265,9 +265,7 @@ s32 act_throwing(struct MarioState *m) {
mario_throw_held_object(m); mario_throw_held_object(m);
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
queue_rumble_data(3, 50); queue_rumble_data(3, 50);
#endif
} }
animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE); animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE);
@ -287,9 +285,7 @@ s32 act_heavy_throw(struct MarioState *m) {
mario_drop_held_object(m); mario_drop_held_object(m);
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
queue_rumble_data(3, 50); queue_rumble_data(3, 50);
#endif
} }
animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE); animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE);
@ -319,9 +315,7 @@ s32 act_picking_up_bowser(struct MarioState *m) {
m->angleVel[1] = 0; m->angleVel[1] = 0;
m->marioBodyState->grabPos = GRAB_POS_BOWSER; m->marioBodyState->grabPos = GRAB_POS_BOWSER;
mario_grab_used_object(m); mario_grab_used_object(m);
#ifdef VERSION_SH
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
#endif
play_sound(SOUND_MARIO_HRMM, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_HRMM, m->marioObj->header.gfx.cameraToObject);
} }
@ -397,15 +391,11 @@ s32 act_holding_bowser(struct MarioState *m) {
// play sound on overflow // play sound on overflow
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1]) { if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1]) {
#ifdef VERSION_SH
queue_rumble_data(4, 20); queue_rumble_data(4, 20);
#endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
} }
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) { if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) {
#ifdef VERSION_SH
queue_rumble_data(4, 20); queue_rumble_data(4, 20);
#endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
} }
@ -422,14 +412,10 @@ s32 act_holding_bowser(struct MarioState *m) {
s32 act_releasing_bowser(struct MarioState *m) { s32 act_releasing_bowser(struct MarioState *m) {
if (++m->actionTimer == 1) { if (++m->actionTimer == 1) {
if (m->actionArg == 0) { if (m->actionArg == 0) {
#ifdef VERSION_SH
queue_rumble_data(4, 50); queue_rumble_data(4, 50);
#endif
mario_throw_held_object(m); mario_throw_held_object(m);
} else { } else {
#ifdef VERSION_SH
queue_rumble_data(4, 50); queue_rumble_data(4, 50);
#endif
mario_drop_held_object(m); mario_drop_held_object(m);
} }
} }

View File

@ -798,16 +798,12 @@ s32 act_shockwave_bounce(struct MarioState *m) {
f32 sp18; f32 sp18;
if (m->marioObj->oInteractStatus & 0x10) { if (m->marioObj->oInteractStatus & 0x10) {
#ifdef VERSION_SH
queue_rumble_data(70, 40); queue_rumble_data(70, 40);
#endif
return hurt_and_set_mario_action(m, ACT_SHOCKED, 0, 4); return hurt_and_set_mario_action(m, ACT_SHOCKED, 0, 4);
} }
if (m->actionTimer == 0) { if (m->actionTimer == 0) {
#ifdef VERSION_SH
queue_rumble_data(70, 40); queue_rumble_data(70, 40);
#endif
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK1) { if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK1) {
return hurt_and_set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0, 0xc); return hurt_and_set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0, 0xc);
} }

View File

@ -554,11 +554,9 @@ static s32 act_breaststroke(struct MarioState *m) {
reset_float_globals(m); reset_float_globals(m);
} }
#ifdef VERSION_SH
if (m->actionTimer < 6) { if (m->actionTimer < 6) {
func_sh_8024CA04(); func_sh_8024CA04();
} }
#endif
set_mario_animation(m, MARIO_ANIM_SWIM_PART1); set_mario_animation(m, MARIO_ANIM_SWIM_PART1);
common_swimming_step(m, sSwimStrength); common_swimming_step(m, sSwimStrength);
@ -802,9 +800,7 @@ static s32 act_water_throw(struct MarioState *m) {
if (m->actionTimer++ == 5) { if (m->actionTimer++ == 5) {
mario_throw_held_object(m); mario_throw_held_object(m);
#ifdef VERSION_SH
queue_rumble_data(3, 50); queue_rumble_data(3, 50);
#endif
} }
if (is_anim_at_end(m)) { if (is_anim_at_end(m)) {
@ -978,11 +974,9 @@ static s32 act_water_plunge(struct MarioState *m) {
m->particleFlags |= PARTICLE_WATER_SPLASH; m->particleFlags |= PARTICLE_WATER_SPLASH;
m->actionState = 1; m->actionState = 1;
#ifdef VERSION_SH
if (m->prevAction & ACT_FLAG_AIR) { if (m->prevAction & ACT_FLAG_AIR) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#endif
} }
if (stepResult == WATER_STEP_HIT_FLOOR || m->vel[1] >= endVSpeed || m->actionTimer > 20) { if (stepResult == WATER_STEP_HIT_FLOOR || m->vel[1] >= endVSpeed || m->actionTimer > 20) {
@ -1087,10 +1081,8 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL); set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
vec3f_copy(m->marioObj->header.gfx.pos, m->pos); vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0); vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
#ifdef VERSION_SH
reset_rumble_timers();
#endif
reset_rumble_timers();
return FALSE; return FALSE;
} }

View File

@ -104,14 +104,10 @@ static s32 read_eeprom_data(void *buffer, s32 size) {
u32 offset = (u32)((u8 *) buffer - (u8 *) &gSaveBuffer) / 8; u32 offset = (u32)((u8 *) buffer - (u8 *) &gSaveBuffer) / 8;
do { do {
#ifdef VERSION_SH
block_until_rumble_pak_free(); block_until_rumble_pak_free();
#endif
triesLeft--; triesLeft--;
status = osEepromLongRead(&gSIEventMesgQueue, offset, buffer, size); status = osEepromLongRead(&gSIEventMesgQueue, offset, buffer, size);
#ifdef VERSION_SH
release_rumble_pak_control(); release_rumble_pak_control();
#endif
} while (triesLeft > 0 && status != 0); } while (triesLeft > 0 && status != 0);
} }
@ -132,14 +128,10 @@ static s32 write_eeprom_data(void *buffer, s32 size, const uintptr_t baseofs) {
u32 offset = (u32)baseofs >> 3; u32 offset = (u32)baseofs >> 3;
do { do {
#ifdef VERSION_SH
block_until_rumble_pak_free(); block_until_rumble_pak_free();
#endif
triesLeft--; triesLeft--;
status = osEepromLongWrite(&gSIEventMesgQueue, offset, buffer, size); status = osEepromLongWrite(&gSIEventMesgQueue, offset, buffer, size);
#ifdef VERSION_SH
release_rumble_pak_control(); release_rumble_pak_control();
#endif
} while (triesLeft > 0 && status != 0); } while (triesLeft > 0 && status != 0);
} }

View File

@ -153,11 +153,10 @@ void play_menu_sounds(s16 soundMenuFlags) {
if (soundMenuFlags & 0x100) { if (soundMenuFlags & 0x100) {
play_menu_sounds_extra(20, NULL); play_menu_sounds_extra(20, NULL);
} }
#ifdef VERSION_SH
if ((soundMenuFlags & 0x20) != 0) { if ((soundMenuFlags & 0x20) != 0) {
queue_rumble_data(10, 60); queue_rumble_data(10, 60);
} }
#endif
} }
/** /**

View File

@ -68,7 +68,7 @@ void cur_obj_play_sound_1(s32 soundMagic) {
void cur_obj_play_sound_2(s32 soundMagic) { void cur_obj_play_sound_2(s32 soundMagic) {
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) { if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
play_sound(soundMagic, gCurrentObject->header.gfx.cameraToObject); play_sound(soundMagic, gCurrentObject->header.gfx.cameraToObject);
#ifdef VERSION_SH
if (soundMagic == SOUND_OBJ_BOWSER_WALK) { if (soundMagic == SOUND_OBJ_BOWSER_WALK) {
queue_rumble_data(3, 60); queue_rumble_data(3, 60);
} }
@ -78,7 +78,6 @@ void cur_obj_play_sound_2(s32 soundMagic) {
if (soundMagic == SOUND_OBJ_WHOMP_LOWPRIO) { if (soundMagic == SOUND_OBJ_WHOMP_LOWPRIO) {
queue_rumble_data(5, 80); queue_rumble_data(5, 80);
} }
#endif
} }
} }

View File

@ -5,8 +5,6 @@
#include "main.h" #include "main.h"
#include "thread6.h" #include "thread6.h"
#ifdef VERSION_SH
static s8 D_SH_8030CCB4; static s8 D_SH_8030CCB4;
static s32 sUnusedDisableRumble; static s32 sUnusedDisableRumble;
static s32 sRumblePakThreadActive; static s32 sRumblePakThreadActive;
@ -15,22 +13,18 @@ static s32 sRumblePakErrorCount;
s32 gRumblePakTimer; s32 gRumblePakTimer;
// These void* are OSPfs* but we don't have that header // These void* are OSPfs* but we don't have that header
// And in general, it is not necessary =)
extern s32 osMotorStop(void *); extern s32 osMotorStop(void *);
extern s32 osMotorStart(void *); extern s32 osMotorStart(void *);
extern u32 osMotorInit(OSMesgQueue *, void *, s32); extern u32 osMotorInit(OSMesgQueue *, void *, s32);
void init_rumble_pak_scheduler_queue(void) { void init_rumble_pak_scheduler_queue(void) {
osCreateMesgQueue(&gRumblePakSchedulerMesgQueue, gRumblePakSchedulerMesgBuf, 1);
osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
} }
void block_until_rumble_pak_free(void) { void block_until_rumble_pak_free(void) {
OSMesg msg;
osRecvMesg(&gRumblePakSchedulerMesgQueue, &msg, OS_MESG_BLOCK);
} }
void release_rumble_pak_control(void) { void release_rumble_pak_control(void) {
osSendMesg(&gRumblePakSchedulerMesgQueue, (OSMesg) 0, OS_MESG_NOBLOCK);
} }
static void start_rumble(void) { static void start_rumble(void) {
@ -225,17 +219,7 @@ void func_sh_8024CA04(void) {
gCurrRumbleSettings.unk0C = 4; gCurrRumbleSettings.unk0C = 4;
} }
static void thread6_rumble_loop(UNUSED void *a0) { void thread6_rumble_loop(UNUSED void *a0) {
OSMesg msg;
cancel_rumble();
sRumblePakThreadActive = TRUE;
while (TRUE) {
// Block until VI
osRecvMesg(&gRumbleThreadVIMesgQueue, &msg, OS_MESG_BLOCK);
update_rumble_data_queue(); update_rumble_data_queue();
update_rumble_pak(); update_rumble_pak();
@ -251,7 +235,6 @@ static void thread6_rumble_loop(UNUSED void *a0) {
if (gRumblePakTimer > 0) { if (gRumblePakTimer > 0) {
gRumblePakTimer--; gRumblePakTimer--;
} }
}
} }
void cancel_rumble(void) { void cancel_rumble(void) {
@ -272,17 +255,10 @@ void cancel_rumble(void) {
} }
void create_thread_6(void) { void create_thread_6(void) {
osCreateMesgQueue(&gRumbleThreadVIMesgQueue, gRumbleThreadVIMesgBuf, 1);
osCreateThread(&gRumblePakThread, 6, thread6_rumble_loop, NULL, gThread6Stack + 0x2000, 30);
osStartThread(&gRumblePakThread);
} }
void rumble_thread_update_vi(void) { void rumble_thread_update_vi(void) {
if (sRumblePakThreadActive == FALSE) { if (sRumblePakThreadActive == FALSE) {
return; return;
} }
osSendMesg(&gRumbleThreadVIMesgQueue, (OSMesg) 0x56525443, OS_MESG_NOBLOCK);
} }
#endif

View File

@ -1,8 +1,6 @@
#ifndef _THREAD_6_H #ifndef _THREAD_6_H
#define _THREAD_6_H #define _THREAD_6_H
#ifdef VERSION_SH
extern s32 gRumblePakTimer; extern s32 gRumblePakTimer;
extern void init_rumble_pak_scheduler_queue(void); extern void init_rumble_pak_scheduler_queue(void);
@ -18,6 +16,4 @@ extern void cancel_rumble(void);
extern void create_thread_6(void); extern void create_thread_6(void);
extern void rumble_thread_update_vi(void); extern void rumble_thread_update_vi(void);
#endif #endif // _THREAD_6_H
#endif

View File

@ -23,6 +23,9 @@
#include "configfile.h" #include "configfile.h"
#include "controller/controller_api.h" #include "controller/controller_api.h"
#include "game/main.h"
#include "game/thread6.h"
OSMesg D_80339BEC; OSMesg D_80339BEC;
OSMesgQueue gSIEventMesgQueue; OSMesgQueue gSIEventMesgQueue;
@ -32,6 +35,10 @@ s8 gDebugLevelSelect;
s8 gShowProfiler; s8 gShowProfiler;
s8 gShowDebugText; s8 gShowDebugText;
s32 gRumblePakPfs;
struct RumbleData gRumbleDataQueue[3];
struct StructSH8031D9B0 gCurrRumbleSettings;
static struct AudioAPI *audio_api; static struct AudioAPI *audio_api;
static struct GfxWindowManagerAPI *wm_api; static struct GfxWindowManagerAPI *wm_api;
static struct GfxRenderingAPI *rendering_api; static struct GfxRenderingAPI *rendering_api;
@ -60,6 +67,7 @@ void send_display_list(struct SPTask *spTask) {
void produce_one_frame(void) { void produce_one_frame(void) {
gfx_start_frame(); gfx_start_frame();
game_loop_one_iteration(); game_loop_one_iteration();
thread6_rumble_loop();
int samples_left = audio_api->buffered(); int samples_left = audio_api->buffered();
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528; u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;