Complete native GUI file flows and Football Limited audio data (by Codex)
This commit is contained in:
1 parent
978a014b87
commit
0b2354c979
12 files changed
+155
-26
No files matched your search
@@ -614,6 +614,20 @@ CareerSession::CareerSession(const std::filesystem::path &data, uint32_t watcom_
|
||||
exe_.u32(::bmh::layout::CareerSession_DataDirectory_RuntimeField4)};
|
||||
const auto stream = original_english_save ? obw::normalize_english_save(file, counts) : file.stream;
|
||||
const SaveState save(stream, counts);
|
||||
const auto manager_count = save.data(::bmh::layout::ManagerCount)[0];
|
||||
if (manager_count < 1 || manager_count > 4)
|
||||
throw FormatError("Invalid legacy manager count");
|
||||
if (importing_legacy) {
|
||||
size_t english_blocks = 0;
|
||||
for (const auto &[address, size] : kEnglishCompetitionBlocks)
|
||||
for (const auto &block : save.extension())
|
||||
if (block.address == address && block.bytes.size() == size)
|
||||
++english_blocks;
|
||||
if ((kEnglishCompetitions && english_blocks != std::size(kEnglishCompetitionBlocks)) ||
|
||||
(!kEnglishCompetitions && english_blocks != 0))
|
||||
throw FormatError(
|
||||
"Spielstand und Mod-Ausgabe passen nicht zusammen oder englische Pokaldaten fehlen.");
|
||||
}
|
||||
g_ = GameState::from_save(save, counts);
|
||||
if (importing_legacy && file.plain_header.size() >= 11) {
|
||||
const std::string year(file.plain_header.begin() + 7, file.plain_header.begin() + 11);
|
||||
|
||||
@@ -352,8 +352,8 @@ void start_original_desk_audio(openbmh::audio::Playback& playback, const GameSta
|
||||
original_audio_command(playback, 1); // SavePathInDirectory / CareerFirstSteps2, resume the same song.
|
||||
}
|
||||
|
||||
bool save_path_in_directory(const fs::path& path, const fs::path& directory,
|
||||
std::string_view expected_extension = ".fbm") {
|
||||
bool save_path_in_directory(const fs::path &path, const fs::path &directory,
|
||||
std::string_view expected_extension) {
|
||||
if (path.filename().empty()) return false;
|
||||
std::string ext = path.extension().string();
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(), [](unsigned char c) { return char(std::tolower(c)); });
|
||||
@@ -1878,7 +1878,8 @@ std::string serve_flow_request(ui::StartupFlow& flow, const ui::FlowResult& resu
|
||||
result.settings_owner_sequence == flow.settings_owner_sequence() &&
|
||||
request.origin_item_id == desk_owner.item_id && request.manager_slot == desk_owner.manager_slot;
|
||||
if (!session || !same_pending || request.revision != revision ||
|
||||
!save_path_in_directory(request.path, save_directory, ".ein")) {
|
||||
!save_path_in_directory(request.path, save_directory,
|
||||
content::find(data) ? ".obsettings" : ".ein")) {
|
||||
flow.reject_settings_file("stale_request_or_invalid_settings_path");
|
||||
return {};
|
||||
}
|
||||
@@ -1909,7 +1910,8 @@ std::string serve_flow_request(ui::StartupFlow& flow, const ui::FlowResult& resu
|
||||
return {};
|
||||
}
|
||||
if (request.revision != revision ||
|
||||
!save_path_in_directory(request.path, save_directory, ".men")) {
|
||||
!save_path_in_directory(request.path, save_directory,
|
||||
content::find(data) ? ".oblayout" : ".men")) {
|
||||
flow.reject_file_action("stale_request_or_invalid_menu_layout_path");
|
||||
return {};
|
||||
}
|
||||
@@ -1927,7 +1929,8 @@ std::string serve_flow_request(ui::StartupFlow& flow, const ui::FlowResult& resu
|
||||
}
|
||||
} else if (result.request == ui::FlowRequest::file_action) {
|
||||
const auto& request = result.file_action;
|
||||
if (request.revision != revision || !save_path_in_directory(request.path, save_directory)) {
|
||||
if (request.revision != revision ||
|
||||
!save_path_in_directory(request.path, save_directory, content::find(data) ? ".obs" : ".fbm")) {
|
||||
flow.reject_file_action("stale_request_or_invalid_save_path");
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user