mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 04:21:15 +00:00
🚚 fix: use original joystick variable name
This commit is contained in:
parent
a2e5ed2393
commit
17df90bb2e
@ -118,8 +118,8 @@ IsleApp::IsleApp()
|
|||||||
m_drawCursor = FALSE;
|
m_drawCursor = FALSE;
|
||||||
m_use3dSound = TRUE;
|
m_use3dSound = TRUE;
|
||||||
m_useMusic = TRUE;
|
m_useMusic = TRUE;
|
||||||
m_useGamepad = TRUE;
|
m_useJoystick = TRUE;
|
||||||
m_gamepadIndex = 0;
|
m_joystickIndex = 0;
|
||||||
m_wideViewAngle = TRUE;
|
m_wideViewAngle = TRUE;
|
||||||
m_islandQuality = 2;
|
m_islandQuality = 2;
|
||||||
m_islandTexture = 1;
|
m_islandTexture = 1;
|
||||||
@ -833,8 +833,8 @@ MxResult IsleApp::SetupWindow()
|
|||||||
RealtimeView::SetUserMaxLOD(m_maxLod);
|
RealtimeView::SetUserMaxLOD(m_maxLod);
|
||||||
if (LegoOmni::GetInstance()) {
|
if (LegoOmni::GetInstance()) {
|
||||||
if (LegoOmni::GetInstance()->GetInputManager()) {
|
if (LegoOmni::GetInstance()->GetInputManager()) {
|
||||||
LegoOmni::GetInstance()->GetInputManager()->SetUseGamepad(m_useGamepad);
|
LegoOmni::GetInstance()->GetInputManager()->SetUseJoystick(m_useJoystick);
|
||||||
LegoOmni::GetInstance()->GetInputManager()->SetGamepadIndex(m_gamepadIndex);
|
LegoOmni::GetInstance()->GetInputManager()->SetJoystickIndex(m_joystickIndex);
|
||||||
}
|
}
|
||||||
if (LegoOmni::GetInstance()->GetVideoManager() && g_isle->GetDrawCursor()) {
|
if (LegoOmni::GetInstance()->GetVideoManager() && g_isle->GetDrawCursor()) {
|
||||||
LegoOmni::GetInstance()->GetVideoManager()->SetCursorBitmap(m_cursorCurrentBitmap);
|
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:3DSound", m_use3dSound ? "true" : "false");
|
||||||
iniparser_set(dict, "isle:Music", m_useMusic ? "true" : "false");
|
iniparser_set(dict, "isle:Music", m_useMusic ? "true" : "false");
|
||||||
|
|
||||||
iniparser_set(dict, "isle:UseJoystick", m_useGamepad ? "true" : "false");
|
iniparser_set(dict, "isle:UseJoystick", m_useJoystick ? "true" : "false");
|
||||||
iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_gamepadIndex, buf, 10));
|
iniparser_set(dict, "isle:JoystickIndex", SDL_itoa(m_joystickIndex, buf, 10));
|
||||||
iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false");
|
iniparser_set(dict, "isle:Draw Cursor", m_drawCursor ? "true" : "false");
|
||||||
SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity);
|
SDL_snprintf(buf, sizeof(buf), "%f", m_cursorSensitivity);
|
||||||
iniparser_set(dict, "isle:Cursor Sensitivity", buf);
|
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_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle);
|
||||||
m_use3dSound = iniparser_getboolean(dict, "isle:3DSound", m_use3dSound);
|
m_use3dSound = iniparser_getboolean(dict, "isle:3DSound", m_use3dSound);
|
||||||
m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic);
|
m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic);
|
||||||
m_useGamepad = iniparser_getboolean(dict, "isle:UseJoystick", m_useGamepad);
|
m_useJoystick = iniparser_getboolean(dict, "isle:UseJoystick", m_useJoystick);
|
||||||
m_gamepadIndex = iniparser_getint(dict, "isle:JoystickIndex", m_gamepadIndex);
|
m_joystickIndex = iniparser_getint(dict, "isle:JoystickIndex", m_joystickIndex);
|
||||||
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
|
m_drawCursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_drawCursor);
|
||||||
m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity);
|
m_cursorSensitivity = iniparser_getdouble(dict, "isle:Cursor Sensitivity", m_cursorSensitivity);
|
||||||
|
|
||||||
|
|||||||
@ -74,8 +74,8 @@ class IsleApp {
|
|||||||
MxS32 m_hasLightSupport; // 0x24
|
MxS32 m_hasLightSupport; // 0x24
|
||||||
MxS32 m_use3dSound; // 0x28
|
MxS32 m_use3dSound; // 0x28
|
||||||
MxS32 m_useMusic; // 0x2c
|
MxS32 m_useMusic; // 0x2c
|
||||||
MxS32 m_useGamepad; // 0x30
|
MxS32 m_useJoystick; // 0x30
|
||||||
MxS32 m_gamepadIndex; // 0x34
|
MxS32 m_joystickIndex; // 0x34
|
||||||
MxS32 m_wideViewAngle; // 0x38
|
MxS32 m_wideViewAngle; // 0x38
|
||||||
MxS32 m_islandQuality; // 0x3c
|
MxS32 m_islandQuality; // 0x3c
|
||||||
MxS32 m_islandTexture; // 0x40
|
MxS32 m_islandTexture; // 0x40
|
||||||
|
|||||||
@ -108,8 +108,8 @@ class LegoInputManager : public MxPresenter {
|
|||||||
|
|
||||||
MxResult Create(HWND p_hwnd);
|
MxResult Create(HWND p_hwnd);
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
MxResult GetGamepad();
|
MxResult GetJoystick();
|
||||||
MxResult GetGamepadState(MxU32* p_gamepadX, MxU32* p_gamepadY, MxU32* p_povPosition);
|
MxResult GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, MxU32* p_povPosition);
|
||||||
void StartAutoDragTimer();
|
void StartAutoDragTimer();
|
||||||
void StopAutoDragTimer();
|
void StopAutoDragTimer();
|
||||||
void EnableInputProcessing();
|
void EnableInputProcessing();
|
||||||
@ -121,8 +121,8 @@ class LegoInputManager : public MxPresenter {
|
|||||||
void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
|
void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
|
||||||
void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
|
void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
|
||||||
void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
|
void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
|
||||||
void SetUseGamepad(MxBool p_useGamepad) { m_useGamepad = p_useGamepad; }
|
void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; }
|
||||||
void SetGamepadIndex(MxS32 p_gamepadIndex) { m_gamepadIndex = p_gamepadIndex; }
|
void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; }
|
||||||
|
|
||||||
void DisableInputProcessing()
|
void DisableInputProcessing()
|
||||||
{
|
{
|
||||||
@ -165,10 +165,10 @@ class LegoInputManager : public MxPresenter {
|
|||||||
MxBool m_unk0x88; // 0x88
|
MxBool m_unk0x88; // 0x88
|
||||||
const bool* m_keyboardState;
|
const bool* m_keyboardState;
|
||||||
MxBool m_unk0x195; // 0x195
|
MxBool m_unk0x195; // 0x195
|
||||||
SDL_JoystickID* m_gamepadids;
|
SDL_JoystickID* m_joyids;
|
||||||
SDL_Gamepad* m_gamepad;
|
SDL_Gamepad* m_joystick;
|
||||||
MxS32 m_gamepadIndex; // 0x19c
|
MxS32 m_joystickIndex; // 0x19c
|
||||||
MxBool m_useGamepad; // 0x334
|
MxBool m_useJoystick; // 0x334
|
||||||
MxBool m_unk0x335; // 0x335
|
MxBool m_unk0x335; // 0x335
|
||||||
MxBool m_unk0x336; // 0x336
|
MxBool m_unk0x336; // 0x336
|
||||||
};
|
};
|
||||||
|
|||||||
@ -533,7 +533,7 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und)
|
|||||||
MxS32 povPosition;
|
MxS32 povPosition;
|
||||||
|
|
||||||
if (instance->GetInputManager()
|
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 yVal = (joystickY * m_vMax) / 100;
|
||||||
MxU32 xVal = (joystickX * m_hMax) / 100;
|
MxU32 xVal = (joystickX * m_hMax) / 100;
|
||||||
|
|
||||||
|
|||||||
@ -40,10 +40,10 @@ LegoInputManager::LegoInputManager()
|
|||||||
m_unk0x81 = FALSE;
|
m_unk0x81 = FALSE;
|
||||||
m_unk0x88 = FALSE;
|
m_unk0x88 = FALSE;
|
||||||
m_unk0x195 = 0;
|
m_unk0x195 = 0;
|
||||||
m_gamepadids = NULL;
|
m_joyids = NULL;
|
||||||
m_gamepadIndex = -1;
|
m_joystickIndex = -1;
|
||||||
m_gamepad = NULL;
|
m_joystick = NULL;
|
||||||
m_useGamepad = FALSE;
|
m_useJoystick = FALSE;
|
||||||
m_unk0x335 = FALSE;
|
m_unk0x335 = FALSE;
|
||||||
m_unk0x336 = FALSE;
|
m_unk0x336 = FALSE;
|
||||||
m_unk0x74 = 0x19;
|
m_unk0x74 = 0x19;
|
||||||
@ -71,7 +71,7 @@ MxResult LegoInputManager::Create(HWND p_hwnd)
|
|||||||
m_eventQueue = new LegoEventQueue;
|
m_eventQueue = new LegoEventQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGamepad();
|
GetJoystick();
|
||||||
|
|
||||||
if (!m_keyboardNotifyList || !m_eventQueue) {
|
if (!m_keyboardNotifyList || !m_eventQueue) {
|
||||||
Destroy();
|
Destroy();
|
||||||
@ -98,7 +98,7 @@ void LegoInputManager::Destroy()
|
|||||||
delete m_controlManager;
|
delete m_controlManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(m_gamepadids);
|
SDL_free(m_joyids);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1005c0f0
|
// FUNCTION: LEGO1 0x1005c0f0
|
||||||
@ -146,31 +146,31 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1005c240
|
// 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;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MxS32 numGamepads = 0;
|
MxS32 numJoysticks = 0;
|
||||||
if (m_gamepadids != NULL) {
|
if (m_joyids != NULL) {
|
||||||
SDL_free(m_gamepadids);
|
SDL_free(m_joyids);
|
||||||
m_gamepadids = NULL;
|
m_joyids = NULL;
|
||||||
}
|
}
|
||||||
m_gamepadids = SDL_GetGamepads(&numGamepads);
|
m_joyids = SDL_GetGamepads(&numJoysticks);
|
||||||
|
|
||||||
if (m_useGamepad != FALSE && numGamepads != 0) {
|
if (m_useJoystick != FALSE && numJoysticks != 0) {
|
||||||
MxS32 gamepadid = m_gamepadIndex;
|
MxS32 joyid = m_joystickIndex;
|
||||||
if (gamepadid >= 0) {
|
if (joyid >= 0) {
|
||||||
m_gamepad = SDL_OpenGamepad(m_gamepadids[gamepadid]);
|
m_joystick = SDL_OpenGamepad(m_joyids[joyid]);
|
||||||
if (m_gamepad != NULL) {
|
if (m_joystick != NULL) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (gamepadid = 0; gamepadid < numGamepads; gamepadid++) {
|
for (joyid = 0; joyid < numJoysticks; joyid++) {
|
||||||
m_gamepad = SDL_OpenGamepad(m_gamepadids[gamepadid]);
|
m_joystick = SDL_OpenGamepad(m_joyids[joyid]);
|
||||||
if (m_gamepad != NULL) {
|
if (m_joystick != NULL) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,21 +180,21 @@ MxResult LegoInputManager::GetGamepad()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1005c320
|
// 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 (m_useJoystick != FALSE) {
|
||||||
if (GetGamepad() == -1) {
|
if (GetJoystick() == -1) {
|
||||||
if (m_gamepad != NULL) {
|
if (m_joystick != NULL) {
|
||||||
// GetGamepad() failed but handle to joystick is still open, close it
|
// GetJoystick() failed but handle to joystick is still open, close it
|
||||||
SDL_CloseGamepad(m_gamepad);
|
SDL_CloseGamepad(m_joystick);
|
||||||
m_gamepad = NULL;
|
m_joystick = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MxS16 xPos = SDL_GetGamepadAxis(m_gamepad, SDL_GAMEPAD_AXIS_LEFTX);
|
MxS16 xPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTX);
|
||||||
MxS16 yPos = SDL_GetGamepadAxis(m_gamepad, SDL_GAMEPAD_AXIS_LEFTY);
|
MxS16 yPos = SDL_GetGamepadAxis(m_joystick, SDL_GAMEPAD_AXIS_LEFTY);
|
||||||
if (xPos > -8000 && xPos < 8000) {
|
if (xPos > -8000 && xPos < 8000) {
|
||||||
// Ignore small axis values
|
// Ignore small axis values
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
@ -205,8 +205,8 @@ MxResult LegoInputManager::GetGamepadState(MxU32* p_gamepadX, MxU32* p_gamepadY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// normalize values acquired from joystick axes
|
// normalize values acquired from joystick axes
|
||||||
*p_gamepadX = ((xPos + 32768) * 100) / 65535;
|
*p_joystickX = ((xPos + 32768) * 100) / 65535;
|
||||||
*p_gamepadY = ((yPos + 32768) * 100) / 65535;
|
*p_joystickY = ((yPos + 32768) * 100) / 65535;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user