From 8d541597d3193668d3532aa048b17399b58aad1a Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Tue, 31 Mar 2026 00:10:53 +0400 Subject: [PATCH] SAPF{DOGPFOSG --- binding-mri/binding-util.cpp | 3 +-- binding-mri/binding-util.h | 3 +++ binding-mri/filesystem-binding.cpp | 2 +- src/alstream.cpp | 2 +- src/bitmap.cpp | 8 +++----- src/font.cpp | 3 +-- src/gl-meta.cpp | 5 +++-- src/screen.cpp | 12 ++++++------ src/settingsmenu.cpp | 4 +--- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/binding-mri/binding-util.cpp b/binding-mri/binding-util.cpp index 9af7925..4d4fd1f 100644 --- a/binding-mri/binding-util.cpp +++ b/binding-mri/binding-util.cpp @@ -79,8 +79,7 @@ static const RbException excToRbExc[] = MKXP /* MKXPError */ }; -void raiseRbExc(const Exception &exc) -{ +void raiseRbExc(const Exception &exc){ RbData *data = getRbData(); VALUE excClass = data->exc[excToRbExc[exc.type]]; diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index ed8830e..681bf61 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -23,6 +23,9 @@ #define BINDING_UTIL_H #include +//костыль ебаный сука +#undef snprintf + #undef inline #include "exception.h" diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index dcfa7a6..acc18d0 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -40,7 +40,7 @@ DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance); static VALUE fileIntForPath(const char *path, bool rubyExc) { - SDL_IOStream *ops = SDL_OpenIO(); + SDL_IOStream *ops; try { diff --git a/src/alstream.cpp b/src/alstream.cpp index 0f1c95b..80b50fb 100644 --- a/src/alstream.cpp +++ b/src/alstream.cpp @@ -220,7 +220,7 @@ struct ALStreamOpenHandler : FileSystem::OpenHandler /* Try to read ogg file signature */ char sig[5] = { 0 }; - SDL_ReadIO(srcOps, sig, 1, 4); + SDL_ReadIO(srcOps, sig, 4); SDL_SeekIO(srcOps, 0, SDL_IO_SEEK_SET); try diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 133efbf..331d1a4 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -92,7 +92,7 @@ struct BitmapPrivate * getPixel calls. Is invalidated any time the bitmap * is modified */ SDL_Surface *surface; - SDL_PixelFormatDetails *format; + SDL_PixelFormatDetails format; /* The 'tainted' area describes which parts of the * bitmap are not cleared, ie. don't have 0 opacity. @@ -121,9 +121,7 @@ struct BitmapPrivate void allocSurface() { - surface = SDL_CreateRGBSurface(0, gl.width, gl.height, format->BitsPerPixel, - format->Rmask, format->Gmask, - format->Bmask, format->Amask); + surface = SDL_CreateSurface(gl.width, gl.height, format); } void clearTaintedArea() @@ -1259,7 +1257,7 @@ IntRect Bitmap::textSize(const char *str) str = fixed.c_str(); int w, h; - TTF_GetStringSize(font, str, &w, &h); + TTF_SizeText(font, str, &w, &h); /* If str is one character long, *endPtr == 0 */ const char *endPtr; diff --git a/src/font.cpp b/src/font.cpp index 853c7f1..7e30d3b 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -156,8 +156,7 @@ _TTF_Font *SharedFontState::getFont(std::string family, throw Exception(Exception::SDLError, "%s", SDL_GetError()); p->pool.insert(key, font); - - return font; + return (_TTF_Font*)font; } bool SharedFontState::fontPresent(std::string family) const diff --git a/src/gl-meta.cpp b/src/gl-meta.cpp index 97579bf..4b2e09e 100644 --- a/src/gl-meta.cpp +++ b/src/gl-meta.cpp @@ -42,8 +42,9 @@ void subRectImageUpload(GLint srcW, GLint srcX, GLint srcY, } else { - SDL_PixelFormat *form = src->format; - SDL_Surface *tmp = SDL_CreateRGBSurface(0, dstW, dstH, form->BitsPerPixel, + SDL_PixelFormat *form = &src->format + //SDL_PixelFormat *form = src->format; + SDL_Surface *tmp = SDL_CreateSurface(0, dstW, dstH, form->BitsPerPixel, form->Rmask, form->Gmask, form->Bmask, form->Amask); SDL_Rect srcRect = { srcX, srcY, dstW, dstH }; diff --git a/src/screen.cpp b/src/screen.cpp index f30e59c..639b6df 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -48,9 +48,8 @@ int screenMain(Config &conf) //} SDL_Window *win; - win = SDL_CreateShapedWindow("The Journal", - SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - DEFAULT_WIDTH, DEFAULT_HEIGHT, 0); + win = SDL_CreateWindow("The Journal", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOW_RESIZABLE); + //SDL_SetWindowShape(win, ); if (!win) { @@ -62,9 +61,10 @@ int screenMain(Config &conf) shapeMode.mode = ShapeModeColorKey; shapeMode.parameters.colorKey = colorKey; //SDL_Surface *surface = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_INDEX8); - SDL_Surface *shape = SDL_CreateRGBSurface(DEFAULT_WIDTH, DEFAULT_HEIGHT, 0, 0, 0, 0); - // SDL_Palette *palette = SDL_CreateSurfacePalette(surface); - SDL_SetPaletteColors(shape, &black, 0, 1); + //SDL_PIXELFORMAT_UNKNOWN - 0,0,0,0 ....maybe? + SDL_Surface *shape = SDL_CreateSurface(DEFAULT_WIDTH, DEFAULT_HEIGHT, SDL_PIXELFORMAT_UNKNOWN); + SDL_Palette *palette = SDL_CreateSurfacePalette(surface); + SDL_SetPaletteColors(palette, &black, 0, 1); char messageBuf[256]; diff --git a/src/settingsmenu.cpp b/src/settingsmenu.cpp index b5c8d10..154e86c 100644 --- a/src/settingsmenu.cpp +++ b/src/settingsmenu.cpp @@ -395,10 +395,8 @@ struct SettingsMenuPrivate { int bpp; Uint32 rMask, gMask, bMask, aMask; - SDL_GetMasksForPixelFormat(SDL_PIXELFORMAT_ABGR8888, - &bpp, &rMask, &gMask, &bMask, &aMask); //SDL_Surface *surface = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_INDEX8); - return SDL_CreateRGBSurface(w, h, rMask, gMask, bMask, 0); + return SDL_CreateSurface(w, h, SDL_PIXELFORMAT_ABGR8888); } void fillSurface(SDL_Surface *surf, uint8_t grey){