Wii: Add adjustable gyroscope settings (closes #2245)

This commit is contained in:
Vicki Pfau 2021-10-12 14:33:55 -07:00
parent 40d4c430fc
commit b4f4f2b0fa
2 changed files with 24 additions and 3 deletions

View File

@ -34,6 +34,7 @@ Misc:
- Qt: Rearrange menus some
- Qt: Clean up cheats dialog
- Qt: Only set default controller bindings if loading fails (fixes mgba.io/i/799)
- Wii: Add adjustable gyroscope settings (closes mgba.io/i/2245)
0.9.2: (2021-07-10)
Emulation fixes:

View File

@ -43,7 +43,7 @@
#define ANALOG_DEADZONE 0x30
static void _mapKey(struct mInputMap* map, uint32_t binding, int nativeKey, enum GBAKey key) {
static void _mapKey(struct mInputMap* map, uint32_t binding, int nativeKey, int key) {
mInputBindKey(map, binding, __builtin_ctz(nativeKey), key);
}
@ -124,6 +124,7 @@ static bool sgbCrop = false;
static int32_t tiltX;
static int32_t tiltY;
static int32_t gyroZ;
static float gyroSensitivity = 1.f;
static uint32_t retraceCount;
static uint32_t referenceRetraceCount;
static bool frameLimiter = true;
@ -564,8 +565,26 @@ int main(int argc, char* argv[]) {
},
.nStates = 8
},
{
.title = "Gyroscope sensitivity",
.data = GUI_V_S("gyroSensitivity"),
.submenu = 0,
.state = 0,
.validStates = (const char*[]) {
"1x", "1x flipped", "2x", "2x flipped", "1/2x", "1/2x flipped"
},
.stateMappings = (const struct GUIVariant[]) {
GUI_V_F(1.f),
GUI_V_F(-1.f),
GUI_V_F(2.f),
GUI_V_F(-2.f),
GUI_V_F(0.5f),
GUI_V_F(-0.5f),
},
.nStates = 6
},
},
.nConfigExtra = 5,
.nConfigExtra = 6,
.setup = _setup,
.teardown = 0,
.gameLoaded = _gameLoaded,
@ -976,6 +995,7 @@ void _unpaused(struct mGUIRunner* runner) {
if (mCoreConfigGetFloatValue(&runner->config, "stretchHeight", &stretch)) {
hStretch = fminf(1.0f, fmaxf(0.5f, stretch));
}
mCoreConfigGetFloatValue(&runner->config, "gyroSensitivity", &gyroSensitivity);
}
void _prepareForFrame(struct mGUIRunner* runner) {
@ -1220,7 +1240,7 @@ int32_t _readTiltY(struct mRotationSource* source) {
int32_t _readGyroZ(struct mRotationSource* source) {
UNUSED(source);
return gyroZ;
return gyroZ * gyroSensitivity;
}
static s8 WPAD_StickX(u8 chan, u8 right) {