diff --git a/Common/Data/Collections/FastVec.h b/Common/Data/Collections/FastVec.h index ee3799d775..85859bbb9c 100644 --- a/Common/Data/Collections/FastVec.h +++ b/Common/Data/Collections/FastVec.h @@ -158,7 +158,8 @@ private: T *oldData = data_; data_ = (T *)malloc(sizeof(T) * newCapacity); _assert_msg_(data_ != nullptr, "%d", (int)newCapacity); - if (capacity_ != 0) { + _dbg_assert_(oldData != nullptr); + if (capacity_ != 0 && oldData != nullptr) { memcpy(data_, oldData, sizeof(T) * size_); free(oldData); } diff --git a/Common/GPU/Vulkan/VulkanDescSet.cpp b/Common/GPU/Vulkan/VulkanDescSet.cpp index df68d67b87..b28f501525 100644 --- a/Common/GPU/Vulkan/VulkanDescSet.cpp +++ b/Common/GPU/Vulkan/VulkanDescSet.cpp @@ -5,7 +5,12 @@ VulkanDescSetPool::~VulkanDescSetPool() { } void VulkanDescSetPool::Create(VulkanContext *vulkan, const BindingType *bindingTypes, uint32_t bindingTypesCount, uint32_t descriptorCount) { - _assert_msg_(descPool_ == VK_NULL_HANDLE, "VulkanDescSetPool::Create when already exists"); + // Seeing confusing crash reports of this, so reduced to a debug asserts and trying to limp along. + _dbg_assert_msg_(descPool_ == VK_NULL_HANDLE, "VulkanDescSetPool::Create when already exists"); + if (descPool_) { + ERROR_LOG(Log::G3D, "VulkanDescSetPool::Create when already exists - unexpected"); + descPool_ = VK_NULL_HANDLE; + } vulkan_ = vulkan; info_ = { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO }; diff --git a/Core/FileSystems/BlockDevices.h b/Core/FileSystems/BlockDevices.h index e62f18622c..5b765ca31c 100644 --- a/Core/FileSystems/BlockDevices.h +++ b/Core/FileSystems/BlockDevices.h @@ -46,7 +46,7 @@ public: } return true; } - int GetBlockSize() const { return 2048;} // forced, it cannot be changed by subclasses. If a subclass uses bigger blocks internally, it must cache and virtualize. + int constexpr GetBlockSize() const { return 2048;} // forced, it cannot be changed by subclasses. If a subclass uses bigger blocks internally, it must cache and virtualize. virtual u32 GetNumBlocks() const = 0; virtual u64 GetUncompressedSize() const { return (u64)GetNumBlocks() * (u64)GetBlockSize(); diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index c7a6d3d7f8..425b2513b9 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -529,6 +529,8 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { const int firstBlockSize = firstBlockOffset == 0 ? 0 : (int)std::min(size, 2048LL - firstBlockOffset); const int lastBlockSize = (size - firstBlockSize) & 2047; const s64 middleSize = size - firstBlockSize - lastBlockSize; + _dbg_assert_((middleSize & 2047) == 0); + u32 secNum = (u32)(positionOnIso / 2048); u8 theSector[2048]; @@ -543,9 +545,9 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { pointer += firstBlockSize; } if (middleSize > 0) { - const u32 sectors = (u32)(middleSize / 2048); - blockDevice->ReadBlocks(secNum, sectors, pointer); - secNum += sectors; + const u32 middleSectors = (u32)(middleSize / 2048); + blockDevice->ReadBlocks(secNum, middleSectors, pointer); + secNum += middleSectors; pointer += middleSize; } if (lastBlockSize > 0) { diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 30a42df40f..d34caff9c2 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1400,6 +1400,12 @@ void PostPutAction::run(MipsCall &call) { ringbufferPutPacketsAdded += packetsAddedThisRound; } + if (!ctx) { + _dbg_assert_(false); + ERROR_LOG(Log::Mpeg, "sceMpegRingbufferPut: bad mpeg handle %08x", ringbuffer->mpeg); + return; + } + // It seems validation is done only by older mpeg libs. if (mpegLibVersion < 0x0105 && packetsAddedThisRound > 0) { // TODO: Faster / less wasteful validation. diff --git a/GPU/Common/ReplacedTexture.cpp b/GPU/Common/ReplacedTexture.cpp index 0950d00e54..5c3ed37593 100644 --- a/GPU/Common/ReplacedTexture.cpp +++ b/GPU/Common/ReplacedTexture.cpp @@ -223,7 +223,8 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) { break; } - VFSFileReference *fileRef = vfs_->GetFile(desc_.filenames[i].c_str()); + std::string path(desc_.filenames[i]); + VFSFileReference *fileRef = vfs_->GetFile(path.c_str()); if (!fileRef) { if (i == 0) { INFO_LOG(Log::TexReplacement, "Texture replacement file '%s' not found in %s", desc_.filenames[i].c_str(), vfs_->toString().c_str()); diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index cc3db79d27..d681d1a7d6 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -101,6 +101,7 @@ void GPU_Vulkan::FinishInitOnMainThread() { } void GPU_Vulkan::LoadCache(const Path &filename) { + _dbg_assert_(draw_); if (!g_Config.bShaderCache) { WARN_LOG(Log::G3D, "Shader cache disabled. Not loading."); return; diff --git a/android/src/org/ppsspp/ppsspp/ShortcutActivity.java b/android/src/org/ppsspp/ppsspp/ShortcutActivity.java index 06b6c7d2f5..cf2d5ef60b 100644 --- a/android/src/org/ppsspp/ppsspp/ShortcutActivity.java +++ b/android/src/org/ppsspp/ppsspp/ShortcutActivity.java @@ -161,7 +161,11 @@ public class ShortcutActivity extends Activity { setResult(RESULT_OK, responseIntent); // Must call finish for result to be returned immediately - finish(); + try { + finish(); + } catch (Exception e) { + NativeApp.reportException(e, "Error finishing respondToShortcutRequest"); + } Log.i(TAG, "End of respondToShortcutRequest"); }