From f02d8a08697863b81527cea8deab875e0aed0d37 Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Wed, 20 May 2026 09:49:31 +0400 Subject: [PATCH] Memory usage optimization just bcz im bored in school --- binding-mri/audio-binding.cpp | 8 ++++---- binding-mri/binding-mri.cpp | 9 +-------- binding-mri/bitmap-binding.cpp | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/binding-mri/audio-binding.cpp b/binding-mri/audio-binding.cpp index b743c71..13ea544 100644 --- a/binding-mri/audio-binding.cpp +++ b/binding-mri/audio-binding.cpp @@ -29,8 +29,8 @@ { \ RB_UNUSED_PARAM; \ const char *filename; \ - int volume = 100; \ - int pitch = 100; \ + unsigned short volume = 100; \ + unsigned short pitch = 100; \ double pos = 0.0; \ if (rgssVer >= 3) \ rb_get_args(argc, argv, "z|iif", &filename, &volume, &pitch, &pos RB_ARG_END); \ @@ -56,8 +56,8 @@ { \ RB_UNUSED_PARAM; \ const char *filename; \ - int volume = 100; \ - int pitch = 100; \ + unsigned short volume = 100; \ + unsigned short pitch = 100; \ rb_get_args(argc, argv, "z|ii", &filename, &volume, &pitch RB_ARG_END); \ GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch); ) \ return Qnil; \ diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 712cc1c..2ec472d 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -118,10 +118,6 @@ static void mriBindingInit(){ SunshineBindingInit(); steamBindingInit(); chromaBindingInit(); - #ifdef DEBUG - printf("[mriBindingInit] Done\n"); - printf("[mriBindingInit] RGSS version: %i\n", rgssVer); - #endif _rb_define_module_function(rb_mKernel, "rgss_main", mriRgssMain); _rb_define_module_function(rb_mKernel, "rgss_stop", mriRgssStop); @@ -145,10 +141,7 @@ static void mriBindingInit(){ rb_gv_set("MKXP", Qtrue); VALUE debug = rb_bool_new(shState->config().editor.debug); - if (rgssVer == 1) - rb_gv_set("DEBUG", debug); - else if (rgssVer >= 2) - rb_gv_set("TEST", debug); + rb_gv_set("DEBUG", debug); rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest)); } diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index fd4b0c9..780c15f 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -108,7 +108,7 @@ RB_METHOD(bitmapBlt){ int x, y; VALUE srcObj; VALUE srcRectObj; - int opacity = 255; + unsigned short opacity = 255; Bitmap *src; Rect *srcRect; @@ -129,7 +129,7 @@ RB_METHOD(bitmapStretchBlt){ VALUE destRectObj; VALUE srcObj; VALUE srcRectObj; - int opacity = 255; + unsigned short opacity = 255; Bitmap *src; Rect *destRect, *srcRect;