gs: remove old pre-mtgs cruft

This commit is contained in:
kojin 2021-10-20 18:10:09 -04:00 committed by lightningterror
parent 740b421ce8
commit 8095490d23
5 changed files with 9 additions and 158 deletions

View File

@ -58,7 +58,6 @@ extern bool RunLinuxDialog();
#undef None
static GSRenderer* s_gs = NULL;
static void (*s_irq)() = NULL;
static uint8* s_basemem = NULL;
static int s_vsync = 0;
static bool s_exclusive = true;
@ -147,7 +146,7 @@ void GSclose()
int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads = -1)
{
GSDevice* dev = NULL;
bool old_api = *dsp == NULL;
ASSERT(dsp != nullptr);
// Fresh start up or config file changed
if (renderer == GSRendererType::Undefined)
@ -234,22 +233,8 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads
{
try
{
if (old_api)
{
// old-style API expects us to create and manage our own window:
wnd->Create(title, w, h);
wnd->Show();
*dsp = wnd->GetDisplay();
}
else
{
wnd->Attach(win_handle, false);
}
wnd->Attach(win_handle, false);
window = wnd; // Previous code will throw if window isn't supported
break;
}
catch (GSRecoverableError)
@ -335,12 +320,8 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads
}
s_gs->SetRegsMem(s_basemem);
s_gs->SetIrqCallback(s_irq);
s_gs->SetVSync(s_vsync);
if (!old_api)
s_gs->SetMultithreaded(true);
if (!s_gs->CreateDevice(dev))
{
// This probably means the user has DX11 configured with a video card that is only DX9
@ -424,40 +405,6 @@ int GSopen2(void** dsp, uint32 flags)
return retval;
}
int GSopen(void** dsp, const char* title, int mt)
{
GSRendererType renderer = GSRendererType::Default;
// Legacy GUI expects to acquire vsync from the configuration files.
s_vsync = theApp.GetConfigI("vsync");
if (mt == 2)
{
// pcsx2 sent a switch renderer request
mt = 1;
}
else
{
// normal init
renderer = static_cast<GSRendererType>(theApp.GetConfigI("Renderer"));
}
*dsp = NULL;
int retval = _GSopen(dsp, title, renderer);
if (retval == 0 && s_gs)
{
s_gs->SetMultithreaded(!!mt);
}
gsopen_done = true;
return retval;
}
void GSreset()
{
try
@ -753,16 +700,6 @@ int GStest()
return 0;
}
void GSirqCallback(void (*irq)())
{
s_irq = irq;
if (s_gs)
{
s_gs->SetIrqCallback(s_irq);
}
}
void pt(const char* str)
{
struct tm* current;

View File

@ -1780,7 +1780,6 @@ int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads)
void GSosdLog(const char* utf8, uint32 color);
void GSosdMonitor(const char* key, const char* value, uint32 color);
int GSopen2(void** dsp, uint32 flags);
int GSopen(void** dsp, const char* title, int mt);
void GSreset();
void GSgifSoftReset(uint32 mask);
void GSwriteCSR(uint32 csr);
@ -1798,7 +1797,6 @@ void GSkeyEvent(const HostKeyEvent& e);
int GSfreeze(FreezeAction mode, freezeData* data);
void GSconfigure();
int GStest();
void GSirqCallback(void (*irq)());
bool GSsetupRecording(std::string& filename);
void GSendRecording();
void GSsetGameCRC(uint32 crc, int options);

View File

@ -24,8 +24,6 @@ int GSState::s_n = 0;
GSState::GSState()
: m_version(6)
, m_mt(false)
, m_irq(NULL)
, m_path3hack(0)
, m_gsc(NULL)
, m_skip(0)
@ -160,34 +158,6 @@ void GSState::SetRegsMem(uint8* basemem)
m_regs = (GSPrivRegSet*)basemem;
}
void GSState::SetIrqCallback(void (*irq)())
{
m_irq = irq;
}
void GSState::SetMultithreaded(bool mt)
{
// Some older versions of PCSX2 didn't properly set the irq callback to NULL
// in multithreaded mode (possibly because ZeroGS itself would assert in such
// cases), and didn't bind them to a dummy callback either. PCSX2 handles all
// IRQs internally when multithreaded anyway -- so let's ignore them here:
m_mt = mt;
if (mt)
{
m_fpGIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GSState::GIFRegHandlerNull;
m_fpGIFRegHandlers[GIF_A_D_REG_FINISH] = &GSState::GIFRegHandlerNull;
m_fpGIFRegHandlers[GIF_A_D_REG_LABEL] = &GSState::GIFRegHandlerNull;
}
else
{
m_fpGIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GSState::GIFRegHandlerSIGNAL;
m_fpGIFRegHandlers[GIF_A_D_REG_FINISH] = &GSState::GIFRegHandlerFINISH;
m_fpGIFRegHandlers[GIF_A_D_REG_LABEL] = &GSState::GIFRegHandlerLABEL;
}
}
void GSState::SetFrameSkip(int skip)
{
if (m_frameskip == skip)
@ -359,7 +329,9 @@ void GSState::ResetHandlers()
m_fpGIFRegHandlers[GIF_A_D_REG_TRXDIR] = &GSState::GIFRegHandlerTRXDIR;
m_fpGIFRegHandlers[GIF_A_D_REG_HWREG] = &GSState::GIFRegHandlerHWREG;
SetMultithreaded(m_mt);
m_fpGIFRegHandlers[GIF_A_D_REG_SIGNAL] = &GSState::GIFRegHandlerNull;
m_fpGIFRegHandlers[GIF_A_D_REG_FINISH] = &GSState::GIFRegHandlerNull;
m_fpGIFRegHandlers[GIF_A_D_REG_LABEL] = &GSState::GIFRegHandlerNull;
}
bool GSState::isinterlaced()
@ -1388,37 +1360,6 @@ void GSState::GIFRegHandlerHWREG(const GIFReg* RESTRICT r)
Write(reinterpret_cast<const uint8*>(r), 8); // haunting ground
}
void GSState::GIFRegHandlerSIGNAL(const GIFReg* RESTRICT r)
{
GL_REG("SIGNAL = 0x%x_%x", r->u32[1], r->u32[0]);
m_regs->SIGLBLID.SIGID = (m_regs->SIGLBLID.SIGID & ~r->SIGNAL.IDMSK) | (r->SIGNAL.ID & r->SIGNAL.IDMSK);
if (m_regs->CSR.wSIGNAL)
m_regs->CSR.rSIGNAL = 1;
if (!m_regs->IMR.SIGMSK && m_irq)
m_irq();
}
void GSState::GIFRegHandlerFINISH(const GIFReg* RESTRICT r)
{
GL_REG("FINISH = 0x%x_%x", r->u32[1], r->u32[0]);
if (m_regs->CSR.wFINISH)
m_regs->CSR.rFINISH = 1;
if (!m_regs->IMR.FINISHMSK && m_irq)
m_irq();
}
void GSState::GIFRegHandlerLABEL(const GIFReg* RESTRICT r)
{
GL_REG("LABEL = 0x%x_%x", r->u32[1], r->u32[0]);
m_regs->SIGLBLID.LBLID = (m_regs->SIGLBLID.LBLID & ~r->LABEL.IDMSK) | (r->LABEL.ID & r->LABEL.IDMSK);
}
void GSState::Flush()
{
FlushWrite();
@ -2112,21 +2053,11 @@ void GSState::Transfer(const uint8* mem, uint32 size)
{
if (size == 0 && path.nloop > 0)
{
if (m_mt)
{
// Hackfix for BIOS, which sends an incomplete packet when it does an XGKICK without
// having an EOP specified anywhere in VU1 memory. Needed until PCSX2 is fixed to
// handle it more properly (ie, without looping infinitely).
// Hackfix for BIOS, which sends an incomplete packet when it does an XGKICK without
// having an EOP specified anywhere in VU1 memory. Needed until PCSX2 is fixed to
// handle it more properly (ie, without looping infinitely).
path.nloop = 0;
}
else
{
// Unused in 0.9.7 and above, but might as well keep this for now; allows GS
// to work with legacy editions of PCSX2.
Transfer<0>(mem - 0x4000, 0x4000 / 16);
}
path.nloop = 0;
}
}
}

View File

@ -119,15 +119,9 @@ class GSState : public GSAlignedClass<32>
void GIFRegHandlerTRXREG(const GIFReg* RESTRICT r);
void GIFRegHandlerTRXDIR(const GIFReg* RESTRICT r);
void GIFRegHandlerHWREG(const GIFReg* RESTRICT r);
void GIFRegHandlerSIGNAL(const GIFReg* RESTRICT r);
void GIFRegHandlerFINISH(const GIFReg* RESTRICT r);
void GIFRegHandlerLABEL(const GIFReg* RESTRICT r);
int m_version;
int m_sssize;
bool m_mt;
void (*m_irq)();
bool m_path3hack;
struct GSTransferBuffer
@ -274,6 +268,4 @@ public:
virtual void SetGameCRC(uint32 crc, int options);
void SetFrameSkip(int skip);
void SetRegsMem(uint8* basemem);
void SetIrqCallback(void (*irq)());
void SetMultithreaded(bool mt = true);
};

View File

@ -226,12 +226,6 @@ union PacketTagType
};
};
static void dummyIrqCallback()
{
// dummy, because MTGS doesn't need this mess!
// (and zerogs does >_<)
}
void SysMtgsThread::OpenGS()
{
if (m_Opened)
@ -242,7 +236,6 @@ void SysMtgsThread::OpenGS()
memcpy(RingBuffer.Regs, PS2MEM_GS, sizeof(PS2MEM_GS));
GSsetBaseMem(RingBuffer.Regs);
GSirqCallback(dummyIrqCallback);
pxAssertMsg((GSopen2((void**)pDsp, 1 | (renderswitch ? 4 : 0)) == 0), "GS failed to open!");