16 { 652, 26, 2560, 224, 0x02 },
17 { 680, 37, 2560, 256, 0x03 },
18 { 232, 35, 1440, 480, 0x50 },
19 { 320, 64, 1312, 576, 0x53 },
20 { 420, 40, 1280, 720, 0x52 },
21 { 300, 120, 1920, 540, 0x51 },
22 { 280, 18, 1280, 480, 0x1A },
23 { 330, 18, 1280, 480, 0x1B },
24 { 360, 18, 1280, 480, 0x1C },
25 { 260, 18, 1280, 480, 0x1D },
26 { 450, 25, 1600, 600, 0x2A },
27 { 465, 25, 1600, 600, 0x2B },
28 { 465, 25, 1600, 600, 0x2C },
29 { 510, 25, 1600, 600, 0x2D },
30 { 500, 25, 1600, 600, 0x2E },
31 { 580, 30, 2048, 768, 0x3B },
32 { 266, 30, 1024, 768, 0x3C },
33 { 260, 30, 1024, 768, 0x3D },
34 { 290, 30, 1024, 768, 0x3E },
35 { 350, 40, 1280, 1024, 0x4A },
36 { 350, 40, 1280, 1024, 0x4B },
40static float graph_width = 0.0f;
41static float graph_height = 0.0f;
42static float graph_aspect = 1.0f;
44static int graph_filter = 0;
45static int graph_crtmode = 0;
46static int graph_interlace = 0;
47static int graph_ffmd = 0;
48static int graph_x = 0;
49static int graph_y = 0;
50static int graph_magh = 0;
51static int graph_magv = 0;
53static u64 graph_pmode = 0;
56u64 smode1_values[22] =
60 GS_SET_SMODE1(4,32,1,0,2,0,1,1,0,0,4,0,0,0,0,0,1,1,1,1,0),
61 GS_SET_SMODE1(4,32,1,0,3,0,1,1,0,0,4,0,0,0,0,0,1,1,1,1,0),
62 GS_SET_SMODE1(4,32,1,0,0,0,1,1,0,0,2,0,0,0,0,0,1,1,1,1,1),
63 GS_SET_SMODE1(4,32,1,0,0,0,1,1,0,1,2,0,0,0,0,0,1,1,1,1,1),
64 GS_SET_SMODE1(2,22,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
65 GS_SET_SMODE1(2,22,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,0),
66 GS_SET_SMODE1(2,15,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
67 GS_SET_SMODE1(3,28,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
68 GS_SET_SMODE1(3,28,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
69 GS_SET_SMODE1(3,16,0,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
70 GS_SET_SMODE1(3,16,0,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
71 GS_SET_SMODE1(6,71,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
72 GS_SET_SMODE1(5,74,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
73 GS_SET_SMODE1(3,44,1,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
74 GS_SET_SMODE1(3,25,0,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
75 GS_SET_SMODE1(3,29,0,0,0,0,0,1,0,0,2,0,0,0,0,0,1,1,1,0,1),
76 GS_SET_SMODE1(6,67,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
77 GS_SET_SMODE1(3,35,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
78 GS_SET_SMODE1(1, 7,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
79 GS_SET_SMODE1(1, 8,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
80 GS_SET_SMODE1(1,10,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,0,1),
84static inline int __udelay(
unsigned int usecs)
87 register unsigned int loops_total = 0;
88 register unsigned int loops_end = usecs * 148;
90 if (usecs > loops_end)
108 :
"0" (loops_total),
"r" (loops_end));
121 if (romname[4] ==
'E')
138 *
GS_REG_CSR = GS_SET_CSR(0,0,0,0,0,0,0,0,0,0,0,0);
141 GsPutIMR(0x00007700);
144 asm volatile (
"sync.p\n\t"
162 interlace = GRAPH_MODE_INTERLACED;
166 if (interlace == GRAPH_MODE_NONINTERLACED)
174 graph_crtmode = mode;
175 graph_interlace = interlace;
177 graph_filter = flicker_filter;
180 SetGsCrt(graph_interlace, graph_mode[mode].mode, graph_ffmd);
194 graph_width = (float)width;
195 graph_height = (float)height;
206 dx = graph_mode[graph_crtmode].x + graph_x;
209 dy = graph_mode[graph_crtmode].y;
212 dw = graph_mode[graph_crtmode].width;
213 dh = graph_mode[graph_crtmode].height;
217 if ((graph_interlace) && (graph_ffmd == GRAPH_MODE_FIELD))
221 dh = graph_mode[graph_crtmode].height * 2;
229 graph_magh = dw / width;
230 graph_magv = dh / height;
252 *
GS_REG_DISPLAY1 = GS_SET_DISPLAY(dx,dy,graph_magh-1,graph_magv-1,dw-1,height-1);
253 *
GS_REG_DISPLAY2 = GS_SET_DISPLAY(dx,dy,graph_magh-1,graph_magv-1,dw-1,height-2);
259 *
GS_REG_DISPLAY1 = GS_SET_DISPLAY(dx,dy,graph_magh-1,graph_magv-1,dw-1,height-1);
260 *
GS_REG_DISPLAY2 = GS_SET_DISPLAY(dx,dy,graph_magh-1,graph_magv-1,dw-1,height-1);
304void graph_set_output(
int rc1,
int rc2,
int alpha_select,
int alpha_output,
int blend_method,
unsigned char alpha)
307 graph_pmode = GS_SET_PMODE(rc1, rc2, alpha_select, alpha_output, blend_method, alpha);
340void graph_set_smode1(
char cmod,
char gcont)
347 pmode_val = graph_pmode;
348 smode1_val = smode1_values[graph_crtmode];
358 if ((graph_crtmode < 0x04) || (graph_crtmode > 0x50))
361 smode1_val |= (u64)(gcont & 1) << 25;
366 if ((graph_crtmode < 0x04) && (cmod > 0x01) && (cmod < 0x04))
369 smode1_val |= (u64)(cmod & 3) << 13;
379 asm volatile (
"sync.l; sync.p;");
382 if ((graph_crtmode >= 0x1A) && (graph_crtmode != 0x50) && (graph_crtmode != 0x53))
391 *
GS_REG_SMODE1 = smode1_val & ~((u64)1 << 16) & ~((u64)1 << 17);
396 asm volatile (
"sync.l; sync.p;");
407 graph_aspect = 1.78f;
413 graph_aspect = 1.33f;
418 graph_aspect = graph_aspect * (graph_height / graph_width);
427 return graph_make_config(graph_crtmode, graph_interlace, graph_ffmd, graph_x, graph_y, graph_filter, config);
440 *
GS_REG_CSR = GS_SET_CSR(0,0,0,0,0,0,0,0,0,0,0,0);
int graph_set_screen(int x, int y, int width, int height)
void graph_set_bgcolor(unsigned char r, unsigned char g, unsigned char b)
void graph_set_output(int rc1, int rc2, int alpha_select, int alpha_output, int blend_method, unsigned char alpha)
#define GRAPH_MODE_HDTV_576P
#define GRAPH_MODE_HDTV_1080I
void graph_enable_output(void)
void graph_set_framebuffer_filtered(int fbp, int width, int psm, int x, int y)
int graph_get_region(void)
void graph_disable_output(void)
float graph_aspect_ratio(void)
int graph_set_mode(int interlace, int mode, int ffmd, int flicker_filter)
void graph_set_framebuffer(int context, int fbp, int width, int psm, int x, int y)
int graph_get_config(char *config)
int graph_make_config(int mode, int interlace, int ffmd, int x, int y, int flicker_filter, char *config)
int configGetTvScreenType(void)
char * GetRomName(char *romname)