diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 6e25fe1e0..4190246d5 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -465,6 +465,7 @@ int main(int argc, char *argv[]) #endif if (initsystem()) Bexit(9); + SDL_StartTextInput(); r = GameMain(); @@ -1886,7 +1887,7 @@ int32_t handleevents_pollsdl(void) { if (GUICapture & 1) { - event_t event; + event_t event = {}; event.type = EV_GUI_Event; event.subtype = ev.type == SDL_KEYDOWN ? EV_GUI_KeyDown : EV_GUI_KeyUp; SDL_Keymod kmod = SDL_GetModState(); diff --git a/source/common/console/c_console.cpp b/source/common/console/c_console.cpp index 4f1563dd3..f7cfb6369 100644 --- a/source/common/console/c_console.cpp +++ b/source/common/console/c_console.cpp @@ -1060,6 +1060,10 @@ void C_Ticker() lasttic = consoletic; NotifyStrings.Tick(); + if (GUICapture & 1) + { + D_ProcessEvents(); + } } void FNotifyBuffer::Tick() diff --git a/source/common/console/d_event.cpp b/source/common/console/d_event.cpp index 3eadb47bb..7cc5ffee4 100644 --- a/source/common/console/d_event.cpp +++ b/source/common/console/d_event.cpp @@ -22,6 +22,7 @@ #include "c_bind.h" #include "d_event.h" +#include "c_console.h" #include "d_gui.h" #include "inputstate.h" @@ -146,9 +147,9 @@ void D_ProcessEvents (void) continue; if (ev->type == EV_DeviceChange) (void)0;//UpdateJoystickMenu(I_UpdateDeviceList()); -#if 0 if (C_Responder (ev)) continue; // console ate the event +#if 0 if (M_Responder (ev)) continue; // menu ate the event #endif diff --git a/source/glbackend/gl_hwtexture.cpp b/source/glbackend/gl_hwtexture.cpp index 5504d463d..65d6ff3e3 100644 --- a/source/glbackend/gl_hwtexture.cpp +++ b/source/glbackend/gl_hwtexture.cpp @@ -37,12 +37,20 @@ #include "glad/glad.h" #include "glbackend.h" #include "bitmap.h" +#include "c_dispatch.h" +#include "printf.h" //#include "compat.h" // Workaround to avoid including the dirty 'compat.h' header. This will hopefully not be needed anymore once the texture format uses something better. # define B_LITTLE_ENDIAN 1 # define B_BIG_ENDIAN 0 +uint64_t alltexturesize; + +CCMD(alltexturesize) +{ + Printf("All textures are %llu bytes\n", alltexturesize); +} //=========================================================================== @@ -54,6 +62,7 @@ unsigned int FHardwareTexture::CreateTexture(int w, int h, int type, bool mipmapped) { static int gltypes[] = { GL_R8, GL_RGBA8, GL_RGB5_A1, GL_RGBA2 }; + static uint8_t bytes[] = { 1, 4, 2, 1 }; glTexID = GLInterface.GetTextureID(); glActiveTexture(GL_TEXTURE15); glBindTexture(GL_TEXTURE_2D, glTexID); @@ -65,6 +74,18 @@ unsigned int FHardwareTexture::CreateTexture(int w, int h, int type, bool mipmap mWidth = w; mHeight = h; + allocated = w * h; + if (mipmapped) + { + + for (auto mip = allocated>>2; mip > 0; mip >>= 2) + { + allocated += mip; + } + } + allocated *= bytes[type]; + alltexturesize += allocated; + glTexStorage2D(GL_TEXTURE_2D, mipmapped? bits : 1, gltypes[type], w, h); glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0); @@ -122,6 +143,7 @@ unsigned int FHardwareTexture::LoadTexturePart(const unsigned char* buffer, int //=========================================================================== FHardwareTexture::~FHardwareTexture() { + alltexturesize -= allocated; if (glTexID != 0) glDeleteTextures(1, &glTexID); } diff --git a/source/glbackend/gl_hwtexture.h b/source/glbackend/gl_hwtexture.h index 917661701..a4c9be5a5 100644 --- a/source/glbackend/gl_hwtexture.h +++ b/source/glbackend/gl_hwtexture.h @@ -26,6 +26,7 @@ private: bool mipmapped = true; int mWidth = 0, mHeight = 0; int colorId = 0; + uint32_t allocated = 0; public: