This commit is contained in:
ZakatTeamI2P 2026-03-30 22:27:19 +04:00
parent 5ae9caaf39
commit 7b740a8a1a
7 changed files with 39 additions and 39 deletions

View File

@ -31,7 +31,7 @@
static void static void
fileIntFreeInstance(void *inst) fileIntFreeInstance(void *inst)
{ {
SDL_RWops *ops = static_cast<SDL_RWops*>(inst); SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst);
SDL_RWclose(ops); SDL_RWclose(ops);
SDL_FreeRW(ops); SDL_FreeRW(ops);
@ -42,7 +42,7 @@ DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
static VALUE static VALUE
fileIntForPath(const char *path, bool rubyExc) fileIntForPath(const char *path, bool rubyExc)
{ {
SDL_RWops *ops = SDL_AllocRW(); SDL_IOStream *ops = SDL_AllocRW();
try try
{ {
@ -73,7 +73,7 @@ RB_METHOD(fileIntRead)
int length = -1; int length = -1;
rb_get_args(argc, argv, "i", &length RB_ARG_END); rb_get_args(argc, argv, "i", &length RB_ARG_END);
SDL_RWops *ops = getPrivateData<SDL_RWops>(self); SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
if (length == -1) if (length == -1)
{ {
@ -97,7 +97,7 @@ RB_METHOD(fileIntClose)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
SDL_RWops *ops = getPrivateData<SDL_RWops>(self); SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
SDL_RWclose(ops); SDL_RWclose(ops);
return Qnil; return Qnil;
@ -107,7 +107,7 @@ RB_METHOD(fileIntGetByte)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
SDL_RWops *ops = getPrivateData<SDL_RWops>(self); SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
unsigned char byte; unsigned char byte;
size_t result = SDL_RWread(ops, &byte, 1, 1); size_t result = SDL_RWread(ops, &byte, 1, 1);

View File

@ -57,12 +57,12 @@ struct ALDataSource
virtual bool setPitch(float value) = 0; virtual bool setPitch(float value) = 0;
}; };
ALDataSource *createSDLSource(SDL_RWops &ops, ALDataSource *createSDLSource(SDL_IOStream &ops,
const char *extension, const char *extension,
uint32_t maxBufSize, uint32_t maxBufSize,
bool looped); bool looped);
ALDataSource *createVorbisSource(SDL_RWops &ops, ALDataSource *createVorbisSource(SDL_IOStream &ops,
bool looped); bool looped);
#endif // ALDATASOURCE_H #endif // ALDATASOURCE_H

View File

@ -456,18 +456,18 @@ void EventThread::process(RGSSThreadData &rtData)
break; break;
case SDL_EVENT_FINGER_DOWN : case SDL_EVENT_FINGER_DOWN :
i = event.tfinger.fingerId; i = event.tfinger.fingerID;
touchState.fingers[i].down = true; touchState.fingers[i].down = true;
/* falls through */ /* falls through */
case SDL_EVENT_FINGER_MOTION : case SDL_EVENT_FINGER_MOTION :
i = event.tfinger.fingerId; i = event.tfinger.fingerID;
touchState.fingers[i].x = event.tfinger.x * winW; touchState.fingers[i].x = event.tfinger.x * winW;
touchState.fingers[i].y = event.tfinger.y * winH; touchState.fingers[i].y = event.tfinger.y * winH;
break; break;
case SDL_EVENT_FINGER_UP : case SDL_EVENT_FINGER_UP :
i = event.tfinger.fingerId; i = event.tfinger.fingerID;
memset(&touchState.fingers[i], 0, sizeof(touchState.fingers[0])); memset(&touchState.fingers[i], 0, sizeof(touchState.fingers[0]));
break; break;
@ -801,7 +801,7 @@ SyncPoint::Util::Util()
SyncPoint::Util::~Util() SyncPoint::Util::~Util()
{ {
SDL_DestroyCond(cond); SDL_DestroyCondition(cond);
SDL_DestroyMutex(mut); SDL_DestroyMutex(mut);
} }

View File

@ -148,7 +148,7 @@ 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_IOStream *ops) static Sint64 SDL_IOStreamSize(SDL_IOStream *ops)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -158,7 +158,7 @@ static Sint64 SDL_RWopsSize(SDL_IOStream *ops)
return PHYSFS_fileLength(f); return PHYSFS_fileLength(f);
} }
static Sint64 SDL_RWopsSeek(SDL_IOStream *ops, int64_t offset, int whence) static Sint64 SDL_IOStreamSeek(SDL_IOStream *ops, int64_t offset, int whence)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -186,7 +186,7 @@ static Sint64 SDL_RWopsSeek(SDL_IOStream *ops, int64_t offset, int whence)
return (result != 0) ? PHYSFS_tell(f) : -1; return (result != 0) ? PHYSFS_tell(f) : -1;
} }
static size_t SDL_RWopsRead(SDL_IO_SEEK_END *ops, void *buffer, size_t size, size_t maxnum) static size_t SDL_IOStreamRead(SDL_IO_SEEK_END *ops, void *buffer, size_t size, size_t maxnum)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -198,7 +198,7 @@ static size_t SDL_RWopsRead(SDL_IO_SEEK_END *ops, void *buffer, size_t size, siz
return (result != -1) ? (result / size) : 0; return (result != -1) ? (result / size) : 0;
} }
static size_t SDL_RWopsWrite(SDL_IOStream *ops, const void *buffer, size_t size, size_t num) static size_t SDL_IOStreamWrite(SDL_IOStream *ops, const void *buffer, size_t size, size_t num)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -210,7 +210,7 @@ static size_t SDL_RWopsWrite(SDL_IOStream *ops, const void *buffer, size_t size,
return (result != -1) ? (result / size) : 0; return (result != -1) ? (result / size) : 0;
} }
static int SDL_RWopsClose(SDL_IOStream *ops) static int SDL_IOStreamClose(SDL_IOStream *ops)
{ {
PHYSFS_File *f = sdlPHYS(ops); PHYSFS_File *f = sdlPHYS(ops);
@ -223,9 +223,9 @@ static int SDL_RWopsClose(SDL_IOStream *ops)
return (result != 0) ? 0 : -1; return (result != 0) ? 0 : -1;
} }
static int SDL_RWopsCloseFree(SDL_IOStream *ops) static int SDL_IOStreamCloseFree(SDL_IOStream *ops)
{ {
int result = SDL_RWopsClose(ops); int result = SDL_IOStreamClose(ops);
SDL_CloseIO(ops); SDL_CloseIO(ops);
@ -276,15 +276,15 @@ initReadOps(PHYSFS_File *handle,
SDL_IOStream &ops, SDL_IOStream &ops,
bool freeOnClose) bool freeOnClose)
{ {
ops.size = SDL_RWopsSize; ops.size = SDL_IOStreamSize;
ops.seek = SDL_RWopsSeek; ops.seek = SDL_IOStreamSeek;
ops.read = SDL_RWopsRead; ops.read = SDL_IOStreamRead;
ops.write = SDL_RWopsWrite; ops.write = SDL_IOStreamWrite;
if (freeOnClose) if (freeOnClose)
ops.close = SDL_RWopsCloseFree; ops.close = SDL_IOStreamCloseFree;
else else
ops.close = SDL_RWopsClose; ops.close = SDL_IOStreamClose;
ops.type = SDL_RWOPS_PHYSFS; ops.type = SDL_RWOPS_PHYSFS;
ops.hidden.unknown.data1 = handle; ops.hidden.unknown.data1 = handle;
@ -339,7 +339,7 @@ void FileSystem::addPath(const char *path)
if (!PHYSFS_mount(path, 0, 1)) if (!PHYSFS_mount(path, 0, 1))
{ {
/* If it didn't work, try mounting via a wrapped /* If it didn't work, try mounting via a wrapped
* SDL_RWops */ * SDL_IOStream */
PHYSFS_Io *io = createSDLRWIo(path); PHYSFS_Io *io = createSDLRWIo(path);
if (io) if (io)
@ -648,7 +648,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename)
throw Exception(Exception::NoFileError, "%s", filename); throw Exception(Exception::NoFileError, "%s", filename);
} }
void FileSystem::openReadRaw(SDL_RWops &ops, void FileSystem::openReadRaw(SDL_IOStream &ops,
const char *filename, const char *filename,
bool freeOnClose) bool freeOnClose)
{ {

View File

@ -10,8 +10,8 @@
#include "font.h" #include "font.h"
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_image.h> #include <SDL3_image/SDL_image.h>
#include <SDL3/SDL_ttf.h> #include <SDL3_ttf/SDL_ttf.h>
// OS-Specific code // OS-Specific code
#if defined _WIN32 #if defined _WIN32
@ -68,7 +68,7 @@ struct OneshotPrivate
// Alpha texture data for portions of window obscured by screen edges // Alpha texture data for portions of window obscured by screen edges
int winX, winY; int winX, winY;
SDL_mutex *winMutex; SDL_Mutex *winMutex;
bool winPosChanged; bool winPosChanged;
std::vector<uint8_t> obscuredMap; std::vector<uint8_t> obscuredMap;
bool obscuredCleared; bool obscuredCleared;

View File

@ -57,7 +57,7 @@ SDL_Thread *createSDLThread(C *obj, const std::string &name = std::string())
* on the physical filesystem. This wrapper attempts to open a * on the physical filesystem. This wrapper attempts to open a
* real file first before falling back to the assets folder */ * real file first before falling back to the assets folder */
//static inline //static inline
//SDL_RWops *RWFromFile(const char *filename, //SDL_IOStream *RWFromFile(const char *filename,
// const char *mode) // const char *mode)
//{ //{
// FILE *f = fopen(filename, mode); // FILE *f = fopen(filename, mode);

View File

@ -29,17 +29,17 @@
static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *ops) static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *ops)
{ {
return SDL_RWread(static_cast<SDL_RWops*>(ops), ptr, size, nmemb); return SDL_RWread(static_cast<SDL_IOStream*>(ops), ptr, size, nmemb);
} }
static int vfSeek(void *ops, ogg_int64_t offset, int whence) static int vfSeek(void *ops, ogg_int64_t offset, int whence)
{ {
return SDL_RWseek(static_cast<SDL_RWops*>(ops), offset, whence); return SDL_RWseek(static_cast<SDL_IOStream*>(ops), offset, whence);
} }
static long vfTell(void *ops) static long vfTell(void *ops)
{ {
return SDL_RWtell(static_cast<SDL_RWops*>(ops)); return SDL_RWtell(static_cast<SDL_IOStream*>(ops));
} }
static ov_callbacks OvCallbacks = static ov_callbacks OvCallbacks =
@ -53,7 +53,7 @@ static ov_callbacks OvCallbacks =
struct VorbisSource : ALDataSource struct VorbisSource : ALDataSource
{ {
SDL_RWops &src; SDL_IOStream &src;
OggVorbis_File vf; OggVorbis_File vf;
@ -78,7 +78,7 @@ struct VorbisSource : ALDataSource
std::vector<int16_t> sampleBuf; std::vector<int16_t> sampleBuf;
VorbisSource(SDL_RWops &ops, VorbisSource(SDL_IOStream &ops,
bool looped) bool looped)
: src(ops), : src(ops),
currentFrame(0) currentFrame(0)
@ -87,7 +87,7 @@ struct VorbisSource : ALDataSource
if (error) if (error)
{ {
SDL_RWclose(&src); SDL_CloseIO(&src);
throw Exception(Exception::MKXPError, throw Exception(Exception::MKXPError,
"Vorbisfile: Cannot read ogg file"); "Vorbisfile: Cannot read ogg file");
} }
@ -99,7 +99,7 @@ struct VorbisSource : ALDataSource
if (info.channels > 2) if (info.channels > 2)
{ {
ov_clear(&vf); ov_clear(&vf);
SDL_RWclose(&src); SDL_CloseIO(&src);
throw Exception(Exception::MKXPError, throw Exception(Exception::MKXPError,
"Cannot handle audio with more than 2 channels"); "Cannot handle audio with more than 2 channels");
} }
@ -148,7 +148,7 @@ struct VorbisSource : ALDataSource
~VorbisSource() ~VorbisSource()
{ {
ov_clear(&vf); ov_clear(&vf);
SDL_RWclose(&src); SDL_CloseIO(&src);
} }
int sampleRate() int sampleRate()
@ -282,7 +282,7 @@ struct VorbisSource : ALDataSource
} }
}; };
ALDataSource *createVorbisSource(SDL_RWops &ops, ALDataSource *createVorbisSource(SDL_IOStream &ops,
bool looped) bool looped)
{ {
return new VorbisSource(ops, looped); return new VorbisSource(ops, looped);