From f85b5e99edfb2e1b9a4563cacc96892195eee379 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 16 Jan 2021 16:44:59 +0300 Subject: Includes overhaul, fix some compiler warnings --- src/core/Frontend.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/core/Frontend.cpp') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index f8945d98..086a9887 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1,10 +1,6 @@ -#if defined RW_D3D9 || defined RWLIBS -#define DIRECTINPUT_VERSION 0x0800 -#include -#endif - #define FORCE_PC_SCALING #define WITHWINDOWS +#define WITHDINPUT #include "common.h" #ifndef PS2_MENU #include "crossplatform.h" -- cgit v1.2.3 From 73f1340afb80f8749cb309b4ac89b9f13f4dff31 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 23 Jan 2021 15:59:38 +0300 Subject: Store all settings in .INI --- src/core/Frontend.cpp | 58 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 16 deletions(-) (limited to 'src/core/Frontend.cpp') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 086a9887..12e4b16a 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -563,13 +563,21 @@ CMenuManager::Initialise(void) DMAudio.Service(); DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); +#ifdef FIX_BUGS + static bool firstTime = true; + if (firstTime) { + DMAudio.SetRadioInCar(m_PrefsRadioStation); + firstTime = false; + } else +#endif m_PrefsRadioStation = DMAudio.GetRadioInCar(); + DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); if (DMAudio.IsMP3RadioChannelAvailable()) { if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK) - m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10; + m_PrefsRadioStation = CGeneral::GetRandomNumber() % (USERTRACK + 1); } else if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > WAVE) - m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9; + m_PrefsRadioStation = CGeneral::GetRandomNumber() % (WAVE + 1); CFileMgr::SetDir(""); //CFileMgr::SetDir(""); @@ -653,7 +661,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl) m_bWaitingForNewKeyBind = false; m_KeyPressedCode = -1; m_bStartWaitingForKeyBind = false; +#ifdef LOAD_INI_SETTINGS + SaveINIControllerSettings(); +#else SaveSettings(); +#endif } } @@ -3032,6 +3044,11 @@ CMenuManager::LoadSettings() CFileMgr::CloseFile(fileHandle); CFileMgr::SetDir(""); +#ifdef LOAD_INI_SETTINGS + LoadINISettings(); + LoadINIControllerSettings(); // Calling that after LoadINISettings is important because of gSelectedJoystickName loading +#endif + #ifdef FIX_BUGS TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; #endif @@ -3077,15 +3094,12 @@ CMenuManager::LoadSettings() strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME); strcpy(m_aSkinName, DEFAULT_SKIN_NAME); } - -#ifdef LOAD_INI_SETTINGS - LoadINISettings(); // needs frontend options to be loaded -#endif } void CMenuManager::SaveSettings() { +#ifndef LOAD_INI_SETTINGS static char RubbishString[48] = "stuffmorestuffevenmorestuff etc"; static int SomeVersion = 3; @@ -3144,7 +3158,14 @@ CMenuManager::SaveSettings() CFileMgr::CloseFile(fileHandle); CFileMgr::SetDir(""); -#ifdef LOAD_INI_SETTINGS +#else + m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex; + static bool firstTime = true; + // In other conditions we already call SaveINIControllerSettings explicitly. + if (firstTime) { + SaveINIControllerSettings(); + firstTime = false; + } SaveINISettings(); #endif } @@ -4424,19 +4445,19 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u MouseButtonJustClicked = false; if (CPad::GetPad(0)->GetLeftMouseJustDown()) - MouseButtonJustClicked = 1; + MouseButtonJustClicked = rsMOUSELEFTBUTTON; else if (CPad::GetPad(0)->GetRightMouseJustUp()) - MouseButtonJustClicked = 3; + MouseButtonJustClicked = rsMOUSERIGHTBUTTON; else if (CPad::GetPad(0)->GetMiddleMouseJustUp()) - MouseButtonJustClicked = 2; + MouseButtonJustClicked = rsMOUSMIDDLEBUTTON; else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) - MouseButtonJustClicked = 4; + MouseButtonJustClicked = rsMOUSEWHEELUPBUTTON; else if (CPad::GetPad(0)->GetMouseWheelDownJustUp()) - MouseButtonJustClicked = 5; + MouseButtonJustClicked = rsMOUSEWHEELDOWNBUTTON; else if (CPad::GetPad(0)->GetMouseX1JustUp()) - MouseButtonJustClicked = 6; + MouseButtonJustClicked = rsMOUSEX1BUTTON; else if (CPad::GetPad(0)->GetMouseX2JustUp()) - MouseButtonJustClicked = 7; + MouseButtonJustClicked = rsMOUSEX2BUTTON; JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); @@ -4796,6 +4817,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u TheCamera.m_bUseMouse3rdPerson = false; #endif SaveSettings(); +#ifdef LOAD_INI_SETTINGS + SaveINIControllerSettings(); +#endif } SetHelperText(2); break; @@ -4826,7 +4850,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u *option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue; - if (option.m_CFOSelect->save) + // Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO + // if (option.m_CFOSelect->save) SaveSettings(); if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc) @@ -4982,7 +5007,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u *option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue; - if (option.m_CFOSelect->save) + // Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO + // if (option.m_CFOSelect->save) SaveSettings(); if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc) -- cgit v1.2.3 From 1b3284042446551f6ff5a2c723957056131f5f31 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 22 Jan 2021 23:40:28 +0300 Subject: No more resetting bindings for joypad, create .ini at the first start, joystick hotplug for Linux --- src/core/Frontend.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/Frontend.cpp') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 12e4b16a..0a9db5a4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3045,8 +3045,13 @@ CMenuManager::LoadSettings() CFileMgr::SetDir(""); #ifdef LOAD_INI_SETTINGS - LoadINISettings(); - LoadINIControllerSettings(); // Calling that after LoadINISettings is important because of gSelectedJoystickName loading + if (LoadINISettings()) { + LoadINIControllerSettings(); + } else { + // no re3.ini, create it + SaveINISettings(); + SaveINIControllerSettings(); + } #endif #ifdef FIX_BUGS @@ -3160,12 +3165,6 @@ CMenuManager::SaveSettings() #else m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex; - static bool firstTime = true; - // In other conditions we already call SaveINIControllerSettings explicitly. - if (firstTime) { - SaveINIControllerSettings(); - firstTime = false; - } SaveINISettings(); #endif } @@ -5450,6 +5449,9 @@ CMenuManager::SwitchMenuOnAndOff() ThingsToDoBeforeLeavingPage(); #endif SaveSettings(); +#ifdef LOAD_INI_SETTINGS + SaveINIControllerSettings(); +#endif pControlEdit = nil; pEditString = nil; DisplayComboButtonErrMsg = false; -- cgit v1.2.3