diff options
Diffstat (limited to 'src')
27 files changed, 61 insertions, 253 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 2be6fe996..959084cdf 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -32,7 +32,6 @@ set(HEADERS common_funcs.h common_paths.h common_types.h - debug_interface.h emu_window.h file_util.h hash.h diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 023a485a4..e7d0d3e43 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/debug_interface.h" #include "common/break_points.h" #include "common/logging/log.h" @@ -101,92 +100,3 @@ void BreakPoints::Clear() m_BreakPoints.clear(); } - -MemChecks::TMemChecksStr MemChecks::GetStrings() const -{ - TMemChecksStr mcs; - for (auto memcheck : m_MemChecks) - { - std::stringstream mc; - mc << std::hex << memcheck.StartAddress; - mc << " " << (memcheck.bRange ? memcheck.EndAddress : memcheck.StartAddress) << " " - << (memcheck.bRange ? "n" : "") - << (memcheck.OnRead ? "r" : "") - << (memcheck.OnWrite ? "w" : "") - << (memcheck.Log ? "l" : "") - << (memcheck.Break ? "p" : ""); - mcs.push_back(mc.str()); - } - - return mcs; -} - -void MemChecks::AddFromStrings(const TMemChecksStr& mcs) -{ - for (auto mcs_item : mcs) - { - TMemCheck mc; - std::stringstream mcstr; - mcstr << std::hex << mcs_item; - mcstr >> mc.StartAddress; - mc.bRange = mcs_item.find("n") != mcs_item.npos; - mc.OnRead = mcs_item.find("r") != mcs_item.npos; - mc.OnWrite = mcs_item.find("w") != mcs_item.npos; - mc.Log = mcs_item.find("l") != mcs_item.npos; - mc.Break = mcs_item.find("p") != mcs_item.npos; - if (mc.bRange) - mcstr >> mc.EndAddress; - else - mc.EndAddress = mc.StartAddress; - Add(mc); - } -} - -void MemChecks::Add(const TMemCheck& rMemoryCheck) -{ - if (GetMemCheck(rMemoryCheck.StartAddress) == 0) - m_MemChecks.push_back(rMemoryCheck); -} - -void MemChecks::Remove(u32 Address) -{ - auto cond = [&Address](const TMemCheck& mc) { return mc.StartAddress == Address; }; - auto it = std::find_if(m_MemChecks.begin(), m_MemChecks.end(), cond); - if (it != m_MemChecks.end()) - m_MemChecks.erase(it); -} - -TMemCheck *MemChecks::GetMemCheck(u32 address) -{ - for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i) - { - if (i->bRange) - { - if (address >= i->StartAddress && address <= i->EndAddress) - return &(*i); - } - else if (i->StartAddress == address) - return &(*i); - } - - // none found - return 0; -} - -void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, - bool write, int size, u32 pc) -{ - if ((write && OnWrite) || (!write && OnRead)) - { - if (Log) - { - LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)", - pc, debug_interface->getDescription(pc).c_str(), - write ? "Write" : "Read", size*8, size*2, iValue, addr, - debug_interface->getDescription(addr).c_str() - ); - } - if (Break) - debug_interface->breakNow(); - } -} diff --git a/src/common/break_points.h b/src/common/break_points.h index f0a55e7b1..b0629df37 100644 --- a/src/common/break_points.h +++ b/src/common/break_points.h @@ -18,31 +18,6 @@ struct TBreakPoint bool bTemporary; }; -struct TMemCheck -{ - TMemCheck(): - StartAddress(0), EndAddress(0), - bRange(false), OnRead(false), OnWrite(false), - Log(false), Break(false), numHits(0) - { } - - u32 StartAddress; - u32 EndAddress; - - bool bRange; - - bool OnRead; - bool OnWrite; - - bool Log; - bool Break; - - u32 numHits; - - void Action(DebugInterface *dbg_interface, u32 iValue, u32 addr, - bool write, int size, u32 pc); -}; - // Code breakpoints. class BreakPoints { @@ -73,27 +48,3 @@ private: TBreakPoints m_BreakPoints; u32 m_iBreakOnCount; }; - - -// Memory breakpoints -class MemChecks -{ -public: - typedef std::vector<TMemCheck> TMemChecks; - typedef std::vector<std::string> TMemChecksStr; - - TMemChecks m_MemChecks; - - const TMemChecks& GetMemChecks() { return m_MemChecks; } - - TMemChecksStr GetStrings() const; - void AddFromStrings(const TMemChecksStr& mcs); - - void Add(const TMemCheck& rMemoryCheck); - - // memory breakpoint - TMemCheck *GetMemCheck(u32 address); - void Remove(u32 _Address); - - void Clear() { m_MemChecks.clear(); }; -}; diff --git a/src/common/debug_interface.h b/src/common/debug_interface.h deleted file mode 100644 index 32f55cb59..000000000 --- a/src/common/debug_interface.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include <cstring> -#include <string> - -class DebugInterface -{ -protected: - virtual ~DebugInterface() {} - -public: - virtual void disasm(unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");} - virtual void getRawMemoryString(int /*memory*/, unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");} - virtual int getInstructionSize(int /*instruction*/) {return 1;} - virtual bool isAlive() {return true;} - virtual bool isBreakpoint(unsigned int /*address*/) {return false;} - virtual void setBreakpoint(unsigned int /*address*/){} - virtual void clearBreakpoint(unsigned int /*address*/){} - virtual void clearAllBreakpoints() {} - virtual void toggleBreakpoint(unsigned int /*address*/){} - virtual bool isMemCheck(unsigned int /*address*/) {return false;} - virtual void toggleMemCheck(unsigned int /*address*/){} - virtual unsigned int readMemory(unsigned int /*address*/){return 0;} - virtual void writeExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {} - virtual unsigned int readExtraMemory(int /*memory*/, unsigned int /*address*/){return 0;} - virtual unsigned int readInstruction(unsigned int /*address*/){return 0;} - virtual unsigned int getPC() {return 0;} - virtual void setPC(unsigned int /*address*/) {} - virtual void step() {} - virtual void runToBreakpoint() {} - virtual void breakNow() {} - virtual void insertBLR(unsigned int /*address*/, unsigned int /*value*/) {} - virtual void showJitResults(unsigned int /*address*/) {}; - virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} - virtual std::string getDescription(unsigned int /*address*/) = 0; -}; diff --git a/src/common/swap.h b/src/common/swap.h index b92e5bfa4..a7c37bc44 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -148,7 +148,7 @@ struct swap_struct_t { typedef swap_struct_t<T, F> swapped_t; protected: - T value; + T value = T(); static T swap(T v) { return F::swap(v); @@ -158,7 +158,7 @@ public: return swap(value); } - swap_struct_t() : value((T)0) {} + swap_struct_t() = default; swap_struct_t(const T &v): value(swap(v)) {} template <typename S> diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index bb6048cc0..ed99c4f13 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -4,10 +4,10 @@ #include <boost/container/static_vector.hpp> -#include "clipper.h" -#include "pica.h" -#include "rasterizer.h" -#include "shader/shader_interpreter.h" +#include "video_core/clipper.h" +#include "video_core/pica.h" +#include "video_core/rasterizer.h" +#include "video_core/shader/shader_interpreter.h" namespace Pica { diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 6e9cb2586..47afd8938 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -2,25 +2,24 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <cmath> #include <boost/range/algorithm/fill.hpp> #include "common/microprofile.h" #include "common/profiler.h" +#include "core/settings.h" #include "core/hle/service/gsp_gpu.h" #include "core/hw/gpu.h" -#include "core/settings.h" - -#include "debug_utils/debug_utils.h" -#include "clipper.h" -#include "command_processor.h" -#include "math.h" -#include "pica.h" -#include "primitive_assembly.h" -#include "renderer_base.h" -#include "shader/shader_interpreter.h" -#include "video_core.h" +#include "video_core/clipper.h" +#include "video_core/command_processor.h" +#include "video_core/pica.h" +#include "video_core/primitive_assembly.h" +#include "video_core/renderer_base.h" +#include "video_core/video_core.h" +#include "video_core/debug_utils/debug_utils.h" +#include "video_core/shader/shader_interpreter.h" namespace Pica { diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 9a61e700b..77a4fe272 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -31,8 +31,7 @@ #include "video_core/renderer_base.h" #include "video_core/utils.h" #include "video_core/video_core.h" - -#include "debug_utils.h" +#include "video_core/debug_utils/debug_utils.h" using nihstro::DVLBHeader; using nihstro::DVLEHeader; diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index 48ac269e3..fae5de7d1 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -10,9 +10,6 @@ #include "core/hle/service/gsp_gpu.h" -#include "command_processor.h" -#include "pica.h" - class GraphicsDebugger { public: diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp index 61983bc6c..8c528989e 100644 --- a/src/video_core/pica.cpp +++ b/src/video_core/pica.cpp @@ -5,8 +5,8 @@ #include <cstring> #include <unordered_map> -#include "pica.h" -#include "shader/shader.h" +#include "video_core/pica.h" +#include "video_core/shader/shader.h" namespace Pica { diff --git a/src/video_core/pica.h b/src/video_core/pica.h index c1dca5087..ff81b409d 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -13,8 +13,8 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" -#include "common/logging/log.h" #include "common/vector_math.h" +#include "common/logging/log.h" namespace Pica { diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index e2b1df44c..44a8dbfe9 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "pica.h" -#include "primitive_assembly.h" -#include "shader/shader_interpreter.h" - #include "common/logging/log.h" + +#include "video_core/pica.h" +#include "video_core/primitive_assembly.h" #include "video_core/debug_utils/debug_utils.h" +#include "video_core/shader/shader_interpreter.h" namespace Pica { diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h index 80432d68a..52d0ec8ff 100644 --- a/src/video_core/primitive_assembly.h +++ b/src/video_core/primitive_assembly.h @@ -8,8 +8,6 @@ #include "video_core/pica.h" -#include "video_core/shader/shader_interpreter.h" - namespace Pica { /* diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 77eadda9e..a90ff5fef 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <algorithm> +#include <cmath> #include "common/color.h" #include "common/common_types.h" @@ -10,15 +11,14 @@ #include "common/microprofile.h" #include "common/profiler.h" -#include "core/hw/gpu.h" #include "core/memory.h" +#include "core/hw/gpu.h" -#include "debug_utils/debug_utils.h" -#include "math.h" -#include "pica.h" -#include "rasterizer.h" -#include "shader/shader_interpreter.h" +#include "video_core/pica.h" +#include "video_core/rasterizer.h" #include "video_core/utils.h" +#include "video_core/debug_utils/debug_utils.h" +#include "video_core/shader/shader_interpreter.h" namespace Pica { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 62ca18317..50eb157a5 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -12,9 +12,9 @@ #include "common/microprofile.h" #include "common/profiler.h" -#include "core/hw/gpu.h" #include "core/memory.h" #include "core/settings.h" +#include "core/hw/gpu.h" #include "video_core/pica.h" #include "video_core/utils.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 24560d7f8..1fe307846 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -9,11 +9,10 @@ #include "common/common_types.h" #include "video_core/hwrasterizer_base.h" +#include "video_core/renderer_opengl/gl_rasterizer_cache.h" +#include "video_core/renderer_opengl/gl_state.h" #include "video_core/shader/shader_interpreter.h" -#include "gl_state.h" -#include "gl_rasterizer_cache.h" - class RasterizerOpenGL : public HWRasterizer { public: diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d9ccf2a3f..10d4ab0b6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -10,9 +10,9 @@ #include "core/memory.h" +#include "video_core/debug_utils/debug_utils.h" #include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include "video_core/renderer_opengl/pica_to_gl.h" -#include "video_core/debug_utils/debug_utils.h" RasterizerCacheOpenGL::~RasterizerCacheOpenGL() { FullFlush(); diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index ec56237b5..98a48ffbe 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -4,13 +4,13 @@ #pragma once -#include "gl_state.h" -#include "gl_resource_manager.h" -#include "video_core/debug_utils/debug_utils.h" -#include "video_core/pica.h" - -#include <memory> #include <map> +#include <memory> + +#include "video_core/pica.h" +#include "video_core/debug_utils/debug_utils.h" +#include "video_core/renderer_opengl/gl_resource_manager.h" +#include "video_core/renderer_opengl/gl_state.h" class RasterizerCacheOpenGL : NonCopyable { public: diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index 42d0e597c..4cf246c06 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "gl_shader_util.h" -#include "common/logging/log.h" - -#include <vector> #include <algorithm> +#include <vector> + +#include "common/logging/log.h" +#include "video_core/renderer_opengl/gl_shader_util.h" namespace ShaderUtil { diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index e02c27fbf..77b2816cb 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_state.h" #include "video_core/pica.h" +#include "video_core/renderer_opengl/gl_state.h" OpenGLState OpenGLState::cur_state; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 067d072ae..22f261c68 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -11,18 +11,18 @@ #include "common/logging/log.h" #include "common/profiler_reporting.h" +#include "core/memory.h" +#include "core/settings.h" #include "core/hw/gpu.h" #include "core/hw/hw.h" #include "core/hw/lcd.h" -#include "core/memory.h" -#include "core/settings.h" #include "video_core/video_core.h" -#include "video_core/renderer_opengl/renderer_opengl.h" +#include "video_core/debug_utils/debug_utils.h" +#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_shaders.h" - -#include "video_core/debug_utils/debug_utils.h" +#include "video_core/renderer_opengl/renderer_opengl.h" /** * Vertex structure that the drawn screen rectangles are composed of. diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index fd6d7c964..5677e538b 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -8,13 +8,10 @@ #include <glad/glad.h> -#include "common/math_util.h" - #include "core/hw/gpu.h" #include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_state.h" -#include "video_core/renderer_opengl/gl_rasterizer.h" class EmuWindow; diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 69e4efa68..7b0c20b74 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -7,9 +7,8 @@ #include <nihstro/shader_bytecode.h> #include "video_core/pica.h" - -#include "shader.h" -#include "shader_interpreter.h" +#include "video_core/shader/shader.h" +#include "video_core/shader/shader_interpreter.h" using nihstro::OpCode; using nihstro::Instruction; diff --git a/src/video_core/shader/shader_interpreter.h b/src/video_core/shader/shader_interpreter.h index 71bcad5ac..294bca50e 100644 --- a/src/video_core/shader/shader_interpreter.h +++ b/src/video_core/shader/shader_interpreter.h @@ -4,9 +4,7 @@ #pragma once -#include "video_core/pica.h" - -#include "shader.h" +#include "video_core/shader/shader.h" namespace Pica { diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.h index 8668cfff4..3afbceccf 100644 --- a/src/video_core/shader/shader_jit_x64.h +++ b/src/video_core/shader/shader_jit_x64.h @@ -9,8 +9,7 @@ #include "common/x64/emitter.h" #include "video_core/pica.h" - -#include "shader.h" +#include "video_core/shader/shader.h" using nihstro::Instruction; using nihstro::OpCode; diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp index c7cc93cea..6e1ff5cf4 100644 --- a/src/video_core/utils.cpp +++ b/src/video_core/utils.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <stdio.h> -#include <string.h> +#include <cstdio> +#include <cstring> #include "video_core/utils.h" diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 943fde5ee..eaddda668 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -2,17 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/logging/log.h" #include "common/emu_window.h" +#include "common/logging/log.h" #include "core/core.h" #include "core/settings.h" -#include "video_core.h" -#include "renderer_base.h" -#include "renderer_opengl/renderer_opengl.h" - -#include "pica.h" +#include "video_core/pica.h" +#include "video_core/renderer_base.h" +#include "video_core/video_core.h" +#include "video_core/renderer_opengl/renderer_opengl.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Video Core namespace |