diff --git a/src/xenia/base/threading.h b/src/xenia/base/threading.h index 351009df5..527188208 100644 --- a/src/xenia/base/threading.h +++ b/src/xenia/base/threading.h @@ -162,7 +162,8 @@ inline WaitResult WaitAll( WaitHandle* wait_handles[], size_t wait_handle_count, bool is_alertable, std::chrono::milliseconds timeout = std::chrono::milliseconds::max()) { return WaitMultiple(wait_handles, wait_handle_count, true, is_alertable, - timeout).first; + timeout) + .first; } inline WaitResult WaitAll( std::vector wait_handles, bool is_alertable, diff --git a/src/xenia/base/threading_win.cc b/src/xenia/base/threading_win.cc index fec9c5764..9d37ba5c4 100644 --- a/src/xenia/base/threading_win.cc +++ b/src/xenia/base/threading_win.cc @@ -61,8 +61,8 @@ void set_name(DWORD thread_id, const std::string& name) { __try { RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), reinterpret_cast(&info)); + } __except (EXCEPTION_EXECUTE_HANDLER) { } - __except(EXCEPTION_EXECUTE_HANDLER) {} } void set_name(const std::string& name) { diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index def77c7c4..d0125e686 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -2979,23 +2979,23 @@ EMITTER_OPCODE_TABLE(OPCODE_COMPARE_NE, COMPARE_NE_I8, COMPARE_NE_I16, static void Emit(X64Emitter& e, const EmitArgType& i) { \ EmitAssociativeCompareOp( \ e, i, \ - [](X64Emitter & e, const Reg8& dest, const reg_type& src1, \ + [](X64Emitter& e, const Reg8& dest, const reg_type& src1, \ const reg_type& src2, bool inverse) { \ - e.cmp(src1, src2); \ - if (!inverse) { \ - e.instr(dest); \ - } else { \ - e.inverse_instr(dest); \ - } \ + e.cmp(src1, src2); \ + if (!inverse) { \ + e.instr(dest); \ + } else { \ + e.inverse_instr(dest); \ + } \ }, \ - [](X64Emitter & e, const Reg8& dest, const reg_type& src1, \ + [](X64Emitter& e, const Reg8& dest, const reg_type& src1, \ int32_t constant, bool inverse) { \ - e.cmp(src1, constant); \ - if (!inverse) { \ - e.instr(dest); \ - } else { \ - e.inverse_instr(dest); \ - } \ + e.cmp(src1, constant); \ + if (!inverse) { \ + e.instr(dest); \ + } else { \ + e.inverse_instr(dest); \ + } \ }); \ } \ }; diff --git a/src/xenia/cpu/frontend/ppc_instr.h b/src/xenia/cpu/frontend/ppc_instr.h index 599534423..8f372d79c 100644 --- a/src/xenia/cpu/frontend/ppc_instr.h +++ b/src/xenia/cpu/frontend/ppc_instr.h @@ -118,8 +118,7 @@ typedef struct { uint32_t LK : 1; uint32_t AA : 1; uint32_t LI : 24; - uint32_t: - 6; + uint32_t : 6; } I; // kXEPPCInstrFormatB struct { @@ -128,8 +127,7 @@ typedef struct { uint32_t BD : 14; uint32_t BI : 5; uint32_t BO : 5; - uint32_t: - 6; + uint32_t : 6; } B; // kXEPPCInstrFormatSC @@ -138,87 +136,71 @@ typedef struct { uint32_t DS : 16; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } D; // kXEPPCInstrFormatDS struct { - uint32_t: - 2; + uint32_t : 2; uint32_t DS : 14; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } DS; // kXEPPCInstrFormatX struct { uint32_t Rc : 1; - uint32_t: - 10; + uint32_t : 10; uint32_t RB : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } X; // kXEPPCInstrFormatXL struct { uint32_t LK : 1; - uint32_t: - 10; + uint32_t : 10; uint32_t BB : 5; uint32_t BI : 5; uint32_t BO : 5; - uint32_t: - 6; + uint32_t : 6; } XL; // kXEPPCInstrFormatXFX struct { - uint32_t: - 1; - uint32_t: - 10; + uint32_t : 1; + uint32_t : 10; uint32_t spr : 10; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } XFX; // kXEPPCInstrFormatXFL struct { uint32_t Rc : 1; - uint32_t: - 10; + uint32_t : 10; uint32_t RB : 5; uint32_t W : 1; uint32_t FM : 8; uint32_t L : 1; - uint32_t: - 6; + uint32_t : 6; } XFL; // kXEPPCInstrFormatXS struct { uint32_t Rc : 1; uint32_t SH5 : 1; - uint32_t: - 9; + uint32_t : 9; uint32_t SH : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } XS; // kXEPPCInstrFormatXO struct { uint32_t Rc : 1; - uint32_t: - 9; + uint32_t : 9; uint32_t OE : 1; uint32_t RB : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } XO; // kXEPPCInstrFormatA struct { @@ -228,8 +210,7 @@ typedef struct { uint32_t FRB : 5; uint32_t FRA : 5; uint32_t FRT : 5; - uint32_t: - 6; + uint32_t : 6; } A; // kXEPPCInstrFormatM struct { @@ -239,8 +220,7 @@ typedef struct { uint32_t SH : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } M; // kXEPPCInstrFormatMD struct { @@ -252,8 +232,7 @@ typedef struct { uint32_t SH : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } MD; // kXEPPCInstrFormatMDS struct { @@ -264,40 +243,33 @@ typedef struct { uint32_t RB : 5; uint32_t RA : 5; uint32_t RT : 5; - uint32_t: - 6; + uint32_t : 6; } MDS; // kXEPPCInstrFormatVXA struct { - uint32_t: - 6; + uint32_t : 6; uint32_t VC : 5; uint32_t VB : 5; uint32_t VA : 5; uint32_t VD : 5; - uint32_t: - 6; + uint32_t : 6; } VXA; // kXEPPCInstrFormatVX struct { - uint32_t: - 11; + uint32_t : 11; uint32_t VB : 5; uint32_t VA : 5; uint32_t VD : 5; - uint32_t: - 6; + uint32_t : 6; } VX; // kXEPPCInstrFormatVXR struct { - uint32_t: - 10; + uint32_t : 10; uint32_t Rc : 1; uint32_t VB : 5; uint32_t VA : 5; uint32_t VD : 5; - uint32_t: - 6; + uint32_t : 6; } VXR; // kXEPPCInstrFormatVX128 struct { @@ -306,31 +278,25 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 1; + uint32_t : 1; uint32_t VA128h : 1; - uint32_t: - 4; + uint32_t : 4; uint32_t VA128H : 1; uint32_t VB128l : 5; uint32_t VA128l : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128; // kXEPPCInstrFormatVX128_1 struct { - // VD128 = VD128l | (VD128h << 5) - uint32_t: - 2; + // VD128 = VD128l | (VD128h << 5) + uint32_t : 2; uint32_t VD128h : 2; - uint32_t: - 7; + uint32_t : 7; uint32_t RB : 5; uint32_t RA : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_1; // kXEPPCInstrFormatVX128_2 struct { @@ -339,18 +305,15 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 1; + uint32_t : 1; uint32_t VA128h : 1; uint32_t VC : 3; - uint32_t: - 1; + uint32_t : 1; uint32_t VA128H : 1; uint32_t VB128l : 5; uint32_t VA128l : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_2; // kXEPPCInstrFormatVX128_3 struct { @@ -358,13 +321,11 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 7; + uint32_t : 7; uint32_t VB128l : 5; uint32_t IMM : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_3; // kXEPPCInstrFormatVX128_4 struct { @@ -372,16 +333,13 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 2; + uint32_t : 2; uint32_t z : 2; - uint32_t: - 3; + uint32_t : 3; uint32_t VB128l : 5; uint32_t IMM : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_4; // kXEPPCInstrFormatVX128_5 struct { @@ -390,16 +348,14 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 1; + uint32_t : 1; uint32_t VA128h : 1; uint32_t SH : 4; uint32_t VA128H : 1; uint32_t VB128l : 5; uint32_t VA128l : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_5; // kXEPPCInstrFormatVX128_P struct { @@ -408,16 +364,13 @@ typedef struct { // PERM = PERMl | (PERMh << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 2; + uint32_t : 2; uint32_t PERMh : 3; - uint32_t: - 2; + uint32_t : 2; uint32_t VB128l : 5; uint32_t PERMl : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_P; // kXEPPCInstrFormatVX128_R struct { @@ -426,18 +379,15 @@ typedef struct { // VB128 = VB128l | (VB128h << 5) uint32_t VB128h : 2; uint32_t VD128h : 2; - uint32_t: - 1; + uint32_t : 1; uint32_t VA128h : 1; uint32_t Rc : 1; - uint32_t: - 3; + uint32_t : 3; uint32_t VA128H : 1; uint32_t VB128l : 5; uint32_t VA128l : 5; uint32_t VD128l : 5; - uint32_t: - 6; + uint32_t : 6; } VX128_R; // kXEPPCInstrFormatXDSS struct { diff --git a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc index d710f579b..3f11e3a28 100644 --- a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc +++ b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc @@ -371,8 +371,7 @@ void ProtectedRunTest(TestSuite& test_suite, TestRunner& runner, } #if XE_COMPILER_MSVC - } - __except(filter(GetExceptionCode())) { + } __except (filter(GetExceptionCode())) { XELOGE(" TEST FAILED (UNSUPPORTED INSTRUCTION)"); ++failed_count; } diff --git a/src/xenia/cpu/test/xe-cpu-hir-test.cc b/src/xenia/cpu/test/xe-cpu-hir-test.cc index 12b630a2b..636405ad2 100644 --- a/src/xenia/cpu/test/xe-cpu-hir-test.cc +++ b/src/xenia/cpu/test/xe-cpu-hir-test.cc @@ -22,7 +22,7 @@ using xe::cpu::frontend::PPCContext; int main(std::vector& args) { std::vector narrow_args; - auto narrow_argv = new char* [args.size()]; + auto narrow_argv = new char*[args.size()]; for (size_t i = 0; i < args.size(); ++i) { auto narrow_arg = xe::to_string(args[i]); narrow_argv[i] = const_cast(narrow_arg.data()); diff --git a/src/xenia/debug/debugger.cc b/src/xenia/debug/debugger.cc index ce14e6426..c14745ed2 100644 --- a/src/xenia/debug/debugger.cc +++ b/src/xenia/debug/debugger.cc @@ -229,7 +229,8 @@ void Debugger::OnMessage(std::vector buffer) { fbb.CreateString(xe::to_string(code_cache->file_name())), code_cache->base_address(), code_cache->total_size(), fbb.CreateString(xe::to_string(functions_path_)), - fbb.CreateString(xe::to_string(functions_trace_path_))).Union(); + fbb.CreateString(xe::to_string(functions_trace_path_))) + .Union(); // Allow continuation if we were blocked waiting for a client. accept_fence_.Signal(); diff --git a/src/xenia/debug/proto/messages_generated.h b/src/xenia/debug/proto/messages_generated.h index 105f70ba4..4a7933c5d 100644 --- a/src/xenia/debug/proto/messages_generated.h +++ b/src/xenia/debug/proto/messages_generated.h @@ -99,12 +99,22 @@ enum RequestData { }; inline const char** EnumNamesRequestData() { - static const char* names[] = { - "NONE", "AttachRequest", "ListBreakpointsRequest", - "AddBreakpointsRequest", "UpdateBreakpointsRequest", - "RemoveBreakpointsRequest", "ListModulesRequest", "GetModuleRequest", - "ListFunctionsRequest", "GetFunctionRequest", "ListThreadsRequest", - "StopRequest", "BreakRequest", "ContinueRequest", "StepRequest", nullptr}; + static const char* names[] = {"NONE", + "AttachRequest", + "ListBreakpointsRequest", + "AddBreakpointsRequest", + "UpdateBreakpointsRequest", + "RemoveBreakpointsRequest", + "ListModulesRequest", + "GetModuleRequest", + "ListFunctionsRequest", + "GetFunctionRequest", + "ListThreadsRequest", + "StopRequest", + "BreakRequest", + "ContinueRequest", + "StepRequest", + nullptr}; return names; } @@ -136,13 +146,24 @@ enum ResponseData { }; inline const char** EnumNamesResponseData() { - static const char* names[] = { - "NONE", "AttachResponse", "ListBreakpointsResponse", - "AddBreakpointsResponse", "UpdateBreakpointsResponse", - "RemoveBreakpointsResponse", "ListModulesResponse", "GetModuleResponse", - "ListFunctionsResponse", "GetFunctionResponse", "ListThreadsResponse", - "StopResponse", "BreakResponse", "ContinueResponse", "StepResponse", - "BreakpointEvent", "AccessViolationEvent", nullptr}; + static const char* names[] = {"NONE", + "AttachResponse", + "ListBreakpointsResponse", + "AddBreakpointsResponse", + "UpdateBreakpointsResponse", + "RemoveBreakpointsResponse", + "ListModulesResponse", + "GetModuleResponse", + "ListFunctionsResponse", + "GetFunctionResponse", + "ListThreadsResponse", + "StopResponse", + "BreakResponse", + "ContinueResponse", + "StepResponse", + "BreakpointEvent", + "AccessViolationEvent", + nullptr}; return names; } diff --git a/src/xenia/debug/proto/modules_generated.h b/src/xenia/debug/proto/modules_generated.h index dda192750..6ae37ccc0 100644 --- a/src/xenia/debug/proto/modules_generated.h +++ b/src/xenia/debug/proto/modules_generated.h @@ -460,8 +460,9 @@ struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS struct ListFunctionsResponseBuilder { flatbuffers::FlatBufferBuilder& fbb_; flatbuffers::uoffset_t start_; - void add_entry(flatbuffers::Offset< - flatbuffers::Vector>> entry) { + void add_entry( + flatbuffers::Offset< + flatbuffers::Vector>> entry) { fbb_.AddOffset(4, entry); } ListFunctionsResponseBuilder(flatbuffers::FlatBufferBuilder& _fbb) diff --git a/src/xenia/debug/proto/threads_generated.h b/src/xenia/debug/proto/threads_generated.h index 0396441e1..c8df3a742 100644 --- a/src/xenia/debug/proto/threads_generated.h +++ b/src/xenia/debug/proto/threads_generated.h @@ -204,7 +204,7 @@ struct ListThreadsResponseBuilder { flatbuffers::FlatBufferBuilder& fbb_; flatbuffers::uoffset_t start_; void add_thread(flatbuffers::Offset< - flatbuffers::Vector>> thread) { + flatbuffers::Vector>> thread) { fbb_.AddOffset(4, thread); } ListThreadsResponseBuilder(flatbuffers::FlatBufferBuilder& _fbb) diff --git a/src/xenia/debug/ui/views/cpu/cpu_view.cc b/src/xenia/debug/ui/views/cpu/cpu_view.cc index 88d9ded07..cf634ebf3 100644 --- a/src/xenia/debug/ui/views/cpu/cpu_view.cc +++ b/src/xenia/debug/ui/views/cpu/cpu_view.cc @@ -30,15 +30,15 @@ el::Element* CpuView::BuildUI() { .distribution(LayoutDistribution::kAvailable) .axis(Axis::kY) .child( - LayoutBoxNode() - .gravity(Gravity::kTop | Gravity::kLeftRight) - .distribution(LayoutDistribution::kAvailable) - .axis(Axis::kX) - .skin("button_group") - .child(ButtonNode("?")) - .child( - DropDownButtonNode().item("Module").item("Module").item( - "Module"))) + LayoutBoxNode() + .gravity(Gravity::kTop | Gravity::kLeftRight) + .distribution(LayoutDistribution::kAvailable) + .axis(Axis::kX) + .skin("button_group") + .child(ButtonNode("?")) + .child( + DropDownButtonNode().item("Module").item("Module").item( + "Module"))) .child(ListBoxNode() .gravity(Gravity::kAll) .item("fn") @@ -59,12 +59,12 @@ el::Element* CpuView::BuildUI() { .distribution(LayoutDistribution::kAvailable) .axis(Axis::kY) .child( - LayoutBoxNode() - .gravity(Gravity::kTop | Gravity::kLeftRight) - .distribution(LayoutDistribution::kGravity) - .distribution_position(LayoutDistributionPosition::kLeftTop) - .axis(Axis::kX) - .child(ButtonNode("A"))) + LayoutBoxNode() + .gravity(Gravity::kTop | Gravity::kLeftRight) + .distribution(LayoutDistribution::kGravity) + .distribution_position(LayoutDistributionPosition::kLeftTop) + .axis(Axis::kX) + .child(ButtonNode("A"))) .child(TextBoxNode("source!") .gravity(Gravity::kAll) .is_multiline(true) @@ -96,15 +96,15 @@ el::Element* CpuView::BuildUI() { .distribution(LayoutDistribution::kAvailable) .axis(Axis::kY) .child( - LayoutBoxNode() - .id("source_toolbar") - .gravity(Gravity::kTop | Gravity::kLeftRight) - .distribution(LayoutDistribution::kGravity) - .distribution_position(LayoutDistributionPosition::kLeftTop) - .axis(Axis::kX) - .child(ButtonNode("button")) - .child(ButtonNode("button")) - .child(ButtonNode("button"))) + LayoutBoxNode() + .id("source_toolbar") + .gravity(Gravity::kTop | Gravity::kLeftRight) + .distribution(LayoutDistribution::kGravity) + .distribution_position(LayoutDistributionPosition::kLeftTop) + .axis(Axis::kX) + .child(ButtonNode("button")) + .child(ButtonNode("button")) + .child(ButtonNode("button"))) .child(LayoutBoxNode() .gravity(Gravity::kAll) .distribution(LayoutDistribution::kAvailable) diff --git a/src/xenia/gpu/gl4/gl4_graphics_system.cc b/src/xenia/gpu/gl4/gl4_graphics_system.cc index b72279cd9..bb0bbc2a1 100644 --- a/src/xenia/gpu/gl4/gl4_graphics_system.cc +++ b/src/xenia/gpu/gl4/gl4_graphics_system.cc @@ -177,101 +177,100 @@ void GL4GraphicsSystem::EndTracing() { command_processor_->EndTracing(); } void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size, TracePlaybackMode playback_mode) { - command_processor_->CallInThread( - [this, trace_data, trace_size, playback_mode]() { - command_processor_->set_swap_mode(SwapMode::kIgnored); + command_processor_->CallInThread([this, trace_data, trace_size, + playback_mode]() { + command_processor_->set_swap_mode(SwapMode::kIgnored); - auto trace_ptr = trace_data; - bool pending_break = false; - const PacketStartCommand* pending_packet = nullptr; - while (trace_ptr < trace_data + trace_size) { - auto type = - static_cast(xe::load(trace_ptr)); - switch (type) { - case TraceCommandType::kPrimaryBufferStart: { - auto cmd = - reinterpret_cast(trace_ptr); - // - trace_ptr += sizeof(*cmd) + cmd->count * 4; - break; - } - case TraceCommandType::kPrimaryBufferEnd: { - auto cmd = - reinterpret_cast(trace_ptr); - // - trace_ptr += sizeof(*cmd); - break; - } - case TraceCommandType::kIndirectBufferStart: { - auto cmd = reinterpret_cast( - trace_ptr); - // - trace_ptr += sizeof(*cmd) + cmd->count * 4; - break; - } - case TraceCommandType::kIndirectBufferEnd: { - auto cmd = - reinterpret_cast(trace_ptr); - // - trace_ptr += sizeof(*cmd); - break; - } - case TraceCommandType::kPacketStart: { - auto cmd = reinterpret_cast(trace_ptr); - trace_ptr += sizeof(*cmd); - std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, - cmd->count * 4); - trace_ptr += cmd->count * 4; - pending_packet = cmd; - break; - } - case TraceCommandType::kPacketEnd: { - auto cmd = reinterpret_cast(trace_ptr); - trace_ptr += sizeof(*cmd); - if (pending_packet) { - command_processor_->ExecutePacket(pending_packet->base_ptr, - pending_packet->count); - pending_packet = nullptr; - } - if (pending_break) { - return; - } - break; - } - case TraceCommandType::kMemoryRead: { - auto cmd = reinterpret_cast(trace_ptr); - trace_ptr += sizeof(*cmd); - std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, - cmd->length); - trace_ptr += cmd->length; - break; - } - case TraceCommandType::kMemoryWrite: { - auto cmd = reinterpret_cast(trace_ptr); - trace_ptr += sizeof(*cmd); - // ? - trace_ptr += cmd->length; - break; - } - case TraceCommandType::kEvent: { - auto cmd = reinterpret_cast(trace_ptr); - trace_ptr += sizeof(*cmd); - switch (cmd->event_type) { - case EventType::kSwap: { - if (playback_mode == TracePlaybackMode::kBreakOnSwap) { - pending_break = true; - } - break; - } + auto trace_ptr = trace_data; + bool pending_break = false; + const PacketStartCommand* pending_packet = nullptr; + while (trace_ptr < trace_data + trace_size) { + auto type = static_cast(xe::load(trace_ptr)); + switch (type) { + case TraceCommandType::kPrimaryBufferStart: { + auto cmd = + reinterpret_cast(trace_ptr); + // + trace_ptr += sizeof(*cmd) + cmd->count * 4; + break; + } + case TraceCommandType::kPrimaryBufferEnd: { + auto cmd = + reinterpret_cast(trace_ptr); + // + trace_ptr += sizeof(*cmd); + break; + } + case TraceCommandType::kIndirectBufferStart: { + auto cmd = + reinterpret_cast(trace_ptr); + // + trace_ptr += sizeof(*cmd) + cmd->count * 4; + break; + } + case TraceCommandType::kIndirectBufferEnd: { + auto cmd = + reinterpret_cast(trace_ptr); + // + trace_ptr += sizeof(*cmd); + break; + } + case TraceCommandType::kPacketStart: { + auto cmd = reinterpret_cast(trace_ptr); + trace_ptr += sizeof(*cmd); + std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, + cmd->count * 4); + trace_ptr += cmd->count * 4; + pending_packet = cmd; + break; + } + case TraceCommandType::kPacketEnd: { + auto cmd = reinterpret_cast(trace_ptr); + trace_ptr += sizeof(*cmd); + if (pending_packet) { + command_processor_->ExecutePacket(pending_packet->base_ptr, + pending_packet->count); + pending_packet = nullptr; + } + if (pending_break) { + return; + } + break; + } + case TraceCommandType::kMemoryRead: { + auto cmd = reinterpret_cast(trace_ptr); + trace_ptr += sizeof(*cmd); + std::memcpy(memory()->TranslatePhysical(cmd->base_ptr), trace_ptr, + cmd->length); + trace_ptr += cmd->length; + break; + } + case TraceCommandType::kMemoryWrite: { + auto cmd = reinterpret_cast(trace_ptr); + trace_ptr += sizeof(*cmd); + // ? + trace_ptr += cmd->length; + break; + } + case TraceCommandType::kEvent: { + auto cmd = reinterpret_cast(trace_ptr); + trace_ptr += sizeof(*cmd); + switch (cmd->event_type) { + case EventType::kSwap: { + if (playback_mode == TracePlaybackMode::kBreakOnSwap) { + pending_break = true; } break; } } + break; } + } + } - command_processor_->set_swap_mode(SwapMode::kNormal); - command_processor_->IssueSwap(1280, 720); - }); + command_processor_->set_swap_mode(SwapMode::kNormal); + command_processor_->IssueSwap(1280, 720); + }); } void GL4GraphicsSystem::ClearCaches() { diff --git a/src/xenia/gpu/ucode_disassembler.cc b/src/xenia/gpu/ucode_disassembler.cc index bdcac4b77..777c5e129 100644 --- a/src/xenia/gpu/ucode_disassembler.cc +++ b/src/xenia/gpu/ucode_disassembler.cc @@ -47,9 +47,22 @@ using namespace xe::gpu::ucode; using namespace xe::gpu::xenos; 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", }; /* @@ -143,36 +156,36 @@ struct { { #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 diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index adfbafdce..e56448bb4 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -508,8 +508,11 @@ void XThread::DeliverAPCs() { // kernel_routine(apc_address, &normal_routine, &normal_context, // &system_arg1, &system_arg2) uint64_t kernel_args[] = { - apc_ptr, scratch_address_ + 0, scratch_address_ + 4, - scratch_address_ + 8, scratch_address_ + 12, + apc_ptr, + scratch_address_ + 0, + scratch_address_ + 4, + scratch_address_ + 8, + scratch_address_ + 12, }; processor->Execute(thread_state_, apc->kernel_routine, kernel_args, xe::countof(kernel_args)); diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 1ac2e1b58..f0629e057 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -464,8 +464,8 @@ xe::cpu::Export* RegisterExport(void (*fn)(Ps&...), const char* name, using xe::cpu::ExportTag; #define DECLARE_EXPORT(module_name, name, tags) \ - const auto EXPORT_##module_name##_##name = \ - RegisterExport_##module_name(xe::kernel::shim::RegisterExport< \ + const auto EXPORT_##module_name##_##name = RegisterExport_##module_name( \ + xe::kernel::shim::RegisterExport< \ xe::kernel::shim::KernelModuleId::module_name, ordinals::##name>( \ &name, #name, tags)); diff --git a/src/xenia/kernel/xboxkrnl_error.cc b/src/xenia/kernel/xboxkrnl_error.cc index 796a748d9..28347ef62 100644 --- a/src/xenia/kernel/xboxkrnl_error.cc +++ b/src/xenia/kernel/xboxkrnl_error.cc @@ -962,21 +962,11 @@ const uint32_t error_table_0xC0980001[] = { #define MAKE_ENTRY(x) \ { ##x, xe::countof(error_table_##x), error_table_##x } const error_lookup_table error_tables[] = { - MAKE_ENTRY(0x00000103), - MAKE_ENTRY(0x40000002), - MAKE_ENTRY(0x40020056), - MAKE_ENTRY(0x400200AF), - MAKE_ENTRY(0x80000001), - MAKE_ENTRY(0x80000288), - MAKE_ENTRY(0x80090300), - MAKE_ENTRY(0xC0000001), - MAKE_ENTRY(0xC0000202), - MAKE_ENTRY(0xC0020001), - MAKE_ENTRY(0xC0030001), - MAKE_ENTRY(0xC0030059), - MAKE_ENTRY(0xC0050003), - MAKE_ENTRY(0xC0980001), - {0, 0, nullptr}, + MAKE_ENTRY(0x00000103), MAKE_ENTRY(0x40000002), MAKE_ENTRY(0x40020056), + MAKE_ENTRY(0x400200AF), MAKE_ENTRY(0x80000001), MAKE_ENTRY(0x80000288), + MAKE_ENTRY(0x80090300), MAKE_ENTRY(0xC0000001), MAKE_ENTRY(0xC0000202), + MAKE_ENTRY(0xC0020001), MAKE_ENTRY(0xC0030001), MAKE_ENTRY(0xC0030059), + MAKE_ENTRY(0xC0050003), MAKE_ENTRY(0xC0980001), {0, 0, nullptr}, }; #undef MAKE_ENTRY diff --git a/src/xenia/ui/gl/gl_context.cc b/src/xenia/ui/gl/gl_context.cc index 0ba7fb2c4..703a32994 100644 --- a/src/xenia/ui/gl/gl_context.cc +++ b/src/xenia/ui/gl/gl_context.cc @@ -131,9 +131,12 @@ bool GLContext::Initialize(Window* target_window) { context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; } - int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // - WGL_CONTEXT_MINOR_VERSION_ARB, 5, // - WGL_CONTEXT_FLAGS_ARB, context_flags, // + 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); @@ -187,10 +190,14 @@ std::unique_ptr GLContext::CreateShared() { context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; } - 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, // + 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) { @@ -234,7 +241,8 @@ void FatalGLError(std::string error) { XEFATAL( (error + "\nEnsure you have the latest drivers for your GPU and that it supports " - "OpenGL 4.5. See http://xenia.jp/faq/ for more information.").c_str()); + "OpenGL 4.5. See http://xenia.jp/faq/ for more information.") + .c_str()); } void GLContext::AssertExtensionsPresent() { @@ -350,10 +358,11 @@ void GLContext::DebugMessage(GLenum source, GLenum type, GLuint id, message); } -void GLAPIENTRY -GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei length, - const GLchar* message, GLvoid* user_param) { +void GLAPIENTRY 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/ui/gl/gl_context.h b/src/xenia/ui/gl/gl_context.h index 1c140def5..441c0bb9f 100644 --- a/src/xenia/ui/gl/gl_context.h +++ b/src/xenia/ui/gl/gl_context.h @@ -58,9 +58,11 @@ class GLContext : public GraphicsContext { void SetupDebugging(); 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); + static void GLAPIENTRY DebugMessageThunk(GLenum source, GLenum type, + GLuint id, GLenum severity, + GLsizei length, + const GLchar* message, + GLvoid* user_param); HDC dc_ = nullptr; HGLRC glrc_ = nullptr; diff --git a/src/xenia/ui/window_win.h b/src/xenia/ui/window_win.h index f25323ddd..1029fcb46 100644 --- a/src/xenia/ui/window_win.h +++ b/src/xenia/ui/window_win.h @@ -53,8 +53,8 @@ class Win32Window : public Window { void OnResize(UIEvent& e) override; - static LRESULT CALLBACK - WndProcThunk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK WndProcThunk(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam); virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);