mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
AAAAAAAAAAAAAAAAAAAAAAAA
This commit is contained in:
parent
f7ab2765aa
commit
b4703792c1
9 changed files with 35 additions and 34 deletions
|
|
@ -79,7 +79,7 @@ struct AudioStream
|
|||
bool noResumeStop;
|
||||
|
||||
ALStream stream;
|
||||
SDL_mutex *streamMut;
|
||||
SDL_Mutex *streamMut;
|
||||
|
||||
/* Fade out */
|
||||
struct
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_gamecontroller.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_messagebox.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <SDL3/SDL_thread.h>
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<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);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ static int SDL_RWopsCloseFree(SDL_IOStream *ops)
|
|||
{
|
||||
int result = SDL_RWopsClose(ops);
|
||||
|
||||
SDL_FreeRW(ops);
|
||||
SDL_CloseIO(ops);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef FILESYSTEM_H
|
||||
#define FILESYSTEM_H
|
||||
|
||||
#include <SDL_IOStream.h>
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
|
||||
struct FileSystemPrivate;
|
||||
class SharedFontState;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <SDL3/SDL_atomic.h>
|
||||
#include <SDL3/SDL_thread.h>
|
||||
#include <SDL3/SDL_IOStream.h>
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
|
@ -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<class C, void (C::*func)()>
|
||||
|
|
@ -91,7 +91,7 @@ template<size_t bufSize = 248, size_t pbSize = 8>
|
|||
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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue