im looks like shit
This commit is contained in:
parent
e8f9220197
commit
e4de91bde2
|
|
@ -323,7 +323,7 @@ static void runCustomScript(const std::string &filename){
|
||||||
|
|
||||||
if (!readFileSDL(filename.c_str(), scriptData)){
|
if (!readFileSDL(filename.c_str(), scriptData)){
|
||||||
snprintf(msg, sizeof msg, "Unable to open %s", filename);
|
snprintf(msg, sizeof msg, "Unable to open %s", filename);
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,11 +342,11 @@ struct BacktraceData{
|
||||||
static void runRMXPScripts(BacktraceData &btData){
|
static void runRMXPScripts(BacktraceData &btData){
|
||||||
const Config &conf = shState->rtData().config;
|
const Config &conf = shState->rtData().config;
|
||||||
const std::string &scriptPack = conf.game.scripts;
|
const std::string &scriptPack = conf.game.scripts;
|
||||||
char msg[512];
|
char msg[1024];
|
||||||
|
|
||||||
if (!shState->fileSystem().exists(scriptPack.c_str())){
|
if (!shState->fileSystem().exists(scriptPack.c_str())){
|
||||||
snprintf(msg, sizeof msg, "Unable to open '%s'", scriptPack.c_str());
|
snprintf(msg, sizeof msg, "Unable to open '%s'", scriptPack.c_str());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,15 +356,14 @@ static void runRMXPScripts(BacktraceData &btData){
|
||||||
* still go wrong */
|
* still go wrong */
|
||||||
try{
|
try{
|
||||||
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||||
printf("[runRMXPScripts] %s\n", scriptPack.c_str());
|
|
||||||
}catch (const Exception &e){
|
}catch (const Exception &e){
|
||||||
snprintf(msg, sizeof msg, "Failed to read script data: %s", e.msg);
|
snprintf(msg, sizeof msg, "Failed to read script data: %s", e.msg);
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
|
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
|
||||||
crash("Failed to read script data");
|
crash("Failed to read script data", Exception::MEOW, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -374,9 +373,6 @@ static void runRMXPScripts(BacktraceData &btData){
|
||||||
rb_gv_set("$RGSS_SCRIPTS", scriptArray);
|
rb_gv_set("$RGSS_SCRIPTS", scriptArray);
|
||||||
|
|
||||||
long scriptCount = RARRAY_LEN(scriptArray);
|
long scriptCount = RARRAY_LEN(scriptArray);
|
||||||
#ifdef DEBUG
|
|
||||||
printf("[runRMXPScripts] Scripts count: %ld\n", scriptCount);
|
|
||||||
#endif
|
|
||||||
std::string decodeBuffer;
|
std::string decodeBuffer;
|
||||||
decodeBuffer.resize(0x1000);
|
decodeBuffer.resize(0x1000);
|
||||||
|
|
||||||
|
|
@ -411,7 +407,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
||||||
if (result != Z_OK){
|
if (result != Z_OK){
|
||||||
static char buffer[256];
|
static char buffer[256];
|
||||||
snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName));
|
snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName));
|
||||||
crash(buffer);
|
crash(buffer, Exception::MEOW, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -510,7 +506,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
|
||||||
|
|
||||||
char ms[640];
|
char ms[640];
|
||||||
snprintf(&ms[0], 640, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
snprintf(&ms[0], 640, "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
|
||||||
crash(ms);
|
crash(ms, Exception::MEOW, false);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
19
oneshot.conf
19
oneshot.conf
|
|
@ -9,12 +9,24 @@
|
||||||
# relative to gameFolder and ignoring both RTPs and
|
# relative to gameFolder and ignoring both RTPs and
|
||||||
# encrypted archives.
|
# encrypted archives.
|
||||||
|
|
||||||
|
# Debug mode
|
||||||
|
# Enable reset on F12 press and other
|
||||||
|
# (default: disabled)
|
||||||
|
#
|
||||||
|
# debugMode=false
|
||||||
|
|
||||||
# Start game in fullscreen mode,
|
# Start game in fullscreen mode,
|
||||||
# i.e. Big Picture/console mode.
|
# i.e. Big Picture/console mode.
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
#
|
#
|
||||||
# fullscreen=false
|
# fullscreen=false
|
||||||
|
|
||||||
|
# screenMode
|
||||||
|
# idk
|
||||||
|
# (default: disabled)
|
||||||
|
# screenMode=false
|
||||||
|
|
||||||
|
|
||||||
# Display current FPS in Window title
|
# Display current FPS in Window title
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
# printFPS=false
|
# printFPS=false
|
||||||
|
|
@ -31,6 +43,13 @@
|
||||||
#
|
#
|
||||||
# EnableSixteenByNine=false
|
# EnableSixteenByNine=false
|
||||||
|
|
||||||
|
# Controlling the resolution of the game window,
|
||||||
|
# it is not recommended to change.
|
||||||
|
# If you want to configure 16:9, use EnableSixteenByNine.
|
||||||
|
#
|
||||||
|
# defScreenW=0
|
||||||
|
# defScreenH=0
|
||||||
|
|
||||||
# Apply linear interpolation when game screen
|
# Apply linear interpolation when game screen
|
||||||
# is upscaled
|
# is upscaled
|
||||||
# (default: disabled)
|
# (default: disabled)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#include <SDL3/SDL_audio.h>
|
#include <SDL3/SDL_audio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include "meow.h"
|
||||||
namespace AL{
|
namespace AL{
|
||||||
|
|
||||||
#define DEF_AL_ID \
|
#define DEF_AL_ID \
|
||||||
|
|
@ -177,6 +177,7 @@ inline uint8_t formatSampleSize(int sdlFormat){
|
||||||
case SDL_AUDIO_S16BE :
|
case SDL_AUDIO_S16BE :
|
||||||
return 2;
|
return 2;
|
||||||
default :
|
default :
|
||||||
|
crash("Unhandled sample format", Exception::MEOW, false);
|
||||||
assert(!"Unhandled sample format");
|
assert(!"Unhandled sample format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,6 +197,7 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount){
|
||||||
case 2 : return AL_FORMAT_STEREO16;
|
case 2 : return AL_FORMAT_STEREO16;
|
||||||
}
|
}
|
||||||
default :
|
default :
|
||||||
|
crash("Unhandled sample size / channel count", Exception::MEOW, false);
|
||||||
assert(!"Unhandled sample size / channel count");
|
assert(!"Unhandled sample size / channel count");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,9 +232,8 @@ void ALStream::openSource(const std::string &filename){
|
||||||
|
|
||||||
if (!source){
|
if (!source){
|
||||||
char buf[512];
|
char buf[512];
|
||||||
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
|
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s", filename.c_str(), handler.errorMsg.c_str());
|
||||||
filename.c_str(), handler.errorMsg.c_str());
|
crash(buf, Exception::MEOW, false);
|
||||||
crash(buf);
|
|
||||||
|
|
||||||
Debug() << buf;
|
Debug() << buf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@
|
||||||
|
|
||||||
#define GUARD_MEGA \
|
#define GUARD_MEGA \
|
||||||
{ \
|
{ \
|
||||||
if (p->megaSurface) \
|
if (p->megaSurface) { \
|
||||||
throw Exception(Exception::MKXPError, \
|
crash("Operation not supported for mega surfaces", Exception::MKXPError, true); \
|
||||||
"Operation not supported for mega surfaces"); \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OUTLINE_SIZE 1
|
#define OUTLINE_SIZE 1
|
||||||
|
|
@ -229,7 +229,7 @@ Bitmap::Bitmap(const char *filename){
|
||||||
|
|
||||||
if (!imgSurf){
|
if (!imgSurf){
|
||||||
snprintf(msg, sizeof msg, "Error loading image '%s': %s", filename, SDL_GetError());
|
snprintf(msg, sizeof msg, "Error loading image '%s': %s", filename, SDL_GetError());
|
||||||
throw Exception(Exception::SDLError, msg);
|
crash(msg, Exception::SDLError, true);
|
||||||
}
|
}
|
||||||
p->ensureFormat(imgSurf, SDL_PIXELFORMAT_ABGR8888);
|
p->ensureFormat(imgSurf, SDL_PIXELFORMAT_ABGR8888);
|
||||||
|
|
||||||
|
|
@ -265,8 +265,7 @@ Bitmap::Bitmap(const char *filename){
|
||||||
|
|
||||||
Bitmap::Bitmap(int width, int height){
|
Bitmap::Bitmap(int width, int height){
|
||||||
if (width <= 0 || height <= 0){
|
if (width <= 0 || height <= 0){
|
||||||
crash("failed to create bitmap");
|
crash("failed to create bitmap", Exception::RGSSError, true);
|
||||||
throw Exception(Exception::RGSSError, "failed to create bitmap");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEXFBO tex = shState->texPool().request(width, height);
|
TEXFBO tex = shState->texPool().request(width, height);
|
||||||
|
|
@ -411,8 +410,7 @@ void Bitmap::stretchBlt(const IntRect &destRect, const Bitmap &source, const Int
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
/* Clipped blit */
|
/* Clipped blit */
|
||||||
GLMeta::subRectImageUpload(blitTemp->w, bltRect.x - dstRect.x, bltRect.y - dstRect.y,
|
GLMeta::subRectImageUpload(blitTemp->w, bltRect.x - dstRect.x, bltRect.y - dstRect.y, bltRect.x, bltRect.y, bltRect.w, bltRect.h, blitTemp, GL_RGBA);
|
||||||
bltRect.x, bltRect.y, bltRect.w, bltRect.h, blitTemp, GL_RGBA);
|
|
||||||
GLMeta::subRectImageEnd();
|
GLMeta::subRectImageEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,12 @@ void Config::read(int argc, char *argv[]){
|
||||||
|
|
||||||
commonDataPath = prefPath(".", "Oneshot");
|
commonDataPath = prefPath(".", "Oneshot");
|
||||||
|
|
||||||
//Hardcode some ini/version settings
|
|
||||||
rgssVersion = 1;
|
rgssVersion = 1;
|
||||||
|
if(windowTitle == "")
|
||||||
game.title = "OneShot: Sunshine";
|
game.title = "OneShot: Sunshine";
|
||||||
game.scripts = "Data/xScripts.rxdata";
|
game.scripts = "Data/xScripts.rxdata";
|
||||||
|
|
||||||
|
if(defScreenW == 0 || defScreenH == 0){
|
||||||
if (EnableSixteenByNine){
|
if (EnableSixteenByNine){
|
||||||
defScreenW = 1280;
|
defScreenW = 1280;
|
||||||
defScreenH = 720;
|
defScreenH = 720;
|
||||||
|
|
@ -180,6 +181,7 @@ void Config::read(int argc, char *argv[]){
|
||||||
defScreenW = 640;
|
defScreenW = 640;
|
||||||
defScreenH = 480;
|
defScreenH = 480;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
/* Override fullscreen config if Big Picture */
|
/* Override fullscreen config if Big Picture */
|
||||||
|
|
|
||||||
18
src/etc.cpp
18
src/etc.cpp
|
|
@ -103,10 +103,8 @@ void Color::serialize(char *buffer) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
Color *Color::deserialize(const char *data, int len){
|
Color *Color::deserialize(const char *data, int len){
|
||||||
if (len != 32){
|
if (len != 32)
|
||||||
crash("Color: Serialized data invalid");
|
crash("Color: Serialized data invalid", Exception::ArgumentError, true);
|
||||||
throw Exception(Exception::ArgumentError, "Color: Serialized data invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
Color *c = new Color();
|
Color *c = new Color();
|
||||||
|
|
||||||
|
|
@ -224,10 +222,8 @@ void Tone::serialize(char *buffer) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
Tone *Tone::deserialize(const char *data, int len){
|
Tone *Tone::deserialize(const char *data, int len){
|
||||||
if (len != 32){
|
if (len != 32)
|
||||||
crash("Tone: Serialized data invalid");
|
crash("Tone: Serialized data invalid", Exception::ArgumentError, true);
|
||||||
throw Exception(Exception::ArgumentError, "Tone: Serialized data invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
Tone *t = new Tone();
|
Tone *t = new Tone();
|
||||||
|
|
||||||
|
|
@ -357,10 +353,8 @@ void Rect::serialize(char *buffer) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect *Rect::deserialize(const char *data, int len){
|
Rect *Rect::deserialize(const char *data, int len){
|
||||||
if (len != 16){
|
if (len != 16)
|
||||||
crash("Rect: Serialized data invalid");
|
crash("Rect: Serialized data invalid", Exception::ArgumentError, true);
|
||||||
throw Exception(Exception::ArgumentError, "Rect: Serialized data invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect *r = new Rect();
|
Rect *r = new Rect();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,7 @@ private:
|
||||||
|
|
||||||
void resetInputStates();
|
void resetInputStates();
|
||||||
void setFullscreen(SDL_Window *, bool mode);
|
void setFullscreen(SDL_Window *, bool mode);
|
||||||
void updateCursorState(bool inWindow,
|
void updateCursorState(bool inWindow, const SDL_Rect &screen);
|
||||||
const SDL_Rect &screen);
|
|
||||||
|
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool showCursor;
|
bool showCursor;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,10 @@ struct Exception{
|
||||||
/* New types introduced in mkxp */
|
/* New types introduced in mkxp */
|
||||||
PHYSFSError,
|
PHYSFSError,
|
||||||
SDLError,
|
SDLError,
|
||||||
MKXPError
|
MKXPError,
|
||||||
|
|
||||||
|
// For crash()
|
||||||
|
MEOW
|
||||||
};
|
};
|
||||||
|
|
||||||
Type type;
|
Type type;
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ struct SDLRWIoContext{
|
||||||
filename(filename)
|
filename(filename)
|
||||||
{
|
{
|
||||||
if (!ops)
|
if (!ops)
|
||||||
crash("Failed to open file");
|
crash("Failed to open file", Exception::SDLError, true);
|
||||||
throw Exception(Exception::SDLError, "Failed to open file: %s", SDL_GetError());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~SDLRWIoContext(){
|
~SDLRWIoContext(){
|
||||||
|
|
@ -70,7 +69,6 @@ static SDL_IOStream *getSDLRWops(PHYSFS_Io *io){
|
||||||
}
|
}
|
||||||
|
|
||||||
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, len);
|
return SDL_ReadIO(getSDLRWops(io), buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,6 +118,7 @@ static PHYSFS_Io *createSDLRWIo(const char *filename){
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
@ -563,6 +562,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename){
|
||||||
|
|
||||||
void FileSystem::openRead(OpenHandler &handler, const char *filename){
|
void FileSystem::openRead(OpenHandler &handler, const char *filename){
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
char msg[512];
|
||||||
size_t len = strcpySafe(buffer, filename, sizeof(buffer), -1);
|
size_t len = strcpySafe(buffer, filename, sizeof(buffer), -1);
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
|
|
@ -588,8 +588,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
|
||||||
dir = buffer;
|
dir = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -602,17 +601,22 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
|
||||||
PHYSFS_enumerate(dir, openReadEnumCB, &data);
|
PHYSFS_enumerate(dir, openReadEnumCB, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.physfsError)
|
if (data.physfsError){
|
||||||
throw Exception(Exception::PHYSFSError, "PhysFS: %s", data.physfsError);
|
snprintf(msg, sizeof msg, "PhysFS: %s", data.physfsError);
|
||||||
|
crash(msg, Exception::PHYSFSError, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.matchCount == 0)
|
if (data.matchCount == 0){
|
||||||
throw Exception(Exception::NoFileError, "%s", filename);
|
snprintf(msg, sizeof msg, "NoFileError: %s", data.physfsError);
|
||||||
|
crash(msg, Exception::NoFileError, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){
|
void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){
|
||||||
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
||||||
if (!handle)
|
if (!handle){
|
||||||
throw Exception(Exception::NoFileError, "%s", filename);
|
throw Exception(Exception::NoFileError, "%s", filename);
|
||||||
|
}
|
||||||
|
|
||||||
initReadOps(handle, stream);
|
initReadOps(handle, stream);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/font.cpp
10
src/font.cpp
|
|
@ -27,6 +27,7 @@
|
||||||
#include "boost-hash.h"
|
#include "boost-hash.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
@ -101,6 +102,7 @@ void SharedFontState::initFontSetCB(SDL_IOStream* &ops, const std::string &filen
|
||||||
}
|
}
|
||||||
|
|
||||||
TTF_Font *SharedFontState::getFont(std::string family, int size){
|
TTF_Font *SharedFontState::getFont(std::string family, int size){
|
||||||
|
char msg[512];
|
||||||
if (family.empty())
|
if (family.empty())
|
||||||
family = "Terminus (TTF)"; // terminus hardcoded :3c
|
family = "Terminus (TTF)"; // terminus hardcoded :3c
|
||||||
|
|
||||||
|
|
@ -126,7 +128,7 @@ TTF_Font *SharedFontState::getFont(std::string family, int size){
|
||||||
SDL_IOStream *ops;
|
SDL_IOStream *ops;
|
||||||
|
|
||||||
if (family.empty()){
|
if (family.empty()){
|
||||||
throw Exception(Exception::RGSSError, "font does not exist");
|
crash("font does not exist", Exception::RGSSError, true);
|
||||||
}else{
|
}else{
|
||||||
/* Use 'other' path as alternative in case
|
/* Use 'other' path as alternative in case
|
||||||
* we have no 'regular' styled font asset */
|
* we have no 'regular' styled font asset */
|
||||||
|
|
@ -140,8 +142,10 @@ TTF_Font *SharedFontState::getFont(std::string family, int size){
|
||||||
|
|
||||||
font = TTF_OpenFontIO(ops, 1, size);
|
font = TTF_OpenFontIO(ops, 1, size);
|
||||||
|
|
||||||
if (!font)
|
if (!font){
|
||||||
throw Exception(Exception::SDLError, "%s", SDL_GetError());
|
snprintf(msg, sizeof msg, "%s", SDL_GetError());
|
||||||
|
crash(msg, Exception::SDLError, true);
|
||||||
|
}
|
||||||
|
|
||||||
p->pool.insert(key, font);
|
p->pool.insert(key, font);
|
||||||
return font;
|
return font;
|
||||||
|
|
|
||||||
41
src/main.cpp
41
src/main.cpp
|
|
@ -89,7 +89,7 @@ int rgssThreadFun(void *userdata){
|
||||||
|
|
||||||
if (!glCtx){
|
if (!glCtx){
|
||||||
snprintf(msg, sizeof msg, "Error creating context: %s", SDL_GetError());
|
snprintf(msg, sizeof msg, "Error creating context: %s", SDL_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
rgssThreadError(threadData, std::string(msg));
|
rgssThreadError(threadData, std::string(msg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +98,7 @@ int rgssThreadFun(void *userdata){
|
||||||
initGLFunctions();
|
initGLFunctions();
|
||||||
}
|
}
|
||||||
catch (const Exception &exc){
|
catch (const Exception &exc){
|
||||||
crash(exc.msg.c_str());
|
crash(exc.msg.c_str(), Exception::MEOW, false);
|
||||||
rgssThreadError(threadData, exc.msg);
|
rgssThreadError(threadData, exc.msg);
|
||||||
SDL_GL_DestroyContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -127,7 +127,7 @@ int rgssThreadFun(void *userdata){
|
||||||
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
|
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
|
||||||
|
|
||||||
if (!alcCtx){
|
if (!alcCtx){
|
||||||
crash("Error creating OpenAL context");
|
crash("Error creating OpenAL context", Exception::MEOW, false);
|
||||||
rgssThreadError(threadData, "Error creating OpenAL context");
|
rgssThreadError(threadData, "Error creating OpenAL context");
|
||||||
SDL_GL_DestroyContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -138,7 +138,7 @@ int rgssThreadFun(void *userdata){
|
||||||
try{
|
try{
|
||||||
SharedState::initInstance(threadData);
|
SharedState::initInstance(threadData);
|
||||||
}catch (const Exception &exc){
|
}catch (const Exception &exc){
|
||||||
crash(exc.msg.c_str());
|
crash(exc.msg.c_str(), Exception::MEOW, false);
|
||||||
rgssThreadError(threadData, exc.msg);
|
rgssThreadError(threadData, exc.msg);
|
||||||
alcDestroyContext(alcCtx);
|
alcDestroyContext(alcCtx);
|
||||||
SDL_GL_DestroyContext(glCtx);
|
SDL_GL_DestroyContext(glCtx);
|
||||||
|
|
@ -194,7 +194,7 @@ static void setGamePathInRegistry() {
|
||||||
long keyCreateError = RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), 0L, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL);
|
long keyCreateError = RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Software\\OneShot\\"), 0L, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL);
|
||||||
|
|
||||||
if (keyCreateError != ERROR_SUCCESS){
|
if (keyCreateError != ERROR_SUCCESS){
|
||||||
crash("Unable to create key in registry.");
|
crash("Unable to create key in registry", Exception::MEOW, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
keyOpenError = ERROR_SUCCESS;
|
keyOpenError = ERROR_SUCCESS;
|
||||||
|
|
@ -202,12 +202,12 @@ static void setGamePathInRegistry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyOpenError != ERROR_SUCCESS){
|
if (keyOpenError != ERROR_SUCCESS){
|
||||||
crash("Unable to open registry.");
|
crash("Unable to open registry.", Exception::MEOW, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char);
|
DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char);
|
||||||
if (RegSetValueEx(key, TEXT("GameDirectory"), 0, REG_SZ, (LPBYTE)dataDir, dataSize) != ERROR_SUCCESS){
|
if (RegSetValueEx(key, TEXT("GameDirectory"), 0, REG_SZ, (LPBYTE)dataDir, dataSize) != ERROR_SUCCESS){
|
||||||
showInitError("Unable to set GameDirectory registry value.");
|
crash("Unable to set GameDirectory registry value", Exception::MEOW, false);
|
||||||
}
|
}
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
}
|
}
|
||||||
|
|
@ -235,19 +235,19 @@ int main(int argc, char *argv[]){
|
||||||
/* initialize SDL first */
|
/* initialize SDL first */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){
|
||||||
snprintf(msg, sizeof msg, "Error initializing SDL: %s", SDL_GetError());
|
snprintf(msg, sizeof msg, "Error initializing SDL: %s", SDL_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
if (!STEAMSHIM_init()){
|
if (!STEAMSHIM_init()){
|
||||||
crash("Could not initialize Steamworks API");
|
crash("Could not initialize Steamworks API", Exception::MEOW, true);
|
||||||
return 0;
|
return 0
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!EventThread::allocUserEvents()){
|
if (!EventThread::allocUserEvents()){
|
||||||
crash("Error allocating SDL user events");
|
crash("Error allocating SDL user events", Exception::MEOW, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,12 +278,13 @@ int main(int argc, char *argv[]){
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!conf.gameFolder.empty())
|
if (!conf.gameFolder.empty()){
|
||||||
if (chdir(conf.gameFolder.c_str()) != 0){
|
if (chdir(conf.gameFolder.c_str()) != 0){
|
||||||
snprintf(msg, sizeof msg, "Unable to switch into gameFolder %s", conf.gameFolder);
|
snprintf(msg, sizeof msg, "Unable to switch into gameFolder %s", conf.gameFolder);
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern int screenMain(Config &conf);
|
extern int screenMain(Config &conf);
|
||||||
if (conf.screenMode)
|
if (conf.screenMode)
|
||||||
|
|
@ -294,14 +295,13 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
if (TTF_Init() == false){
|
if (TTF_Init() == false){
|
||||||
snprintf(msg, sizeof msg, "Error initializing SDL_ttf: %s", SDL_GetError());
|
snprintf(msg, sizeof msg, "Error initializing SDL_ttf: %s", SDL_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sound_Init() == false){
|
if (Sound_Init() == false){
|
||||||
snprintf(msg, sizeof msg, "Error initializing SDL_sound: %s", Sound_GetError());
|
snprintf(msg, sizeof msg, "Error initializing SDL_sound: %s", Sound_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
|
@ -321,7 +321,7 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
if (!win){
|
if (!win){
|
||||||
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
|
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,8 +336,8 @@ int main(int argc, char *argv[]){
|
||||||
ALCdevice *alcDev = alcOpenDevice(0);
|
ALCdevice *alcDev = alcOpenDevice(0);
|
||||||
|
|
||||||
if (!alcDev){
|
if (!alcDev){
|
||||||
crash("Error opening OpenAL device");
|
|
||||||
SDL_DestroyWindow(win);
|
SDL_DestroyWindow(win);
|
||||||
|
crash("Error opening OpenAL device", Exception::MEOW, true);
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
|
@ -393,9 +393,8 @@ int main(int argc, char *argv[]){
|
||||||
else
|
else
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot: Sunshine will now force quit", win);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, conf.windowTitle.c_str(), "The RGSS script seems to be stuck and OneShot: Sunshine will now force quit", win);
|
||||||
|
|
||||||
if (!rtData.rgssErrorMsg.empty()){
|
if (!rtData.rgssErrorMsg.empty())
|
||||||
crash(rtData.rgssErrorMsg.c_str());
|
crash(rtData.rgssErrorMsg.c_str(), Exception::MEOW, false);
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up any remainin events */
|
/* Clean up any remainin events */
|
||||||
eventThread.cleanup();
|
eventThread.cleanup();
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
#include <SDL3_sound/SDL_sound.h>
|
#include <SDL3_sound/SDL_sound.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
#include <SDL3/SDL_video.h>
|
#include <SDL3/SDL_video.h>
|
||||||
|
|
||||||
#include "meow.h"
|
#include "meow.h"
|
||||||
#include "eventthread.h"
|
#include "eventthread.h"
|
||||||
|
#include "exception.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gl-debug.h"
|
#include "gl-debug.h"
|
||||||
#include "gl-fun.h"
|
#include "gl-fun.h"
|
||||||
|
|
@ -38,7 +40,7 @@ static inline const char* glGetStringInt(GLenum name){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void crash(const char* reason){
|
void crash(const char* reason, Exception::Type t, bool do_exp){
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash log? You can share the crash log with the developers and help resolve the issue.", reason);
|
snprintf(msg, sizeof msg, "Error occured! Error message: %s\n\n Want to create a crash log? You can share the crash log with the developers and help resolve the issue.", reason);
|
||||||
SDL_MessageBoxData messageboxdata = {
|
SDL_MessageBoxData messageboxdata = {
|
||||||
|
|
@ -104,4 +106,9 @@ void crash(const char* reason){
|
||||||
printf("[CRASHLOG] Failed to write crashdump file\n");
|
printf("[CRASHLOG] Failed to write crashdump file\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(do_exp == true){
|
||||||
|
if(!t == Exception::MEOW)
|
||||||
|
throw Exception(t, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
void crash(const char* reason);
|
#include "exception.h"
|
||||||
|
void crash(const char* reason, Exception::Type t, bool do_exp);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ int screenMain(Config &conf){
|
||||||
|
|
||||||
if (!win){
|
if (!win){
|
||||||
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
|
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
|
||||||
crash(msg);
|
crash(msg, Exception::MEOW, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "aldatasource.h"
|
#include "aldatasource.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#include <SDL3_sound/SDL_sound.h>
|
#include <SDL3_sound/SDL_sound.h>
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ struct SDLSoundSource : ALDataSource{
|
||||||
SDL_IOStream &srcOps;
|
SDL_IOStream &srcOps;
|
||||||
uint8_t sampleSize;
|
uint8_t sampleSize;
|
||||||
bool looped;
|
bool looped;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
ALenum alFormat;
|
ALenum alFormat;
|
||||||
ALsizei alFreq;
|
ALsizei alFreq;
|
||||||
|
|
@ -44,7 +46,8 @@ struct SDLSoundSource : ALDataSource{
|
||||||
|
|
||||||
if (!sample){
|
if (!sample){
|
||||||
SDL_CloseIO(&ops);
|
SDL_CloseIO(&ops);
|
||||||
throw Exception(Exception::SDLError, "SDL_sound: %s", Sound_GetError());
|
snprintf(msg, sizeof msg, "SDL_sound: %s", Sound_GetError());
|
||||||
|
crash(msg, Exception::SDLError, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleSize = formatSampleSize(sample->actual.format);
|
sampleSize = formatSampleSize(sample->actual.format);
|
||||||
|
|
|
||||||
|
|
@ -152,8 +152,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(vertShader);
|
printShaderLog(vertShader);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
|
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
|
||||||
crash(msg);
|
crash(msg, Exception::MKXPError ,true);
|
||||||
throw Exception(Exception::MKXPError, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compile fragment shader */
|
/* Compile fragment shader */
|
||||||
|
|
@ -165,8 +164,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(fragShader);
|
printShaderLog(fragShader);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
|
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
|
||||||
crash(msg);
|
crash(msg, Exception::MKXPError, true);
|
||||||
throw Exception(Exception::MKXPError, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Link shader program */
|
/* Link shader program */
|
||||||
|
|
@ -184,8 +182,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
if (!success){
|
if (!success){
|
||||||
printProgramLog(program);
|
printProgramLog(program);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
|
snprintf(msg, sizeof msg, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
|
||||||
crash(msg);
|
crash(msg, Exception::MKXPError, true);
|
||||||
throw Exception(Exception::MKXPError, msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "debugwriter.h"
|
#include "debugwriter.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#include <SDL3_sound/SDL_sound.h>
|
#include <SDL3_sound/SDL_sound.h>
|
||||||
|
|
||||||
|
|
@ -197,8 +198,7 @@ struct SoundOpenHandler : FileSystem::OpenHandler{
|
||||||
|
|
||||||
ALenum alFormat = chooseALFormat(sampleSize, sample->actual.channels);
|
ALenum alFormat = chooseALFormat(sampleSize, sample->actual.channels);
|
||||||
|
|
||||||
AL::Buffer::uploadData(buffer->alBuffer, alFormat, sample->buffer,
|
AL::Buffer::uploadData(buffer->alBuffer, alFormat, sample->buffer, buffer->bytes, sample->actual.freq);
|
||||||
buffer->bytes, sample->actual.freq);
|
|
||||||
|
|
||||||
Sound_FreeSample(sample);
|
Sound_FreeSample(sample);
|
||||||
|
|
||||||
|
|
@ -207,6 +207,7 @@ struct SoundOpenHandler : FileSystem::OpenHandler{
|
||||||
};
|
};
|
||||||
|
|
||||||
SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
|
SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
|
||||||
|
char msg[512];
|
||||||
SoundBuffer *buffer = bufferHash.value(filename, 0);
|
SoundBuffer *buffer = bufferHash.value(filename, 0);
|
||||||
|
|
||||||
if (buffer){
|
if (buffer){
|
||||||
|
|
@ -224,8 +225,8 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
|
||||||
|
|
||||||
if (!buffer){
|
if (!buffer){
|
||||||
char buf[512];
|
char buf[512];
|
||||||
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s",
|
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
|
||||||
filename.c_str(), Sound_GetError());
|
crash(msg, Exception::MEOW, false);
|
||||||
Debug() << buf;
|
Debug() << buf;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -513,8 +513,7 @@ void Sprite::draw(){
|
||||||
base = &shader;
|
base = &shader;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
switch (p->shader)
|
switch (p->shader){
|
||||||
{
|
|
||||||
case ShaderType::SHADER_worldMachine:
|
case ShaderType::SHADER_worldMachine:
|
||||||
{
|
{
|
||||||
WMShader &shader = shState->shaders().worldMachine;
|
WMShader &shader = shState->shaders().worldMachine;
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,8 @@ void Table::serialize(char *buffer) const{
|
||||||
|
|
||||||
|
|
||||||
Table *Table::deserialize(const char *data, int len){
|
Table *Table::deserialize(const char *data, int len){
|
||||||
if (len < 20){
|
if (len < 20)
|
||||||
crash("Marshal: Table: bad file format");
|
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
||||||
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
|
|
||||||
}
|
|
||||||
|
|
||||||
readInt32(&data);
|
readInt32(&data);
|
||||||
int x = readInt32(&data);
|
int x = readInt32(&data);
|
||||||
|
|
@ -124,15 +122,11 @@ Table *Table::deserialize(const char *data, int len){
|
||||||
int z = readInt32(&data);
|
int z = readInt32(&data);
|
||||||
int size = readInt32(&data);
|
int size = readInt32(&data);
|
||||||
|
|
||||||
if (size != x*y*z){
|
if (size != x*y*z)
|
||||||
crash("Marshal: Table: bad file format");
|
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
||||||
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len != 20 + x*y*z*2){
|
if (len != 20 + x*y*z*2)
|
||||||
crash("Marshal: Table: bad file format");
|
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
||||||
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
|
|
||||||
}
|
|
||||||
|
|
||||||
Table *t = new Table(x, y, z);
|
Table *t = new Table(x, y, z);
|
||||||
memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);
|
memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,7 @@ TEXFBO TexPool::request(int width, int height){
|
||||||
int maxSize = glState.caps.maxTexSize;
|
int maxSize = glState.caps.maxTexSize;
|
||||||
if (width > maxSize || height > maxSize){
|
if (width > maxSize || height > maxSize){
|
||||||
snprintf(msg, sizeof msg, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
|
snprintf(msg, sizeof msg, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
|
||||||
crash(msg);
|
crash(msg, Exception::MKXPError, true);
|
||||||
throw Exception(Exception::MKXPError, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nope, create it instead */
|
/* Nope, create it instead */
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include "vertex.h"
|
#include "vertex.h"
|
||||||
#include "tileatlas.h"
|
#include "tileatlas.h"
|
||||||
#include "tilemap-common.h"
|
#include "tilemap-common.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#include <sigc++/connection.h>
|
#include <sigc++/connection.h>
|
||||||
|
|
||||||
|
|
@ -400,7 +401,7 @@ struct TilemapPrivate {
|
||||||
atlas.size = TileAtlas::minSize(atlas.efTilesetH, glState.caps.maxTexSize);
|
atlas.size = TileAtlas::minSize(atlas.efTilesetH, glState.caps.maxTexSize);
|
||||||
|
|
||||||
if (atlas.size.x < 0)
|
if (atlas.size.x < 0)
|
||||||
throw Exception(Exception::MKXPError, "Cannot allocate big enough texture for tileset atlas");
|
crash("Cannot allocate big enough texture for tileset atlas", Exception::MKXPError, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateAutotileInfo(){
|
void updateAutotileInfo(){
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "aldatasource.h"
|
#include "aldatasource.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include "meow.h"
|
||||||
|
|
||||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||||
#include <vorbis/vorbisfile.h>
|
#include <vorbis/vorbisfile.h>
|
||||||
|
|
@ -79,7 +80,7 @@ struct VorbisSource : ALDataSource{
|
||||||
|
|
||||||
if (error){
|
if (error){
|
||||||
SDL_CloseIO(&src);
|
SDL_CloseIO(&src);
|
||||||
throw Exception(Exception::MKXPError, "Vorbisfile: Cannot read ogg file");
|
crash("Vorbisfile: Cannot read ogg file", Exception::MKXPError, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract bitstream info */
|
/* Extract bitstream info */
|
||||||
|
|
@ -89,7 +90,7 @@ struct VorbisSource : ALDataSource{
|
||||||
if (info.channels > 2){
|
if (info.channels > 2){
|
||||||
ov_clear(&vf);
|
ov_clear(&vf);
|
||||||
SDL_CloseIO(&src);
|
SDL_CloseIO(&src);
|
||||||
throw Exception(Exception::MKXPError, "Cannot handle audio with more than 2 channels");
|
crash("Cannot handle audio with more than 2 channels", Exception::MKXPError, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);
|
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue