From c90326ffbd47345d344e9b6173206a86be454fba Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Fri, 1 May 2026 06:10:53 -0400 Subject: [PATCH] Fixes for stupid changes --- binding-mri/binding-mri.cpp | 5 ++--- binding-mri/binding-util.cpp | 9 +++------ binding-mri/binding-util.h | 8 +++----- binding-mri/bitmap-binding.cpp | 21 +++++++-------------- binding-mri/chroma-binding.cpp | 18 +++++++++--------- binding-mri/filesystem-binding.cpp | 14 ++++++++------ 6 files changed, 32 insertions(+), 43 deletions(-) diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 7e62bfd..6d4a474 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -232,7 +232,7 @@ RB_METHOD(mkxpMouseInWindow){ } static VALUE rgssMainCb(VALUE block){ - printf("[rgssMainCb] \n"); + printf("[rgssMainCb] ...my home is calling, my keep going, no more stolling...\n"); rb_funcall2(block, rb_intern("call"), 0, 0); return Qnil; } @@ -251,8 +251,7 @@ static void processReset(){ shState->audio().reset(); shState->rtData().rqReset.clear(); - shState->graphics().repaintWait(shState->rtData().rqResetFinish, - false); + shState->graphics().repaintWait(shState->rtData().rqResetFinish, false); } static VALUE rgssMainCb_wrapper(VALUE data){ return rgssMainCb(data); } diff --git a/binding-mri/binding-util.cpp b/binding-mri/binding-util.cpp index 99975c7..91426a3 100644 --- a/binding-mri/binding-util.cpp +++ b/binding-mri/binding-util.cpp @@ -115,8 +115,7 @@ int rb_get_args(int argc, VALUE *argv, const char *format, ...){ if (argI >= argc) break; - switch (c) - { + switch (c){ case 'o' : { if (argI >= argc) @@ -257,10 +256,8 @@ int rb_get_args(int argc, VALUE *argv, const char *format, ...){ * the stack to check for RB_ARG_END */ format--; - while ((c = *format++)) - { - switch (c) - { + while ((c = *format++)){ + switch (c){ case 'o' : case 'S' : va_arg(ap, VALUE*); diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index fc6add9..823f43a 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -298,8 +298,7 @@ static inline void rb_define_class_method(VALUE klass, const char *name, RubyMet rb_define_singleton_method(klass, name, RUBY_METHOD_FUNC(func), -1); } -static inline void -_rb_define_module_function(VALUE module, const char *name, RubyMethod func){ +static inline void _rb_define_module_function(VALUE module, const char *name, RubyMethod func){ rb_define_module_function(module, name, RUBY_METHOD_FUNC(func), -1); } @@ -335,8 +334,7 @@ static inline VALUE objectLoad(int argc, VALUE *argv, VALUE self) { return obj; } -static inline VALUE -rb_bool_new(bool value){ +static inline VALUE rb_bool_new(bool value){ return value ? Qtrue : Qfalse; } @@ -358,7 +356,7 @@ inline void rb_float_arg(VALUE arg, double *out, int argPos = 0) { inline void rb_int_arg(VALUE arg, int *out, int argPos = 0) { switch (rb_type(arg)) { case RUBY_T_FLOAT: - // FIXME check int range? + // TODO: int range check *out = NUM2LONG(arg); break; diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index 48680dc..b8c6207 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -54,8 +54,7 @@ RB_METHOD(bitmapInitialize){ rb_get_args(argc, argv, "z", &filename RB_ARG_END); GUARD_EXC( b = new Bitmap(filename); ) - } - else{ + }else{ int width, height; rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END); @@ -162,8 +161,7 @@ RB_METHOD(bitmapFillRect){ color = getPrivateDataCheck(colorObj, ColorType); GUARD_EXC( b->fillRect(rect->toIntRect(), color->norm); ); - } - else{ + }else{ int x, y, width, height; rb_get_args(argc, argv, "iiiio", &x, &y, &width, &height, &colorObj RB_ARG_END); @@ -245,16 +243,14 @@ RB_METHOD(bitmapDrawText){ rb_get_args(argc, argv, "oo|i", &rectObj, &strObj, &align RB_ARG_END); str = objAsStringPtr(strObj); - } - else{ + }else{ rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END); } rect = getPrivateDataCheck(rectObj, RectType); GUARD_EXC( b->drawText(rect->toIntRect(), str, align); ); - } - else{ + }else{ int x, y, width, height; if (rgssVer >= 2){ @@ -262,8 +258,7 @@ RB_METHOD(bitmapDrawText){ rb_get_args(argc, argv, "iiiio|i", &x, &y, &width, &height, &strObj, &align RB_ARG_END); str = objAsStringPtr(strObj); - } - else{ + }else{ rb_get_args(argc, argv, "iiiiz|i", &x, &y, &width, &height, &str, &align RB_ARG_END); } @@ -283,8 +278,7 @@ RB_METHOD(bitmapTextSize){ rb_get_args(argc, argv, "o", &strObj RB_ARG_END); str = objAsStringPtr(strObj); - } - else{ + }else{ rb_get_args(argc, argv, "z", &str RB_ARG_END); } @@ -317,8 +311,7 @@ RB_METHOD(bitmapGradientFillRect){ color2 = getPrivateDataCheck(color2Obj, ColorType); GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, vertical); ); - } - else{ + }else{ int x, y, width, height; rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height, diff --git a/binding-mri/chroma-binding.cpp b/binding-mri/chroma-binding.cpp index c60bd0f..4743cac 100644 --- a/binding-mri/chroma-binding.cpp +++ b/binding-mri/chroma-binding.cpp @@ -23,16 +23,16 @@ int lastAnimId = -1; void _attemptLinkSdk() { - Debug() << "[_attempLinkSdk]Attempting to bind Chroma SDK"; + Debug() << "[_attempLinkSdk] Attempting to bind Chroma SDK"; #ifdef _WIN32 hLib = LoadLibrary(L"ChromaApi.dll"); if (hLib != NULL) { - Debug() << "[_attempLinkSdk]Chroma Impl @" << hLib; + Debug() << "[_attempLinkSdk] Chroma Impl @" << hLib; INIT_SUCCESS = true; _playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation"); INIT_SUCCESS &= _playAnimation != NULL; - Debug() << "[_attempLinkSdk]Plugin method @" << reinterpret_cast(_playAnimation); + Debug() << "[_attempLinkSdk] Plugin method @" << reinterpret_cast(_playAnimation); _openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation"); INIT_SUCCESS &= _openAnimation != NULL; @@ -43,18 +43,18 @@ void _attemptLinkSdk() { _pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized"); INIT_SUCCESS &= _pluginInit != NULL; if (INIT_SUCCESS && !_pluginIsInitialized()) { - Debug() << "[_attempLinkSdk]Initializing chroma plugin"; + Debug() << "[_attempLinkSdk] Initializing chroma plugin"; _pluginInit(); } _pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit"); INIT_SUCCESS &= _pluginUninit != NULL; - Debug() << "[_attempLinkSdk]Plugin init success:" << INIT_SUCCESS; + Debug() << "[_attempLinkSdk] Plugin init success:" << INIT_SUCCESS; } #else // Currently the Razor Chroma API is Windows-only. // So, if we are not building for Windows platform, // then don't bother with Chroma stuff. - Debug() << "[_attempLinkSdk]Chroma: Unsupported Platform"; + Debug() << "[_attempLinkSdk] Chroma: Unsupported Platform"; #endif } @@ -62,16 +62,16 @@ void _attemptLinkSdk() { RB_METHOD(chromaPlayAnimation) { RB_UNUSED_PARAM; - Debug() << "[chromaPlayAnimation]Chroma: Attempting to play animation."; + Debug() << "[chromaPlayAnimation] Chroma: Attempting to play animation."; const char* animfile; bool loop; rb_get_args(argc, argv, "zb", &animfile, &loop RB_ARG_END); if (INIT_SUCCESS) { - Debug() << "[chromaPlayAnimation]Opening animation:" << animfile; + Debug() << "[chromaPlayAnimation] Opening animation:" << animfile; lastAnimId = _openAnimation(animfile); - Debug() << "[chromaPlayAnimation]ID:" << lastAnimId; + Debug() << "[chromaPlayAnimation] ID:" << lastAnimId; _playAnimation(lastAnimId); } diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index 429d805..af19548 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -50,14 +50,15 @@ VALUE fileIntForPath(const char *path, bool rubyExc){ } } catch (const Exception &e){ - if (ops) + if (ops){ printf("[fileIntForPath] Closing ops\n"); SDL_CloseIO(ops); - - if (rubyExc) - raiseRbExc(e); - else + } + if (rubyExc){ + raiseRbExc(e); } + else{ throw e; + } } VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt")); @@ -86,9 +87,10 @@ RB_METHOD(fileIntRead){ SDL_SeekIO(ops, cur, SDL_IO_SEEK_SET); } - if (length == 0) + if (length == 0){ printf("[fileIntRead] zero length\n"); return Qnil; + } VALUE data = rb_str_new(0, length); printf("[fileIntRead] data: %s\n", rb_str_to_str(data));