mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
efesdg
This commit is contained in:
parent
94b77c141e
commit
78e4b16153
7 changed files with 58 additions and 120 deletions
0
assets/oneshot.desktop
Normal file → Executable file
0
assets/oneshot.desktop
Normal file → Executable file
|
|
@ -155,7 +155,7 @@ class Window_Settings
|
||||||
tr('Frameskip'),
|
tr('Frameskip'),
|
||||||
tr('In-Game Timer'),
|
tr('In-Game Timer'),
|
||||||
tr('Language'),
|
tr('Language'),
|
||||||
tr('Debug mode(DEVS ONLY!)'),
|
tr('Debug mode(!)'),
|
||||||
tr('One Shot Mode(!)'),
|
tr('One Shot Mode(!)'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,20 +35,16 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "sdl-util.h"
|
#include "sdl-util.h"
|
||||||
|
|
||||||
namespace std
|
namespace std{
|
||||||
{
|
std::ostream& operator<<(std::ostream &os, const std::vector<std::string> &vec){
|
||||||
std::ostream& operator<<(std::ostream &os, const std::vector<std::string> &vec)
|
for (auto item : vec){
|
||||||
{
|
|
||||||
for (auto item : vec)
|
|
||||||
{
|
|
||||||
os << item << " ";
|
os << item << " ";
|
||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string prefPath(const char *org, const char *app)
|
static std::string prefPath(const char *org, const char *app){
|
||||||
{
|
|
||||||
const char *path = PHYSFS_getPrefDir(org, app);
|
const char *path = PHYSFS_getPrefDir(org, app);
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
|
|
@ -71,8 +67,7 @@ namespace po = boost::program_options;
|
||||||
Config::Config()
|
Config::Config()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Config::read(int argc, char *argv[])
|
void Config::read(int argc, char *argv[]){
|
||||||
{
|
|
||||||
#define PO_DESC_ALL \
|
#define PO_DESC_ALL \
|
||||||
PO_DESC(debugMode, bool, false) \
|
PO_DESC(debugMode, bool, false) \
|
||||||
PO_DESC(screenMode, bool, false) \
|
PO_DESC(screenMode, bool, false) \
|
||||||
|
|
@ -104,8 +99,7 @@ void Config::read(int argc, char *argv[])
|
||||||
editor.battleTest = false;
|
editor.battleTest = false;
|
||||||
|
|
||||||
/* Read arguments sent from the editor */
|
/* Read arguments sent from the editor */
|
||||||
if (argc > 1)
|
if (argc > 1){
|
||||||
{
|
|
||||||
std::string argv1 = argv[1];
|
std::string argv1 = argv[1];
|
||||||
/* RGSS1 uses "debug", 2 and 3 use "test" */
|
/* RGSS1 uses "debug", 2 and 3 use "test" */
|
||||||
if (argv1 == "debug" || argv1 == "test")
|
if (argv1 == "debug" || argv1 == "test")
|
||||||
|
|
@ -114,8 +108,7 @@ void Config::read(int argc, char *argv[])
|
||||||
editor.battleTest = true;
|
editor.battleTest = true;
|
||||||
|
|
||||||
/* Fix offset */
|
/* Fix offset */
|
||||||
if (editor.debug || editor.battleTest)
|
if (editor.debug || editor.battleTest){
|
||||||
{
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
@ -134,29 +127,24 @@ void Config::read(int argc, char *argv[])
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
|
|
||||||
/* Parse command line options */
|
/* Parse command line options */
|
||||||
try
|
try{
|
||||||
{
|
|
||||||
po::parsed_options cmdPo =
|
po::parsed_options cmdPo =
|
||||||
po::command_line_parser(argc, argv).options(podesc).run();
|
po::command_line_parser(argc, argv).options(podesc).run();
|
||||||
po::store(cmdPo, vm);
|
po::store(cmdPo, vm);
|
||||||
}
|
}
|
||||||
catch (po::error &error)
|
catch (po::error &error){
|
||||||
{
|
|
||||||
Debug() << "Command line:" << error.what();
|
Debug() << "Command line:" << error.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse configuration file */
|
/* Parse configuration file */
|
||||||
SDLRWStream confFile(CONF_FILE, "r");
|
SDLRWStream confFile(CONF_FILE, "r");
|
||||||
|
|
||||||
if (confFile)
|
if (confFile){
|
||||||
{
|
try{
|
||||||
try
|
|
||||||
{
|
|
||||||
po::store(po::parse_config_file(confFile.stream(), podesc, true), vm);
|
po::store(po::parse_config_file(confFile.stream(), podesc, true), vm);
|
||||||
po::notify(vm);
|
po::notify(vm);
|
||||||
}
|
}
|
||||||
catch (po::error &error)
|
catch (po::error &error){
|
||||||
{
|
|
||||||
Debug() << CONF_FILE":" << error.what();
|
Debug() << CONF_FILE":" << error.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,8 +176,7 @@ void Config::read(int argc, char *argv[])
|
||||||
|
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
/* Override fullscreen config if Big Picture */
|
/* Override fullscreen config if Big Picture */
|
||||||
if (const char *env = std::getenv("SteamTenfoot"))
|
if (const char *env = std::getenv("SteamTenfoot")){
|
||||||
{
|
|
||||||
if (!strcmp(env, "1"))
|
if (!strcmp(env, "1"))
|
||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,34 +66,28 @@ struct SDLRWIoContext
|
||||||
|
|
||||||
static PHYSFS_Io *createSDLRWIo(const char *filename);
|
static PHYSFS_Io *createSDLRWIo(const char *filename);
|
||||||
|
|
||||||
static SDL_IOStream *getSDLRWops(PHYSFS_Io *io)
|
static SDL_IOStream *getSDLRWops(PHYSFS_Io *io){
|
||||||
{
|
|
||||||
return static_cast<SDLRWIoContext*>(io->opaque)->ops;
|
return static_cast<SDLRWIoContext*>(io->opaque)->ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64 SDLRWIoRead(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len)
|
static PHYSFS_sint64 SDLRWIoRead(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len){
|
||||||
{
|
|
||||||
// return SDL_ReadIO(getSDLRWops(io), buf, 1, len);
|
// return SDL_ReadIO(getSDLRWops(io), buf, 1, len);
|
||||||
return SDL_ReadIO(getSDLRWops(io), buf, len);
|
return SDL_ReadIO(getSDLRWops(io), buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SDLRWIoSeek(struct PHYSFS_Io *io, PHYSFS_uint64 offset)
|
static int SDLRWIoSeek(struct PHYSFS_Io *io, PHYSFS_uint64 offset){
|
||||||
{
|
|
||||||
return (SDL_SeekIO(getSDLRWops(io), offset, SDL_IOWhence::SDL_IO_SEEK_SET) != -1);
|
return (SDL_SeekIO(getSDLRWops(io), offset, SDL_IOWhence::SDL_IO_SEEK_SET) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64 SDLRWIoTell(struct PHYSFS_Io *io)
|
static PHYSFS_sint64 SDLRWIoTell(struct PHYSFS_Io *io){
|
||||||
{
|
|
||||||
return SDL_SeekIO(getSDLRWops(io), 0, SDL_IOWhence::SDL_IO_SEEK_CUR);
|
return SDL_SeekIO(getSDLRWops(io), 0, SDL_IOWhence::SDL_IO_SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64 SDLRWIoLength(struct PHYSFS_Io *io)
|
static PHYSFS_sint64 SDLRWIoLength(struct PHYSFS_Io *io){
|
||||||
{
|
|
||||||
return SDL_GetIOSize(getSDLRWops(io));
|
return SDL_GetIOSize(getSDLRWops(io));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PHYSFS_Io *SDLRWIoDuplicate(struct PHYSFS_Io *io)
|
static struct PHYSFS_Io *SDLRWIoDuplicate(struct PHYSFS_Io *io){
|
||||||
{
|
|
||||||
SDLRWIoContext *ctx = static_cast<SDLRWIoContext*>(io->opaque);
|
SDLRWIoContext *ctx = static_cast<SDLRWIoContext*>(io->opaque);
|
||||||
int64_t offset = io->tell(io);
|
int64_t offset = io->tell(io);
|
||||||
PHYSFS_Io *dup = createSDLRWIo(ctx->filename.c_str());
|
PHYSFS_Io *dup = createSDLRWIo(ctx->filename.c_str());
|
||||||
|
|
@ -104,14 +98,12 @@ static struct PHYSFS_Io *SDLRWIoDuplicate(struct PHYSFS_Io *io)
|
||||||
return dup;
|
return dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SDLRWIoDestroy(struct PHYSFS_Io *io)
|
static void SDLRWIoDestroy(struct PHYSFS_Io *io){
|
||||||
{
|
|
||||||
delete static_cast<SDLRWIoContext*>(io->opaque);
|
delete static_cast<SDLRWIoContext*>(io->opaque);
|
||||||
delete io;
|
delete io;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_Io SDLRWIoTemplate =
|
static PHYSFS_Io SDLRWIoTemplate ={
|
||||||
{
|
|
||||||
0, 0, /* version, opaque */
|
0, 0, /* version, opaque */
|
||||||
SDLRWIoRead,
|
SDLRWIoRead,
|
||||||
0, /* write */
|
0, /* write */
|
||||||
|
|
@ -123,16 +115,12 @@ static PHYSFS_Io SDLRWIoTemplate =
|
||||||
SDLRWIoDestroy
|
SDLRWIoDestroy
|
||||||
};
|
};
|
||||||
|
|
||||||
static PHYSFS_Io *createSDLRWIo(const char *filename)
|
static PHYSFS_Io *createSDLRWIo(const char *filename){
|
||||||
{
|
|
||||||
SDLRWIoContext *ctx;
|
SDLRWIoContext *ctx;
|
||||||
|
|
||||||
try
|
try{
|
||||||
{
|
|
||||||
ctx = new SDLRWIoContext(filename);
|
ctx = new SDLRWIoContext(filename);
|
||||||
}
|
}catch (const Exception &e){
|
||||||
catch (const Exception &e)
|
|
||||||
{
|
|
||||||
Debug() << "Failed mounting" << filename;
|
Debug() << "Failed mounting" << filename;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -144,13 +132,11 @@ static PHYSFS_Io *createSDLRWIo(const char *filename)
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline PHYSFS_File *sdlPHYS(void *userdata)
|
static inline PHYSFS_File *sdlPHYS(void *userdata){
|
||||||
{
|
|
||||||
return static_cast<PHYSFS_File*>(userdata);
|
return static_cast<PHYSFS_File*>(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Sint64 SDL_RWopsSize(void *userdata)
|
static Sint64 SDL_RWopsSize(void *userdata){
|
||||||
{
|
|
||||||
PHYSFS_File *f = sdlPHYS(userdata);
|
PHYSFS_File *f = sdlPHYS(userdata);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
@ -159,8 +145,7 @@ static Sint64 SDL_RWopsSize(void *userdata)
|
||||||
return PHYSFS_fileLength(f);
|
return PHYSFS_fileLength(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Sint64 SDL_RWopsSeek(void *userdata, Sint64 offset, SDL_IOWhence whence)
|
static Sint64 SDL_RWopsSeek(void *userdata, Sint64 offset, SDL_IOWhence whence){
|
||||||
{
|
|
||||||
PHYSFS_File *f = sdlPHYS(userdata);
|
PHYSFS_File *f = sdlPHYS(userdata);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
@ -187,8 +172,7 @@ static Sint64 SDL_RWopsSeek(void *userdata, Sint64 offset, SDL_IOWhence whence)
|
||||||
return (result != 0) ? PHYSFS_tell(f) : -1;
|
return (result != 0) ? PHYSFS_tell(f) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t SDL_RWopsRead(void *userdata, void *ptr, size_t size, SDL_IOStatus *status)
|
static size_t SDL_RWopsRead(void *userdata, void *ptr, size_t size, SDL_IOStatus *status){
|
||||||
{
|
|
||||||
PHYSFS_File *f = sdlPHYS(userdata);
|
PHYSFS_File *f = sdlPHYS(userdata);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
@ -204,8 +188,7 @@ static size_t SDL_RWopsRead(void *userdata, void *ptr, size_t size, SDL_IOStatus
|
||||||
return (result != -1) ? (result) : 0;
|
return (result != -1) ? (result) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t SDL_RWopsWrite(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status)
|
static size_t SDL_RWopsWrite(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status){
|
||||||
{
|
|
||||||
PHYSFS_File *f = sdlPHYS(userdata);
|
PHYSFS_File *f = sdlPHYS(userdata);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
@ -219,8 +202,7 @@ static size_t SDL_RWopsWrite(void *userdata, const void *ptr, size_t size, SDL_I
|
||||||
return (result != -1) ? (result) : 0;
|
return (result != -1) ? (result) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool SDL_RWopsClose(void *userdata)
|
static bool SDL_RWopsClose(void *userdata){
|
||||||
{
|
|
||||||
PHYSFS_File *f = sdlPHYS(userdata);
|
PHYSFS_File *f = sdlPHYS(userdata);
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
@ -269,13 +251,10 @@ strcpySafe(char *dst, const char *src,
|
||||||
/* Attempt to locate an extension string in a filename.
|
/* Attempt to locate an extension string in a filename.
|
||||||
* Either a pointer into the input string pointing at the
|
* Either a pointer into the input string pointing at the
|
||||||
* extension, or null is returned */
|
* extension, or null is returned */
|
||||||
static const char *
|
static const char *findExt(const char *filename){
|
||||||
findExt(const char *filename)
|
|
||||||
{
|
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (len = strlen(filename); len > 0; --len)
|
for (len = strlen(filename); len > 0; --len){
|
||||||
{
|
|
||||||
if (filename[len] == '/')
|
if (filename[len] == '/')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -310,16 +289,14 @@ initReadOps(PHYSFS_File *handle,
|
||||||
ops = SDL_OpenIO(&iface, handle);
|
ops = SDL_OpenIO(&iface, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void strTolower(std::string &str)
|
static void strTolower(std::string &str){
|
||||||
{
|
|
||||||
for (size_t i = 0; i < str.size(); ++i)
|
for (size_t i = 0; i < str.size(); ++i)
|
||||||
str[i] = tolower(str[i]);
|
str[i] = tolower(str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// const Uint32 SDL_RWOPS_PHYSFS = SDL_RWOPS_UNKNOWN+10;
|
// const Uint32 SDL_RWOPS_PHYSFS = SDL_RWOPS_UNKNOWN+10;
|
||||||
|
|
||||||
struct FileSystemPrivate
|
struct FileSystemPrivate{
|
||||||
{
|
|
||||||
/* Maps: lower case full filepath,
|
/* Maps: lower case full filepath,
|
||||||
* To: mixed case full filepath */
|
* To: mixed case full filepath */
|
||||||
BoostHash<std::string, std::string> pathCache;
|
BoostHash<std::string, std::string> pathCache;
|
||||||
|
|
@ -345,16 +322,14 @@ FileSystem::FileSystem(bool allowSymlinks)
|
||||||
PHYSFS_permitSymbolicLinks(1);
|
PHYSFS_permitSymbolicLinks(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystem::~FileSystem()
|
FileSystem::~FileSystem(){
|
||||||
{
|
|
||||||
delete p;
|
delete p;
|
||||||
|
|
||||||
if (PHYSFS_deinit() == 0)
|
if (PHYSFS_deinit() == 0)
|
||||||
Debug() << "PhyFS failed to deinit.";
|
Debug() << "PhyFS failed to deinit.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::addPath(const char *path)
|
void FileSystem::addPath(const char *path){
|
||||||
{
|
|
||||||
/* Try the normal mount first */
|
/* Try the normal mount first */
|
||||||
if (!PHYSFS_mount(path, 0, 1))
|
if (!PHYSFS_mount(path, 0, 1))
|
||||||
{
|
{
|
||||||
|
|
@ -367,8 +342,7 @@ void FileSystem::addPath(const char *path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CacheEnumData
|
struct CacheEnumData{
|
||||||
{
|
|
||||||
FileSystemPrivate *p;
|
FileSystemPrivate *p;
|
||||||
std::stack<std::vector<std::string>*> fileLists;
|
std::stack<std::vector<std::string>*> fileLists;
|
||||||
|
|
||||||
|
|
@ -393,8 +367,7 @@ struct CacheEnumData
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Converts in-place */
|
/* Converts in-place */
|
||||||
void toNFC(char *inout)
|
void toNFC(char *inout){
|
||||||
{
|
|
||||||
#ifdef OS_OSX
|
#ifdef OS_OSX
|
||||||
size_t srcSize = strlen(inout);
|
size_t srcSize = strlen(inout);
|
||||||
size_t bufSize = sizeof(buf);
|
size_t bufSize = sizeof(buf);
|
||||||
|
|
@ -417,8 +390,7 @@ struct CacheEnumData
|
||||||
};
|
};
|
||||||
|
|
||||||
static PHYSFS_EnumerateCallbackResult
|
static PHYSFS_EnumerateCallbackResult
|
||||||
cacheEnumCB(void *d, const char *origdir, const char *fname)
|
cacheEnumCB(void *d, const char *origdir, const char *fname){
|
||||||
{
|
|
||||||
CacheEnumData &data = *static_cast<CacheEnumData*>(d);
|
CacheEnumData &data = *static_cast<CacheEnumData*>(d);
|
||||||
char fullPath[512];
|
char fullPath[512];
|
||||||
|
|
||||||
|
|
@ -437,8 +409,7 @@ cacheEnumCB(void *d, const char *origdir, const char *fname)
|
||||||
PHYSFS_Stat stat;
|
PHYSFS_Stat stat;
|
||||||
PHYSFS_stat(fullPath, &stat);
|
PHYSFS_stat(fullPath, &stat);
|
||||||
|
|
||||||
if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY)
|
if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY){
|
||||||
{
|
|
||||||
/* Create a new list for this directory */
|
/* Create a new list for this directory */
|
||||||
std::vector<std::string> &list = data.p->fileLists[lowerCase];
|
std::vector<std::string> &list = data.p->fileLists[lowerCase];
|
||||||
|
|
||||||
|
|
@ -446,9 +417,7 @@ cacheEnumCB(void *d, const char *origdir, const char *fname)
|
||||||
data.fileLists.push(&list);
|
data.fileLists.push(&list);
|
||||||
PHYSFS_enumerate(fullPath, cacheEnumCB, d);
|
PHYSFS_enumerate(fullPath, cacheEnumCB, d);
|
||||||
data.fileLists.pop();
|
data.fileLists.pop();
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Get the file list for the directory we're currently
|
/* Get the file list for the directory we're currently
|
||||||
* traversing and append this filename to it */
|
* traversing and append this filename to it */
|
||||||
std::vector<std::string> &list = *data.fileLists.top();
|
std::vector<std::string> &list = *data.fileLists.top();
|
||||||
|
|
@ -463,8 +432,7 @@ cacheEnumCB(void *d, const char *origdir, const char *fname)
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::createPathCache()
|
void FileSystem::createPathCache(){
|
||||||
{
|
|
||||||
CacheEnumData data(p);
|
CacheEnumData data(p);
|
||||||
data.fileLists.push(&p->fileLists[""]);
|
data.fileLists.push(&p->fileLists[""]);
|
||||||
PHYSFS_enumerate("", cacheEnumCB, &data);
|
PHYSFS_enumerate("", cacheEnumCB, &data);
|
||||||
|
|
@ -472,15 +440,13 @@ void FileSystem::createPathCache()
|
||||||
p->havePathCache = true;
|
p->havePathCache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FontSetsCBData
|
struct FontSetsCBData{
|
||||||
{
|
|
||||||
FileSystemPrivate *p;
|
FileSystemPrivate *p;
|
||||||
SharedFontState *sfs;
|
SharedFontState *sfs;
|
||||||
};
|
};
|
||||||
|
|
||||||
static PHYSFS_EnumerateCallbackResult
|
static PHYSFS_EnumerateCallbackResult
|
||||||
fontSetEnumCB (void *data, const char *dir, const char *fname)
|
fontSetEnumCB (void *data, const char *dir, const char *fname){
|
||||||
{
|
|
||||||
FontSetsCBData *d = static_cast<FontSetsCBData*>(data);
|
FontSetsCBData *d = static_cast<FontSetsCBData*>(data);
|
||||||
|
|
||||||
/* Only consider filenames with font extensions */
|
/* Only consider filenames with font extensions */
|
||||||
|
|
@ -516,15 +482,13 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::initFontSets(SharedFontState &sfs)
|
void FileSystem::initFontSets(SharedFontState &sfs){
|
||||||
{
|
|
||||||
FontSetsCBData d = { p, &sfs };
|
FontSetsCBData d = { p, &sfs };
|
||||||
|
|
||||||
PHYSFS_enumerate("Fonts", fontSetEnumCB, &d);
|
PHYSFS_enumerate("Fonts", fontSetEnumCB, &d);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OpenReadEnumData
|
struct OpenReadEnumData{
|
||||||
{
|
|
||||||
FileSystem::OpenHandler &handler;
|
FileSystem::OpenHandler &handler;
|
||||||
SDL_IOStream* ops;
|
SDL_IOStream* ops;
|
||||||
|
|
||||||
|
|
@ -554,8 +518,7 @@ struct OpenReadEnumData
|
||||||
};
|
};
|
||||||
|
|
||||||
static PHYSFS_EnumerateCallbackResult
|
static PHYSFS_EnumerateCallbackResult
|
||||||
openReadEnumCB(void *d, const char *dirpath, const char *filename)
|
openReadEnumCB(void *d, const char *dirpath, const char *filename){
|
||||||
{
|
|
||||||
OpenReadEnumData &data = *static_cast<OpenReadEnumData*>(d);
|
OpenReadEnumData &data = *static_cast<OpenReadEnumData*>(d);
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
const char *fullPath;
|
const char *fullPath;
|
||||||
|
|
@ -567,12 +530,10 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
|
||||||
if (strncmp(filename, data.filename, data.filenameN) != 0)
|
if (strncmp(filename, data.filename, data.filenameN) != 0)
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
|
|
||||||
if (!*dirpath)
|
if (!*dirpath){
|
||||||
{
|
|
||||||
fullPath = filename;
|
fullPath = filename;
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename);
|
snprintf(buffer, sizeof(buffer), "%s/%s", dirpath, filename);
|
||||||
fullPath = buffer;
|
fullPath = buffer;
|
||||||
}
|
}
|
||||||
|
|
@ -592,8 +553,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
|
||||||
|
|
||||||
PHYSFS_File *phys = PHYSFS_openRead(fullPath);
|
PHYSFS_File *phys = PHYSFS_openRead(fullPath);
|
||||||
|
|
||||||
if (!phys)
|
if (!phys){
|
||||||
{
|
|
||||||
/* Failing to open this file here means there must
|
/* Failing to open this file here means there must
|
||||||
* be a deeper rooted problem somewhere within PhysFS.
|
* be a deeper rooted problem somewhere within PhysFS.
|
||||||
* Just abort alltogether. */
|
* Just abort alltogether. */
|
||||||
|
|
@ -614,8 +574,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename)
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::openRead(OpenHandler &handler, const char *filename)
|
void FileSystem::openRead(OpenHandler &handler, const char *filename){
|
||||||
{
|
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
size_t len = strcpySafe(buffer, filename, sizeof(buffer), -1);
|
size_t len = strcpySafe(buffer, filename, sizeof(buffer), -1);
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
@ -634,8 +593,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename)
|
||||||
const char *file = buffer;
|
const char *file = buffer;
|
||||||
const char *dir = "";
|
const char *dir = "";
|
||||||
|
|
||||||
if (!root)
|
if (!root){
|
||||||
{
|
|
||||||
/* Cut the buffer in half so we can use it
|
/* Cut the buffer in half so we can use it
|
||||||
* for both filename and directory path */
|
* for both filename and directory path */
|
||||||
*delim = '\0';
|
*delim = '\0';
|
||||||
|
|
@ -646,17 +604,14 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename)
|
||||||
OpenReadEnumData data(handler, file, len + buffer - delim - !root,
|
OpenReadEnumData data(handler, file, len + buffer - delim - !root,
|
||||||
p->havePathCache ? &p->pathCache : 0);
|
p->havePathCache ? &p->pathCache : 0);
|
||||||
|
|
||||||
if (p->havePathCache)
|
if (p->havePathCache){
|
||||||
{
|
|
||||||
/* Get the list of files contained in this directory
|
/* Get the list of files contained in this directory
|
||||||
* and manually iterate over them */
|
* and manually iterate over them */
|
||||||
const std::vector<std::string> &fileList = p->fileLists[dir];
|
const std::vector<std::string> &fileList = p->fileLists[dir];
|
||||||
|
|
||||||
for (size_t i = 0; i < fileList.size(); ++i)
|
for (size_t i = 0; i < fileList.size(); ++i)
|
||||||
openReadEnumCB(&data, dir, fileList[i].c_str());
|
openReadEnumCB(&data, dir, fileList[i].c_str());
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
PHYSFS_enumerate(dir, openReadEnumCB, &data);
|
PHYSFS_enumerate(dir, openReadEnumCB, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -678,7 +633,6 @@ void FileSystem::openReadRaw(SDL_IOStream* &stream,
|
||||||
initReadOps(handle, stream);
|
initReadOps(handle, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileSystem::exists(const char *filename)
|
bool FileSystem::exists(const char *filename){
|
||||||
{
|
|
||||||
return PHYSFS_exists(filename);
|
return PHYSFS_exists(filename);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -389,8 +389,7 @@ int main(int argc, char *argv[]){
|
||||||
if (rtData.rqTermAck)
|
if (rtData.rqTermAck)
|
||||||
SDL_WaitThread(rgssThread, 0);
|
SDL_WaitThread(rgssThread, 0);
|
||||||
else
|
else
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(),
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot: sunshine will now force quit", win);
|
||||||
"The RGSS script seems to be stuck and OneShot will now force quit", win);
|
|
||||||
|
|
||||||
if (!rtData.rgssErrorMsg.empty()){
|
if (!rtData.rgssErrorMsg.empty()){
|
||||||
Debug() << rtData.rgssErrorMsg;
|
Debug() << rtData.rgssErrorMsg;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <security.h>
|
#include <security.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <SDL2/SDL_syswm.h>
|
|
||||||
#elif defined __APPLE__ || __linux__
|
#elif defined __APPLE__ || __linux__
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -164,8 +163,7 @@ static WCHAR *w32_toWide(const char *str){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Oneshot::Oneshot(RGSSThreadData &threadData) :
|
Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
threadData(threadData)
|
threadData(threadData){
|
||||||
{
|
|
||||||
p = new OneshotPrivate();
|
p = new OneshotPrivate();
|
||||||
p->window = threadData.window;
|
p->window = threadData.window;
|
||||||
p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1);
|
p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1);
|
||||||
|
|
|
||||||
BIN
windows/icon.ico
BIN
windows/icon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 26 KiB |
Loading…
Reference in a new issue