mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Add various checks trying to avoid various crashes found in Google Play crash reports.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user