mirror of https://github.com/PCSX2/pcsx2.git
parent
b2dc31ba80
commit
8866faa8d5
|
@ -518,7 +518,6 @@ set(pcsx2GSSources
|
|||
GS/GSAlignedClass.cpp
|
||||
GS/GSCapture.cpp
|
||||
GS/GSClut.cpp
|
||||
GS/GSCrc.cpp
|
||||
GS/GSDrawingContext.cpp
|
||||
GS/GSDump.cpp
|
||||
GS/GSLocalMemory.cpp
|
||||
|
@ -554,7 +553,6 @@ set(pcsx2GSHeaders
|
|||
GS/GSBlock.h
|
||||
GS/GSCapture.h
|
||||
GS/GSClut.h
|
||||
GS/GSCrc.h
|
||||
GS/GSDrawingContext.h
|
||||
GS/GSDrawingEnvironment.h
|
||||
GS/GSDump.h
|
||||
|
|
|
@ -202,6 +202,7 @@ static bool OpenGSRenderer(GSRendererType renderer, u8* basemem)
|
|||
|
||||
g_gs_renderer->SetRegsMem(basemem);
|
||||
g_gs_renderer->ResetPCRTC();
|
||||
g_gs_renderer->UpdateRenderFixes();
|
||||
g_perfmon.Reset();
|
||||
return true;
|
||||
}
|
||||
|
@ -239,7 +240,6 @@ bool GSreopen(bool recreate_device, bool recreate_renderer, const Pcsx2Config::G
|
|||
}
|
||||
|
||||
u8* basemem = g_gs_renderer->GetRegsMem();
|
||||
const u32 gamecrc = g_gs_renderer->GetGameCRC();
|
||||
|
||||
freezeData fd = {};
|
||||
std::unique_ptr<u8[]> fd_data;
|
||||
|
@ -309,8 +309,6 @@ bool GSreopen(bool recreate_device, bool recreate_renderer, const Pcsx2Config::G
|
|||
Console.Error("(GSreopen) Failed to defrost");
|
||||
return false;
|
||||
}
|
||||
|
||||
g_gs_renderer->SetGameCRC(gamecrc);
|
||||
}
|
||||
|
||||
if (!capture_filename.empty())
|
||||
|
@ -504,9 +502,10 @@ void GSThrottlePresentation()
|
|||
Threading::SleepUntil(s_next_manual_present_time);
|
||||
}
|
||||
|
||||
void GSSetGameCRC(u32 crc)
|
||||
void GSGameChanged()
|
||||
{
|
||||
g_gs_renderer->SetGameCRC(crc);
|
||||
if (GSConfig.UseHardwareRenderer())
|
||||
GSTextureReplacements::GameChanged();
|
||||
}
|
||||
|
||||
void GSResizeDisplayWindow(int width, int height, float scale)
|
||||
|
@ -731,7 +730,7 @@ void GSUpdateConfig(const Pcsx2Config::GSOptions& new_config)
|
|||
GSConfig.BeforeDrawFunctionId != old_config.BeforeDrawFunctionId ||
|
||||
GSConfig.MoveHandlerFunctionId != old_config.MoveHandlerFunctionId)
|
||||
{
|
||||
g_gs_renderer->UpdateCRCHacks();
|
||||
g_gs_renderer->UpdateRenderFixes();
|
||||
}
|
||||
|
||||
// renderer-specific options (e.g. auto flush, TC offset)
|
||||
|
|
|
@ -94,7 +94,7 @@ bool GSBeginCapture(std::string filename);
|
|||
void GSEndCapture();
|
||||
void GSPresentCurrentFrame();
|
||||
void GSThrottlePresentation();
|
||||
void GSSetGameCRC(u32 crc);
|
||||
void GSGameChanged();
|
||||
void GSSetDisplayAlignment(GSDisplayAlignment alignment);
|
||||
void GSResizeDisplayWindow(int width, int height, float scale);
|
||||
void GSUpdateDisplayWindow();
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "GS/GSCrc.h"
|
||||
#include "GS/GSExtra.h"
|
||||
#include "GS/GS.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "common/StringUtil.h"
|
||||
|
||||
const CRC::Game CRC::m_games[] =
|
||||
{
|
||||
// Note: IDs 0x7ACF7E03, 0x7D4EA48F, 0x37C53760 - shouldn't be added as it's from the multiloaders when packing games.
|
||||
{0x00000000, NoTitle /* NoRegion */},
|
||||
{0xFC46EA61, Tekken5 /* JP */},
|
||||
{0x1F88EE37, Tekken5 /* EU */},
|
||||
{0x1F88BECD, Tekken5 /* EU */}, // language selector...
|
||||
{0x652050D2, Tekken5 /* US */},
|
||||
{0xEA64EF39, Tekken5 /* KO */},
|
||||
};
|
||||
|
||||
const CRC::Game& CRC::Lookup(u32 crc)
|
||||
{
|
||||
for (const Game& game : m_games)
|
||||
{
|
||||
if (game.crc == crc)
|
||||
return game;
|
||||
}
|
||||
|
||||
return m_games[0];
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
class CRC
|
||||
{
|
||||
public:
|
||||
enum Title : u32
|
||||
{
|
||||
NoTitle,
|
||||
Tekken5,
|
||||
TitleCount,
|
||||
};
|
||||
|
||||
struct Game
|
||||
{
|
||||
u32 crc;
|
||||
Title title;
|
||||
};
|
||||
|
||||
private:
|
||||
static const Game m_games[];
|
||||
|
||||
public:
|
||||
static const Game& Lookup(u32 crc);
|
||||
};
|
|
@ -2187,11 +2187,6 @@ void GSState::ReadLocalMemoryUnsync(u8* mem, int qwc, GIFRegBITBLTBUF BITBLTBUF,
|
|||
}
|
||||
}
|
||||
|
||||
void GSState::PurgePool()
|
||||
{
|
||||
g_gs_device->PurgePool();
|
||||
}
|
||||
|
||||
void GSState::PurgeTextureCache()
|
||||
{
|
||||
}
|
||||
|
@ -2610,17 +2605,6 @@ int GSState::Defrost(const freezeData* fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GSState::SetGameCRC(u32 crc)
|
||||
{
|
||||
m_crc = crc;
|
||||
UpdateCRCHacks();
|
||||
}
|
||||
|
||||
void GSState::UpdateCRCHacks()
|
||||
{
|
||||
m_game = CRC::Lookup(GSConfig.UserHacks_DisableRenderFixes ? 0 : m_crc);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void GSState::UpdateContext()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "GS/Renderers/Common/GSVertexTrace.h"
|
||||
#include "GS/Renderers/Common/GSDevice.h"
|
||||
#include "GS/GSVector.h"
|
||||
#include "GSCrc.h"
|
||||
#include "GSAlignedClass.h"
|
||||
|
||||
class GSDumpBase;
|
||||
|
@ -218,8 +217,6 @@ public:
|
|||
const GSDrawingEnvironment* m_draw_env = &m_env;
|
||||
GSDrawingContext* m_context = nullptr;
|
||||
GSVector4i temp_draw_rect = {};
|
||||
u32 m_crc = 0;
|
||||
CRC::Game m_game = {};
|
||||
std::unique_ptr<GSDumpBase> m_dump;
|
||||
bool m_scissor_invalid = false;
|
||||
bool m_nativeres = false;
|
||||
|
@ -389,7 +386,6 @@ public:
|
|||
bool TestDrawChanged();
|
||||
void FlushWrite();
|
||||
virtual void Draw() = 0;
|
||||
virtual void PurgePool();
|
||||
virtual void PurgeTextureCache();
|
||||
virtual void ReadbackTextureCache();
|
||||
virtual void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) {}
|
||||
|
@ -409,10 +405,6 @@ public:
|
|||
int Freeze(freezeData* fd, bool sizeonly);
|
||||
int Defrost(const freezeData* fd);
|
||||
|
||||
u32 GetGameCRC() const { return m_crc; }
|
||||
virtual void SetGameCRC(u32 crc);
|
||||
virtual void UpdateCRCHacks();
|
||||
|
||||
u8* GetRegsMem() const { return reinterpret_cast<u8*>(m_regs); }
|
||||
void SetRegsMem(u8* basemem) { m_regs = reinterpret_cast<GSPrivRegSet*>(basemem); }
|
||||
|
||||
|
|
|
@ -87,6 +87,15 @@ void GSRenderer::Destroy()
|
|||
GSCapture::EndCapture();
|
||||
}
|
||||
|
||||
void GSRenderer::PurgePool()
|
||||
{
|
||||
g_gs_device->PurgePool();
|
||||
}
|
||||
|
||||
void GSRenderer::UpdateRenderFixes()
|
||||
{
|
||||
}
|
||||
|
||||
bool GSRenderer::Merge(int field)
|
||||
{
|
||||
GSVector2i fs(0, 0);
|
||||
|
@ -659,6 +668,9 @@ void GSRenderer::VSync(u32 field, bool registers_written, bool idle_frame)
|
|||
|
||||
if (!m_dump && m_dump_frames > 0)
|
||||
{
|
||||
if (GSConfig.UserHacks_ReadTCOnClose)
|
||||
ReadbackTextureCache();
|
||||
|
||||
freezeData fd = {0, nullptr};
|
||||
Freeze(&fd, true);
|
||||
fd.data = new u8[fd.size];
|
||||
|
@ -673,26 +685,23 @@ void GSRenderer::VSync(u32 field, bool registers_written, bool idle_frame)
|
|||
std::string_view compression_str;
|
||||
if (GSConfig.GSDumpCompression == GSDumpCompressionMethod::Uncompressed)
|
||||
{
|
||||
m_dump = std::unique_ptr<GSDumpBase>(new GSDumpUncompressed(m_snapshot, VMManager::GetDiscSerial(), m_crc,
|
||||
screenshot_width, screenshot_height,
|
||||
screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(),
|
||||
fd, m_regs));
|
||||
m_dump = std::unique_ptr<GSDumpBase>(new GSDumpUncompressed(m_snapshot, VMManager::GetDiscSerial(),
|
||||
VMManager::GetDiscCRC(), screenshot_width, screenshot_height,
|
||||
screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(), fd, m_regs));
|
||||
compression_str = "with no compression";
|
||||
}
|
||||
else if (GSConfig.GSDumpCompression == GSDumpCompressionMethod::LZMA)
|
||||
{
|
||||
m_dump = std::unique_ptr<GSDumpBase>(new GSDumpXz(m_snapshot, VMManager::GetDiscSerial(), m_crc,
|
||||
screenshot_width, screenshot_height,
|
||||
screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(),
|
||||
fd, m_regs));
|
||||
m_dump = std::unique_ptr<GSDumpBase>(
|
||||
new GSDumpXz(m_snapshot, VMManager::GetDiscSerial(), VMManager::GetDiscCRC(), screenshot_width,
|
||||
screenshot_height, screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(), fd, m_regs));
|
||||
compression_str = "with LZMA compression";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dump = std::unique_ptr<GSDumpBase>(new GSDumpZst(m_snapshot, VMManager::GetDiscSerial(), m_crc,
|
||||
screenshot_width, screenshot_height,
|
||||
screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(),
|
||||
fd, m_regs));
|
||||
m_dump = std::unique_ptr<GSDumpBase>(
|
||||
new GSDumpZst(m_snapshot, VMManager::GetDiscSerial(), VMManager::GetDiscCRC(), screenshot_width,
|
||||
screenshot_height, screenshot_pixels.empty() ? nullptr : screenshot_pixels.data(), fd, m_regs));
|
||||
compression_str = "with Zstandard compression";
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,10 @@ public:
|
|||
|
||||
virtual void Destroy();
|
||||
|
||||
virtual void UpdateRenderFixes();
|
||||
|
||||
void PurgePool();
|
||||
|
||||
virtual void VSync(u32 field, bool registers_written, bool idle_frame);
|
||||
virtual bool CanUpscale() { return false; }
|
||||
virtual float GetUpscaleMultiplier() { return 1.0f; }
|
||||
|
|
|
@ -1532,9 +1532,9 @@ s16 GSLookupMoveHandlerFunctionId(const std::string_view& name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void GSRendererHW::UpdateCRCHacks()
|
||||
void GSRendererHW::UpdateRenderFixes()
|
||||
{
|
||||
GSRenderer::UpdateCRCHacks();
|
||||
GSRenderer::UpdateRenderFixes();
|
||||
|
||||
m_nativeres = (GSConfig.UpscaleMultiplier == 1.0f);
|
||||
s_nativeres = m_nativeres;
|
||||
|
|
|
@ -76,13 +76,6 @@ GSTexture* GSRendererHW::LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVecto
|
|||
return g_texture_cache->LookupPaletteSource(CBP, CPSM, CBW, offset, scale, size);
|
||||
}
|
||||
|
||||
void GSRendererHW::SetGameCRC(u32 crc)
|
||||
{
|
||||
GSRenderer::SetGameCRC(crc);
|
||||
|
||||
GSTextureReplacements::GameChanged();
|
||||
}
|
||||
|
||||
bool GSRendererHW::CanUpscale()
|
||||
{
|
||||
return GSConfig.UpscaleMultiplier != 1.0f;
|
||||
|
|
|
@ -185,8 +185,7 @@ public:
|
|||
|
||||
void Destroy() override;
|
||||
|
||||
void SetGameCRC(u32 crc) override;
|
||||
void UpdateCRCHacks() override;
|
||||
void UpdateRenderFixes() override;
|
||||
|
||||
bool CanUpscale() override;
|
||||
float GetUpscaleMultiplier() override;
|
||||
|
|
|
@ -57,9 +57,6 @@ namespace MTGS
|
|||
}
|
||||
};
|
||||
|
||||
static bool TryOpenGS();
|
||||
static void CloseGS();
|
||||
|
||||
static void ThreadEntryPoint();
|
||||
static void MainLoop();
|
||||
|
||||
|
@ -176,7 +173,8 @@ void MTGS::ThreadEntryPoint()
|
|||
}
|
||||
|
||||
// try initializing.. this could fail
|
||||
const bool opened = TryOpenGS();
|
||||
std::memcpy(RingBuffer.Regs, PS2MEM_GS, sizeof(PS2MEM_GS));
|
||||
const bool opened = GSopen(EmuConfig.GS, EmuConfig.GS.Renderer, RingBuffer.Regs);
|
||||
s_open_flag.store(opened, std::memory_order_release);
|
||||
|
||||
// notify emu thread that we finished opening (or failed)
|
||||
|
@ -195,7 +193,7 @@ void MTGS::ThreadEntryPoint()
|
|||
// when we come back here, it's because we closed (or shutdown)
|
||||
// that means the emu thread should be blocked, waiting for us to be done
|
||||
pxAssertRel(!s_open_flag.load(std::memory_order_relaxed), "Open flag is clear on close");
|
||||
CloseGS();
|
||||
GSclose();
|
||||
s_open_or_close_done.Post();
|
||||
|
||||
// we need to reset sem_event here, because MainLoop() kills it.
|
||||
|
@ -313,17 +311,6 @@ union PacketTagType
|
|||
};
|
||||
};
|
||||
|
||||
bool MTGS::TryOpenGS()
|
||||
{
|
||||
std::memcpy(RingBuffer.Regs, PS2MEM_GS, sizeof(PS2MEM_GS));
|
||||
|
||||
if (!GSopen(EmuConfig.GS, EmuConfig.GS.Renderer, RingBuffer.Regs))
|
||||
return false;
|
||||
|
||||
GSSetGameCRC(VMManager::GetDiscCRC());
|
||||
return true;
|
||||
}
|
||||
|
||||
void MTGS::MainLoop()
|
||||
{
|
||||
// Threading info: run in MTGS thread
|
||||
|
@ -554,10 +541,6 @@ void MTGS::MainLoop()
|
|||
}
|
||||
break;
|
||||
|
||||
case Command::CRC:
|
||||
GSSetGameCRC(tag.data[0]);
|
||||
break;
|
||||
|
||||
case Command::InitAndReadFIFO:
|
||||
MTGS_LOG("(MTGS Packet Read) ringtype=Fifo2, size=%d", tag.data[0]);
|
||||
GSInitAndReadFIFO((u8*)tag.pointer, tag.data[0]);
|
||||
|
@ -623,11 +606,6 @@ void MTGS::MainLoop()
|
|||
s_sem_event.Kill();
|
||||
}
|
||||
|
||||
void MTGS::CloseGS()
|
||||
{
|
||||
GSclose();
|
||||
}
|
||||
|
||||
// Waits for the GS to empty out the entire ring buffer contents.
|
||||
// If syncRegs, then writes pcsx2's gs regs to MTGS's internal copy
|
||||
// If weakWait, then this function is allowed to exit after MTGS finished a path1 packet
|
||||
|
@ -894,11 +872,6 @@ void MTGS::SendPointerPacket(Command type, u32 data0, void* data1)
|
|||
_FinishSimplePacket();
|
||||
}
|
||||
|
||||
void MTGS::SendGameCRC(u32 crc)
|
||||
{
|
||||
SendSimplePacket(Command::CRC, crc, 0, 0);
|
||||
}
|
||||
|
||||
bool MTGS::WaitForOpen()
|
||||
{
|
||||
if (IsOpen())
|
||||
|
@ -956,6 +929,12 @@ void MTGS::RunOnGSThread(AsyncCallType func)
|
|||
SetEvent();
|
||||
}
|
||||
|
||||
void MTGS::GameChanged()
|
||||
{
|
||||
pxAssertRel(IsOpen(), "MTGS is running");
|
||||
RunOnGSThread(GSGameChanged);
|
||||
}
|
||||
|
||||
void MTGS::ApplySettings()
|
||||
{
|
||||
pxAssertRel(IsOpen(), "MTGS is running");
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace MTGS
|
|||
Freeze,
|
||||
Reset, // issues a GSreset() command.
|
||||
SoftReset, // issues a soft reset for the GIF
|
||||
CRC,
|
||||
GSPacket,
|
||||
MTVUGSPacket,
|
||||
InitAndReadFIFO,
|
||||
|
@ -71,7 +70,6 @@ namespace MTGS
|
|||
void WaitGS(bool syncRegs = true, bool weakWait = false, bool isMTVU = false);
|
||||
void ResetGS(bool hardware_reset);
|
||||
|
||||
void SendGameCRC(u32 crc);
|
||||
bool WaitForOpen();
|
||||
void WaitForClose();
|
||||
void Freeze(FreezeAction mode, FreezeData& data);
|
||||
|
@ -80,6 +78,7 @@ namespace MTGS
|
|||
void InitAndReadFIFO(u8* mem, u32 qwc);
|
||||
|
||||
void RunOnGSThread(AsyncCallType func);
|
||||
void GameChanged();
|
||||
void ApplySettings();
|
||||
void ResizeDisplayWindow(int width, int height, float scale);
|
||||
void UpdateDisplayWindow();
|
||||
|
|
|
@ -905,7 +905,7 @@ void VMManager::UpdateDiscDetails(bool booting)
|
|||
ReportGameChangeToHost();
|
||||
Achievements::GameChanged(s_disc_crc, s_current_crc);
|
||||
if (MTGS::IsOpen())
|
||||
MTGS::SendGameCRC(s_disc_crc);
|
||||
MTGS::GameChanged();
|
||||
ReloadPINE();
|
||||
UpdateDiscordPresence(Achievements::GetRichPresenceString());
|
||||
|
||||
|
|
|
@ -284,7 +284,6 @@
|
|||
<ClCompile Include="GS\GSBlock.cpp" />
|
||||
<ClCompile Include="GS\GSCapture.cpp" />
|
||||
<ClCompile Include="GS\GSClut.cpp" />
|
||||
<ClCompile Include="GS\GSCrc.cpp" />
|
||||
<ClCompile Include="GS\Renderers\Common\GSDevice.cpp" />
|
||||
<ClCompile Include="GS\Renderers\DX11\GSDevice11.cpp" />
|
||||
<ClCompile Include="GS\Renderers\OpenGL\GSDeviceOGL.cpp" />
|
||||
|
@ -626,7 +625,6 @@
|
|||
<ClInclude Include="GS\GSBlock.h" />
|
||||
<ClInclude Include="GS\GSCapture.h" />
|
||||
<ClInclude Include="GS\GSClut.h" />
|
||||
<ClInclude Include="GS\GSCrc.h" />
|
||||
<ClInclude Include="GS\Renderers\Common\GSDevice.h" />
|
||||
<ClInclude Include="GS\Renderers\DX11\GSDevice11.h" />
|
||||
<ClInclude Include="GS\Renderers\OpenGL\GSDeviceOGL.h" />
|
||||
|
|
|
@ -995,9 +995,6 @@
|
|||
<ClCompile Include="GS\GSClut.cpp">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GS\GSCrc.cpp">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GS\GSDump.cpp">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1915,9 +1912,6 @@
|
|||
<ClInclude Include="GS\GSClut.h">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GS\GSCrc.h">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GS\GSDump.h">
|
||||
<Filter>System\Ps2\GS</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue