summaryrefslogtreecommitdiffstats
path: root/src/skel
diff options
context:
space:
mode:
Diffstat (limited to 'src/skel')
-rw-r--r--src/skel/crossplatform.cpp40
-rw-r--r--src/skel/glfw/glfw.cpp31
-rw-r--r--src/skel/skeleton.cpp4
-rw-r--r--src/skel/win/resource.h2
-rw-r--r--src/skel/win/win.cpp37
5 files changed, 67 insertions, 47 deletions
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp
index 452ad9fa..4b7d3d9a 100644
--- a/src/skel/crossplatform.cpp
+++ b/src/skel/crossplatform.cpp
@@ -26,19 +26,35 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
// Compatible with Linux/POSIX and MinGW on Windows
#ifndef _WIN32
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
- char newpathname[32];
- strncpy(newpathname, pathname, 32);
- char* path = strtok(newpathname, "\\*");
- strncpy(firstfile->folder, path, sizeof(firstfile->folder));
-
- // Both w/ extension and w/o extension is ok
- if (strlen(path) + 2 != strlen(pathname))
- strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
+ char pathCopy[MAX_PATH];
+ strcpy(pathCopy, pathname);
+
+ char *folder = strtok(pathCopy, "*");
+ char *extension = strtok(NULL, "*");
+
+ // because strtok doesn't return NULL for last delimiter
+ if (extension - folder == strlen(pathname))
+ extension = nil;
+
+ // Case-sensitivity and backslashes...
+ // Will be freed at the bottom
+ char *realFolder = casepath(folder);
+ if (realFolder) {
+ folder = realFolder;
+ }
+
+ strncpy(firstfile->folder, folder, sizeof(firstfile->folder));
+
+ if (extension)
+ strncpy(firstfile->extension, extension, sizeof(firstfile->extension));
else
- strncpy(firstfile->extension, "", sizeof(firstfile->extension));
+ firstfile->extension[0] = '\0';
+
+ if (realFolder)
+ free(realFolder);
HANDLE d;
- if ((d = (HANDLE)opendir(path)) == NULL || !FindNextFile(d, firstfile))
+ if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile))
return NULL;
return d;
@@ -52,8 +68,8 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
while ((file = readdir((DIR*)d)) != NULL) {
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
- if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG) &&
- (extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
+ if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
+ (extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
realpath(relativepath, path);
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index 08e5c021..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;
}
@@ -386,10 +387,6 @@ psInitialize(void)
InitialiseLanguage();
-#ifndef GTA3_1_1_PATCH
- FrontEndMenuManager.LoadSettings();
-#endif
-
#endif
gGameState = GS_START_UP;
@@ -422,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;
@@ -439,13 +436,9 @@ psInitialize(void)
#ifndef PS2_MENU
-
-#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
-#endif
-
#ifdef _WIN32
MEMORYSTATUS memstats;
@@ -867,7 +860,8 @@ bool IsThisJoystickBlacklisted(int i)
const char* joyname = glfwGetJoystickName(i);
- if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
+ if (gSelectedJoystickName[0] != '\0' &&
+ strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
return false;
return true;
@@ -1250,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);
+ RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
}
+#else
+ if (RwInitialised && gGameState == GS_PLAYING_GAME)
+ {
+ RsEventHandler(rsIDLE, (void *)TRUE);
+ }
+#endif
if (RwInitialised && height > 0 && width > 0) {
RwRect r;
@@ -1765,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;
@@ -1781,6 +1779,7 @@ main(int argc, char *argv[])
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
+ // LoadingScreen(nil, nil, "loadsc0"); // duplicate
FrontEndMenuManager.m_bGameNotLoaded = true;
diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp
index 99f44fed..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;
}
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 1d1037af..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;
}
@@ -650,10 +651,6 @@ psInitialize(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage();
-#ifndef GTA3_1_1_PATCH
- FrontEndMenuManager.LoadSettings();
-#endif
-
#endif
gGameState = GS_START_UP;
@@ -688,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;
@@ -701,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);
@@ -945,8 +938,7 @@ void HandleGraphEvent(void)
/*
*****************************************************************************
- */
-
+ */
LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -1016,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;
@@ -1327,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;
@@ -1382,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;
@@ -2255,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() )
@@ -2292,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() )
@@ -2328,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;
@@ -2345,6 +2349,7 @@ WinMain(HINSTANCE instance,
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
+ // LoadingScreen(nil, nil, "loadsc0"); // duplicate
FrontEndMenuManager.m_bGameNotLoaded = true;