[PS2] Fix for debug library for proper video mode selection

Create a single thread for each patch to be added to the repository. Please try to stay on topic.
Post Reply
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

[PS2] Fix for debug library for proper video mode selection

Post by cosmito »

This fixes debug lib for proper PAL/NTSC screen mode initialization. It's just what gsKit currently uses that works equally well at PS2 fat and slim models.

Code: Select all

Index: src/scr_printf.c
===================================================================
--- src/scr_printf.c	(revision 1664)
+++ src/scr_printf.c	(working copy)
@@ -66,6 +66,19 @@
 /* charmap must be 16 byte aligned.  */
 static u32	charmap[64] __attribute__ (( aligned (16) ));
 
+// from gsKit
+static int debug_detect_signal()
+{
+	char romname[14];
+	GetRomName((char *)romname);
+	if (romname[4] == 'E') {
+		return 1;
+	}
+	else {
+		return 0;
+	}
+}
+
 static void Init_GS( int a, int b, int c)
 {
    u64	*mem = (u64 *)0x12001000;
@@ -187,9 +200,15 @@
    X = Y = 0;
    EI();
    DmaReset();
-/// EEUG: note that access to 0x1FC7FF52 causes
-///       crash on SCPH-77004. Probably this code must be revised
-   Init_GS( 0, ((*((char*)0x1FC7FF52))=='E')+2, 1);
+///// EEUG: note that access to 0x1FC7FF52 causes
+/////       crash on SCPH-77004. Probably this code must be revised
+//   Init_GS( 0, ((*((char*)0x1FC7FF52))=='E')+2, 1);
+      
+   if (debug_detect_signal() == 1)
+       Init_GS( 0, 3, 1);
+   else
+       Init_GS( 0, 2, 1);
+
    SetVideoMode();
    Dma02Wait();
    progdma( &setupscr, 15);
Post Reply