diff options
Diffstat (limited to 'src/skel')
-rw-r--r-- | src/skel/crossplatform.cpp | 30 | ||||
-rw-r--r-- | src/skel/crossplatform.h | 4 | ||||
-rw-r--r-- | src/skel/glfw/glfw.cpp | 97 | ||||
-rw-r--r-- | src/skel/platform.h | 4 | ||||
-rw-r--r-- | src/skel/skeleton.cpp | 8 | ||||
-rw-r--r-- | src/skel/win/gta3.ico | bin | 161654 -> 0 bytes | |||
-rw-r--r-- | src/skel/win/gtavc.ico | bin | 0 -> 81817 bytes | |||
-rw-r--r-- | src/skel/win/resource.h | 2 | ||||
-rw-r--r-- | src/skel/win/win.cpp | 120 | ||||
-rw-r--r-- | src/skel/win/win.rc | 2 |
10 files changed, 175 insertions, 92 deletions
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index 577983b6..f7016b21 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -32,15 +32,15 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { char *folder = strtok(pathCopy, "*"); char *extension = strtok(NULL, "*"); - // because I remember like strtok might not return NULL for last delimiter - if (extension && extension - folder == strlen(pathname)) - extension = nil; + // because I remember like strtok might not return NULL for last delimiter + if (extension && extension - folder == strlen(pathname)) + extension = nil; // Case-sensitivity and backslashes... - // Will be freed at the bottom - char *realFolder = casepath(folder); + // Will be freed at the bottom + char *realFolder = casepath(folder); if (realFolder) { - folder = realFolder; + folder = realFolder; } strncpy(firstfile->folder, folder, sizeof(firstfile->folder)); @@ -50,8 +50,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { else firstfile->extension[0] = '\0'; - if (realFolder) - free(realFolder); + if (realFolder) + free(realFolder); HANDLE d; if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile)) @@ -279,3 +279,17 @@ char* casepath(char const* path, bool checkPathFirst) return out; } #endif + +#if !defined(_MSC_VER) && !defined(__CWCC__) +char *strdate(char *buf) { + time_t timestamp; + time(×tamp); + tm *localTm = localtime(×tamp); + strftime(buf, 10, "%m/%d/%y", localTm); + return buf; +} + +char *_strdate(char *buf) { + return strdate(buf); +} +#endif diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h index aa90ce5a..f37e64a1 100644 --- a/src/skel/crossplatform.h +++ b/src/skel/crossplatform.h @@ -13,6 +13,10 @@ enum eWinVersion OS_WINXP, }; +#if !defined(_MSC_VER) && !defined(__CWCC__) +char *_strdate(char *buf); +#endif + #ifdef _WIN32 // As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, we only need type definitions so let's include <IntSafe.h>. diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 8d3fc7d7..0928229f 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -159,7 +159,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; } @@ -199,7 +199,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); @@ -402,10 +406,6 @@ psInitialize(void) InitialiseLanguage(); -#if GTA_VERSION < GTA3_PC_11 - FrontEndMenuManager.LoadSettings(); -#endif - #endif gGameState = GS_START_UP; @@ -455,13 +455,9 @@ psInitialize(void) #ifndef PS2_MENU - -#if GTA_VERSION >= GTA3_PC_11 FrontEndMenuManager.LoadSettings(); #endif -#endif - #ifdef _WIN32 MEMORYSTATUS memstats; @@ -485,11 +481,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(); @@ -907,7 +919,7 @@ void _InputInitialiseJoys() free(db); fclose(f); } else - printf("You don't seem to have copied " SDL_GAMEPAD_DB_PATH " file from re3/gamefiles to GTA3 directory. Some gamepads may not be recognized.\n"); + printf("You don't seem to have copied " SDL_GAMEPAD_DB_PATH " file from reVC/gamefiles to GTA: Vice City directory. Some gamepads may not be recognized.\n"); #undef SDL_GAMEPAD_DB_PATH @@ -938,12 +950,33 @@ void _InputInitialiseJoys() } } -long _InputInitialiseMouse() +int lastCursorMode = GLFW_CURSOR_HIDDEN; +long _InputInitialiseMouse(bool exclusive) { - glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + // Disabled = keep cursor centered and hide + lastCursorMode = exclusive ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_HIDDEN; + glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, lastCursorMode); return 0; } +void _InputShutdownMouse() +{ + // Not needed +} + +// Not "needs exclusive" on GLFW, but more like "needs to change mode" +bool _InputMouseNeedsExclusive() +{ + // That was the cause of infamous mouse bug on Win. + + RwVideoMode vm; + RwEngineGetVideoModeInfo(&vm, GcurSelVM); + + // If windowed, free the cursor on menu(where this func. is called and DISABLED-HIDDEN transition is done accordingly) + // If it's fullscreen, be sure that it didn't stuck on HIDDEN. + return !(vm.flags & rwVIDEOMODEEXCLUSIVE) || lastCursorMode == GLFW_CURSOR_HIDDEN; +} + void psPostRWinit(void) { RwVideoMode vm; @@ -961,7 +994,7 @@ void psPostRWinit(void) glfwSetJoystickCallback(joysChangeCB); _InputInitialiseJoys(); - _InputInitialiseMouse(); + _InputInitialiseMouse(false); if(!(vm.flags & rwVIDEOMODEEXCLUSIVE)) glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight); @@ -1140,7 +1173,7 @@ void InitialiseLanguage() || primLayout == LANG_GERMAN ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::germanGame = true; } @@ -1149,7 +1182,7 @@ void InitialiseLanguage() || primLayout == LANG_FRENCH ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::frenchGame = true; } @@ -1160,7 +1193,7 @@ void InitialiseLanguage() #ifdef NASTY_GAME CGame::nastyGame = true; - CMenuManager::m_PrefsAllowNastyGame = true; + FrontEndMenuManager.m_PrefsAllowNastyGame = true; CGame::noProstitutes = false; #endif @@ -1195,33 +1228,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; } } @@ -1923,7 +1956,7 @@ main(int argc, char *argv[]) int connectedPadButtons = ControlsManager.ms_padButtonsInited; #endif - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { @@ -1982,7 +2015,7 @@ main(int argc, char *argv[]) #ifndef MASTER if (gbModelViewer) { - // This is TheModelViewer in LCS, but not compiled on III Mobile. + // This is TheModelViewer in LCS LoadingScreen("Loading the ModelViewer", NULL, GetRandomSplashScreen()); CAnimViewer::Initialise(); CTimer::Update(); @@ -2011,7 +2044,7 @@ main(int argc, char *argv[]) #endif #ifndef MASTER if (gbModelViewer) { - // This is TheModelViewerCore in LCS, but TheModelViewer on other state-machine III-VCs. + // This is TheModelViewerCore in LCS TheModelViewer(); } else #endif @@ -2110,6 +2143,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; @@ -2122,15 +2156,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 ) { @@ -2213,7 +2247,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; @@ -2316,7 +2350,6 @@ main(int argc, char *argv[]) #endif } - #ifndef MASTER if ( gbModelViewer ) CAnimViewer::Shutdown(); @@ -2487,5 +2520,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 7889056b..2bb23460 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -305,8 +305,6 @@ RsRwInitialize(void *displayID) { RwEngineOpenParams openParams; - PUSH_MEMID(MEMID_RENDER); // NB: not popped on failed return - /* * Start RenderWare... */ @@ -371,10 +369,8 @@ RsRwInitialize(void *displayID) psNativeTextureSupport(); + RwTextureSetAutoMipmapping(TRUE); RwTextureSetMipmapping(FALSE); - RwTextureSetAutoMipmapping(FALSE); - - POP_MEMID(); return TRUE; } @@ -401,7 +397,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 d0a47713..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..7bfcc5a5 --- /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 01e56701..f251f58d 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -53,7 +53,6 @@ #define MAX_SUBSYSTEMS (16) - static RwBool ForegroundApp = TRUE; static RwBool RwInitialised = FALSE; @@ -195,7 +194,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; } @@ -235,7 +234,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); @@ -579,6 +582,9 @@ _RETEX: } } +#ifdef __MWERKS__ +#pragma dont_inline on +#endif void _psPrintCpuInfo() { RwUInt32 features = _psGetCpuFeatures(); @@ -593,6 +599,9 @@ void _psPrintCpuInfo() if ( FeaturesEx & 0x80000000 ) debug("with 3DNow"); } +#ifdef __MWERKS__ +#pragma dont_inline off +#endif #endif /* @@ -661,10 +670,6 @@ psInitialize(void) C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); InitialiseLanguage(); -#if GTA_VERSION < GTA3_PC_11 - FrontEndMenuManager.LoadSettings(); -#endif - #endif gGameState = GS_START_UP; @@ -712,13 +717,9 @@ psInitialize(void) } #ifndef PS2_MENU - -#if GTA_VERSION >= GTA3_PC_11 FrontEndMenuManager.LoadSettings(); #endif -#endif - dwDXVersion = GetDXVersion(); debug("DirectX version 0x%x\n", dwDXVersion); @@ -956,8 +957,7 @@ void HandleGraphEvent(void) /* ***************************************************************************** - */ - + */ LRESULT CALLBACK MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) { @@ -1303,6 +1303,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; + } + } /* @@ -1311,7 +1321,6 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) return DefWindowProc(window, message, wParam, lParam); } - /* ***************************************************************************** */ @@ -1330,11 +1339,7 @@ InitApplication(HANDLE instance) windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = (HINSTANCE)instance; -#ifdef FIX_BUGS - windowClass.hIcon = LoadIcon((HINSTANCE)instance, MAKEINTRESOURCE(IDI_MAIN_ICON)); -#else - windowClass.hIcon = nil; -#endif + windowClass.hIcon = LoadIcon((HINSTANCE)instance, (LPCSTR)IDI_MAIN_ICON); windowClass.hCursor = LoadCursor(nil, IDC_ARROW); windowClass.hbrBackground = nil; windowClass.lpszMenuName = NULL; @@ -1390,10 +1395,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth) if ( mode.Width == width && mode.Height == height && mode.Format == format ) { if ( mode.RefreshRate == 0 ) { - // From VC -#ifdef FIX_BUGS d3d->Release(); -#endif return 0; } @@ -1402,10 +1404,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth) } } - // From VC -#ifdef FIX_BUGS d3d->Release(); -#endif if ( refreshRate == -1 ) return -1; @@ -1499,7 +1498,7 @@ psSelectDevice() #ifdef DEFAULT_NATIVE_RESOLUTION GcurSelVM = 1; #else - MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK); + MessageBox(nil, "Cannot find 640x480 video mode", "GTA: Vice City", MB_OK); return FALSE; #endif } @@ -1542,7 +1541,7 @@ psSelectDevice() } if(bestFsMode < 0){ - MessageBox(nil, "Cannot find desired video mode", "GTA3", MB_OK); + MessageBox(nil, "Cannot find desired video mode", "GTA: Vice City", MB_OK); return FALSE; } GcurSelVM = bestFsMode; @@ -1676,7 +1675,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode) return TRUE; } - /* ***************************************************************************** */ @@ -1787,7 +1785,7 @@ void InitialiseLanguage() || primLayout == LANG_GERMAN ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::germanGame = true; } @@ -1796,7 +1794,7 @@ void InitialiseLanguage() || primLayout == LANG_FRENCH ) { CGame::nastyGame = false; - CMenuManager::m_PrefsAllowNastyGame = false; + FrontEndMenuManager.m_PrefsAllowNastyGame = false; CGame::frenchGame = true; } @@ -1807,7 +1805,7 @@ void InitialiseLanguage() #ifdef NASTY_GAME CGame::nastyGame = true; - CMenuManager::m_PrefsAllowNastyGame = true; + FrontEndMenuManager.m_PrefsAllowNastyGame = true; CGame::noProstitutes = false; #endif @@ -1842,33 +1840,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; } } @@ -2088,7 +2086,7 @@ WinMain(HINSTANCE instance, if ( _InputInitialise() == S_OK ) { - _InputInitialiseMouse(); + _InputInitialiseMouse(false); _InputInitialiseJoys(); } @@ -2169,7 +2167,7 @@ WinMain(HINSTANCE instance, int connectedPadButtons = ControlsManager.ms_padButtonsInited; #endif - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { @@ -2209,7 +2207,7 @@ WinMain(HINSTANCE instance, #ifndef MASTER if (gbModelViewer) { - // This is TheModelViewer in LCS, but not compiled on III Mobile. + // This is TheModelViewer in LCS LoadingScreen("Loading the ModelViewer", NULL, GetRandomSplashScreen()); CAnimViewer::Initialise(); CTimer::Update(); @@ -2298,6 +2296,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() ) @@ -2322,7 +2322,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"); @@ -2338,6 +2338,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() ) @@ -2377,6 +2379,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; @@ -2394,10 +2397,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 ) { @@ -2482,7 +2486,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; @@ -2651,7 +2655,7 @@ HRESULT _InputInitialise() return S_OK; } -HRESULT _InputInitialiseMouse() +HRESULT _InputInitialiseMouse(bool exclusive) { HRESULT hr; @@ -2669,7 +2673,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 @@ -2957,6 +2961,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; @@ -3426,5 +3452,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 |