diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index b421444b..9456a653 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -118,8 +118,8 @@ IsleApp::IsleApp() m_drawCursor = FALSE; m_use3dSound = TRUE; m_useMusic = TRUE; - m_useGamepad = TRUE; - m_gamepadIndex = 0; + m_useJoystick = TRUE; + m_joystickIndex = 0; m_wideViewAngle = TRUE; m_islandQuality = 2; m_islandTexture = 1; @@ -833,8 +833,8 @@ MxResult IsleApp::SetupWindow() RealtimeView::SetUserMaxLOD(m_maxLod); if (LegoOmni::GetInstance()) { if (LegoOmni::GetInstance()->GetInputManager()) { - LegoOmni::GetInstance()->GetInputManager()->SetUseGamepad(m_useGamepad); - LegoOmni::GetInstance()->GetInputManager()->SetGamepadIndex(m_gamepadIndex); + LegoOmni::GetInstance()->GetInputManager()->SetUseJoystick(m_useJoystick); + LegoOmni::GetInstance()->GetInputManager()->SetJoystickIndex(m_joystickIndex); } if (LegoOmni::GetInstance()->GetVideoManager() && g_isle->GetDrawCursor()) { LegoOmni::GetInstance()->GetVideoManager()->SetCursorBitmap(m_cursorCurrentBitmap); @@ -923,8 +923,8 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:3DSound", m_use3dSound ? "true" : "false"); iniparser_set(dict, "isle:Music", m_useMusic ? "true" : "false"); - iniparser_set(dict, "isle:UseJoystick", m_useGamepad ? "true" : "false"); - iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_gamepadIndex, buf, 10)); + iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false"); + iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10)); iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false"); SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity); iniparser_set(dict, "isle:Cursor Sensitivity", buf); @@ -979,8 +979,8 @@ bool IsleApp::LoadConfig() m_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle); m_use3dSound = iniparser_getboolean(dict, "isle:3DSound", m_use3dSound); m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic); - m_useGamepad = iniparser_getboolean(dict, "isle:UseJoystick", m_useGamepad); - m_gamepadIndex = iniparser_getint(dict, "isle:JoystickIndex", m_gamepadIndex); + m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick); + m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex); m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor); m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity); diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 7ff8fa0c..970753e4 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -74,8 +74,8 @@ class IsleApp { MxS32 m_hasLightSupport; // 0x24 MxS32 m_use3dSound; // 0x28 MxS32 m_useMusic; // 0x2c - MxS32 m_useGamepad; // 0x30 - MxS32 m_gamepadIndex; // 0x34 + MxS32 m_useJoystick; // 0x30 + MxS32 m_joystickIndex; // 0x34 MxS32 m_wideViewAngle; // 0x38 MxS32 m_islandQuality; // 0x3c MxS32 m_islandTexture; // 0x40 diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 86be3cd7..ece1cbd1 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -108,8 +108,8 @@ class LegoInputManager : public MxPresenter { MxResult Create(HWND p_hwnd); void Destroy() override; - MxResult GetGamepad(); - MxResult GetGamepadState(MxU32* p_gamepadX, MxU32* p_gamepadY, MxU32* p_povPosition); + MxResult GetJoystick(); + MxResult GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, MxU32* p_povPosition); void StartAutoDragTimer(); void StopAutoDragTimer(); void EnableInputProcessing(); @@ -121,8 +121,8 @@ class LegoInputManager : public MxPresenter { void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; } void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; } void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } - void SetUseGamepad(MxBool p_useGamepad) { m_useGamepad = p_useGamepad; } - void SetGamepadIndex(MxS32 p_gamepadIndex) { m_gamepadIndex = p_gamepadIndex; } + void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; } + void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; } void DisableInputProcessing() { @@ -165,12 +165,12 @@ class LegoInputManager : public MxPresenter { MxBool m_unk0x88; // 0x88 const bool* m_keyboardState; MxBool m_unk0x195; // 0x195 - SDL_JoystickID* m_gamepadids; - SDL_Gamepad* m_gamepad; - MxS32 m_gamepadIndex; // 0x19c - MxBool m_useGamepad; // 0x334 - MxBool m_unk0x335; // 0x335 - MxBool m_unk0x336; // 0x336 + SDL_JoystickID* m_joyids; + SDL_Gamepad* m_joystick; + MxS32 m_joystickIndex; // 0x19c + MxBool m_useJoystick; // 0x334 + MxBool m_unk0x335; // 0x335 + MxBool m_unk0x336; // 0x336 }; // TEMPLATE: LEGO1 0x10028850 diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 0e41c9d6..4308717a 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -533,7 +533,7 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) MxS32 povPosition; if (instance->GetInputManager() - ->GetGamepadState((MxU32*) &joystickX, (MxU32*) &joystickY, (MxU32*) &povPosition) != FAILURE) { + ->GetJoystickState((MxU32*) &joystickX, (MxU32*) &joystickY, (MxU32*) &povPosition) != FAILURE) { MxU32 yVal = (joystickY * m_vMax) / 100; MxU32 xVal = (joystickX * m_hMax) / 100; diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index d4edc0c3..eca8078b 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -40,10 +40,10 @@ LegoInputManager::LegoInputManager() m_unk0x81 = FALSE; m_unk0x88 = FALSE; m_unk0x195 = 0; - m_gamepadids = NULL; - m_gamepadIndex = -1; - m_gamepad = NULL; - m_useGamepad = FALSE; + m_joyids = NULL; + m_joystickIndex = -1; + m_joystick = NULL; + m_useJoystick = FALSE; m_unk0x335 = FALSE; m_unk0x336 = FALSE; m_unk0x74 = 0x19; @@ -71,7 +71,7 @@ MxResult LegoInputManager::Create(HWND p_hwnd) m_eventQueue = new LegoEventQueue; } - GetGamepad(); + GetJoystick(); if (!m_keyboardNotifyList || !m_eventQueue) { Destroy(); @@ -98,7 +98,7 @@ void LegoInputManager::Destroy() delete m_controlManager; } - SDL_free(m_gamepadids); + SDL_free(m_joyids); } // FUNCTION: LEGO1 0x1005c0f0 @@ -146,31 +146,31 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags) } // FUNCTION: LEGO1 0x1005c240 -MxResult LegoInputManager::GetGamepad() +MxResult LegoInputManager::GetJoystick() { - if (m_gamepad != NULL && SDL_GamepadConnected(m_gamepad) == TRUE) { + if (m_joystick != NULL && SDL_GamepadConnected(m_joystick) == TRUE) { return SUCCESS; } - MxS32 numGamepads = 0; - if (m_gamepadids != NULL) { - SDL_free(m_gamepadids); - m_gamepadids = NULL; + MxS32 numJoysticks = 0; + if (m_joyids != NULL) { + SDL_free(m_joyids); + m_joyids = NULL; } - m_gamepadids = SDL_GetGamepads(&numGamepads); + m_joyids = SDL_GetGamepads(&numJoysticks); - if (m_useGamepad != FALSE && numGamepads != 0) { - MxS32 gamepadid = m_gamepadIndex; - if (gamepadid >= 0) { - m_gamepad = SDL_OpenGamepad(m_gamepadids[gamepadid]); - if (m_gamepad != NULL) { + if (m_useJoystick != FALSE && numJoysticks != 0) { + MxS32 joyid = m_joystickIndex; + if (joyid >= 0) { + m_joystick = SDL_OpenGamepad(m_joyids[joyid]); + if (m_joystick != NULL) { return SUCCESS; } } - for (gamepadid = 0; gamepadid < numGamepads; gamepadid++) { - m_gamepad = SDL_OpenGamepad(m_gamepadids[gamepadid]); - if (m_gamepad != NULL) { + for (joyid = 0; joyid < numJoysticks; joyid++) { + m_joystick = SDL_OpenGamepad(m_joyids[joyid]); + if (m_joystick != NULL) { return SUCCESS; } } @@ -180,21 +180,21 @@ MxResult LegoInputManager::GetGamepad() } // FUNCTION: LEGO1 0x1005c320 -MxResult LegoInputManager::GetGamepadState(MxU32* p_gamepadX, MxU32* p_gamepadY, MxU32* p_povPosition) +MxResult LegoInputManager::GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, MxU32* p_povPosition) { - if (m_useGamepad != FALSE) { - if (GetGamepad() == -1) { - if (m_gamepad != NULL) { - // GetGamepad() failed but handle to joystick is still open, close it - SDL_CloseGamepad(m_gamepad); - m_gamepad = NULL; + if (m_useJoystick != FALSE) { + if (GetJoystick() == -1) { + if (m_joystick != NULL) { + // GetJoystick() failed but handle to joystick is still open, close it + SDL_CloseGamepad(m_joystick); + m_joystick = NULL; } return FAILURE; } - MxS16 xPos = SDL_GetGamepadAxis(m_gamepad, SDL_GAMEPAD_AXIS_LEFTX); - MxS16 yPos = SDL_GetGamepadAxis(m_gamepad, SDL_GAMEPAD_AXIS_LEFTY); + MxS16 xPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTX); + MxS16 yPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTY); if (xPos > -8000 && xPos < 8000) { // Ignore small axis values xPos = 0; @@ -205,8 +205,8 @@ MxResult LegoInputManager::GetGamepadState(MxU32* p_gamepadX, MxU32* p_gamepadY, } // normalize values acquired from joystick axes - *p_gamepadX = ((xPos + 32768) * 100) / 65535; - *p_gamepadY = ((yPos + 32768) * 100) / 65535; + *p_joystickX = ((xPos + 32768) * 100) / 65535; + *p_joystickY = ((yPos + 32768) * 100) / 65535; return SUCCESS; }