Merge pull request #595 from Arceveti/develop/2.1.0-four-controllers-base

4 controllers support + osContCh optimization
This commit is contained in:
thecozies authored and GitHub committed 2023-09-22 16:56:23 -05:00
commit cd2e639206
17 files changed
+198 -233

No files matched your search

+20 -12
View File
@@ -10,12 +10,32 @@
*/
#define INTERNAL_ROM_NAME "HackerSM64 "
/**
* Force the game to delete any existing save data originating from a different hack. This requires INTERNAL_ROM_NAME to be unique to work properly.
* It is recommended to enable this if any significant changes to the save file are made that could cause issues with this or other hacks.
* NOTE: Using save editors with this define will likely just end up wiping your save, since SM64 specific save editors most likely use hardcoded save magic.
*/
// #define UNIQUE_SAVE_DATA
/**
* Enables Rumble Pak Support.
* Currently not recommended, as it may cause random crashes.
*/
// #define ENABLE_RUMBLE (1 || VERSION_SH)
/**
* The maximum number of supported players/controllers. 1-4.
* This will save performance if the player has extra unused controllers plugged in.
* NOTE: Default is 2, maximum is 4.
* NOTE: This needs to be at least 2 for now for gamecube controller swap to work.
*/
#define MAX_NUM_PLAYERS 2
/**
* Informs supported emulators to default to GameCube controller inputs.
*/
// #define EMU_DEFAULT_TO_GCN
/**
* Screen Size Defines.
*/
@@ -29,18 +49,6 @@
#define BORDER_HEIGHT_CONSOLE 0
#define BORDER_HEIGHT_EMULATOR 0
/**
* Force the game to delete any existing save data originating from a different hack. This requires INTERNAL_ROM_NAME to be unique to work properly.
* It is recommended to enable this if any significant changes to the save file are made that could cause issues with this or other hacks.
* NOTE: Using save editors with this define will likely just end up wiping your save, since SM64 specific save editors most likely use hardcoded save magic.
*/
// #define UNIQUE_SAVE_DATA
/**
* Informs supported emulators to default to gamecube controller inputs.
*/
// #define USE_GAMECUBE_CONTROLLER
/**
* RCVI hack. Increases performance on emulator, and does nothing on console.
* Might break on some emulators. Use at your own risk, and don't use it unless you actually need the extra performance.
+5 -4
View File
@@ -112,6 +112,11 @@ typedef struct {
/* Controller type */
// Console ID:
#define CONT_CONSOLE_MASK (0x3 << 3) // 0x0018 | 0: N64, 1: Dolphin
#define CONT_CONSOLE_N64 ( 0 << 3) // 0x0000
#define CONT_CONSOLE_GCN ( 1 << 3) // 0x0008
#define CONT_ABSOLUTE 0x0001
#define CONT_RELATIVE 0x0002
#define CONT_JOYPORT 0x0004
@@ -194,9 +199,6 @@ typedef struct {
#define CONT_ERR_VOICE_WORD 14
#define CONT_ERR_VOICE_NO_RESPONSE 15
#define CONT_TYPE_N64 0
#define CONT_TYPE_GCN 1
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -213,7 +215,6 @@ typedef struct {
*
*/
extern u8 __osControllerTypes[MAXCONTROLLERS];
/**************************************************************************
*
+13 -15
View File
@@ -32,21 +32,19 @@ struct Config {
u8 tvType;
};
struct Controller {
/*0x00*/ s16 rawStickX; //
/*0x02*/ s16 rawStickY; //
/*0x04*/ f32 stickX; // [-64, 64] positive is right
/*0x08*/ f32 stickY; // [-64, 64] positive is up
/*0x0C*/ f32 stickMag; // distance from center [0, 64]
/*0x10*/ u16 buttonDown;
/*0x12*/ u16 buttonPressed;
/*0x14*/ u16 buttonReleased;
/*0x18*/ OSContStatus *statusData;
/*0x1C*/ OSContPadEx *controllerData;
#if ENABLE_RUMBLE
/*0x20*/ s32 port;
#endif
};
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.
/*0x10*/ u16 buttonDown; // Buttons held down on the current frame.
/*0x12*/ u16 buttonPressed; // Buttons pressed on the current frame but not held on the previous frame.
/*0x14*/ u16 buttonReleased; // Burrons released on the current frame and held on the previous frame.
/*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].
} Controller; /*0x24*/
// -- Booleans --