diff --git a/src/xenia/base/bit_map.h b/src/xenia/base/bit_map.h index e80ad93b6..29bbb3925 100644 --- a/src/xenia/base/bit_map.h +++ b/src/xenia/base/bit_map.h @@ -10,6 +10,7 @@ #ifndef XENIA_BASE_BIT_MAP_H_ #define XENIA_BASE_BIT_MAP_H_ +#include #include #include @@ -52,4 +53,4 @@ class BitMap { } // namespace xe -#endif // XENIA_BASE_BIT_MAP_H_ \ No newline at end of file +#endif // XENIA_BASE_BIT_MAP_H_ diff --git a/src/xenia/base/byte_stream.cc b/src/xenia/base/byte_stream.cc index abc49c1ba..652b5c0df 100644 --- a/src/xenia/base/byte_stream.cc +++ b/src/xenia/base/byte_stream.cc @@ -9,6 +9,8 @@ #include "xenia/base/byte_stream.h" +#include + #include "xenia/base/assert.h" namespace xe { @@ -34,4 +36,24 @@ void ByteStream::Write(const uint8_t* buf, size_t len) { Advance(len); } -} // namespace xe \ No newline at end of file +template <> +std::string ByteStream::Read() { + std::string str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len); + return str; +} + +template <> +std::wstring ByteStream::Read() { + std::wstring str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len * 2); + return str; +} + +} // namespace xe diff --git a/src/xenia/base/byte_stream.h b/src/xenia/base/byte_stream.h index 479be9760..d97568b28 100644 --- a/src/xenia/base/byte_stream.h +++ b/src/xenia/base/byte_stream.h @@ -46,26 +46,6 @@ class ByteStream { return data; } - template <> - std::string Read() { - std::string str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len); - return str; - } - - template <> - std::wstring Read() { - std::wstring str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len * 2); - return str; - } - template void Write(T data) { Write(reinterpret_cast(&data), sizeof(T)); @@ -87,6 +67,12 @@ class ByteStream { size_t offset_ = 0; }; +template <> +std::string ByteStream::Read(); + +template <> +std::wstring ByteStream::Read(); + } // namespace xe -#endif // XENIA_BASE_BYTE_STREAM_H_ \ No newline at end of file +#endif // XENIA_BASE_BYTE_STREAM_H_ diff --git a/src/xenia/base/profiling.cc b/src/xenia/base/profiling.cc index 742a6a279..b787992f7 100644 --- a/src/xenia/base/profiling.cc +++ b/src/xenia/base/profiling.cc @@ -261,7 +261,9 @@ void Profiler::OnMouseDown(bool left_button, bool right_button) {} void Profiler::OnMouseUp() {} void Profiler::OnMouseMove(int x, int y) {} void Profiler::OnMouseWheel(int x, int y, int dy) {} -void Profiler::set_display(std::unique_ptr display) {} +void Profiler::ToggleDisplay() {} +void Profiler::TogglePause() {} +void Profiler::set_window(ui::Window* window) {} void Profiler::Present() {} #endif // XE_OPTION_PROFILING diff --git a/src/xenia/base/x64_context.cc b/src/xenia/base/x64_context.cc index 8671c4017..77f595461 100644 --- a/src/xenia/base/x64_context.cc +++ b/src/xenia/base/x64_context.cc @@ -45,8 +45,7 @@ std::string X64Context::GetStringFromValue(X64Register reg, bool hex) const { static_cast(X64Register::kXmm15)) { auto value = xmm_registers[static_cast(reg) - static_cast(X64Register::kXmm0)]; - return hex ? string_util::to_hex_string(value) - : string_util::to_string(value); + return hex ? string_util::to_hex_string(value) : xe::to_string(value); } else { assert_unhandled_case(reg); return ""; diff --git a/src/xenia/base/x64_context.h b/src/xenia/base/x64_context.h index 0a9002661..052193bb3 100644 --- a/src/xenia/base/x64_context.h +++ b/src/xenia/base/x64_context.h @@ -15,6 +15,8 @@ #include #include +#include "xenia/base/vec128.h" + namespace xe { enum class X64Register { @@ -84,24 +86,24 @@ class X64Context { union { struct { - __m128 xmm0; - __m128 xmm1; - __m128 xmm2; - __m128 xmm3; - __m128 xmm4; - __m128 xmm5; - __m128 xmm6; - __m128 xmm7; - __m128 xmm8; - __m128 xmm9; - __m128 xmm10; - __m128 xmm11; - __m128 xmm12; - __m128 xmm13; - __m128 xmm14; - __m128 xmm15; + vec128_t xmm0; + vec128_t xmm1; + vec128_t xmm2; + vec128_t xmm3; + vec128_t xmm4; + vec128_t xmm5; + vec128_t xmm6; + vec128_t xmm7; + vec128_t xmm8; + vec128_t xmm9; + vec128_t xmm10; + vec128_t xmm11; + vec128_t xmm12; + vec128_t xmm13; + vec128_t xmm14; + vec128_t xmm15; }; - __m128 xmm_registers[16]; + vec128_t xmm_registers[16]; }; static const char* GetRegisterName(X64Register reg); diff --git a/src/xenia/cpu/hir/value.cc b/src/xenia/cpu/hir/value.cc index e0be35b58..03ef79a2a 100644 --- a/src/xenia/cpu/hir/value.cc +++ b/src/xenia/cpu/hir/value.cc @@ -206,6 +206,9 @@ void Value::Convert(TypeName target_type, RoundMode round_mode) { type = target_type; constant.f64 = constant.f32; return; + default: + assert_unhandled_case(target_type); + return; } case FLOAT64_TYPE: switch (target_type) { @@ -213,9 +216,12 @@ void Value::Convert(TypeName target_type, RoundMode round_mode) { type = target_type; constant.f32 = (float)constant.f64; return; + default: + assert_unhandled_case(target_type); + return; } default: - assert_unhandled_case(target_type); + assert_unhandled_case(type); return; } } diff --git a/src/xenia/cpu/processor.cc b/src/xenia/cpu/processor.cc index f292ef6ce..f9304bc83 100644 --- a/src/xenia/cpu/processor.cc +++ b/src/xenia/cpu/processor.cc @@ -338,7 +338,7 @@ uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address, SCOPE_profile_cpu_f("cpu"); auto context = thread_state->context(); - for (size_t i = 0; i < std::min(arg_count, 8ull); ++i) { + for (size_t i = 0; i < std::min(arg_count, static_cast(8)); ++i) { context->r[3 + i] = args[i]; } diff --git a/src/xenia/debug/ui/debug_window.cc b/src/xenia/debug/ui/debug_window.cc index a06443609..5526d42bf 100644 --- a/src/xenia/debug/ui/debug_window.cc +++ b/src/xenia/debug/ui/debug_window.cc @@ -318,7 +318,7 @@ void DebugWindow::DrawSourcePane() { // name text box (editable) // combo for interleaved + [ppc, hir, opt hir, x64 + byte with sizes] ImGui::AlignFirstTextHeightToWidgets(); - ImGui::Text(function->module()->name().c_str()); + ImGui::Text("%s", function->module()->name().c_str()); ImGui::SameLine(); ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); @@ -657,7 +657,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint32_t* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -697,7 +697,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint64_t* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -715,7 +715,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, double* value) { } else { input_flags |= ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll; - std::snprintf(buffer, xe::countof(buffer), "%.8LF", *value); + std::snprintf(buffer, xe::countof(buffer), "%.8F", *value); } char label[16] = {0}; std::snprintf(label, xe::countof(label), "##dregister%d", id); @@ -736,7 +736,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, double* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -779,7 +779,7 @@ bool DebugWindow::DrawRegisterTextBoxes(int id, float* value) { auto alt_value = state_.register_input_hex ? std::to_string(value[i]) : string_util::to_hex_string(value[i]); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } if (i < 3) { ImGui::SameLine(); @@ -968,7 +968,7 @@ void DebugWindow::DrawRegistersPane() { ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); dirty_host_context |= DrawRegisterTextBoxes( - i, thread_info->host_context.xmm_registers[i].m128_f32); + i, thread_info->host_context.xmm_registers[i].f32); ImGui::EndGroup(); } ImGui::EndChild(); @@ -1067,9 +1067,9 @@ void DebugWindow::DrawThreadsPane() { ImGui::Dummy(ImVec2(8, 0)); ImGui::SameLine(); if (frame.guest_function) { - ImGui::Text(frame.guest_function->name().c_str()); + ImGui::Text("%s", frame.guest_function->name().c_str()); } else { - ImGui::Text(frame.name); + ImGui::Text("%s", frame.name); } if (is_current_thread && !frame.guest_pc) { ImGui::PopStyleColor(); @@ -1259,7 +1259,7 @@ void DebugWindow::DrawBreakpointsPane() { ImGui::SameLine(); ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); - ImGui::Text(export_entry->name); + ImGui::Text("%s", export_entry->name); ImGui::Dummy(ImVec2(0, 1)); ImGui::PopID(); } @@ -1344,6 +1344,10 @@ void DebugWindow::DrawBreakpointsPane() { } break; } + default: { + // Ignored. + break; + } } } if (ImGui::BeginPopupContextItem("##breakpoint_context_menu")) { diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index d293a01e5..ccfec481e 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -504,8 +504,7 @@ X_STATUS Emulator::CompleteLaunch(const std::wstring& path, XELOGI("Launching module %s", next_module.c_str()); auto module = kernel_state_->LoadUserModule(next_module.c_str()); if (!module) { - auto path_str = xe::to_string(path); - XELOGE("Failed to load user module %s", path.c_str()); + XELOGE("Failed to load user module %S", path.c_str()); return X_STATUS_NOT_FOUND; } diff --git a/src/xenia/gpu/glsl_shader_translator.cc b/src/xenia/gpu/glsl_shader_translator.cc index 423ba191d..397dd3a63 100644 --- a/src/xenia/gpu/glsl_shader_translator.cc +++ b/src/xenia/gpu/glsl_shader_translator.cc @@ -559,6 +559,9 @@ void GlslShaderTranslator::ProcessVertexFetchInstruction( EmitSource(" = vf%u_%d;\n", instr.operands[1].storage_index, instr.attributes.offset); break; + default: + assert_always(); + break; } } @@ -676,6 +679,9 @@ void GlslShaderTranslator::ProcessTextureFetchInstruction( EmitUnimplementedTranslationError(); EmitSourceDepth("pv = vec4(0.0);\n"); break; + case FetchOpcode::kVertexFetch: + assert_always(); + break; } EmitStoreVectorResult(instr.result); @@ -728,6 +734,10 @@ void GlslShaderTranslator::EmitLoadOperand(size_t i, case InstructionStorageSource::kConstantBool: EmitSource("state.bool_consts"); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } switch (op.storage_addressing_mode) { case InstructionStorageAddressingMode::kStatic: @@ -815,6 +825,8 @@ void GlslShaderTranslator::EmitStoreResult(const InstructionResult& result, case InstructionStorageTarget::kDepth: EmitSourceDepth("gl_FragDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { diff --git a/src/xenia/gpu/shader.cc b/src/xenia/gpu/shader.cc index c2fc1f25d..3e0be41f9 100644 --- a/src/xenia/gpu/shader.cc +++ b/src/xenia/gpu/shader.cc @@ -9,6 +9,7 @@ #include "xenia/gpu/shader.h" +#include #include #include "xenia/base/filesystem.h" @@ -47,8 +48,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) { char txt_file_name[kMaxPath]; std::snprintf(txt_file_name, xe::countof(txt_file_name), - "%s/shader_%s_%.16llX.%s", base_path.c_str(), path_prefix, - ucode_data_hash_, + "%s/shader_%s_%.16" PRIX64 ".%s", base_path.c_str(), + path_prefix, ucode_data_hash_, shader_type_ == ShaderType::kVertex ? "vert" : "frag"); FILE* f = fopen(txt_file_name, "w"); if (f) { @@ -70,8 +71,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) { char bin_file_name[kMaxPath]; std::snprintf(bin_file_name, xe::countof(bin_file_name), - "%s/shader_%s_%.16llX.bin.%s", base_path.c_str(), path_prefix, - ucode_data_hash_, + "%s/shader_%s_%.16" PRIX64 ".bin.%s", base_path.c_str(), + path_prefix, ucode_data_hash_, shader_type_ == ShaderType::kVertex ? "vert" : "frag"); f = fopen(bin_file_name, "w"); if (f) { diff --git a/src/xenia/gpu/shader_translator.cc b/src/xenia/gpu/shader_translator.cc index f4e7376df..689bcbf97 100644 --- a/src/xenia/gpu/shader_translator.cc +++ b/src/xenia/gpu/shader_translator.cc @@ -159,7 +159,7 @@ void ShaderTranslator::GatherBindingInformation( case ControlFlowOpcode::kCondExecPred: case ControlFlowOpcode::kCondExecPredEnd: case ControlFlowOpcode::kCondExecPredClean: - case ControlFlowOpcode::kCondExecPredCleanEnd: + case ControlFlowOpcode::kCondExecPredCleanEnd: { uint32_t sequence = cf.exec.sequence(); for (uint32_t instr_offset = cf.exec.address(); instr_offset < cf.exec.address() + cf.exec.count(); @@ -184,17 +184,19 @@ void ShaderTranslator::GatherBindingInformation( auto& op = *reinterpret_cast(ucode_dwords_ + instr_offset * 3); if (op.has_vector_op() && op.is_export()) { - if (op.vector_dest() >= 0 && op.vector_dest() <= 3) { + if (op.vector_dest() <= 3) { writes_color_targets_[op.vector_dest()] = true; } } if (op.has_scalar_op() && op.is_export()) { - if (op.vector_dest() >= 0 && op.vector_dest() <= 3) { + if (op.vector_dest() <= 3) { writes_color_targets_[op.vector_dest()] = true; } } } } + } break; + default: break; } } @@ -248,6 +250,9 @@ void ShaderTranslator::GatherTextureBindingInformation( case FetchOpcode::kSetTextureGradientsVert: // Doesn't use bindings. return; + default: + // Continue. + break; } Shader::TextureBinding binding; binding.binding_index = texture_bindings_.size(); @@ -271,6 +276,9 @@ void AddControlFlowTargetLabel(const ControlFlowInstruction& cf, case ControlFlowOpcode::kCondJmp: label_addresses->insert(cf.cond_jmp.address()); break; + default: + // Ignored. + break; } } @@ -435,6 +443,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( i.opcode_name = "cexece"; i.is_end = true; break; + default: + break; } i.instruction_address = cf.address(); i.instruction_count = cf.count(); @@ -446,6 +456,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( case ControlFlowOpcode::kCondExecEnd: i.clean = false; break; + default: + break; } i.is_yield = cf.is_yield(); i.sequence = cf.sequence(); diff --git a/src/xenia/gpu/shader_translator_disasm.cc b/src/xenia/gpu/shader_translator_disasm.cc index 4f4022f6e..8e1bdb996 100644 --- a/src/xenia/gpu/shader_translator_disasm.cc +++ b/src/xenia/gpu/shader_translator_disasm.cc @@ -45,6 +45,8 @@ void DisassembleResultOperand(const InstructionResult& result, case InstructionStorageTarget::kDepth: out->Append("oDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { @@ -90,6 +92,10 @@ void DisassembleSourceOperand(const InstructionOperand& op, StringBuffer* out) { case InstructionStorageSource::kConstantBool: out->Append('b'); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } if (op.is_absolute_value) { out->Append("_abs"); diff --git a/src/xenia/ui/imgui_drawer.cc b/src/xenia/ui/imgui_drawer.cc index c79870250..6507699e7 100644 --- a/src/xenia/ui/imgui_drawer.cc +++ b/src/xenia/ui/imgui_drawer.cc @@ -274,6 +274,9 @@ void ImGuiDrawer::OnMouseDown(MouseEvent* e) { case xe::ui::MouseEvent::Button::kRight: { io.MouseDown[1] = true; } break; + default: { + // Ignored. + } break; } } @@ -292,6 +295,9 @@ void ImGuiDrawer::OnMouseUp(MouseEvent* e) { case xe::ui::MouseEvent::Button::kRight: { io.MouseDown[1] = false; } break; + default: { + // Ignored. + } break; } } diff --git a/src/xenia/ui/window.cc b/src/xenia/ui/window.cc index 0d27eaec0..0a3c1993b 100644 --- a/src/xenia/ui/window.cc +++ b/src/xenia/ui/window.cc @@ -9,6 +9,8 @@ #include "xenia/ui/window.h" +#include + #include "third_party/imgui/imgui.h" #include "xenia/base/assert.h" #include "xenia/base/clock.h"