refactor: use enum controller types

This commit is contained in:
str1k3r committed 2026-09-05 09:17:13 -04:00
1 parent e71fe15126
commit 9b7d5a0c25
1 file changed
+49 -40
+49 -40
View File
@@ -50,7 +50,7 @@
#endif #endif
#ifdef _WINDOWS64 #ifdef _WINDOWS64
string m_LastControllerType = "mrow"; EControllerType m_LastControllerType;
#endif #endif
CRITICAL_SECTION UIController::ms_reloadSkinsCS; CRITICAL_SECTION UIController::ms_reloadSkinsCS;
@@ -509,35 +509,42 @@ void UIController::tick()
//str1k3r - this is what actually does all the autoswitching //str1k3r - this is what actually does all the autoswitching
void UIController::GetControllerType() void UIController::GetControllerType()
{ {
const char* ControllerType = InputManager.GetControllerType(0); EControllerType ControllerType = InputManager.GetControllerType(0);
wstring controlTooltipsPath = L""; wstring controlTooltipsPath = L"";
if(ControllerType != m_LastControllerType) if(ControllerType != m_LastControllerType)
{ {
m_LastControllerType = ControllerType; m_LastControllerType = ControllerType;
//if (strcmp(ControllerType, "PS3") == 0) switch(ControllerType)
//{
// controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
//}
//else if (strcmp(ControllerType, "PS4") == 0)
//{
// controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
//}
if (strcmp(ControllerType, "XBOXONE") == 0 || strcmp(ControllerType, "UNKNOWN") == 0)
{ {
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf"; case EControllerType_Xbox360:
} controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf";
else if (strcmp(ControllerType, "XBOX360") == 0) break;
{ case EControllerType_Default:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf"; case EControllerType_XboxOne:
} controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf";
else break;
{ /*
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf"; case EControllerType_PS3:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
break;
case EControllerType_PS4:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
break;
case EControllerType_PS5:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\PS5HDControls.swf" : L"ControlTooltips\\PS5Controls.swf";
break;
case EControllerType_Switch:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\SwitchHDControls.swf" : L"ControlTooltips\\SwitchControls.swf";
break;
*/
default:
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf";
break;
} }
ReloadSkin(eLibrary_ControlTooltips, controlTooltipsPath, (m_fScreenHeight >= 1080.0f) ? L"skinControlTooltipsHD.swf" : L"skinControlTooltips.swf"); ReloadSkin(eLibrary_ControlTooltips, controlTooltipsPath, (ui.getScreenWidth() >= 1920) ? L"skinControlTooltipsHD.swf" : L"skinControlTooltips.swf");
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
{ {
@@ -556,27 +563,29 @@ void UIController::GetControllerType()
wstring UIController::GetTooltipSkinPath() wstring UIController::GetTooltipSkinPath()
{ {
const char* ControllerType = InputManager.GetControllerType(0); EControllerType ControllerType = InputManager.GetControllerType(0);
//if (strcmp(ControllerType, "PS3") == 0) switch(ControllerType)
//{
// return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
//}
//else if (strcmp(ControllerType, "PS4") == 0)
//{
// return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
//}
if (strcmp(ControllerType, "XBOXONE") == 0 || strcmp(ControllerType, "UNKNOWN") == 0)
{ {
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf"; case EControllerType_XboxOne:
} case EControllerType_Xbox360:
else if (strcmp(ControllerType, "XBOX360") == 0) return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf";
{ case EControllerType_Default:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf"; //case EControllerType_XboxOne:
} return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf";
else /*
{ case EControllerType_PS3:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf"; return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
case EControllerType_PS4:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
case EControllerType_PS5:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\PS5HDControls.swf" : L"ControlTooltips\\PS5Controls.swf";
case EControllerType_Switch:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\SwitchHDControls.swf" : L"ControlTooltips\\SwitchControls.swf";
*/
default:
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf";
break;
} }
} }
#endif #endif