Fix SDL1.2 build and some runtime issues with SDL1.2

This commit is contained in:
Daniel Gibson 2024-06-02 15:36:40 +02:00
parent 7f62e9aa94
commit cb5d988058
3 changed files with 8 additions and 1 deletions

View file

@ -423,7 +423,7 @@ const char *idKeyInput::KeyNumToString( int keynum, bool localized ) {
// check for a key string
for ( kn = keynames; kn->name; kn++ ) {
if ( keynum == kn->keynum ) {
if ( !localized || kn->strId[0] != '#' ) {
if ( !localized || (kn->strId && kn->strId[0] != '#') ) {
return kn->name;
} else {
#if MACOS_X

View file

@ -263,6 +263,7 @@ static void R_CheckCvars( void ) {
if ( r_swapInterval.IsModified() ) {
GLimp_SetSwapInterval( r_swapInterval.GetInteger() );
r_swapInterval.ClearModified();
}
}

View file

@ -405,6 +405,7 @@ try_again:
context = SDL_GL_CreateContext(window);
GLimp_SetSwapInterval( r_swapInterval.GetInteger() );
r_swapInterval.ClearModified();
SDL_GetWindowSize(window, &glConfig.vidWidth, &glConfig.vidHeight);
@ -419,6 +420,8 @@ try_again:
if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, r_swapInterval.GetInteger()) < 0)
common->Warning("SDL_GL_SWAP_CONTROL not supported");
r_swapInterval.ClearModified();
window = SDL_SetVideoMode(parms.width, parms.height, colorbits, flags);
if (!window) {
common->DPrintf("Couldn't set GL mode %d/%d/%d: %s",
@ -576,7 +579,10 @@ try_again:
return false;
}
#if SDL_VERSION_ATLEAST(2, 0, 0)
// SDL1.2 has no context, and is not supported by ImGui anyway
D3::ImGuiHooks::Init(window, context);
#endif
return true;
}