From d1ee1512b949b934fc06b483bb96b4b0b62536ce Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 3 May 2015 10:27:50 -0700 Subject: [PATCH] Fixing most clang-format errors. --- src/xdb/module.h | 4 +- src/xdb/postmortem_cursor.cc | 2 +- src/xdb/sym/map_symbol_database.cc | 4 +- src/xdb/thread.h | 6 +- src/xenia/apu/apu-private.h | 2 - src/xenia/apu/audio_driver.cc | 9 +- src/xenia/apu/nop/nop_audio_system.cc | 16 +- src/xenia/apu/xaudio2/xaudio2_audio_system.cc | 16 +- src/xenia/cpu/backend/x64/x64_emitter.h | 4 +- src/xenia/cpu/backend/x64/x64_sequence.inl | 244 ++++++++-------- src/xenia/debug_agent.cc | 3 +- src/xenia/gpu/gl4/blitter.h | 3 +- src/xenia/gpu/gl4/command_processor.cc | 80 +++--- src/xenia/gpu/gl4/gl4_shader_translator.cc | 143 +++++----- src/xenia/gpu/gl4/gl_context.cc | 26 +- src/xenia/gpu/gl4/gl_context.h | 5 +- src/xenia/gpu/texture_info.cc | 7 +- src/xenia/gpu/trace_viewer_main.cc | 39 ++- src/xenia/gpu/ucode_disassembler.cc | 267 +++++++++--------- src/xenia/hid/hid-private.h | 2 - .../kernel/fs/devices/disc_image_entry.cc | 3 +- src/xenia/kernel/fs/devices/host_path_file.cc | 4 +- .../fs/devices/stfs_container_device.cc | 2 +- .../kernel/fs/devices/stfs_container_entry.cc | 2 +- src/xenia/kernel/fs/entry.cc | 4 +- src/xenia/kernel/fs/filesystem.h | 3 +- src/xenia/kernel/object_table.cc | 2 +- src/xenia/kernel/objects/xenumerator.cc | 3 +- src/xenia/kernel/objects/xthread.cc | 5 +- src/xenia/kernel/xam_module.cc | 2 +- src/xenia/kernel/xam_msg.cc | 3 +- src/xenia/kernel/xam_net.cc | 2 +- src/xenia/kernel/xam_user.cc | 6 +- src/xenia/kernel/xboxkrnl_threading.cc | 2 +- src/xenia/memory.cc | 27 +- .../tools/api-scanner/api_scanner_loader.cc | 43 ++- .../tools/api-scanner/api_scanner_loader.h | 67 ++--- .../tools/api-scanner/api_scanner_main.cc | 3 +- src/xenia/xbox.h | 25 +- 39 files changed, 540 insertions(+), 550 deletions(-) diff --git a/src/xdb/module.h b/src/xdb/module.h index 8be42b0be..ad0a3b0d8 100644 --- a/src/xdb/module.h +++ b/src/xdb/module.h @@ -16,8 +16,8 @@ namespace xdb { class Module { public: - uint16_t module_id; - // info + uint16_t module_id; + // info }; } // namespace xdb diff --git a/src/xdb/postmortem_cursor.cc b/src/xdb/postmortem_cursor.cc index 6b1a530c8..cf465d4b6 100644 --- a/src/xdb/postmortem_cursor.cc +++ b/src/xdb/postmortem_cursor.cc @@ -96,7 +96,7 @@ class PostmortemCursor::Executor { auto event_type = xe::load(trace_ptr_); switch (event_type) { case EventType::END_OF_STREAM: { - eof_= true; + eof_ = true; cursor_->end_of_stream(); return; } diff --git a/src/xdb/sym/map_symbol_database.cc b/src/xdb/sym/map_symbol_database.cc index f8fba81d8..81366502a 100644 --- a/src/xdb/sym/map_symbol_database.cc +++ b/src/xdb/sym/map_symbol_database.cc @@ -12,9 +12,7 @@ namespace xdb { namespace sym { -Symbol* MapSymbolDatabase::Lookup(uint32_t address) { - return nullptr; -} +Symbol* MapSymbolDatabase::Lookup(uint32_t address) { return nullptr; } } // namespace sym } // namespace xdb diff --git a/src/xdb/thread.h b/src/xdb/thread.h index 425b45c44..b2db5ebef 100644 --- a/src/xdb/thread.h +++ b/src/xdb/thread.h @@ -16,9 +16,9 @@ namespace xdb { class Thread { public: - uint16_t thread_id; - // name - // etc + uint16_t thread_id; + // name + // etc }; } // namespace xdb diff --git a/src/xenia/apu/apu-private.h b/src/xenia/apu/apu-private.h index 181dd9f9b..5253e156f 100644 --- a/src/xenia/apu/apu-private.h +++ b/src/xenia/apu/apu-private.h @@ -12,8 +12,6 @@ #include - DECLARE_string(apu); - #endif // XENIA_APU_APU_PRIVATE_H_ diff --git a/src/xenia/apu/audio_driver.cc b/src/xenia/apu/audio_driver.cc index 91b24df44..b9459c3c1 100644 --- a/src/xenia/apu/audio_driver.cc +++ b/src/xenia/apu/audio_driver.cc @@ -17,10 +17,7 @@ using namespace xe; using namespace xe::apu; using namespace xe::cpu; +AudioDriver::AudioDriver(Emulator* emulator) + : emulator_(emulator), memory_(emulator->memory()) {} -AudioDriver::AudioDriver(Emulator* emulator) : - emulator_(emulator), memory_(emulator->memory()) { -} - -AudioDriver::~AudioDriver() { -} +AudioDriver::~AudioDriver() {} diff --git a/src/xenia/apu/nop/nop_audio_system.cc b/src/xenia/apu/nop/nop_audio_system.cc index 8901d9e96..96ad48869 100644 --- a/src/xenia/apu/nop/nop_audio_system.cc +++ b/src/xenia/apu/nop/nop_audio_system.cc @@ -11,23 +11,17 @@ #include "xenia/apu/apu-private.h" - using namespace xe; using namespace xe::apu; using namespace xe::apu::nop; +NopAudioSystem::NopAudioSystem(Emulator* emulator) : AudioSystem(emulator) {} -NopAudioSystem::NopAudioSystem(Emulator* emulator) : - AudioSystem(emulator) { -} +NopAudioSystem::~NopAudioSystem() {} -NopAudioSystem::~NopAudioSystem() { -} - -X_STATUS NopAudioSystem::CreateDriver(size_t index, HANDLE wait_handle, AudioDriver** out_driver) { +X_STATUS NopAudioSystem::CreateDriver(size_t index, HANDLE wait_handle, + AudioDriver** out_driver) { return X_STATUS_NOT_IMPLEMENTED; } -void NopAudioSystem::DestroyDriver(AudioDriver* driver) { - assert_always(); -} +void NopAudioSystem::DestroyDriver(AudioDriver* driver) { assert_always(); } diff --git a/src/xenia/apu/xaudio2/xaudio2_audio_system.cc b/src/xenia/apu/xaudio2/xaudio2_audio_system.cc index 4fee2d3b0..ee549e45b 100644 --- a/src/xenia/apu/xaudio2/xaudio2_audio_system.cc +++ b/src/xenia/apu/xaudio2/xaudio2_audio_system.cc @@ -18,19 +18,15 @@ using namespace xe; using namespace xe::apu; using namespace xe::apu::xaudio2; +XAudio2AudioSystem::XAudio2AudioSystem(Emulator* emulator) + : AudioSystem(emulator) {} -XAudio2AudioSystem::XAudio2AudioSystem(Emulator* emulator) : - AudioSystem(emulator) { -} +XAudio2AudioSystem::~XAudio2AudioSystem() {} -XAudio2AudioSystem::~XAudio2AudioSystem() { -} +void XAudio2AudioSystem::Initialize() { AudioSystem::Initialize(); } -void XAudio2AudioSystem::Initialize() { - AudioSystem::Initialize(); -} - -X_STATUS XAudio2AudioSystem::CreateDriver(size_t index, HANDLE wait, AudioDriver** out_driver) { +X_STATUS XAudio2AudioSystem::CreateDriver(size_t index, HANDLE wait, + AudioDriver** out_driver) { assert_not_null(out_driver); auto driver = new XAudio2AudioDriver(emulator_, wait); driver->Initialize(); diff --git a/src/xenia/cpu/backend/x64/x64_emitter.h b/src/xenia/cpu/backend/x64/x64_emitter.h index 797956e0c..44e4579f4 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.h +++ b/src/xenia/cpu/backend/x64/x64_emitter.h @@ -103,7 +103,7 @@ class X64Emitter : public Xbyak::CodeGenerator { Runtime* runtime() const { return runtime_; } X64Backend* backend() const { return backend_; } - const Xbyak::util::Cpu *cpu() const { return &cpu_; } + const Xbyak::util::Cpu* cpu() const { return &cpu_; } int Initialize(); @@ -193,7 +193,7 @@ class X64Emitter : public Xbyak::CodeGenerator { X64Backend* backend_; X64CodeCache* code_cache_; XbyakAllocator* allocator_; - Xbyak::util::Cpu cpu_; // Host CPU info + Xbyak::util::Cpu cpu_; // Host CPU info hir::Instr* current_instr_; diff --git a/src/xenia/cpu/backend/x64/x64_sequence.inl b/src/xenia/cpu/backend/x64/x64_sequence.inl index 5013ba4a6..77ce8ca1b 100644 --- a/src/xenia/cpu/backend/x64/x64_sequence.inl +++ b/src/xenia/cpu/backend/x64/x64_sequence.inl @@ -7,7 +7,6 @@ ****************************************************************************** */ - namespace { enum KeyType { @@ -36,16 +35,15 @@ union InstrKey { }; uint32_t value; - operator uint32_t() const { - return value; - } + operator uint32_t() const { return value; } InstrKey() : value(0) {} InstrKey(uint32_t v) : value(v) {} InstrKey(const Instr* i) : value(0) { opcode = i->opcode->num; uint32_t sig = i->opcode->signature; - dest = GET_OPCODE_SIG_TYPE_DEST(sig) ? OPCODE_SIG_TYPE_V + i->dest->type : 0; + dest = + GET_OPCODE_SIG_TYPE_DEST(sig) ? OPCODE_SIG_TYPE_V + i->dest->type : 0; src1 = GET_OPCODE_SIG_TYPE_SRC1(sig); if (src1 == OPCODE_SIG_TYPE_V) { src1 += i->src1.value->type; @@ -60,11 +58,8 @@ union InstrKey { } } - template + template struct Construct { static const uint32_t value = (OPCODE) | (DEST << 8) | (SRC1 << 13) | (SRC2 << 18) | (SRC3 << 23); @@ -88,27 +83,33 @@ struct Op : OpBase { }; struct VoidOp : Op { -protected: - template friend struct Op; - template friend struct I; + protected: + template + friend struct Op; + template + friend struct I; void Load(const Instr::Op& op) {} }; struct OffsetOp : Op { uint64_t value; -protected: - template friend struct Op; - template friend struct I; - void Load(const Instr::Op& op) { - this->value = op.offset; - } + + protected: + template + friend struct Op; + template + friend struct I; + void Load(const Instr::Op& op) { this->value = op.offset; } }; struct SymbolOp : Op { FunctionInfo* value; -protected: - template friend struct Op; - template friend struct I; + + protected: + template + friend struct Op; + template + friend struct I; bool Load(const Instr::Op& op) { this->value = op.symbol_info; return true; @@ -117,15 +118,17 @@ protected: struct LabelOp : Op { hir::Label* value; -protected: - template friend struct Op; - template friend struct I; - void Load(const Instr::Op& op) { - this->value = op.label; - } + + protected: + template + friend struct Op; + template + friend struct I; + void Load(const Instr::Op& op) { this->value = op.label; } }; -template +template struct ValueOp : Op, KEY_TYPE> { typedef REG_TYPE reg_type; static const int tag = TAG; @@ -136,9 +139,7 @@ struct ValueOp : Op, KEY_TYPE> { assert_true(!is_constant); return reg_; } - operator const REG_TYPE&() const { - return reg(); - } + operator const REG_TYPE&() const { return reg(); } bool IsEqual(const T& b) const { if (is_constant && b.is_constant) { return reinterpret_cast(this)->constant() == b.constant(); @@ -157,18 +158,10 @@ struct ValueOp : Op, KEY_TYPE> { return false; } } - bool operator== (const T& b) const { - return IsEqual(b); - } - bool operator!= (const T& b) const { - return !IsEqual(b); - } - bool operator== (const Xbyak::Reg& b) const { - return IsEqual(b); - } - bool operator!= (const Xbyak::Reg& b) const { - return !IsEqual(b); - } + bool operator==(const T& b) const { return IsEqual(b); } + bool operator!=(const T& b) const { return !IsEqual(b); } + bool operator==(const Xbyak::Reg& b) const { return IsEqual(b); } + bool operator!=(const Xbyak::Reg& b) const { return !IsEqual(b); } void Load(const Instr::Op& op) { const Value* value = op.value; this->value = value; @@ -177,7 +170,8 @@ struct ValueOp : Op, KEY_TYPE> { X64Emitter::SetupReg(value, reg_); } } -protected: + + protected: REG_TYPE reg_; }; @@ -255,30 +249,34 @@ struct TagTable { Instr::Op op; } table[16]; - template ::type* = nullptr> + template ::type* = nullptr> bool CheckTag(const Instr::Op& op) { return true; } - template ::type* = nullptr> + template ::type* = nullptr> bool CheckTag(const Instr::Op& op) { return true; } - template ::type* = nullptr> + template ::type* = nullptr> bool CheckTag(const Instr::Op& op) { return true; } - template ::type* = nullptr> + template ::type* = nullptr> bool CheckTag(const Instr::Op& op) { return true; } - template = KEY_TYPE_V_I8>::type* = nullptr> + template = + KEY_TYPE_V_I8>::type* = nullptr> bool CheckTag(const Instr::Op& op) { const Value* value = op.value; if (T::tag == -1) { return true; } - if (table[T::tag].valid && - table[T::tag].op.value != value) { + if (table[T::tag].valid && table[T::tag].op.value != value) { return false; } table[T::tag].valid = true; @@ -292,7 +290,8 @@ struct DestField; template struct DestField { DEST dest; -protected: + + protected: bool LoadDest(const Instr* i, TagTable& tag_table) { Instr::Op op; op.value = i->dest; @@ -305,10 +304,8 @@ protected: }; template <> struct DestField { -protected: - bool LoadDest(const Instr* i, TagTable& tag_table) { - return true; - } + protected: + bool LoadDest(const Instr* i, TagTable& tag_table) { return true; } }; template @@ -317,14 +314,16 @@ template struct I : DestField { typedef DestField BASE; static const hir::Opcode opcode = OPCODE; - static const uint32_t key = InstrKey::Construct::value; + static const uint32_t key = + InstrKey::Construct::value; static const KeyType dest_type = DEST::key_type; const Instr* instr; -protected: - template friend struct SequenceFields; + + protected: + template + friend struct SequenceFields; bool Load(const Instr* i, TagTable& tag_table) { - if (InstrKey(i).value == key && - BASE::LoadDest(i, tag_table)) { + if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table)) { instr = i; return true; } @@ -335,16 +334,18 @@ template struct I : DestField { typedef DestField BASE; static const hir::Opcode opcode = OPCODE; - static const uint32_t key = InstrKey::Construct::value; + static const uint32_t key = + InstrKey::Construct::value; static const KeyType dest_type = DEST::key_type; static const KeyType src1_type = SRC1::key_type; const Instr* instr; SRC1 src1; -protected: - template friend struct SequenceFields; + + protected: + template + friend struct SequenceFields; bool Load(const Instr* i, TagTable& tag_table) { - if (InstrKey(i).value == key && - BASE::LoadDest(i, tag_table) && + if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) && tag_table.CheckTag(i->src1)) { instr = i; src1.Load(i->src1); @@ -357,18 +358,20 @@ template struct I : DestField { typedef DestField BASE; static const hir::Opcode opcode = OPCODE; - static const uint32_t key = InstrKey::Construct::value; + static const uint32_t key = InstrKey::Construct< + OPCODE, DEST::key_type, SRC1::key_type, SRC2::key_type>::value; static const KeyType dest_type = DEST::key_type; static const KeyType src1_type = SRC1::key_type; static const KeyType src2_type = SRC2::key_type; const Instr* instr; SRC1 src1; SRC2 src2; -protected: - template friend struct SequenceFields; + + protected: + template + friend struct SequenceFields; bool Load(const Instr* i, TagTable& tag_table) { - if (InstrKey(i).value == key && - BASE::LoadDest(i, tag_table) && + if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) && tag_table.CheckTag(i->src1) && tag_table.CheckTag(i->src2)) { instr = i; @@ -379,11 +382,14 @@ protected: return false; } }; -template +template struct I : DestField { typedef DestField BASE; static const hir::Opcode opcode = OPCODE; - static const uint32_t key = InstrKey::Construct::value; + static const uint32_t key = + InstrKey::Construct::value; static const KeyType dest_type = DEST::key_type; static const KeyType src1_type = SRC1::key_type; static const KeyType src2_type = SRC2::key_type; @@ -392,11 +398,12 @@ struct I : DestField { SRC1 src1; SRC2 src2; SRC3 src3; -protected: - template friend struct SequenceFields; + + protected: + template + friend struct SequenceFields; bool Load(const Instr* i, TagTable& tag_table) { - if (InstrKey(i).value == key && - BASE::LoadDest(i, tag_table) && + if (InstrKey(i).value == key && BASE::LoadDest(i, tag_table) && tag_table.CheckTag(i->src1) && tag_table.CheckTag(i->src2) && tag_table.CheckTag(i->src3)) { @@ -415,8 +422,10 @@ struct SequenceFields; template struct SequenceFields { I1 i1; -protected: - template friend struct Sequence; + + protected: + template + friend struct Sequence; bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) { if (i1.Load(i, tag_table)) { *new_tail = i->next; @@ -428,8 +437,10 @@ protected: template struct SequenceFields : SequenceFields { I2 i2; -protected: - template friend struct Sequence; + + protected: + template + friend struct Sequence; bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) { if (SequenceFields::Check(i, tag_table, new_tail)) { auto ni = i->next; @@ -444,8 +455,10 @@ protected: template struct SequenceFields : SequenceFields { I3 i3; -protected: - template friend struct Sequence; + + protected: + template + friend struct Sequence; bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) { if (SequenceFields::Check(i, tag_table, new_tail)) { auto ni = i->next; @@ -460,8 +473,10 @@ protected: template struct SequenceFields : SequenceFields { I4 i4; -protected: - template friend struct Sequence; + + protected: + template + friend struct Sequence; bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) { if (SequenceFields::Check(i, tag_table, new_tail)) { auto ni = i->next; @@ -476,8 +491,10 @@ protected: template struct SequenceFields : SequenceFields { I5 i5; -protected: - template friend struct Sequence; + + protected: + template + friend struct Sequence; bool Check(const Instr* i, TagTable& tag_table, const Instr** new_tail) { if (SequenceFields::Check(i, tag_table, new_tail)) { auto ni = i->next; @@ -528,7 +545,7 @@ template struct SingleSequence : public Sequence, T> { typedef Sequence, T> BASE; typedef T EmitArgType; - // TODO(benvanik): find a way to do this cross-compiler. +// TODO(benvanik): find a way to do this cross-compiler. #if XE_COMPILER_MSVC static uint32_t head_key() { return T::key; } #else @@ -539,9 +556,8 @@ struct SingleSequence : public Sequence, T> { } template - static void EmitUnaryOp( - X64Emitter& e, const EmitArgType& i, - const REG_FN& reg_fn) { + static void EmitUnaryOp(X64Emitter& e, const EmitArgType& i, + const REG_FN& reg_fn) { if (i.src1.is_constant) { e.mov(i.dest, i.src1.constant()); reg_fn(e, i.dest); @@ -554,9 +570,9 @@ struct SingleSequence : public Sequence, T> { } template - static void EmitCommutativeBinaryOp( - X64Emitter& e, const EmitArgType& i, - const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) { + static void EmitCommutativeBinaryOp(X64Emitter& e, const EmitArgType& i, + const REG_REG_FN& reg_reg_fn, + const REG_CONST_FN& reg_const_fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); if (i.dest == i.src2) { @@ -596,9 +612,9 @@ struct SingleSequence : public Sequence, T> { } } template - static void EmitAssociativeBinaryOp( - X64Emitter& e, const EmitArgType& i, - const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) { + static void EmitAssociativeBinaryOp(X64Emitter& e, const EmitArgType& i, + const REG_REG_FN& reg_reg_fn, + const REG_CONST_FN& reg_const_fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); if (i.dest == i.src2) { @@ -645,8 +661,8 @@ struct SingleSequence : public Sequence, T> { } template - static void EmitCommutativeBinaryXmmOp( - X64Emitter& e, const EmitArgType& i, const FN& fn) { + static void EmitCommutativeBinaryXmmOp(X64Emitter& e, const EmitArgType& i, + const FN& fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); e.LoadConstantXmm(e.xmm0, i.src1.constant()); @@ -660,8 +676,8 @@ struct SingleSequence : public Sequence, T> { } template - static void EmitAssociativeBinaryXmmOp( - X64Emitter& e, const EmitArgType& i, const FN& fn) { + static void EmitAssociativeBinaryXmmOp(X64Emitter& e, const EmitArgType& i, + const FN& fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); e.LoadConstantXmm(e.xmm0, i.src1.constant()); @@ -675,9 +691,9 @@ struct SingleSequence : public Sequence, T> { } template - static void EmitCommutativeCompareOp( - X64Emitter& e, const EmitArgType& i, - const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) { + static void EmitCommutativeCompareOp(X64Emitter& e, const EmitArgType& i, + const REG_REG_FN& reg_reg_fn, + const REG_CONST_FN& reg_const_fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); if (i.src1.ConstantFitsIn32Reg()) { @@ -700,13 +716,14 @@ struct SingleSequence : public Sequence, T> { } } template - static void EmitAssociativeCompareOp( - X64Emitter& e, const EmitArgType& i, - const REG_REG_FN& reg_reg_fn, const REG_CONST_FN& reg_const_fn) { + static void EmitAssociativeCompareOp(X64Emitter& e, const EmitArgType& i, + const REG_REG_FN& reg_reg_fn, + const REG_CONST_FN& reg_const_fn) { if (i.src1.is_constant) { assert_true(!i.src2.is_constant); if (i.src1.ConstantFitsIn32Reg()) { - reg_const_fn(e, i.dest, i.src2, static_cast(i.src1.constant()), true); + reg_const_fn(e, i.dest, i.src2, static_cast(i.src1.constant()), + true); } else { auto temp = GetTempReg(e); e.mov(temp, i.src1.constant()); @@ -714,7 +731,8 @@ struct SingleSequence : public Sequence, T> { } } else if (i.src2.is_constant) { if (i.src2.ConstantFitsIn32Reg()) { - reg_const_fn(e, i.dest, i.src1, static_cast(i.src2.constant()), false); + reg_const_fn(e, i.dest, i.src1, static_cast(i.src2.constant()), + false); } else { auto temp = GetTempReg(e); e.mov(temp, i.src2.constant()); @@ -739,7 +757,7 @@ static const tag_t TAG7 = 7; template void Register() { - sequence_table.insert({ T::head_key(), T::Select }); + sequence_table.insert({T::head_key(), T::Select}); } template void Register() { @@ -747,9 +765,7 @@ void Register() { Register(); }; #define EMITTER_OPCODE_TABLE(name, ...) \ - void Register_##name() { \ - Register<__VA_ARGS__>(); \ - } + void Register_##name() { Register<__VA_ARGS__>(); } #define MATCH(...) __VA_ARGS__ #define EMITTER(name, match) struct name : SingleSequence diff --git a/src/xenia/debug_agent.cc b/src/xenia/debug_agent.cc index 74fbcabee..c21fd78d7 100644 --- a/src/xenia/debug_agent.cc +++ b/src/xenia/debug_agent.cc @@ -50,8 +50,7 @@ int DebugAgent::SetupTracing(const std::string& trace_file, uint64_t capacity) { auto file_path = xe::to_wstring(trace_file); file_ = CreateFile(file_path.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY, - nullptr); + FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY, nullptr); if (!file_) { XELOGE("Could not open trace file for writing"); return 1; diff --git a/src/xenia/gpu/gl4/blitter.h b/src/xenia/gpu/gl4/blitter.h index eaa702d83..b70c62e9c 100644 --- a/src/xenia/gpu/gl4/blitter.h +++ b/src/xenia/gpu/gl4/blitter.h @@ -48,7 +48,8 @@ class Blitter { GLuint dest_texture, Rect2D dest_rect); private: - void Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect, GLenum filter); + void Draw(GLuint src_texture, Rect2D src_rect, Rect2D dest_rect, + GLenum filter); GLuint vertex_program_; GLuint color_fragment_program_; diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index b95c97fae..deaa2dff3 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2106,31 +2106,29 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateBlendState() { draw_batcher_.Flush(DrawBatcher::FlushMode::kStateChange); - static const GLenum blend_map[] = { - /* 0 */ GL_ZERO, - /* 1 */ GL_ONE, - /* 2 */ GL_ZERO, // ? - /* 3 */ GL_ZERO, // ? - /* 4 */ GL_SRC_COLOR, - /* 5 */ GL_ONE_MINUS_SRC_COLOR, - /* 6 */ GL_SRC_ALPHA, - /* 7 */ GL_ONE_MINUS_SRC_ALPHA, - /* 8 */ GL_DST_COLOR, - /* 9 */ GL_ONE_MINUS_DST_COLOR, - /* 10 */ GL_DST_ALPHA, - /* 11 */ GL_ONE_MINUS_DST_ALPHA, - /* 12 */ GL_CONSTANT_COLOR, - /* 13 */ GL_ONE_MINUS_CONSTANT_COLOR, - /* 14 */ GL_CONSTANT_ALPHA, - /* 15 */ GL_ONE_MINUS_CONSTANT_ALPHA, - /* 16 */ GL_SRC_ALPHA_SATURATE, + static const GLenum blend_map[] = {/* 0 */ GL_ZERO, + /* 1 */ GL_ONE, + /* 2 */ GL_ZERO, // ? + /* 3 */ GL_ZERO, // ? + /* 4 */ GL_SRC_COLOR, + /* 5 */ GL_ONE_MINUS_SRC_COLOR, + /* 6 */ GL_SRC_ALPHA, + /* 7 */ GL_ONE_MINUS_SRC_ALPHA, + /* 8 */ GL_DST_COLOR, + /* 9 */ GL_ONE_MINUS_DST_COLOR, + /* 10 */ GL_DST_ALPHA, + /* 11 */ GL_ONE_MINUS_DST_ALPHA, + /* 12 */ GL_CONSTANT_COLOR, + /* 13 */ GL_ONE_MINUS_CONSTANT_COLOR, + /* 14 */ GL_CONSTANT_ALPHA, + /* 15 */ GL_ONE_MINUS_CONSTANT_ALPHA, + /* 16 */ GL_SRC_ALPHA_SATURATE, }; - static const GLenum blend_op_map[] = { - /* 0 */ GL_FUNC_ADD, - /* 1 */ GL_FUNC_SUBTRACT, - /* 2 */ GL_MIN, - /* 3 */ GL_MAX, - /* 4 */ GL_FUNC_REVERSE_SUBTRACT, + static const GLenum blend_op_map[] = {/* 0 */ GL_FUNC_ADD, + /* 1 */ GL_FUNC_SUBTRACT, + /* 2 */ GL_MIN, + /* 3 */ GL_MAX, + /* 4 */ GL_FUNC_REVERSE_SUBTRACT, }; for (int i = 0; i < xe::countof(regs.rb_blendcontrol); ++i) { uint32_t blend_control = regs.rb_blendcontrol[i]; @@ -2183,25 +2181,23 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateDepthStencilState() { draw_batcher_.Flush(DrawBatcher::FlushMode::kStateChange); - static const GLenum compare_func_map[] = { - /* 0 */ GL_NEVER, - /* 1 */ GL_LESS, - /* 2 */ GL_EQUAL, - /* 3 */ GL_LEQUAL, - /* 4 */ GL_GREATER, - /* 5 */ GL_NOTEQUAL, - /* 6 */ GL_GEQUAL, - /* 7 */ GL_ALWAYS, + static const GLenum compare_func_map[] = {/* 0 */ GL_NEVER, + /* 1 */ GL_LESS, + /* 2 */ GL_EQUAL, + /* 3 */ GL_LEQUAL, + /* 4 */ GL_GREATER, + /* 5 */ GL_NOTEQUAL, + /* 6 */ GL_GEQUAL, + /* 7 */ GL_ALWAYS, }; - static const GLenum stencil_op_map[] = { - /* 0 */ GL_KEEP, - /* 1 */ GL_ZERO, - /* 2 */ GL_REPLACE, - /* 3 */ GL_INCR_WRAP, - /* 4 */ GL_DECR_WRAP, - /* 5 */ GL_INVERT, - /* 6 */ GL_INCR, - /* 7 */ GL_DECR, + static const GLenum stencil_op_map[] = {/* 0 */ GL_KEEP, + /* 1 */ GL_ZERO, + /* 2 */ GL_REPLACE, + /* 3 */ GL_INCR_WRAP, + /* 4 */ GL_DECR_WRAP, + /* 5 */ GL_INVERT, + /* 6 */ GL_INCR, + /* 7 */ GL_DECR, }; // A2XX_RB_DEPTHCONTROL_Z_ENABLE if (regs.rb_depthcontrol & 0x00000002) { diff --git a/src/xenia/gpu/gl4/gl4_shader_translator.cc b/src/xenia/gpu/gl4/gl4_shader_translator.cc index cbf3803d2..715907349 100644 --- a/src/xenia/gpu/gl4/gl4_shader_translator.cc +++ b/src/xenia/gpu/gl4/gl4_shader_translator.cc @@ -1497,15 +1497,22 @@ static const struct { } cf_instructions[] = { #define INSTR(opc, fxn) \ { #opc } - INSTR(NOP, print_cf_nop), INSTR(EXEC, print_cf_exec), - INSTR(EXEC_END, print_cf_exec), INSTR(COND_EXEC, print_cf_exec), - INSTR(COND_EXEC_END, print_cf_exec), INSTR(COND_PRED_EXEC, print_cf_exec), - INSTR(COND_PRED_EXEC_END, print_cf_exec), INSTR(LOOP_START, print_cf_loop), - INSTR(LOOP_END, print_cf_loop), INSTR(COND_CALL, print_cf_jmp_call), - INSTR(RETURN, print_cf_jmp_call), INSTR(COND_JMP, print_cf_jmp_call), - INSTR(ALLOC, print_cf_alloc), INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), - INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), - INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ?? + INSTR(NOP, print_cf_nop), + INSTR(EXEC, print_cf_exec), + INSTR(EXEC_END, print_cf_exec), + INSTR(COND_EXEC, print_cf_exec), + INSTR(COND_EXEC_END, print_cf_exec), + INSTR(COND_PRED_EXEC, print_cf_exec), + INSTR(COND_PRED_EXEC_END, print_cf_exec), + INSTR(LOOP_START, print_cf_loop), + INSTR(LOOP_END, print_cf_loop), + INSTR(COND_CALL, print_cf_jmp_call), + INSTR(RETURN, print_cf_jmp_call), + INSTR(COND_JMP, print_cf_jmp_call), + INSTR(ALLOC, print_cf_alloc), + INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), + INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), + INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ?? #undef INSTR }; @@ -1652,66 +1659,66 @@ bool GL4ShaderTranslator::TranslateVertexFetch(const instr_fetch_vtx_t* vtx, } fetch_types[0xff] = { #define TYPE(id) \ { #id } - TYPE(FMT_1_REVERSE), // 0 - {0}, - TYPE(FMT_8), // 2 - {0}, - {0}, - {0}, - TYPE(FMT_8_8_8_8), // 6 - TYPE(FMT_2_10_10_10), // 7 - {0}, - {0}, - TYPE(FMT_8_8), // 10 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_16), // 24 - TYPE(FMT_16_16), // 25 - TYPE(FMT_16_16_16_16), // 26 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_32), // 33 - TYPE(FMT_32_32), // 34 - TYPE(FMT_32_32_32_32), // 35 - TYPE(FMT_32_FLOAT), // 36 - TYPE(FMT_32_32_FLOAT), // 37 - TYPE(FMT_32_32_32_32_FLOAT), // 38 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_32_32_32_FLOAT), // 57 + TYPE(FMT_1_REVERSE), // 0 + {0}, + TYPE(FMT_8), // 2 + {0}, + {0}, + {0}, + TYPE(FMT_8_8_8_8), // 6 + TYPE(FMT_2_10_10_10), // 7 + {0}, + {0}, + TYPE(FMT_8_8), // 10 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_16), // 24 + TYPE(FMT_16_16), // 25 + TYPE(FMT_16_16_16_16), // 26 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_32), // 33 + TYPE(FMT_32_32), // 34 + TYPE(FMT_32_32_32_32), // 35 + TYPE(FMT_32_FLOAT), // 36 + TYPE(FMT_32_32_FLOAT), // 37 + TYPE(FMT_32_32_32_32_FLOAT), // 38 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_32_32_32_FLOAT), // 57 #undef TYPE - }; + }; // Disassemble. Append(" // %sFETCH:\t", sync ? "(S)" : " "); diff --git a/src/xenia/gpu/gl4/gl_context.cc b/src/xenia/gpu/gl4/gl_context.cc index 70dc5db3b..8ed626134 100644 --- a/src/xenia/gpu/gl4/gl_context.cc +++ b/src/xenia/gpu/gl4/gl_context.cc @@ -96,10 +96,10 @@ bool GLContext::Initialize(HWND hwnd) { int context_flags = 0; #if DEBUG context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; -#endif // DEBUG - int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // - WGL_CONTEXT_MINOR_VERSION_ARB, 5, // - WGL_CONTEXT_FLAGS_ARB, context_flags, // +#endif // DEBUG + int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // + WGL_CONTEXT_MINOR_VERSION_ARB, 5, // + WGL_CONTEXT_FLAGS_ARB, context_flags, // 0}; glrc_ = wglCreateContextAttribsARB(dc_, nullptr, attrib_list); @@ -140,15 +140,15 @@ std::unique_ptr GLContext::CreateShared() { GLContextLock context_lock(this); int context_flags = 0; - //int profile = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + // int profile = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; int profile = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; #if DEBUG context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; -#endif // DEBUG - int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // - WGL_CONTEXT_MINOR_VERSION_ARB, 5, // - WGL_CONTEXT_FLAGS_ARB, context_flags, // - WGL_CONTEXT_PROFILE_MASK_ARB, profile, // +#endif // DEBUG + int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // + WGL_CONTEXT_MINOR_VERSION_ARB, 5, // + WGL_CONTEXT_FLAGS_ARB, context_flags, // + WGL_CONTEXT_PROFILE_MASK_ARB, profile, // 0}; new_glrc = wglCreateContextAttribsARB(dc_, glrc_, attrib_list); if (!new_glrc) { @@ -273,9 +273,9 @@ void GLContext::DebugMessage(GLenum source, GLenum type, GLuint id, } void GLAPIENTRY -GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei length, - const GLchar* message, GLvoid* user_param) { + GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, + const GLchar* message, GLvoid* user_param) { reinterpret_cast(user_param) ->DebugMessage(source, type, id, severity, length, message); } diff --git a/src/xenia/gpu/gl4/gl_context.h b/src/xenia/gpu/gl4/gl_context.h index e8b6083c2..12ccebdba 100644 --- a/src/xenia/gpu/gl4/gl_context.h +++ b/src/xenia/gpu/gl4/gl_context.h @@ -43,8 +43,9 @@ class GLContext { void DebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message); static void GLAPIENTRY - DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity, - GLsizei length, const GLchar* message, GLvoid* user_param); + DebugMessageThunk(GLenum source, GLenum type, GLuint id, GLenum severity, + GLsizei length, const GLchar* message, + GLvoid* user_param); HWND hwnd_; HDC dc_; diff --git a/src/xenia/gpu/texture_info.cc b/src/xenia/gpu/texture_info.cc index 89d30f924..d44163652 100644 --- a/src/xenia/gpu/texture_info.cc +++ b/src/xenia/gpu/texture_info.cc @@ -212,7 +212,8 @@ void TextureInfo::CalculateTextureSizes2D(const xe_gpu_texture_fetch_t& fetch) { output_length = size_2d.output_pitch * block_height; } -void TextureInfo::CalculateTextureSizesCube(const xe_gpu_texture_fetch_t& fetch) { +void TextureInfo::CalculateTextureSizesCube( + const xe_gpu_texture_fetch_t& fetch) { assert_true(fetch.size_stack.depth + 1 == 6); size_cube.logical_width = 1 + fetch.size_stack.width; size_cube.logical_height = 1 + fetch.size_stack.height; @@ -232,8 +233,8 @@ void TextureInfo::CalculateTextureSizesCube(const xe_gpu_texture_fetch_t& fetch) size_cube.block_height = tile_height * 32; uint32_t bytes_per_block = format_info->block_width * - format_info->block_height * - format_info->bits_per_pixel / 8; + format_info->block_height * + format_info->bits_per_pixel / 8; uint32_t byte_pitch = tile_width * 32 * bytes_per_block; if (!is_tiled) { // Each row must be a multiple of 256 in linear textures. diff --git a/src/xenia/gpu/trace_viewer_main.cc b/src/xenia/gpu/trace_viewer_main.cc index 4b9af88fc..32cce0d28 100644 --- a/src/xenia/gpu/trace_viewer_main.cc +++ b/src/xenia/gpu/trace_viewer_main.cc @@ -1062,24 +1062,23 @@ void DrawShaderUI(xe::ui::MainWindow* window, TracePlayer& player, // glBlendFuncSeparatei(i, src_blend, dest_blend, src_blend_alpha, // dest_blend_alpha); void DrawBlendMode(uint32_t src_blend, uint32_t dest_blend, uint32_t blend_op) { - static const char* kBlendNames[] = { - /* 0 */ "ZERO", - /* 1 */ "ONE", - /* 2 */ "UNK2", // ? - /* 3 */ "UNK3", // ? - /* 4 */ "SRC_COLOR", - /* 5 */ "ONE_MINUS_SRC_COLOR", - /* 6 */ "SRC_ALPHA", - /* 7 */ "ONE_MINUS_SRC_ALPHA", - /* 8 */ "DST_COLOR", - /* 9 */ "ONE_MINUS_DST_COLOR", - /* 10 */ "DST_ALPHA", - /* 11 */ "ONE_MINUS_DST_ALPHA", - /* 12 */ "CONSTANT_COLOR", - /* 13 */ "ONE_MINUS_CONSTANT_COLOR", - /* 14 */ "CONSTANT_ALPHA", - /* 15 */ "ONE_MINUS_CONSTANT_ALPHA", - /* 16 */ "SRC_ALPHA_SATURATE", + static const char* kBlendNames[] = {/* 0 */ "ZERO", + /* 1 */ "ONE", + /* 2 */ "UNK2", // ? + /* 3 */ "UNK3", // ? + /* 4 */ "SRC_COLOR", + /* 5 */ "ONE_MINUS_SRC_COLOR", + /* 6 */ "SRC_ALPHA", + /* 7 */ "ONE_MINUS_SRC_ALPHA", + /* 8 */ "DST_COLOR", + /* 9 */ "ONE_MINUS_DST_COLOR", + /* 10 */ "DST_ALPHA", + /* 11 */ "ONE_MINUS_DST_ALPHA", + /* 12 */ "CONSTANT_COLOR", + /* 13 */ "ONE_MINUS_CONSTANT_COLOR", + /* 14 */ "CONSTANT_ALPHA", + /* 15 */ "ONE_MINUS_CONSTANT_ALPHA", + /* 16 */ "SRC_ALPHA_SATURATE", }; const char* src_str = kBlendNames[src_blend]; const char* dest_str = kBlendNames[dest_blend]; @@ -2397,7 +2396,7 @@ void ImImpl_Setup() { pixels); // Store our identifier - io.Fonts->TexID = (void*)(intptr_t)tex_id; + io.Fonts->TexID = (void*)(intptr_t) tex_id; io.DeltaTime = 1.0f / 60.0f; io.RenderDrawListsFn = ImImpl_RenderDrawLists; @@ -2539,7 +2538,7 @@ void ImImpl_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count) { for (const ImDrawCmd* pcmd = cmd_list->commands.begin(); pcmd != pcmd_end; pcmd++) { if (pcmd->texture_id != prev_texture_id) { - glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->texture_id); + glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t) pcmd->texture_id); prev_texture_id = pcmd->texture_id; } glScissor((int)pcmd->clip_rect.x, (int)(height - pcmd->clip_rect.w), diff --git a/src/xenia/gpu/ucode_disassembler.cc b/src/xenia/gpu/ucode_disassembler.cc index d414e430d..d66524e2b 100644 --- a/src/xenia/gpu/ucode_disassembler.cc +++ b/src/xenia/gpu/ucode_disassembler.cc @@ -63,9 +63,10 @@ struct Output { }; static const char* levels[] = { - "", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t", - "\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t", "x", "x", "x", - "x", "x", "x", + "", "\t", "\t\t", "\t\t\t", + "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t", "\t\t\t\t\t\t\t", + "\t\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t\t", "x", "x", + "x", "x", "x", "x", }; /* @@ -155,40 +156,39 @@ void print_export_comment(Output* output, uint32_t num, ShaderType type) { struct { uint32_t num_srcs; const char* name; -} vector_instructions[0x20] = - { +} vector_instructions[0x20] = { #define INSTR(opc, num_srcs) \ { num_srcs, #opc } - INSTR(ADDv, 2), // 0 - INSTR(MULv, 2), // 1 - INSTR(MAXv, 2), // 2 - INSTR(MINv, 2), // 3 - INSTR(SETEv, 2), // 4 - INSTR(SETGTv, 2), // 5 - INSTR(SETGTEv, 2), // 6 - INSTR(SETNEv, 2), // 7 - INSTR(FRACv, 1), // 8 - INSTR(TRUNCv, 1), // 9 - INSTR(FLOORv, 1), // 10 - INSTR(MULADDv, 3), // 111 - INSTR(CNDEv, 3), // 12 - INSTR(CNDGTEv, 3), // 13 - INSTR(CNDGTv, 3), // 14 - INSTR(DOT4v, 2), // 15 - INSTR(DOT3v, 2), // 16 - INSTR(DOT2ADDv, 3), // 17 -- ??? - INSTR(CUBEv, 2), // 18 - INSTR(MAX4v, 1), // 19 - INSTR(PRED_SETE_PUSHv, 2), // 20 - INSTR(PRED_SETNE_PUSHv, 2), // 21 - INSTR(PRED_SETGT_PUSHv, 2), // 22 - INSTR(PRED_SETGTE_PUSHv, 2), // 23 - INSTR(KILLEv, 2), // 24 - INSTR(KILLGTv, 2), // 25 - INSTR(KILLGTEv, 2), // 26 - INSTR(KILLNEv, 2), // 27 - INSTR(DSTv, 2), // 28 - INSTR(MOVAv, 1), // 29 + INSTR(ADDv, 2), // 0 + INSTR(MULv, 2), // 1 + INSTR(MAXv, 2), // 2 + INSTR(MINv, 2), // 3 + INSTR(SETEv, 2), // 4 + INSTR(SETGTv, 2), // 5 + INSTR(SETGTEv, 2), // 6 + INSTR(SETNEv, 2), // 7 + INSTR(FRACv, 1), // 8 + INSTR(TRUNCv, 1), // 9 + INSTR(FLOORv, 1), // 10 + INSTR(MULADDv, 3), // 111 + INSTR(CNDEv, 3), // 12 + INSTR(CNDGTEv, 3), // 13 + INSTR(CNDGTv, 3), // 14 + INSTR(DOT4v, 2), // 15 + INSTR(DOT3v, 2), // 16 + INSTR(DOT2ADDv, 3), // 17 -- ??? + INSTR(CUBEv, 2), // 18 + INSTR(MAX4v, 1), // 19 + INSTR(PRED_SETE_PUSHv, 2), // 20 + INSTR(PRED_SETNE_PUSHv, 2), // 21 + INSTR(PRED_SETGT_PUSHv, 2), // 22 + INSTR(PRED_SETGTE_PUSHv, 2), // 23 + INSTR(KILLEv, 2), // 24 + INSTR(KILLGTv, 2), // 25 + INSTR(KILLGTEv, 2), // 26 + INSTR(KILLNEv, 2), // 27 + INSTR(DSTv, 2), // 28 + INSTR(MOVAv, 1), // 29 }, scalar_instructions[0x40] = { INSTR(ADDs, 1), // 0 @@ -353,64 +353,64 @@ struct { } fetch_types[0xff] = { #define TYPE(id) \ { #id } - TYPE(FMT_1_REVERSE), // 0 - {0}, - TYPE(FMT_8), // 2 - {0}, - {0}, - {0}, - TYPE(FMT_8_8_8_8), // 6 - TYPE(FMT_2_10_10_10), // 7 - {0}, - {0}, - TYPE(FMT_8_8), // 10 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_16), // 24 - TYPE(FMT_16_16), // 25 - TYPE(FMT_16_16_16_16), // 26 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_32), // 33 - TYPE(FMT_32_32), // 34 - TYPE(FMT_32_32_32_32), // 35 - TYPE(FMT_32_FLOAT), // 36 - TYPE(FMT_32_32_FLOAT), // 37 - TYPE(FMT_32_32_32_32_FLOAT), // 38 - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - TYPE(FMT_32_32_32_FLOAT), // 57 + TYPE(FMT_1_REVERSE), // 0 + {0}, + TYPE(FMT_8), // 2 + {0}, + {0}, + {0}, + TYPE(FMT_8_8_8_8), // 6 + TYPE(FMT_2_10_10_10), // 7 + {0}, + {0}, + TYPE(FMT_8_8), // 10 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_16), // 24 + TYPE(FMT_16_16), // 25 + TYPE(FMT_16_16_16_16), // 26 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_32), // 33 + TYPE(FMT_32_32), // 34 + TYPE(FMT_32_32_32_32), // 35 + TYPE(FMT_32_FLOAT), // 36 + TYPE(FMT_32_32_FLOAT), // 37 + TYPE(FMT_32_32_32_32_FLOAT), // 38 + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + {0}, + TYPE(FMT_32_32_32_FLOAT), // 57 #undef TYPE }; @@ -556,34 +556,34 @@ struct { } fetch_instructions[] = { #define INSTR(opc, name, fxn) \ { name, fxn } - INSTR(VTX_FETCH, "VERTEX", print_fetch_vtx), // 0 - INSTR(TEX_FETCH, "SAMPLE", print_fetch_tex), // 1 - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - INSTR(TEX_GET_BORDER_COLOR_FRAC, "?", print_fetch_tex), // 16 - INSTR(TEX_GET_COMP_TEX_LOD, "?", print_fetch_tex), // 17 - INSTR(TEX_GET_GRADIENTS, "?", print_fetch_tex), // 18 - INSTR(TEX_GET_WEIGHTS, "?", print_fetch_tex), // 19 - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - INSTR(TEX_SET_TEX_LOD, "SET_TEX_LOD", print_fetch_tex), // 24 - INSTR(TEX_SET_GRADIENTS_H, "?", print_fetch_tex), // 25 - INSTR(TEX_SET_GRADIENTS_V, "?", print_fetch_tex), // 26 - INSTR(TEX_RESERVED_4, "?", print_fetch_tex), // 27 + INSTR(VTX_FETCH, "VERTEX", print_fetch_vtx), // 0 + INSTR(TEX_FETCH, "SAMPLE", print_fetch_tex), // 1 + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + INSTR(TEX_GET_BORDER_COLOR_FRAC, "?", print_fetch_tex), // 16 + INSTR(TEX_GET_COMP_TEX_LOD, "?", print_fetch_tex), // 17 + INSTR(TEX_GET_GRADIENTS, "?", print_fetch_tex), // 18 + INSTR(TEX_GET_WEIGHTS, "?", print_fetch_tex), // 19 + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + INSTR(TEX_SET_TEX_LOD, "SET_TEX_LOD", print_fetch_tex), // 24 + INSTR(TEX_SET_GRADIENTS_H, "?", print_fetch_tex), // 25 + INSTR(TEX_SET_GRADIENTS_V, "?", print_fetch_tex), // 26 + INSTR(TEX_RESERVED_4, "?", print_fetch_tex), // 27 #undef INSTR }; @@ -677,15 +677,22 @@ struct { } cf_instructions[] = { #define INSTR(opc, fxn) \ { #opc, fxn } - INSTR(NOP, print_cf_nop), INSTR(EXEC, print_cf_exec), - INSTR(EXEC_END, print_cf_exec), INSTR(COND_EXEC, print_cf_exec), - INSTR(COND_EXEC_END, print_cf_exec), INSTR(COND_PRED_EXEC, print_cf_exec), - INSTR(COND_PRED_EXEC_END, print_cf_exec), INSTR(LOOP_START, print_cf_loop), - INSTR(LOOP_END, print_cf_loop), INSTR(COND_CALL, print_cf_jmp_call), - INSTR(RETURN, print_cf_jmp_call), INSTR(COND_JMP, print_cf_jmp_call), - INSTR(ALLOC, print_cf_alloc), INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), - INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), - INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ?? + INSTR(NOP, print_cf_nop), + INSTR(EXEC, print_cf_exec), + INSTR(EXEC_END, print_cf_exec), + INSTR(COND_EXEC, print_cf_exec), + INSTR(COND_EXEC_END, print_cf_exec), + INSTR(COND_PRED_EXEC, print_cf_exec), + INSTR(COND_PRED_EXEC_END, print_cf_exec), + INSTR(LOOP_START, print_cf_loop), + INSTR(LOOP_END, print_cf_loop), + INSTR(COND_CALL, print_cf_jmp_call), + INSTR(RETURN, print_cf_jmp_call), + INSTR(COND_JMP, print_cf_jmp_call), + INSTR(ALLOC, print_cf_alloc), + INSTR(COND_EXEC_PRED_CLEAN, print_cf_exec), + INSTR(COND_EXEC_PRED_CLEAN_END, print_cf_exec), + INSTR(MARK_VS_FETCH_DONE, print_cf_nop), // ?? #undef INSTR }; diff --git a/src/xenia/hid/hid-private.h b/src/xenia/hid/hid-private.h index 1326d7fdf..b1c6230e0 100644 --- a/src/xenia/hid/hid-private.h +++ b/src/xenia/hid/hid-private.h @@ -12,8 +12,6 @@ #include - DECLARE_string(hid); - #endif // XENIA_HID_HID_PRIVATE_H_ diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.cc b/src/xenia/kernel/fs/devices/disc_image_entry.cc index 0f513a0dd..9d0db7f0b 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.cc +++ b/src/xenia/kernel/fs/devices/disc_image_entry.cc @@ -64,8 +64,7 @@ X_STATUS DiscImageEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length, if (!entry) { return X_STATUS_NO_SUCH_FILE; } - } - else { + } else { if (restart) { it_ = gdfx_entry_->children.begin(); } diff --git a/src/xenia/kernel/fs/devices/host_path_file.cc b/src/xenia/kernel/fs/devices/host_path_file.cc index dbf5f5a6a..161e7e77b 100644 --- a/src/xenia/kernel/fs/devices/host_path_file.cc +++ b/src/xenia/kernel/fs/devices/host_path_file.cc @@ -18,9 +18,7 @@ namespace fs { HostPathFile::HostPathFile(KernelState* kernel_state, Mode mode, HostPathEntry* entry, HANDLE file_handle) - : entry_(entry), - file_handle_(file_handle), - XFile(kernel_state, mode) {} + : entry_(entry), file_handle_(file_handle), XFile(kernel_state, mode) {} HostPathFile::~HostPathFile() { CloseHandle(file_handle_); diff --git a/src/xenia/kernel/fs/devices/stfs_container_device.cc b/src/xenia/kernel/fs/devices/stfs_container_device.cc index c4aa0561f..4addc264c 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_device.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_device.cc @@ -39,7 +39,7 @@ int STFSContainerDevice::Init() { return 1; } - //stfs_->Dump(); + // stfs_->Dump(); return 0; } diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.cc b/src/xenia/kernel/fs/devices/stfs_container_entry.cc index c1c308416..4686b0854 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.cc @@ -45,7 +45,7 @@ X_STATUS STFSContainerEntry::QueryDirectory(XDirectoryInfo* out_info, STFSEntry* entry(nullptr); - if( file_name != nullptr ) { + if (file_name != nullptr) { // Only queries in the current directory are supported for now assert_true(std::strchr(file_name, '\\') == nullptr); diff --git a/src/xenia/kernel/fs/entry.cc b/src/xenia/kernel/fs/entry.cc index 52a08cdc7..623b623bb 100644 --- a/src/xenia/kernel/fs/entry.cc +++ b/src/xenia/kernel/fs/entry.cc @@ -30,9 +30,7 @@ Entry::Entry(Device* device, const std::string& path) Entry::~Entry() = default; -bool Entry::is_read_only() const { - return device_->is_read_only(); -} +bool Entry::is_read_only() const { return device_->is_read_only(); } } // namespace fs } // namespace kernel diff --git a/src/xenia/kernel/fs/filesystem.h b/src/xenia/kernel/fs/filesystem.h index 7b4e7ecbc..91a90980b 100644 --- a/src/xenia/kernel/fs/filesystem.h +++ b/src/xenia/kernel/fs/filesystem.h @@ -39,8 +39,7 @@ class FileSystem { int RegisterDevice(const std::string& path, Device* device); int RegisterHostPathDevice(const std::string& path, - const std::wstring& local_path, - bool read_only); + const std::wstring& local_path, bool read_only); int RegisterDiscImageDevice(const std::string& path, const std::wstring& local_path); int RegisterSTFSContainerDevice(const std::string& path, diff --git a/src/xenia/kernel/object_table.cc b/src/xenia/kernel/object_table.cc index 5b3418b59..b4b3811f6 100644 --- a/src/xenia/kernel/object_table.cc +++ b/src/xenia/kernel/object_table.cc @@ -213,7 +213,7 @@ X_STATUS ObjectTable::AddNameMapping(const std::string& name, X_HANDLE handle) { if (name_table_.count(name)) { return X_STATUS_OBJECT_NAME_COLLISION; } - name_table_.insert({ name, handle }); + name_table_.insert({name, handle}); return X_STATUS_SUCCESS; } diff --git a/src/xenia/kernel/objects/xenumerator.cc b/src/xenia/kernel/objects/xenumerator.cc index c917a39a7..ed367e03b 100644 --- a/src/xenia/kernel/objects/xenumerator.cc +++ b/src/xenia/kernel/objects/xenumerator.cc @@ -16,8 +16,7 @@ XEnumerator::XEnumerator(KernelState* kernel_state, size_t item_capacity, size_t item_size) : XObject(kernel_state, kTypeEnumerator), item_capacity_(item_capacity), - item_size_(item_size) -{} + item_size_(item_size) {} XEnumerator::~XEnumerator() = default; diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 7db1cbf03..367377972 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -424,8 +424,9 @@ void XThread::DeliverAPCs(void* data) { // kernel_routine(apc_address, &normal_routine, &normal_context, // &system_arg1, &system_arg2) uint64_t kernel_args[] = { - apc_address, thread->scratch_address_ + 0, thread->scratch_address_ + 4, - thread->scratch_address_ + 8, thread->scratch_address_ + 12, + apc_address, thread->scratch_address_ + 0, + thread->scratch_address_ + 4, thread->scratch_address_ + 8, + thread->scratch_address_ + 12, }; processor->ExecuteInterrupt(0, kernel_routine, kernel_args, xe::countof(kernel_args)); diff --git a/src/xenia/kernel/xam_module.cc b/src/xenia/kernel/xam_module.cc index 4237b2e6c..4eb9920f2 100644 --- a/src/xenia/kernel/xam_module.cc +++ b/src/xenia/kernel/xam_module.cc @@ -40,7 +40,7 @@ void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) { return; } - // Build the export table used for resolution. +// Build the export table used for resolution. #include "xenia/kernel/util/export_table_pre.inc" static xe::cpu::KernelExport xam_export_table[] = { #include "xenia/kernel/xam_table.inc" diff --git a/src/xenia/kernel/xam_msg.cc b/src/xenia/kernel/xam_msg.cc index deb355f25..7fa57a7eb 100644 --- a/src/xenia/kernel/xam_msg.cc +++ b/src/xenia/kernel/xam_msg.cc @@ -33,7 +33,8 @@ SHIM_CALL XMsgInProcessCall_shim(PPCContext* ppc_state, KernelState* state) { SHIM_SET_RETURN_32(result); } -SHIM_CALL XMsgSystemProcessCall_shim(PPCContext* ppc_state, KernelState* state) { +SHIM_CALL XMsgSystemProcessCall_shim(PPCContext* ppc_state, + KernelState* state) { uint32_t app = SHIM_GET_ARG_32(0); uint32_t message = SHIM_GET_ARG_32(1); uint32_t buffer = SHIM_GET_ARG_32(2); diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc index c8e9b7815..91eb46505 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam_net.cc @@ -283,7 +283,7 @@ SHIM_CALL NetDll_select_shim(PPCContext* ppc_state, KernelState* state) { uint32_t timeout_ptr = SHIM_GET_ARG_32(5); XELOGD("NetDll_select(%d, %d, %.8X, %.8X, %.8X, %.8X)", arg0, nfds, readfds_ptr, writefds_ptr, exceptfds_ptr, timeout_ptr); - fd_set readfds = { 0 }; + fd_set readfds = {0}; if (readfds_ptr) { LoadFdset(SHIM_MEM_ADDR(readfds_ptr), &readfds); } diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index 25f1c46cf..d180e8592 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -416,7 +416,8 @@ SHIM_CALL XamWriteGamerTile_shim(PPCContext* ppc_state, KernelState* state) { } } -SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, KernelState* state) { +SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, + KernelState* state) { uint32_t handle_ptr = SHIM_GET_ARG_32(0); XELOGD("XamSessionCreateHandle(%.8X)", handle_ptr); @@ -426,7 +427,8 @@ SHIM_CALL XamSessionCreateHandle_shim(PPCContext* ppc_state, KernelState* state) SHIM_SET_RETURN_32(X_ERROR_SUCCESS); } -SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state, KernelState* state) { +SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state, + KernelState* state) { uint32_t handle = SHIM_GET_ARG_32(0); uint32_t obj_ptr = SHIM_GET_ARG_32(1); diff --git a/src/xenia/kernel/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl_threading.cc index ac72a03ba..a8dbaa8ae 100644 --- a/src/xenia/kernel/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl_threading.cc @@ -319,7 +319,7 @@ SHIM_CALL KeDelayExecutionThread_shim(PPCContext* ppc_state, } SHIM_CALL NtYieldExecution_shim(PPCContext* ppc_state, KernelState* state) { - //XELOGD("NtYieldExecution()"); + // XELOGD("NtYieldExecution()"); XThread* thread = XThread::GetCurrentThread(); X_STATUS result = thread->Delay(0, 0, 0); SHIM_SET_RETURN_64(0); diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 78cfdf230..a26223569 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -224,15 +224,24 @@ const static struct { uint32_t virtual_address_end; uint32_t target_address; } map_info[] = { - 0x00000000, 0x3FFFFFFF, 0x00000000, // (1024mb) - virtual 4k pages - 0x40000000, 0x7EFFFFFF, 0x40000000, // (1024mb) - virtual 64k pages (cont) - 0x7F000000, 0x7F0FFFFF, 0x00000000, // (1mb) - GPU writeback - 0x7F100000, 0x7FFFFFFF, 0x00100000, // (15mb) - XPS? - 0x80000000, 0x8FFFFFFF, 0x80000000, // (256mb) - xex 64k pages - 0x90000000, 0x9FFFFFFF, 0x80000000, // (256mb) - xex 4k pages - 0xA0000000, 0xBFFFFFFF, 0x00000000, // (512mb) - physical 64k pages - 0xC0000000, 0xDFFFFFFF, 0x00000000, // - physical 16mb pages - 0xE0000000, 0xFFFFFFFF, 0x00000000, // - physical 4k pages + 0x00000000, 0x3FFFFFFF, + 0x00000000, // (1024mb) - virtual 4k pages + 0x40000000, 0x7EFFFFFF, + 0x40000000, // (1024mb) - virtual 64k pages (cont) + 0x7F000000, 0x7F0FFFFF, + 0x00000000, // (1mb) - GPU writeback + 0x7F100000, 0x7FFFFFFF, + 0x00100000, // (15mb) - XPS? + 0x80000000, 0x8FFFFFFF, + 0x80000000, // (256mb) - xex 64k pages + 0x90000000, 0x9FFFFFFF, + 0x80000000, // (256mb) - xex 4k pages + 0xA0000000, 0xBFFFFFFF, + 0x00000000, // (512mb) - physical 64k pages + 0xC0000000, 0xDFFFFFFF, + 0x00000000, // - physical 16mb pages + 0xE0000000, 0xFFFFFFFF, + 0x00000000, // - physical 4k pages }; int Memory::MapViews(uint8_t* mapping_base) { assert_true(xe::countof(map_info) == xe::countof(views_.all_views)); diff --git a/src/xenia/tools/api-scanner/api_scanner_loader.cc b/src/xenia/tools/api-scanner/api_scanner_loader.cc index 65f36f736..b94b72aff 100644 --- a/src/xenia/tools/api-scanner/api_scanner_loader.cc +++ b/src/xenia/tools/api-scanner/api_scanner_loader.cc @@ -16,21 +16,19 @@ namespace tools { void apiscanner_logger::operator()(const LogType type, const char* szMessage) { switch (type) { - case LT_WARNING: - fprintf(stderr, "[W] %s\n", szMessage); - break; - case LT_ERROR: - fprintf(stderr, "[!] %s\n", szMessage); - break; - default: - break; + case LT_WARNING: + fprintf(stderr, "[W] %s\n", szMessage); + break; + case LT_ERROR: + fprintf(stderr, "[!] %s\n", szMessage); + break; + default: + break; } } apiscanner_loader::apiscanner_loader() - : export_resolver(nullptr) - , memory_(nullptr) -{ + : export_resolver(nullptr), memory_(nullptr) { export_resolver = std::make_unique(); kernel::XamModule::RegisterExportTable(export_resolver.get()); @@ -40,8 +38,7 @@ apiscanner_loader::apiscanner_loader() memory_->Initialize(); } -apiscanner_loader::~apiscanner_loader() -{ +apiscanner_loader::~apiscanner_loader() { if (export_resolver != nullptr) { export_resolver.reset(); } @@ -62,7 +59,6 @@ bool apiscanner_loader::LoadTitleImports(const std::wstring& target) { return ReadTarget(); } - bool apiscanner_loader::ReadTarget() { // XXX Do a wildcard search for all xex files? const char path[] = "game:\\default.xex"; @@ -91,8 +87,7 @@ bool apiscanner_loader::ReadTarget() { if (read_result) { loaded_titles.push_back(res); } - } - else { + } else { kernel::XFileInfo file_info; if (fs_entry->QueryInfo(&file_info)) { if (file) { @@ -107,7 +102,7 @@ bool apiscanner_loader::ReadTarget() { // XXX No kernel state again int result = file_system.Open(std::move(fs_entry), nullptr, - kernel::fs::Mode::READ, false, &file); + kernel::fs::Mode::READ, false, &file); if (result) { if (file) { file->Release(); @@ -141,10 +136,9 @@ bool apiscanner_loader::ReadTarget() { } bool apiscanner_loader::ExtractImports(const void* addr, const size_t length, - title& info) -{ + title& info) { // Load the XEX into memory and decrypt. - xe_xex2_options_t xex_options = { 0 }; + xe_xex2_options_t xex_options = {0}; xe_xex2_ref xex_(xe_xex2_load(memory_.get(), addr, length, xex_options)); if (!xex_) { log(log.LT_ERROR, "Failed to parse xex file"); @@ -154,7 +148,7 @@ bool apiscanner_loader::ExtractImports(const void* addr, const size_t length, const xe_xex2_header_t* header = xe_xex2_get_header(xex_); info.title_id = header->execution_info.title_id; - + // XXX Copy out library versions? for (size_t n = 0; n < header->import_library_count; n++) { const xe_xex2_import_library_t* library = &header->import_libraries[n]; @@ -162,8 +156,7 @@ bool apiscanner_loader::ExtractImports(const void* addr, const size_t length, xe_xex2_import_info_t* import_infos; size_t import_info_count; if (!xe_xex2_get_import_infos(xex_, library, &import_infos, - &import_info_count)) { - + &import_info_count)) { for (size_t m = 0; m < import_info_count; m++) { const xe_xex2_import_info_t* import_info = &import_infos[m]; @@ -186,5 +179,5 @@ bool apiscanner_loader::ExtractImports(const void* addr, const size_t length, return true; } -} // tools -} // xe +} // tools +} // xe diff --git a/src/xenia/tools/api-scanner/api_scanner_loader.h b/src/xenia/tools/api-scanner/api_scanner_loader.h index c84e405d9..2d26ebda9 100644 --- a/src/xenia/tools/api-scanner/api_scanner_loader.h +++ b/src/xenia/tools/api-scanner/api_scanner_loader.h @@ -22,46 +22,39 @@ namespace xe { namespace tools { - class apiscanner_logger - { - public: - enum LogType { - LT_WARNING, - LT_ERROR - }; +class apiscanner_logger { + public: + enum LogType { LT_WARNING, LT_ERROR }; - void operator()(const LogType type, const char* szMessage); + void operator()(const LogType type, const char* szMessage); +}; + +class apiscanner_loader { + private: + kernel::fs::FileSystem file_system; + apiscanner_logger log; + std::unique_ptr memory_; + std::unique_ptr export_resolver; + + public: + apiscanner_loader(); + ~apiscanner_loader(); + + bool LoadTitleImports(const std::wstring& target); + + struct title { + uint32_t title_id; + std::vector imports; }; - class apiscanner_loader - { - private: - kernel::fs::FileSystem file_system; - apiscanner_logger log; - std::unique_ptr memory_; - std::unique_ptr export_resolver; + const std::vector& GetAllTitles() const { return loaded_titles; } - public: - apiscanner_loader(); - ~apiscanner_loader(); + private: + std::vector<title> loaded_titles; - bool LoadTitleImports(const std::wstring& target); - - struct title - { - uint32_t title_id; - std::vector<std::string> imports; - }; - - const std::vector<title>& GetAllTitles() const { return loaded_titles; } - - private: - std::vector<title> loaded_titles; - - bool ReadTarget(); - bool ExtractImports(const void* addr, const size_t length, title& info); - }; - -} // tools -} // xe + bool ReadTarget(); + bool ExtractImports(const void* addr, const size_t length, title& info); +}; +} // tools +} // xe diff --git a/src/xenia/tools/api-scanner/api_scanner_main.cc b/src/xenia/tools/api-scanner/api_scanner_main.cc index caf67d665..46796974d 100644 --- a/src/xenia/tools/api-scanner/api_scanner_main.cc +++ b/src/xenia/tools/api-scanner/api_scanner_main.cc @@ -16,7 +16,6 @@ namespace tools { DEFINE_string(target, "", "List of file to extract imports from"); int api_scanner_main(std::vector<std::wstring>& args) { - // XXX we need gflags to split multiple flags into arrays for us if (args.size() == 2 || !FLAGS_target.empty()) { @@ -44,4 +43,4 @@ int api_scanner_main(std::vector<std::wstring>& args) { } // namespace xe DEFINE_ENTRY_POINT(L"api-scanner", L"api-scanner --target=<target file>", - xe::tools::api_scanner_main); + xe::tools::api_scanner_main); diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index ab6e1b099..a1412de02 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -18,10 +18,8 @@ namespace xe { #pragma pack(push, 4) - typedef uint32_t X_HANDLE; -#define X_INVALID_HANDLE_VALUE ((X_HANDLE)-1) - +#define X_INVALID_HANDLE_VALUE ((X_HANDLE)-1) // TODO(benvanik): type all of this so we get some safety. @@ -170,7 +168,6 @@ enum X_FILE_ATTRIBUTES { X_FILE_ATTRIBUTE_ENCRYPTED = 0x4000, }; - // http://code.google.com/p/vdash/source/browse/trunk/vdash/include/kernel.h enum X_FILE_INFORMATION_CLASS { XFileDirectoryInformation = 1, @@ -246,18 +243,14 @@ inline void XOverlappedSetExtendedError(void* ptr, uint32_t value) { } class X_ANSI_STRING { -private: - uint16_t length; - uint16_t maximum_length; + private: + uint16_t length; + uint16_t maximum_length; const char* buffer; -public: - X_ANSI_STRING() { - Zero(); - } - X_ANSI_STRING(const uint8_t* base, uint32_t p) { - Read(base, p); - } + public: + X_ANSI_STRING() { Zero(); } + X_ANSI_STRING(const uint8_t* base, uint32_t p) { Read(base, p); } void Read(const uint8_t* base, uint32_t p) { length = xe::load_and_swap<uint16_t>(base + p); maximum_length = xe::load_and_swap<uint16_t>(base + p + 2); @@ -287,13 +280,11 @@ public: return result; } }; -//static_assert_size(X_ANSI_STRING, 8); - +// static_assert_size(X_ANSI_STRING, 8); // Values seem to be all over the place - GUIDs? typedef uint32_t XNotificationID; - // http://ffplay360.googlecode.com/svn/trunk/Common/XTLOnPC.h struct X_VIDEO_MODE { be<uint32_t> display_width;