Don't crash on trying to re-record a GE dump

This commit is contained in:
Henrik Rydgård 2024-11-01 20:27:09 +01:00
parent 2e53d2f9f9
commit dd8f9b682f
4 changed files with 16 additions and 3 deletions

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;
};

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();

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;

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");