Merge pull request #19572 from hrydgard/even-more-fixes

Even more minor fixes
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-11-01 22:08:47 +01:00
commit e8ea225a0f
9 files changed
+64 -38

No files matched your search

+2
View File
@@ -21,6 +21,7 @@
#include "Common/File/Path.h"
#include "Core/Compatibility.h"
#include "Core/Loaders.h"
enum GPUCore {
GPUCORE_GLES,
@@ -86,6 +87,7 @@ struct CoreParameter {
bool frozen = false;
FileLoader *mountIsoLoader = nullptr;
IdentifiedFileType fileType = IdentifiedFileType::UNKNOWN;
Compatibility compat;
};
+17 -4
View File
@@ -23,7 +23,7 @@
#include "Core/Loaders.h"
#include "Core/ELF/PBPReader.h"
PBPReader::PBPReader(FileLoader *fileLoader) : file_(nullptr), header_(), isELF_(false) {
PBPReader::PBPReader(FileLoader *fileLoader) {
if (!fileLoader->Exists()) {
ERROR_LOG(Log::Loader, "Failed to open PBP file %s", fileLoader->GetPath().c_str());
return;
@@ -48,12 +48,19 @@ PBPReader::PBPReader(FileLoader *fileLoader) : file_(nullptr), header_(), isELF_
file_ = fileLoader;
}
bool PBPReader::GetSubFile(PBPSubFile file, std::vector<u8> *out) {
bool PBPReader::GetSubFile(PBPSubFile file, std::vector<u8> *out) const {
if (!file_) {
return false;
}
const size_t expected = GetSubFileSize(file);
// This is only used to get the PARAM.SFO, so let's have a strict 256MB file size limit for sanity.
if (expected > 256 * 1024 * 1024) {
ERROR_LOG(Log::Loader, "Bad subfile size: %d", (int)expected);
return false;
}
const u32 off = header_.offsets[(int)file];
out->resize(expected);
@@ -67,13 +74,19 @@ bool PBPReader::GetSubFile(PBPSubFile file, std::vector<u8> *out) {
return true;
}
void PBPReader::GetSubFileAsString(PBPSubFile file, std::string *out) {
bool PBPReader::GetSubFileAsString(PBPSubFile file, std::string *out) const {
if (!file_) {
out->clear();
return;
return false;
}
const size_t expected = GetSubFileSize(file);
// This is only used to get the PNG, AT3 etc, so let's have a strict 256MB file size limit for sanity.
if (expected > 256 * 1024 * 1024) {
ERROR_LOG(Log::Loader, "Bad subfile size: %d", (int)expected);
return false;
}
const u32 off = header_.offsets[(int)file];
out->resize(expected);
+7 -7
View File
@@ -50,10 +50,10 @@ public:
bool IsValid() const { return file_ != nullptr; }
bool IsELF() const { return file_ == nullptr && isELF_; }
bool GetSubFile(PBPSubFile file, std::vector<u8> *out);
void GetSubFileAsString(PBPSubFile file, std::string *out);
bool GetSubFile(PBPSubFile file, std::vector<u8> *out) const;
bool GetSubFileAsString(PBPSubFile file, std::string *out) const;
size_t GetSubFileSize(PBPSubFile file) {
size_t GetSubFileSize(PBPSubFile file) const {
int num = (int)file;
if (num < 7) {
return header_.offsets[file + 1] - header_.offsets[file];
@@ -63,8 +63,8 @@ public:
}
private:
FileLoader *file_;
size_t fileSize_;
const PBPHeader header_;
bool isELF_;
FileLoader *file_ = nullptr;
size_t fileSize_ = 0;
const PBPHeader header_{};
bool isELF_ = false;
};
+4 -2
View File
@@ -428,10 +428,12 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
memcpy(psarStr, &psar_id, 4);
// Protect against a badly decrypted header, and send information through the assert about what's being played (implicitly).
_assert_msg_(blockLBAs_ <= 4096, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr);
_dbg_assert_msg_(blockLBAs_ <= 4096, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr);
// When we remove the above assert, let's just try to survive.
if (blockLBAs_ > 4096) {
ERROR_LOG(Log::Loader, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr);
// We'll end up displaying an error message since ReadBlock will fail.
return;
}
@@ -447,7 +449,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
table_ = new table_info[numBlocks_];
readSize = fileLoader_->ReadAt(psarOffset + tableOffset_, 1, tableSize_, table_);
if (readSize!=tableSize_){
if (readSize != tableSize_){
ERROR_LOG(Log::Loader, "Invalid NPUMDIMG table!");
}
+14 -22
View File
@@ -4,27 +4,23 @@
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/sceIo.h"
static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr)
{
INFO_LOG(Log::HLE, "call sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr);
static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr) {
WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr);
return 0;
}
static int sceNpDrmClearLicenseeKey()
{
INFO_LOG(Log::HLE, "call sceNpDrmClearLicenseeKey()");
static int sceNpDrmClearLicenseeKey() {
WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmClearLicenseeKey()");
return 0;
}
static int sceNpDrmRenameCheck(const char *filename)
{
INFO_LOG(Log::HLE, "call sceNpDrmRenameCheck(%s)", filename);
static int sceNpDrmRenameCheck(const char *filename) {
WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmRenameCheck(%s)", filename);
return 0;
}
static int sceNpDrmEdataSetupKey(u32 edataFd)
{
INFO_LOG(Log::HLE, "call sceNpDrmEdataSetupKey %x", edataFd);
static int sceNpDrmEdataSetupKey(u32 edataFd) {
INFO_LOG(Log::HLE, "sceNpDrmEdataSetupKey(%x)", edataFd);
int usec = 0;
// set PGD offset
int retval = __IoIoctl(edataFd, 0x04100002, 0x90, 0, 0, 0, usec);
@@ -37,20 +33,17 @@ static int sceNpDrmEdataSetupKey(u32 edataFd)
return hleDelayResult(retval, "io ctrl command", usec);
}
static int sceNpDrmEdataGetDataSize(u32 edataFd)
{
INFO_LOG(Log::HLE, "call sceNpDrmEdataGetDataSize %x", edataFd);
static int sceNpDrmEdataGetDataSize(u32 edataFd) {
INFO_LOG(Log::HLE, "sceNpDrmEdataGetDataSize %x", edataFd);
return sceIoIoctl(edataFd, 0x04100010, 0, 0, 0, 0);
}
static int sceNpDrmOpen()
{
ERROR_LOG(Log::HLE, "UNIMPL sceNpDrmOpen");
static int sceNpDrmOpen() {
ERROR_LOG(Log::HLE, "UNIMPL: sceNpDrmOpen()");
return 0;
}
const HLEFunction sceNpDrm[] =
{
const HLEFunction sceNpDrm[] = {
{0XA1336091, &WrapI_U<sceNpDrmSetLicenseeKey>, "sceNpDrmSetLicenseeKey", 'i', "x"},
{0X9B745542, &WrapI_V<sceNpDrmClearLicenseeKey>, "sceNpDrmClearLicenseeKey", 'i', "" },
{0X275987D1, &WrapI_C<sceNpDrmRenameCheck>, "sceNpDrmRenameCheck", 'i', "s"},
@@ -59,8 +52,7 @@ const HLEFunction sceNpDrm[] =
{0X2BAA4294, &WrapI_V<sceNpDrmOpen>, "sceNpDrmOpen", 'i', "" },
};
void Register_sceNpDrm()
{
void Register_sceNpDrm() {
RegisterModule("sceNpDrm", ARRAY_SIZE(sceNpDrm), sceNpDrm);
RegisterModule("scePspNpDrm_user", ARRAY_SIZE(sceNpDrm), sceNpDrm);
}
+1
View File
@@ -254,6 +254,7 @@ bool CPU_Init(std::string *errorString, FileLoader *loadedFile) {
if (!g_CoreParameter.mountIso.empty()) {
g_CoreParameter.mountIsoLoader = ConstructFileLoader(g_CoreParameter.mountIso);
}
g_CoreParameter.fileType = type;
MIPSAnalyst::Reset();
Replacement_Init();
+12 -2
View File
@@ -151,7 +151,12 @@ static void DirtyDrawnVRAM() {
DirtyVRAM(gstate.getFrameBufAddress(), bytes, DirtyVRAMFlag::DRAWN);
}
static void BeginRecording() {
static bool BeginRecording() {
if (PSP_CoreParameter().fileType == IdentifiedFileType::PPSSPP_GE_DUMP) {
// Can't record a GE dump.
return false;
}
active = true;
nextFrame = false;
lastTextures.clear();
@@ -178,6 +183,7 @@ static void BeginRecording() {
}
DirtyAllVRAM(DirtyVRAMFlag::DIRTY);
return true;
}
static void WriteCompressed(FILE *fp, const void *p, size_t sz) {
@@ -619,6 +625,10 @@ void ClearCallback() {
static void FinishRecording() {
// We're done - this was just to write the result out.
if (!active) {
return;
}
Path filename = WriteRecording();
commands.clear();
pushbuf.clear();
@@ -785,7 +795,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) {
}
if (!active && nextFrame && (gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0) {
NOTICE_LOG(Log::System, "Recording starting on display...");
BeginRecording();
BeginRecording(); // TODO: Handle return value.
}
if (!active) {
return;
+1 -1
View File
@@ -1398,7 +1398,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
Draw::BackendState state = draw->GetCurrentBackendState();
if (state.valid) {
_dbg_assert_msg_(state.passes >= 1, "skipB: %d sw: %d mode: %d back: %d tag: %s", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering, (int)mode, (int)g_Config.iGPUBackend, screenManager()->topScreen()->tag());
_dbg_assert_msg_(state.passes >= 1, "skipB: %d sw: %d mode: %d back: %d tag: %s behi: %d", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering, (int)mode, (int)g_Config.iGPUBackend, screenManager()->topScreen()->tag(), (int)g_Config.bRunBehindPauseMenu);
// Workaround any remaining bugs like this.
if (state.passes == 0) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, }, "EmuScreen_SafeFallback");
+6
View File
@@ -831,6 +831,12 @@ ULJS00188 = true
UCES00018 = true
UCUS98601 = true
# PlayStation Network Collection: Power Pack (#19571)
UCES01160 = true
# PlayStation Network Collection: Puzzle Pack
UCES01159 = true
[GoWFramerateHack60]
# Replaces ForceMax60FPS for GOW games, should provide smoother experience
# Also works around softlock in GOW:GOS , see #8299