From eeb043e52bcf77c654531ad8f12c2c0b9fe38c76 Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Wed, 22 Jul 2026 21:17:01 +0400 Subject: [PATCH] Crashdump privacy --- CMakeLists.txt | 1 + binding-mri/sunshine-binding.cpp | 15 +++++++++++++-- binding-mri/sunshine-binding.h | 1 + scripts/Data_Settings.rb | 9 ++++++--- scripts/Data_Settings_Setters.rb | 8 ++++---- scripts/Sprite_Footprint.rb | 2 -- src/main.cpp | 8 -------- src/meow.cpp | 17 +++++++++-------- 8 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 binding-mri/sunshine-binding.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 57f28c8..541089b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,7 @@ set(BINDING_HEADERS binding-mri/flashable-binding.h binding-mri/keybindings-binding.h binding-mri/signalconnection-binding.h + binding-mri/sunshine-binding.h ) set(BINDING_SOURCE binding-mri/binding-mri.cpp diff --git a/binding-mri/sunshine-binding.cpp b/binding-mri/sunshine-binding.cpp index 8ca5842..a0274b8 100644 --- a/binding-mri/sunshine-binding.cpp +++ b/binding-mri/sunshine-binding.cpp @@ -9,8 +9,17 @@ #include "ruby/internal/intern/class.h" #include "security.h" #include "eventthread.h" -//Просто на C реализуем методы мне в падлу ебаться со статической линковкой и прочим дерьмом. -//Аминь. +#include "sunshine-binding.h" +bool is_privacy_crashdump_enabled = false; + +static VALUE sunshine_get_crash_privacy(VALUE self) { + return is_privacy_crashdump_enabled ? Qtrue : Qfalse; +} + +static VALUE sunshine_set_crash_privacy(VALUE, VALUE v) { + is_privacy_crashdump_enabled = RTEST(v); + return v; +} static VALUE obj_clone(VALUE self){ return rb_obj_clone(self); @@ -46,6 +55,8 @@ void SunshineBindingInit(){ 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("SECURITYSTATE"), rb_str_new_cstr(securitystate)); + rb_define_singleton_method(module, "crashprivacy", RUBY_METHOD_FUNC(sunshine_get_crash_privacy), 0); + rb_define_singleton_method(module, "crashprivacy=", RUBY_METHOD_FUNC(sunshine_set_crash_privacy), 1); //если методы доступны то просто не перезаписываем их if (!rb_respond_to(rb_cObject, rb_intern("class"))) { rb_define_method(rb_cObject, "class", rb_obj_class, 0); diff --git a/binding-mri/sunshine-binding.h b/binding-mri/sunshine-binding.h new file mode 100644 index 0000000..45c3f42 --- /dev/null +++ b/binding-mri/sunshine-binding.h @@ -0,0 +1 @@ +extern bool is_privacy_crashdump_enabled; diff --git a/scripts/Data_Settings.rb b/scripts/Data_Settings.rb index 0e79314..ab7eb2b 100644 --- a/scripts/Data_Settings.rb +++ b/scripts/Data_Settings.rb @@ -28,8 +28,10 @@ module Settings :true_memory_mode => false, :oneshot_mode => false, :twm_shader_footprint => true, - # Advanced + # Advanced + :crashlog_privacy => false, + #controls :gamepad_led => true, :gamepad_deadzone => 5, @@ -326,8 +328,9 @@ class Window_Settings tr("Advanced") => [ { :type => :bool, - :name => tr('useless option:3'), - :default => false + :name => tr('Crashlog privacy'), + :parameter => :crashlog_privacy + }, ], tr("Debug") => [ diff --git a/scripts/Data_Settings_Setters.rb b/scripts/Data_Settings_Setters.rb index 87518d7..58cb5ba 100644 --- a/scripts/Data_Settings_Setters.rb +++ b/scripts/Data_Settings_Setters.rb @@ -7,8 +7,11 @@ module Settings # if you do not take the value from settings directly. # name must be same as the parameter identifier + + def crashlog_privacy(value) + Sunshine.crashprivacy=value + end - # Audio def bgm_volume(value) Audio.bgm_volume = value end @@ -16,7 +19,6 @@ module Settings Audio.sfx_volume = value end - # Video def fullscreen(value) Graphics.fullscreen = $console = value end @@ -56,7 +58,6 @@ module Settings # TODO: fix languages on new ruby versions end - # Gameplay def movement(value) $game_switches[251] = value != 0 end @@ -65,7 +66,6 @@ module Settings # TODO: fix skip_text settings setter end - # Advanced def frameskip(value) Graphics.frameskip = value end diff --git a/scripts/Sprite_Footprint.rb b/scripts/Sprite_Footprint.rb index 25c8f53..fed143b 100644 --- a/scripts/Sprite_Footprint.rb +++ b/scripts/Sprite_Footprint.rb @@ -11,8 +11,6 @@ class Sprite_Footprint < Sprite self.oy = 16 self.bitmap = RPG::Cache.misc('footprints') self.src_rect.set(0, 16 * (direction / 2 - 1), 16, 16) - - self.shader = (Settings[:twm_shader] and Settings[:twm_shader_footprint]) and ($game_switches[160] or Settings[:true_memory_mode]) and (character_name.start_with?("en") or character_name.start_with?("niko")) ? Shader::WorldMachine : Shader::Sprite update end diff --git a/src/main.cpp b/src/main.cpp index b3b5dc8..c539b4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -336,10 +336,6 @@ int main(int argc, char *argv[]){ SDL_Window *win; Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS; - // #ifdef __APPLE__ - // winFlags |= SDL_WINDOW_RESIZABLE; - // #endif - win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags); if (conf.fullscreen) SDL_SetWindowFullscreen(win, true); @@ -368,10 +364,6 @@ int main(int argc, char *argv[]){ } SDL_DisplayMode mode; - /* Can't sync to display refresh rate if its value is unknown */ - //if (!mode.refresh_rate) - // conf.syncToRefreshrate = false; - EventThread eventThread; RGSSThreadData rtData(&eventThread, win, alcDev, mode.refresh_rate, conf); diff --git a/src/meow.cpp b/src/meow.cpp index 484831b..80ee9a0 100644 --- a/src/meow.cpp +++ b/src/meow.cpp @@ -25,6 +25,7 @@ #include #include #include +#include "sunshine-binding.h" #ifdef __LINUX__ #include #include "xdg-user-dir-lookup.h" @@ -120,12 +121,14 @@ void crash(Exception::Type t, const char *fmt, ...){ o << "Internal storage path: " << SDL_GetAndroidInternalStoragePath() << std::endl; o << "External Storage path: " << SDL_GetAndroidExternalStoragePath() << ats::endl; o << "Cache path: " << SDL_GetAndroidCachePath() << std::endl; - o << "Is ChromeBook? " << SDL_IsChromebook() << std::endl; - o << "Is Phone? " << SDL_IsPhone() << std::endl; - o << "Is Tablet? " << SDL_IsTablet() << std::endl; - o << "Is Samsung DeX? " << SDL_IsDeXMode() << std::endl; - o << "Is TV? " << SDL_IsTV() << std::endl; - o << "Is Ubuntu Touch? " << SDL_IsUbuntuTouch() << std::endl; + if(!is_privacy_crashdump_enabled){ + o << "Is ChromeBook? " << SDL_IsChromebook() << std::endl; + o << "Is Phone? " << SDL_IsPhone() << std::endl; + o << "Is Tablet? " << SDL_IsTablet() << std::endl; + o << "Is Samsung DeX? " << SDL_IsDeXMode() << std::endl; + o << "Is TV? " << SDL_IsTV() << std::endl; + o << "Is Ubuntu Touch? " << SDL_IsUbuntuTouch() << std::endl; + } #elif __EMSCRIPTEN__ o << "Emscripten start address of the stack: " << emscripten_stack_get_base() << std::endl; o << "Emscripten end address of the stack: " << emscripten_stack_get_end() << std::endl; @@ -135,9 +138,7 @@ void crash(Exception::Type t, const char *fmt, ...){ o << "PSPdev MIPS Stack Trace: " << int pspDebugGetStackTrace() << std::endl; #endif o << "[Hardware]" << std::endl; - o << "L1 cache line size: " << SDL_GetCPUCacheLineSize() << std::endl; o << "number of logical CPU cores: " << SDL_GetNumLogicalCPUCores() << std::endl; - //o << "System page size: " << SDL_GetSystemPageSize() << " bytes" << std::endl; o << "System RAM size: " << SDL_GetSystemRAM() << " MiB" << std::endl; o.close(); }else{