d3d: Support the Danganronpa hack.
This commit is contained in:
parent
1f44bf2396
commit
b9d7ffe484
6 changed files with 22 additions and 20 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "Core/Config.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/System.h"
|
||||
#include "GPU/Common/FramebufferCommon.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
|
@ -41,6 +42,21 @@ FramebufferManagerCommon::FramebufferManagerCommon() :
|
|||
FramebufferManagerCommon::~FramebufferManagerCommon() {
|
||||
}
|
||||
|
||||
void FramebufferManagerCommon::Init() {
|
||||
|
||||
const std::string gameId = g_paramSFO.GetValueString("DISC_ID");
|
||||
// This applies a hack to Dangan Ronpa, its demo, and its sequel.
|
||||
// The game draws solid colors to a small framebuffer, and then reads this directly in VRAM.
|
||||
// We force this framebuffer to 1x and force download it automatically.
|
||||
hackForce04154000Download_ = gameId == "NPJH50631" || gameId == "NPJH50372" || gameId == "NPJH90164" || gameId == "NPJH50515";
|
||||
|
||||
// And an initial clear. We don't clear per frame as the games are supposed to handle that
|
||||
// by themselves.
|
||||
ClearBuffer();
|
||||
|
||||
BeginFrame();
|
||||
}
|
||||
|
||||
void FramebufferManagerCommon::BeginFrame() {
|
||||
DecimateFBOs();
|
||||
currentRenderVfb_ = 0;
|
||||
|
@ -664,7 +680,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst
|
|||
if (srcHeight <= 0 || srcY + srcHeight > srcBuffer->bufferHeight) {
|
||||
WARN_LOG_ONCE(btdheight, G3D, "Block transfer download %08x -> %08x skipped, %d+%d is taller than %d", srcBasePtr, dstBasePtr, srcY, srcHeight, srcBuffer->bufferHeight);
|
||||
} else {
|
||||
ReadFramebufferToMemory(srcBuffer, true, srcX * srcXFactor, srcY, srcWidth * srcXFactor, srcHeight);
|
||||
ReadFramebufferToMemory(srcBuffer, true, static_cast<int>(srcX * srcXFactor), srcY, static_cast<int>(srcWidth * srcXFactor), srcHeight);
|
||||
}
|
||||
}
|
||||
return false; // Let the bit copy happen
|
||||
|
@ -708,7 +724,7 @@ void FramebufferManagerCommon::NotifyBlockTransferAfter(u32 dstBasePtr, int dstS
|
|||
const u8 *srcBase = Memory::GetPointerUnchecked(srcBasePtr) + (srcX + srcY * srcStride) * bpp;
|
||||
int dstBpp = dstBuffer->format == GE_FORMAT_8888 ? 4 : 2;
|
||||
float dstXFactor = (float)bpp / dstBpp;
|
||||
DrawPixels(dstBuffer, dstX * dstXFactor, dstY, srcBase, dstBuffer->format, srcStride * dstXFactor, dstWidth * dstXFactor, dstHeight);
|
||||
DrawPixels(dstBuffer, static_cast<int>(dstX * dstXFactor), dstY, srcBase, dstBuffer->format, static_cast<int>(srcStride * dstXFactor), static_cast<int>(dstWidth * dstXFactor), dstHeight);
|
||||
SetColorUpdated(dstBuffer);
|
||||
RebindFramebuffer();
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
FramebufferManagerCommon();
|
||||
virtual ~FramebufferManagerCommon();
|
||||
|
||||
virtual void Init();
|
||||
void BeginFrame();
|
||||
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format);
|
||||
|
||||
|
|
|
@ -126,9 +126,6 @@ namespace DX9 {
|
|||
convBuf(0),
|
||||
gameUsesSequentialCopies_(false)
|
||||
{
|
||||
// And an initial clear. We don't clear per frame as the games are supposed to handle that
|
||||
// by themselves.
|
||||
ClearBuffer();
|
||||
// TODO: Check / use D3DCAPS2_DYNAMICTEXTURES?
|
||||
int usage = 0;
|
||||
D3DPOOL pool = D3DPOOL_MANAGED;
|
||||
|
@ -141,7 +138,6 @@ namespace DX9 {
|
|||
drawPixelsTex_ = nullptr;
|
||||
ERROR_LOG(G3D, "Failed to create drawpixels texture");
|
||||
}
|
||||
BeginFrame();
|
||||
}
|
||||
|
||||
FramebufferManagerDX9::~FramebufferManagerDX9() {
|
||||
|
|
|
@ -396,6 +396,7 @@ DIRECTX9_GPU::DIRECTX9_GPU()
|
|||
transformDraw_.SetShaderManager(shaderManager_);
|
||||
transformDraw_.SetTextureCache(&textureCache_);
|
||||
transformDraw_.SetFramebufferManager(&framebufferManager_);
|
||||
framebufferManager_.Init();
|
||||
framebufferManager_.SetTextureCache(&textureCache_);
|
||||
framebufferManager_.SetShaderManager(shaderManager_);
|
||||
framebufferManager_.SetTransformDrawEngine(&transformDraw_);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
@ -353,20 +352,9 @@ FramebufferManager::FramebufferManager() :
|
|||
}
|
||||
|
||||
void FramebufferManager::Init() {
|
||||
FramebufferManagerCommon::Init();
|
||||
CompileDraw2DProgram();
|
||||
|
||||
const std::string gameId = g_paramSFO.GetValueString("DISC_ID");
|
||||
// This applies a hack to Dangan Ronpa, its demo, and its sequel.
|
||||
// The game draws solid colors to a small framebuffer, and then reads this directly in VRAM.
|
||||
// We force this framebuffer to 1x and force download it automatically.
|
||||
hackForce04154000Download_ = gameId == "NPJH50631" || gameId == "NPJH50372" || gameId == "NPJH90164" || gameId == "NPJH50515";
|
||||
|
||||
// And an initial clear. We don't clear per frame as the games are supposed to handle that
|
||||
// by themselves.
|
||||
ClearBuffer();
|
||||
|
||||
SetLineWidth();
|
||||
BeginFrame();
|
||||
}
|
||||
|
||||
FramebufferManager::~FramebufferManager() {
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
void DestroyAllFBOs();
|
||||
|
||||
void Init();
|
||||
virtual void Init() override;
|
||||
void EndFrame();
|
||||
void Resized();
|
||||
void DeviceLost();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue