diff options
-rw-r--r-- | src/core/Frontend.cpp | 34 | ||||
-rw-r--r-- | src/core/config.h | 4 | ||||
-rw-r--r-- | src/core/re3.cpp | 3 | ||||
-rw-r--r-- | src/render/Credits.cpp | 19 | ||||
-rw-r--r-- | src/skel/glfw/glfw.cpp | 28 |
5 files changed, 66 insertions, 22 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 0e358fc5..256cf0d4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -262,6 +262,12 @@ ScaleAndCenterX(float x) #endif #ifdef PS2_LIKE_MENU +#define PAGE_NAME_X MENU_X_RIGHT_ALIGNED +#else +#define PAGE_NAME_X SCREEN_SCALE_FROM_RIGHT +#endif + +#ifdef PS2_LIKE_MENU #define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \ do { \ if (reverseAlpha) { \ @@ -272,7 +278,7 @@ ScaleAndCenterX(float x) if (updateDelay) \ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \ } \ - if (withReverseAlpha) { \ + if (withReverseAlpha && !m_bRenderGameInMenu) { \ pendingOption = option; \ pendingScreen = screen; \ reverseAlpha = true; \ @@ -827,7 +833,7 @@ CMenuManager::Draw() if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') { PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); // Weird place to put that. nextYToUse += 24.0f + 10.0f; @@ -1418,10 +1424,17 @@ CMenuManager::Draw() if (!m_bRenderGameInMenu) #endif if (i == m_nCurrOption && itemsAreSelectable) { +#ifdef PS2_LIKE_MENU // We keep stretching, because we also stretch background image and we want that bar to be aligned with borders of background - CSprite2d::DrawRect(CRect(StretchX(10.0f), MENU_Y(bitAboveNextItemY), - SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)), + CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(29.0f), MENU_Y(bitAboveNextItemY), + MENU_X_RIGHT_ALIGNED(29.0f), MENU_Y(usableLineHeight + nextItemY)), CRGBA(100, 200, 50, FadeIn(50))); +#else + // We keep stretching, because we also stretch background image and we want that bar to be aligned with borders of background + CSprite2d::DrawRect(CRect(StretchX(10.0f), MENU_Y(bitAboveNextItemY), + SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)), + CRGBA(100, 200, 50, FadeIn(50))); +#endif } CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90))); @@ -2047,11 +2060,11 @@ CMenuManager::DrawControllerSetupScreen() switch (m_ControlMethod) { case CONTROL_STANDARD: - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), + CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); break; case CONTROL_CLASSIC: - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), + CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_CTI")); break; default: @@ -2753,7 +2766,7 @@ CMenuManager::DrawPlayerSetupScreen() PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS")); + CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS")); // lstrcpy's changed with strcpy @@ -3737,7 +3750,7 @@ CMenuManager::PrintStats() // ::Draw already does that. /* PREPARE_MENU_HEADER - CFont::PrintString(MENU_X_RIGHT_ALIGNED(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + CFont::PrintString(PAGE_NAME_X(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); */ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y)); } @@ -4513,12 +4526,17 @@ CMenuManager::ProcessButtonPresses(void) bottomBarActive = false; curBottomBarOption = hoveredBottomBarOption; ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false); + if (bbNames[curBottomBarOption].screenId == MENUPAGE_SOUND_SETTINGS) + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); return; } else if (bottomBarActive) { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); bottomBarActive = false; + if (bbNames[curBottomBarOption].screenId == MENUPAGE_SOUND_SETTINGS) + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); + // If there's a menu change with fade ongoing, finish it now if (reverseAlpha) m_nMenuFadeAlpha = 0; diff --git a/src/core/config.h b/src/core/config.h index 498be8f3..13a0c099 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -242,13 +242,13 @@ enum Config { #ifndef PC_MENU # define PS2_MENU //# define PS2_MENU_USEALLPAGEICONS -# define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box -//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. #else # define MENU_MAP // VC-like menu map. Make sure you have new menu.txd # define SCROLLABLE_STATS_PAGE // only draggable by mouse atm # define TRIANGLE_BACK_BUTTON //# define CIRCLE_BACK_BUTTON +//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. +//# define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box # define CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full #endif diff --git a/src/core/re3.cpp b/src/core/re3.cpp index a7a0d7f1..13cb6283 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -267,6 +267,7 @@ void PS2AlphaTestChange(int8 displayedValue) // Important: Make sure to read the warnings/informations in frontendoption.h!! +// For texts: Either use TheText.Get, or use wcsdup(wchar version of strdup) void CustomFrontendOptionsPopulate(void) { @@ -369,7 +370,7 @@ CustomFrontendOptionsPopulate(void) #ifdef FREE_CAM SWITCH_TO_DISPLAY_MENU - static const wchar* text = (wchar*)L"FREE CAM"; + static const wchar* text = (wchar*)wcsdup(L"FREE CAM"); FrontendOptionAddSelect(text, off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, true); #endif diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 2cfdba90..2d33ce40 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -11,6 +11,13 @@ bool CCredits::bCreditsGoing; uint32 CCredits::CreditsStartTime; +#ifdef ASPECT_RATIO_SCALE +#define SCALE_AND_CENTER(x) ScaleAndCenterX(x) +extern float ScaleAndCenterX(float x); +#else +#define SCALE_AND_CENTER(x) SCREEN_STRETCH_X(x) +#endif + void CCredits::Init(void) { @@ -39,11 +46,11 @@ CCredits::PrintCreditSpace(float space, uint32 &line) void CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset) { - float start = SCREEN_HEIGHT + 50.0f; + float start = DEFAULT_SCREEN_HEIGHT + 50.0f; float y = lineoffset + start - scrolloffset; if(y > -50.0f && y < start){ - CFont::SetScale(scaleX, scaleY); - CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text); + CFont::SetScale(SCREEN_SCALE_X(scaleX), SCREEN_SCALE_Y(scaleY)); + CFont::PrintString(SCREEN_WIDTH/2.0f, SCREEN_SCALE_Y(y), (uint16*)text); } lineoffset += scaleY*25.0f; } @@ -62,7 +69,7 @@ CCredits::Render(void) scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f; CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetCentreSize(SCREEN_WIDTH - 20); + CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH - 20)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(220, 220, 220, 220)); @@ -489,7 +496,7 @@ CCredits::Render(void) if(TheCamera.m_WideScreenOn) TheCamera.DrawBordersForWideScreen(); - if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f) + if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f) bCreditsGoing = false; } @@ -497,3 +504,5 @@ bool CCredits::AreCreditsDone(void) { return !bCreditsGoing; } + +#undef SCALE_AND_CENTER
\ No newline at end of file diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index f5fd4474..d7feb885 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -822,12 +822,28 @@ void joysChangeCB(int jid, int event); bool IsThisJoystickBlacklisted(int i) { - const char *joyname = glfwGetJoystickName(i); + if (glfwJoystickIsGamepad(i)) + return false; + + const char* joyname = glfwGetJoystickName(i); // this is just a keyboard and mouse // Microsoft Microsoft® 2.4GHz Transceiver v8.0 Consumer Control // Microsoft Microsoft® 2.4GHz Transceiver v8.0 System Control - if(strstr(joyname, "2.4GHz Transceiver")) + if (strstr(joyname, "2.4GHz Transceiver")) + return true; + // COMPANY USB Device System Control + // COMPANY USB Device Consumer Control + if (strstr(joyname, "COMPANY USB")) + return true; + // i.e. Synaptics TM2438-005 + if (strstr(joyname, "Synaptics ")) + return true; + // i.e. ELAN Touchscreen + if (strstr(joyname, "ELAN ")) + return true; + // i.e. Primax Electronics, Ltd HP Wireless Keyboard Mouse Kit Consumer Control + if (strstr(joyname, "Keyboard")) return true; return false; @@ -2016,11 +2032,11 @@ void CapturePad(RwInt32 padID) // Gamepad axes are guaranteed to return 0.0f if that particular gamepad doesn't have that axis. if ( glfwPad != -1 ) { - leftStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[0] : numAxes >= 0 ? axes[0] : 0.0f; - leftStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[1] : numAxes >= 1 ? axes[1] : 0.0f; + leftStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[0] : numAxes >= 1 ? axes[0] : 0.0f; + leftStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[1] : numAxes >= 2 ? axes[1] : 0.0f; - rightStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[2] : numAxes >= 2 ? axes[2] : 0.0f; - rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[3] : numAxes >= 3 ? axes[3] : 0.0f; + rightStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[2] : numAxes >= 3 ? axes[2] : 0.0f; + rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[3] : numAxes >= 4 ? axes[3] : 0.0f; } { |