mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix: [Win32] Set minimum resolution for timers to 1ms. (#8660)
This commit is contained in:
parent
395e015282
commit
f1f281b318
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <timeapi.h>
|
||||||
|
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
@ -540,6 +541,9 @@ void *_safe_esp = nullptr;
|
|||||||
|
|
||||||
static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
||||||
{
|
{
|
||||||
|
/* Restore system timer resolution. */
|
||||||
|
timeEndPeriod(1);
|
||||||
|
|
||||||
/* Disable our event loop. */
|
/* Disable our event loop. */
|
||||||
SetWindowLongPtr(GetActiveWindow(), GWLP_WNDPROC, (LONG_PTR)&DefWindowProc);
|
SetWindowLongPtr(GetActiveWindow(), GWLP_WNDPROC, (LONG_PTR)&DefWindowProc);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#define NO_SHOBJIDL_SORTDIRECTION // Avoid multiple definition of SORT_ASCENDING
|
#define NO_SHOBJIDL_SORTDIRECTION // Avoid multiple definition of SORT_ASCENDING
|
||||||
#include <shlobj.h> /* SHGetFolderPath */
|
#include <shlobj.h> /* SHGetFolderPath */
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <timeapi.h>
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#include "../../fios.h"
|
#include "../../fios.h"
|
||||||
#include "../../core/alloc_func.hpp"
|
#include "../../core/alloc_func.hpp"
|
||||||
@ -413,6 +414,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
int argc;
|
int argc;
|
||||||
char *argv[64]; // max 64 command line arguments
|
char *argv[64]; // max 64 command line arguments
|
||||||
|
|
||||||
|
/* Set system timer resolution to 1ms. */
|
||||||
|
timeBeginPeriod(1);
|
||||||
|
|
||||||
CrashLog::InitialiseCrashLog();
|
CrashLog::InitialiseCrashLog();
|
||||||
|
|
||||||
#if defined(UNICODE)
|
#if defined(UNICODE)
|
||||||
@ -440,6 +444,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
for (int i = 0; i < argc; i++) ValidateString(argv[i]);
|
for (int i = 0; i < argc; i++) ValidateString(argv[i]);
|
||||||
|
|
||||||
openttd_main(argc, argv);
|
openttd_main(argc, argv);
|
||||||
|
|
||||||
|
/* Restore system timer resolution. */
|
||||||
|
timeEndPeriod(1);
|
||||||
|
|
||||||
free(cmdline);
|
free(cmdline);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user