refresh rate: more settings, detect tv-out
authornotaz <notasas@gmail.com>
Tue, 26 Jun 2007 20:49:30 +0000 (20:49 +0000)
committernotaz <notasas@gmail.com>
Tue, 26 Jun 2007 20:49:30 +0000 (20:49 +0000)
git-svn-id: file:///home/notaz/opt/svn/fceu@173 be3aeb3a-fb24-0410-a615-afba39da0efa

drivers/gp2x/cpuctrl.c
drivers/gp2x/cpuctrl.h

index b2cc395..9940fd5 100644 (file)
@@ -185,14 +185,45 @@ static reg_setting rate_100_02[] =
        { 0, 0, 0 }
 };
 
+// 120.00 97/0/2/7|25/ 7/ 7/11/37
+static reg_setting rate_120[] =
+{
+       { 0x0914, 0xffff, (97<<8)|(0<<2)|2 },   /* UPLLSETVREG */
+       { 0x0924, 0xff00, (2<<14)|(7<<8) },     /* DISPCSETREG */
+       { 0x281A, 0x00ff, 25 },                 /* .HSWID(T2) */
+       { 0x281C, 0x00ff, 7 },                  /* .HSSTR(T8) */
+       { 0x281E, 0x00ff, 7 },                  /* .HSEND(T7) */
+       { 0x2822, 0x01ff, 11 },                 /* .VSEND (T9) */
+       { 0x2826, 0x0ff0, 37<<4 },              /* .DESTR(T3) */
+       { 0, 0, 0 }
+};
+
+// 100.00 96/0/2/7|29/25/53/15/37
+static reg_setting rate_100[] =
+{
+       { 0x0914, 0xffff, (96<<8)|(0<<2)|2 },   /* UPLLSETVREG */
+       { 0x0924, 0xff00, (2<<14)|(7<<8) },     /* DISPCSETREG */
+       { 0x281A, 0x00ff, 29 },                 /* .HSWID(T2) */
+       { 0x281C, 0x00ff, 25 },                 /* .HSSTR(T8) */
+       { 0x281E, 0x00ff, 53 },                 /* .HSEND(T7) */
+       { 0x2822, 0x01ff, 15 },                 /* .VSEND (T9) */
+       { 0x2826, 0x0ff0, 37<<4 },              /* .DESTR(T3) */
+       { 0, 0, 0 }
+};
 
 
-static reg_setting *possible_rates[] = { rate_almost60, rate_50, rate_120_20, rate_100_02 };
+
+static reg_setting *possible_rates[] = { rate_almost60, rate_50, rate_120_20, rate_100_02, rate_120, rate_100 };
 
 void set_LCD_custom_rate(lcd_rate_t rate)
 {
        reg_setting *set;
 
+       if (MEM_REG[0x2800>>1] & 0x100) // tv-out
+       {
+               return;
+       }
+
        printf("setting custom LCD refresh, mode=%i... ", rate); fflush(stdout);
        for (set = possible_rates[rate]; set->reg; set++)
        {
index d537f4e..d94d60b 100644 (file)
@@ -19,6 +19,8 @@ typedef enum
        LCDR_50,        /* 50Hz, has interlacing problems */
        LCDR_120_20,    /* ~60.10*2Hz, used by FCE Ultra */
        LCDR_100_02,    /* ~50.01*2Hz, used by FCE Ultra */
+       LCDR_120,       /* 120Hz */
+       LCDR_100,       /* 100Hz */
 } lcd_rate_t;
 
 extern void set_LCD_custom_rate(lcd_rate_t rate);