From 076ea106818e2a448df2ef924e5ddcc2a89569a6 Mon Sep 17 00:00:00 2001 From: whitecum1488 Date: Sat, 22 Aug 2026 21:00:37 +0300 Subject: [PATCH] Xuinia --- binding-mri/graphics-binding.cpp | 3 +- scripts/Main.rb | 11 +-- scripts_benchmark/Main.rb | 119 ++----------------------------- src/config.cpp | 3 +- src/config.h | 2 +- src/main.cpp | 2 +- src/meow.cpp | 8 +-- src/meow.h | 2 +- src/modloader.cpp | 27 +++---- toolchain/arch/arm.cmake | 6 +- 10 files changed, 36 insertions(+), 147 deletions(-) diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index f30047e..e22eb15 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -100,7 +100,6 @@ RB_METHOD(graphicsFrameReset){ shState->graphics().set##PropName(value); \ return rb_bool_new(value); \ } - RB_METHOD(graphicsPosX){ RB_UNUSED_PARAM; @@ -317,7 +316,7 @@ void graphicsBindingInit(){ INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" ); INIT_GRA_PROP_BIND( Smooth, "smooth" ); INIT_GRA_PROP_BIND( Frameskip, "frameskip" ); - + const Config &conf = shState->rtData().config; rb_define_const(module, "RESOLUTION_OVERRIDDEN", rb_bool_new(conf.resolutionOverridden)); } diff --git a/scripts/Main.rb b/scripts/Main.rb index d35a355..80b7a74 100644 --- a/scripts/Main.rb +++ b/scripts/Main.rb @@ -1,13 +1,4 @@ -#============================================================================== -# ** Main -#------------------------------------------------------------------------------ -# After defining each class, actual processing begins here. -#============================================================================== - -#at_exit do -# Wallpaper.reset -# save unless $game_switches[99] || ($game_system.map_interpreter.running? || !$scene.is_a?(Scene_Map)) -#end +# After defining each class, actual processing begins here. class Float def to_f diff --git a/scripts_benchmark/Main.rb b/scripts_benchmark/Main.rb index 12729bf..7799caa 100644 --- a/scripts_benchmark/Main.rb +++ b/scripts_benchmark/Main.rb @@ -1,113 +1,8 @@ -N = 5_000_000 -sink = 0 - -# 1. Цикл, арифметика и ветвления -i = 0 -while i < N - sink ^= (i * 31 + 17) % 1_000_003 - i += 1 +c = 0 +while c < 1000 + c = c + 1 + puts c + Graphics.frame_reset + Graphics.update + Font.default_size = c end - -# 2. Вызовы методов -class TestObject - def initialize(value) - @value = value - end - - def calculate(x) - ((@value + x) * 3) ^ 0x55aa - end -end - -objects = Array.new(10) { |x| TestObject.new(x) } - -i = 0 -while i < N - sink ^= objects[i % objects.length].calculate(i) - i += 1 -end - -# 3. Создание объектов и сборка мусора -i = 0 -while i < N - data = { - id: i, - name: "object_#{i}", - values: [i, i * 2, i * 3], - enabled: (i & 1) == 0 - } - - sink ^= data[:values][1] - i += 1 -end - -# 4. Строковые операции -text = "benchmark_string_" * 20 - -i = 0 -while i < N - value = "#{text}:#{i}".upcase.reverse - sink ^= value.length - i += 1 -end - -# 5. Массивы -array = Array.new(10_000) { |x| x } - -i = 0 -while i < N - array[i % array.length] = (array[i % array.length] * 31 + i) % 1_000_003 - sink ^= array[i % array.length] - i += 1 -end - -# 6. Hash lookup -hash = {} -10_000.times do |x| - hash["key_#{x}"] = x -end - -i = 0 -while i < N - sink ^= hash["key_#{i % 10_000}"] - i += 1 -end - -# 7. BigInt-арифметика -big = (1 << 100_000) + 12_345 - -200.times do - big = big * big - big %= (1 << 100_000) - 1 - sink ^= big & 0xffff -end - -# 8. Исключения -exception_count = 100_000 -i = 0 - -while i < exception_count - begin - raise RuntimeError, "benchmark error" - rescue RuntimeError - sink += 1 - end - - i += 1 -end - -# 9. clone / dup -object = { - name: "test", - values: Array.new(100, 123), - nested: { enabled: true } -} - -i = 0 -while i < N - copy = object.dup - sink ^= copy[:values].length - i += 1 -end - -puts "sink=#{sink}" diff --git a/src/config.cpp b/src/config.cpp index 68954fa..4e2a68e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -77,6 +77,7 @@ void Config::read(int argc, char *argv[]){ PO_DESC(windowTitle, std::string, "") \ PO_DESC(commonDataPath, std::string, "") \ PO_DESC(Modloader.ModsDirPath, std::string,"mods") \ + PO_DESC(Modloader.skip_modloader_screen, bool, false) \ PO_DESC(fixedFramerate, int, 0) \ PO_DESC(frameSkip, bool, true) \ PO_DESC(syncToRefreshrate, bool, false) \ @@ -91,7 +92,6 @@ void Config::read(int argc, char *argv[]){ PO_DESC(SE.sourceCount, int, 6) \ PO_DESC(pathCache, bool, true) \ PO_DESC(Windows_AllocConsole, bool, false) \ - PO_DESC(Modloader.use_default_save_path, bool, false) \ PO_DESC(pancakes, bool, false) \ PO_DESC(SecurityEngine, bool, true) \ PO_DESC(journal_address, std::string, "127.0.0.1") \ @@ -170,3 +170,4 @@ void Config::read(int argc, char *argv[]){ } #endif } + diff --git a/src/config.h b/src/config.h index d35190b..116f1ec 100644 --- a/src/config.h +++ b/src/config.h @@ -67,7 +67,7 @@ struct Config{ struct{ std::string ModsDirPath; - bool use_default_save_path; + bool skip_modloader_screen; } Modloader; bool useScriptNames; diff --git a/src/main.cpp b/src/main.cpp index 63af751..e11f907 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -340,7 +340,7 @@ int main(int argc, char *argv[]){ unloadLocale(); unloadLanguageMetadata(); - if(show_crash_sceen){ + if(show_crash_screen){ crash_screen(win); } MIX_DestroyMixer(mixer); diff --git a/src/meow.cpp b/src/meow.cpp index 8c52876..506ec6f 100644 --- a/src/meow.cpp +++ b/src/meow.cpp @@ -129,7 +129,7 @@ static void get_reason_and_solution(Exception::Type t) { break; case Exception::NoFileError: crash_reason = "Broken installation"; - crash_possible_solution = "Try reinstall game"; + crash_possible_solution = "Try reinstall game or mods if you load some mods."; break; case Exception::ShaderError: crash_reason = "Broken Shader"; @@ -185,9 +185,9 @@ void crash(Exception::Type t, const char *fmt, ...) { SDL_vsnprintf(crash_message, sizeof(crash_message), fmt, args); va_end(args); - get_reason_and_solution(t); - show_crash_sceen = true; - //Protect against segfaults + get_reason_and_solution(t); + show_crash_screen = true; + //Protect against segfaults if(is_ruby_initialized){ ruby_stop(-1); } diff --git a/src/meow.h b/src/meow.h index e99ed4f..93804d0 100644 --- a/src/meow.h +++ b/src/meow.h @@ -7,7 +7,7 @@ inline std::vector logs = {}; inline std::vector modloader_logs = {}; -inline bool show_crash_sceen = false; +inline bool show_crash_screen = false; inline bool is_privacy_crashdump_enabled = false; inline bool is_ruby_initialized = false; inline char crash_message[1024] = ""; diff --git a/src/modloader.cpp b/src/modloader.cpp index e839e3a..450ec8a 100644 --- a/src/modloader.cpp +++ b/src/modloader.cpp @@ -49,8 +49,8 @@ static int renderer_thread(void* data){ while(!stop_render){ index_on_screen = 10; SDL_SetRenderDrawColor(ren, 0, 0, 0, 255); - SDL_RenderClear(ren); - SDL_RenderTexture(ren, tex, NULL, NULL); + SDL_RenderClear(ren); + SDL_RenderTexture(ren, tex, NULL, NULL); SDL_SetRenderDrawColor(ren, 150, 100, 255, 255); std::size_t size = modloader_logs.size(); std::size_t n = std::min(static_cast(N), size); @@ -68,25 +68,24 @@ static int renderer_thread(void* data){ } void ModLoader(Config conf, SDL_Window* win){ - std::string path = "mods"; - if (!fs::exists(path) || !fs::is_directory(path)) { + if (!fs::exists(conf.Modloader.ModsDirPath) || !fs::is_directory(conf.Modloader.ModsDirPath)) { Debug() << "[MODLOADER] Mods directory not found, skip."; return; - }else if (fs::is_empty(path)) { + }else if (fs::is_empty(conf.Modloader.ModsDirPath)) { Debug() << "[MODLOADER] Mods directory empty, skip."; return; } if(conf.SecurityEngine){ - SecurityManagerInit(); + SecurityManagerInit(); + } + SDL_Thread* render_thread_pointer = NULL; + if(!conf.Modloader.skip_modloader_screen){ + render_thread_pointer = SDL_CreateThread(renderer_thread, "ModRenderer", win); } - SDL_Thread* render_thread_pointer = SDL_CreateThread(renderer_thread, "ModRenderer", win); - if (!render_thread_pointer) { - //TODO: Error handling - } std::vector mod_list = {}; try { - // 1.check if any zip(mod) file, 2. calculate sha256 hash of zip(mod) files 3.mount mod via PhysFS - for (const auto &entry : fs::directory_iterator(path, fs::directory_options::skip_permission_denied)) { + // 1.check if any zip(mod) file, 2.mount mod via PhysFS + for (const auto &entry : fs::directory_iterator(conf.Modloader.ModsDirPath, fs::directory_options::skip_permission_denied)) { std::error_code ec; auto p = entry.path(); if (!fs::is_regular_file(p, ec) || ec) continue; @@ -107,7 +106,9 @@ void ModLoader(Config conf, SDL_Window* win){ } sleep(1); stop_render = true; - SDL_WaitThread(render_thread_pointer, NULL); + if(!conf.Modloader.skip_modloader_screen){ + SDL_WaitThread(render_thread_pointer, NULL); + } modloader_is_enabled = true; } catch (const std::exception& e) { crash(Exception::ModLoaderError, "Something is wrong, Exception: %s ", e.what()); diff --git a/toolchain/arch/arm.cmake b/toolchain/arch/arm.cmake index 3249041..82db9c8 100644 --- a/toolchain/arch/arm.cmake +++ b/toolchain/arch/arm.cmake @@ -2,5 +2,7 @@ set(ARCH_COMMON "") set(ARCH_RELEASE -momit-leaf-frame-pointer -mlow-precision-recip-sqrt -mlow-precision-sqrt --mlow-precision-div) -set(ARCH_DEBUG -menable-sysreg-checking) +-mlow-precision-div +-mearly-ra=all) +set(ARCH_DEBUG -menable-sysreg-checking +-mpoke-function-name)