Fixes for stupid changes

This commit is contained in:
DepressedTWM 2026-05-01 06:10:53 -04:00
parent f89abcc19d
commit c90326ffbd
6 changed files with 32 additions and 43 deletions

View File

@ -232,7 +232,7 @@ RB_METHOD(mkxpMouseInWindow){
} }
static VALUE rgssMainCb(VALUE block){ 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); rb_funcall2(block, rb_intern("call"), 0, 0);
return Qnil; return Qnil;
} }
@ -251,8 +251,7 @@ static void processReset(){
shState->audio().reset(); shState->audio().reset();
shState->rtData().rqReset.clear(); shState->rtData().rqReset.clear();
shState->graphics().repaintWait(shState->rtData().rqResetFinish, shState->graphics().repaintWait(shState->rtData().rqResetFinish, false);
false);
} }
static VALUE rgssMainCb_wrapper(VALUE data){ return rgssMainCb(data); } static VALUE rgssMainCb_wrapper(VALUE data){ return rgssMainCb(data); }

View File

@ -115,8 +115,7 @@ int rb_get_args(int argc, VALUE *argv, const char *format, ...){
if (argI >= argc) if (argI >= argc)
break; break;
switch (c) switch (c){
{
case 'o' : case 'o' :
{ {
if (argI >= argc) 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 */ * the stack to check for RB_ARG_END */
format--; format--;
while ((c = *format++)) while ((c = *format++)){
{ switch (c){
switch (c)
{
case 'o' : case 'o' :
case 'S' : case 'S' :
va_arg(ap, VALUE*); va_arg(ap, VALUE*);

View File

@ -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); rb_define_singleton_method(klass, name, RUBY_METHOD_FUNC(func), -1);
} }
static inline void static inline void _rb_define_module_function(VALUE module, const char *name, RubyMethod func){
_rb_define_module_function(VALUE module, const char *name, RubyMethod func){
rb_define_module_function(module, name, RUBY_METHOD_FUNC(func), -1); 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; return obj;
} }
static inline VALUE static inline VALUE rb_bool_new(bool value){
rb_bool_new(bool value){
return value ? Qtrue : Qfalse; 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) { inline void rb_int_arg(VALUE arg, int *out, int argPos = 0) {
switch (rb_type(arg)) { switch (rb_type(arg)) {
case RUBY_T_FLOAT: case RUBY_T_FLOAT:
// FIXME check int range? // TODO: int range check
*out = NUM2LONG(arg); *out = NUM2LONG(arg);
break; break;

View File

@ -54,8 +54,7 @@ RB_METHOD(bitmapInitialize){
rb_get_args(argc, argv, "z", &filename RB_ARG_END); rb_get_args(argc, argv, "z", &filename RB_ARG_END);
GUARD_EXC( b = new Bitmap(filename); ) GUARD_EXC( b = new Bitmap(filename); )
} }else{
else{
int width, height; int width, height;
rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END); rb_get_args(argc, argv, "ii", &width, &height RB_ARG_END);
@ -162,8 +161,7 @@ RB_METHOD(bitmapFillRect){
color = getPrivateDataCheck<Color>(colorObj, ColorType); color = getPrivateDataCheck<Color>(colorObj, ColorType);
GUARD_EXC( b->fillRect(rect->toIntRect(), color->norm); ); GUARD_EXC( b->fillRect(rect->toIntRect(), color->norm); );
} }else{
else{
int x, y, width, height; int x, y, width, height;
rb_get_args(argc, argv, "iiiio", &x, &y, &width, &height, &colorObj RB_ARG_END); 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); rb_get_args(argc, argv, "oo|i", &rectObj, &strObj, &align RB_ARG_END);
str = objAsStringPtr(strObj); str = objAsStringPtr(strObj);
} }else{
else{
rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END); rb_get_args(argc, argv, "oz|i", &rectObj, &str, &align RB_ARG_END);
} }
rect = getPrivateDataCheck<Rect>(rectObj, RectType); rect = getPrivateDataCheck<Rect>(rectObj, RectType);
GUARD_EXC( b->drawText(rect->toIntRect(), str, align); ); GUARD_EXC( b->drawText(rect->toIntRect(), str, align); );
} }else{
else{
int x, y, width, height; int x, y, width, height;
if (rgssVer >= 2){ 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); rb_get_args(argc, argv, "iiiio|i", &x, &y, &width, &height, &strObj, &align RB_ARG_END);
str = objAsStringPtr(strObj); str = objAsStringPtr(strObj);
} }else{
else{
rb_get_args(argc, argv, "iiiiz|i", &x, &y, &width, &height, &str, &align RB_ARG_END); 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); rb_get_args(argc, argv, "o", &strObj RB_ARG_END);
str = objAsStringPtr(strObj); str = objAsStringPtr(strObj);
} }else{
else{
rb_get_args(argc, argv, "z", &str RB_ARG_END); rb_get_args(argc, argv, "z", &str RB_ARG_END);
} }
@ -317,8 +311,7 @@ RB_METHOD(bitmapGradientFillRect){
color2 = getPrivateDataCheck<Color>(color2Obj, ColorType); color2 = getPrivateDataCheck<Color>(color2Obj, ColorType);
GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, vertical); ); GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, vertical); );
} }else{
else{
int x, y, width, height; int x, y, width, height;
rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height, rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height,

View File

@ -23,16 +23,16 @@ int lastAnimId = -1;
void _attemptLinkSdk() { void _attemptLinkSdk() {
Debug() << "[_attempLinkSdk]Attempting to bind Chroma SDK"; Debug() << "[_attempLinkSdk] Attempting to bind Chroma SDK";
#ifdef _WIN32 #ifdef _WIN32
hLib = LoadLibrary(L"ChromaApi.dll"); hLib = LoadLibrary(L"ChromaApi.dll");
if (hLib != NULL) { if (hLib != NULL) {
Debug() << "[_attempLinkSdk]Chroma Impl @" << hLib; Debug() << "[_attempLinkSdk] Chroma Impl @" << hLib;
INIT_SUCCESS = true; INIT_SUCCESS = true;
_playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation"); _playAnimation = (PluginPlayAnimation) GetProcAddress(hLib, "PluginPlayAnimation");
INIT_SUCCESS &= _playAnimation != NULL; INIT_SUCCESS &= _playAnimation != NULL;
Debug() << "[_attempLinkSdk]Plugin method @" << reinterpret_cast<void*>(_playAnimation); Debug() << "[_attempLinkSdk] Plugin method @" << reinterpret_cast<void*>(_playAnimation);
_openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation"); _openAnimation = (PluginOpenAnimation) GetProcAddress(hLib, "PluginOpenAnimation");
INIT_SUCCESS &= _openAnimation != NULL; INIT_SUCCESS &= _openAnimation != NULL;
@ -43,18 +43,18 @@ void _attemptLinkSdk() {
_pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized"); _pluginIsInitialized = (PluginIsInitialized) GetProcAddress(hLib, "PluginIsInitialized");
INIT_SUCCESS &= _pluginInit != NULL; INIT_SUCCESS &= _pluginInit != NULL;
if (INIT_SUCCESS && !_pluginIsInitialized()) { if (INIT_SUCCESS && !_pluginIsInitialized()) {
Debug() << "[_attempLinkSdk]Initializing chroma plugin"; Debug() << "[_attempLinkSdk] Initializing chroma plugin";
_pluginInit(); _pluginInit();
} }
_pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit"); _pluginUninit = (PluginUninit) GetProcAddress(hLib, "PluginUninit");
INIT_SUCCESS &= _pluginUninit != NULL; INIT_SUCCESS &= _pluginUninit != NULL;
Debug() << "[_attempLinkSdk]Plugin init success:" << INIT_SUCCESS; Debug() << "[_attempLinkSdk] Plugin init success:" << INIT_SUCCESS;
} }
#else #else
// Currently the Razor Chroma API is Windows-only. // Currently the Razor Chroma API is Windows-only.
// So, if we are not building for Windows platform, // So, if we are not building for Windows platform,
// then don't bother with Chroma stuff. // then don't bother with Chroma stuff.
Debug() << "[_attempLinkSdk]Chroma: Unsupported Platform"; Debug() << "[_attempLinkSdk] Chroma: Unsupported Platform";
#endif #endif
} }
@ -62,16 +62,16 @@ void _attemptLinkSdk() {
RB_METHOD(chromaPlayAnimation) { RB_METHOD(chromaPlayAnimation) {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
Debug() << "[chromaPlayAnimation]Chroma: Attempting to play animation."; Debug() << "[chromaPlayAnimation] Chroma: Attempting to play animation.";
const char* animfile; const char* animfile;
bool loop; bool loop;
rb_get_args(argc, argv, "zb", &animfile, &loop RB_ARG_END); rb_get_args(argc, argv, "zb", &animfile, &loop RB_ARG_END);
if (INIT_SUCCESS) { if (INIT_SUCCESS) {
Debug() << "[chromaPlayAnimation]Opening animation:" << animfile; Debug() << "[chromaPlayAnimation] Opening animation:" << animfile;
lastAnimId = _openAnimation(animfile); lastAnimId = _openAnimation(animfile);
Debug() << "[chromaPlayAnimation]ID:" << lastAnimId; Debug() << "[chromaPlayAnimation] ID:" << lastAnimId;
_playAnimation(lastAnimId); _playAnimation(lastAnimId);
} }

View File

@ -50,15 +50,16 @@ VALUE fileIntForPath(const char *path, bool rubyExc){
} }
} }
catch (const Exception &e){ catch (const Exception &e){
if (ops) if (ops){
printf("[fileIntForPath] Closing ops\n"); printf("[fileIntForPath] Closing ops\n");
SDL_CloseIO(ops); SDL_CloseIO(ops);
}
if (rubyExc) if (rubyExc){
raiseRbExc(e); raiseRbExc(e); }
else else{
throw e; throw e;
} }
}
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt")); 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); SDL_SeekIO(ops, cur, SDL_IO_SEEK_SET);
} }
if (length == 0) if (length == 0){
printf("[fileIntRead] zero length\n"); printf("[fileIntRead] zero length\n");
return Qnil; return Qnil;
}
VALUE data = rb_str_new(0, length); VALUE data = rb_str_new(0, length);
printf("[fileIntRead] data: %s\n", rb_str_to_str(data)); printf("[fileIntRead] data: %s\n", rb_str_to_str(data));