mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-10-03 03:06:52 -04:00
Fixes & support Wii discs
This commit is contained in:
@@ -6,6 +6,7 @@ window.saves pane.list > header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
focus: none;
|
||||
}
|
||||
|
||||
window.saves pane.list > header section-heading {
|
||||
|
||||
@@ -41,11 +41,13 @@ constexpr auto AcceptedDiscs = std::to_array<borealis::disc::AcceptedDisc>({
|
||||
.expectedHash = borealis::disc::parse_xxh3_128("9ef597588b0035ca9e91b333fa9a8a7e"),
|
||||
},
|
||||
{
|
||||
.gameId = "RZDE01", .revision = 0,
|
||||
.gameId = "RZDE01",
|
||||
.revision = 0,
|
||||
.expectedHash = borealis::disc::parse_xxh3_128("b3d91fbea59e5c66934d04c01566728e"),
|
||||
},
|
||||
{
|
||||
.gameId = "RZDE01", .revision = 2,
|
||||
.gameId = "RZDE01",
|
||||
.revision = 2,
|
||||
.expectedHash = borealis::disc::parse_xxh3_128("c3ec420921a1b36d6ae43f576491d25c"),
|
||||
},
|
||||
{
|
||||
@@ -103,11 +105,12 @@ Region region_from_game_id(std::string_view gameId) noexcept {
|
||||
return Region::NorthAmerica;
|
||||
}
|
||||
|
||||
void update_info(const borealis::disc::Result& result, DiscInfo& info) noexcept {
|
||||
void update_info(const borealis::disc::Result& result, DiscInfo& info) {
|
||||
if (!result.metadata.gameId.empty()) {
|
||||
info.platform = result.metadata.platform;
|
||||
info.region = region_from_game_id(result.metadata.gameId);
|
||||
info.revision = result.metadata.revision;
|
||||
info.gameId = result.metadata.gameId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef DUSK_ISO_VALIDATE_HPP
|
||||
#define DUSK_ISO_VALIDATE_HPP
|
||||
|
||||
#include "dusk/settings.h"
|
||||
#include <borealis/disc.hpp>
|
||||
#include "dusk/settings.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace dusk {
|
||||
@@ -39,6 +40,7 @@ struct DiscInfo {
|
||||
Platform platform = Platform::Unknown;
|
||||
Region region = Region::NorthAmerica;
|
||||
uint8_t revision = 0;
|
||||
std::string gameId;
|
||||
};
|
||||
|
||||
ValidationError inspect(const char* path, DiscInfo& info);
|
||||
|
||||
@@ -766,24 +766,14 @@ Result apply_artifact(const Storage& storage, const SaveIdentity& identity,
|
||||
} // namespace
|
||||
|
||||
std::optional<SaveIdentity> identity_for_disc(const iso::DiscInfo& info, std::string saveName) {
|
||||
if (info.platform != iso::Platform::GameCube || !utils::is_valid_save_name(saveName)) {
|
||||
if (info.gameId.size() != 6 || !utils::is_valid_save_name(saveName)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
std::string game;
|
||||
switch (info.region) {
|
||||
case iso::Region::NorthAmerica:
|
||||
game = "GZ2E";
|
||||
break;
|
||||
case iso::Region::Europe:
|
||||
game = "GZ2P";
|
||||
break;
|
||||
case iso::Region::Japan:
|
||||
game = "GZ2J";
|
||||
break;
|
||||
case iso::Region::Korea:
|
||||
return std::nullopt;
|
||||
}
|
||||
return SaveIdentity{.maker = "01", .game = std::move(game), .saveName = std::move(saveName)};
|
||||
return SaveIdentity{
|
||||
.maker = info.gameId.substr(4),
|
||||
.game = info.gameId.substr(0, 4),
|
||||
.saveName = std::move(saveName),
|
||||
};
|
||||
}
|
||||
|
||||
std::string card_file_stem(
|
||||
|
||||
@@ -177,14 +177,14 @@ bool installed_mod(std::string_view id) {
|
||||
}
|
||||
|
||||
void export_artifact(save_manager::ExportArtifact artifact, std::string pattern) {
|
||||
borealis::file_select::ExportOptions options{
|
||||
.parentWindow = aurora::window::get_sdl_window(),
|
||||
.sourceLocation = borealis::io::fs_path_to_string(artifact.path),
|
||||
.suggestedName = artifact.suggestedName,
|
||||
.filters = {{"Save file", std::move(pattern)}},
|
||||
};
|
||||
borealis::file_select::export_file(
|
||||
{
|
||||
.parentWindow = aurora::window::get_sdl_window(),
|
||||
.sourceLocation = borealis::io::fs_path_to_string(artifact.path),
|
||||
.suggestedName = artifact.suggestedName,
|
||||
.filters = {{"Save file", std::move(pattern)}},
|
||||
},
|
||||
[artifact = std::move(artifact)](borealis::file_select::Result result) {
|
||||
std::move(options), [artifact = std::move(artifact)](borealis::file_select::Result result) {
|
||||
save_manager::remove_temporary_export(artifact);
|
||||
if (result.status != borealis::file_select::Status::Selected &&
|
||||
result.status != borealis::file_select::Status::Canceled)
|
||||
@@ -936,8 +936,7 @@ void add_save_files_control(Pane& leftPane, Pane& rightPane) {
|
||||
const auto& state = prelaunch_state();
|
||||
return !state.configuredDiscCanLaunch || data::is_data_path_restart_pending() ||
|
||||
(!state.activeDiscPath.empty() &&
|
||||
state.configuredDiscPath != state.activeDiscPath) ||
|
||||
state.configuredDiscInfo.platform != iso::Platform::GameCube;
|
||||
state.configuredDiscPath != state.activeDiscPath);
|
||||
},
|
||||
});
|
||||
leftPane.register_control(button.on_pressed([] {
|
||||
|
||||
Reference in New Issue
Block a user