Log disc verification status

This commit is contained in:
Luke Street
2026-05-09 20:40:59 -06:00
parent 5e08b810fc
commit 7562486449
5 changed files with 36 additions and 2 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
#include "dusk/io.hpp"
#include <cstdio>
#include <filesystem>
#include "dusk/io.hpp"
using namespace dusk::io;
#if _WIN32
+20
View File
@@ -9,6 +9,8 @@
#include <stdexcept>
#include <string_view>
#include "dusk/logging.h"
namespace {
constexpr uint8_t hex_nibble_to_u8(char c) {
@@ -42,6 +44,18 @@ constexpr XXH128_hash_t parse_xxh128(std::string_view hex) {
};
}
const char* verification_state_name(dusk::DiscVerificationState state) noexcept {
switch (state) {
case dusk::DiscVerificationState::Success:
return "verified";
case dusk::DiscVerificationState::HashMismatch:
return "hash mismatch";
case dusk::DiscVerificationState::Unknown:
default:
return "unknown";
}
}
} // namespace
namespace dusk::iso {
@@ -248,4 +262,10 @@ bool isPal(const char* path) {
DiscInfo info{};
return inspect(path, info) == ValidationError::Success && info.isPal;
}
void log_verification_state(std::string_view path, DiscVerificationState state) {
const std::string pathText = path.empty() ? "<none>" : std::string(path);
DuskLog.info(
"Disc verification status: {} (path: {})", verification_state_name(state), pathText);
}
} // namespace dusk::iso
+1
View File
@@ -31,6 +31,7 @@ struct DiscInfo {
ValidationError inspect(const char* path, DiscInfo& info);
ValidationError validate(const char* path, VerificationStatus& status, DiscInfo& info);
bool isPal(const char* path);
void log_verification_state(std::string_view path, DiscVerificationState state);
} // namespace dusk::iso
+9 -1
View File
@@ -302,9 +302,17 @@ std::string get_error_msg(iso::ValidationError error) {
}
void persist_disc_choice(const std::string& path, iso::ValidationError validation) {
const auto previousPath = getSettings().backend.isoPath.getValue();
const auto previousVerification = getSettings().backend.isoVerification.getValue();
const auto verification = verification_to_config(validation);
getSettings().backend.isoPath.setValue(path);
getSettings().backend.isoVerification.setValue(verification_to_config(validation));
getSettings().backend.isoVerification.setValue(verification);
config::Save();
if (previousPath != path || previousVerification != verification) {
iso::log_verification_state(path, verification);
}
}
void apply_valid_disc_result(
+4
View File
@@ -649,6 +649,10 @@ int game_main(int argc, char* argv[]) {
}
}
dusk::iso::log_verification_state(
dusk::getSettings().backend.isoPath.getValue(),
dusk::getSettings().backend.isoVerification.getValue());
if (!dvd_opened) {
if (dusk::getSettings().backend.isoPath.getValue().empty()) {
forcePreLaunchUI = true;