diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 6ba26b4ee..2dad04bd9 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -41,7 +41,6 @@ #include "xenia/hid/input_system.h" #include "xenia/kernel/kernel_state.h" #include "xenia/kernel/user_module.h" -#include "xenia/kernel/util/gameinfo_utils.h" #include "xenia/kernel/util/xdbf_utils.h" #include "xenia/kernel/xam/achievement_manager.h" #include "xenia/kernel/xam/xam_module.h" @@ -1314,35 +1313,7 @@ std::string Emulator::FindLaunchModule() { return path + cvars::launch_module; } - std::string default_module("default.xex"); - - auto gameinfo_entry(file_system_->ResolvePath(path + "GameInfo.bin")); - if (gameinfo_entry) { - vfs::File* file = nullptr; - X_STATUS result = - gameinfo_entry->Open(vfs::FileAccess::kGenericRead, &file); - if (XSUCCEEDED(result)) { - std::vector buffer(gameinfo_entry->size()); - size_t bytes_read = 0; - result = file->ReadSync(buffer.data(), buffer.size(), 0, &bytes_read); - if (XSUCCEEDED(result)) { - kernel::util::GameInfo info(buffer); - if (info.is_valid()) { - XELOGI("Found virtual title {}", info.virtual_title_id()); - - const std::string xna_id("584E07D1"); - auto xna_id_entry(file_system_->ResolvePath(path + xna_id)); - if (xna_id_entry) { - default_module = xna_id + "\\" + info.module_name(); - } else { - XELOGE("Could not find fixed XNA path {}", xna_id); - } - } - } - } - } - - return path + default_module; + return path + "default.xex"; } static std::string format_version(xex2_version version) { diff --git a/src/xenia/kernel/util/gameinfo_utils.cc b/src/xenia/kernel/util/gameinfo_utils.cc deleted file mode 100644 index b69c2e63f..000000000 --- a/src/xenia/kernel/util/gameinfo_utils.cc +++ /dev/null @@ -1,82 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2016 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include "xenia/kernel/util/gameinfo_utils.h" - -namespace xe { -namespace kernel { -namespace util { - -constexpr fourcc_t kGameInfoExecSignature = make_fourcc("EXEC"); -constexpr fourcc_t kGameInfoCommSignature = make_fourcc("COMM"); -constexpr fourcc_t kGameInfoTitlSignature = make_fourcc("TITL"); - -GameInfoWrapper::GameInfoWrapper(const uint8_t* data, size_t data_size) - : data_(data), data_size_(data_size) { - if (!data) { - return; - } - - const GameInfoBlockHeader* block_header(nullptr); - size_t data_offset(0); - while (data_offset < data_size_) { - block_header = - reinterpret_cast(data_ + data_offset); - data_offset += sizeof(GameInfoBlockHeader); - - switch (block_header->magic) { - case kGameInfoExecSignature: - exec_.virtual_titleid = - reinterpret_cast(data_ + data_offset); - data_offset += exec_.VirtualTitleIdLength + 1; - exec_.module_name = reinterpret_cast(data_ + data_offset); - data_offset += exec_.ModuleNameLength + 1; - exec_.build_description = - reinterpret_cast(data_ + data_offset); - data_offset += exec_.BuildDescriptionLength + 1; - break; - case kGameInfoCommSignature: - assert_true(block_header->block_size == sizeof(GameInfoBlockComm)); - comm_ = reinterpret_cast(data_ + data_offset); - data_offset += block_header->block_size; - break; - case kGameInfoTitlSignature: - assert_true(block_header->block_size == sizeof(GameInfoBlockTitl)); - titl_ = reinterpret_cast(data_ + data_offset); - data_offset += block_header->block_size; - break; - default: - // Unsupported headers - data_ = nullptr; - return; - } - } - - if ((comm_ == nullptr) || (titl_ == nullptr) || - (exec_.virtual_titleid == nullptr)) { - data_ = nullptr; - } -} - -uint32_t GameInfo::title_id() const { return comm_->title_id; } - -std::string GameInfo::virtual_title_id() const { - size_t virtual_titleid_length(std::strlen(exec_.virtual_titleid)); - return std::string(exec_.virtual_titleid, - exec_.virtual_titleid + virtual_titleid_length); -} - -std::string GameInfo::module_name() const { - size_t module_name_length(std::strlen(exec_.module_name)); - return std::string(exec_.module_name, exec_.module_name + module_name_length); -} - -} // namespace util -} // namespace kernel -} // namespace xe diff --git a/src/xenia/kernel/util/gameinfo_utils.h b/src/xenia/kernel/util/gameinfo_utils.h deleted file mode 100644 index 7108ac8f0..000000000 --- a/src/xenia/kernel/util/gameinfo_utils.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2020 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_ -#define XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_ - -#include -#include - -#include "xenia/base/memory.h" - -namespace xe { -namespace kernel { -namespace util { - -class GameInfoWrapper { - public: - GameInfoWrapper(const uint8_t* data, size_t data_size); - - bool is_valid() const { return data_ != nullptr; } - - protected: - struct GameInfoBlockHeader { - xe::be magic; - xe::be block_size; - }; - static_assert_size(GameInfoBlockHeader, 8); - - struct GameInfoBlockExec { - const char* virtual_titleid; - const char* module_name; - const char* build_description; - - const uint32_t VirtualTitleIdLength = 32; - const uint32_t ModuleNameLength = 42; - const uint32_t BuildDescriptionLength = 64; - }; - - struct GameInfoBlockComm { - xe::be title_id; - }; - static_assert_size(GameInfoBlockComm, 4); - - struct GameInfoBlockTitl { - xe::be title[128]; - xe::be description[256]; - xe::be publisher[256]; // assumed field name from wxPirs - }; - - private: - const uint8_t* data_ = nullptr; - size_t data_size_ = 0; - - protected: - GameInfoBlockExec exec_; - const GameInfoBlockComm* comm_ = nullptr; - const GameInfoBlockTitl* titl_ = nullptr; -}; - -class GameInfo : public GameInfoWrapper { - public: - GameInfo(const std::vector& data) - : GameInfoWrapper(reinterpret_cast(data.data()), - data.size()) {} - - uint32_t title_id() const; - std::string virtual_title_id() const; - std::string module_name() const; -}; - -} // namespace util -} // namespace kernel -} // namespace xe - -#endif // XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_