diff --git a/src/android/i_system.c b/src/android/i_system.c index 102bff461..ef10df5b5 100644 --- a/src/android/i_system.c +++ b/src/android/i_system.c @@ -226,10 +226,6 @@ const char *I_LocateWad(void) return "/sdcard/srb2"; } -void I_GetJoystickEvents(void){} - -void I_GetJoystick2Events(void){} - char *I_GetEnv(const char *name) { LOGW("I_GetEnv() called?!"); diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 31eaf0346..4d52ffa70 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -167,6 +167,8 @@ static char returnWadPath[256]; #include "../i_video.h" #include "../i_sound.h" #include "../i_system.h" +#include "../i_time.h" +#include "../i_net.h" #include "../screen.h" //vid.WndParent #include "../d_net.h" #include "../g_game.h" @@ -196,8 +198,6 @@ UINT8 keyboard_started = false; #ifdef HAVE_TERMIOS // TERMIOS console code from Quake3: thank you! -boolean stdin_active = true; - typedef struct { size_t cursor; @@ -699,11 +699,7 @@ void I_JoyScale4(void) */ -void I_ShutdownJoystick(void) -{ -} - -void I_GetJoystickEvents(UINT8 index) +void I_ShutdownJoystick(UINT8 index) { (void)index; } diff --git a/src/dedicated/i_video.c b/src/dedicated/i_video.c index d253a7572..062c459ed 100644 --- a/src/dedicated/i_video.c +++ b/src/dedicated/i_video.c @@ -129,6 +129,13 @@ INT32 VID_SetMode(INT32 modeNum) return true; } +boolean I_CheckAboveDesktopRes(INT32 width, INT32 height) +{ + (void)width; + (void)height; + return false; +} + void I_StartupGraphics(void) { } diff --git a/src/i_system.h b/src/i_system.h index 7084c655f..97dfae9a1 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -29,6 +29,10 @@ extern "C" { */ #define MAX_QUIT_FUNCS 16 +void I_GetConsoleEvents(void); + +extern boolean consolevent; +extern boolean framebuffer; /** \brief Graphic system had started up */ diff --git a/src/i_video.h b/src/i_video.h index 62b874992..d4bb659ee 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -127,8 +127,6 @@ boolean I_CheckNativeRes(void); void I_SetBorderlessWindow(void); -void I_HandleControllerHatRepeat(void); - #ifdef USE_FBO_OGL void RefreshOGLSDLSurface(void); @@ -137,6 +135,15 @@ boolean UseScreenFBO(void); extern boolean downsample; #endif +// So we can call this from i_video event loop +void I_ShutdownJoystick(UINT8 index); + +// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination +void I_UpdateJoystickDeviceIndex(UINT8 player); +void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer); + +void I_HandleControllerHatRepeat(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 354eb0427..36859ef54 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -213,14 +213,12 @@ static char returnWadPath[256]; #include "../byteptr.h" #endif -SDL_bool consolevent = SDL_FALSE; -SDL_bool framebuffer = SDL_FALSE; +boolean consolevent = false; +boolean framebuffer = false; UINT8 keyboard_started = false; #ifdef HAVE_TERMIOS // TERMIOS console code from Quake3: thank you! -SDL_bool stdin_active = SDL_TRUE; - typedef struct { size_t cursor; @@ -282,7 +280,7 @@ static void I_ShutdownConsole(void) if (consolevent) { I_OutputMsg("Shutdown tty console\n"); - consolevent = SDL_FALSE; + consolevent = false; tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc); } } @@ -301,7 +299,7 @@ static void I_StartupConsole(void) framebuffer = static_cast( M_CheckParm("-framebuffer")); if (framebuffer) - consolevent = SDL_FALSE; + consolevent = false; if (!consolevent) return; @@ -309,7 +307,7 @@ static void I_StartupConsole(void) if (isatty(STDIN_FILENO)!=1) { I_OutputMsg("stdin is not a tty, tty console mode failed\n"); - consolevent = SDL_FALSE; + consolevent = false; return; } @@ -511,7 +509,7 @@ static void I_StartupConsole(void) if (gotConsole) { SetConsoleTitleA("SRB2Kart Console"); - consolevent = SDL_TRUE; + consolevent = true; } //Let get the real console HANDLE, because Mingw's Bash is bad! @@ -544,7 +542,7 @@ static inline void I_StartupConsole(void) framebuffer = M_CheckParm("-framebuffer"); if (framebuffer) - consolevent = SDL_FALSE; + consolevent = false; } static inline void I_ShutdownConsole(void){} #endif @@ -765,7 +763,7 @@ void I_JoyScale4(void) } // Cheat to get the device index for a joystick handle -INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev) +static INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev) { SDL_Joystick *joystick = NULL; diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index a323c2424..1dcf028fb 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -157,9 +157,12 @@ static SDL_bool usesdl2soft = SDL_FALSE; static SDL_bool borderlesswindow = SDL_FALSE; // SDL2 vars -SDL_Window *window = NULL; -SDL_Renderer *renderer = NULL; +static SDL_Window *window = NULL; +static SDL_Renderer *renderer = NULL; static SDL_Texture *texture = NULL; +#ifdef HWRENDER +static SDL_GLContext sdlglcontext = NULL; +#endif static SDL_bool havefocus = SDL_TRUE; static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); @@ -1411,7 +1414,7 @@ void I_FinishUpdate(void) #ifdef HWRENDER if (rendermode == render_opengl) { - OglSdlFinishUpdate(); + OglSdlFinishUpdate(window); return; } #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 529b47399..272e48a1b 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -461,7 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = Z_Malloc(len, PU_SOUND, 0); + mem = Z_Malloc(len, PU_SOUND, NULL); gme_play(emu, len >> 1, mem); gme_free_info(info); @@ -499,7 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = Z_Malloc(len, PU_SOUND, 0); + mem = Z_Malloc(len, PU_SOUND, NULL); gme_play(emu, len >> 1, mem); gme_free_info(info); diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 9e51efdc4..d50cdbe93 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -72,7 +72,6 @@ boolean UseScreenFBO(void) /** \brief SDL video display surface */ INT32 oglflags = 0; -SDL_GLContext sdlglcontext = NULL; void *GetGLFunc(const char *proc) { @@ -221,7 +220,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) \return void */ -void OglSdlFinishUpdate(void) +void OglSdlFinishUpdate(SDL_Window *window) { int sdlw, sdlh; diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h index 8dd2b9e0e..9bdebc715 100644 --- a/src/sdl/ogl_sdl.h +++ b/src/sdl/ogl_sdl.h @@ -20,11 +20,9 @@ boolean OglSdlSurface(INT32 w, INT32 h); -void OglSdlFinishUpdate(void); +void OglSdlFinishUpdate(SDL_Window *window); boolean VID_LoadOGLAPI(void); -extern SDL_Renderer *renderer; -extern SDL_GLContext sdlglcontext; extern Uint16 realwidth; extern Uint16 realheight; diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index c711d68d7..e5bdca395 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -23,9 +23,6 @@ extern "C" { #endif -extern SDL_bool consolevent; -extern SDL_bool framebuffer; - #include "../m_fixed.h" // SDL2 stub macro @@ -67,21 +64,6 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS #define SDL_JDEADZONE 153 #undef SDL_JDEADZONE -// So we can call this from i_video event loop -void I_ShutdownJoystick(UINT8 index); - -// Cheat to get the device index for a game controller handle -INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev); - -// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination -void I_UpdateJoystickDeviceIndex(UINT8 player); -void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer); - -void I_GetConsoleEvents(void); - -// Needed for some WIN32 functions -extern SDL_Window *window; - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/w_wad.cpp b/src/w_wad.cpp index b911f74bd..e849ad7db 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -2012,13 +2012,15 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag) rspr = static_cast(W_GetCachedRotPatchPwad(WADFILENUM(num), LUMPNUM(num))); if (rspr == NULL) - return W_CachePatchNum(W_GetNumForName("MISSING"), tag); + return W_CachePatchNum(num, tag); if (rspr->patches[idx] == NULL) { INT32 xpivot = 0, ypivot = 0; ptr = static_cast(W_CachePatchNum(num, PU_PATCH)); + if (ptr == NULL) + return W_CachePatchNum(num, tag); // >y pivot centered // >x pivot not centered