diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/file_util.cpp | 37 | ||||
| -rw-r--r-- | src/common/file_util.h | 14 | ||||
| -rw-r--r-- | src/core/hle/kernel/memory/slab_heap.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/time/standard_network_system_clock_core.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/steady_clock_core.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/time/system_clock_context_update_callback.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/system_clock_core.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/system_clock_core.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 2 | 
10 files changed, 51 insertions, 19 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 35eee0096..45b750e1e 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -888,7 +888,14 @@ std::string SanitizePath(std::string_view path_, DirectorySeparator directory_se      }      std::replace(path.begin(), path.end(), type1, type2); -    path.erase(std::unique(path.begin(), path.end(), + +    auto start = path.begin(); +#ifdef _WIN32 +    // allow network paths which start with a double backslash (e.g. \\server\share) +    if (start != path.end()) +        ++start; +#endif +    path.erase(std::unique(start, path.end(),                             [type2](char c1, char c2) { return c1 == type2 && c2 == type2; }),                 path.end());      return std::string(RemoveTrailingSlash(path)); @@ -967,6 +974,34 @@ bool IOFile::Flush() {      return IsOpen() && 0 == std::fflush(m_file);  } +std::size_t IOFile::ReadImpl(void* data, std::size_t length, std::size_t data_size) const { +    if (!IsOpen()) { +        return std::numeric_limits<std::size_t>::max(); +    } + +    if (length == 0) { +        return 0; +    } + +    DEBUG_ASSERT(data != nullptr); + +    return std::fread(data, data_size, length, m_file); +} + +std::size_t IOFile::WriteImpl(const void* data, std::size_t length, std::size_t data_size) { +    if (!IsOpen()) { +        return std::numeric_limits<std::size_t>::max(); +    } + +    if (length == 0) { +        return 0; +    } + +    DEBUG_ASSERT(data != nullptr); + +    return std::fwrite(data, data_size, length, m_file); +} +  bool IOFile::Resize(u64 size) {      return IsOpen() && 0 ==  #ifdef _WIN32 diff --git a/src/common/file_util.h b/src/common/file_util.h index cde7ddf2d..f7a0c33fa 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -222,22 +222,15 @@ public:          static_assert(std::is_trivially_copyable_v<T>,                        "Given array does not consist of trivially copyable objects"); -        if (!IsOpen()) { -            return std::numeric_limits<std::size_t>::max(); -        } - -        return std::fread(data, sizeof(T), length, m_file); +        return ReadImpl(data, length, sizeof(T));      }      template <typename T>      std::size_t WriteArray(const T* data, std::size_t length) {          static_assert(std::is_trivially_copyable_v<T>,                        "Given array does not consist of trivially copyable objects"); -        if (!IsOpen()) { -            return std::numeric_limits<std::size_t>::max(); -        } -        return std::fwrite(data, sizeof(T), length, m_file); +        return WriteImpl(data, length, sizeof(T));      }      template <typename T> @@ -278,6 +271,9 @@ public:      }  private: +    std::size_t ReadImpl(void* data, std::size_t length, std::size_t data_size) const; +    std::size_t WriteImpl(const void* data, std::size_t length, std::size_t data_size); +      std::FILE* m_file = nullptr;  }; diff --git a/src/core/hle/kernel/memory/slab_heap.h b/src/core/hle/kernel/memory/slab_heap.h index 049403e15..be95fc3f7 100644 --- a/src/core/hle/kernel/memory/slab_heap.h +++ b/src/core/hle/kernel/memory/slab_heap.h @@ -51,7 +51,7 @@ public:      }      void Free(void* obj) { -        Node* node = reinterpret_cast<Node*>(obj); +        Node* node = static_cast<Node*>(obj);          Node* cur_head = head.load();          do { @@ -145,7 +145,7 @@ public:      }      T* Allocate() { -        T* obj = reinterpret_cast<T*>(AllocateImpl()); +        T* obj = static_cast<T*>(AllocateImpl());          if (obj != nullptr) {              new (obj) T();          } diff --git a/src/core/hle/service/time/standard_network_system_clock_core.h b/src/core/hle/service/time/standard_network_system_clock_core.h index 3f505c37c..c993bdf79 100644 --- a/src/core/hle/service/time/standard_network_system_clock_core.h +++ b/src/core/hle/service/time/standard_network_system_clock_core.h @@ -23,7 +23,7 @@ public:          standard_network_clock_sufficient_accuracy = value;      } -    bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) { +    bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {          SystemClockContext context{};          if (GetClockContext(system, context) != RESULT_SUCCESS) {              return {}; diff --git a/src/core/hle/service/time/steady_clock_core.h b/src/core/hle/service/time/steady_clock_core.h index 84af3d105..d80a2385f 100644 --- a/src/core/hle/service/time/steady_clock_core.h +++ b/src/core/hle/service/time/steady_clock_core.h @@ -16,6 +16,7 @@ namespace Service::Time::Clock {  class SteadyClockCore {  public:      SteadyClockCore() = default; +    virtual ~SteadyClockCore() = default;      const Common::UUID& GetClockSourceId() const {          return clock_source_id; diff --git a/src/core/hle/service/time/system_clock_context_update_callback.h b/src/core/hle/service/time/system_clock_context_update_callback.h index 6260de6c3..2b0fa7e75 100644 --- a/src/core/hle/service/time/system_clock_context_update_callback.h +++ b/src/core/hle/service/time/system_clock_context_update_callback.h @@ -20,7 +20,7 @@ namespace Service::Time::Clock {  class SystemClockContextUpdateCallback {  public:      SystemClockContextUpdateCallback(); -    ~SystemClockContextUpdateCallback(); +    virtual ~SystemClockContextUpdateCallback();      bool NeedUpdate(const SystemClockContext& value) const; diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp index 1a3ab8cfa..d31d4e2ca 100644 --- a/src/core/hle/service/time/system_clock_core.cpp +++ b/src/core/hle/service/time/system_clock_core.cpp @@ -9,7 +9,7 @@  namespace Service::Time::Clock {  SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core) -    : steady_clock_core{steady_clock_core}, is_initialized{} { +    : steady_clock_core{steady_clock_core} {      context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId();  } diff --git a/src/core/hle/service/time/system_clock_core.h b/src/core/hle/service/time/system_clock_core.h index 54407a6c5..608dd3b2e 100644 --- a/src/core/hle/service/time/system_clock_core.h +++ b/src/core/hle/service/time/system_clock_core.h @@ -22,7 +22,7 @@ class SystemClockContextUpdateCallback;  class SystemClockCore {  public:      explicit SystemClockCore(SteadyClockCore& steady_clock_core); -    ~SystemClockCore(); +    virtual ~SystemClockCore();      SteadyClockCore& GetSteadyClockCore() const {          return steady_clock_core; diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 12c6dcfde..6d2ff20f9 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -34,8 +34,6 @@  namespace OpenGL {  using Tegra::Engines::ShaderType; -using VideoCommon::Shader::CompileDepth; -using VideoCommon::Shader::CompilerSettings;  using VideoCommon::Shader::ProgramCode;  using VideoCommon::Shader::Registry;  using VideoCommon::Shader::ShaderIR; @@ -45,7 +43,7 @@ namespace {  constexpr u32 STAGE_MAIN_OFFSET = 10;  constexpr u32 KERNEL_MAIN_OFFSET = 0; -constexpr CompilerSettings COMPILER_SETTINGS{CompileDepth::FullDecompile}; +constexpr VideoCommon::Shader::CompilerSettings COMPILER_SETTINGS{};  /// Gets the address for the specified shader stage program  GPUVAddr GetShaderAddress(Core::System& system, Maxwell::ShaderProgram program) { diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 89f0e04ef..2c0c77c28 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -191,6 +191,7 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,          case Tegra::Texture::TextureMipmapFilter::Linear:              return GL_LINEAR_MIPMAP_LINEAR;          } +        break;      }      case Tegra::Texture::TextureFilter::Nearest: {          switch (mip_filter_mode) { @@ -201,6 +202,7 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,          case Tegra::Texture::TextureMipmapFilter::Linear:              return GL_NEAREST_MIPMAP_LINEAR;          } +        break;      }      }      LOG_ERROR(Render_OpenGL, "Unimplemented texture filter mode={}", static_cast<u32>(filter_mode));  | 
