From 9e019a3a1a7a155f2dc99116b9ebe093c8d38d77 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 07:53:15 -0800 Subject: [PATCH 1/7] Build: Silence SFMT warning. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07e462e59d..bda50b1f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1369,7 +1369,8 @@ add_library(sfmt19937 STATIC ext/sfmt19937/SFMT-params.h ext/sfmt19937/SFMT-params19937.h ) -include_directories(ext/sfmt19937) +target_compile_definitions(sfmt19937 PRIVATE SFMT_MEXP=19937) +target_include_directories(sfmt19937 PRIVATE ext/sfmt19937) add_library(xbrz STATIC ext/xbrz/xbrz.cpp From 0556ee67fc96284ec2a850f2c2085d5c73e689ba Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 07:57:09 -0800 Subject: [PATCH 2/7] SaveState: Fix a format type error. --- Common/Serialize/Serializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Serialize/Serializer.cpp b/Common/Serialize/Serializer.cpp index ebe0e10d68..c9fb6457c2 100644 --- a/Common/Serialize/Serializer.cpp +++ b/Common/Serialize/Serializer.cpp @@ -76,7 +76,7 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver) return PointerWrapSection(*this, -1, title); } if (!checkpoints_[curCheckpoint_].Matches(marker, offset)) { - WARN_LOG(SAVESTATE, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, offset, (int)checkpoints_[curCheckpoint_].offset); + WARN_LOG(SAVESTATE, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, (int)offset, (int)checkpoints_[curCheckpoint_].offset); if (curCheckpoint_ > 1) { WARN_LOG(SAVESTATE, "Previous checkpoint: %s (%d)", checkpoints_[curCheckpoint_ - 1].title, (int)checkpoints_[curCheckpoint_ - 1].offset); } From e49668eea72eadb604ec3ed60ff2637cf7f43d6c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 07:57:30 -0800 Subject: [PATCH 3/7] SaveState: Correct missing switch case warnings. --- Common/Serialize/SerializeSet.h | 5 ++--- Common/Serialize/Serializer.cpp | 3 +++ Core/MemMap.cpp | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Common/Serialize/SerializeSet.h b/Common/Serialize/SerializeSet.h index 7e22f21e56..642b0dc6bb 100644 --- a/Common/Serialize/SerializeSet.h +++ b/Common/Serialize/SerializeSet.h @@ -46,9 +46,8 @@ void DoSet(PointerWrap &p, std::set &x) { Do(p, *itr++); } break; - - default: - ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", p.mode); + case PointerWrap::MODE_NOOP: + break; } } diff --git a/Common/Serialize/Serializer.cpp b/Common/Serialize/Serializer.cpp index c9fb6457c2..71f5168c3b 100644 --- a/Common/Serialize/Serializer.cpp +++ b/Common/Serialize/Serializer.cpp @@ -171,6 +171,7 @@ void Do(PointerWrap &p, std::string &x) { case PointerWrap::MODE_READ: x = (char*)*p.ptr; break; case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_NOOP: break; case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(!strcmp(x.c_str(), (char*)*p.ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char *)*p.ptr, p.ptr); break; } (*p.ptr) += stringLen; @@ -198,6 +199,7 @@ void Do(PointerWrap &p, std::wstring &x) { case PointerWrap::MODE_READ: x = read(); break; case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_NOOP: break; case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(x == read(), "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), read().c_str(), p.ptr); break; } (*p.ptr) += stringLen; @@ -225,6 +227,7 @@ void Do(PointerWrap &p, std::u16string &x) { case PointerWrap::MODE_READ: x = read(); break; case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_NOOP: break; case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(x == read(), "Savestate verification failure: (at %p).\n", p.ptr); break; } (*p.ptr) += stringLen; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 52ef9ff5f9..50a2d564fa 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -335,6 +335,8 @@ static void DoMemoryVoid(PointerWrap &p, uint32_t start, uint32_t size) { _dbg_assert_msg_(d[i] == storage[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", d[i], d[i], &d[i], storage[i], storage[i], &storage[i]); }, 0, size, 128); break; + case PointerWrap::MODE_NOOP: + break; } storage += size; } From 8c378c4557ee187e53b1d9136b8f023b22a23397 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 07:57:45 -0800 Subject: [PATCH 4/7] GPU: Avoid an override warning. --- GPU/GPUCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 4b47c65570..c15afe508f 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -265,7 +265,7 @@ protected: void DeviceLost() override; void DeviceRestore() override; - void ClearCacheNextFrame(); + void ClearCacheNextFrame() override; virtual void CheckRenderResized(); From e09a1a32a3464cdfaeee3b27325bbf98bb0dfd0b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 08:07:53 -0800 Subject: [PATCH 5/7] Build: Reduce include spam in CMake. This makes it more like other platforms, which don't globally include these directories. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bda50b1f2c..6f087427d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -884,7 +884,7 @@ add_library(cityhash STATIC ext/cityhash/city.h ext/cityhash/citycrc.h ) -include_directories(ext/cityhash) +target_include_directories(cityhash PRIVATE ext/cityhash) if(NOT MSVC) # These can be fast even for debug. @@ -1360,7 +1360,7 @@ add_library(kirk STATIC ext/libkirk/kirk_engine.c ext/libkirk/kirk_engine.h ) -include_directories(ext/libkirk) +target_include_directories(kirk PRIVATE ext/libkirk) add_library(sfmt19937 STATIC ext/sfmt19937/SFMT.c @@ -1376,13 +1376,13 @@ add_library(xbrz STATIC ext/xbrz/xbrz.cpp ext/xbrz/xbrz.h ) -include_directories(ext/xbrz) +target_include_directories(xbrz PRIVATE ext/xbrz) add_library(xxhash STATIC ext/xxhash.c ext/xxhash.h ) -include_directories(ext/xxhash) +target_include_directories(xxhash PRIVATE ext/xxhash) set(CoreExtra) set(CoreExtraLibs) From 6c6133a3c1073e6a5b6fc5716e2c7acb119fd16b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 08:08:20 -0800 Subject: [PATCH 6/7] Build: Get rid of legacy zstd support. This refers to old versions of zstd we never used, and the code also generates warnings when it's built. --- CMakeLists.txt | 1 + ext/libzstd.vcxproj | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f087427d0..4a9173ed37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2068,6 +2068,7 @@ if(USE_SYSTEM_ZSTD) target_link_libraries(${CoreLibName} ${ZSTD_LIBRARY}) else() set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "we don't need zstd programs" FORCE) + set(ZSTD_LEGACY_SUPPORT OFF CACHE BOOL "we don't use any old zstd files" FORCE) add_subdirectory(ext/zstd/build/cmake EXCLUDE_FROM_ALL) set(CoreExtraLibs ${CoreExtraLibs} libzstd_static) include_directories(ext/zstd/lib) diff --git a/ext/libzstd.vcxproj b/ext/libzstd.vcxproj index 7cd642f51c..68dadeded9 100644 --- a/ext/libzstd.vcxproj +++ b/ext/libzstd.vcxproj @@ -231,7 +231,7 @@ Level4 - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -250,7 +250,7 @@ Level4 - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -267,7 +267,7 @@ Level4 - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -284,7 +284,7 @@ Level4 - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug true @@ -304,7 +304,7 @@ MaxSpeed true true - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false MultiThreaded true @@ -330,7 +330,7 @@ MaxSpeed true true - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false false MultiThreaded @@ -356,7 +356,7 @@ MaxSpeed true true - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false false MultiThreaded @@ -382,7 +382,7 @@ MaxSpeed true true - ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false false MultiThreaded From 3342d5ecb3032b1bd5b604a74810ad746a09a763 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 4 Dec 2022 08:17:05 -0800 Subject: [PATCH 7/7] softgpu: Remove an unused case. --- GPU/Software/TransformUnit.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 53d2cb12c1..b7c9401219 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -569,10 +569,9 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G // Some games send rectangles as a series of regular triangles. // We look for this, but only in throughmode. ClipVertexData buf[6]; - int buf_index = data_index_; - for (int i = 0; i < data_index_; ++i) { - buf[i] = data_[i]; - } + // Could start at data_index_ and copy to buf, but there's little reason. + int buf_index = 0; + _assert_(data_index_ == 0); for (int vtx = 0; vtx < vertex_count; ++vtx) { buf[buf_index++] = vreader.Read(vtx);