mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
afd
This commit is contained in:
parent
c0c0e4d8ba
commit
e8f9220197
3 changed files with 3 additions and 59 deletions
|
|
@ -117,9 +117,6 @@ DEF_AUD_PROP_I(SFX_Volume)
|
|||
|
||||
RB_METHOD(audioReset){
|
||||
RB_UNUSED_PARAM;
|
||||
#ifdef DEBUG
|
||||
printf("[audioReset] Reseting audio\n");
|
||||
#endif
|
||||
shState->audio().reset();
|
||||
|
||||
return Qnil;
|
||||
|
|
|
|||
|
|
@ -225,9 +225,6 @@ static VALUE rgssMainRescue(VALUE arg, VALUE exc){
|
|||
}
|
||||
|
||||
static void processReset(){
|
||||
#ifdef DEBUG
|
||||
printf("[processReset] reset!\n");
|
||||
#endif
|
||||
shState->graphics().reset();
|
||||
shState->audio().reset();
|
||||
|
||||
|
|
@ -252,9 +249,6 @@ RB_METHOD(mriRgssMain){
|
|||
break;
|
||||
|
||||
if (rb_obj_class(exc) == getRbData()->exc[Reset]){
|
||||
#ifdef DEBUG
|
||||
printf("[mriRgssMain] Reset\n");
|
||||
#endif
|
||||
processReset();
|
||||
}else{
|
||||
rb_exc_raise(exc);
|
||||
|
|
@ -266,9 +260,6 @@ RB_METHOD(mriRgssMain){
|
|||
|
||||
RB_METHOD(mriRgssStop){
|
||||
RB_UNUSED_PARAM;
|
||||
#ifdef DEBUG
|
||||
printf("[mriRgssStop] Stop\n");
|
||||
#endif
|
||||
while (true)
|
||||
shState->graphics().update();
|
||||
|
||||
|
|
@ -398,10 +389,6 @@ static void runRMXPScripts(BacktraceData &btData){
|
|||
VALUE scriptName = rb_ary_entry(script, 1);
|
||||
VALUE scriptString = rb_ary_entry(script, 2);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("[runRMXPScripts] Script Name: %s\n", RSTRING_PTR(scriptName));
|
||||
#endif
|
||||
|
||||
int result = Z_OK;
|
||||
unsigned long bufferLen;
|
||||
|
||||
|
|
@ -477,8 +464,7 @@ static void showExc(VALUE exc, const BacktraceData &btData){
|
|||
VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL);
|
||||
VALUE bt0 = rb_ary_entry(bt, 0);
|
||||
VALUE name = rb_class_path(rb_obj_class(exc));
|
||||
VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")",
|
||||
bt0, exc, name);
|
||||
VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")", bt0, exc, name);
|
||||
/* omit "useless" last entry (from ruby:1:in `eval') */
|
||||
for (long i = 1, btlen = RARRAY_LEN(bt) - 1; i < btlen; ++i)
|
||||
rb_str_catf(ds, "\n\tfrom %" PRIsVALUE, rb_ary_entry(bt, i));
|
||||
|
|
@ -561,18 +547,11 @@ static void mriBindingExecute(){
|
|||
BacktraceData btData;
|
||||
|
||||
mriBindingInit();
|
||||
#ifdef DEBUG
|
||||
printf("[mriBindingExecute] run RMXP Scripts\n");
|
||||
#endif
|
||||
runRMXPScripts(btData);
|
||||
|
||||
VALUE exc = rb_errinfo();
|
||||
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
|
||||
showExc(exc, btData);
|
||||
#ifdef DEBUG
|
||||
printf("[mirBindingExecure] Ruby cleanup\n");
|
||||
#endif
|
||||
//ruby_cleanup(0);
|
||||
|
||||
shState->rtData().rqTermAck.set();
|
||||
}
|
||||
|
|
@ -586,8 +565,5 @@ static void mriBindingTerminate(){
|
|||
}
|
||||
|
||||
static void mriBindingReset(){
|
||||
#ifdef DEBUG
|
||||
printf("[mriBindingReset] Binding reset...\n");
|
||||
#endif
|
||||
rb_raise(getRbData()->exc[Reset], " ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,23 +31,14 @@
|
|||
|
||||
void fileIntFreeInstance(void *inst){
|
||||
SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst);
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntFreeInstance] Closing ops\n");
|
||||
#endif
|
||||
SDL_CloseIO(ops);
|
||||
}
|
||||
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
|
||||
|
||||
VALUE fileIntForPath(const char *path, bool rubyExc){
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntForPath] %s!\n", path);
|
||||
#endif
|
||||
SDL_IOStream* ops = nullptr;
|
||||
ops = SDL_IOFromFile(path, "r");
|
||||
if (!ops){
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntForPath] Failed to open file: %s\n", path);
|
||||
#endif
|
||||
if (rubyExc) {
|
||||
rb_raise(rb_eIOError, "Cannot open file: %s", path);
|
||||
}
|
||||
|
|
@ -71,9 +62,6 @@ RB_METHOD(fileIntRead){
|
|||
}
|
||||
|
||||
if (length == 0){
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntRead] zero length\n");
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
@ -87,14 +75,9 @@ RB_METHOD(fileIntRead){
|
|||
RB_NA_METHOD(fileIntClose){
|
||||
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
|
||||
if (!ops){
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntClose] Already closed or null\n");
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("[fileIntClose] Closing ops\n");
|
||||
#endif
|
||||
|
||||
SDL_CloseIO(ops);
|
||||
setPrivateData(self, nullptr);
|
||||
return Qnil;
|
||||
|
|
@ -118,18 +101,12 @@ VALUE load_protect(VALUE marsh_and_port) {
|
|||
}
|
||||
|
||||
VALUE kernelLoadDataInt(const char *filename, bool rubyExc){
|
||||
#ifdef DEBUG
|
||||
printf("[kernelLoadDataInt] Filename: %s\n", filename);
|
||||
#endif
|
||||
VALUE port = fileIntForPath(filename, rubyExc);
|
||||
if (NIL_P(port)) return Qnil;
|
||||
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
|
||||
VALUE args[2] = { marsh, port };
|
||||
int state = 0;
|
||||
VALUE result = rb_protect(load_protect, (VALUE)args, &state);
|
||||
#ifdef DEBUG
|
||||
printf("[kernelLoadDataInt] State %d\n", state);
|
||||
#endif
|
||||
|
||||
rb_funcallv(port, rb_intern("close"), 0, NULL);
|
||||
|
||||
|
|
@ -152,9 +129,6 @@ RB_METHOD(kernelLoadData){
|
|||
RB_UNUSED_PARAM;
|
||||
const char *filename;
|
||||
rb_get_args(argc, argv, "z", &filename);
|
||||
#ifdef DEBUG
|
||||
printf("[kernelLoadData] filename: %s\n", filename);
|
||||
#endif
|
||||
return kernelLoadDataInt(filename, true);
|
||||
}
|
||||
|
||||
|
|
@ -174,11 +148,8 @@ RB_METHOD(kernelSaveData){
|
|||
|
||||
VALUE v[] = { obj, file };
|
||||
rb_funcall2(marsh, rb_intern("dump"), ARRAY_SIZE(v), v);
|
||||
#ifdef DEBUG
|
||||
printf("[kernelSaveData] Closing file %s\n", rb_str_to_str(filename));
|
||||
#endif
|
||||
rb_io_close(file);
|
||||
|
||||
rb_io_close(file);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue