From 5be1a24f7a32531c69381fd767331bf3daeed9b5 Mon Sep 17 00:00:00 2001 From: x1nixmzeng Date: Sat, 30 Jul 2016 15:00:51 +0100 Subject: [PATCH] Clang formatting --- src/xenia/emulator.cc | 2 +- src/xenia/kernel/util/gameinfo_utils.cc | 60 ++++++++++++------------- src/xenia/kernel/util/gameinfo_utils.h | 38 ++++++++-------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 6d3a9bd69..2c5969de4 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -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)) { diff --git a/src/xenia/kernel/util/gameinfo_utils.cc b/src/xenia/kernel/util/gameinfo_utils.cc index 089606325..aabd4f0d0 100644 --- a/src/xenia/kernel/util/gameinfo_utils.cc +++ b/src/xenia/kernel/util/gameinfo_utils.cc @@ -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(data_ + data_offset); + reinterpret_cast(data_ + data_offset); data_offset += sizeof(GameInfoBlockHeader); switch (block_header->magic) { - case kGameInfoExecMagic: - 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 kGameInfoCommMagic: - assert_true(block_header->block_size == sizeof(GameInfoBlockComm)); - comm_ = reinterpret_cast(data_ + data_offset); - data_offset += block_header->block_size; - break; - case kGameInfoTitlMagic: - 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; + case kGameInfoExecMagic: + 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 kGameInfoCommMagic: + assert_true(block_header->block_size == sizeof(GameInfoBlockComm)); + comm_ = reinterpret_cast(data_ + data_offset); + data_offset += block_header->block_size; + break; + case kGameInfoTitlMagic: + 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; } } @@ -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 diff --git a/src/xenia/kernel/util/gameinfo_utils.h b/src/xenia/kernel/util/gameinfo_utils.h index 137567f2e..189ac46ef 100644 --- a/src/xenia/kernel/util/gameinfo_utils.h +++ b/src/xenia/kernel/util/gameinfo_utils.h @@ -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 magic; xe::be 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 title[128]; xe::be description[256]; - xe::be publisher[256]; // assumed field name from wxPirs + xe::be 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 &data) - : GameInfoWrapper(reinterpret_cast(data.data()), + public: + GameInfo(const std::vector& data) + : GameInfoWrapper(reinterpret_cast(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_