Skip to content

Instantly share code, notes, and snippets.

@water111
Created August 26, 2019 19:56
Show Gist options
  • Save water111/e4a0af85968daad1ac478573ae07b48c to your computer and use it in GitHub Desktop.
Save water111/e4a0af85968daad1ac478573ae07b48c to your computer and use it in GitHub Desktop.
diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp
index b6fbba399..997627e75 100644
--- a/pcsx2/Counters.cpp
+++ b/pcsx2/Counters.cpp
@@ -205,7 +205,8 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, Fixed100 framesPerSecond, u32 s
// One test we have shows that VBlank lasts for ~22 HBlanks, another we have show that is the time it's off.
// There exists a game (Legendz Gekitou! Saga Battle) Which runs REALLY slowly if VBlank is ~22 HBlanks, so the other test wins.
- u64 Blank = HalfFrame / 2; // PAL VBlank Period is off for roughly 22 HSyncs
+ //u64 Blank = HalfFrame / 2; // PAL VBlank Period is off for roughly 22 HSyncs
+ u64 Blank = (Frame / scansPerFrame) * (gsVideoMode == GS_VideoMode::NTSC ? 26 : 22);
//I would have suspected this to be Frame - Blank, but that seems to completely freak it out
//and the test results are completely wrong. It seems 100% the same as the PS2 test on this,
@@ -488,14 +489,19 @@ static __fi void VSyncStart(u32 sCycle)
// Should no longer be required (Refraction)
}
+uint64_t fc = 0;
static __fi void VSyncEnd(u32 sCycle)
{
if(EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll)
SysTrace.EE.Counters.Write( " ================ EE COUNTER VSYNC END (frame: %d) ================", g_FrameCount );
g_FrameCount++;
-
-
+ fc++;
+
+ if (fc >= 400) {
+ memWrite8(0x0132630, 1);
+ memWrite8(0x0132530, 1);
+ }
hwIntcIrq(INTC_VBLANK_E); // HW Irq
psxVBlankEnd(); // psxCounters vBlank End
diff --git a/pcsx2/MemoryTypes.h b/pcsx2/MemoryTypes.h
index 9f1385306..346837a5d 100644
--- a/pcsx2/MemoryTypes.h
+++ b/pcsx2/MemoryTypes.h
@@ -17,7 +17,7 @@
namespace Ps2MemSize
{
- static const uint MainRam = _32mb; // 32 MB main memory!
+ static const uint MainRam = _32mb * 4; // 32 MB main memory!
static const uint Rom = _1mb * 4; // 4 MB main rom
static const uint Rom1 = 0x00040000; // DVD player
static const uint Rom2 = 0x00080000; // Chinese rom extension (?)
diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp
index 0c49a1c10..f4e779b6d 100644
--- a/pcsx2/R5900.cpp
+++ b/pcsx2/R5900.cpp
@@ -530,14 +530,40 @@ __fi void CPU_INT( EE_EventType n, s32 ecycle)
}
// Called from recompilers; __fastcall define is mandatory.
+extern uint64_t fc;
void __fastcall eeGameStarting()
{
if (!g_GameStarted)
{
+ fc = 0;
//Console.WriteLn( Color_Green, "(R5900) ELF Entry point! [addr=0x%08X]", ElfEntry );
g_GameStarted = true;
g_GameLoading = false;
GetCoreThread().GameStartingInThread();
+ if (memRead32(0x001002d8) == 0x03e00008) {
+ memWrite32(0x010028c, 0);
+ memWrite32(0x0100298, 0);
+ memWrite32(0x010b64c, 0);
+ }
+ else {
+ // at this point the main ELF is loaded, so we can patch it
+ memWrite32(0x100290, 0); // NOP out the code which disables DebugSegment
+ memWrite32(0x10029c, 0); // NOP out the code which disables MasterDebug
+
+ // NOP out the code which attempts to communicate over the network
+ if (memRead32(0x0010b770))
+ {
+ memWrite32(0x10b76c, 0);
+ }
+ else
+ {
+ memWrite32(0x10b654, 0);
+ }
+ }
+
+
+ // we are using a retail BIOS, which will not map the upper memory, so we must do it manually
+ vtlb_VMap(0x02000000, 0x02000000, 0x06000000);
// GameStartingInThread may issue a reset of the cpu and/or recompilers. Check for and
// handle such things here:
diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp
index 8d23213c5..5796b7cb2 100644
--- a/pcsx2/x86/ix86-32/iR5900-32.cpp
+++ b/pcsx2/x86/ix86-32/iR5900-32.cpp
@@ -519,7 +519,7 @@ static void recAlloc()
for (int i = 0; i < 0x10000; i++)
recLUT_SetPage(recLUT, 0, 0, 0, i, 0);
- for ( int i = 0x0000; i < 0x0200; i++ )
+ for ( int i = 0x0000; i < 0x0200 * 4; i++ )
{
recLUT_SetPage(recLUT, hwLUT, recRAM, 0x0000, i, i);
recLUT_SetPage(recLUT, hwLUT, recRAM, 0x2000, i, i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment