Clang formatting
This commit is contained in:
parent
6cc3440086
commit
5be1a24f7a
|
@ -510,7 +510,7 @@ std::string Emulator::FindLaunchModule() {
|
|||
|
||||
auto gameinfo_entry(file_system_->ResolvePath(path + "GameInfo.bin"));
|
||||
if (gameinfo_entry) {
|
||||
vfs::File *file = nullptr;
|
||||
vfs::File* file = nullptr;
|
||||
X_STATUS result =
|
||||
gameinfo_entry->Open(vfs::FileAccess::kGenericRead, &file);
|
||||
if (XSUCCEEDED(result)) {
|
||||
|
|
|
@ -17,44 +17,44 @@ constexpr uint32_t kGameInfoExecMagic = 'EXEC';
|
|||
constexpr uint32_t kGameInfoCommMagic = 'COMM';
|
||||
constexpr uint32_t kGameInfoTitlMagic = 'TITL';
|
||||
|
||||
GameInfoWrapper::GameInfoWrapper(const uint8_t *data, size_t data_size)
|
||||
GameInfoWrapper::GameInfoWrapper(const uint8_t* data, size_t data_size)
|
||||
: data_(data), data_size_(data_size) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
const GameInfoBlockHeader *block_header(nullptr);
|
||||
const GameInfoBlockHeader* block_header(nullptr);
|
||||
size_t data_offset(0);
|
||||
while (data_offset < data_size_) {
|
||||
block_header =
|
||||
reinterpret_cast<const GameInfoBlockHeader *>(data_ + data_offset);
|
||||
reinterpret_cast<const GameInfoBlockHeader*>(data_ + data_offset);
|
||||
data_offset += sizeof(GameInfoBlockHeader);
|
||||
|
||||
switch (block_header->magic) {
|
||||
case kGameInfoExecMagic:
|
||||
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 kGameInfoCommMagic:
|
||||
assert_true(block_header->block_size == sizeof(GameInfoBlockComm));
|
||||
comm_ = reinterpret_cast<const GameInfoBlockComm *>(data_ + data_offset);
|
||||
data_offset += block_header->block_size;
|
||||
break;
|
||||
case kGameInfoTitlMagic:
|
||||
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;
|
||||
case kGameInfoExecMagic:
|
||||
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 kGameInfoCommMagic:
|
||||
assert_true(block_header->block_size == sizeof(GameInfoBlockComm));
|
||||
comm_ = reinterpret_cast<const GameInfoBlockComm*>(data_ + data_offset);
|
||||
data_offset += block_header->block_size;
|
||||
break;
|
||||
case kGameInfoTitlMagic:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,6 @@ std::string GameInfo::module_name() const {
|
|||
return std::string(exec_.module_name, exec_.module_name + module_name_length);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
} // namespace util
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace kernel {
|
|||
namespace util {
|
||||
|
||||
class GameInfoWrapper {
|
||||
public:
|
||||
GameInfoWrapper(const uint8_t *data, size_t data_size);
|
||||
public:
|
||||
GameInfoWrapper(const uint8_t* data, size_t data_size);
|
||||
|
||||
bool is_valid() const { return data_ != nullptr; }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
struct GameInfoBlockHeader {
|
||||
xe::be<uint32_t> magic;
|
||||
xe::be<uint32_t> block_size;
|
||||
|
@ -33,9 +33,9 @@ protected:
|
|||
static_assert_size(GameInfoBlockHeader, 8);
|
||||
|
||||
struct GameInfoBlockExec {
|
||||
const char *virtual_titleid;
|
||||
const char *module_name;
|
||||
const char *build_description;
|
||||
const char* virtual_titleid;
|
||||
const char* module_name;
|
||||
const char* build_description;
|
||||
|
||||
const uint32_t VirtualTitleIdLength = 32;
|
||||
const uint32_t ModuleNameLength = 42;
|
||||
|
@ -50,23 +50,23 @@ protected:
|
|||
struct GameInfoBlockTitl {
|
||||
xe::be<wchar_t> title[128];
|
||||
xe::be<wchar_t> description[256];
|
||||
xe::be<wchar_t> publisher[256]; // assumed field name from wxPirs
|
||||
xe::be<wchar_t> publisher[256]; // assumed field name from wxPirs
|
||||
};
|
||||
|
||||
private:
|
||||
const uint8_t *data_ = nullptr;
|
||||
private:
|
||||
const uint8_t* data_ = nullptr;
|
||||
size_t data_size_ = 0;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
GameInfoBlockExec exec_;
|
||||
const GameInfoBlockComm *comm_ = nullptr;
|
||||
const GameInfoBlockTitl *titl_ = nullptr;
|
||||
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()),
|
||||
public:
|
||||
GameInfo(const std::vector<uint8_t>& data)
|
||||
: GameInfoWrapper(reinterpret_cast<const uint8_t*>(data.data()),
|
||||
data.size()) {}
|
||||
|
||||
uint32_t title_id() const;
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
std::string module_name() const;
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
} // namespace util
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_
|
||||
#endif // XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_
|
||||
|
|
Loading…
Reference in New Issue