im so shitttyyyy

This commit is contained in:
ZakatTeamI2P 2026-05-15 23:56:06 +04:00
parent cc506bf087
commit c2af9b3ff9
17 changed files with 138 additions and 73 deletions

View file

@ -117,7 +117,9 @@ DEF_AUD_PROP_I(SFX_Volume)
RB_METHOD(audioReset){ RB_METHOD(audioReset){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
printf("[audioReset] Reseting audio\n"); #ifdef DEBUG
printf("[audioReset] Reseting audio\n");
#endif
shState->audio().reset(); shState->audio().reset();
return Qnil; return Qnil;

View file

@ -122,8 +122,10 @@ static void mriBindingInit(){
SunshineBindingInit(); SunshineBindingInit();
steamBindingInit(); steamBindingInit();
chromaBindingInit(); chromaBindingInit();
printf("[mriBindingInit] Done\n"); #ifdef DEBUG
printf("[mriBindingInit] RGSS version: %i\n", rgssVer); printf("[mriBindingInit] Done\n");
printf("[mriBindingInit] RGSS version: %i\n", rgssVer);
#endif
if (rgssVer >= 3){ if (rgssVer >= 3){
_rb_define_module_function(rb_mKernel, "rgss_main", mriRgssMain); _rb_define_module_function(rb_mKernel, "rgss_main", mriRgssMain);
_rb_define_module_function(rb_mKernel, "rgss_stop", mriRgssStop); _rb_define_module_function(rb_mKernel, "rgss_stop", mriRgssStop);
@ -151,13 +153,15 @@ static void mriBindingInit(){
/* Load global constants */ /* Load global constants */
rb_gv_set("MKXP", Qtrue); rb_gv_set("MKXP", Qtrue);
VALUE debug = rb_bool_new(shState->config().editor.debug); #ifdef DEBUG
if (rgssVer == 1) VALUE debug = rb_bool_new(shState->config().editor.debug);
rb_gv_set("DEBUG", debug); if (rgssVer == 1)
else if (rgssVer >= 2) rb_gv_set("DEBUG", debug);
rb_gv_set("TEST", debug); else if (rgssVer >= 2)
rb_gv_set("TEST", debug);
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest)); rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
#endif
} }
static void showMsg(const std::string &msg){ static void showMsg(const std::string &msg){
@ -248,7 +252,9 @@ static VALUE rgssMainRescue(VALUE arg, VALUE exc){
} }
static void processReset(){ static void processReset(){
printf("[processReset] reset!\n"); #ifdef DEBUG
printf("[processReset] reset!\n");
#endif
shState->graphics().reset(); shState->graphics().reset();
shState->audio().reset(); shState->audio().reset();
@ -273,7 +279,9 @@ RB_METHOD(mriRgssMain){
break; break;
if (rb_obj_class(exc) == getRbData()->exc[Reset]){ if (rb_obj_class(exc) == getRbData()->exc[Reset]){
printf("[mriRgssMain] Reset\n"); #ifdef DEBUG
printf("[mriRgssMain] Reset\n");
#endif
processReset(); processReset();
}else{ }else{
rb_exc_raise(exc); rb_exc_raise(exc);
@ -285,7 +293,9 @@ RB_METHOD(mriRgssMain){
RB_METHOD(mriRgssStop){ RB_METHOD(mriRgssStop){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
printf("[mriRgssStop] Stop\n"); #ifdef DEBUG
printf("[mriRgssStop] Stop\n");
#endif
while (true) while (true)
shState->graphics().update(); shState->graphics().update();
@ -396,12 +406,18 @@ static void runRMXPScripts(BacktraceData &btData){
} }
/* Set the debug flag */ /* Set the debug flag */
rb_gv_set("$debug", conf.debugMode ? Qtrue : Qfalse); #ifdef DEBUG
rb_gv_set("$debug", conf.debugMode ? Qtrue : Qfalse);
#else
rb_gv_set("$debug", Qfalse);
#endif
rb_gv_set("$RGSS_SCRIPTS", scriptArray); rb_gv_set("$RGSS_SCRIPTS", scriptArray);
long scriptCount = RARRAY_LEN(scriptArray); long scriptCount = RARRAY_LEN(scriptArray);
printf("[runRMXPScripts] Scripts count: %ld\n", scriptCount); #ifdef DEBUG
printf("[runRMXPScripts] Scripts count: %ld\n", scriptCount);
#endif
std::string decodeBuffer; std::string decodeBuffer;
decodeBuffer.resize(0x1000); decodeBuffer.resize(0x1000);
@ -413,8 +429,11 @@ static void runRMXPScripts(BacktraceData &btData){
VALUE scriptName = rb_ary_entry(script, 1); VALUE scriptName = rb_ary_entry(script, 1);
VALUE scriptString = rb_ary_entry(script, 2); VALUE scriptString = rb_ary_entry(script, 2);
//printf("[runRMXPScripts] Script Name: %s\n", RSTRING_PTR(scriptName));
#ifdef DEBUG
printf("[runRMXPScripts] Script Name: %s\n", RSTRING_PTR(scriptName));
#endif
int result = Z_OK; int result = Z_OK;
unsigned long bufferLen; unsigned long bufferLen;
@ -575,14 +594,17 @@ static void mriBindingExecute(){
BacktraceData btData; BacktraceData btData;
mriBindingInit(); mriBindingInit();
printf("[mriBindingExecute] run RMXP Scripts\n"); #ifdef DEBUG
printf("[mriBindingExecute] run RMXP Scripts\n");
#endif
runRMXPScripts(btData); runRMXPScripts(btData);
VALUE exc = rb_errinfo(); VALUE exc = rb_errinfo();
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit)) if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
showExc(exc, btData); showExc(exc, btData);
#ifdef DEBUG
printf("[mirBindingExecure] Ruby cleanup\n"); printf("[mirBindingExecure] Ruby cleanup\n");
#endif
ruby_cleanup(0); ruby_cleanup(0);
shState->rtData().rqTermAck.set(); shState->rtData().rqTermAck.set();
@ -597,7 +619,9 @@ static void mriBindingTerminate(){
} }
static void mriBindingReset(){ static void mriBindingReset(){
printf("[mriBindingReset] Binding reset...\n"); #ifdef DEBUG
printf("[mriBindingReset] Binding reset...\n");
#endif
rb_raise(getRbData()->exc[Reset], " "); rb_raise(getRbData()->exc[Reset], " ");
} }

View file

@ -68,8 +68,8 @@ RB_METHOD(chromaPlayAnimation) {
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;
lastAnimId = _openAnimation(animfile); lastAnimId = _openAnimation(animfile);
Debug() << "[chromaPlayAnimation] Opening animation:" << animfile;
Debug() << "[chromaPlayAnimation] ID:" << lastAnimId; Debug() << "[chromaPlayAnimation] ID:" << lastAnimId;
_playAnimation(lastAnimId); _playAnimation(lastAnimId);
} }

View file

@ -87,6 +87,7 @@ RB_METHOD(disposableIsDisposed){
template<class C> template<class C>
static void disposableBindingInit(VALUE klass){ static void disposableBindingInit(VALUE klass){
printf("[disposableBindingInit] Initialing disposable binding\n");
_rb_define_method(klass, "dispose", disposableDispose<C>); _rb_define_method(klass, "dispose", disposableDispose<C>);
_rb_define_method(klass, "disposed?", disposableIsDisposed<C>); _rb_define_method(klass, "disposed?", disposableIsDisposed<C>);

View file

@ -31,17 +31,23 @@
void fileIntFreeInstance(void *inst){ void fileIntFreeInstance(void *inst){
SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst); SDL_IOStream *ops = static_cast<SDL_IOStream*>(inst);
printf("[fileIntFreeInstance] Closing ops\n"); #ifdef DEBUG
printf("[fileIntFreeInstance] Closing ops\n");
#endif
SDL_CloseIO(ops); SDL_CloseIO(ops);
} }
DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance); DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
VALUE fileIntForPath(const char *path, bool rubyExc){ VALUE fileIntForPath(const char *path, bool rubyExc){
printf("[fileIntForPath] %s!\n", path); #ifdef DEBUG
printf("[fileIntForPath] %s!\n", path);
#endif
SDL_IOStream* ops = nullptr; SDL_IOStream* ops = nullptr;
ops = SDL_IOFromFile(path, "r"); ops = SDL_IOFromFile(path, "r");
if (!ops){ if (!ops){
printf("[fileIntForPath] Failed to open file: %s\n", path); #ifdef DEBUG
printf("[fileIntForPath] Failed to open file: %s\n", path);
#endif
if (rubyExc) { if (rubyExc) {
rb_raise(rb_eIOError, "Cannot open file: %s", path); rb_raise(rb_eIOError, "Cannot open file: %s", path);
} }
@ -65,7 +71,9 @@ RB_METHOD(fileIntRead){
} }
if (length == 0){ if (length == 0){
printf("[fileIntRead] zero length\n"); #ifdef DEBUG
printf("[fileIntRead] zero length\n");
#endif
return Qnil; return Qnil;
} }
@ -79,11 +87,14 @@ RB_METHOD(fileIntRead){
RB_NA_METHOD(fileIntClose){ RB_NA_METHOD(fileIntClose){
SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self); SDL_IOStream *ops = getPrivateData<SDL_IOStream>(self);
if (!ops){ if (!ops){
printf("[fileIntClose] Already closed or null\n"); #ifdef DEBUG
printf("[fileIntClose] Already closed or null\n");
#endif
return Qnil; return Qnil;
} }
#ifdef DEBUG
printf("[fileIntClose] Closing ops\n"); printf("[fileIntClose] Closing ops\n");
#endif
SDL_CloseIO(ops); SDL_CloseIO(ops);
setPrivateData(self, nullptr); setPrivateData(self, nullptr);
@ -108,15 +119,18 @@ VALUE load_protect(VALUE marsh_and_port) {
} }
VALUE kernelLoadDataInt(const char *filename, bool rubyExc){ VALUE kernelLoadDataInt(const char *filename, bool rubyExc){
printf("[kernelLoadDataInt] Filename: %s\n", filename); #ifdef DEBUG
printf("[kernelLoadDataInt] Filename: %s\n", filename);
#endif
VALUE port = fileIntForPath(filename, rubyExc); VALUE port = fileIntForPath(filename, rubyExc);
if (NIL_P(port)) return Qnil; if (NIL_P(port)) return Qnil;
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
VALUE args[2] = { marsh, port }; VALUE args[2] = { marsh, port };
int state = 0; int state = 0;
VALUE result = rb_protect(load_protect, (VALUE)args, &state); VALUE result = rb_protect(load_protect, (VALUE)args, &state);
printf("[kernelLoadDataInt] State %d\n", state); #ifdef DEBUG
printf("[kernelLoadDataInt] State %d\n", state);
#endif
rb_funcallv(port, rb_intern("close"), 0, NULL); rb_funcallv(port, rb_intern("close"), 0, NULL);
@ -139,7 +153,9 @@ RB_METHOD(kernelLoadData){
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
const char *filename; const char *filename;
rb_get_args(argc, argv, "z", &filename); rb_get_args(argc, argv, "z", &filename);
printf("[kernelLoadData] filename: %s\n", filename); #ifdef DEBUG
printf("[kernelLoadData] filename: %s\n", filename);
#endif
return kernelLoadDataInt(filename, true); return kernelLoadDataInt(filename, true);
} }
@ -150,14 +166,18 @@ RB_METHOD(kernelSaveData){
VALUE filename; VALUE filename;
rb_get_args(argc, argv, "oS", &obj, &filename); rb_get_args(argc, argv, "oS", &obj, &filename);
printf("[kernelSaveData] Filename: %s\n", rb_str_to_str(filename)); #ifdef DEBUG
printf("[kernelSaveData] Filename: %s\n", rb_str_to_str(filename));
#endif
VALUE file = rb_file_open_str(filename, "wb"); VALUE file = rb_file_open_str(filename, "wb");
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));
VALUE v[] = { obj, file }; VALUE v[] = { obj, file };
rb_funcall2(marsh, rb_intern("dump"), ARRAY_SIZE(v), v); rb_funcall2(marsh, rb_intern("dump"), ARRAY_SIZE(v), v);
printf("[kernelSaveData] Closing file %s\n", rb_str_to_str(filename)); #ifdef DEBUG
printf("[kernelSaveData] Closing file %s\n", rb_str_to_str(filename));
#endif
rb_io_close(file); rb_io_close(file);
return Qnil; return Qnil;

View file

@ -62,6 +62,7 @@ RB_METHOD(flashableUpdate){
template<class C> template<class C>
static void flashableBindingInit(VALUE klass){ static void flashableBindingInit(VALUE klass){
printf("[flashableBindingInit] Initializing Flashable binding\n");
_rb_define_method(klass, "flash", flashableFlash<C>); _rb_define_method(klass, "flash", flashableFlash<C>);
_rb_define_method(klass, "update", flashableUpdate<C>); _rb_define_method(klass, "update", flashableUpdate<C>);
} }

View file

@ -76,7 +76,9 @@ int server_thread(void *data){
active = true; active = true;
if (message_len > 0){ if (message_len > 0){
if (write(out_pipe, (char*)message_buffer, message_len) == -1){ if (write(out_pipe, (char*)message_buffer, message_len) == -1){
Debug() << "[journal-binding>server_thread()]Failure writing to journal's pipe!"; #ifdef DEBUG
Debug() << "[journal-binding>server_thread()]Failure writing to journal's pipe!";
#endif
} }
} }
SDL_UnlockMutex(mutex); SDL_UnlockMutex(mutex);
@ -85,8 +87,7 @@ int server_thread(void *data){
#endif #endif
} }
RB_METHOD(journalSet) RB_METHOD(journalSet){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
const char *name; const char *name;
rb_get_args(argc, argv, "z", &name RB_ARG_END); rb_get_args(argc, argv, "z", &name RB_ARG_END);
@ -144,8 +145,7 @@ RB_METHOD(journalSet)
return Qnil; return Qnil;
} }
RB_METHOD(journalSetLang) RB_METHOD(journalSetLang){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
const char *lang; const char *lang;
rb_get_args(argc, argv, "z", &lang RB_ARG_END); rb_get_args(argc, argv, "z", &lang RB_ARG_END);
@ -154,8 +154,7 @@ RB_METHOD(journalSetLang)
return Qnil; return Qnil;
} }
RB_METHOD(journalActive) RB_METHOD(journalActive){
{
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return active ? Qtrue : Qfalse; return active ? Qtrue : Qfalse;
} }

View file

@ -74,8 +74,8 @@ RB_METHOD(sceneElementSetVisible){
} }
template<class C> template<class C>
void void sceneElementBindingInit(VALUE klass){
sceneElementBindingInit(VALUE klass){ printf("[sceneElementBindingInit] Initialing SceneElement binding\n");
_rb_define_method(klass, "z", sceneElementGetZ<C>); _rb_define_method(klass, "z", sceneElementGetZ<C>);
_rb_define_method(klass, "z=", sceneElementSetZ<C>); _rb_define_method(klass, "z=", sceneElementSetZ<C>);
_rb_define_method(klass, "visible", sceneElementGetVisible<C>); _rb_define_method(klass, "visible", sceneElementGetVisible<C>);

View file

@ -41,8 +41,8 @@ serializableDump(int, VALUE *, VALUE self){
} }
template<class C> template<class C>
void void serializableBindingInit(VALUE klass){
serializableBindingInit(VALUE klass){ printf("[serializableBindingInit] Initialing Binding binding\n");
_rb_define_method(klass, "_dump", serializableDump<C>); _rb_define_method(klass, "_dump", serializableDump<C>);
} }

View file

@ -34,7 +34,9 @@ void SunshineBindingInit(){
rb_const_set(module, rb_intern("SDLVersion_major"), INT2NUM(SDL_MAJOR_VERSION)); rb_const_set(module, rb_intern("SDLVersion_major"), INT2NUM(SDL_MAJOR_VERSION));
rb_const_set(module, rb_intern("SDLVersion_minor"), INT2NUM(SDL_MINOR_VERSION)); rb_const_set(module, rb_intern("SDLVersion_minor"), INT2NUM(SDL_MINOR_VERSION));
rb_const_set(module, rb_intern("SDLVersion_micro"), INT2NUM(SDL_MICRO_VERSION)); rb_const_set(module, rb_intern("SDLVersion_micro"), INT2NUM(SDL_MICRO_VERSION));
printf("[SunshineBindingInit] SDL version: %i.%i.%i\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION); #ifdef DEBUG
printf("[SunshineBindingInit] SDL version: %i.%i.%i\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
#endif
//если методы доступны то просто не перезаписываем их //если методы доступны то просто не перезаписываем их
if (!rb_respond_to(rb_cObject, rb_intern("class"))) { if (!rb_respond_to(rb_cObject, rb_intern("class"))) {
rb_define_method(rb_cObject, "class", rb_obj_class, 0); rb_define_method(rb_cObject, "class", rb_obj_class, 0);

View file

@ -86,6 +86,7 @@ static C *viewportElementInitialize(int argc, VALUE *argv, VALUE self){
template<class C> template<class C>
void viewportElementBindingInit(VALUE klass){ void viewportElementBindingInit(VALUE klass){
printf("[viewportElementBindingInit] Initialing Viewport Element binding\n");
sceneElementBindingInit<C>(klass); sceneElementBindingInit<C>(klass);
_rb_define_method(klass, "viewport", viewportElementGetViewport<C>); _rb_define_method(klass, "viewport", viewportElementGetViewport<C>);

View file

@ -63,16 +63,22 @@
void desktopEnvironmentInit(){ void desktopEnvironmentInit(){
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n"); printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
if (desktop != "uninitialized") { if (desktop != "uninitialized") {
#ifdef DEBUG
printf("[desktopEnvironmentInit] Running on standalone Window Manager?Trying identify configuration...\n"); printf("[desktopEnvironmentInit] Running on standalone Window Manager?Trying identify configuration...\n");
#endif
// If Nitrogen wallpaper manager and feh is aviable we can just use nitrogen --restore command and feh --bg-scale:P // If Nitrogen wallpaper manager and feh is aviable we can just use nitrogen --restore command and feh --bg-scale:P
if (FILE *file = fopen("/usr/bin/nitrogen", "r")){ if (FILE *file = fopen("/usr/bin/nitrogen", "r")){
IsNitrogen = true; IsNitrogen = true;
printf("[desktopEnvironmentInit] Nitrogen wallpaper manager detected!I will try to use it...\n"); #ifdef DEBUG
printf("[desktopEnvironmentInit] Nitrogen wallpaper manager detected!I will try to use it...\n");
#endif
fclose(file); fclose(file);
}else{ fclose(file); } }else{ fclose(file); }
if (FILE *file = fopen("/usr/bin/feh", "r")) { if (FILE *file = fopen("/usr/bin/feh", "r")) {
IsFeh = true; IsFeh = true;
printf("[desktopEnvironmentInit] Feh detected!I will try to use it...\n"); #ifdef DEBUG
printf("[desktopEnvironmentInit] Feh detected!I will try to use it...\n");
#endif
fclose(file); fclose(file);
} else{ fclose(file); } } else{ fclose(file); }
if(!IsNitrogen && !IsFeh){ if(!IsNitrogen && !IsFeh){
@ -192,7 +198,9 @@ RB_METHOD(wallpaperSet){
std::string path; std::string path;
#ifdef _WIN32 #ifdef _WIN32
path = shState->config().gameFolder + "\\Wallpaper\\" + name + ".bmp"; path = shState->config().gameFolder + "\\Wallpaper\\" + name + ".bmp";
Debug() << "[wallpaperSet] Setting wallpaper to " << path; #ifdef DEBUG
Debug() << "[wallpaperSet] Setting wallpaper to " << path;
#endif
// Crapify the slashes // Crapify the slashes
size_t index = 0; size_t index = 0;
for (;;) { for (;;) {
@ -266,8 +274,9 @@ end:
nameFix.replace(nameFix.end()-3, nameFix.end(), "unix"); nameFix.replace(nameFix.end()-3, nameFix.end(), "unix");
} }
path = "/Wallpaper/" + nameFix + ".png"; path = "/Wallpaper/" + nameFix + ".png";
#ifdef DEBUG
Debug() << "[wallpaperSet] Setting wallpaper to " << path; Debug() << "[wallpaperSet] Setting wallpaper to " << path;
#endif
#ifdef __APPLE__ #ifdef __APPLE__
if (!isCached) { if (!isCached) {
@ -363,9 +372,11 @@ end:
"\"]);" << "\"]);" <<
"}" << "}" <<
"'"; "'";
Debug() << "[wallpaperSet] Wallpaper command:" << command.str();
int result = system(command.str().c_str()); int result = system(command.str().c_str());
Debug() << "[wallpaperSet ] Result:" << result; #ifdef DEBUG
Debug() << "[wallpaperSet] Wallpaper command:" << command.str();
Debug() << "[wallpaperSet ] Result:" << result;
#endif
} else if (IsFeh == true) { } else if (IsFeh == true) {
//path //path
printf("[wallpaperSet] Trying set wallpapers via feh\n"); printf("[wallpaperSet] Trying set wallpapers via feh\n");
@ -492,14 +503,18 @@ RB_METHOD(wallpaperReset){
"}" << "}" <<
"}" << "}" <<
"'"; "'";
Debug() << "[wallpaperReset] Reset wallpaper command:" << command.str();
int result = system(command.str().c_str()); int result = system(command.str().c_str());
Debug() << "[wallpaperReset] Reset result:" << result; #ifdef DEBUG
Debug() << "[wallpaperReset] Reset wallpaper command:" << command.str();
Debug() << "[wallpaperReset] Reset result:" << result;
#endif
} else if (IsNitrogen == true){ } else if (IsNitrogen == true){
system("nitrogen --restore"); system("nitrogen --restore");
} else { } else {
if (remove(fallbackPath.c_str()) != 0) { if (remove(fallbackPath.c_str()) != 0) {
Debug() << "[wallpaperReset] Failed to delete:" << fallbackPath; #ifdef DEBUG
Debug() << "[wallpaperReset] Failed to delete:" << fallbackPath;
#endif
} }
} }
#endif #endif
@ -508,6 +523,7 @@ RB_METHOD(wallpaperReset){
} }
void wallpaperBindingInit(){ void wallpaperBindingInit(){
printf("[wallpaperBindingInit] Initialing Wallpaper binding\n");
VALUE module = rb_define_module("Wallpaper"); VALUE module = rb_define_module("Wallpaper");
// Functions // Functions

View file

@ -27,7 +27,9 @@
DEF_TYPE(Window); DEF_TYPE(Window);
RB_METHOD(windowInitialize){ RB_METHOD(windowInitialize){
printf("[windowInitialize] Creating window\n"); #ifdef DEBUG
printf("[windowInitialize] Creating window\n");
#endif
Window *w = viewportElementInitialize<Window>(argc, argv, self); Window *w = viewportElementInitialize<Window>(argc, argv, self);
setPrivateData(self, w); setPrivateData(self, w);

View file

@ -73,7 +73,7 @@ class Scene_Title
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit")) @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
#Debug info like in minecraft Forge :P #Debug info like in minecraft Forge :P
@menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}")) @menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}"))
@menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL#{SDLVer}")) @menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL #{SDLVer}"))
if $game_switches[160] && $game_switches[152] if $game_switches[160] && $game_switches[152]
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("...")) @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
end end
@ -138,7 +138,7 @@ class Scene_Title
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings")) @menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit")) @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
@menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}")) @menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}"))
@menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL#{SDLVer}")) @menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL #{SDLVer}"))
if $game_switches[160] && $game_switches[152] if $game_switches[160] && $game_switches[152]
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("...")) @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
end end

View file

@ -117,7 +117,8 @@ int rgssThreadFun(void *userdata){
bool vsync = conf.vsync || conf.syncToRefreshrate; bool vsync = conf.vsync || conf.syncToRefreshrate;
SDL_GL_SetSwapInterval(vsync ? 1 : 0); SDL_GL_SetSwapInterval(vsync ? 1 : 0);
SDL_SetHint(SDL_HINT_RENDER_VSYNC, vsync ? 1 : 0); if (vsync)
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
#ifndef NDEBUG #ifndef NDEBUG
GLDebugLogger dLogger; GLDebugLogger dLogger;
@ -222,7 +223,9 @@ int main(int argc, char *argv[]){
SDL_SetHint(SDL_HINT_APP_NAME, "Oneshot: Sunshine"); SDL_SetHint(SDL_HINT_APP_NAME, "Oneshot: Sunshine");
SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME, "Oneshot: sunshine"); SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME, "Oneshot: sunshine");
SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_ROLE, "Game"); SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_ROLE, "Game");
SDL_SetHint(SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, "1"); #if defined(__linux__) && SDL_VERSION_ATLEAST(3, 4, 10)
SDL_SetHint(SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, "1");
#endif
//X11 work on *BSD,Solaris too! //X11 work on *BSD,Solaris too!
#if defined(__linux__) || defined(BSD) || defined(__sun) #if defined(__linux__) || defined(BSD) || defined(__sun)
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");

View file

@ -812,16 +812,14 @@ struct TilemapPrivate {
void prepareZLayerBatches(){ void prepareZLayerBatches(){
ZLayer *const *zlayers = elem.zlayers; ZLayer *const *zlayers = elem.zlayers;
for (size_t i = 0; i < elem.activeLayers; ++i) for (size_t i = 0; i < elem.activeLayers; ++i){
{
ZLayer *batchHead = zlayers[i]; ZLayer *batchHead = zlayers[i];
batchHead->batchedFlag = false; batchHead->batchedFlag = false;
GLsizei vboBatchCount = batchHead->vboCount; GLsizei vboBatchCount = batchHead->vboCount;
IntruListLink<SceneElement> *iter = &batchHead->link; IntruListLink<SceneElement> *iter = &batchHead->link;
for (i = i+1; i < elem.activeLayers; ++i) for (i = i+1; i < elem.activeLayers; ++i){
{
iter = iter->next; iter = iter->next;
ZLayer *layer = zlayers[i]; ZLayer *layer = zlayers[i];
@ -844,8 +842,7 @@ struct TilemapPrivate {
const Vec2i combOrigin = origin + elem.sceneGeo.orig; const Vec2i combOrigin = origin + elem.sceneGeo.orig;
const Vec2i mvpPos = getTilePos(combOrigin); const Vec2i mvpPos = getTilePos(combOrigin);
if (mvpPos != viewpPos) if (mvpPos != viewpPos){
{
viewpPos = mvpPos; viewpPos = mvpPos;
buffersDirty = true; buffersDirty = true;
updateFlashMapViewport(); updateFlashMapViewport();

View file

@ -120,8 +120,7 @@ struct QuadChunk {
: vert(0), count(0) : vert(0), count(0)
{} {}
void setAlpha(float value) void setAlpha(float value){
{
for (int i = 0; i < count*4; ++i) for (int i = 0; i < count*4; ++i)
vert[i].color.w = value; vert[i].color.w = value;
} }
@ -614,8 +613,7 @@ struct WindowPrivate {
void updateControls(){ void updateControls(){
bool updateArray = false; bool updateArray = false;
if (active && cursorVert.vert) if (active && cursorVert.vert){
{
float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0f; float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0f;
cursorVert.setAlpha(alpha); cursorVert.setAlpha(alpha);
@ -623,8 +621,7 @@ struct WindowPrivate {
updateArray = true; updateArray = true;
} }
if (pause && pauseAniVert.vert) if (pause && pauseAniVert.vert){
{
float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0f; float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0f;
FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]]; FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]];