From ab939e059b4263fec4e26425bce6a12ecf88d2e6 Mon Sep 17 00:00:00 2001 From: erorcun Date: Wed, 27 Jan 2021 18:26:08 +0300 Subject: Clean up POSIX streaming code --- src/skel/glfw/glfw.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 431697dc..aab78c6d 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1271,10 +1271,11 @@ void terminateHandler(int sig, siginfo_t *info, void *ucontext) { RsGlobal.quit = TRUE; } +#ifdef FLUSHABLE_STREAMING void dummyHandler(int sig){ // Don't kill the app pls } - +#endif #endif void resizeCB(GLFWwindow* window, int width, int height) { @@ -1528,11 +1529,13 @@ main(int argc, char *argv[]) act.sa_sigaction = terminateHandler; act.sa_flags = SA_SIGINFO; sigaction(SIGTERM, &act, NULL); +#ifdef FLUSHABLE_STREAMING struct sigaction sa; sigemptyset(&sa.sa_mask); sa.sa_handler = dummyHandler; sa.sa_flags = 0; - sigaction(SIGUSR1, &sa, NULL); // Needed for CdStreamPosix + sigaction(SIGUSR1, &sa, NULL); +#endif #endif /* -- cgit v1.2.3 From a216bb56ee5877ec21ac22fdf1f7ffcb2fccde87 Mon Sep 17 00:00:00 2001 From: erorcun Date: Wed, 27 Jan 2021 18:26:48 +0300 Subject: Attempt to fix input delays on GLFW --- src/skel/glfw/glfw.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index aab78c6d..97a77827 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1448,7 +1448,7 @@ bool rshiftStatus = false; void keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods) { - if (key >= 0 && key <= GLFW_KEY_LAST) { + if (key >= 0 && key <= GLFW_KEY_LAST && action != GLFW_REPEAT) { RsKeyCodes ks = (RsKeyCodes)keymap[key]; if (key == GLFW_KEY_LEFT_SHIFT) @@ -1459,7 +1459,6 @@ keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods) if (action == GLFW_RELEASE) RsKeyboardEventHandler(rsKEYUP, &ks); else if (action == GLFW_PRESS) RsKeyboardEventHandler(rsKEYDOWN, &ks); - else if (action == GLFW_REPEAT) RsKeyboardEventHandler(rsKEYDOWN, &ks); } } -- cgit v1.2.3 From 810bad9fd8cf344f7d73b82f042910a4c443b0f7 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 29 Jan 2021 01:44:33 +0300 Subject: Fix some UBs --- src/skel/crossplatform.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/skel') diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index 37c94cb4..68df6704 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -32,8 +32,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) { char *folder = strtok(pathCopy, "*"); char *extension = strtok(NULL, "*"); - // because strtok doesn't return NULL for last delimiter - if (extension - folder == strlen(pathname)) + // because I remember like strtok might not return NULL for last delimiter + if (extension && extension - folder == strlen(pathname)) extension = nil; // Case-sensitivity and backslashes... @@ -187,7 +187,7 @@ char* casepath(char const* path, bool checkPathFirst) rl = 1; } - bool cantProceed = false; // just convert slashes in what's left in string, not case sensitivity + bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't) bool mayBeTrailingSlash = false; char* c; while (c = strsep(&p, "/\\")) @@ -251,7 +251,7 @@ char* casepath(char const* path, bool checkPathFirst) } if (rl > l + 2) { - printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%d chars)\n\tCorrected: %s (%d chars)\n\n", path, l, out, rl); + printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%zu chars)\n\tCorrected: %s (%zu chars)\n\n", path, l, out, rl); } return out; } -- cgit v1.2.3 From 675aef29cf85f956052a150792d4d56f91ff692c Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 5 Feb 2021 17:51:57 +0300 Subject: Detect joystick menu for XInput --- src/skel/crossplatform.h | 2 +- src/skel/glfw/glfw.cpp | 8 ++++---- src/skel/win/win.cpp | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/skel') diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h index 009b17c7..6ea5b11e 100644 --- a/src/skel/crossplatform.h +++ b/src/skel/crossplatform.h @@ -75,7 +75,7 @@ void CapturePad(RwInt32 padID); void joysChangeCB(int jid, int event); #endif -#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS +#ifdef DETECT_JOYSTICK_MENU extern char gSelectedJoystickName[128]; #endif diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 97a77827..8fe1d93f 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -80,7 +80,7 @@ static psGlobalType PsGlobal; size_t _dwMemAvailPhys; RwUInt32 gGameState; -#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS +#ifdef DETECT_JOYSTICK_MENU char gSelectedJoystickName[128] = ""; #endif @@ -852,7 +852,7 @@ void joysChangeCB(int jid, int event); bool IsThisJoystickBlacklisted(int i) { -#ifndef DONT_TRUST_RECOGNIZED_JOYSTICKS +#ifndef DETECT_JOYSTICK_MENU return false; #else if (glfwJoystickIsGamepad(i)) @@ -917,7 +917,7 @@ void _InputInitialiseJoys() if (PSGLOBAL(joy1id) != -1) { int count; glfwGetJoystickButtons(PSGLOBAL(joy1id), &count); -#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS +#ifdef DETECT_JOYSTICK_MENU strcpy(gSelectedJoystickName, glfwGetJoystickName(PSGLOBAL(joy1id))); #endif ControlsManager.InitDefaultControlConfigJoyPad(count); @@ -2182,7 +2182,7 @@ void joysChangeCB(int jid, int event) if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) { if (PSGLOBAL(joy1id) == -1) { PSGLOBAL(joy1id) = jid; -#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS +#ifdef DETECT_JOYSTICK_MENU strcpy(gSelectedJoystickName, glfwGetJoystickName(jid)); #endif // This is behind LOAD_INI_SETTINGS, because otherwise the Init call below will destroy/overwrite your bindings. diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 397e88c4..6ed02011 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -120,6 +120,10 @@ DWORD _dwOperatingSystemVersion; RwUInt32 gGameState; CJoySticks AllValidWinJoys; +#ifdef DETECT_JOYSTICK_MENU +char gSelectedJoystickName[128] = ""; +#endif + // What is that for anyway? #ifndef IMPROVED_VIDEOMODE static RwBool defaultFullscreenRes = TRUE; -- cgit v1.2.3 From 879838c9f20d9f166353d4dd5ea486dda6f91921 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 12 Feb 2021 00:29:09 +0100 Subject: enable screenshots with F12 --- src/skel/glfw/glfw.cpp | 1 + src/skel/win/win.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 8fe1d93f..db9d101a 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -207,6 +207,7 @@ psGrabScreen(RwCamera *pCamera) } #else rw::Image *image = RwCameraGetRaster(pCamera)->toImage(); + image->removeMask(); if(image) return image; #endif diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 6ed02011..89c901b2 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -262,6 +262,7 @@ psGrabScreen(RwCamera *pCamera) } #else rw::Image *image = RwCameraGetRaster(pCamera)->toImage(); + image->removeMask(); if(image) return image; #endif -- cgit v1.2.3 From 333530e260cddef8c9135446d210090ff70d5b3b Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 13 Feb 2021 14:54:51 +0100 Subject: new icon --- src/skel/win/gtavc.ico | Bin 3262 -> 81817 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'src/skel') diff --git a/src/skel/win/gtavc.ico b/src/skel/win/gtavc.ico index d253ff2c..7bfcc5a5 100644 Binary files a/src/skel/win/gtavc.ico and b/src/skel/win/gtavc.ico differ -- cgit v1.2.3 From e5d51604922c913ba1077ce2b3bc131f3365cc14 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 13 Feb 2021 17:09:12 +0100 Subject: glfw window icon --- src/skel/glfw/glfw.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index db9d101a..ce8da817 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -52,6 +52,11 @@ long _dwOperatingSystemVersion; #define MAX_SUBSYSTEMS (16) +#ifdef _WIN32 +#define GLFW_EXPOSE_NATIVE_WIN32 +#include +#endif + rw::EngineOpenParams openParams; static RwBool ForegroundApp = TRUE; @@ -1592,6 +1597,15 @@ main(int argc, char *argv[]) return 0; } +#ifdef _WIN32 + HWND wnd = glfwGetWin32Window(PSGLOBAL(window)); + + HICON icon = LoadIcon(instance, MAKEINTRESOURCE(IDI_MAIN_ICON)); + + SendMessage(wnd, WM_SETICON, ICON_BIG, (LPARAM)icon); + SendMessage(wnd, WM_SETICON, ICON_SMALL, (LPARAM)icon); +#endif + psPostRWinit(); ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp()); -- cgit v1.2.3 From a76c962aa348479ddb5a4d30472183239ddb9285 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 15 Feb 2021 14:27:35 +0100 Subject: always console for windows Debug builds --- src/skel/glfw/glfw.cpp | 2 ++ src/skel/win/win.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index ce8da817..941a2a7b 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1508,7 +1508,9 @@ WinMain(HINSTANCE instance, SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); #ifndef MASTER +#ifndef DEBUG if (strstr(cmdLine, "-console")) +#endif { AllocConsole(); freopen("CONIN$", "r", stdin); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 89c901b2..5cbc9ba0 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2019,7 +2019,9 @@ WinMain(HINSTANCE instance, SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); #ifndef MASTER +#ifndef DEBUG if (strstr(cmdLine, "-console")) +#endif { AllocConsole(); freopen("CONIN$", "r", stdin); -- cgit v1.2.3 From a58d76d27dc3f9fc8c6de6cf0cbbf9f957391d52 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 15 Feb 2021 14:58:19 +0100 Subject: Revert "always console for windows Debug builds" This reverts commit a76c962aa348479ddb5a4d30472183239ddb9285. --- src/skel/glfw/glfw.cpp | 2 -- src/skel/win/win.cpp | 2 -- 2 files changed, 4 deletions(-) (limited to 'src/skel') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 941a2a7b..ce8da817 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1508,9 +1508,7 @@ WinMain(HINSTANCE instance, SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); #ifndef MASTER -#ifndef DEBUG if (strstr(cmdLine, "-console")) -#endif { AllocConsole(); freopen("CONIN$", "r", stdin); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 5cbc9ba0..89c901b2 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2019,9 +2019,7 @@ WinMain(HINSTANCE instance, SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); #ifndef MASTER -#ifndef DEBUG if (strstr(cmdLine, "-console")) -#endif { AllocConsole(); freopen("CONIN$", "r", stdin); -- cgit v1.2.3