From 44e1edb50c983442907122436b35af9f1e4967a2 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:18:09 -0700 Subject: [PATCH] avs: make max path check stricter (#305) ## Link to GitHub Issue, if one exists n/a ## Description of change The check to warn the user about potential MAX_PATH violation should be stricter. Saw a user with 150 characters run into a crash during boot for SDVX3. ## Testing Tested paths under 130 / over 130, in both 32/64 bits. --- src/spice2x/avs/game.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/spice2x/avs/game.cpp b/src/spice2x/avs/game.cpp index 310d780..ca5c1a2 100644 --- a/src/spice2x/avs/game.cpp +++ b/src/spice2x/avs/game.cpp @@ -76,18 +76,23 @@ namespace avs { const auto dll_path_s = dll_path.string(); log_info("avs-game", "DLL path: {}", dll_path_s.c_str()); - if (MAX_PATH <= (dll_path_s.length() + 64)) { + // MAX_PATH is 260 + if (130 <= dll_path_s.length()) { log_warning( "avs-game", "PATH TOO LONG WARNING\n\n\n" "-------------------------------------------------------------------\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n" + " PATH TOO LONG \n" "WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING\n" "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" - "'{}' has a length of {}\n" - "Most of these games will behave unexpectedly when the path is too long,\n" - "often resulting in random crashes. Move the game contents to a directory\n" - "with shorter path.\n" - "-------------------------------------------------------------------\n\n\n", + "The path '{}'\n" + " has a length of {}\n" + "Most of these games may behave unexpectedly when the path is too\n" + "long, often resulting in random crashes. Move the game contents to\n" + "a directory with shorter path.\n" + "-------------------------------------------------------------------\n\n", dll_path_s, dll_path_s.length()); } if (!fileutils::file_exists(dll_path)) {