mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Fixes for stupid changes
This commit is contained in:
parent
f89abcc19d
commit
c90326ffbd
6 changed files with 32 additions and 43 deletions
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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*);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Color>(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<Rect>(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<Color>(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,
|
||||
|
|
|
|||
|
|
@ -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<void*>(_playAnimation);
|
||||
Debug() << "[_attempLinkSdk] Plugin method @" << reinterpret_cast<void*>(_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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue