This commit is contained in:
whitecum1488 2026-08-22 21:00:37 +03:00
parent 5352c63336
commit 076ea10681
10 changed files with 36 additions and 147 deletions

View File

@ -101,7 +101,6 @@ RB_METHOD(graphicsFrameReset){
return rb_bool_new(value); \
}
RB_METHOD(graphicsPosX){
RB_UNUSED_PARAM;
return INT2FIX(shState->graphics().x());

View File

@ -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
class Float
def to_f

View File

@ -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}"

View File

@ -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
}

View File

@ -67,7 +67,7 @@ struct Config{
struct{
std::string ModsDirPath;
bool use_default_save_path;
bool skip_modloader_screen;
} Modloader;
bool useScriptNames;

View File

@ -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);

View File

@ -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";
@ -186,7 +186,7 @@ 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;
show_crash_screen = true;
//Protect against segfaults
if(is_ruby_initialized){
ruby_stop(-1);

View File

@ -7,7 +7,7 @@
inline std::vector<std::string> logs = {};
inline std::vector<std::string> 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] = "";

View File

@ -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();
}
SDL_Thread* render_thread_pointer = SDL_CreateThread(renderer_thread, "ModRenderer", win);
if (!render_thread_pointer) {
//TODO: Error handling
SDL_Thread* render_thread_pointer = NULL;
if(!conf.Modloader.skip_modloader_screen){
render_thread_pointer = SDL_CreateThread(renderer_thread, "ModRenderer", win);
}
std::vector<std::string> 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;
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());

View File

@ -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)