diff options
Diffstat (limited to 'src/skel')
-rw-r--r-- | src/skel/events.cpp | 2 | ||||
-rw-r--r-- | src/skel/glfw/glfw.cpp | 98 | ||||
-rw-r--r-- | src/skel/platform.h | 4 | ||||
-rw-r--r-- | src/skel/skeleton.cpp | 6 | ||||
-rw-r--r-- | src/skel/win/gta3.ico | bin | 2238 -> 0 bytes | |||
-rw-r--r-- | src/skel/win/gtavc.ico | bin | 0 -> 3262 bytes | |||
-rw-r--r-- | src/skel/win/resource.h | 2 | ||||
-rw-r--r-- | src/skel/win/win.cpp | 119 | ||||
-rw-r--r-- | src/skel/win/win.rc | 2 |
9 files changed, 155 insertions, 78 deletions
diff --git a/src/skel/events.cpp b/src/skel/events.cpp index 3e1e95b3..6589ab71 100644 --- a/src/skel/events.cpp +++ b/src/skel/events.cpp @@ -9,6 +9,8 @@ #include "events.h" +// --MIAMI: file done + /* ***************************************************************************** */ diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index cdb73992..26a3a509 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -43,6 +43,7 @@ #define MAX_SUBSYSTEMS (16) +// --MIAMI: file done rw::EngineOpenParams openParams; @@ -152,7 +153,7 @@ const char *_psGetUserFilesFolder() &KeycbData) == ERROR_SUCCESS ) { RegCloseKey(hKey); - strcat(szUserFiles, "\\GTA3 User Files"); + strcat(szUserFiles, "\\GTA Vice City User Files"); _psCreateFolder(szUserFiles); return szUserFiles; } @@ -192,7 +193,11 @@ psCameraBeginUpdate(RwCamera *camera) void psCameraShowRaster(RwCamera *camera) { - if (CMenuManager::m_PrefsVsync) +#ifdef LEGACY_MENU_OPTIONS + if (FrontEndMenuManager.m_PrefsVsync || FrontEndMenuManager.m_bMenuActive) +#else + if (FrontEndMenuManager.m_PrefsFrameLimiter || FrontEndMenuManager.m_bMenuActive) +#endif RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPWAITVSYNC); else RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPDONTWAIT); @@ -382,10 +387,6 @@ psInitialize(void) InitialiseLanguage(); -#ifndef GTA3_1_1_PATCH - FrontEndMenuManager.LoadSettings(); -#endif - #endif gGameState = GS_START_UP; @@ -418,7 +419,7 @@ psInitialize(void) } else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) { - if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 ) + if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 ) { debug("Operating System is Win98\n"); _dwOperatingSystemVersion = OS_WIN98; @@ -435,13 +436,9 @@ psInitialize(void) #ifndef PS2_MENU - -#ifdef GTA3_1_1_PATCH FrontEndMenuManager.LoadSettings(); #endif -#endif - #ifdef _WIN32 MEMORYSTATUS memstats; @@ -465,11 +462,27 @@ psInitialize(void) debug("Physical memory size %llu\n", _dwMemAvailPhys); debug("Available physical memory %llu\n", size); #else +#ifndef __APPLE__ struct sysinfo systemInfo; sysinfo(&systemInfo); _dwMemAvailPhys = systemInfo.freeram; debug("Physical memory size %u\n", systemInfo.totalram); debug("Available physical memory %u\n", systemInfo.freeram); +#else + uint64_t size = 0; + uint64_t page_size = 0; + size_t uint64_len = sizeof(uint64_t); + size_t ull_len = sizeof(unsigned long long); + sysctl((int[]){CTL_HW, HW_PAGESIZE}, 2, &page_size, &ull_len, NULL, 0); + sysctl((int[]){CTL_HW, HW_MEMSIZE}, 2, &size, &uint64_len, NULL, 0); + vm_statistics_data_t vm_stat; + mach_msg_type_number_t count = HOST_VM_INFO_COUNT; + host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vm_stat, &count); + _dwMemAvailPhys = (uint64_t)(vm_stat.free_count * page_size); + debug("Physical memory size %llu\n", _dwMemAvailPhys); + debug("Available physical memory %llu\n", size); +#endif + _dwOperatingSystemVersion = OS_WINXP; // To fool other classes #endif TheText.Unload(); @@ -881,12 +894,23 @@ void _InputInitialiseJoys() } } -long _InputInitialiseMouse() +long _InputInitialiseMouse(bool exclusive) { glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN); return 0; } +void _InputShutdownMouse() +{ + // Not needed +} + +bool _InputMouseNeedsExclusive() +{ + // That was the cause of infamous mouse bug on Win. Not supported on glfw anyway + return false; +} + void psPostRWinit(void) { RwVideoMode vm; @@ -900,7 +924,7 @@ void psPostRWinit(void) glfwSetJoystickCallback(joysChangeCB); _InputInitialiseJoys(); - _InputInitialiseMouse(); + _InputInitialiseMouse(false); if(!(vm.flags & rwVIDEOMODEEXCLUSIVE)) glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight); @@ -1079,7 +1103,7 @@ void InitialiseLanguage() || primLayout == LANG_GERMAN ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::germanGame = true; } @@ -1088,7 +1112,7 @@ void InitialiseLanguage() || primLayout == LANG_FRENCH ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::frenchGame = true; } @@ -1099,7 +1123,7 @@ void InitialiseLanguage() #ifdef NASTY_GAME CGame::nastyGame = true; - CMenuManager::m_PrefsAllowNastyGame = true; + FrontEndMenuManager.m_PrefsAllowNastyGame = true; CGame::noProstitutes = false; #endif @@ -1134,33 +1158,33 @@ void InitialiseLanguage() } } - CMenuManager::OS_Language = primUserLCID; + FrontEndMenuManager.OS_Language = primUserLCID; switch ( lang ) { case LANG_GERMAN: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN; break; } case LANG_SPANISH: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH; break; } case LANG_FRENCH: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH; break; } case LANG_ITALIAN: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN; break; } default: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN; break; } } @@ -1220,14 +1244,17 @@ void resizeCB(GLFWwindow* window, int width, int height) { * memory things don't work. */ /* redraw window */ - if (RwInitialised && (gGameState == GS_PLAYING_GAME #ifndef MASTER - || gGameState == GS_ANIMVIEWER -#endif - )) + if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER)) + { + RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE); + } +#else + if (RwInitialised && gGameState == GS_PLAYING_GAME) { - RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void*)TRUE); + RsEventHandler(rsIDLE, (void *)TRUE); } +#endif if (RwInitialised && height > 0 && width > 0) { RwRect r; @@ -1435,7 +1462,7 @@ WinMain(HINSTANCE instance, RwChar** argv; SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); -#if 0 +#if 1 // TODO: make this an option somewhere AllocConsole(); freopen("CONIN$", "r", stdin); @@ -1565,7 +1592,7 @@ main(int argc, char *argv[]) { CFileMgr::SetDirMyDocuments(); - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { @@ -1735,6 +1762,7 @@ main(int argc, char *argv[]) printf("Into TheGame!!!\n"); #else LoadingScreen(nil, nil, "loadsc0"); + // LoadingScreen(nil, nil, "loadsc0"); // duplicate #endif if ( !CGame::InitialiseOnceAfterRW() ) RsGlobal.quit = TRUE; @@ -1747,15 +1775,15 @@ main(int argc, char *argv[]) #endif break; } - #ifndef PS2_MENU case GS_INIT_FRONTEND: { LoadingScreen(nil, nil, "loadsc0"); + // LoadingScreen(nil, nil, "loadsc0"); // duplicate FrontEndMenuManager.m_bGameNotLoaded = true; - CMenuManager::m_bStartUpFrontEndRequested = true; + FrontEndMenuManager.m_bStartUpFrontEndRequested = true; if ( defaultFullscreenRes ) { @@ -1838,7 +1866,7 @@ main(int argc, char *argv[]) float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if ( RwInitialised ) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) + if (!FrontEndMenuManager.m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); } break; @@ -1849,7 +1877,7 @@ main(int argc, char *argv[]) float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if (RwInitialised) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) + if (!FrontEndMenuManager.m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsANIMVIEWER, (void*)TRUE); } break; @@ -2107,5 +2135,9 @@ int strcasecmp(const char* str1, const char* str2) { return _strcmpi(str1, str2); } +int strncasecmp(const char *str1, const char *str2, size_t len) +{ + return _strnicmp(str1, str2, len); +} #endif #endif diff --git a/src/skel/platform.h b/src/skel/platform.h index c9a8a11f..0475d20a 100644 --- a/src/skel/platform.h +++ b/src/skel/platform.h @@ -38,7 +38,9 @@ extern RwBool psInstallFileSystem(void); extern RwBool psNativeTextureSupport(void); extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs); -extern long _InputInitialiseMouse(); // returns HRESULT on Windows actually +extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually +extern void _InputShutdownMouse(); +extern bool _InputMouseNeedsExclusive(); extern void _InputInitialiseJoys(); extern void HandleExit(); diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index 4780316a..e21abb17 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -11,7 +11,7 @@ #include "skeleton.h" #include "platform.h" - +// --MIAMI: file done static RwBool DefaultVideoMode = TRUE; @@ -371,8 +371,8 @@ RsRwInitialize(void *displayID) psNativeTextureSupport(); + RwTextureSetAutoMipmapping(TRUE); RwTextureSetMipmapping(FALSE); - RwTextureSetAutoMipmapping(FALSE); return TRUE; } @@ -399,7 +399,7 @@ RsInitialize(void) */ RwBool result; - RsGlobal.appName = RWSTRING("GTA3"); + RsGlobal.appName = RWSTRING("GTA: Vice City"); RsGlobal.maximumWidth = DEFAULT_SCREEN_WIDTH; RsGlobal.maximumHeight = DEFAULT_SCREEN_HEIGHT; RsGlobal.width = DEFAULT_SCREEN_WIDTH; diff --git a/src/skel/win/gta3.ico b/src/skel/win/gta3.ico Binary files differdeleted file mode 100644 index 2017c811..00000000 --- a/src/skel/win/gta3.ico +++ /dev/null diff --git a/src/skel/win/gtavc.ico b/src/skel/win/gtavc.ico Binary files differnew file mode 100644 index 00000000..d253ff2c --- /dev/null +++ b/src/skel/win/gtavc.ico diff --git a/src/skel/win/resource.h b/src/skel/win/resource.h index 84dffb95..93f14216 100644 --- a/src/skel/win/resource.h +++ b/src/skel/win/resource.h @@ -8,7 +8,7 @@ #define IDEXIT 1002 #define IDC_SELECTDEVICE 1005 -#define IDI_MAIN_ICON 1042 +#define IDI_MAIN_ICON 100 // Next default values for new objects // #ifdef APSTUDIO_INVOKED diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index ac46d23a..a10a1a92 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -53,6 +53,7 @@ #define MAX_SUBSYSTEMS (16) +// --MIAMI: file done static RwBool ForegroundApp = TRUE; @@ -189,7 +190,7 @@ const char *_psGetUserFilesFolder() &KeycbData) == ERROR_SUCCESS ) { RegCloseKey(hKey); - strcat(szUserFiles, "\\GTA3 User Files"); + strcat(szUserFiles, "\\GTA Vice City User Files"); _psCreateFolder(szUserFiles); return szUserFiles; } @@ -229,7 +230,11 @@ psCameraBeginUpdate(RwCamera *camera) void psCameraShowRaster(RwCamera *camera) { - if (CMenuManager::m_PrefsVsync) +#ifdef LEGACY_MENU_OPTIONS + if (FrontEndMenuManager.m_PrefsVsync || FrontEndMenuManager.m_bMenuActive) +#else + if (FrontEndMenuManager.m_PrefsFrameLimiter || FrontEndMenuManager.m_bMenuActive) +#endif RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPWAITVSYNC); else RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPDONTWAIT); @@ -646,10 +651,6 @@ psInitialize(void) C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); InitialiseLanguage(); -#ifndef GTA3_1_1_PATCH - FrontEndMenuManager.LoadSettings(); -#endif - #endif gGameState = GS_START_UP; @@ -684,7 +685,7 @@ psInitialize(void) } else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) { - if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 ) + if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 ) { debug("Operating System is Win98\n"); _dwOperatingSystemVersion = OS_WIN98; @@ -697,13 +698,9 @@ psInitialize(void) } #ifndef PS2_MENU - -#ifdef GTA3_1_1_PATCH FrontEndMenuManager.LoadSettings(); #endif -#endif - dwDXVersion = GetDXVersion(); debug("DirectX version 0x%x\n", dwDXVersion); @@ -941,8 +938,7 @@ void HandleGraphEvent(void) /* ***************************************************************************** - */ - + */ LRESULT CALLBACK MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) { @@ -1012,10 +1008,17 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) RECT rect; /* redraw window */ +#ifndef MASTER if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER)) { RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE); } +#else + if (RwInitialised && gGameState == GS_PLAYING_GAME) + { + RsEventHandler(rsIDLE, (void *)TRUE); + } +#endif /* Manually resize window */ rect.left = rect.top = 0; @@ -1287,6 +1290,16 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) break; } +#ifdef FIX_BUGS // game turns on menu when focus is re-gained rather than lost + case WM_KILLFOCUS: +#else + case WM_SETFOCUS: +#endif + { + CGame::InitAfterFocusLoss(); + break; + } + } /* @@ -1295,7 +1308,6 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) return DefWindowProc(window, message, wParam, lParam); } - /* ***************************************************************************** */ @@ -1314,7 +1326,7 @@ InitApplication(HANDLE instance) windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = (HINSTANCE)instance; - windowClass.hIcon = nil; + windowClass.hIcon = LoadIcon((HINSTANCE)instance, (LPCSTR)IDI_MAIN_ICON); windowClass.hCursor = LoadCursor(nil, IDC_ARROW); windowClass.hbrBackground = nil; windowClass.lpszMenuName = NULL; @@ -1369,17 +1381,17 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth) #endif if ( mode.Width == width && mode.Height == height && mode.Format == format ) { - if ( mode.RefreshRate == 0 ) + if ( mode.RefreshRate == 0 ) { + d3d->Release(); return 0; + } if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 ) refreshRate = mode.RefreshRate; } } -#ifdef FIX_BUGS d3d->Release(); -#endif if ( refreshRate == -1 ) return -1; @@ -1650,7 +1662,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode) return TRUE; } - /* ***************************************************************************** */ @@ -1761,7 +1772,7 @@ void InitialiseLanguage() || primLayout == LANG_GERMAN ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::germanGame = true; } @@ -1770,7 +1781,7 @@ void InitialiseLanguage() || primLayout == LANG_FRENCH ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::frenchGame = true; } @@ -1781,7 +1792,7 @@ void InitialiseLanguage() #ifdef NASTY_GAME CGame::nastyGame = true; - CMenuManager::m_PrefsAllowNastyGame = true; + FrontEndMenuManager.m_PrefsAllowNastyGame = true; CGame::noProstitutes = false; #endif @@ -1816,33 +1827,33 @@ void InitialiseLanguage() } } - CMenuManager::OS_Language = primUserLCID; + FrontEndMenuManager.OS_Language = primUserLCID; switch ( lang ) { case LANG_GERMAN: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN; break; } case LANG_SPANISH: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH; break; } case LANG_FRENCH: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH; break; } case LANG_ITALIAN: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN; break; } default: { - CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN; + FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN; break; } } @@ -1994,13 +2005,11 @@ WinMain(HINSTANCE instance, RwChar **argv; SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); -#if 0 // TODO: make this an option somewhere AllocConsole(); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); -#endif /* * Initialize the platform independent data. @@ -2056,7 +2065,7 @@ WinMain(HINSTANCE instance, if ( _InputInitialise() == S_OK ) { - _InputInitialiseMouse(); + _InputInitialiseMouse(false); _InputInitialiseJoys(); } @@ -2130,7 +2139,7 @@ WinMain(HINSTANCE instance, { CFileMgr::SetDirMyDocuments(); - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { @@ -2245,6 +2254,8 @@ WinMain(HINSTANCE instance, if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 ) ++gGameState; + else if ( CPad::GetPad(0)->NewState.CheckForInput() ) + ++gGameState; else if ( CPad::GetPad(0)->GetLeftMouseJustDown() ) ++gGameState; else if ( CPad::GetPad(0)->GetEnterJustDown() ) @@ -2266,7 +2277,7 @@ WinMain(HINSTANCE instance, CoUninitialize(); #endif - if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) + if ( FrontEndMenuManager.OS_Language == LANG_FRENCH || FrontEndMenuManager.OS_Language == LANG_GERMAN ) PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); else PlayMovieInWindow(cmdShow, "movies\\GTAtitles.mpg"); @@ -2282,6 +2293,8 @@ WinMain(HINSTANCE instance, if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 ) ++gGameState; + else if ( CPad::GetPad(0)->NewState.CheckForInput() ) + ++gGameState; else if ( CPad::GetPad(0)->GetLeftMouseJustDown() ) ++gGameState; else if ( CPad::GetPad(0)->GetEnterJustDown() ) @@ -2318,6 +2331,7 @@ WinMain(HINSTANCE instance, printf("Into TheGame!!!\n"); #else LoadingScreen(nil, nil, "loadsc0"); + // LoadingScreen(nil, nil, "loadsc0"); // duplicate #endif if ( !CGame::InitialiseOnceAfterRW() ) RsGlobal.quit = TRUE; @@ -2335,10 +2349,11 @@ WinMain(HINSTANCE instance, case GS_INIT_FRONTEND: { LoadingScreen(nil, nil, "loadsc0"); + // LoadingScreen(nil, nil, "loadsc0"); // duplicate FrontEndMenuManager.m_bGameNotLoaded = true; - CMenuManager::m_bStartUpFrontEndRequested = true; + FrontEndMenuManager.m_bStartUpFrontEndRequested = true; if ( defaultFullscreenRes ) { @@ -2423,7 +2438,7 @@ WinMain(HINSTANCE instance, float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if ( RwInitialised ) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) + if (!FrontEndMenuManager.m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); } break; @@ -2434,7 +2449,7 @@ WinMain(HINSTANCE instance, float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if (RwInitialised) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) + if (!FrontEndMenuManager.m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsANIMVIEWER, (void*)TRUE); } break; @@ -2517,7 +2532,7 @@ WinMain(HINSTANCE instance, else if ( gGameState == GS_ANIMVIEWER ) CAnimViewer::Shutdown(); #endif - + CTimer::Stop(); if ( FrontEndMenuManager.m_bFirstTime == true ) @@ -2602,7 +2617,7 @@ HRESULT _InputInitialise() return S_OK; } -HRESULT _InputInitialiseMouse() +HRESULT _InputInitialiseMouse(bool exclusive) { HRESULT hr; @@ -2620,7 +2635,7 @@ HRESULT _InputInitialiseMouse() if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) ) return hr; - if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ) ) ) + if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), (exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND ) ) ) return hr; // Acquire the newly created device @@ -2908,6 +2923,28 @@ void _InputShutdown() SAFE_RELEASE(PSGLOBAL(dinterface)); } +void _InputShutdownMouse() +{ + if (PSGLOBAL(mouse) == nil) + return; + + PSGLOBAL(mouse)->Unacquire(); + SAFE_RELEASE(PSGLOBAL(mouse)); +} + +bool _InputMouseNeedsExclusive(void) +{ + // FIX: I don't know why R* needed that, but it causes infamous mouse bug on modern systems. + // Probably DirectInput bug, since Acquire() and GetDeviceState() reports everything A-OK. +#ifdef FIX_BUGS + return false; +#endif + RwVideoMode vm; + RwEngineGetVideoModeInfo(&vm, GcurSelVM); + + return vm.flags & rwVIDEOMODEEXCLUSIVE; +} + BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ) { HRESULT hr; @@ -3377,5 +3414,9 @@ int strcasecmp(const char *str1, const char *str2) { return _strcmpi(str1, str2); } +int strncasecmp(const char *str1, const char *str2, size_t len) +{ + return _strnicmp(str1, str2, len); +} #endif #endif diff --git a/src/skel/win/win.rc b/src/skel/win/win.rc index 379c473d..9b5aa305 100644 --- a/src/skel/win/win.rc +++ b/src/skel/win/win.rc @@ -42,6 +42,6 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_MAIN_ICON ICON DISCARDABLE "gta3.ico" +IDI_MAIN_ICON ICON DISCARDABLE "gtavc.ico" /////////////////////////////////////////////////////////////////////////////
\ No newline at end of file |