AAAAAAAAAAAAAAAAAAAAAAAA

This commit is contained in:
ZakatTeamI2P 2026-03-30 21:13:57 +04:00
parent f7ab2765aa
commit b4703792c1
9 changed files with 35 additions and 34 deletions

View file

@ -79,7 +79,7 @@ struct AudioStream
bool noResumeStop; bool noResumeStop;
ALStream stream; ALStream stream;
SDL_mutex *streamMut; SDL_Mutex *streamMut;
/* Fade out */ /* Fade out */
struct struct

View file

@ -243,7 +243,7 @@ struct BitmapOpenHandler : FileSystem::OpenHandler
bool tryRead(SDL_IOStream &ops, const char *ext) 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; return surf != 0;
} }
}; };
@ -278,7 +278,7 @@ Bitmap::Bitmap(const char *filename)
} }
catch (const Exception &e) catch (const Exception &e)
{ {
SDL_FreeSurface(imgSurf); SDL_DestroySurface(imgSurf);
throw e; throw e;
} }
@ -1013,9 +1013,9 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
SDL_Surface *txtSurf; SDL_Surface *txtSurf;
if (shState->rtData().config.solidFonts) if (shState->rtData().config.solidFonts)
txtSurf = TTF_RenderUTF8_Solid(font, str, c); txtSurf = TTF_RenderText_Solid(font, str, c);
else else
txtSurf = TTF_RenderUTF8_Blended(font, str, c); txtSurf = TTF_RenderText_Blended(font, str, c);
p->ensureFormat(txtSurf, SDL_PIXELFORMAT_ABGR8888); 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 */ /* set the next font render to render the outline */
TTF_SetFontOutline(font, OUTLINE_SIZE); TTF_SetFontOutline(font, OUTLINE_SIZE);
if (shState->rtData().config.solidFonts) if (shState->rtData().config.solidFonts)
outline = TTF_RenderUTF8_Solid(font, str, co); outline = TTF_RenderText_Solid(font, str, co);
else else
outline = TTF_RenderUTF8_Blended(font, str, co); outline = TTF_RenderText_Blended(font, str, co);
p->ensureFormat(outline, SDL_PIXELFORMAT_ABGR8888); p->ensureFormat(outline, SDL_PIXELFORMAT_ABGR8888);
SDL_Rect outRect = {OUTLINE_SIZE, OUTLINE_SIZE, txtSurf->w, txtSurf->h}; 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, /* If we have no intersection at all,
* there's nothing to upload to begin with */ * there's nothing to upload to begin with */
if (SDL_IntersectRect(&btmRect, &txtRect, &inters)) if (SDL_GetRectIntersection(&btmRect, &txtRect, &inters))
{ {
bool subImage = false; bool subImage = false;
int subSrcX = 0, subSrcY = 0; int subSrcX = 0, subSrcY = 0;
@ -1259,7 +1259,7 @@ IntRect Bitmap::textSize(const char *str)
str = fixed.c_str(); str = fixed.c_str();
int w, h; int w, h;
TTF_SizeUTF8(font, str, &w, &h); TTF_GetStringSize(font, str, &w, &h);
/* If str is one character long, *endPtr == 0 */ /* If str is one character long, *endPtr == 0 */
const char *endPtr; const char *endPtr;

View file

@ -23,7 +23,7 @@
#include <SDL3/SDL_events.h> #include <SDL3/SDL_events.h>
#include <SDL3/SDL_joystick.h> #include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_gamecontroller.h> #include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_messagebox.h> #include <SDL3/SDL_messagebox.h>
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
#include <SDL3/SDL_thread.h> #include <SDL3/SDL_thread.h>
@ -216,7 +216,7 @@ void EventThread::process(RGSSThreadData &rtData)
case SDL_EVENT_FINGER_DOWN : case SDL_EVENT_FINGER_DOWN :
case SDL_EVENT_FINGER_UP : case SDL_EVENT_FINGER_UP :
case SDL_EVENT_FINGER_MOTION : case SDL_EVENT_FINGER_MOTION :
if (event.tfinger.fingerId >= MAX_FINGERS) if (event.tfinger.fingerID >= MAX_FINGERS)
continue; continue;
break; break;
} }
@ -634,7 +634,7 @@ void EventThread::updateCursorState(bool inWindow, const SDL_Rect &screen){
void EventThread::requestTerminate() void EventThread::requestTerminate()
{ {
SDL_Event event; SDL_Event event;
event.type = SDL_QUIT; event.type = SDL_EVENT_QUIT;
SDL_PushEvent(&event); SDL_PushEvent(&event);
} }
@ -794,7 +794,7 @@ void SyncPoint::passSecondarySync()
SyncPoint::Util::Util() SyncPoint::Util::Util()
{ {
mut = SDL_CreateMutex(); mut = SDL_CreateMutex();
cond = SDL_CreateCond(); cond = SDL_CreateCondition();
} }
SyncPoint::Util::~Util() SyncPoint::Util::~Util()

View file

@ -184,7 +184,7 @@ struct UnidirMessage
} }
private: private:
SDL_mutex *mutex; SDL_Mutex *mutex;
mutable AtomicFlag changed; mutable AtomicFlag changed;
T current; T current;
}; };
@ -213,8 +213,8 @@ private:
void waitForUnlock(); void waitForUnlock();
AtomicFlag locked; AtomicFlag locked;
SDL_mutex *mut; SDL_Mutex *mut;
SDL_cond *cond; SDL_Condition *cond;
}; };
Util mainSync; Util mainSync;

View file

@ -143,12 +143,12 @@ static PHYSFS_Io *createSDLRWIo(const char *filename)
return io; return io;
} }
static inline PHYSFS_File *sdlPHYS(SDL_RWops *ops) static inline PHYSFS_File *sdlPHYS(SDL_IOStream *ops)
{ {
return static_cast<PHYSFS_File*>(ops->hidden.unknown.data1); return static_cast<PHYSFS_File*>(ops->hidden.unknown.data1);
} }
static Sint64 SDL_RWopsSize(SDL_RWops *ops) static Sint64 SDL_RWopsSize(SDL_IOStream *ops)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -227,7 +227,7 @@ static int SDL_RWopsCloseFree(SDL_IOStream *ops)
{ {
int result = SDL_RWopsClose(ops); int result = SDL_RWopsClose(ops);
SDL_FreeRW(ops); SDL_CloseIO(ops);
return result; return result;
} }

View file

@ -22,7 +22,7 @@
#ifndef FILESYSTEM_H #ifndef FILESYSTEM_H
#define FILESYSTEM_H #define FILESYSTEM_H
#include <SDL_IOStream.h> #include <SDL3/SDL_iostream.h>
struct FileSystemPrivate; struct FileSystemPrivate;
class SharedFontState; class SharedFontState;

View file

@ -91,7 +91,7 @@ SharedFontState::~SharedFontState()
void SharedFontState::initFontSetCB(SDL_IOStream &ops, void SharedFontState::initFontSetCB(SDL_IOStream &ops,
const std::string &filename) const std::string &filename)
{ {
TTF_Font *font = TTF_OpenFontRW(&ops, 0, 0); TTF_Font *font = TTF_OpenFontIO(&ops, 0, 0);
if (!font) if (!font)
return; return;
@ -150,7 +150,7 @@ _TTF_Font *SharedFontState::getFont(std::string family,
shState->fileSystem().openReadRaw(*ops, path, true); shState->fileSystem().openReadRaw(*ops, path, true);
} }
font = TTF_OpenFontRW(ops, 1, size); font = TTF_OpenFontIO(ops, 1, size);
if (!font) if (!font)
throw Exception(Exception::SDLError, "%s", SDL_GetError()); throw Exception(Exception::SDLError, "%s", SDL_GetError());

View file

@ -134,7 +134,7 @@ int rgssThreadFun(void *userdata)
if (!alcCtx) if (!alcCtx)
{ {
rgssThreadError(threadData, "Error creating OpenAL context"); rgssThreadError(threadData, "Error creating OpenAL context");
SDL_GL_DeleteContext(glCtx); SDL_GL_DestroyContext(glCtx);
return 0; 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_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "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) #if defined(__linux__) && SDL_VERSION_ATLEAST(2, 0, 8)
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
#endif #endif

View file

@ -3,7 +3,7 @@
#include <SDL3/SDL_atomic.h> #include <SDL3/SDL_atomic.h>
#include <SDL3/SDL_thread.h> #include <SDL3/SDL_thread.h>
#include <SDL3/SDL_IOStream.h> #include <SDL3/SDL_iostream.h>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -17,26 +17,26 @@ struct AtomicFlag
AtomicFlag(bool value) AtomicFlag(bool value)
{ {
SDL_AtomicSet(&atom, value ? 1 : 0); SDL_SetAtomicInt(&atom, value ? 1 : 0);
} }
void set() void set()
{ {
SDL_AtomicSet(&atom, 1); SDL_SetAtomicInt(&atom, 1);
} }
void clear() void clear()
{ {
SDL_AtomicSet(&atom, 0); SDL_SetAtomicInt(&atom, 0);
} }
operator bool() const operator bool() const
{ {
return SDL_AtomicGet(&atom); return SDL_GetAtomicInt(&atom);
} }
private: private:
mutable SDL_atomic_t atom; mutable SDL_AtomicInt atom;
}; };
template<class C, void (C::*func)()> template<class C, void (C::*func)()>
@ -91,7 +91,7 @@ template<size_t bufSize = 248, size_t pbSize = 8>
class SDLRWBuf : public std::streambuf class SDLRWBuf : public std::streambuf
{ {
public: public:
SDLRWBuf(SDL_RWops *ops) SDLRWBuf(SDL_IOStream *ops)
: ops(ops) : ops(ops)
{ {
char *end = buf + bufSize + pbSize; char *end = buf + bufSize + pbSize;
@ -115,8 +115,8 @@ private:
memmove(base, egptr() - pbSize, pbSize); memmove(base, egptr() - pbSize, pbSize);
start += pbSize; start += pbSize;
} }
//size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size);
size_t n = SDL_ReadIO(ops, start, 1, bufSize - (start - base)); size_t n = SDL_ReadIO(ops, start, bufSize - (start - base));
if (n == 0) if (n == 0)
return traits_type::eof(); return traits_type::eof();
@ -156,7 +156,7 @@ public:
} }
private: private:
SDL_CloseIO *ops; SDL_IOStream *ops;
SDLRWBuf<> buf; SDLRWBuf<> buf;
std::istream s; std::istream s;
}; };