diff --git a/Common/MemArena.cpp b/Common/MemArena.cpp index 82861775bc..ef65551614 100644 --- a/Common/MemArena.cpp +++ b/Common/MemArena.cpp @@ -215,8 +215,10 @@ u8* MemArena::Find4GBBase() #ifdef _M_X64 #ifdef _WIN32 // 64 bit - u8* base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE); - VirtualFree(base, 0, MEM_RELEASE); + u8 *base = (u8*)VirtualAlloc(0, 0xE1000000, MEM_RESERVE, PAGE_READWRITE); + if (base) { + VirtualFree(base, 0, MEM_RELEASE); + } return base; #else // Very precarious - mmap cannot return an error when trying to map already used pages. diff --git a/Common/x64Emitter.h b/Common/x64Emitter.h index db7d67dea8..e78166f9b3 100644 --- a/Common/x64Emitter.h +++ b/Common/x64Emitter.h @@ -34,7 +34,7 @@ namespace Gen { -enum X64Reg +enum X64Reg : u32 { EAX = 0, EBX = 3, ECX = 1, EDX = 2, ESI = 6, EDI = 7, EBP = 5, ESP = 4, diff --git a/Core/FileLoaders/RamCachingFileLoader.cpp b/Core/FileLoaders/RamCachingFileLoader.cpp index 7f56774a81..b4f9453941 100644 --- a/Core/FileLoaders/RamCachingFileLoader.cpp +++ b/Core/FileLoaders/RamCachingFileLoader.cpp @@ -223,7 +223,7 @@ void RamCachingFileLoader::StartReadAhead(s64 pos) { for (u32 i = cacheStartPos; i <= cacheEndPos; ++i) { if (blocks_[i] == 0) { - SaveIntoCache(i << BLOCK_SHIFT, BLOCK_SIZE * BLOCK_READAHEAD); + SaveIntoCache((u64)i << BLOCK_SHIFT, BLOCK_SIZE * BLOCK_READAHEAD); break; } } diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index 9a5a434995..5fc1da5d7d 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -477,7 +477,7 @@ static int Replace_dl_write_matrix() { return 60; } - u32 matrix; + u32 matrix = 0; int count = 12; switch (PARAM(1)) { case 3: diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 76d18df677..83d70dc343 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -180,6 +180,8 @@ void __sceAudiocodecDoState(PointerWrap &p){ // loadstate if audioList is nonempty auto codec_ = new int[count]; auto ctxPtr_ = new u32[count]; + // These sizeof(pointers) are wrong, but kept to avoid breaking on old saves. + // They're not used in new savestates. p.DoArray(codec_, s >= 2 ? count : (int)ARRAY_SIZE(codec_)); p.DoArray(ctxPtr_, s >= 2 ? count : (int)ARRAY_SIZE(ctxPtr_)); for (int i = 0; i < count; i++) { diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 6b43be3cd0..4c9395cfe2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1656,7 +1656,7 @@ static void __ReportThreadQueueEmpty() { int idleStatus1 = -1; if (idleThread1) { idleThread1->GetQuickInfo(idleDescription1, sizeof(idleDescription1)); - idleStatus1 = idleThread0->nt.status; + idleStatus1 = idleThread1->nt.status; } else { sprintf(idleDescription1, "DELETED"); } diff --git a/Core/MIPS/x86/RegCache.h b/Core/MIPS/x86/RegCache.h index 9b3ae2f195..fe7cc43a21 100644 --- a/Core/MIPS/x86/RegCache.h +++ b/Core/MIPS/x86/RegCache.h @@ -35,9 +35,9 @@ namespace X64JitConstants { const int NUM_MIPS_GPRS = 36; #ifdef _M_X64 - const int NUM_X_REGS = 16; + const u32 NUM_X_REGS = 16; #elif _M_IX86 - const int NUM_X_REGS = 8; + const u32 NUM_X_REGS = 8; #endif } diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index ee8f3d1aaa..1155de1c61 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -646,7 +646,8 @@ namespace SaveState break; case SAVESTATE_SAVE_SCREENSHOT: - if (!TakeGameScreenshot(op.filename.c_str(), SCREENSHOT_JPG, SCREENSHOT_RENDER)) { + callbackResult = TakeGameScreenshot(op.filename.c_str(), SCREENSHOT_JPG, SCREENSHOT_RENDER); + if (!callbackResult) { ERROR_LOG(COMMON, "Failed to take a screenshot for the savestate! %s", op.filename.c_str()); } break; diff --git a/ext/native/gfx_es2/draw_text.cpp b/ext/native/gfx_es2/draw_text.cpp index 03de087229..c3352307f7 100644 --- a/ext/native/gfx_es2/draw_text.cpp +++ b/ext/native/gfx_es2/draw_text.cpp @@ -81,7 +81,7 @@ uint32_t TextDrawer::SetFont(const char *fontName, int size, int flags) { else fname = L"Tahoma"; - uint32_t fontHash = hash::Fletcher((const uint8_t *)fontName, strlen(fontName)); + uint32_t fontHash = fontName ? hash::Fletcher((const uint8_t *)fontName, strlen(fontName)) : 0; fontHash ^= size; fontHash ^= flags << 10;