mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 14:20:42 -07:00
avs: when nvram/raw folder creation fails, show a warning message when the game eventually crashes (#383)
## Link to GitHub Issue, if one exists #345 ## Description of change When the directory specified in the mounttable (in avs-config.xml) lead to bad path, remember this and show a warning message block before the game crashes. ## Testing Tested with simulated bad mounttable set up.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "external/robin_hood.h"
|
||||
#include "launcher/logger.h"
|
||||
#include "launcher/signal.h"
|
||||
#include "util/detour.h"
|
||||
#include "util/fileutils.h"
|
||||
#include "util/libutils.h"
|
||||
@@ -1736,7 +1737,13 @@ namespace avs {
|
||||
return;
|
||||
}
|
||||
|
||||
static void create_dir(
|
||||
static void avs_dir_err(const std::filesystem::path &src_path)
|
||||
{
|
||||
launcher::signal::AVS_DIR_CREATION_FAILURE = TRUE;
|
||||
launcher::signal::AVS_SRC_PATH = src_path.string();
|
||||
}
|
||||
|
||||
static void create_avs_dir(
|
||||
const std::string_view &avs_path,
|
||||
const std::string_view &src_path)
|
||||
{
|
||||
@@ -1745,6 +1752,7 @@ namespace avs {
|
||||
auto real_path = std::filesystem::absolute(src_path, err);
|
||||
|
||||
if (err) {
|
||||
avs_dir_err(real_path);
|
||||
log_warning("avs-core", "failed to resolve '{}' path: {}", avs_path, err.message());
|
||||
return;
|
||||
}
|
||||
@@ -1754,7 +1762,9 @@ namespace avs {
|
||||
if (created) {
|
||||
log_info("avs-core", "created '{}' at '{}'", avs_path, real_path.string());
|
||||
}
|
||||
|
||||
if (err) {
|
||||
avs_dir_err(real_path);
|
||||
log_warning("avs-core", "failed to create '{}' folder at '{}': {}",
|
||||
avs_path,
|
||||
real_path.string(),
|
||||
@@ -1815,7 +1825,7 @@ namespace avs {
|
||||
return;
|
||||
}
|
||||
|
||||
create_dir(avs_path, device_path);
|
||||
create_avs_dir(avs_path, device_path);
|
||||
}
|
||||
|
||||
static void create_avs_config_fs_table(
|
||||
@@ -1870,7 +1880,7 @@ namespace avs {
|
||||
continue;
|
||||
}
|
||||
|
||||
create_dir(dst_path, src_path);
|
||||
create_avs_dir(dst_path, src_path);
|
||||
} while ((vfs_node = property_node_traversal(vfs_node, TRAVERSE_NEXT_SEARCH_RESULT)));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "signal.h"
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
|
||||
#include "avs/core.h"
|
||||
#include "acio/acio.h"
|
||||
#include "external/stackwalker/stackwalker.h"
|
||||
#include "hooks/libraryhook.h"
|
||||
@@ -32,6 +32,8 @@ namespace launcher::signal {
|
||||
|
||||
// states
|
||||
bool SUPERSTEP_SOUND_ERROR = false;
|
||||
bool AVS_DIR_CREATION_FAILURE = false;
|
||||
std::string AVS_SRC_PATH;
|
||||
}
|
||||
|
||||
#define V(variant) case variant: return #variant
|
||||
@@ -121,6 +123,18 @@ static LONG WINAPI TopLevelExceptionFilter(struct _EXCEPTION_POINTERS *Exception
|
||||
log_warning("signal", " fix your audio device, double check your audio options/patches, and try again");
|
||||
}
|
||||
|
||||
if (launcher::signal::AVS_DIR_CREATION_FAILURE) {
|
||||
log_warning("signal",
|
||||
"AVS filesystem initialization failure was previously detected during boot!");
|
||||
log_warning("signal",
|
||||
" ERROR: directory could not be created: {}",
|
||||
launcher::signal::AVS_SRC_PATH.c_str());
|
||||
log_warning("signal",
|
||||
" this crash may have been caused by bad <mounttable> contents in {}",
|
||||
avs::core::CFG_PATH.c_str());
|
||||
log_warning("signal", " fix the XML file and try again");
|
||||
}
|
||||
|
||||
// walk the exception chain
|
||||
struct _EXCEPTION_RECORD *record_cause = ExceptionRecord->ExceptionRecord;
|
||||
while (record_cause != nullptr) {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace launcher::signal {
|
||||
|
||||
// settings
|
||||
extern bool DISABLE;
|
||||
extern bool USE_VEH_WORKAROUND;
|
||||
extern bool SUPERSTEP_SOUND_ERROR;
|
||||
extern bool AVS_DIR_CREATION_FAILURE;
|
||||
extern std::string AVS_XML_PATH;
|
||||
extern std::string AVS_SRC_PATH;
|
||||
|
||||
//void print_stacktrace();
|
||||
void attach();
|
||||
|
||||
Reference in New Issue
Block a user