More logs! And fixes...

This commit is contained in:
ZakatTeamI2P 2026-04-29 08:16:19 +04:00
parent eed717b070
commit a184b2a5d4
2 changed files with 13 additions and 18 deletions

View file

@ -161,7 +161,7 @@ static void showMsg(const std::string &msg){
#ifdef NDEBUG #ifdef NDEBUG
shState->eThread().showMessageBox(msg.c_str()); shState->eThread().showMessageBox(msg.c_str());
#else #else
Debug() << msg.c_str(); Debug() << "[DEBUG] " + msg.c_str();
#endif #endif
} }
@ -227,25 +227,26 @@ RB_METHOD(mkxpRawKeyStates){
RB_METHOD(mkxpMouseInWindow){ RB_METHOD(mkxpMouseInWindow){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_bool_new(EventThread::mouseState.inWindow); return rb_bool_new(EventThread::mouseState.inWindow);
} }
static VALUE rgssMainCb(VALUE block){ static VALUE rgssMainCb(VALUE block){
printf("[rgssMainCb] \n");
rb_funcall2(block, rb_intern("call"), 0, 0); rb_funcall2(block, rb_intern("call"), 0, 0);
return Qnil; return Qnil;
} }
static VALUE rgssMainRescue(VALUE arg, VALUE exc){ static VALUE rgssMainRescue(VALUE arg, VALUE exc){
VALUE *excRet = (VALUE*) arg; VALUE *excRet = (VALUE*) arg;
*excRet = exc; *excRet = exc;
return Qnil; return Qnil;
} }
static void processReset(){ static void processReset(){
printf("[processReset]\n"); printf("[processReset] reset!\n");
shState->graphics().reset(); shState->graphics().reset();
shState->audio().reset(); shState->audio().reset();
@ -270,10 +271,12 @@ RB_METHOD(mriRgssMain){
if (NIL_P(exc)) if (NIL_P(exc))
break; break;
if (rb_obj_class(exc) == getRbData()->exc[Reset]) if (rb_obj_class(exc) == getRbData()->exc[Reset]){
printf("[mriRgssMain] Reset\n");
processReset(); processReset();
else }else{
rb_exc_raise(exc); rb_exc_raise(exc);
}
} }
return Qnil; return Qnil;
@ -281,7 +284,7 @@ RB_METHOD(mriRgssMain){
RB_METHOD(mriRgssStop){ RB_METHOD(mriRgssStop){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
printf("[mriRgssStop] Stop\n");
while (true) while (true)
shState->graphics().update(); shState->graphics().update();
@ -364,13 +367,11 @@ static void runRMXPScripts(BacktraceData &btData){
const std::string &scriptPack = conf.game.scripts; const std::string &scriptPack = conf.game.scripts;
if (scriptPack.empty()){ if (scriptPack.empty()){
printf("[runRMXPScripts] No game scripts specified (missing Game.ini?)\n");
showMsg("No game scripts specified (missing Game.ini?)"); showMsg("No game scripts specified (missing Game.ini?)");
return; return;
} }
if (!shState->fileSystem().exists(scriptPack.c_str())){ if (!shState->fileSystem().exists(scriptPack.c_str())){
printf("[runRMXPScripts] Unable to open %s\n", scriptPack);
showMsg("Unable to open '" + scriptPack + "'"); showMsg("Unable to open '" + scriptPack + "'");
return; return;
} }
@ -383,13 +384,11 @@ static void runRMXPScripts(BacktraceData &btData){
scriptArray = kernelLoadDataInt(scriptPack.c_str(), false); scriptArray = kernelLoadDataInt(scriptPack.c_str(), false);
printf("[runRMXPScripts] %s", scriptPack.c_str()); printf("[runRMXPScripts] %s", scriptPack.c_str());
}catch (const Exception &e){ }catch (const Exception &e){
printf("[runRMXPScripts] Failed to read script data: %s", e.msg);
showMsg(std::string("Failed to read script data: ") + e.msg); showMsg(std::string("Failed to read script data: ") + e.msg);
return; return;
} }
if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){ if (!RB_TYPE_P(scriptArray, RUBY_T_ARRAY)){
printf("[runRMXPScripts] Failed to read script data");
showMsg("Failed to read script data"); showMsg("Failed to read script data");
return; return;
} }
@ -413,7 +412,6 @@ static void runRMXPScripts(BacktraceData &btData){
VALUE scriptName = rb_ary_entry(script, 1); VALUE scriptName = rb_ary_entry(script, 1);
VALUE scriptString = rb_ary_entry(script, 2); VALUE scriptString = rb_ary_entry(script, 2);
printf("[runRMXPScripts] Script Name: %s", rb_str_to_str(scriptName)); printf("[runRMXPScripts] Script Name: %s", rb_str_to_str(scriptName));
//printf("[runRMXPScripts] ");
int result = Z_OK; int result = Z_OK;
unsigned long bufferLen; unsigned long bufferLen;
@ -490,7 +488,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL); VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL);
VALUE bt0 = rb_ary_entry(bt, 0); VALUE bt0 = rb_ary_entry(bt, 0);
VALUE name = rb_class_path(rb_obj_class(exc)); VALUE name = rb_class_path(rb_obj_class(exc));
VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")", VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")",
bt0, exc, name); bt0, exc, name);
/* omit "useless" last entry (from ruby:1:in `eval') */ /* omit "useless" last entry (from ruby:1:in `eval') */
@ -537,8 +535,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
file = btData.scriptNames.value(file, file); file = btData.scriptNames.value(file, file);
std::string ms(640, '\0'); std::string ms(640, '\0');
snprintf(&ms[0], ms.size(), "[runRMXPScripts]Script '%s' line %s: %s occured.\n\n%s", snprintf(&ms[0], ms.size(), "Script '%s' line %s: %s occured.\n\n%s", file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));
showMsg(ms); showMsg(ms);
} }
@ -577,7 +574,7 @@ static void mriBindingExecute(){
BacktraceData btData; BacktraceData btData;
mriBindingInit(); mriBindingInit();
printf("[mriBindingExecute] run RMXP Scripts\n");
runRMXPScripts(btData); runRMXPScripts(btData);
VALUE exc = rb_errinfo(); VALUE exc = rb_errinfo();

View file

@ -252,5 +252,3 @@ void fileIntBindingInit(){
rb_define_module_function(marsh, "load", RUBY_METHOD_FUNC(_marshalLoad), -1); rb_define_module_function(marsh, "load", RUBY_METHOD_FUNC(_marshalLoad), -1);
printf("[fileIntBindingInit] Done\n"); printf("[fileIntBindingInit] Done\n");
} }