[Kernel] Removed useless GameInfoWrapper class
It was added back in 2016 and never really used. I tested few games and never saw GameInfo.bin in XNA games or any other game
This commit is contained in:
parent
e8a92c1073
commit
2fc36721b4
|
@ -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<uint8_t> 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) {
|
||||
|
|
|
@ -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<const GameInfoBlockHeader*>(data_ + data_offset);
|
||||
data_offset += sizeof(GameInfoBlockHeader);
|
||||
|
||||
switch (block_header->magic) {
|
||||
case kGameInfoExecSignature:
|
||||
exec_.virtual_titleid =
|
||||
reinterpret_cast<const char*>(data_ + data_offset);
|
||||
data_offset += exec_.VirtualTitleIdLength + 1;
|
||||
exec_.module_name = reinterpret_cast<const char*>(data_ + data_offset);
|
||||
data_offset += exec_.ModuleNameLength + 1;
|
||||
exec_.build_description =
|
||||
reinterpret_cast<const char*>(data_ + data_offset);
|
||||
data_offset += exec_.BuildDescriptionLength + 1;
|
||||
break;
|
||||
case kGameInfoCommSignature:
|
||||
assert_true(block_header->block_size == sizeof(GameInfoBlockComm));
|
||||
comm_ = reinterpret_cast<const GameInfoBlockComm*>(data_ + data_offset);
|
||||
data_offset += block_header->block_size;
|
||||
break;
|
||||
case kGameInfoTitlSignature:
|
||||
assert_true(block_header->block_size == sizeof(GameInfoBlockTitl));
|
||||
titl_ = reinterpret_cast<const GameInfoBlockTitl*>(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
|
|
@ -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 <string>
|
||||
#include <vector>
|
||||
|
||||
#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<uint32_t> magic;
|
||||
xe::be<uint32_t> 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<uint32_t> title_id;
|
||||
};
|
||||
static_assert_size(GameInfoBlockComm, 4);
|
||||
|
||||
struct GameInfoBlockTitl {
|
||||
xe::be<char16_t> title[128];
|
||||
xe::be<char16_t> description[256];
|
||||
xe::be<char16_t> 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<uint8_t>& data)
|
||||
: GameInfoWrapper(reinterpret_cast<const uint8_t*>(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_
|
Loading…
Reference in New Issue