You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Updates from main input branch
This commit is contained in:
@@ -15,14 +15,14 @@
|
||||
.word 0x00000000 /* Unknown */
|
||||
.word 0x00000000 /* Unknown */
|
||||
.ascii INTERNAL_ROM_NAME /* Internal ROM name */
|
||||
#if defined(USE_GAMECUBE_CONTROLLER)
|
||||
#if defined(EMU_DEFAULT_TO_GCN)
|
||||
/* Advanced homebrew ROM header bytes: https://n64brew.dev/wiki/ROM_Header#Advanced_Homebrew_ROM_Header */
|
||||
.word 0x82000000
|
||||
#else
|
||||
.word 0x00000000 /* Unknown */
|
||||
#endif
|
||||
.word 0x0000004E /* Cartridge */
|
||||
#if defined(EEP4K) && !defined(USE_GAMECUBE_CONTROLLER)
|
||||
#if defined(EEP4K) && !defined(EMU_DEFAULT_TO_GCN)
|
||||
.ascii "SM" /* Cartridge ID */
|
||||
#else
|
||||
.ascii "ED" /* Cartridge ID */
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
#define MAX_NUM_PLAYERS 2
|
||||
|
||||
/**
|
||||
* Informs supported emulators to default to gamecube controller inputs.
|
||||
* Informs supported emulators to default to GameCube controller inputs.
|
||||
*/
|
||||
// #define USE_GAMECUBE_CONTROLLER
|
||||
// #define EMU_DEFAULT_TO_GCN
|
||||
|
||||
/**
|
||||
* Screen Size Defines.
|
||||
|
||||
@@ -32,9 +32,9 @@ struct Config {
|
||||
u8 tvType;
|
||||
};
|
||||
|
||||
struct Controller {
|
||||
/*0x00*/ s16 rawStickX; // Analog stick [-80, 80] positive is right. Used for menus.
|
||||
/*0x02*/ s16 rawStickY; // Analog stick [-80, 80] positive is up. Used for menus.
|
||||
typedef struct Controller {
|
||||
/*0x00*/ s16 rawStickX; // Analog stick [-128, 128] positive is right. Used for menus.
|
||||
/*0x02*/ s16 rawStickY; // Analog stick [-128, 128] positive is up. Used for menus.
|
||||
/*0x04*/ f32 stickX; // Analog stick [-64, 64] positive is right. Used for gameplay.
|
||||
/*0x08*/ f32 stickY; // Analog stick [-64, 64] positive is up. Used for gameplay.
|
||||
/*0x0C*/ f32 stickMag; // Analog stick distance from center [0, 64]. Used for gameplay.
|
||||
@@ -44,7 +44,7 @@ struct Controller {
|
||||
/*0x18*/ OSContStatus* statusData; // Pointer to the controller status data in gControllerStatuses.
|
||||
/*0x1C*/ OSContPadEx* controllerData; // Pointer to the raw input data in gControllerPads.
|
||||
/*0x20*/ s32 port; // The port index this controller is plugged into [0, 3].
|
||||
}; /*0x24*/
|
||||
} Controller; /*0x24*/
|
||||
|
||||
// -- Booleans --
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ u16 sRenderingFramebuffer = 0;
|
||||
// Goddard Vblank Function Caller
|
||||
void (*gGoddardVblankCallback)(void) = NULL;
|
||||
|
||||
// Defined controller slots. Anything above MAX_NUM_PLAYERS will be unused.
|
||||
// Defined player slots. Anything above MAX_NUM_PLAYERS should not be used.
|
||||
struct Controller* const gPlayer1Controller = &gControllers[0];
|
||||
struct Controller* const gPlayer2Controller = &gControllers[1];
|
||||
struct Controller* const gPlayer3Controller = &gControllers[2];
|
||||
@@ -577,8 +577,6 @@ void adjust_analog_stick(struct Controller *controller) {
|
||||
* Update the controller struct with available inputs if present.
|
||||
*/
|
||||
void read_controller_inputs(s32 threadID) {
|
||||
s32 i;
|
||||
|
||||
// If any controllers are plugged in, update the controller information.
|
||||
if (gControllerBits) {
|
||||
if (threadID == THREAD_5_GAME_LOOP) {
|
||||
@@ -593,9 +591,10 @@ void read_controller_inputs(s32 threadID) {
|
||||
run_demo_inputs();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAX_NUM_PLAYERS; i++) {
|
||||
struct Controller* controller = &gControllers[i];
|
||||
for (s32 cont = 0; cont < MAX_NUM_PLAYERS; cont++) {
|
||||
struct Controller* controller = &gControllers[cont];
|
||||
OSContPadEx* controllerData = controller->controllerData;
|
||||
|
||||
// if we're receiving inputs, update the controller struct with the new button info.
|
||||
if (controller->controllerData != NULL) {
|
||||
// HackerSM64: Swaps Z and L, only on console, and only when playing with a GameCube controller.
|
||||
@@ -630,19 +629,29 @@ void read_controller_inputs(s32 threadID) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Links a controller struct to the appropriate status and pad.
|
||||
*
|
||||
* @param[out] controller The controller to link.
|
||||
* @param[in ] port The port to get the data from.
|
||||
*/
|
||||
static void assign_controller_data_to_port(struct Controller* controller, int port) {
|
||||
controller->statusData = &gControllerStatuses[port];
|
||||
controller->controllerData = &gControllerPads[port];
|
||||
controller->port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the controller structs to point at the OSCont information.
|
||||
*/
|
||||
void init_controllers(void) {
|
||||
struct Controller* controller = NULL;
|
||||
int port, cont = 0;
|
||||
int lastUsedPort = -1;
|
||||
|
||||
// Set controller 1 to point to the set of status/pads for input 1 and
|
||||
// init the controllers.
|
||||
gControllers[0].statusData = &gControllerStatuses[0];
|
||||
gControllers[0].controllerData = &gControllerPads[0];
|
||||
osContInit(&gSIEventMesgQueue, &gControllerBits, &gControllerStatuses[0]);
|
||||
assign_controller_data_to_port(&gControllers[0], 0);
|
||||
osContInit(&gSIEventMesgQueue, &gControllerBits, gControllerStatuses);
|
||||
|
||||
#ifdef EEP
|
||||
// strangely enough, the EEPROM probe for save data is done in this function.
|
||||
@@ -667,10 +676,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.
|
||||
controller = &gControllers[cont];
|
||||
controller->statusData = &gControllerStatuses[port];
|
||||
controller->controllerData = &gControllerPads[port];
|
||||
controller->port = port;
|
||||
assign_controller_data_to_port(&gControllers[cont], port);
|
||||
|
||||
lastUsedPort = port;
|
||||
|
||||
@@ -683,8 +689,8 @@ void init_controllers(void) {
|
||||
// so if port 1 is an N64 controller and port 2 is a GC controller, swap them.
|
||||
if (gEmulator & EMU_CONSOLE) {
|
||||
if (
|
||||
__osControllerTypes[0] == CONT_TYPE_N64 &&
|
||||
__osControllerTypes[1] == CONT_TYPE_GCN
|
||||
(__osControllerTypes[0] == CONT_TYPE_N64) &&
|
||||
(__osControllerTypes[1] == CONT_TYPE_GCN)
|
||||
) {
|
||||
struct Controller temp = gControllers[0];
|
||||
gControllers[0] = gControllers[1];
|
||||
|
||||
@@ -1711,7 +1711,10 @@ s32 execute_mario_action(UNUSED struct Object *obj) {
|
||||
|
||||
if (gMarioState->action) {
|
||||
#ifdef ENABLE_DEBUG_FREE_MOVE
|
||||
if (gPlayer1Controller->buttonDown & U_JPAD && !(gPlayer1Controller->buttonDown & L_TRIG)) {
|
||||
if (
|
||||
(gMarioState->controller->buttonDown & U_JPAD) &&
|
||||
!(gMarioState->controller->buttonDown & L_TRIG)
|
||||
) {
|
||||
set_camera_mode(gMarioState->area->camera, CAMERA_MODE_8_DIRECTIONS, 1);
|
||||
set_mario_action(gMarioState, ACT_DEBUG_FREE_MOVE, 0);
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ UNUSED s32 debug_sequence_tracker(s16 debugInputSequence[]) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// If the third controller button pressed is next in sequence, reset timer and progress to next value.
|
||||
// If the button pressed is next in sequence, reset timer and progress to next value.
|
||||
if (debugInputSequence[sDebugSequenceTracker] & gPlayer1Controller->buttonPressed) {
|
||||
sDebugSequenceTracker++;
|
||||
sDebugTimer = 0;
|
||||
|
||||
Reference in New Issue
Block a user