Clang formatting

This commit is contained in:
x1nixmzeng 2016-07-30 15:00:51 +01:00
parent 6cc3440086
commit 5be1a24f7a
3 changed files with 50 additions and 50 deletions

View File

@ -510,7 +510,7 @@ std::string Emulator::FindLaunchModule() {
auto gameinfo_entry(file_system_->ResolvePath(path + "GameInfo.bin")); auto gameinfo_entry(file_system_->ResolvePath(path + "GameInfo.bin"));
if (gameinfo_entry) { if (gameinfo_entry) {
vfs::File *file = nullptr; vfs::File* file = nullptr;
X_STATUS result = X_STATUS result =
gameinfo_entry->Open(vfs::FileAccess::kGenericRead, &file); gameinfo_entry->Open(vfs::FileAccess::kGenericRead, &file);
if (XSUCCEEDED(result)) { if (XSUCCEEDED(result)) {

View File

@ -17,44 +17,44 @@ constexpr uint32_t kGameInfoExecMagic = 'EXEC';
constexpr uint32_t kGameInfoCommMagic = 'COMM'; constexpr uint32_t kGameInfoCommMagic = 'COMM';
constexpr uint32_t kGameInfoTitlMagic = 'TITL'; 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) { : data_(data), data_size_(data_size) {
if (!data) { if (!data) {
return; return;
} }
const GameInfoBlockHeader *block_header(nullptr); const GameInfoBlockHeader* block_header(nullptr);
size_t data_offset(0); size_t data_offset(0);
while (data_offset < data_size_) { while (data_offset < data_size_) {
block_header = block_header =
reinterpret_cast<const GameInfoBlockHeader *>(data_ + data_offset); reinterpret_cast<const GameInfoBlockHeader*>(data_ + data_offset);
data_offset += sizeof(GameInfoBlockHeader); data_offset += sizeof(GameInfoBlockHeader);
switch (block_header->magic) { switch (block_header->magic) {
case kGameInfoExecMagic: case kGameInfoExecMagic:
exec_.virtual_titleid = exec_.virtual_titleid =
reinterpret_cast<const char *>(data_ + data_offset); reinterpret_cast<const char*>(data_ + data_offset);
data_offset += exec_.VirtualTitleIdLength + 1; data_offset += exec_.VirtualTitleIdLength + 1;
exec_.module_name = reinterpret_cast<const char *>(data_ + data_offset); exec_.module_name = reinterpret_cast<const char*>(data_ + data_offset);
data_offset += exec_.ModuleNameLength + 1; data_offset += exec_.ModuleNameLength + 1;
exec_.build_description = exec_.build_description =
reinterpret_cast<const char *>(data_ + data_offset); reinterpret_cast<const char*>(data_ + data_offset);
data_offset += exec_.BuildDescriptionLength + 1; data_offset += exec_.BuildDescriptionLength + 1;
break; break;
case kGameInfoCommMagic: case kGameInfoCommMagic:
assert_true(block_header->block_size == sizeof(GameInfoBlockComm)); assert_true(block_header->block_size == sizeof(GameInfoBlockComm));
comm_ = reinterpret_cast<const GameInfoBlockComm *>(data_ + data_offset); comm_ = reinterpret_cast<const GameInfoBlockComm*>(data_ + data_offset);
data_offset += block_header->block_size; data_offset += block_header->block_size;
break; break;
case kGameInfoTitlMagic: case kGameInfoTitlMagic:
assert_true(block_header->block_size == sizeof(GameInfoBlockTitl)); assert_true(block_header->block_size == sizeof(GameInfoBlockTitl));
titl_ = reinterpret_cast<const GameInfoBlockTitl *>(data_ + data_offset); titl_ = reinterpret_cast<const GameInfoBlockTitl*>(data_ + data_offset);
data_offset += block_header->block_size; data_offset += block_header->block_size;
break; break;
default: default:
// Unsupported headers // Unsupported headers
data_ = nullptr; data_ = nullptr;
return; return;
} }
} }
@ -77,6 +77,6 @@ std::string GameInfo::module_name() const {
return std::string(exec_.module_name, exec_.module_name + module_name_length); return std::string(exec_.module_name, exec_.module_name + module_name_length);
} }
} // namespace util } // namespace util
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe

View File

@ -20,12 +20,12 @@ namespace kernel {
namespace util { namespace util {
class GameInfoWrapper { class GameInfoWrapper {
public: public:
GameInfoWrapper(const uint8_t *data, size_t data_size); GameInfoWrapper(const uint8_t* data, size_t data_size);
bool is_valid() const { return data_ != nullptr; } bool is_valid() const { return data_ != nullptr; }
protected: protected:
struct GameInfoBlockHeader { struct GameInfoBlockHeader {
xe::be<uint32_t> magic; xe::be<uint32_t> magic;
xe::be<uint32_t> block_size; xe::be<uint32_t> block_size;
@ -33,9 +33,9 @@ protected:
static_assert_size(GameInfoBlockHeader, 8); static_assert_size(GameInfoBlockHeader, 8);
struct GameInfoBlockExec { struct GameInfoBlockExec {
const char *virtual_titleid; const char* virtual_titleid;
const char *module_name; const char* module_name;
const char *build_description; const char* build_description;
const uint32_t VirtualTitleIdLength = 32; const uint32_t VirtualTitleIdLength = 32;
const uint32_t ModuleNameLength = 42; const uint32_t ModuleNameLength = 42;
@ -50,23 +50,23 @@ protected:
struct GameInfoBlockTitl { struct GameInfoBlockTitl {
xe::be<wchar_t> title[128]; xe::be<wchar_t> title[128];
xe::be<wchar_t> description[256]; 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: private:
const uint8_t *data_ = nullptr; const uint8_t* data_ = nullptr;
size_t data_size_ = 0; size_t data_size_ = 0;
protected: protected:
GameInfoBlockExec exec_; GameInfoBlockExec exec_;
const GameInfoBlockComm *comm_ = nullptr; const GameInfoBlockComm* comm_ = nullptr;
const GameInfoBlockTitl *titl_ = nullptr; const GameInfoBlockTitl* titl_ = nullptr;
}; };
class GameInfo : public GameInfoWrapper { class GameInfo : public GameInfoWrapper {
public: public:
GameInfo(const std::vector<uint8_t> &data) GameInfo(const std::vector<uint8_t>& data)
: GameInfoWrapper(reinterpret_cast<const uint8_t *>(data.data()), : GameInfoWrapper(reinterpret_cast<const uint8_t*>(data.data()),
data.size()) {} data.size()) {}
uint32_t title_id() const; uint32_t title_id() const;
@ -74,8 +74,8 @@ public:
std::string module_name() const; std::string module_name() const;
}; };
} // namespace util } // namespace util
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe
#endif // XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_ #endif // XENIA_KERNEL_UTIL_GAMEINFO_UTILS_H_