From ada2054a3bb9f578dfcc2f7cc37a7373b1eb7831 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 25 Jul 2014 00:43:47 +0200 Subject: [PATCH] Mobile shadows Some CMenuManager stuff reversed --- VCS PC/Audio.cpp | 1 + VCS PC/Audio.h | 1 + VCS PC/FileMgr.cpp | 2 + VCS PC/Font.cpp | 1 + VCS PC/Font.h | 1 + VCS PC/Frontend.cpp | 710 +++++++++++++++++++++++++++++++---- VCS PC/Frontend.h | 43 ++- VCS PC/MemoryMgr.h | 14 +- VCS PC/Object.cpp | 12 + VCS PC/Object.h | 4 + VCS PC/PcSave.cpp | 10 + VCS PC/PcSave.h | 8 + VCS PC/RealTimeShadowMgr.cpp | 62 ++- VCS PC/RealTimeShadowMgr.h | 4 +- VCS PC/Shadows.cpp | 40 ++ VCS PC/Shadows.h | 2 + VCS PC/UpdateManager.cpp | 8 +- VCS PC/UpdateManager.h | 7 + VCS PC/VCSPC.cpp | 277 +++++++------- 19 files changed, 959 insertions(+), 248 deletions(-) diff --git a/VCS PC/Audio.cpp b/VCS PC/Audio.cpp index b84c22a..6ad48b5 100644 --- a/VCS PC/Audio.cpp +++ b/VCS PC/Audio.cpp @@ -13,6 +13,7 @@ WRAPPER void CAudioEngine::SetMusicMasterVolume(signed char nVolume) { WRAPARG(n WRAPPER void CAudioEngine::SetEffectsMasterVolume(signed char nVolume) { WRAPARG(nVolume); EAXJMP(0x506E10); } WRAPPER void CAudioEngine::SetRadioAutoRetuneOnOff(bool bRetune) { WRAPARG(bRetune); EAXJMP(0x506F80); } WRAPPER void CAudioEngine::RetuneRadio(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507E10); } +WRAPPER const char* CAudioEngine::GetRadioStationName(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507000); } signed char CAERadioTrackManager::GetNextTrackByStation(BYTE stationID) diff --git a/VCS PC/Audio.h b/VCS PC/Audio.h index 85ee773..28ee737 100644 --- a/VCS PC/Audio.h +++ b/VCS PC/Audio.h @@ -87,6 +87,7 @@ class CAudioEngine void SetEffectsMasterVolume(signed char nVolume); void SetRadioAutoRetuneOnOff(bool bRetune); void RetuneRadio(signed char nStation); + const char* GetRadioStationName(signed char nStation); }; extern CAudioEngine& AudioEngine; diff --git a/VCS PC/FileMgr.cpp b/VCS PC/FileMgr.cpp index 2d321d2..4203e11 100644 --- a/VCS PC/FileMgr.cpp +++ b/VCS PC/FileMgr.cpp @@ -8,6 +8,7 @@ #include "Audio.h" #include "GroupedBuildings.h" #include "TxdStore.h" +#include "Object.h" tFileLoaderList_IMG* CFileLoader::m_pImagesList; tFileLoaderList* CFileLoader::m_pObjectsList; @@ -310,6 +311,7 @@ void CFileLoader::LoadLevels() } // Pre-IPL stuff + MatchAllModelStrings(); InitModelIndices(); // Wraps some calls diff --git a/VCS PC/Font.cpp b/VCS PC/Font.cpp index 9d3155c..afd2a3e 100644 --- a/VCS PC/Font.cpp +++ b/VCS PC/Font.cpp @@ -26,6 +26,7 @@ WRAPPER void CFont::SetOrientation(unsigned char bOrientation) { WRAPARG(bOrient WRAPPER void CFont::PrintString(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A700); } WRAPPER void CFont::PrintStringFromBottom(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A820); } WRAPPER void CFont::InitPerFrame() { EAXJMP(0x719800); } +WRAPPER int CFont::GetNumberLines(float, float, const char* pText) { WRAPARG(pText); EAXJMP(0x71A5E0); } unsigned char CFont::FindSubFontCharacter(char character, unsigned char bFontType) { diff --git a/VCS PC/Font.h b/VCS PC/Font.h index 8ccc752..43f3e1c 100644 --- a/VCS PC/Font.h +++ b/VCS PC/Font.h @@ -95,6 +95,7 @@ class CFont static void PrintStringFromBottom(float posX, float posY, const char* pText); static void SetWrapx(float fWrap); static void InitPerFrame(); + static int GetNumberLines(float, float, const char* pText); static void Initialise(); static void Shutdown(); diff --git a/VCS PC/Frontend.cpp b/VCS PC/Frontend.cpp index 00917da..c8e8b76 100644 --- a/VCS PC/Frontend.cpp +++ b/VCS PC/Frontend.cpp @@ -15,6 +15,7 @@ #include "Camera.h" #include "FxSystem.h" #include "Shadows.h" +#include "PcSave.h" CSprite2d* const LoadingSprites = (CSprite2d*)0xBAB35C; int& CurrentLoadingSprite = *(int*)0x8D093C; @@ -239,6 +240,7 @@ MenuItem CMenuManager::ms_pMenus[] = { 24, "FEM_FRM", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, 26, "FED_WIS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_SHADOWS_QUALITY, "FED_SHA", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, + MENUACTION_SHADOWS_DISTANCE, "FED_SHD", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_TEXTURE_FILTERMODE, "FED_TXF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_EFFECTS_QUALITY, "FED_EFF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, 44, "FED_AAS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, @@ -334,7 +336,7 @@ MenuItem CMenuManager::ms_pMenus[] = { 52, "FEJ_RNA", ACTION_CLICKORARROWS, 40, 0, 0, 2, 0, 0, 2, "FEDS_TB", ACTION_STANDARD, 0, 0, 146, 3, 0, 0 }, - + // Pause menu { "FET_PAU", 255, 0, 54, "FEP_RES", ACTION_STANDARD, 0, 0, -84, 3, 0, 0, 5, "FEP_SGA", ACTION_STANDARD, 1, 0, 0, 3, 0, 0, @@ -414,6 +416,10 @@ static inline const char* GetTitlePCByLanguage() WRAPPER void CMenuManager::SmallMessageScreen(const char* pMessage) { WRAPARG(pMessage); EAXJMP(0x574010); } WRAPPER void CMenuManager::SwitchToNewScreen(signed char bScreen) { WRAPARG(bScreen); EAXJMP(0x573680); } WRAPPER void CMenuManager::InitialiseChangedLanguageSettings(bool bRemapButtons) { WRAPARG(bRemapButtons); EAXJMP(0x573260); } +WRAPPER void CMenuManager::PrintBrief() { EAXJMP(0x576320); } +WRAPPER void CMenuManager::DrawContollerScreenExtraText(int nUnk) { WRAPARG(nUnk); EAXJMP(0x57D8D0); } +WRAPPER void CMenuManager::DisplayHelperText(const char* pText) { WRAPARG(pText); EAXJMP(0x57E240); } +WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x57C4F0); } void CMenuManager::SaveSettings() { @@ -604,6 +610,611 @@ void CMenuManager::LoadSettings() CFileMgr::SetDir(""); } +void CMenuManager::DrawStandardMenus(bool bDrawMenu) +{ + CFont::SetBackground(0, 0); + CFont::SetProportional(true); + CFont::SetOrientation(1); + CFont::SetWrapx(RsGlobal.MaximumWidth - 10); + CFont::SetRightJustifyWrap(10.0f); + CFont::SetCentreSize(RsGlobal.MaximumWidth); + + switch ( m_bCurrentMenuPage ) + { + case MENU_PAGE_STATS: + PrintStats(); + break; + case MENU_PAGE_BRIEF: + PrintBrief(); + break; + case MENU_PAGE_AUDIO_SETUP: + if ( bDrawMenu ) + DrawRadioStationIcons(); + break; + case MENU_PAGE_GAME_UPDATES: + PrintUpdaterScreen(); + break; + case MENU_PAGE_DLC: + PrintDLCScreen(); + break; + case MENU_PAGE_ACTIVATE_SERIAL: + PrintActivationScreen(); + break; + } + + // Header + if ( bDrawMenu ) + { + if ( aScreens[m_bCurrentMenuPage].name[0] ) + { + if ( m_bCurrentMenuPage != 5 || !m_bMapLoaded ) + { + CFont::SetOrientation(1); + CFont::SetFontStyle(FONT_RageItalic); + CFont::SetScale(_width(1.3f), _height(2.1f)); + CFont::SetDropShadowPosition(2); + CFont::SetColor(CRGBA(MENU_PINK_R, MENU_PINK_G, MENU_PINK_B)); + CFont::SetDropColor(CRGBA(0, 0, 0)); + CFont::PrintString(_xleft(40.0f), _y(28.0f), TheText.Get(aScreens[m_bCurrentMenuPage].name)); + } + } + } + + // Action 1 text + if ( aScreens[m_bCurrentMenuPage].entryList[0].action == 1 ) + { + CFont::SetWrapx(RsGlobal.MaximumWidth - 40); + CFont::SetFontStyle(FONT_Eurostile); + CFont::SetOrientation(1); + CFont::SetScaleLang(_width(0.49f), _height(1.2f)); + CFont::SetEdge(1); + CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B)); + CFont::SetDropColor(CRGBA(0, 0, 0)); + + const char* pText; + switch ( m_bCurrentMenuPage ) + { + case 6: + { + pText = TheText.Get(m_bMainMenuSwitch ? "FESZ_QQ" : aScreens[m_bCurrentMenuPage].entryList[0].entry); + break; + } + case 35: + { + pText = TheText.Get(m_bMainMenuSwitch ? "FEQ_SRW" : aScreens[m_bCurrentMenuPage].entryList[0].entry); + break; + } + case 17: + { + switch ( SlotValidation[m_bSelectedSaveGame+1] ) + { + case 0: + pText = TheText.Get("FESZ_QO"); + break; + case 2: + pText = TheText.Get("FESZ_QC"); + break; + default: + pText = TheText.Get(aScreens[m_bCurrentMenuPage].entryList[0].entry); + break; + } + break; + } + case 11: + { + pText = TheText.Get(m_bMainMenuSwitch ? "FES_LCG" : aScreens[m_bCurrentMenuPage].entryList[0].entry); + break; + } + default: + { + pText = TheText.Get(aScreens[m_bCurrentMenuPage].entryList[0].entry); + break; + } + } + + CFont::PrintString(_xleft(60.0f), _y(97.0f), pText); + CFont::SetWrapx(RsGlobal.MaximumWidth - 10); + } + + // Controller Redefine + if ( m_bCurrentMenuPage == 38 ) + DrawContollerScreenExtraText(-8); + + // Menu drawing loop + for ( unsigned int i = 0; i < NUM_ENTRIES_PER_MENU; i++ ) + { + CFont::SetFontStyle(FONT_Eurostile); + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) + { + // Save slot + CFont::SetScale(_width(0.42f), _height(0.95f)); + CFont::SetEdge(1); + } + else + { + // Regular texts + CFont::SetScale(_width(0.7f), _height(1.0f)); + CFont::SetEdge(1); + } + unsigned char nAlign; + + switch ( aScreens[m_bCurrentMenuPage].entryList[i].align ) + { + case 1: + nAlign = ALIGN_Left; + break; + case 2: + nAlign = ALIGN_Right; + break; + default: + nAlign = ALIGN_Center; + break; + } + + if ( i == m_dwSelectedMenuItem && m_bMapLoaded ) + CFont::SetColor(CRGBA(MENU_ACTIVE_R, MENU_ACTIVE_G, MENU_ACTIVE_B)); + else + { + if ( CUpdateManager::NewUpdatesPending() && ((m_bCurrentMenuPage == 33 && i == 6) || (m_bCurrentMenuPage == 34 && i == 1) || (m_bCurrentMenuPage == 41 && i == 5) && (m_bCurrentMenuPage == 44 && i == 2)) ) + CFont::SetColor(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B)); + else + CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B)); + } + + CFont::SetDropColor(CRGBA(0, 0, 0)); + CFont::SetOrientation(nAlign); + + // Auto positioning + if ( (aScreens[m_bCurrentMenuPage].entryList[i].posX == 0 && aScreens[m_bCurrentMenuPage].entryList[i].posY == 0) + || aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_MISSIONPACK ) + { + if ( i && (i != 1 || aScreens[m_bCurrentMenuPage].entryList[0].action != 1) ) + { + aScreens[m_bCurrentMenuPage].entryList[i].posX = aScreens[m_bCurrentMenuPage].entryList[i-1].posX; + aScreens[m_bCurrentMenuPage].entryList[i].posY = aScreens[m_bCurrentMenuPage].entryList[i-1].posY + (aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_MISSIONPACK ? 20 : 30); + } + else + { + aScreens[m_bCurrentMenuPage].entryList[i].posX = 320; + aScreens[m_bCurrentMenuPage].entryList[i].posY = 130; + } + } + + if ( aScreens[m_bCurrentMenuPage].entryList[i].action != 1 && aScreens[m_bCurrentMenuPage].entryList[i].entry[0] ) + { + const char* pTextToShow = nullptr; + const char* pTextToShow_RightColumn = nullptr; + char cReservedSpace[64]; + + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) + { + aScreens[m_bCurrentMenuPage].entryList[i].posX = 80; + aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign = -1; + CFont::SetOrientation(1); + + switch ( SlotValidation[i] ) + { + case 0: + pTextToShow = CGenericGameStorage::GetNameOfSavedGame(i-1); + pTextToShow_RightColumn = GetSavedGameDateAndTime(i-1); + break; + case 2: + pTextToShow = TheText.Get("FESZ_CS"); + break; + } + + if ( !pTextToShow || !pTextToShow[0] ) + { + sprintf(gString, "FEM_SL%X", i); + CFont::SetOrientation(0); + aScreens[m_bCurrentMenuPage].entryList[i].posX = 320; + aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign = 0; + pTextToShow = TheText.Get(gString); + } + } + else if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_MISSIONPACK ) + { + // TODO: MPACK name + + } + else if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_JOYMOUSE ) + { + pTextToShow = TheText.Get(m_nController ? "FEJ_TIT" : "FEC_MOU"); + } + else if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_UPDATER ) + { + pTextToShow = CUpdateManager::GetGXTEntryForButton(); + } + else if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_DLC ) + { + pTextToShow = ProcessDLCSlot(i); + } + else + { + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag == ACTION_SERIAL ) + { + if ( !m_bSerialFull ) + CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); + } + pTextToShow = TheText.Get(aScreens[m_bCurrentMenuPage].entryList[i].entry); + } + + // Regular actions - right column + switch ( aScreens[m_bCurrentMenuPage].entryList[i].action ) + { + case 31: + pTextToShow_RightColumn = TheText.Get(m_bRadioAutoSelect ? "FEM_ON" : "FEM_OFF"); + break; + case 32: + pTextToShow_RightColumn = AudioEngine.GetRadioStationName(m_nRadioStation); + break; + case 33: + pTextToShow_RightColumn = TheText.Get(m_bMapLegend ? "FEM_ON" : "FEM_OFF"); + break; + case 25: + pTextToShow_RightColumn = TheText.Get(m_bShowSubtitles ? "FEM_ON" : "FEM_OFF"); + break; + case 26: + sprintf(cReservedSpace, "FEM_AS%d", m_bAspectRatioMode); + pTextToShow_RightColumn = TheText.Get(cReservedSpace); + break; + // case 36 - unused on PC + case 34: + switch ( m_dwRadarMode ) + { + case 0: + pTextToShow_RightColumn = TheText.Get("FED_RDM"); + break; + case 1: + pTextToShow_RightColumn = TheText.Get("FED_RDB"); + break; + case 2: + pTextToShow_RightColumn = TheText.Get("FEM_OFF"); + break; + } + break; + case 35: + switch ( m_bHudOn ) + { + case 0: + pTextToShow_RightColumn = TheText.Get("FEM_OFF"); + break; + case 1: + pTextToShow_RightColumn = TheText.Get("FEM_24H"); + break; + case 2: + pTextToShow_RightColumn = TheText.Get("FEM_12H"); + break; + } + break; + case 65: + pTextToShow_RightColumn = TheText.Get(m_bSavePhotos ? "FEM_ON" : "FEM_OFF"); + break; + case 63: + switch ( m_nRadioMode ) + { + case 0: + pTextToShow_RightColumn = TheText.Get("FEA_PR1"); + break; + case 1: + pTextToShow_RightColumn = TheText.Get("FEA_PR2"); + break; + case 2: + pTextToShow_RightColumn = TheText.Get("FEA_PR3"); + break; + } + break; + case MENUACTION_SHADOWS_QUALITY: + switch ( CShadows::GetShadowQuality() ) + { + case SHADOW_QUALITY_OFF: + pTextToShow_RightColumn = TheText.Get("FEM_OFF"); + break; + case SHADOW_QUALITY_LOWEST: + pTextToShow_RightColumn = TheText.Get("FED_FXC"); + break; + case SHADOW_QUALITY_LOW: + pTextToShow_RightColumn = TheText.Get("FED_FXL"); + break; + case SHADOW_QUALITY_MEDIUM: + pTextToShow_RightColumn = TheText.Get("FED_FXM"); + break; + case SHADOW_QUALITY_HIGH: + pTextToShow_RightColumn = TheText.Get("FED_FXH"); + break; + case SHADOW_QUALITY_HIGHEST: + pTextToShow_RightColumn = TheText.Get("FED_FXV"); + break; + } + break; + case 24: + if ( m_bFrameLimiterMode == 0 ) + pTextToShow_RightColumn = TheText.Get("FEM_OFF"); + else + { + CMessages::InsertNumberInString(TheText.Get("FEM_FPS"), RsGlobalFrameLimits[m_bFrameLimiterMode], -1, -1, -1, -1, -1, cReservedSpace); + pTextToShow_RightColumn = cReservedSpace; + } + break; + // case 43 - mipmapping has been nuked + case 64: + pTextToShow_RightColumn = TheText.Get(m_bTracksAutoScan ? "FEM_ON" : "FEM_OFF"); + break; + case 46: + pTextToShow_RightColumn = TheText.Get(!MousePointerStateHelper.m_bHorizontalInvert ? "FEM_ON" : "FEM_OFF"); + break; + case 47: + pTextToShow_RightColumn = TheText.Get(invertPadX1 ? "FEM_ON" : "FEM_OFF"); + break; + case 48: + pTextToShow_RightColumn = TheText.Get(invertPadY1 ? "FEM_ON" : "FEM_OFF"); + break; + case 49: + pTextToShow_RightColumn = TheText.Get(invertPadX2 ? "FEM_ON" : "FEM_OFF"); + break; + case 50: + pTextToShow_RightColumn = TheText.Get(invertPadY2 ? "FEM_ON" : "FEM_OFF"); + break; + case 51: + pTextToShow_RightColumn = TheText.Get(swapPadAxis1 ? "FEM_ON" : "FEM_OFF"); + break; + case 52: + pTextToShow_RightColumn = TheText.Get(swapPadAxis2 ? "FEM_ON" : "FEM_OFF"); + break; + case 59: + pTextToShow_RightColumn = TheText.Get(CVehicle::m_bEnableMouseSteering ? "FEM_ON" : "FEM_OFF"); + break; + case 60: + pTextToShow_RightColumn = TheText.Get(CVehicle::m_bEnableMouseFlying ? "FEM_ON" : "FEM_OFF"); + break; + case 56: + strncpy(cReservedSpace, ((const char**(*)())0x745AF0)()[m_dwResolution], sizeof(cReservedSpace)); + pTextToShow_RightColumn = cReservedSpace; + break; + case 44: + if ( m_dwAntiAliasingLevel <= 1 ) + pTextToShow_RightColumn = TheText.Get("FEM_OFF"); + else + { + switch ( m_dwAntiAliasingLevel ) + { + case 2: + pTextToShow_RightColumn = TheText.Get("FED_AA1"); + break; + case 3: + pTextToShow_RightColumn = TheText.Get("FED_AA2"); + break; + case 4: + pTextToShow_RightColumn = TheText.Get("FED_AA3"); + break; + } + } + break; + case 58: + pTextToShow_RightColumn = TheText.Get(m_nController ? "FET_CCN" : "FET_SCN"); + break; + case MENUACTION_AUTOINSTALL_UPDATES: + pTextToShow_RightColumn = TheText.Get(CUpdateManager::AutoInstallEnabled() ? "FEM_ON" : "FEM_OFF"); + break; + case MENUACTION_CHECKING_PERIOD: + sprintf(cReservedSpace, "FEU_CH%d", CUpdateManager::GetCheckingPeriod() + 1); + pTextToShow_RightColumn = TheText.Get(cReservedSpace); + break; + case MENUACTION_TEXTURE_FILTERMODE: + sprintf(cReservedSpace, "FED_TX%d", Fx_c::GetTextureFilteringQuality()); + pTextToShow_RightColumn = TheText.Get(cReservedSpace); + break; + case MENUACTION_EFFECTS_QUALITY: + switch ( Fx_c::GetEffectsQuality() ) + { + case FXQUALITY_LOW: + pTextToShow_RightColumn = TheText.Get("FED_FXL"); + break; + case FXQUALITY_MEDIUM: + pTextToShow_RightColumn = TheText.Get("FED_FXM"); + break; + case FXQUALITY_HIGH: + pTextToShow_RightColumn = TheText.Get("FED_FXH"); + break; + } + break; + } + + float fPosX, fPosY; + + if ( aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign == -1 ) + fPosX = _xleft(aScreens[m_bCurrentMenuPage].entryList[i].posX); + else if ( aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign == 1 ) + fPosX = _x(aScreens[m_bCurrentMenuPage].entryList[i].posX); + else + fPosX = _xmiddle(aScreens[m_bCurrentMenuPage].entryList[i].posX); + + if ( aScreens[m_bCurrentMenuPage].entryList[i].screenVertAlign == -1 ) + fPosY = _y(aScreens[m_bCurrentMenuPage].entryList[i].posY); + else if ( aScreens[m_bCurrentMenuPage].entryList[i].screenVertAlign == 1 ) + fPosY = _ydown(aScreens[m_bCurrentMenuPage].entryList[i].posY); + else + fPosY = _ymiddle(aScreens[m_bCurrentMenuPage].entryList[i].posY); + + if ( pTextToShow ) + { + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) + { + char cSlotNumberText[4]; + sprintf(cSlotNumberText, "%d", aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag); + + CFont::PrintString(fPosX + _xleft(25.0f), fPosY, pTextToShow); + + CFont::SetOrientation(ALIGN_Right); + CFont::PrintString(fPosX, fPosY, cSlotNumberText); + } + else + CFont::PrintString(fPosX, fPosY, pTextToShow); + } + + if ( pTextToShow_RightColumn ) + { + CFont::SetFontStyle(FONT_Eurostile); + CFont::SetEdge(1); + + bool bSaveMenu = m_bCurrentMenuPage == 9 || m_bCurrentMenuPage == 10 || m_bCurrentMenuPage == 16; + + if ( bSaveMenu ) + CFont::SetOrientation(ALIGN_Right); + else + CFont::SetOrientation(ALIGN_Left); + + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) + CFont::SetScale(_width(0.35f), _height(0.95f)); + else if ( m_bCurrentMenuPage == 3 && i == 4 ) + CFont::SetScale(_width(0.56f), _height(1.0f)); + else + CFont::SetScale(_width(0.7f), _height(1.0f)); + + CFont::PrintString(bSaveMenu ? _x(40.0f) : _xmiddle(MENU_TEXT_POSITION_RCOLUMN), fPosY, pTextToShow_RightColumn); + } + + // Sliders + switch ( aScreens[m_bCurrentMenuPage].entryList[i].action ) + { + case 27: + { + // Brightness + float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-97.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), m_dwBrightness * (1.0f/192.0f), _width(MENU_SLIDER_WIDTH)); + + if ( i == m_dwSelectedMenuItem ) + { + if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-97.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-97.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 7; + else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-97.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-97.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 6; + else + m_nHoverOption = 16; + } + break; + } + case 28: + { + // Radio volume + float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), m_nRadioVolume * (1.0f/64.0f), _width(MENU_SLIDER_WIDTH)); + + if ( i == m_dwSelectedMenuItem ) + { + if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 11; + else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 10; + else + m_nHoverOption = 16; + } + break; + } + case 29: + { + // SFX volume + float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), m_nSfxVolume * (1.0f/64.0f), _width(MENU_SLIDER_WIDTH)); + + if ( i == m_dwSelectedMenuItem ) + { + if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-94.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 13; + else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-94.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 12; + else + m_nHoverOption = 16; + } + break; + } + case 61: + { + // Draw Distance + float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), (m_fDrawDistance-0.925f) * (1.0f/0.875f), _width(MENU_SLIDER_WIDTH)); + + if ( i == m_dwSelectedMenuItem ) + { + if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 9; + else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 8; + else + m_nHoverOption = 16; + } + break; + } + case 62: + { + // Mouse Sensitivity + float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), (CCamera::m_fMouseAccelHorzntl-0.0003125f)* (1.0f/0.0049f), _width(MENU_SLIDER_WIDTH)); + + if ( i == m_dwSelectedMenuItem ) + { + if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-94.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 15; + else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-94.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-94.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) + m_nHoverOption = 14; + else + m_nHoverOption = 16; + } + break; + } + } + } + } + + // Helpers + if ( !strncmp(aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].entry, "FED_RES", 8) ) + { + if ( m_dwResolution == m_dwAppliedResolution ) + { + if ( m_nHelperTextIndex == 1 ) + ResetHelperText(); + } + else + SetHelperText(1); + } + else + { + if ( m_dwResolution != m_dwAppliedResolution ) + { + m_dwResolution = m_dwAppliedResolution; + SetHelperText(3); + } + } + + if ( !strncmp(aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].entry, "FED_AAS", 8) ) + { + if ( m_dwAntiAliasingLevel == m_dwAppliedAntiAliasingLevel ) + { + if ( m_nHelperTextIndex == 1 ) + ResetHelperText(); + } + else + SetHelperText(1); + } + else + { + if ( m_dwAntiAliasingLevel != m_dwAppliedAntiAliasingLevel ) + { + m_dwAntiAliasingLevel = m_dwAppliedAntiAliasingLevel; + SetHelperText(3); + } + } + + switch ( m_bCurrentMenuPage ) + { + case 0: + case 3: + case 4: + case 26: + case 27: + case 36: + case 39: + case 40: + DisplayHelperText(nullptr); + break; + } +} + void CMenuManager::DrawBackEnd() { // Calculate proper dimensions @@ -641,25 +1252,25 @@ void CMenuManager::DrawBackEnd() CFont::SetBackground(0, 0); CFont::SetProportional(false); CFont::SetFontStyle(FONT_PagerFont); - CFont::SetOrientation(ALIGN_Right); + CFont::SetOrientation(ALIGN_Left); CFont::SetRightJustifyWrap(0.0); CFont::SetEdge(1); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetScale(_width(0.25f), _height(0.4f)); CFont::SetColor(BaseColors[11]); - CFont::PrintString(_x(2.5f), _ydown(13.0f), MOD_VERSION" BUILD "BUILDNUMBER_STR); + CFont::PrintString(_xleft(2.5f), _ydown(13.0f), MOD_VERSION" BUILD "BUILDNUMBER_STR); #ifdef DEVBUILD #ifdef MAKE_ZZCOOL_MOVIE_DEMO - CFont::PrintString(_x(2.5f), _ydown(20.5f), "DEMONSTRATION BUILD"); + CFont::PrintString(_xleft(2.5f), _ydown(20.5f), "DEMONSTRATION BUILD"); #else - CFont::PrintString(_x(2.5f), _ydown(20.5f), "DEV BUILD"); + CFont::PrintString(_xleft(2.5f), _ydown(20.5f), "DEV BUILD"); #endif #else #ifdef COMPILE_RC - CFont::PrintString(_x(2.5f), _ydown(20.5f), "RELEASE CANDIDATE "RELEASE_CANDIDATE); + CFont::PrintString(_xleft(2.5f), _ydown(20.5f), "RELEASE CANDIDATE "RELEASE_CANDIDATE); #else - CFont::PrintString(_x(2.5f), _ydown(20.5f), VERSION_NAME_UPPERCASE); + CFont::PrintString(_xleft(2.5f), _ydown(20.5f), VERSION_NAME_UPPERCASE); #endif #endif @@ -748,19 +1359,19 @@ void CMenuManager::DrawRadioStationIcons() while ( bLoopCounter < 11 ); } -int CMenuManager::DisplaySlider(float posX, float posY, float, float height, float distBetweenRects, float filledAmount, int iWidth) +float CMenuManager::DisplaySlider(float posX, float posY, float height, float distBetweenRects, float filledAmount, float width) { BYTE loopCounter = NUM_SLIDERS * 2; BYTE positionCounter = 0; BYTE secondPositionCounter = 0; bool bDrawHalfSlider = false; + bool bGotLowestInactive = false; float fullWidth = 0.0; - float width = static_cast(iWidth); do { float itemPosX = distBetweenRects * positionCounter / NUM_SLIDERS + posX; - float mousePosX = distBetweenRects * secondPositionCounter / (NUM_SLIDERS * 2) + posX; + float mousePosX = distBetweenRects/2 * secondPositionCounter / (NUM_SLIDERS * 2) + posX; CRGBA colour; if ( static_cast(positionCounter) / NUM_SLIDERS + ( 1 / (NUM_SLIDERS * 2) ) >= filledAmount ) @@ -771,6 +1382,7 @@ int CMenuManager::DisplaySlider(float posX, float posY, float, float height, flo bDrawHalfSlider = true; else colour = CRGBA(MENU_ACTIVE_R, MENU_ACTIVE_G, MENU_ACTIVE_B, 255); + fullWidth = mousePosX; } @@ -792,7 +1404,7 @@ int CMenuManager::DisplaySlider(float posX, float posY, float, float height, flo } while ( loopCounter ); - return static_cast(fullWidth); + return fullWidth; } void CMenuManager::DrawLeftColumn(MenuItem::MenuEntry& pPosition, const char* pText, const char* pRightText) @@ -1532,7 +2144,7 @@ const char* CMenuManager::ProcessDLCSlot(int nSlotID) ms_pMenus[m_bCurrentMenuPage].entryList[nSlotID].action = MENUACTION_TOGGLE_DLC; _snprintf(lastDLCName, sizeof(lastDLCName), "FEE_N%02d", nDLC); - return lastDLCName; + return TheText.Get(lastDLCName); } float CMenuManager::GetTextYPos(const MenuItem::MenuEntry& pPosition) @@ -1557,6 +2169,11 @@ float CMenuManager::GetTextYPosNextItem(const MenuItem::MenuEntry& pPosition) return _ymiddle(pPosition.posY + 26); } +void CMenuManager::Inject() +{ + Memory::InjectHook(0x57BA58, &DrawStandardMenus); +} + // TODO: CLoadingScreen static unsigned char bDrawingStyle; @@ -1785,7 +2402,7 @@ void __declspec(naked) EffectsQuality_RightColumn() } } -void __declspec(naked) AntiAliasing_RightColumn() +/*void __declspec(naked) AntiAliasing_RightColumn() { static const char aFed_Aa1[] = "FED_AA1"; static const char aFed_Aa2[] = "FED_AA2"; @@ -1818,56 +2435,7 @@ void __declspec(naked) AntiAliasing_RightColumn() push 579F65h retn } -} - -void __declspec(naked) ShadowsQuality_RightColumn() -{ - static const char aFed_Fxc[] = "FED_FXC"; - static const char aFed_Fxl[] = "FED_FXL"; - static const char aFed_Fxm[] = "FED_FXM"; - static const char aFed_Fxh[] = "FED_FXH"; - static const char aFed_Fxv[] = "FED_FXV"; - _asm - { - mov ecx, [TheText] - mov eax, [CShadows::m_bShadowQuality] - test eax, eax - jz ShadowsQuality_RightColumn_Off - dec eax - jz ShadowsQuality_RightColumn_Lowest - dec eax - jz ShadowsQuality_RightColumn_Low - dec eax - jz ShadowsQuality_RightColumn_Medium - dec eax - jz ShadowsQuality_RightColumn_High - push offset aFed_Fxv - jmp ShadowsQuality_RightColumn_Return - -ShadowsQuality_RightColumn_Lowest: - push offset aFed_Fxc - jmp ShadowsQuality_RightColumn_Return - -ShadowsQuality_RightColumn_Low: - push offset aFed_Fxl - jmp ShadowsQuality_RightColumn_Return - -ShadowsQuality_RightColumn_Medium: - push offset aFed_Fxm - jmp ShadowsQuality_RightColumn_Return - -ShadowsQuality_RightColumn_High: - push offset aFed_Fxh - -ShadowsQuality_RightColumn_Return: - push 57A161h - retn - -ShadowsQuality_RightColumn_Off: - push 579F65h - retn - } -} +}*/ static void __declspec(naked) UserInputArrowSoundMenus() { @@ -1901,18 +2469,18 @@ static StaticPatcher Patcher([](){ (void*)0x579EF0, (void*)0x579DDE, (void*)0x579DE6, (void*)0x579DB9, (void*)0x579DB1, (void*)0x579DC1, (void*)0x579DD6, (void*)0x579E37, (void*)0x579E67, - (void*)0x579DEE, ShadowsQuality_RightColumn, (void*)0x579EF8, - AntiAliasing_RightColumn, (void*)0x579F57, (void*)0x579F6F, + (void*)0x579DEE, /*ShadowsQuality_RightColumn*/ (void*)0x579EF8, + /*AntiAliasing_RightColumn,*/ (void*)0x579F57, (void*)0x579F6F, (void*)0x579F77, (void*)0x579F7F, (void*)0x579F87, (void*)0x579F8F, (void*)0x579F97, (void*)0x57A05A, (void*)0x57A141, (void*)0x579FB0, (void*)0x57A005, (void*)0x579E7A, (void*)0x579F4F, (void*)0x579E6F, - (void*)0x57A168, AutoInstallUpdates_RightColumm, CheckEvery_RightColumn, - TextureFiltering_RightColumn, EffectsQuality_RightColumn }; + (void*)0x57A168, /*AutoInstallUpdates_RightColumm,*/ /*CheckEvery_RightColumn, */ + /*TextureFiltering_RightColumn, EffectsQuality_RightColumn*/ }; - Memory::Patch(0x579D9C, sizeof(StandardMenusRightColumn_Table)-1); - Memory::Patch(0x579DA6, StandardMenusRightColumn_Table); - Memory::Patch(0x579DAD, StandardMenusRightColumn_Addresses); + //Memory::Patch(0x579D9C, sizeof(StandardMenusRightColumn_Table)-1); + //Memory::Patch(0x579DA6, StandardMenusRightColumn_Table); + //Memory::Patch(0x579DAD, StandardMenusRightColumn_Addresses); static const BYTE UserInputArrowSoundMenus_Table[] = { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, @@ -1930,5 +2498,7 @@ static StaticPatcher Patcher([](){ Memory::InjectHook(0x57C660, &CMenuManager::SaveSettings, PATCH_JUMP); Memory::InjectHook(0x747545, &CMenuManager::LoadSettings); + + CMenuManager::Inject(); }); diff --git a/VCS PC/Frontend.h b/VCS PC/Frontend.h index bffcc1e..f82f020 100644 --- a/VCS PC/Frontend.h +++ b/VCS PC/Frontend.h @@ -72,6 +72,7 @@ // Macroes #define MenuEntriesList (CMenuManager::ms_pMenus) +#define aScreens (CMenuManager::ms_pMenus) enum eMenuPages { @@ -80,7 +81,11 @@ enum eMenuPages MENU_PAGE_GAME, MENU_PAGE_BRIEF, MENU_PAGE_AUDIO_SETUP, - MENU_PAGE_DISPLAY_SETUP + MENU_PAGE_DISPLAY_SETUP, + + MENU_PAGE_GAME_UPDATES = 44, + MENU_PAGE_DLC, + MENU_PAGE_ACTIVATE_SERIAL = 49 }; enum eMenuActions @@ -96,6 +101,7 @@ enum eMenuActions MENUACTION_CHECKING_PERIOD, MENUACTION_TEXTURE_FILTERMODE, MENUACTION_EFFECTS_QUALITY, + MENUACTION_SHADOWS_DISTANCE, NUM_MENU_ACTIONS }; @@ -191,7 +197,7 @@ class CMenuManager bool m_bRadioEq; signed char m_nRadioStation; __int8 field_53; - __int32 m_dwSelectedMenuItem; + unsigned int m_dwSelectedMenuItem; __int8 field_58; __int8 drawRadarOrMap; __int8 field_5A; @@ -206,7 +212,7 @@ class CMenuManager float m_fMapBaseX; float m_fMapBaseY; CVector2D m_vMousePos; - __int8 field_78; + bool m_bMapLoaded; __int8 field_79[3]; __int32 titleLanguage; __int32 textLanguage; @@ -294,7 +300,7 @@ class CMenuManager __int32 field_1AF4; __int32 field_1AF8; __int32 field_1AFC; - __int32 field_1B00; + int m_nHoverOption; __int32 field_1B04; __int8 field_1B08; __int8 field_1B09; @@ -309,7 +315,7 @@ class CMenuManager __int8 field_1B15; __int8 field_1B16; __int8 field_1B17; - __int32 EventToDo; + int m_nHelperTextIndex; __int32 field_1B1C; __int8 field_1B20; __int8 field_1B21; @@ -363,6 +369,15 @@ class CMenuManager public: static MenuItem ms_pMenus[]; +private: + void PrintStats(); + void PrintUpdaterScreen(); + void PrintDLCScreen(); + void PrintActivationScreen(); + void DrawStandardMenus(bool bDrawMenu); + void DrawRadioStationIcons(); + float DisplaySlider(float posX, float posY, float height, float distBetweenRects, float filledAmount, float width); + public: inline BYTE GetHudMode() { return m_bHudOn; }; @@ -393,6 +408,12 @@ class CMenuManager static inline void SwitchToScreenAfterMessage(signed char nScreen) { m_nSwitchToThisAfterMessage = nScreen; } + + void ResetHelperText() + { m_nHelperTextIndex = 0; field_1AEC = 300; } + void SetHelperText(int nText) + { m_nHelperTextIndex = nText; field_1AEC = 300; } + static void RegisterDLCMessage(const char* pMessage); static void LookIntoClipboardForSerial(); @@ -400,19 +421,17 @@ class CMenuManager void SmallMessageScreen(const char* pMessage); void SwitchToNewScreen(signed char bScreen); void InitialiseChangedLanguageSettings(bool bRemapButtons); + void PrintBrief(); + void DrawContollerScreenExtraText(int nUnk); + void DisplayHelperText(const char* pText); + bool CheckHover(int, int, int, int); void SetDefaultPreferences(signed char bScreen); void DrawBackEnd(); - void DrawRadioStationIcons(); - int DisplaySlider(float posX, float posY, float, float height, float distBetweenRects, float filledAmount, int width); void DrawLeftColumn(MenuItem::MenuEntry& pPosition, const char* pText, const char* pRightText); //float GetLeftColumnPos_Height(long posY); float GetRightColumnPos(MenuVar& sPosY); void DrawOutroSplash(); - void PrintStats(); - void PrintUpdaterScreen(); - void PrintDLCScreen(); - void PrintActivationScreen(); void ReadFrontendTextures(); void SwitchToNewScreenVCS(signed char bScreen); void AdditionalOptionInputVCS(unsigned char* pUp, unsigned char* pDown); @@ -428,6 +447,8 @@ class CMenuManager // Hacky workaround float GetTextYPosNextItem(const MenuItem::MenuEntry& pPosition); + static void Inject(); + // void SaveStatsHTML(); }; diff --git a/VCS PC/MemoryMgr.h b/VCS PC/MemoryMgr.h index 6821396..76830f4 100644 --- a/VCS PC/MemoryMgr.h +++ b/VCS PC/MemoryMgr.h @@ -17,20 +17,30 @@ enum PATCH_NOTHING, }; +// Debug checker to make sure reversed functions don't still get hacks +template +inline void CheckMemoryBanList(AT address) +{ + unsigned int nAddress = (unsigned int)address; + + assert(nAddress < 0x5794A0 || nAddress > 0x57B43F); +} + namespace Memory { template inline void Patch(AT address, T value) - { *(T*)address = value; } + { CheckMemoryBanList(address); *(T*)address = value; } template inline void Nop(AT address, unsigned int nCount) // TODO: Finish multibyte nops - { memset((void*)address, 0x90, nCount); } + { CheckMemoryBanList(address); memset((void*)address, 0x90, nCount); } template inline void InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING) { + CheckMemoryBanList(address); DWORD dwHook; _asm { diff --git a/VCS PC/Object.cpp b/VCS PC/Object.cpp index c3874e7..b666b4f 100644 --- a/VCS PC/Object.cpp +++ b/VCS PC/Object.cpp @@ -3,6 +3,18 @@ #include "ModelInfo.h" +unsigned short MI_PARKBENCH = 0xFFFF, MI_CANOPY_TEST = 0xFFFF, MI_CHAIR_TEST = 0xFFFF, MI_PAPERMACHINE = 0xFFFF, + MI_HYDRANT = 0xFFFF; + +void MatchAllModelStrings() +{ + MI_PARKBENCH = CModelInfo::GetModelInfoUInt16("parkbench1"); + MI_CANOPY_TEST = CModelInfo::GetModelInfoUInt16("kb_canopy_test"); + MI_CHAIR_TEST = CModelInfo::GetModelInfoUInt16("kb_chr_tbl_test"); + MI_PAPERMACHINE = CModelInfo::GetModelInfoUInt16("papermachn01"); + MI_HYDRANT = CModelInfo::GetModelInfoUInt16("fire_hydrant"); +} + void CObject::Render() { if ( m_bDoNotRender ) diff --git a/VCS PC/Object.h b/VCS PC/Object.h index d978ebf..edfa5c5 100644 --- a/VCS PC/Object.h +++ b/VCS PC/Object.h @@ -74,6 +74,10 @@ class NOVMT CObject : public CPhysical { CObject::Render(); } }; +void MatchAllModelStrings(); + +extern unsigned short MI_PARKBENCH, MI_CANOPY_TEST, MI_CHAIR_TEST, MI_PAPERMACHINE, MI_HYDRANT; + static_assert(sizeof(CObject) == 0x17C, "Wrong size: CObject"); #endif \ No newline at end of file diff --git a/VCS PC/PcSave.cpp b/VCS PC/PcSave.cpp index 263ee62..9d2e806 100644 --- a/VCS PC/PcSave.cpp +++ b/VCS PC/PcSave.cpp @@ -95,6 +95,16 @@ void C_PcSave::SaveBlockVersion(int nBlock) } } +const char* GetSavedGameDateAndTime(int nSlot) +{ + return SlotSaveDate[nSlot]; +} + +const char* CGenericGameStorage::GetNameOfSavedGame(int nSlot) +{ + return SlotFileName[nSlot]; +} + DEPRECATED void CPedSaveStructure::CPedSaveStructure001::Construct(CPed* pPed) { Coords = *pPed->GetCoords(); diff --git a/VCS PC/PcSave.h b/VCS PC/PcSave.h index f0f09c0..06f273a 100644 --- a/VCS PC/PcSave.h +++ b/VCS PC/PcSave.h @@ -27,6 +27,14 @@ class C_PcSave void LoadFirstBlock(DWORD* pTimestamp); }; +class CGenericGameStorage +{ +public: + friend const char* GetSavedGameDateAndTime(int nSlot); + + static const char* GetNameOfSavedGame(int nSlot); +}; + class CPedSaveStructure { private: diff --git a/VCS PC/RealTimeShadowMgr.cpp b/VCS PC/RealTimeShadowMgr.cpp index 1000c87..9df675d 100644 --- a/VCS PC/RealTimeShadowMgr.cpp +++ b/VCS PC/RealTimeShadowMgr.cpp @@ -12,7 +12,6 @@ WRAPPER void CShadowCamera::Destroy() { EAXJMP(0x705400); } WRAPPER void CShadowCamera::SetLight(RpLight* pLight) { WRAPARG(pLight); EAXJMP(0x705520); } WRAPPER void CShadowCamera::MakeGradientRaster() { EAXJMP(0x705D20); } WRAPPER RwCamera* CShadowCamera::SetCenter(RwV3d* pVector) { WRAPARG(pVector); EAXJMP(0x705590); } -WRAPPER RwCamera* CShadowCamera::Update(RpAtomic* pAtomic) { WRAPARG(pAtomic); EAXJMP(0x705C80); } WRAPPER RwRaster* CShadowCamera::RasterResample(RwRaster* pRaster) { WRAPARG(pRaster); EAXJMP(0x706070); } WRAPPER RwRaster* CShadowCamera::RasterBlur(RwRaster* pRaster, int nPasses) { WRAPARG(pRaster); WRAPARG(nPasses); EAXJMP(0x706170); } WRAPPER RwRaster* CShadowCamera::RasterGradient(RwRaster* pRaster) { WRAPARG(pRaster); EAXJMP(0x706330); } @@ -56,6 +55,29 @@ static RpAtomic* PushGeometryFlags(RpAtomic* pAtomic, void* pData) return pAtomic; } +RwCamera* CShadowCamera::Update(RpAtomic* pAtomic) +{ + RwRGBA ClearColour = { 255, 255, 255, 0 }; + RwCameraClear(m_pCamera, &ClearColour, rwCAMERACLEARIMAGE|rwCAMERACLEARZ); + + if ( RwCameraBeginUpdate(m_pCamera ) ) + { + RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic); + RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry); + + RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|/*rpGEOMETRYPRELIT|*/ + rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); + + AtomicDefaultRenderCallBack(pAtomic); + + RpGeometrySetFlags(pGeometry, geometryFlags); + + InvertRaster(); + RwCameraEndUpdate(m_pCamera); + } + return m_pCamera; +} + RwCamera* CShadowCamera::Update(RpClump* pClump, CPhysical* pEntity) { RwRGBA ClearColour = { 255, 255, 255, 0 }; @@ -86,29 +108,33 @@ RwCamera* CShadowCamera::Update(RpClump* pClump, CPhysical* pEntity) RwTexture* CRealTimeShadow::Update() { - if ( m_nRwObjectType == rpATOMIC ) - RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpAtomicGetFrame(reinterpret_cast(m_pEntity->m_pRwObject)))); - else if ( m_nRwObjectType == rpCLUMP ) - RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpClumpGetFrame(reinterpret_cast(m_pEntity->m_pRwObject)))); + if ( m_pEntity->m_pRwObject ) + { + if ( m_nRwObjectType == rpATOMIC ) + RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpAtomicGetFrame(reinterpret_cast(m_pEntity->m_pRwObject)))); + else if ( m_nRwObjectType == rpCLUMP ) + RwV3dTransformPoints(&m_BaseSphere.center, &m_BoundingSphere.center, 1, RwFrameGetMatrix(RpClumpGetFrame(reinterpret_cast(m_pEntity->m_pRwObject)))); - m_Camera.SetCenter(&m_BaseSphere.center); - if ( m_nRwObjectType == rpATOMIC ) - m_Camera.Update(reinterpret_cast(m_pEntity->m_pRwObject)); - else if ( m_nRwObjectType == rpCLUMP ) - m_Camera.Update(reinterpret_cast(m_pEntity->m_pRwObject), m_pEntity); + m_Camera.SetCenter(&m_BaseSphere.center); + if ( m_nRwObjectType == rpATOMIC ) + m_Camera.Update(reinterpret_cast(m_pEntity->m_pRwObject)); + else if ( m_nRwObjectType == rpCLUMP ) + m_Camera.Update(reinterpret_cast(m_pEntity->m_pRwObject), m_pEntity); - RwRaster* pRaster = RwCameraGetRaster(m_Camera.m_pCamera); + RwRaster* pRaster = RwCameraGetRaster(m_Camera.m_pCamera); - if ( m_bDrawResample ) - pRaster = m_ResampledCamera.RasterResample(pRaster); + if ( m_bDrawResample ) + pRaster = m_ResampledCamera.RasterResample(pRaster); - if ( m_dwBlurPasses ) - pRaster = m_bUsePlayerHelperCams ? g_realTimeShadowMan.m_BlurCamera_Player.RasterBlur(pRaster, m_dwBlurPasses) : g_realTimeShadowMan.m_BlurCamera.RasterBlur(pRaster, m_dwBlurPasses); + if ( m_dwBlurPasses ) + pRaster = m_bUsePlayerHelperCams ? g_realTimeShadowMan.m_BlurCamera_Player.RasterBlur(pRaster, m_dwBlurPasses) : g_realTimeShadowMan.m_BlurCamera.RasterBlur(pRaster, m_dwBlurPasses); - if ( m_bDrawGradient ) - pRaster = m_bUsePlayerHelperCams ? g_realTimeShadowMan.m_GradientCamera_Player.RasterGradient(pRaster) : g_realTimeShadowMan.m_GradientCamera.RasterGradient(pRaster); + if ( m_bDrawGradient ) + pRaster = m_bUsePlayerHelperCams ? g_realTimeShadowMan.m_GradientCamera_Player.RasterGradient(pRaster) : g_realTimeShadowMan.m_GradientCamera.RasterGradient(pRaster); - return m_bDrawResample ? m_ResampledCamera.m_pTexture : m_Camera.m_pTexture; + return m_bDrawResample ? m_ResampledCamera.m_pTexture : m_Camera.m_pTexture; + } + return nullptr; } void CRealTimeShadow::Create(int nSize, int nSizeResampled, bool bResample, int nBlurPasses, bool bGradient, bool bUsePlayerCams) diff --git a/VCS PC/RealTimeShadowMgr.h b/VCS PC/RealTimeShadowMgr.h index b069108..1312abf 100644 --- a/VCS PC/RealTimeShadowMgr.h +++ b/VCS PC/RealTimeShadowMgr.h @@ -1,7 +1,7 @@ #ifndef __REALTIMESHADOWMGR #define __REALTIMESHADOWMGR -#define NUM_MAX_REALTIME_SHADOWS 32 +#define NUM_MAX_REALTIME_SHADOWS 64 struct tShadowQualitySettings { @@ -26,12 +26,12 @@ class CShadowCamera void SetLight(RpLight* pLight); void MakeGradientRaster(); RwCamera* SetCenter(RwV3d* pVector); - RwCamera* Update(RpAtomic* pAtomic); RwRaster* RasterResample(RwRaster* pRaster); RwRaster* RasterBlur(RwRaster* pRaster, int nPasses); RwRaster* RasterGradient(RwRaster* pRaster); void InvertRaster(); + RwCamera* Update(RpAtomic* pAtomic); RwCamera* Update(RpClump* pClump, CPhysical* pEntity); void ReInit(); }; diff --git a/VCS PC/Shadows.cpp b/VCS PC/Shadows.cpp index 425c146..efc6de7 100644 --- a/VCS PC/Shadows.cpp +++ b/VCS PC/Shadows.cpp @@ -5,6 +5,7 @@ #include "Coronas.h" #include "RealTimeShadowMgr.h" #include "Vehicle.h" +#include "Object.h" eShadowQuality CShadows::m_bShadowQuality; @@ -30,6 +31,19 @@ bool CShadows::StoreRealTimeShadowForVehicle(CVehicle* pVehicle) return false; } +void CShadows::StoreRealTimeShadowForObject(CObject* pObject) +{ + if ( m_bShadowQuality > SHADOW_QUALITY_MEDIUM && ThisPropCanHaveShadow(pObject) ) + g_realTimeShadowMan.DoShadowThisFrame(pObject); + +} + +bool CShadows::ThisPropCanHaveShadow(CPhysical* pPhysical) +{ + return pPhysical->m_nModelIndex == MI_PARKBENCH || pPhysical->m_nModelIndex == MI_CANOPY_TEST || pPhysical->m_nModelIndex == MI_CHAIR_TEST + || pPhysical->m_nModelIndex == MI_PAPERMACHINE || pPhysical->m_nModelIndex == MI_HYDRANT; +} + static const float f215 = 2.15f; static const float f115 = 1.15f; @@ -130,6 +144,30 @@ static void __declspec(naked) StoreRTVehicleShadowHack() } } +static void __declspec(naked) StoreRTObjectShadowHack() +{ + _asm + { + push esi + call CShadows::StoreRealTimeShadowForObject + add esp, 4 + pop esi + add esp, 10h + retn + } +} + +/*static void __declspec(naked) StoreRTPoleShadowHack() +{ + _asm + { + push [esp+18h+4] + call CShadows::StoreRealTimeShadowForVehicle + add esp, 4 + retn + } +}*/ + void CShadows::Inject() { Memory::InjectHook(0x70CCB0, RenderIndicatorShadow, PATCH_JUMP); @@ -185,6 +223,8 @@ static StaticPatcher Patcher([](){ Memory::Patch(0x5E6813, 0xEB); //Memory::Patch(0x5E683B, 0xEB); Memory::InjectHook(0x70BDA4, StoreRTVehicleShadowHack); + Memory::InjectHook(0x59FEDB, StoreRTObjectShadowHack, PATCH_JUMP); + //Memory::InjectHook(0x70C753, StoreRTPoleShadowHack); #endif //Memory::InjectHook(0x705590, &CShadowCamera::SetCenter, PATCH_JUMP); CShadows::Inject(); diff --git a/VCS PC/Shadows.h b/VCS PC/Shadows.h index c24fc1e..f93fc29 100644 --- a/VCS PC/Shadows.h +++ b/VCS PC/Shadows.h @@ -26,7 +26,9 @@ class CShadows { return m_bShadowQuality; } static bool StoreRealTimeShadowForVehicle(class CVehicle* pVehicle); + static void StoreRealTimeShadowForObject(class CObject* pObject); static void InitialiseChangedSettings(); + static bool ThisPropCanHaveShadow(CPhysical* pPhysical); static void Inject(); }; diff --git a/VCS PC/UpdateManager.cpp b/VCS PC/UpdateManager.cpp index de9a6d1..8a1cda9 100644 --- a/VCS PC/UpdateManager.cpp +++ b/VCS PC/UpdateManager.cpp @@ -384,16 +384,16 @@ const char* CUpdateManager::GetGXTEntryForButton() { case UPTMODULESTATE_CHECKING: CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); - return "FEU_UCK"; + return TheText.Get("FEU_UCK"); case UPTMODULESTATE_NEW_UPDATES: - return "FEU_UPN"; + return TheText.Get("FEU_UPN"); case UPTMODULESTATE_DOWNLOADING: CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); - return "FEU_UDL"; + return TheText.Get("FEU_UDL"); case UPTMODULESTATE_ALL_READY: CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); default: - return "FEU_UPC"; + return TheText.Get("FEU_UPC"); } } diff --git a/VCS PC/UpdateManager.h b/VCS PC/UpdateManager.h index 419e85c..f1ff451 100644 --- a/VCS PC/UpdateManager.h +++ b/VCS PC/UpdateManager.h @@ -30,6 +30,13 @@ class CUpdateManager public: static inline bool AnyTextDisplaysNow() { return nDrawingState != 0; } + static inline bool NewUpdatesPending() + { return nInterfaceStatus == UPTMODULESTATE_NEW_UPDATES; } + + static inline bool AutoInstallEnabled() + { return bAutoInstallUpdates; } + static inline unsigned char GetCheckingPeriod() + { return bCheckingPeriod; } static inline bool IsDownloading() { return nInterfaceStatus == UPTMODULESTATE_DOWNLOADING || nInterfaceStatus == UPTMODULESTATE_ALL_READY; } diff --git a/VCS PC/VCSPC.cpp b/VCS PC/VCSPC.cpp index f7cd719..da1c9c0 100644 --- a/VCS PC/VCSPC.cpp +++ b/VCS PC/VCSPC.cpp @@ -283,8 +283,8 @@ void* func_6B4800_JumpBack; void* func_6B4800_ElseJump; void* func_6D1AA0_JumpBack; void* func_6D1AA0_ElseJump; -void* Clock_StringInject_JumpBack; -void* Clock_StringInject_JumpToOFF; +//void* Clock_StringInject_JumpBack; +//void* Clock_StringInject_JumpToOFF; void* ScriptCheckpointsColours_JumpBack; void* BigMessage1Inject_JumpBack; void* ExtraWeaponAnimationsInject_JumpBack; @@ -303,8 +303,6 @@ void* SaveFallback_InjectOnLoad_JumpBack; void* SaveFallback_InjectOnSave_ReturnTrue; void* SaveFallback_InjectOnSave_ReturnFalse; void* SaveFallback_FallbackPreBeta3Names_JumpBack; -void* MenuEntriesAlignHack_JumpBack; -void* MenuEntriesPositionHack_JumpBack; void* MenuEntriesLeftColumnHack2_JumpBack; void* WidescreenFOVHack_JumpBack; void* Widescreen_TextDrawsFix2_JumpBack; @@ -318,7 +316,7 @@ void* VideoPlayerCreate1_JumpBack; void* VideoPlayerPlayNextFrame_JumpBack; void* VideoPlayerProc_JumpBack; void* VideoPlayerRelease_JumpBack; -void* FrameLimit_StringInject_JumpBack; +//void* FrameLimit_StringInject_JumpBack; /*void* LoadFontsHack_JumpBack; void* ReleaseFontsHack_JumpBack;*/ void* SetCutsceneModelHack_JumpBack; @@ -403,7 +401,7 @@ const float fRadarPosY = 107.0f; const float fCTSliderRight = 370.0f; const float fRhinoHitStrength = 1000.0f; const float fRefZVal = 1.0f; -const float fBrightnessStep = 1.0f / 192.0f; +//const float fBrightnessStep = 1.0f / 192.0f; const float fBrightnessStep2 = 12.0f; const float fBrightnessMax = 192.0f; //const float fBriefTextHeight = 0.7/448.0; @@ -874,8 +872,8 @@ __forceinline void DefineVariables() func_6B4800_ElseJump = (void*)0x6B4B95; func_6D1AA0_JumpBack = (void*)0x6D1ACC; func_6D1AA0_ElseJump = (void*)0x6D1ACE; - Clock_StringInject_JumpBack = (void*)0x57A161; - Clock_StringInject_JumpToOFF = (void*)0x579F65; + //Clock_StringInject_JumpBack = (void*)0x57A161; + //Clock_StringInject_JumpToOFF = (void*)0x579F65; ScriptCheckpointsColours_JumpBack = (void*)0x493651; BigMessage1Inject_JumpBack = (void*)0x58C8B7; ExtraWeaponAnimationsInject_JumpBack = (void*)0x609A3B; @@ -894,9 +892,7 @@ __forceinline void DefineVariables() SaveFallback_InjectOnSave_ReturnFalse = (void*)0x5D15AB; SaveFallback_FallbackPreBeta3Names_JumpBack = (void*)0x6191EE; LoadGameFailedMessage_JumpBack = (void*)0x53C74B; - MenuEntriesAlignHack_JumpBack = (void*)0x57A21F; MenuEntriesLeftColumnHack2_JumpBack = (void*)0x57A1BA; - MenuEntriesPositionHack_JumpBack = (void*)0x57A3F1; WidescreenFOVHack_JumpBack = (void*)0x72FD5A; Widescreen_TextDrawsFix2_JumpBack = (void*)0x58C229; DriveByKillFix_ReturnTrue = (void*)0x43DE05; @@ -909,7 +905,7 @@ __forceinline void DefineVariables() VideoPlayerPlayNextFrame_JumpBack = (void*)0x748DA3; VideoPlayerProc_JumpBack = (void*)0x74817E; VideoPlayerRelease_JumpBack = (void*)0x748C21; - FrameLimit_StringInject_JumpBack = (void*)0x57A168; + //FrameLimit_StringInject_JumpBack = (void*)0x57A168; /*LoadFontsHack_JumpBack = (void*)0x5BA6E5; ReleaseFontsHack_JumpBack = (void*)0x7189C6;*/ SetCutsceneModelHack_JumpBack = (void*)0x5B10DE; @@ -2184,7 +2180,6 @@ RpAtomic* RenderAtomicTest(RpAtomic* atomic) __forceinline void Main_Patches() { using namespace Memory; - DWORD dwFunc; LogToFile("Patching miscellaneous game data..."); @@ -3057,8 +3052,8 @@ __forceinline void Main_Patches() // Autoupdater InjectHook(0x53E77C, &CUpdateManager::Process); InjectHook(0x53BF4E, &UpdaterProcessHack); - InjectHook(0x579526, &UpdaterMenuDrawHack, PATCH_JUMP); - InjectHook(0x579D50, &UpdaterTextSwap, PATCH_JUMP); + //InjectHook(0x579526, &UpdaterMenuDrawHack, PATCH_JUMP); + //InjectHook(0x579D50, &UpdaterTextSwap, PATCH_JUMP); // InjectHook(0x576E13, &MenuToggleHack, PATCH_JUMP // InjectHook(0x573680, &SetToNewMenuHack, PATCH_JUMP); Patch(0x57CD84, PCMenuActionsTable); @@ -3129,7 +3124,7 @@ __forceinline void Main_Patches() InjectHook(0x748D9A, &MaxosFrameLimitHack, PATCH_JUMP); InjectHook(0x57CECA, &FrameLimit_SwitchInject, PATCH_JUMP); - InjectHook(0x579EF3, &FrameLimit_StringInject); + //InjectHook(0x579EF3, &FrameLimit_StringInject); InjectHook(0x57CD05, &FrameLimit_SetFPS, PATCH_JUMP); /*call(0x573BB8, &FrameLimit_SetFPS2, PATCH_CALL); Nop(0x573BBD, 1);*/ @@ -3216,26 +3211,26 @@ __forceinline void Main_Patches() InjectHook(0x56D220, &UseMetricSystem, PATCH_JUMP); // Radio icons tweaks - InjectHook(0x579538, &CMenuManager::DrawRadioStationIcons, PATCH_NOTHING); + //InjectHook(0x579538, &CMenuManager::DrawRadioStationIcons, PATCH_NOTHING); /*patch(0x574702, 91, 4); patch(0x57470D, 10, 4); Patch(0x57480A, 11); patch(0x574889, 0x8120C283, 4);*/ - Patch(0x57A2BD, 4); + //Patch(0x57A2BD, 4); // 12H Clock menu options InjectHook(0x577086, &Clock_SwitchInject, PATCH_JUMP); - InjectHook(0x579E6A, &Clock_StringInject); + //InjectHook(0x579E6A, &Clock_StringInject); // Pink menu header - Patch(0x5795F3, 11); + //Patch(0x5795F3, 11); Patch(0x57F6C6, 11); // active menu entry RGB - Patch(0x579A63, MENU_ACTIVE_B); - Patch(0x579A68, MENU_ACTIVE_G); - Patch(0x579A6D, MENU_ACTIVE_R); + //Patch(0x579A63, MENU_ACTIVE_B); + //Patch(0x579A68, MENU_ACTIVE_G); + //Patch(0x579A6D, MENU_ACTIVE_R); /*patch(0x5768D3, MENU_ACTIVE_B, 4); patch(0x5768D8, MENU_ACTIVE_G, 4); patch(0x5768DD, MENU_ACTIVE_R, 4);*/ @@ -3247,19 +3242,19 @@ __forceinline void Main_Patches() /*Patch(0x576913, MENU_INACTIVE_B); Patch(0x576915, MENU_INACTIVE_G); Patch(0x576917, MENU_INACTIVE_R);*/ - Patch(0x579767, MENU_INACTIVE_B); - Patch(0x579769, MENU_INACTIVE_G); - Patch(0x57976B, MENU_INACTIVE_R); + //Patch(0x579767, MENU_INACTIVE_B); + //Patch(0x579769, MENU_INACTIVE_G); + //Patch(0x57976B, MENU_INACTIVE_R); /*Patch(0x579A88, MENU_INACTIVE_B); Patch(0x579A8A, MENU_INACTIVE_G); Patch(0x579A8C, MENU_INACTIVE_R);*/ Patch(0x57FD08, MENU_INACTIVE_B); Patch(0x57FD0A, MENU_INACTIVE_G); Patch(0x57FD0C, MENU_INACTIVE_R); - Patch(0x579F2E, MENU_LOCKED_B); - Patch(0x579F30, MENU_LOCKED_G); - Patch(0x579F32, MENU_LOCKED_R); - InjectHook(0x579A87, &MenuEntryColourHack, PATCH_JUMP); + //Patch(0x579F2E, MENU_LOCKED_B); + //Patch(0x579F30, MENU_LOCKED_G); + //Patch(0x579F32, MENU_LOCKED_R); + //InjectHook(0x579A87, &MenuEntryColourHack, PATCH_JUMP); // Custom Tracks slider @@ -3279,18 +3274,18 @@ __forceinline void Main_Patches() patch(0x57BE10, MENU_INACTIVE_R, 4); // Fixed menu fonts - Patch(0x579929, FONT_Eurostile); - Patch(0x5799AD, FONT_Eurostile); + //Patch(0x579929, FONT_Eurostile); + //Patch(0x5799AD, FONT_Eurostile); //Patch(0x5799AD, FONT_PagerFont); - Patch(0x57A20B, FONT_Eurostile); + //Patch(0x57A20B, FONT_Eurostile); Patch(0x57E280, FONT_Eurostile); Patch(0x57FCC3, FONT_Eurostile); Patch(0x5760F7, FONT_Eurostile); Patch(0x57FA41, FONT_Eurostile/*FONT_RageItalic*/); // Smaller outline - Patch(0x579A24, 1); - Patch(0x579739, 1); + //Patch(0x579A24, 1); + //Patch(0x579739, 1); Patch(0x575F21, 1); Patch(0x575F7C, 0x402444DB); @@ -3302,8 +3297,8 @@ __forceinline void Main_Patches() Patch(0x575F66, &WidescreenSupport::fMapZonePosX2); Patch(0x575E6E, 1280.0); - Patch(0x5795E9, 2); - InjectHook(0x5795EA, 0x719570); + //Patch(0x5795E9, 2); + //InjectHook(0x5795EA, 0x719570); // ONE intro splash (FINALLY) Patch(0x748EF8, 0x748AC6); @@ -3315,13 +3310,13 @@ __forceinline void Main_Patches() InjectHook(0x57BA5F, &CMenuManager::DrawOutroSplash, PATCH_NOTHING); // Stats Menu - InjectHook(0x57954A, &CMenuManager::PrintStats, PATCH_NOTHING); + //InjectHook(0x57954A, &CMenuManager::PrintStats, PATCH_NOTHING); Patch(0x577370, &StatsMenuActionHack); // Brightness //Patch(0x573B8A, 96.0 / 512.0); //Patch(0x573B96, 96); - Patch(0x57A8A9, &fBrightnessStep); + //Patch(0x57A8A9, &fBrightnessStep); Patch(0x573487, &fBrightnessStep2); Patch(0x5734AD, &fBrightnessMax); Patch(0x5734BC, &fBrightnessMax); @@ -3430,20 +3425,20 @@ __forceinline void Main_Patches() Patch(0x57B9FB, 0x05EB); // More centered stuff in menu, sliders - InjectHook(0x57A218, &MenuEntriesAlignHack, PATCH_JUMP); - InjectHook(0x57A3B1, &MenuEntriesPositionHack_Inject, PATCH_JUMP); + //InjectHook(0x57A218, &MenuEntriesAlignHack, PATCH_JUMP); + //InjectHook(0x57A3B1, &MenuEntriesPositionHack_Inject, PATCH_JUMP); //Patch(0x57A219, ALIGN_Left); //patch(0x57A3DF, &fMenuTextsPosX, 4); //patch(0x57A3ED, &fMenuTextsPosX2, 4); // -//- related to sliders - InjectHook(0x576860, &CMenuManager::DisplaySlider, PATCH_JUMP); + //InjectHook(0x576860, &CMenuManager::DisplaySlider, PATCH_JUMP); /*patchf(0x57A881, 640.0 - MENU_TEXT_POSITION_RCOLUMN); patchf(0x57AA75, 640.0 - MENU_TEXT_POSITION_RCOLUMN); patchf(0x57ACB2, 640.0 - MENU_TEXT_POSITION_RCOLUMN); patchf(0x57AEA4, 640.0 - MENU_TEXT_POSITION_RCOLUMN); patchf(0x57B0D8, 640.0 - MENU_TEXT_POSITION_RCOLUMN);*/ - Patch(0x57A881, 320.0 + MENU_TEXT_POSITION_RCOLUMN); + /*Patch(0x57A881, 320.0 + MENU_TEXT_POSITION_RCOLUMN); Patch(0x57AA75, 320.0 + MENU_TEXT_POSITION_RCOLUMN); Patch(0x57ACB2, 320.0 + MENU_TEXT_POSITION_RCOLUMN); Patch(0x57AEA4, 320.0 + MENU_TEXT_POSITION_RCOLUMN); @@ -3488,18 +3483,18 @@ __forceinline void Main_Patches() Patch(0x57AC3B, &WidescreenSupport::f100); Patch(0x57AE42, &WidescreenSupport::f100); Patch(0x57B070, &WidescreenSupport::f100); -// Patch(0x57A878, 0xEB); +// Patch(0x57A878, 0xEB);*/ // Proper widescreen support - patch(0x579667, &WidescreenSupport::f40, 4); - patch(0x5795D1, &WidescreenSupport::f1pt3, 4); - patch(0x579865, &WidescreenSupport::f60, 4); - patch(0x57971A, &WidescreenSupport::f0pt49, 4); - patch(0x579983, &WidescreenSupport::f0pt42, 4); - patch(0x579A03, &WidescreenSupport::f0pt7, 4); - patch(0x57A2A2, &WidescreenSupport::f0pt35, 4); - patch(0x57A31B, &WidescreenSupport::f0pt56, 4); - patch(0x57A370, &WidescreenSupport::f0pt7, 4); + //patch(0x579667, &WidescreenSupport::f40, 4); + //patch(0x5795D1, &WidescreenSupport::f1pt3, 4); + //patch(0x579865, &WidescreenSupport::f60, 4); + //patch(0x57971A, &WidescreenSupport::f0pt49, 4); + //patch(0x579983, &WidescreenSupport::f0pt42, 4); + //patch(0x579A03, &WidescreenSupport::f0pt7, 4); + //patch(0x57A2A2, &WidescreenSupport::f0pt35, 4); + //patch(0x57A31B, &WidescreenSupport::f0pt56, 4); + //patch(0x57A370, &WidescreenSupport::f0pt7, 4); patch(0x57403F, &WidescreenSupport::fMenuMessageWidth, 4); patch(0x5740BE, &WidescreenSupport::f0pt56, 4); patch(0x574112, &WidescreenSupport::f95, 4); @@ -3546,10 +3541,10 @@ __forceinline void Main_Patches() patch(0x58C12D, &WidescreenSupport::fTextDrawsWidthMultiplier, 4); patch(0x58C144, &WidescreenSupport::fTextDrawsWidthMultiplier, 4);*/ InjectHook(0x57E3A5, &HelperPosXHack); - InjectHook(0x57A186/*0x57A1BA*//*0x57A1C1*/, &MenuEntriesLeftColumnHack, PATCH_JUMP); + //InjectHook(0x57A186/*0x57A1BA*//*0x57A1C1*/, &MenuEntriesLeftColumnHack, PATCH_JUMP); //call(0x57A190, &MenuEntriesLeftColumnHack2, PATCH_JUMP); - InjectHook(0x579BBF, &MenuEntriesPlaceSave, PATCH_JUMP); - InjectHook(0x579C7F, &MenuEntriesPlaceSave2, PATCH_JUMP); + //InjectHook(0x579BBF, &MenuEntriesPlaceSave, PATCH_JUMP); + //InjectHook(0x579C7F, &MenuEntriesPlaceSave2, PATCH_JUMP); InjectHook(0x72FD75, &WidescreenSupportRecalculateHack, PATCH_JUMP); InjectHook(0x745C99, &WidescreenSupportRecalculateHack2, PATCH_JUMP); InjectHook(0x746341, &WidescreenSupportRecalculateHack3, PATCH_CALL); @@ -3564,7 +3559,7 @@ __forceinline void Main_Patches() InjectHook(0x58BB88, &WidescreenSupport::GetTextBoxPos, PATCH_CALL); // InjectHook(0x714841, &WidescreenSkyWidthHack, PATCH_CALL); InjectHook(0x57706E, &Widescreen_SwitchInject, PATCH_JUMP); - InjectHook(0x579DE9, &Widescreen_StringInject); + //InjectHook(0x579DE9, &Widescreen_StringInject); // InjectHook(0x58C0BB, &Widescreen_TextDrawsFix, PATCH_CALL); InjectHook(0x58C1EC, &Widescreen_TextDrawsFix2, PATCH_JUMP); InjectHook(0x72FC70, &CameraSize, PATCH_JUMP); @@ -3684,8 +3679,8 @@ __forceinline void Main_Patches() InjectHook(0x57B457, &CMenuManager::UserInputVCS, PATCH_NOTHING); // No arrow.txd - Patch(0x57A511, 0xDBE9); - Nop(0x57A516, 1); + //Patch(0x57A511, 0xDBE9); + //Nop(0x57A516, 1); // .set alterations /*#if SET_FILE_VERSION != 6 @@ -3906,11 +3901,11 @@ __forceinline void Main_Patches() Patch(0x61916B, SlotFileName); Patch(0x619189, SlotFileName); Patch(0x5D0F4B, SlotFileName); - Patch(0x579BD5, SlotValidation); + //Patch(0x579BD5, SlotValidation); Patch(0x57B6AD, SlotValidation); Patch(0x5772B3, &SlotValidation[1]); Patch(0x5772D3, &SlotValidation[1]); - Patch(0x5797D7, &SlotValidation[1]); + //Patch(0x5797D7, &SlotValidation[1]); Patch(0x619157, &SlotValidation[1]); Patch(0x61922D, &SlotValidation[1]); Patch(0x619247, &SlotValidation[1]); @@ -3921,13 +3916,13 @@ __forceinline void Main_Patches() Patch(0x57728F, ACTION_SAVE_12); Patch(0x5772FD, ACTION_SAVE_12); - Patch(0x579921, ACTION_SAVE_12); - Patch(0x579BB6, ACTION_SAVE_12); - Patch(0x57A241, ACTION_SAVE_12); + //Patch(0x579921, ACTION_SAVE_12); + //Patch(0x579BB6, ACTION_SAVE_12); + //Patch(0x57A241, ACTION_SAVE_12); Patch(0x57B6A7, ACTION_SAVE_12); - Patch(0x579903, ACTION_MISSIONPACK); - Patch(0x579AFB, ACTION_MISSIONPACK); - Patch(0x579CDA, ACTION_MISSIONPACK); + //Patch(0x579903, ACTION_MISSIONPACK); + //Patch(0x579AFB, ACTION_MISSIONPACK); + //Patch(0x579CDA, ACTION_MISSIONPACK); //Patch(0x579D52, ACTION_JOYMOUSE); Patch(0x57B6F5, ACTION_CLICKORARROWS); @@ -3944,33 +3939,33 @@ __forceinline void Main_Patches() Patch(0x576B30, sizeof(MenuItem)); Patch(0x576B4F, sizeof(MenuItem)); Patch(0x57700A, sizeof(MenuItem)); - Patch(0x579562, sizeof(MenuItem)); - Patch(0x579678, sizeof(MenuItem)); - Patch(0x5796A9, sizeof(MenuItem)); - Patch(0x57981A, sizeof(MenuItem)); - Patch(0x5798D0, sizeof(MenuItem)); - Patch(0x579AAA, sizeof(MenuItem)); - Patch(0x579AD7, sizeof(MenuItem)); - Patch(0x579B24, sizeof(MenuItem)); - Patch(0x579B52, sizeof(MenuItem)); - Patch(0x579B69, sizeof(MenuItem)); - Patch(0x579C78, sizeof(MenuItem)); - Patch(0x579D14, sizeof(MenuItem)); - Patch(0x579D37, sizeof(MenuItem)); - Patch(0x579D8B, sizeof(MenuItem)); - Patch(0x57A182, sizeof(MenuItem)); - Patch(0x57A22E, sizeof(MenuItem)); - Patch(0x57A397, sizeof(MenuItem)); - Patch(0x57A44D, sizeof(MenuItem)); - Patch(0x57A543, sizeof(MenuItem)); - Patch(0x57A60B, sizeof(MenuItem)); - Patch(0x57A653, sizeof(MenuItem)); - Patch(0x57A69B, sizeof(MenuItem)); - Patch(0x57A6DC, sizeof(MenuItem)); - Patch(0x57A71F, sizeof(MenuItem)); - Patch(0x57A772, sizeof(MenuItem)); - Patch(0x57A7B6, sizeof(MenuItem)); - Patch(0x57B277, sizeof(MenuItem)); + //Patch(0x579562, sizeof(MenuItem)); + //Patch(0x579678, sizeof(MenuItem)); + //Patch(0x5796A9, sizeof(MenuItem)); + //Patch(0x57981A, sizeof(MenuItem)); + //Patch(0x5798D0, sizeof(MenuItem)); + //Patch(0x579AAA, sizeof(MenuItem)); + //Patch(0x579AD7, sizeof(MenuItem)); + //Patch(0x579B24, sizeof(MenuItem)); + //Patch(0x579B52, sizeof(MenuItem)); + //Patch(0x579B69, sizeof(MenuItem)); + //Patch(0x579C78, sizeof(MenuItem)); + //Patch(0x579D14, sizeof(MenuItem)); + //Patch(0x579D37, sizeof(MenuItem)); + //Patch(0x579D8B, sizeof(MenuItem)); + //Patch(0x57A182, sizeof(MenuItem)); + //Patch(0x57A22E, sizeof(MenuItem)); + //Patch(0x57A397, sizeof(MenuItem)); + //Patch(0x57A44D, sizeof(MenuItem)); + //Patch(0x57A543, sizeof(MenuItem)); + //Patch(0x57A60B, sizeof(MenuItem)); + //Patch(0x57A653, sizeof(MenuItem)); + //Patch(0x57A69B, sizeof(MenuItem)); + //Patch(0x57A6DC, sizeof(MenuItem)); + //Patch(0x57A71F, sizeof(MenuItem)); + //Patch(0x57A772, sizeof(MenuItem)); + //Patch(0x57A7B6, sizeof(MenuItem)); + //Patch(0x57B277, sizeof(MenuItem)); Patch(0x57B4E4, sizeof(MenuItem)); Patch(0x57B50D, sizeof(MenuItem)); Patch(0x57B582, sizeof(MenuItem)); @@ -3995,7 +3990,7 @@ __forceinline void Main_Patches() Patch(0x5804E0, sizeof(MenuItem)); Patch(0x5805C8, sizeof(MenuItem)); - Patch(0x57B29A, NUM_ENTRIES_PER_MENU); + //Patch(0x57B29A, NUM_ENTRIES_PER_MENU); Patch(0x57FED9, NUM_ENTRIES_PER_MENU); Patch(0x57B521, NUM_ENTRIES_PER_MENU); Patch(0x57B5D2, NUM_ENTRIES_PER_MENU - 1); @@ -4201,49 +4196,49 @@ __forceinline void PatchMenus() Patch(0x57723D, &MenuEntriesList->entryList->targetMenu); Patch(0x577280, &MenuEntriesList->entryList->specialDescFlag); Patch(0x5772F2, &MenuEntriesList->entryList->specialDescFlag); - Patch(0x579568, MenuEntriesList); - Patch(0x57967E, MenuEntriesList); - Patch(0x5796AF, &MenuEntriesList->entryList->action); - Patch(0x57981F, &MenuEntriesList->entryList->entry); - Patch(0x5798D6, &MenuEntriesList->entryList->action); - Patch(0x5798FC, &MenuEntriesList->entryList->specialDescFlag); - Patch(0x579AB2, &MenuEntriesList->entryList->align); - Patch(0x579AE4, &MenuEntriesList->entryList->posX); - Patch(0x579AEE, &MenuEntriesList->entryList->posY); - Patch(0x579AF7, &MenuEntriesList->entryList->specialDescFlag); - Patch(0x579B10, &MenuEntriesList->name[4]); - Patch(0x579B17, &MenuEntriesList->entryList->posX); - Patch(0x579B2E, &MenuEntriesList->name[6]); - Patch(0x579B3A, &MenuEntriesList->entryList->posY); - Patch(0x579B43, &MenuEntriesList->entryList->posX); - Patch(0x579B5A, &MenuEntriesList->entryList->posY); - Patch(0x579B70, &MenuEntriesList->entryList->action); - Patch(0x579B7A, &MenuEntriesList->entryList->action); - Patch(0x579B8B, &MenuEntriesList->entryList->entry); - Patch(0x579B9F, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x579568, MenuEntriesList); + //Patch(0x57967E, MenuEntriesList); + //Patch(0x5796AF, &MenuEntriesList->entryList->action); + //Patch(0x57981F, &MenuEntriesList->entryList->entry); + //Patch(0x5798D6, &MenuEntriesList->entryList->action); + //Patch(0x5798FC, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x579AB2, &MenuEntriesList->entryList->align); + //Patch(0x579AE4, &MenuEntriesList->entryList->posX); + //Patch(0x579AEE, &MenuEntriesList->entryList->posY); + //Patch(0x579AF7, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x579B10, &MenuEntriesList->name[4]); + //Patch(0x579B17, &MenuEntriesList->entryList->posX); + //Patch(0x579B2E, &MenuEntriesList->name[6]); + //Patch(0x579B3A, &MenuEntriesList->entryList->posY); + //Patch(0x579B43, &MenuEntriesList->entryList->posX); + //Patch(0x579B5A, &MenuEntriesList->entryList->posY); + //Patch(0x579B70, &MenuEntriesList->entryList->action); + //Patch(0x579B7A, &MenuEntriesList->entryList->action); + //Patch(0x579B8B, &MenuEntriesList->entryList->entry); + //Patch(0x579B9F, &MenuEntriesList->entryList->specialDescFlag); //Patch(0x579BC3, &MenuEntriesList->entryList->posX); //Patch(0x579C83, &MenuEntriesList->entryList->posX); - Patch(0x579D20, &MenuEntriesList->entryList->action); - Patch(0x579D3F, &MenuEntriesList->name[6]); - Patch(0x579D4A, &MenuEntriesList->entryList->posY); - Patch(0x579D93, &MenuEntriesList->entryList->action); + //Patch(0x579D20, &MenuEntriesList->entryList->action); + //Patch(0x579D3F, &MenuEntriesList->name[6]); + //Patch(0x579D4A, &MenuEntriesList->entryList->posY); + //Patch(0x579D93, &MenuEntriesList->entryList->action); //Patch(0x57A18A, &MenuEntriesList->entryList->posY); //Patch(0x57A1BD, &MenuEntriesList->entryList->posX); - Patch(0x57A235, &MenuEntriesList->entryList->specialDescFlag); - Patch(0x57A39F, &MenuEntriesList->entryList->posY); - Patch(0x57A455, &MenuEntriesList->entryList->align); - Patch(0x57A469, &MenuEntriesList->entryList->posX); - Patch(0x57A4B9, &MenuEntriesList->entryList->posX); - Patch(0x57A4DA, &MenuEntriesList->entryList->posX); - Patch(0x57A54F, &MenuEntriesList->entryList->posY); - Patch(0x57A615, &MenuEntriesList->entryList->entry); - Patch(0x57A65D, &MenuEntriesList->entryList->entry); - Patch(0x57A6A5, &MenuEntriesList->entryList->entry); - Patch(0x57A6E6, &MenuEntriesList->entryList->entry); - Patch(0x57A729, &MenuEntriesList->entryList->entry); - Patch(0x57A77C, &MenuEntriesList->entryList->entry); - Patch(0x57A7BE, &MenuEntriesList->entryList->action); - Patch(0x57B27E, &MenuEntriesList->entryList->action); + //Patch(0x57A235, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x57A39F, &MenuEntriesList->entryList->posY); + //Patch(0x57A455, &MenuEntriesList->entryList->align); + //Patch(0x57A469, &MenuEntriesList->entryList->posX); + //Patch(0x57A4B9, &MenuEntriesList->entryList->posX); + //Patch(0x57A4DA, &MenuEntriesList->entryList->posX); + //Patch(0x57A54F, &MenuEntriesList->entryList->posY); + //Patch(0x57A615, &MenuEntriesList->entryList->entry); + //Patch(0x57A65D, &MenuEntriesList->entryList->entry); + //Patch(0x57A6A5, &MenuEntriesList->entryList->entry); + //Patch(0x57A6E6, &MenuEntriesList->entryList->entry); + //Patch(0x57A729, &MenuEntriesList->entryList->entry); + //Patch(0x57A77C, &MenuEntriesList->entryList->entry); + //Patch(0x57A7BE, &MenuEntriesList->entryList->action); + //Patch(0x57B27E, &MenuEntriesList->entryList->action); Patch(0x57B4F2, &MenuEntriesList->entryList->action); Patch(0x57B519, &MenuEntriesList->entryList->action); Patch(0x57B52A, &MenuEntriesList->entryList->action); @@ -4282,7 +4277,7 @@ __forceinline void PatchMenus() Patch(0x57F79C, "FEM_CFT"); Patch(0x57F702, "FEH_SCN"); Patch(0x57F709, "FEH_CCN"); - Patch(0x579C56, "FEM_SL%X"); + //Patch(0x579C56, "FEM_SL%X"); #ifdef DUMP_MENUS if ( FILE* hDumpFile = fopen("menu_dump.log", "w") ) @@ -5554,7 +5549,7 @@ void __declspec(naked) Clock_SwitchInject() } } -void __declspec(naked) Clock_StringInject() +/*void __declspec(naked) Clock_StringInject() { _asm { @@ -5575,7 +5570,7 @@ void __declspec(naked) Clock_StringInject() Clock_StringInject_DisplayOFF: jmp Clock_StringInject_JumpToOFF } -} +}*/ void __declspec(naked) RadioNameInject() { @@ -6074,7 +6069,7 @@ void __declspec(naked) MenuEntriesAlignHack() MenuEntriesAlignHack_Finish: call CFont::SetOrientation - jmp MenuEntriesAlignHack_JumpBack + //jmp MenuEntriesAlignHack_JumpBack } } @@ -6088,7 +6083,7 @@ void __declspec(naked) MenuEntriesPositionHack_Inject() mov ecx, ebp call CMenuManager::GetRightColumnPos pop ecx - jmp MenuEntriesPositionHack_JumpBack + //jmp MenuEntriesPositionHack_JumpBack } } @@ -6489,7 +6484,7 @@ void __declspec(naked) Widescreen_StringInject() add esp, 10h mov ecx, [TheText] push offset gString - jmp Clock_StringInject_JumpBack + //jmp Clock_StringInject_JumpBack } } @@ -6871,10 +6866,10 @@ void __declspec(naked) FrameLimit_StringInject() call CMessages::InsertNumberInString add esp, 20h mov esi, offset gString - jmp FrameLimit_StringInject_JumpBack + //jmp FrameLimit_StringInject_JumpBack FrameLimit_StringInject_Off: - jmp Clock_StringInject_JumpToOFF + //jmp Clock_StringInject_JumpToOFF } }