fix
This commit is contained in:
parent
ac447dbdf7
commit
f217315d34
|
|
@ -319,11 +319,9 @@ static VALUE evalString(VALUE string, VALUE filename, int *state){
|
||||||
|
|
||||||
static void runCustomScript(const std::string &filename){
|
static void runCustomScript(const std::string &filename){
|
||||||
std::string scriptData;
|
std::string scriptData;
|
||||||
char msg[1024];
|
|
||||||
|
|
||||||
if (!readFileSDL(filename.c_str(), scriptData)){
|
if (!readFileSDL(filename.c_str(), scriptData)){
|
||||||
snprintf(msg, sizeof msg, "Unable to open %s", filename);
|
crash(Exception::MEOW, "Unable to open %s", filename);
|
||||||
crash(msg, Exception::MEOW, false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,11 +340,9 @@ 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[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());
|
crash(Exception::MEOW, "Unable to open '%s'", scriptPack.c_str());
|
||||||
crash(msg, Exception::MEOW, false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -357,13 +353,12 @@ static void runRMXPScripts(BacktraceData &btData){
|
||||||
try{
|
try{
|
||||||
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
|
||||||
}catch (const Exception &e){
|
}catch (const Exception &e){
|
||||||
snprintf(msg, sizeof msg, "Failed to read script data: %s", e.msg);
|
crash(Exception::MEOW, "Failed to read script data: %s", e.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", Exception::MEOW, false);
|
crash(Exception::MEOW, "Failed to read script data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,10 +400,7 @@ static void runRMXPScripts(BacktraceData &btData){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != Z_OK){
|
if (result != Z_OK){
|
||||||
static char buffer[256];
|
crash(Exception::MEOW, "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, Exception::MEOW, false);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
|
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
|
||||||
|
|
@ -504,9 +496,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
|
||||||
file.resize(strlen(file.c_str()));
|
file.resize(strlen(file.c_str()));
|
||||||
file = btData.scriptNames.value(file, file);
|
file = btData.scriptNames.value(file, file);
|
||||||
|
|
||||||
char ms[640];
|
crash(Exception::MEOW, "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, Exception::MEOW, false);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <SDL3/SDL_mutex.h>
|
#include <SDL3/SDL_mutex.h>
|
||||||
#include <SDL3/SDL_thread.h>
|
#include <SDL3/SDL_thread.h>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue