diff --git a/src/d_main.cpp b/src/d_main.cpp index 47a04a4a04..d4b9e01edd 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2439,6 +2439,17 @@ void D_DoomMain (void) allwads.ShrinkToFit(); SetMapxxFlag(); + if (!restart) + { + if (!batchrun) Printf("I_Init: Setting up machine state.\n"); + I_Init(); + if (!batchrun) Printf("V_Init: allocate screen.\n"); + V_InitScreenSize(); + + // This allocates a dummy framebuffer as a stand-in until V_Init2 is called. + V_InitScreen(); + } + GameConfig->DoKeySetup(gameinfo.ConfigName); // Now that wads are loaded, define mod-specific cvars. @@ -2462,27 +2473,9 @@ void D_DoomMain (void) CT_Init (); - if (!restart) - { - if (!batchrun) Printf ("I_Init: Setting up machine state.\n"); - I_Init (); - } - // [RH] Initialize palette management InitPalette (); - if (!batchrun) Printf ("V_Init: allocate screen.\n"); - if (!restart) - { - V_InitScreenSize(); - } - - if (!restart) - { - // This allocates a dummy framebuffer as a stand-in until V_Init2 is called. - V_InitScreen (); - } - if (restart) { // Update screen palette when restarting diff --git a/src/rendering/v_video.cpp b/src/rendering/v_video.cpp index bcda5920d0..2aa835dc9b 100644 --- a/src/rendering/v_video.cpp +++ b/src/rendering/v_video.cpp @@ -538,17 +538,6 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real bool IVideo::SetResolution () { - DFrameBuffer *buff = CreateFrameBuffer(); - - if (buff == NULL) // this cannot really happen - { - return false; - } - - screen = buff; - screen->InitializeState(); - screen->SetGamma(); - V_UpdateModeSize(screen->GetWidth(), screen->GetHeight()); return true; @@ -597,27 +586,25 @@ void V_InitScreenSize () void V_InitScreen() { - screen = new DDummyFrameBuffer (vid_defwidth, vid_defheight); + I_InitGraphics(); + screen = Video->CreateFrameBuffer(); + if (screen == nullptr) + { + I_FatalError("Unable to create frame buffer"); + } + screen->InitializeState(); + screen->SetGamma(); + + } void V_Init2() { - float gamma = static_cast(screen)->Gamma; - - { - DFrameBuffer *s = screen; - screen = NULL; - delete s; - } - UCVarValue val; val.Bool = !!Args->CheckParm("-devparm"); ticker.SetGenericRepDefault(val, CVAR_Bool); - - I_InitGraphics(); - Video->SetResolution(); // this only fails via exceptions. Printf ("Resolution: %d x %d\n", SCREENWIDTH, SCREENHEIGHT); @@ -629,6 +616,7 @@ void V_Init2() FBaseCVar::ResetColors (); C_NewModeAdjust(); setsizeneeded = true; + setmodeneeded = true; } void V_Shutdown() diff --git a/src/win32/base_sysfb.cpp b/src/win32/base_sysfb.cpp index 53384cf2b1..ad09283afe 100644 --- a/src/win32/base_sysfb.cpp +++ b/src/win32/base_sysfb.cpp @@ -353,7 +353,7 @@ SystemBaseFrameBuffer::SystemBaseFrameBuffer(void *hMonitor, bool fullscreen) : { m_Monitor = hMonitor; m_displayDeviceName = 0; - PositionWindow(fullscreen, true); + //PositionWindow(fullscreen, true); HDC hDC = GetDC(Window); diff --git a/src/win32/win32glvideo.cpp b/src/win32/win32glvideo.cpp index e283c700c1..7233f4428d 100644 --- a/src/win32/win32glvideo.cpp +++ b/src/win32/win32glvideo.cpp @@ -97,7 +97,7 @@ DFrameBuffer *Win32GLVideo::CreateFrameBuffer() { SystemGLFrameBuffer *fb; - fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, fullscreen); + fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, false); return fb; }