mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Darkstalkers: Gross hack to avoid the game's own stretch, and present the raw buffer instead for a sharper image.
This commit is contained in:
parent
2dd7a9aa12
commit
9099441973
@ -68,6 +68,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
|
||||
CheckSetting(iniFile, gameID, "HideISOFiles", &flags_.HideISOFiles);
|
||||
CheckSetting(iniFile, gameID, "MoreAccurateVMMUL", &flags_.MoreAccurateVMMUL);
|
||||
CheckSetting(iniFile, gameID, "ForceSoftwareRenderer", &flags_.ForceSoftwareRenderer);
|
||||
CheckSetting(iniFile, gameID, "DarkStalkersPresentHack", &flags_.DarkStalkersPresentHack);
|
||||
}
|
||||
|
||||
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {
|
||||
|
@ -68,6 +68,7 @@ struct CompatFlags {
|
||||
bool HideISOFiles;
|
||||
bool MoreAccurateVMMUL;
|
||||
bool ForceSoftwareRenderer;
|
||||
bool DarkStalkersPresentHack;
|
||||
};
|
||||
|
||||
class IniFile;
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "Core/System.h"
|
||||
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
#include "GPU/Software/Clipper.h"
|
||||
@ -24,6 +26,9 @@
|
||||
|
||||
#include "profiler/profiler.h"
|
||||
|
||||
|
||||
extern bool g_DarkStalkerStretch;
|
||||
|
||||
namespace Clipper {
|
||||
|
||||
enum {
|
||||
@ -207,6 +212,13 @@ void ProcessRect(const VertexData& v0, const VertexData& v1)
|
||||
return;
|
||||
}
|
||||
|
||||
// Eliminate the stretch blit in DarkStalkers.
|
||||
// We compensate for that when blitting the framebuffer in SoftGpu.cpp.
|
||||
if (PSP_CoreParameter().compat.flags().DarkStalkersPresentHack && v0.texturecoords.x == 64.0f && v0.texturecoords.y == 16.0f && v1.texturecoords.x == 448.0f && v1.texturecoords.y == 240.0f) {
|
||||
g_DarkStalkerStretch = true;
|
||||
return;
|
||||
}
|
||||
|
||||
VertexData buf[4];
|
||||
buf[0].screenpos = ScreenCoords(v0.screenpos.x, v0.screenpos.y, v1.screenpos.z);
|
||||
buf[0].texturecoords = v0.texturecoords;
|
||||
|
@ -148,12 +148,16 @@ void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat for
|
||||
GPURecord::NotifyDisplay(framebuf, stride, format);
|
||||
}
|
||||
|
||||
bool g_DarkStalkerStretch;
|
||||
|
||||
// Copies RGBA8 data from RAM to the currently bound render target.
|
||||
void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
||||
if (!draw_)
|
||||
return;
|
||||
float u0 = 0.0f;
|
||||
float u1;
|
||||
float v0 = 1.0f;
|
||||
float v1 = 0.0f;
|
||||
|
||||
if (fbTex) {
|
||||
fbTex->Release();
|
||||
@ -175,7 +179,19 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
||||
desc.mipLevels = 1;
|
||||
desc.tag = "SoftGPU";
|
||||
bool hasImage = true;
|
||||
if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) {
|
||||
if (PSP_CoreParameter().compat.flags().DarkStalkersPresentHack && displayFormat_ == GE_FORMAT_5551 && g_DarkStalkerStretch) {
|
||||
u8 *data = Memory::GetPointer(0x04088000);
|
||||
desc.swizzle = Draw::TextureSwizzle::BGRA;
|
||||
desc.format = Draw::DataFormat::A1R5G5B5_UNORM_PACK16;
|
||||
desc.width = displayStride_ == 0 ? srcwidth : displayStride_;
|
||||
desc.height = srcheight;
|
||||
desc.initData.push_back(data);
|
||||
u0 = 64.0f / 512.0f;
|
||||
u1 = 448.0f / 512.0f;
|
||||
v1 = 16.0f / 272.0f;
|
||||
v0 = 240.0f / 272.0f;
|
||||
g_DarkStalkerStretch = false;
|
||||
} else if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) {
|
||||
hasImage = false;
|
||||
u1 = 1.0f;
|
||||
} else if (displayFormat_ == GE_FORMAT_8888) {
|
||||
@ -252,12 +268,10 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
||||
x2 -= 1.0f;
|
||||
y2 -= 1.0f;
|
||||
|
||||
float v0 = 1.0f;
|
||||
float v1 = 0.0f;
|
||||
|
||||
if (GetGPUBackend() == GPUBackend::VULKAN) {
|
||||
std::swap(v0, v1);
|
||||
}
|
||||
|
||||
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE });
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, dstwidth, dstheight, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
|
@ -688,3 +688,8 @@ UCUS98713 = true
|
||||
# Darkstalkers
|
||||
ULES00016 = true
|
||||
ULUS10005 = true
|
||||
|
||||
[DarkStalkersPresentHack]
|
||||
# Darkstalkers
|
||||
ULES00016 = true
|
||||
ULUS10005 = true
|
||||
|
Loading…
Reference in New Issue
Block a user