From b4703792c12fa280ed6553345c8a5a25e8df93e6 Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Mon, 30 Mar 2026 21:13:57 +0400 Subject: [PATCH] AAAAAAAAAAAAAAAAAAAAAAAA --- src/audiostream.h | 2 +- src/bitmap.cpp | 16 ++++++++-------- src/eventthread.cpp | 8 ++++---- src/eventthread.h | 6 +++--- src/filesystem.cpp | 6 +++--- src/filesystem.h | 2 +- src/font.cpp | 4 ++-- src/main.cpp | 5 +++-- src/sdl-util.h | 20 ++++++++++---------- 9 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/audiostream.h b/src/audiostream.h index 3f234a0..010a814 100644 --- a/src/audiostream.h +++ b/src/audiostream.h @@ -79,7 +79,7 @@ struct AudioStream bool noResumeStop; ALStream stream; - SDL_mutex *streamMut; + SDL_Mutex *streamMut; /* Fade out */ struct diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 876c6b1..05b8bb1 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -243,7 +243,7 @@ struct BitmapOpenHandler : FileSystem::OpenHandler bool tryRead(SDL_IOStream &ops, const char *ext) { - surf = IMG_LoadTyped_RW(&ops, 1, ext); + surf = IMG_LoadTyped_IO(&ops, 1, ext); return surf != 0; } }; @@ -278,7 +278,7 @@ Bitmap::Bitmap(const char *filename) } catch (const Exception &e) { - SDL_FreeSurface(imgSurf); + SDL_DestroySurface(imgSurf); throw e; } @@ -1013,9 +1013,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) SDL_Surface *txtSurf; if (shState->rtData().config.solidFonts) - txtSurf = TTF_RenderUTF8_Solid(font, str, c); + txtSurf = TTF_RenderText_Solid(font, str, c); else - txtSurf = TTF_RenderUTF8_Blended(font, str, c); + txtSurf = TTF_RenderText_Blended(font, str, c); p->ensureFormat(txtSurf, SDL_PIXELFORMAT_ABGR8888); @@ -1034,9 +1034,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) /* set the next font render to render the outline */ TTF_SetFontOutline(font, OUTLINE_SIZE); if (shState->rtData().config.solidFonts) - outline = TTF_RenderUTF8_Solid(font, str, co); + outline = TTF_RenderText_Solid(font, str, co); else - outline = TTF_RenderUTF8_Blended(font, str, co); + outline = TTF_RenderText_Blended(font, str, co); p->ensureFormat(outline, SDL_PIXELFORMAT_ABGR8888); SDL_Rect outRect = {OUTLINE_SIZE, OUTLINE_SIZE, txtSurf->w, txtSurf->h}; @@ -1107,7 +1107,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align) /* If we have no intersection at all, * there's nothing to upload to begin with */ - if (SDL_IntersectRect(&btmRect, &txtRect, &inters)) + if (SDL_GetRectIntersection(&btmRect, &txtRect, &inters)) { bool subImage = false; int subSrcX = 0, subSrcY = 0; @@ -1259,7 +1259,7 @@ IntRect Bitmap::textSize(const char *str) str = fixed.c_str(); int w, h; - TTF_SizeUTF8(font, str, &w, &h); + TTF_GetStringSize(font, str, &w, &h); /* If str is one character long, *endPtr == 0 */ const char *endPtr; diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 622c3a1..21b2bed 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -216,7 +216,7 @@ void EventThread::process(RGSSThreadData &rtData) case SDL_EVENT_FINGER_DOWN : case SDL_EVENT_FINGER_UP : case SDL_EVENT_FINGER_MOTION : - if (event.tfinger.fingerId >= MAX_FINGERS) + if (event.tfinger.fingerID >= MAX_FINGERS) continue; break; } @@ -634,7 +634,7 @@ void EventThread::updateCursorState(bool inWindow, const SDL_Rect &screen){ void EventThread::requestTerminate() { SDL_Event event; - event.type = SDL_QUIT; + event.type = SDL_EVENT_QUIT; SDL_PushEvent(&event); } @@ -794,7 +794,7 @@ void SyncPoint::passSecondarySync() SyncPoint::Util::Util() { mut = SDL_CreateMutex(); - cond = SDL_CreateCond(); + cond = SDL_CreateCondition(); } SyncPoint::Util::~Util() diff --git a/src/eventthread.h b/src/eventthread.h index f6d666e..00ec239 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -184,7 +184,7 @@ struct UnidirMessage } private: - SDL_mutex *mutex; + SDL_Mutex *mutex; mutable AtomicFlag changed; T current; }; @@ -213,8 +213,8 @@ private: void waitForUnlock(); AtomicFlag locked; - SDL_mutex *mut; - SDL_cond *cond; + SDL_Mutex *mut; + SDL_Condition *cond; }; Util mainSync; diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 4d562db..3786ccd 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -143,12 +143,12 @@ static PHYSFS_Io *createSDLRWIo(const char *filename) return io; } -static inline PHYSFS_File *sdlPHYS(SDL_RWops *ops) +static inline PHYSFS_File *sdlPHYS(SDL_IOStream *ops) { return static_cast(ops->hidden.unknown.data1); } -static Sint64 SDL_RWopsSize(SDL_RWops *ops) +static Sint64 SDL_RWopsSize(SDL_IOStream *ops) { PHYSFS_File *f = sdlPHYS(ops); @@ -227,7 +227,7 @@ static int SDL_RWopsCloseFree(SDL_IOStream *ops) { int result = SDL_RWopsClose(ops); - SDL_FreeRW(ops); + SDL_CloseIO(ops); return result; } diff --git a/src/filesystem.h b/src/filesystem.h index 09d182c..74ba2ae 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -22,7 +22,7 @@ #ifndef FILESYSTEM_H #define FILESYSTEM_H -#include +#include struct FileSystemPrivate; class SharedFontState; diff --git a/src/font.cpp b/src/font.cpp index b1cc869..853c7f1 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -91,7 +91,7 @@ SharedFontState::~SharedFontState() void SharedFontState::initFontSetCB(SDL_IOStream &ops, const std::string &filename) { - TTF_Font *font = TTF_OpenFontRW(&ops, 0, 0); + TTF_Font *font = TTF_OpenFontIO(&ops, 0, 0); if (!font) return; @@ -150,7 +150,7 @@ _TTF_Font *SharedFontState::getFont(std::string family, shState->fileSystem().openReadRaw(*ops, path, true); } - font = TTF_OpenFontRW(ops, 1, size); + font = TTF_OpenFontIO(ops, 1, size); if (!font) throw Exception(Exception::SDLError, "%s", SDL_GetError()); diff --git a/src/main.cpp b/src/main.cpp index 7c2e129..60628fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -134,7 +134,7 @@ int rgssThreadFun(void *userdata) if (!alcCtx) { rgssThreadError(threadData, "Error creating OpenAL context"); - SDL_GL_DeleteContext(glCtx); + SDL_GL_DestroyContext(glCtx); return 0; } @@ -238,7 +238,8 @@ int main(int argc, char *argv[]) { SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); - SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1"); + //deleted from SDL3 + //SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1"); #if defined(__linux__) && SDL_VERSION_ATLEAST(2, 0, 8) SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); #endif diff --git a/src/sdl-util.h b/src/sdl-util.h index b6c6ea1..1893836 100644 --- a/src/sdl-util.h +++ b/src/sdl-util.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -17,26 +17,26 @@ struct AtomicFlag AtomicFlag(bool value) { - SDL_AtomicSet(&atom, value ? 1 : 0); + SDL_SetAtomicInt(&atom, value ? 1 : 0); } void set() { - SDL_AtomicSet(&atom, 1); + SDL_SetAtomicInt(&atom, 1); } void clear() { - SDL_AtomicSet(&atom, 0); + SDL_SetAtomicInt(&atom, 0); } operator bool() const { - return SDL_AtomicGet(&atom); + return SDL_GetAtomicInt(&atom); } private: - mutable SDL_atomic_t atom; + mutable SDL_AtomicInt atom; }; template @@ -91,7 +91,7 @@ template class SDLRWBuf : public std::streambuf { public: - SDLRWBuf(SDL_RWops *ops) + SDLRWBuf(SDL_IOStream *ops) : ops(ops) { char *end = buf + bufSize + pbSize; @@ -115,8 +115,8 @@ private: memmove(base, egptr() - pbSize, pbSize); start += pbSize; } - - size_t n = SDL_ReadIO(ops, start, 1, bufSize - (start - base)); + //size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size); + size_t n = SDL_ReadIO(ops, start, bufSize - (start - base)); if (n == 0) return traits_type::eof(); @@ -156,7 +156,7 @@ public: } private: - SDL_CloseIO *ops; + SDL_IOStream *ops; SDLRWBuf<> buf; std::istream s; };