Skip to content

Commit 3692922

Browse files
authored
Merge branch 'master' into patch-6
2 parents c8c897d + 469246f commit 3692922

File tree

6 files changed

+61
-39
lines changed

6 files changed

+61
-39
lines changed

Client/core/CCore.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ CCore::CCore()
156156
m_bGettingIdleCallsFromMultiplayer = false;
157157
m_bWindowsTimerEnabled = false;
158158
m_timeDiscordAppLastUpdate = 0;
159+
m_CurrentRefreshRate = 60;
159160

160161
// Create tray icon
161162
m_pTrayIcon = new CTrayIcon();
@@ -1835,6 +1836,9 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
18351836
if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0)
18361837
m_uiFrameRateLimit = uiClientScriptRate;
18371838

1839+
if (!IsConnected())
1840+
m_uiFrameRateLimit = m_CurrentRefreshRate;
1841+
18381842
// Removes Limiter from Frame Graph if limit is zero and skips frame limit
18391843
if (m_uiFrameRateLimit == 0)
18401844
{
@@ -1861,6 +1865,12 @@ void CCore::SetClientScriptFrameRateLimit(uint uiClientScriptFrameRateLimit)
18611865
RecalculateFrameRateLimit(-1, false);
18621866
}
18631867

1868+
void CCore::SetCurrentRefreshRate(uint value)
1869+
{
1870+
m_CurrentRefreshRate = value;
1871+
RecalculateFrameRateLimit(-1, false);
1872+
}
1873+
18641874
//
18651875
// Make sure the frame rate limit has been applied since the last call
18661876
//
@@ -1921,7 +1931,7 @@ void CCore::ApplyQueuedFrameRateLimit()
19211931
double dSpare = dTargetTimeToUse - m_FrameRateTimer.Get();
19221932
if (dSpare <= 0.0)
19231933
break;
1924-
if (dSpare >= 2.0)
1934+
if (dSpare >= 10.0)
19251935
Sleep(1);
19261936
}
19271937
m_FrameRateTimer.Reset();

Client/core/CCore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
223223
void ApplyQueuedFrameRateLimit();
224224
void EnsureFrameRateLimitApplied();
225225
void SetClientScriptFrameRateLimit(uint uiClientScriptFrameRateLimit);
226+
void SetCurrentRefreshRate(uint value);
226227
void DoReliablePulse();
227228

228229
bool IsTimingCheckpoints();
@@ -371,6 +372,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
371372
CElapsedTimeHD m_FrameRateTimer;
372373
uint m_uiQueuedFrameRate;
373374
bool m_bQueuedFrameRateValid;
375+
uint m_CurrentRefreshRate;
374376
bool m_requestNewNickname{false};
375377
EDiagnosticDebugType m_DiagnosticDebug;
376378

Client/core/CMainMenu.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,9 @@ void CMainMenu::SetIsIngame(bool bIsIngame)
778778
m_bIsIngame = bIsIngame;
779779
m_Settings.SetIsModLoaded(bIsIngame);
780780

781+
// Reset frame rate limit
782+
CCore::GetSingleton().RecalculateFrameRateLimit(-1, false);
783+
781784
m_ulMoveStartTick = GetTickCount32();
782785
if (bIsIngame)
783786
{

Client/core/CModManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void CModManager::DoPulsePostFrame()
9393
if (m_client != nullptr)
9494
CCore::GetSingleton().EnsureFrameRateLimitApplied(); // Catch missed frames
9595
else
96-
CCore::GetSingleton().ApplyFrameRateLimit(88); // Limit when not connected
96+
CCore::GetSingleton().ApplyFrameRateLimit(); // Limit when not connected
9797

9898
if (m_state == State::PendingStart)
9999
{

Client/core/DXHook/CProxyDirect3D9.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,13 @@ HRESULT HandleCreateDeviceResult(HRESULT hResult, IDirect3D9* pDirect3D, UINT Ad
833833
strMessage += SString("Direct3D CreateDevice error: %08x", hResult);
834834
BrowseToSolution("d3dcreatedevice-fail", EXIT_GAME_FIRST | ASK_GO_ONLINE, strMessage);
835835
}
836+
else
837+
{
838+
// Get current refresh rate
839+
D3DDISPLAYMODE DisplayMode;
840+
if (pDirect3D->GetAdapterDisplayMode(Adapter, &DisplayMode) == D3D_OK)
841+
CCore::GetSingleton().SetCurrentRefreshRate(DisplayMode.RefreshRate);
842+
}
836843

837844
return hResult;
838845
}

Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: MTA San Andreas 1.x\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-03-07 21:43+0000\n"
11+
"POT-Creation-Date: 2025-03-08 23:56+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -21,7 +21,7 @@ msgstr ""
2121
#. Create buttons
2222
#. OK button
2323
#: Client/gui/CGUIMessageBox_Impl.cpp:64 Client/loader/Dialogs.cpp:37
24-
#: Client/core/CMainMenu.cpp:1211 Client/core/CSettings.cpp:127
24+
#: Client/core/CMainMenu.cpp:1214 Client/core/CSettings.cpp:127
2525
#: Client/core/CSettings.cpp:4838 Client/core/CVersionUpdater.cpp:1607
2626
#: Client/core/CVersionUpdater.cpp:1823 Client/core/CVersionUpdater.cpp:1916
2727
#: Client/core/CVersionUpdater.cpp:1938 Client/core/CVersionUpdater.cpp:1956
@@ -47,7 +47,7 @@ msgstr ""
4747
#.
4848
#. /////////////////////////////////////////////////////////////////////////
4949
#: Client/gui/CGUIMessageBox_Impl.cpp:72 Client/loader/Dialogs.cpp:35
50-
#: Client/core/CMainMenu.cpp:1191 Client/core/CSettings.cpp:1413
50+
#: Client/core/CMainMenu.cpp:1194 Client/core/CSettings.cpp:1413
5151
#: Client/core/CSettings.cpp:1437 Client/core/CSettings.cpp:4542
5252
#: Client/core/CSettings.cpp:4616 Client/core/CSettings.cpp:4646
5353
#: Client/core/CSettings.cpp:4695 Client/core/CVersionUpdater.cpp:1572
@@ -57,7 +57,7 @@ msgstr ""
5757
msgid "Yes"
5858
msgstr ""
5959

60-
#: Client/loader/Dialogs.cpp:36 Client/core/CMainMenu.cpp:1190
60+
#: Client/loader/Dialogs.cpp:36 Client/core/CMainMenu.cpp:1193
6161
#: Client/core/CSettings.cpp:1412 Client/core/CSettings.cpp:1436
6262
#: Client/core/CSettings.cpp:4541 Client/core/CSettings.cpp:4615
6363
#: Client/core/CSettings.cpp:4645 Client/core/CSettings.cpp:4694
@@ -392,7 +392,7 @@ msgstr ""
392392
#: Client/core/CConnectManager.cpp:422 Client/core/CConnectManager.cpp:432
393393
#: Client/core/CSettings.cpp:2972 Client/core/CSettings.cpp:4219
394394
#: Client/core/CSettings.cpp:4247 Client/core/CSettings.cpp:4817
395-
#: Client/core/CCore.cpp:1261 Client/core/CGUI.cpp:93
395+
#: Client/core/CCore.cpp:1262 Client/core/CGUI.cpp:93
396396
#: Client/core/ServerBrowser/CServerBrowser.cpp:1261
397397
#: Client/core/ServerBrowser/CServerBrowser.cpp:1283
398398
#: Client/core/ServerBrowser/CServerBrowser.cpp:1340
@@ -460,7 +460,7 @@ msgstr ""
460460
msgid "MTA:SA cannot launch because patching GTA:SA has failed:"
461461
msgstr ""
462462

463-
#: Client/loader/CInstallManager.cpp:1057 Client/core/CCore.cpp:806
463+
#: Client/loader/CInstallManager.cpp:1057 Client/core/CCore.cpp:807
464464
#, c-format
465465
msgid "MTA:SA cannot continue because drive %s does not have enough space."
466466
msgstr ""
@@ -1110,7 +1110,7 @@ msgstr ""
11101110

11111111
#: Client/mods/deathmatch/logic/CResource.cpp:372
11121112
#: Client/mods/deathmatch/logic/CClientGame.cpp:1096
1113-
#: Client/core/CSettings.cpp:3520 Client/core/CCore.cpp:669
1113+
#: Client/core/CSettings.cpp:3520 Client/core/CCore.cpp:670
11141114
msgid "In-game"
11151115
msgstr ""
11161116

@@ -1245,7 +1245,7 @@ msgstr ""
12451245

12461246
#: Client/mods/deathmatch/logic/CClientGame.cpp:540
12471247
#: Client/core/CMainMenu.cpp:302 Client/core/CSettings.cpp:3516
1248-
#: Client/core/CCore.cpp:669
1248+
#: Client/core/CCore.cpp:670
12491249
msgid "Main menu"
12501250
msgstr ""
12511251

@@ -1465,18 +1465,18 @@ msgid ""
14651465
"Upgrade Windows to play on the latest servers."
14661466
msgstr ""
14671467

1468-
#: Client/core/CMainMenu.cpp:1184
1468+
#: Client/core/CMainMenu.cpp:1187
14691469
msgid ""
14701470
"This will disconnect you from the current server.\n"
14711471
"\n"
14721472
"Are you sure you want to disconnect?"
14731473
msgstr ""
14741474

1475-
#: Client/core/CMainMenu.cpp:1188
1475+
#: Client/core/CMainMenu.cpp:1191
14761476
msgid "DISCONNECT WARNING"
14771477
msgstr ""
14781478

1479-
#: Client/core/CMainMenu.cpp:1209
1479+
#: Client/core/CMainMenu.cpp:1212
14801480
msgid "INFORMATION"
14811481
msgstr ""
14821482

@@ -2712,110 +2712,110 @@ msgid ""
27122712
"Waiting for response - %-3d"
27132713
msgstr ""
27142714

2715-
#: Client/core/CCore.cpp:808 Shared/mods/deathmatch/logic/Utils.cpp:129
2715+
#: Client/core/CCore.cpp:809 Shared/mods/deathmatch/logic/Utils.cpp:129
27162716
msgid "Fatal error"
27172717
msgstr ""
27182718

2719-
#: Client/core/CCore.cpp:929
2719+
#: Client/core/CCore.cpp:930
27202720
msgid "TO FIX, REMOVE THIS FILE:"
27212721
msgstr ""
27222722

2723-
#: Client/core/CCore.cpp:961
2723+
#: Client/core/CCore.cpp:962
27242724
#, c-format
27252725
msgid "%s module is incorrect!"
27262726
msgstr ""
27272727

2728-
#: Client/core/CCore.cpp:1261
2728+
#: Client/core/CCore.cpp:1262
27292729
msgid "Error executing URL"
27302730
msgstr ""
27312731

27322732
#. m_pCommands->Add ( "e", CCommandFuncs::Editor );
27332733
#. m_pCommands->Add ( "clear", CCommandFuncs::Clear );
2734-
#: Client/core/CCore.cpp:1355
2734+
#: Client/core/CCore.cpp:1356
27352735
msgid "this help screen"
27362736
msgstr ""
27372737

2738-
#: Client/core/CCore.cpp:1356 Client/core/CCore.cpp:1357
2738+
#: Client/core/CCore.cpp:1357 Client/core/CCore.cpp:1358
27392739
msgid "exits the application"
27402740
msgstr ""
27412741

2742-
#: Client/core/CCore.cpp:1358
2742+
#: Client/core/CCore.cpp:1359
27432743
msgid "shows the version"
27442744
msgstr ""
27452745

2746-
#: Client/core/CCore.cpp:1359
2746+
#: Client/core/CCore.cpp:1360
27472747
msgid "shows the time"
27482748
msgstr ""
27492749

2750-
#: Client/core/CCore.cpp:1360
2750+
#: Client/core/CCore.cpp:1361
27512751
msgid "shows the hud"
27522752
msgstr ""
27532753

2754-
#: Client/core/CCore.cpp:1361
2754+
#: Client/core/CCore.cpp:1362
27552755
msgid "shows all the binds"
27562756
msgstr ""
27572757

2758-
#: Client/core/CCore.cpp:1362
2758+
#: Client/core/CCore.cpp:1363
27592759
msgid "shows your serial"
27602760
msgstr ""
27612761

2762-
#: Client/core/CCore.cpp:1371
2762+
#: Client/core/CCore.cpp:1372
27632763
msgid "connects to a server (host port nick pass)"
27642764
msgstr ""
27652765

2766-
#: Client/core/CCore.cpp:1372
2766+
#: Client/core/CCore.cpp:1373
27672767
msgid "connects to a previous server"
27682768
msgstr ""
27692769

2770-
#: Client/core/CCore.cpp:1373
2770+
#: Client/core/CCore.cpp:1374
27712771
msgid "binds a key (key control)"
27722772
msgstr ""
27732773

2774-
#: Client/core/CCore.cpp:1374
2774+
#: Client/core/CCore.cpp:1375
27752775
msgid "unbinds a key (key)"
27762776
msgstr ""
27772777

2778-
#: Client/core/CCore.cpp:1375
2778+
#: Client/core/CCore.cpp:1376
27792779
msgid "copies the default gta controls"
27802780
msgstr ""
27812781

2782-
#: Client/core/CCore.cpp:1376
2782+
#: Client/core/CCore.cpp:1377
27832783
msgid "outputs a screenshot"
27842784
msgstr ""
27852785

2786-
#: Client/core/CCore.cpp:1377
2786+
#: Client/core/CCore.cpp:1378
27872787
msgid "immediately saves the config"
27882788
msgstr ""
27892789

2790-
#: Client/core/CCore.cpp:1379
2790+
#: Client/core/CCore.cpp:1380
27912791
msgid "clears the debug view"
27922792
msgstr ""
27932793

2794-
#: Client/core/CCore.cpp:1380
2794+
#: Client/core/CCore.cpp:1381
27952795
msgid "scrolls the chatbox upwards"
27962796
msgstr ""
27972797

2798-
#: Client/core/CCore.cpp:1381
2798+
#: Client/core/CCore.cpp:1382
27992799
msgid "scrolls the chatbox downwards"
28002800
msgstr ""
28012801

2802-
#: Client/core/CCore.cpp:1382
2802+
#: Client/core/CCore.cpp:1383
28032803
msgid "scrolls the debug view upwards"
28042804
msgstr ""
28052805

2806-
#: Client/core/CCore.cpp:1383
2806+
#: Client/core/CCore.cpp:1384
28072807
msgid "scrolls the debug view downwards"
28082808
msgstr ""
28092809

2810-
#: Client/core/CCore.cpp:1386
2810+
#: Client/core/CCore.cpp:1387
28112811
msgid "shows the memory statistics"
28122812
msgstr ""
28132813

2814-
#: Client/core/CCore.cpp:1387
2814+
#: Client/core/CCore.cpp:1388
28152815
msgid "shows the frame timing graph"
28162816
msgstr ""
28172817

2818-
#: Client/core/CCore.cpp:1391
2818+
#: Client/core/CCore.cpp:1392
28192819
msgid "for developers: reload news"
28202820
msgstr ""
28212821

0 commit comments

Comments
 (0)