im looks like shit

This commit is contained in:
DepressedTWM 2026-05-28 12:33:48 +04:00
parent e8f9220197
commit e4de91bde2
23 changed files with 137 additions and 115 deletions

View file

@ -323,7 +323,7 @@ static void runCustomScript(const std::string &filename){
if (!readFileSDL(filename.c_str(), scriptData)){
snprintf(msg, sizeof msg, "Unable to open %s", filename);
crash(msg);
crash(msg, Exception::MEOW, false);
return;
}
@ -342,11 +342,11 @@ struct BacktraceData{
static void runRMXPScripts(BacktraceData &btData){
const Config &conf = shState->rtData().config;
const std::string &scriptPack = conf.game.scripts;
char msg[512];
char msg[1024];
if (!shState->fileSystem().exists(scriptPack.c_str())){
snprintf(msg, sizeof msg, "Unable to open '%s'", scriptPack.c_str());
crash(msg);
crash(msg, Exception::MEOW, false);
return;
}
@ -356,15 +356,14 @@ static void runRMXPScripts(BacktraceData &btData){
* still go wrong */
try{
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
printf("[runRMXPScripts] %s\n", scriptPack.c_str());
}catch (const Exception &e){
snprintf(msg, sizeof msg, "Failed to read script data: %s", e.msg);
crash(msg);
crash(msg, Exception::MEOW, false);
return;
}
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
crash("Failed to read script data");
crash("Failed to read script data", Exception::MEOW, false);
return;
}
@ -374,9 +373,6 @@ static void runRMXPScripts(BacktraceData &btData){
rb_gv_set("$RGSS_SCRIPTS", scriptArray);
long scriptCount = RARRAY_LEN(scriptArray);
#ifdef DEBUG
printf("[runRMXPScripts] Scripts count: %ld\n", scriptCount);
#endif
std::string decodeBuffer;
decodeBuffer.resize(0x1000);
@ -411,7 +407,7 @@ static void runRMXPScripts(BacktraceData &btData){
if (result != Z_OK){
static char buffer[256];
snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName));
crash(buffer);
crash(buffer, Exception::MEOW, false);
break;
}
@ -510,7 +506,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
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));
crash(ms);
crash(ms, Exception::MEOW, false);
exit(0);
}

View file

@ -9,12 +9,24 @@
# relative to gameFolder and ignoring both RTPs and
# encrypted archives.
# Debug mode
# Enable reset on F12 press and other
# (default: disabled)
#
# debugMode=false
# Start game in fullscreen mode,
# i.e. Big Picture/console mode.
# (default: disabled)
#
# fullscreen=false
# screenMode
# idk
# (default: disabled)
# screenMode=false
# Display current FPS in Window title
# (default: disabled)
# printFPS=false
@ -31,6 +43,13 @@
#
# 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
# is upscaled
# (default: disabled)

View file

@ -26,7 +26,7 @@
#include <AL/alc.h>
#include <SDL3/SDL_audio.h>
#include <assert.h>
#include "meow.h"
namespace AL{
#define DEF_AL_ID \
@ -177,6 +177,7 @@ inline uint8_t formatSampleSize(int sdlFormat){
case SDL_AUDIO_S16BE :
return 2;
default :
crash("Unhandled sample format", Exception::MEOW, false);
assert(!"Unhandled sample format");
}
@ -196,6 +197,7 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount){
case 2 : return AL_FORMAT_STEREO16;
}
default :
crash("Unhandled sample size / channel count", Exception::MEOW, false);
assert(!"Unhandled sample size / channel count");
}

View file

@ -232,9 +232,8 @@ void ALStream::openSource(const std::string &filename){
if (!source){
char buf[512];
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s",
filename.c_str(), handler.errorMsg.c_str());
crash(buf);
snprintf(buf, sizeof(buf), "Unable to decode audio stream: %s: %s", filename.c_str(), handler.errorMsg.c_str());
crash(buf, Exception::MEOW, false);
Debug() << buf;
}

View file

@ -47,9 +47,9 @@
#define GUARD_MEGA \
{ \
if (p->megaSurface) \
throw Exception(Exception::MKXPError, \
"Operation not supported for mega surfaces"); \
if (p->megaSurface) { \
crash("Operation not supported for mega surfaces", Exception::MKXPError, true); \
} \
}
#define OUTLINE_SIZE 1
@ -229,7 +229,7 @@ Bitmap::Bitmap(const char *filename){
if (!imgSurf){
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);
@ -265,8 +265,7 @@ Bitmap::Bitmap(const char *filename){
Bitmap::Bitmap(int width, int height){
if (width <= 0 || height <= 0){
crash("failed to create bitmap");
throw Exception(Exception::RGSSError, "failed to create bitmap");
crash("failed to create bitmap", Exception::RGSSError, true);
}
TEXFBO tex = shState->texPool().request(width, height);
@ -411,8 +410,7 @@ void Bitmap::stretchBlt(const IntRect &destRect, const Bitmap &source, const Int
}
else{
/* Clipped blit */
GLMeta::subRectImageUpload(blitTemp->w, bltRect.x - dstRect.x, bltRect.y - dstRect.y,
bltRect.x, bltRect.y, bltRect.w, bltRect.h, blitTemp, GL_RGBA);
GLMeta::subRectImageUpload(blitTemp->w, bltRect.x - dstRect.x, bltRect.y - dstRect.y, bltRect.x, bltRect.y, bltRect.w, bltRect.h, blitTemp, GL_RGBA);
GLMeta::subRectImageEnd();
}

View file

@ -168,19 +168,21 @@ void Config::read(int argc, char *argv[]){
commonDataPath = prefPath(".", "Oneshot");
//Hardcode some ini/version settings
rgssVersion = 1;
game.title = "OneShot: Sunshine";
if(windowTitle == "")
game.title = "OneShot: Sunshine";
game.scripts = "Data/xScripts.rxdata";
if (EnableSixteenByNine){
defScreenW = 1280;
defScreenH = 720;
}else{
defScreenW = 640;
defScreenH = 480;
if(defScreenW == 0 || defScreenH == 0){
if (EnableSixteenByNine){
defScreenW = 1280;
defScreenH = 720;
}else{
defScreenW = 640;
defScreenH = 480;
}
}
#ifdef STEAM
/* Override fullscreen config if Big Picture */
if (const char *env = std::getenv("SteamTenfoot")){

View file

@ -103,10 +103,8 @@ void Color::serialize(char *buffer) const{
}
Color *Color::deserialize(const char *data, int len){
if (len != 32){
crash("Color: Serialized data invalid");
throw Exception(Exception::ArgumentError, "Color: Serialized data invalid");
}
if (len != 32)
crash("Color: Serialized data invalid", Exception::ArgumentError, true);
Color *c = new Color();
@ -224,10 +222,8 @@ void Tone::serialize(char *buffer) const{
}
Tone *Tone::deserialize(const char *data, int len){
if (len != 32){
crash("Tone: Serialized data invalid");
throw Exception(Exception::ArgumentError, "Tone: Serialized data invalid");
}
if (len != 32)
crash("Tone: Serialized data invalid", Exception::ArgumentError, true);
Tone *t = new Tone();
@ -357,10 +353,8 @@ void Rect::serialize(char *buffer) const{
}
Rect *Rect::deserialize(const char *data, int len){
if (len != 16){
crash("Rect: Serialized data invalid");
throw Exception(Exception::ArgumentError, "Rect: Serialized data invalid");
}
if (len != 16)
crash("Rect: Serialized data invalid", Exception::ArgumentError, true);
Rect *r = new Rect();

View file

@ -114,8 +114,7 @@ private:
void resetInputStates();
void setFullscreen(SDL_Window *, bool mode);
void updateCursorState(bool inWindow,
const SDL_Rect &screen);
void updateCursorState(bool inWindow, const SDL_Rect &screen);
bool fullscreen;
bool showCursor;

View file

@ -39,7 +39,10 @@ struct Exception{
/* New types introduced in mkxp */
PHYSFSError,
SDLError,
MKXPError
MKXPError,
// For crash()
MEOW
};
Type type;

View file

@ -54,8 +54,7 @@ struct SDLRWIoContext{
filename(filename)
{
if (!ops)
crash("Failed to open file");
throw Exception(Exception::SDLError, "Failed to open file: %s", SDL_GetError());
crash("Failed to open file", Exception::SDLError, true);
}
~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){
// return SDL_ReadIO(getSDLRWops(io), buf, 1, len);
return SDL_ReadIO(getSDLRWops(io), buf, len);
}
@ -120,6 +118,7 @@ static PHYSFS_Io *createSDLRWIo(const char *filename){
try{
ctx = new SDLRWIoContext(filename);
}catch (const Exception &e){
Debug() << "Failed mounting" << filename;
return 0;
}
@ -563,6 +562,7 @@ openReadEnumCB(void *d, const char *dirpath, const char *filename){
void FileSystem::openRead(OpenHandler &handler, const char *filename){
char buffer[512];
char msg[512];
size_t len = strcpySafe(buffer, filename, sizeof(buffer), -1);
char *delim;
@ -588,8 +588,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
dir = buffer;
}
OpenReadEnumData data(handler, file, len + buffer - delim - !root,
p->havePathCache ? &p->pathCache : 0);
OpenReadEnumData data(handler, file, len + buffer - delim - !root, p->havePathCache ? &p->pathCache : 0);
if (p->havePathCache){
/* 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);
}
if (data.physfsError)
throw Exception(Exception::PHYSFSError, "PhysFS: %s", data.physfsError);
if (data.physfsError){
snprintf(msg, sizeof msg, "PhysFS: %s", data.physfsError);
crash(msg, Exception::PHYSFSError, true);
}
if (data.matchCount == 0)
throw Exception(Exception::NoFileError, "%s", filename);
if (data.matchCount == 0){
snprintf(msg, sizeof msg, "NoFileError: %s", data.physfsError);
crash(msg, Exception::NoFileError, true);
}
}
void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){
PHYSFS_File *handle = PHYSFS_openRead(filename);
if (!handle)
if (!handle){
throw Exception(Exception::NoFileError, "%s", filename);
}
initReadOps(handle, stream);
}

View file

@ -27,6 +27,7 @@
#include "boost-hash.h"
#include "util.h"
#include "config.h"
#include "meow.h"
#include <string>
#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){
char msg[512];
if (family.empty())
family = "Terminus (TTF)"; // terminus hardcoded :3c
@ -126,7 +128,7 @@ TTF_Font *SharedFontState::getFont(std::string family, int size){
SDL_IOStream *ops;
if (family.empty()){
throw Exception(Exception::RGSSError, "font does not exist");
crash("font does not exist", Exception::RGSSError, true);
}else{
/* Use 'other' path as alternative in case
* 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);
if (!font)
throw Exception(Exception::SDLError, "%s", SDL_GetError());
if (!font){
snprintf(msg, sizeof msg, "%s", SDL_GetError());
crash(msg, Exception::SDLError, true);
}
p->pool.insert(key, font);
return font;

View file

@ -89,7 +89,7 @@ int rgssThreadFun(void *userdata){
if (!glCtx){
snprintf(msg, sizeof msg, "Error creating context: %s", SDL_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
rgssThreadError(threadData, std::string(msg));
return 0;
}
@ -98,7 +98,7 @@ int rgssThreadFun(void *userdata){
initGLFunctions();
}
catch (const Exception &exc){
crash(exc.msg.c_str());
crash(exc.msg.c_str(), Exception::MEOW, false);
rgssThreadError(threadData, exc.msg);
SDL_GL_DestroyContext(glCtx);
return 0;
@ -127,7 +127,7 @@ int rgssThreadFun(void *userdata){
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
if (!alcCtx){
crash("Error creating OpenAL context");
crash("Error creating OpenAL context", Exception::MEOW, false);
rgssThreadError(threadData, "Error creating OpenAL context");
SDL_GL_DestroyContext(glCtx);
return 0;
@ -138,7 +138,7 @@ int rgssThreadFun(void *userdata){
try{
SharedState::initInstance(threadData);
}catch (const Exception &exc){
crash(exc.msg.c_str());
crash(exc.msg.c_str(), Exception::MEOW, false);
rgssThreadError(threadData, exc.msg);
alcDestroyContext(alcCtx);
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);
if (keyCreateError != ERROR_SUCCESS){
crash("Unable to create key in registry.");
crash("Unable to create key in registry", Exception::MEOW, false);
}
else {
keyOpenError = ERROR_SUCCESS;
@ -202,12 +202,12 @@ static void setGamePathInRegistry() {
}
if (keyOpenError != ERROR_SUCCESS){
crash("Unable to open registry.");
crash("Unable to open registry.", Exception::MEOW, false);
}
else {
DWORD dataSize = (strlen(dataDir) + 1) * sizeof(char);
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);
}
@ -235,19 +235,19 @@ int main(int argc, char *argv[]){
/* initialize SDL first */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){
snprintf(msg, sizeof msg, "Error initializing SDL: %s", SDL_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
return 0;
}
#ifdef STEAM
if (!STEAMSHIM_init()){
crash("Could not initialize Steamworks API");
return 0;
crash("Could not initialize Steamworks API", Exception::MEOW, true);
return 0
}
#endif
if (!EventThread::allocUserEvents()){
crash("Error allocating SDL user events");
crash("Error allocating SDL user events", Exception::MEOW, true);
return 0;
}
@ -278,12 +278,13 @@ int main(int argc, char *argv[]){
}
#endif
if (!conf.gameFolder.empty())
if (!conf.gameFolder.empty()){
if (chdir(conf.gameFolder.c_str()) != 0){
snprintf(msg, sizeof msg, "Unable to switch into gameFolder %s", conf.gameFolder);
crash(msg);
crash(msg, Exception::MEOW, true);
return 0;
}
}
extern int screenMain(Config &conf);
if (conf.screenMode)
@ -294,14 +295,13 @@ int main(int argc, char *argv[]){
if (TTF_Init() == false){
snprintf(msg, sizeof msg, "Error initializing SDL_ttf: %s", SDL_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
SDL_Quit();
return 0;
}
if (Sound_Init() == false){
snprintf(msg, sizeof msg, "Error initializing SDL_sound: %s", Sound_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
TTF_Quit();
SDL_Quit();
@ -321,7 +321,7 @@ int main(int argc, char *argv[]){
if (!win){
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
return 0;
}
@ -336,8 +336,8 @@ int main(int argc, char *argv[]){
ALCdevice *alcDev = alcOpenDevice(0);
if (!alcDev){
crash("Error opening OpenAL device");
SDL_DestroyWindow(win);
crash("Error opening OpenAL device", Exception::MEOW, true);
TTF_Quit();
SDL_Quit();
@ -393,9 +393,8 @@ int main(int argc, char *argv[]){
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);
if (!rtData.rgssErrorMsg.empty()){
crash(rtData.rgssErrorMsg.c_str());
}
if (!rtData.rgssErrorMsg.empty())
crash(rtData.rgssErrorMsg.c_str(), Exception::MEOW, false);
/* Clean up any remainin events */
eventThread.cleanup();

View file

@ -6,8 +6,10 @@
#include <SDL3_sound/SDL_sound.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3/SDL_video.h>
#include "meow.h"
#include "eventthread.h"
#include "exception.h"
#include "config.h"
#include "gl-debug.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];
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 = {
@ -104,4 +106,9 @@ void crash(const char* reason){
printf("[CRASHLOG] Failed to write crashdump file\n");
}
}
if(do_exp == true){
if(!t == Exception::MEOW)
throw Exception(t, msg);
}
}

View file

@ -1 +1,2 @@
void crash(const char* reason);
#include "exception.h"
void crash(const char* reason, Exception::Type t, bool do_exp);

View file

@ -39,7 +39,7 @@ int screenMain(Config &conf){
if (!win){
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
crash(msg);
crash(msg, Exception::MEOW, false);
return 0;
}

View file

@ -21,6 +21,7 @@
#include "aldatasource.h"
#include "exception.h"
#include "meow.h"
#include <SDL3_sound/SDL_sound.h>
@ -29,6 +30,7 @@ struct SDLSoundSource : ALDataSource{
SDL_IOStream &srcOps;
uint8_t sampleSize;
bool looped;
char msg[512];
ALenum alFormat;
ALsizei alFreq;
@ -44,7 +46,8 @@ struct SDLSoundSource : ALDataSource{
if (!sample){
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);

View file

@ -152,8 +152,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
if (!success){
printShaderLog(vertShader);
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
crash(msg);
throw Exception(Exception::MKXPError, msg);
crash(msg, Exception::MKXPError ,true);
}
/* Compile fragment shader */
@ -165,8 +164,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
if (!success){
printShaderLog(fragShader);
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
crash(msg);
throw Exception(Exception::MKXPError, msg);
crash(msg, Exception::MKXPError, true);
}
/* Link shader program */
@ -184,8 +182,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
if (!success){
printProgramLog(program);
snprintf(msg, sizeof msg, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
crash(msg);
throw Exception(Exception::MKXPError, msg);
crash(msg, Exception::MKXPError, true);
}
}

View file

@ -27,6 +27,7 @@
#include "config.h"
#include "util.h"
#include "debugwriter.h"
#include "meow.h"
#include <SDL3_sound/SDL_sound.h>
@ -197,8 +198,7 @@ struct SoundOpenHandler : FileSystem::OpenHandler{
ALenum alFormat = chooseALFormat(sampleSize, sample->actual.channels);
AL::Buffer::uploadData(buffer->alBuffer, alFormat, sample->buffer,
buffer->bytes, sample->actual.freq);
AL::Buffer::uploadData(buffer->alBuffer, alFormat, sample->buffer, buffer->bytes, sample->actual.freq);
Sound_FreeSample(sample);
@ -207,6 +207,7 @@ struct SoundOpenHandler : FileSystem::OpenHandler{
};
SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
char msg[512];
SoundBuffer *buffer = bufferHash.value(filename, 0);
if (buffer){
@ -224,8 +225,8 @@ SoundBuffer *SoundEmitter::allocateBuffer(const std::string &filename){
if (!buffer){
char buf[512];
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s",
filename.c_str(), Sound_GetError());
snprintf(buf, sizeof(buf), "Unable to decode sound: %s: %s", filename.c_str(), Sound_GetError());
crash(msg, Exception::MEOW, false);
Debug() << buf;
return 0;

View file

@ -513,8 +513,7 @@ void Sprite::draw(){
base = &shader;
}
else{
switch (p->shader)
{
switch (p->shader){
case ShaderType::SHADER_worldMachine:
{
WMShader &shader = shState->shaders().worldMachine;

View file

@ -113,10 +113,8 @@ void Table::serialize(char *buffer) const{
Table *Table::deserialize(const char *data, int len){
if (len < 20){
crash("Marshal: Table: bad file format");
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
}
if (len < 20)
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
readInt32(&data);
int x = readInt32(&data);
@ -124,15 +122,11 @@ Table *Table::deserialize(const char *data, int len){
int z = readInt32(&data);
int size = readInt32(&data);
if (size != x*y*z){
crash("Marshal: Table: bad file format");
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
}
if (size != x*y*z)
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
if (len != 20 + x*y*z*2){
crash("Marshal: Table: bad file format");
throw Exception(Exception::RGSSError, "Marshal: Table: bad file format");
}
if (len != 20 + x*y*z*2)
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
Table *t = new Table(x, y, z);
memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);

View file

@ -119,8 +119,7 @@ TEXFBO TexPool::request(int width, int height){
int maxSize = glState.caps.maxTexSize;
if (width > maxSize || height > maxSize){
snprintf(msg, sizeof msg, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
crash(msg);
throw Exception(Exception::MKXPError, msg);
crash(msg, Exception::MKXPError, true);
}
/* Nope, create it instead */

View file

@ -38,6 +38,7 @@
#include "vertex.h"
#include "tileatlas.h"
#include "tilemap-common.h"
#include "meow.h"
#include <sigc++/connection.h>
@ -400,7 +401,7 @@ struct TilemapPrivate {
atlas.size = TileAtlas::minSize(atlas.efTilesetH, glState.caps.maxTexSize);
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(){

View file

@ -21,6 +21,7 @@
#include "aldatasource.h"
#include "exception.h"
#include "meow.h"
#define OV_EXCLUDE_STATIC_CALLBACKS
#include <vorbis/vorbisfile.h>
@ -79,7 +80,7 @@ struct VorbisSource : ALDataSource{
if (error){
SDL_CloseIO(&src);
throw Exception(Exception::MKXPError, "Vorbisfile: Cannot read ogg file");
crash("Vorbisfile: Cannot read ogg file", Exception::MKXPError, true);
}
/* Extract bitstream info */
@ -89,7 +90,7 @@ struct VorbisSource : ALDataSource{
if (info.channels > 2){
ov_clear(&vf);
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);