You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Add Rumble support
This commit is contained in:
12
Makefile
12
Makefile
@@ -209,8 +209,8 @@ endif
|
||||
BUILD_DIR_BASE := build
|
||||
# BUILD_DIR is the location where all build artifacts are placed
|
||||
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)
|
||||
ROM := $(BUILD_DIR)/$(TARGET).z64
|
||||
ELF := $(BUILD_DIR)/$(TARGET).elf
|
||||
ROM := $(BUILD_DIR)/$(TARGET_STRING).z64
|
||||
ELF := $(BUILD_DIR)/$(TARGET_STRING).elf
|
||||
LD_SCRIPT := sm64.ld
|
||||
YAY0_DIR := $(BUILD_DIR)/bin
|
||||
SOUND_BIN_DIR := $(BUILD_DIR)/sound
|
||||
@@ -649,12 +649,20 @@ $(GLOBAL_ASM_DEP).$(NON_MATCHING):
|
||||
# Compile C code
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
ifeq ($(COMPILER),ido)
|
||||
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
|
||||
$(V)$(CC) -c $(CFLAGS) -o $@ $<
|
||||
else
|
||||
$(V)$(CC) -c $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
endif
|
||||
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
ifeq ($(COMPILER),ido)
|
||||
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
|
||||
$(V)$(CC) -c $(CFLAGS) -o $@ $<
|
||||
else
|
||||
$(V)$(CC) -c $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
endif
|
||||
|
||||
# Alternate compiler flags needed for matching
|
||||
ifeq ($(COMPILER),ido)
|
||||
|
||||
13
README.md
13
README.md
@@ -2,11 +2,10 @@
|
||||
|
||||
- This repo contains a full decompilation of Super Mario 64 (J), (U), (E), and (SH).
|
||||
- Naming and documentation of the source code and data structures are in progress.
|
||||
- Efforts to decompile the Shindou ROM steadily advance.
|
||||
- It will be edited to allow for the usage of the final "N64 OS" library, version ``2.0L``
|
||||
- Support for Shindou Rumble Pak code may be included in the future.
|
||||
- It will be patched with someone2639's shiftable segments patch
|
||||
- It will have extremely WIP HVQM full motion video support
|
||||
- It has been edited to allow for the usage of the final "N64 OS" library, version ``2.0L``
|
||||
- Shindou Rumble Pak code is on for all regions.
|
||||
- It has been patched with someone2639's shiftable segments patch
|
||||
- It will have HVQM full motion video support
|
||||
- Getting UNFLoader (flashcart USB library) to work with the game is in progress.
|
||||
|
||||
## FAQ
|
||||
@@ -19,9 +18,9 @@ This puts me at a crossroads of either touching leaked code and requiring GCC, o
|
||||
|
||||
I went with the latter.
|
||||
|
||||
Thanks to "someone2639 on soundcloud xd" for this hacky-ass idea
|
||||
Thanks to "someone2639" for this hacky-ass idea
|
||||
|
||||
Q: Will this allow me to use Rumble/FlashRAM/Transfer Pak/microcode swapping/Other Cool N64 Features?
|
||||
Q: Will this allow me to use FlashRAM/Transfer Pak/microcode swapping/Other Cool N64 Features?
|
||||
|
||||
A: Theoretically, all yes.
|
||||
|
||||
|
||||
@@ -8,16 +8,10 @@
|
||||
.word entry_point /* Entrypoint */
|
||||
|
||||
/* Revision */
|
||||
.if VERSION_SH == 1
|
||||
.word 0x00001448
|
||||
.elseif VERSION_EU == 1
|
||||
.word 0x00001446
|
||||
.else /* NTSC-U and NTSC-J 1.0 */
|
||||
.word 0x00001444
|
||||
.endif
|
||||
.word 0x0000144C
|
||||
|
||||
.word 0x4EAA3D0E /* Checksum 1 */
|
||||
.word 0x74757C24 /* Checksum 2 */
|
||||
.word 0x00000000 /* Checksum 1 */
|
||||
.word 0x00000000 /* Checksum 2 */
|
||||
.word 0x00000000 /* Unknown */
|
||||
.word 0x00000000 /* Unknown */
|
||||
.if VERSION_SH == 1
|
||||
@@ -38,8 +32,4 @@
|
||||
.ascii "P" /* PAL (Europe) */
|
||||
.endif
|
||||
|
||||
.if VERSION_SH == 1
|
||||
.byte 0x03 /* Version (Shindou) */
|
||||
.else
|
||||
.byte 0x00 /* Version */
|
||||
.endif
|
||||
|
||||
@@ -73,8 +73,8 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Perform alignment on input 's' */
|
||||
#define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1))
|
||||
|
||||
//#define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1))
|
||||
//commented out due to sm64 conflict
|
||||
|
||||
/***************************************
|
||||
*
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
/// Fixes bug where it shows a star when you grab a key in bowser battle stages
|
||||
#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU || VERSION_SH)
|
||||
|
||||
// Support Rumble Pak
|
||||
#define ENABLE_RUMBLE (1 || VERSION_SH)
|
||||
|
||||
// Screen Size Defines
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <ultra64.h>
|
||||
#include "macros.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
// Certain functions are marked as having return values, but do not
|
||||
@@ -30,7 +31,7 @@ struct Controller
|
||||
/*0x12*/ u16 buttonPressed;
|
||||
/*0x14*/ OSContStatus *statusData;
|
||||
/*0x18*/ OSContPad *controllerData;
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
/*0x1C*/ int port;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "buffers.h"
|
||||
#include "config.h"
|
||||
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
#if defined(VERSION_EU)
|
||||
@@ -15,7 +16,7 @@ ALIGNED8 u8 gIdleThreadStack[0x800];
|
||||
ALIGNED8 u8 gThread3Stack[0x2000];
|
||||
ALIGNED8 u8 gThread4Stack[0x2000];
|
||||
ALIGNED8 u8 gThread5Stack[0x2000];
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
ALIGNED8 u8 gThread6Stack[0x2000];
|
||||
#endif
|
||||
// 0x400 bytes
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "game/save_file.h"
|
||||
#include "game/game_init.h"
|
||||
#include "config.h"
|
||||
|
||||
extern u8 gDecompressionHeap[];
|
||||
|
||||
@@ -18,7 +19,7 @@ extern u8 gIdleThreadStack[];
|
||||
extern u8 gThread3Stack[];
|
||||
extern u8 gThread4Stack[];
|
||||
extern u8 gThread5Stack[];
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
extern u8 gThread6Stack[];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void cap_switch_act_2(void) {
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
spawn_mist_particles();
|
||||
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void controllable_platform_hit_wall(s8 sp1B) {
|
||||
D_80331694 = 5;
|
||||
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(50, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void exclamation_box_act_2(void) {
|
||||
o->oGravity = -8.0f;
|
||||
o->oFloorHeight = o->oPosY;
|
||||
o->oAction = 3;
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ void bhv_1up_interact(void) {
|
||||
play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource);
|
||||
gMarioState->numLives++;
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void bhv_purple_switch_loop(void) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL2_PURPLE_SWITCH);
|
||||
o->oAction = PURPLE_SWITCH_TICKING;
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void bhv_star_door_loop(void) {
|
||||
case 1:
|
||||
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_OPEN);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(35, 30);
|
||||
#endif
|
||||
}
|
||||
@@ -39,7 +39,7 @@ void bhv_star_door_loop(void) {
|
||||
case 3:
|
||||
if (o->oTimer == 0 && (s16)(o->oMoveAngleYaw) >= 0) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_STAR_DOOR_CLOSE);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(35, 30);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ void bhv_treasure_chest_ship_loop(void) {
|
||||
gEnvironmentRegions[6] = -335;
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
reset_rumble_timers_2(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void water_level_pillar_undrained(void) {
|
||||
(s32) approach_f32_symmetric(gEnvironmentLevels[2], -2450.0f, 5.0f);
|
||||
gEnvironmentLevels[0] =
|
||||
(s32) approach_f32_symmetric(gEnvironmentLevels[0], -2450.0f, 5.0f);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
reset_rumble_timers_2(2);
|
||||
#endif
|
||||
} else
|
||||
|
||||
@@ -49,7 +49,7 @@ void bhv_water_level_diamond_loop(void) {
|
||||
cur_obj_play_sound_1(SOUND_ENV_WATER_DRAIN); // same as above
|
||||
}
|
||||
o->oAngleVelYaw = 0x800;
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
reset_rumble_timers_2(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ void read_controller_inputs(void) {
|
||||
if (gControllerBits) {
|
||||
osRecvMesg(&gSIEventMesgQueue, &D_80339BEC, OS_MESG_BLOCK);
|
||||
osContGetReadData(&gControllerPads[0]);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
release_rumble_pak_control();
|
||||
#endif
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void init_controllers(void) {
|
||||
// into any port in order to play the game. this was probably
|
||||
// so if any of the ports didn't work, you can have controllers
|
||||
// plugged into any of them and it will work.
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
gControllers[cont].port = port;
|
||||
#endif
|
||||
gControllers[cont].statusData = &gControllerStatuses[port];
|
||||
@@ -599,11 +599,11 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
struct LevelCommand *addr;
|
||||
|
||||
setup_game_memory();
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
init_rumble_pak_scheduler_queue();
|
||||
#endif
|
||||
init_controllers();
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
create_thread_6();
|
||||
#endif
|
||||
save_file_load_all();
|
||||
@@ -628,7 +628,7 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
// if any controllers are plugged in, start read the data for when
|
||||
// read_controller_inputs is called later.
|
||||
if (gControllerBits) {
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
block_until_rumble_pak_free();
|
||||
#endif
|
||||
osContStartReadData(&gSIEventMesgQueue);
|
||||
|
||||
@@ -2770,7 +2770,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
|
||||
|
||||
if (gCourseCompleteCoins == 50 || gCourseCompleteCoins == 100 || gCourseCompleteCoins == 150) {
|
||||
play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource);
|
||||
gMarioState[0].numLives++;
|
||||
gMarioState->numLives++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -699,7 +699,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
||||
|
||||
m->hurtCounter += 4 * damage;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
set_camera_shake_from_hit(shake);
|
||||
@@ -750,7 +750,7 @@ u32 interact_coin(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||
&& m->numCoins >= 100) {
|
||||
bhv_spawn_star_no_level_exit(6);
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
if (o->oDamageOrCoinValue >= 2) {
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
@@ -773,7 +773,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O
|
||||
|
||||
if (m->health >= 0x100) {
|
||||
mario_stop_riding_and_holding(m);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
|
||||
@@ -876,7 +876,7 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||
m->interactObj = o;
|
||||
m->usedObj = o;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
if (o->collisionData == segmented_to_virtual(warp_pipe_seg3_collision_03009AC8)) {
|
||||
play_sound(SOUND_MENU_ENTER_PIPE, m->marioObj->header.gfx.cameraToObject);
|
||||
queue_rumble_data(15, 80);
|
||||
@@ -1123,7 +1123,7 @@ u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
||||
marioObj->oMarioWhirlpoolPosY = m->pos[1] - o->oPosY;
|
||||
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(30, 60);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_CAUGHT_IN_WHIRLPOOL, 0);
|
||||
@@ -1159,7 +1159,7 @@ u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
|
||||
if (!sInvulnerable && !(m->flags & MARIO_METAL_CAP) && !(m->flags & MARIO_VANISH_CAP)
|
||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED;
|
||||
@@ -1238,7 +1238,7 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
m->interactObj = o;
|
||||
|
||||
if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
push_mario_out_of_object(m, o, 5.0f);
|
||||
@@ -1263,7 +1263,7 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
|
||||
push_mario_out_of_object(m, o, 5.0f);
|
||||
drop_and_set_mario_action(m, bully_knock_back_mario(m), 0);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return TRUE;
|
||||
@@ -1282,7 +1282,7 @@ u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object
|
||||
|
||||
take_damage_from_interact_object(m);
|
||||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(70, 60);
|
||||
#endif
|
||||
|
||||
@@ -1331,7 +1331,7 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc
|
||||
}
|
||||
|
||||
if (interaction & INT_ANY_ATTACK) {
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
attack_object(o, interaction);
|
||||
@@ -1373,7 +1373,7 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob
|
||||
}
|
||||
|
||||
if (interaction & INT_ATTACK_NOT_FROM_BELOW) {
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
attack_object(o, interaction);
|
||||
@@ -1495,7 +1495,7 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc
|
||||
|
||||
update_mario_sound_and_camera(m);
|
||||
play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_GRABBED, 0);
|
||||
@@ -1546,7 +1546,7 @@ u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||
marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000);
|
||||
#endif
|
||||
reset_mario_pitch(m);
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
return set_mario_action(m, ACT_GRAB_POLE_FAST, 0);
|
||||
@@ -1568,7 +1568,7 @@ u32 interact_hoot(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||
m->interactObj = o;
|
||||
m->usedObj = o;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
queue_rumble_data(5, 80);
|
||||
#endif
|
||||
update_mario_sound_and_camera(m);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user