This commit is contained in:
eray orçunus 2020-09-27 04:39:25 +03:00
parent 6cfac662a1
commit 9b76424540
5 changed files with 66 additions and 22 deletions

View file

@ -261,6 +261,12 @@ ScaleAndCenterX(float x)
#define MENU_Y(y) StretchY(y) #define MENU_Y(y) StretchY(y)
#endif #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 #ifdef PS2_LIKE_MENU
#define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \ #define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \
do { \ do { \
@ -272,7 +278,7 @@ ScaleAndCenterX(float x)
if (updateDelay) \ if (updateDelay) \
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \
} \ } \
if (withReverseAlpha) { \ if (withReverseAlpha && !m_bRenderGameInMenu) { \
pendingOption = option; \ pendingOption = option; \
pendingScreen = screen; \ pendingScreen = screen; \
reverseAlpha = true; \ reverseAlpha = true; \
@ -827,7 +833,7 @@ CMenuManager::Draw()
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') { if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
PREPARE_MENU_HEADER 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. // Weird place to put that.
nextYToUse += 24.0f + 10.0f; nextYToUse += 24.0f + 10.0f;
@ -1418,10 +1424,17 @@ CMenuManager::Draw()
if (!m_bRenderGameInMenu) if (!m_bRenderGameInMenu)
#endif #endif
if (i == m_nCurrOption && itemsAreSelectable) { 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(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 // 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), CSprite2d::DrawRect(CRect(StretchX(10.0f), MENU_Y(bitAboveNextItemY),
SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)), SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)),
CRGBA(100, 200, 50, FadeIn(50))); CRGBA(100, 200, 50, FadeIn(50)));
#endif
} }
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90))); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
@ -2047,11 +2060,11 @@ CMenuManager::DrawControllerSetupScreen()
switch (m_ControlMethod) { switch (m_ControlMethod) {
case CONTROL_STANDARD: 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)); TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
break; break;
case CONTROL_CLASSIC: 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")); TheText.Get("FET_CTI"));
break; break;
default: default:
@ -2753,7 +2766,7 @@ CMenuManager::DrawPlayerSetupScreen()
PREPARE_MENU_HEADER 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 // lstrcpy's changed with strcpy
@ -3737,7 +3750,7 @@ CMenuManager::PrintStats()
// ::Draw already does that. // ::Draw already does that.
/* /*
PREPARE_MENU_HEADER 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)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
} }
@ -4513,12 +4526,17 @@ CMenuManager::ProcessButtonPresses(void)
bottomBarActive = false; bottomBarActive = false;
curBottomBarOption = hoveredBottomBarOption; curBottomBarOption = hoveredBottomBarOption;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false); ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false);
if (bbNames[curBottomBarOption].screenId == MENUPAGE_SOUND_SETTINGS)
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
return; return;
} else if (bottomBarActive) { } else if (bottomBarActive) {
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
bottomBarActive = false; 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 there's a menu change with fade ongoing, finish it now
if (reverseAlpha) if (reverseAlpha)
m_nMenuFadeAlpha = 0; m_nMenuFadeAlpha = 0;

View file

@ -242,13 +242,13 @@ enum Config {
#ifndef PC_MENU #ifndef PC_MENU
# define PS2_MENU # define PS2_MENU
//# define PS2_MENU_USEALLPAGEICONS //# 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 #else
# define MENU_MAP // VC-like menu map. Make sure you have new menu.txd # define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
# define SCROLLABLE_STATS_PAGE // only draggable by mouse atm # define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
# define TRIANGLE_BACK_BUTTON # define TRIANGLE_BACK_BUTTON
//# define CIRCLE_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 CUSTOM_FRONTEND_OPTIONS
# define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full # define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full
#endif #endif

View file

@ -267,6 +267,7 @@ void PS2AlphaTestChange(int8 displayedValue)
// Important: Make sure to read the warnings/informations in frontendoption.h!! // 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 void
CustomFrontendOptionsPopulate(void) CustomFrontendOptionsPopulate(void)
{ {
@ -369,7 +370,7 @@ CustomFrontendOptionsPopulate(void)
#ifdef FREE_CAM #ifdef FREE_CAM
SWITCH_TO_DISPLAY_MENU 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); FrontendOptionAddSelect(text, off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, true);
#endif #endif

View file

@ -11,6 +11,13 @@
bool CCredits::bCreditsGoing; bool CCredits::bCreditsGoing;
uint32 CCredits::CreditsStartTime; 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 void
CCredits::Init(void) CCredits::Init(void)
{ {
@ -39,11 +46,11 @@ CCredits::PrintCreditSpace(float space, uint32 &line)
void void
CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset) 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; float y = lineoffset + start - scrolloffset;
if(y > -50.0f && y < start){ if(y > -50.0f && y < start){
CFont::SetScale(scaleX, scaleY); CFont::SetScale(SCREEN_SCALE_X(scaleX), SCREEN_SCALE_Y(scaleY));
CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text); CFont::PrintString(SCREEN_WIDTH/2.0f, SCREEN_SCALE_Y(y), (uint16*)text);
} }
lineoffset += scaleY*25.0f; lineoffset += scaleY*25.0f;
} }
@ -62,7 +69,7 @@ CCredits::Render(void)
scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f; scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f;
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREEN_WIDTH - 20); CFont::SetCentreSize(SCALE_AND_CENTER(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetColor(CRGBA(220, 220, 220, 220)); CFont::SetColor(CRGBA(220, 220, 220, 220));
@ -489,7 +496,7 @@ CCredits::Render(void)
if(TheCamera.m_WideScreenOn) if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen(); TheCamera.DrawBordersForWideScreen();
if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f) if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f)
bCreditsGoing = false; bCreditsGoing = false;
} }
@ -497,3 +504,5 @@ bool CCredits::AreCreditsDone(void)
{ {
return !bCreditsGoing; return !bCreditsGoing;
} }
#undef SCALE_AND_CENTER

View file

@ -822,6 +822,9 @@ void joysChangeCB(int jid, int event);
bool IsThisJoystickBlacklisted(int i) bool IsThisJoystickBlacklisted(int i)
{ {
if (glfwJoystickIsGamepad(i))
return false;
const char* joyname = glfwGetJoystickName(i); const char* joyname = glfwGetJoystickName(i);
// this is just a keyboard and mouse // this is just a keyboard and mouse
@ -829,6 +832,19 @@ bool IsThisJoystickBlacklisted(int i)
// Microsoft Microsoft® 2.4GHz Transceiver v8.0 System Control // Microsoft Microsoft® 2.4GHz Transceiver v8.0 System Control
if (strstr(joyname, "2.4GHz Transceiver")) if (strstr(joyname, "2.4GHz Transceiver"))
return true; 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; 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. // Gamepad axes are guaranteed to return 0.0f if that particular gamepad doesn't have that axis.
if ( glfwPad != -1 ) { if ( glfwPad != -1 ) {
leftStickPos.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[0] : numAxes >= 0 ? axes[0] : 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 >= 1 ? axes[1] : 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.x = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[2] : numAxes >= 3 ? axes[2] : 0.0f;
rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[3] : numAxes >= 3 ? axes[3] : 0.0f; rightStickPos.y = ControlsManager.m_NewState.isGamepad ? gamepadState.axes[3] : numAxes >= 4 ? axes[3] : 0.0f;
} }
{ {