From 019e4d85245387b8dbffc5c6decad2f27a024c8e Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sun, 12 Aug 2012 15:28:08 +0000 Subject: [PATCH] 576p support --- src/computer.c | 1 + src/computer.h | 1 + src/emulator.c | 34 ++++++++++++++++++++++++++++++++++ src/emulator.h | 1 + src/gui_sdl.c | 24 ++++++++++++++++++------ 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/computer.c b/src/computer.c index 3019021..261784a 100644 --- a/src/computer.c +++ b/src/computer.c @@ -171,6 +171,7 @@ void computer_init () { //Called only on start-up ordenador.fetch_state =0; ordenador.last_selected_poke_file[0]='\0'; ordenador.npixels=4; + ordenador.progressive=0; } void computer_set_palete() { diff --git a/src/computer.h b/src/computer.h index 5a9e076..cbbd095 100644 --- a/src/computer.h +++ b/src/computer.h @@ -38,6 +38,7 @@ struct computer { unsigned char precision; //If set 1 emulate with more precision unsigned char npixels; //1, 2 or 4 depending on dblscan and zaurus_mini + unsigned char progressive; //interlace or progressive 576 unsigned int temporal_io; // screen private global variables diff --git a/src/emulator.c b/src/emulator.c index e065754..8235794 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include #endif #ifdef DEBUG @@ -352,6 +354,38 @@ void load_rom(char type) { size=fread(ordenador.shadowrom,8192,1,fichero); fclose(fichero); } + +int set_video_mode() +{ +#ifdef GEKKO + GXRModeObj *rmode; + + rmode = VIDEO_GetPreferredMode(NULL); + + if ((rmode->viTVMode)!=VI_TVMODE_PAL_INT) return -1; + + switch(ordenador.progressive) + { + case 0: //interlace + rmode=&TVPal576IntDfScale; + break; + case 1: //progressive + rmode=&TVPal576ProgScale; + break; + default: + rmode=&TVPal576IntDfScale; + break; + } + VIDEO_Configure(rmode); + VIDEO_Flush(); + VIDEO_WaitVSync(); + + return 0; + + + #endif +} + void init_sdl() { int retorno, bucle; diff --git a/src/emulator.h b/src/emulator.h index d363888..39e2346 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -51,5 +51,6 @@ FILE *myfopen(char *filename,char *mode); void init_sdl(); void init_sound(); void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hwsurface); +int set_video_mode(); #endif diff --git a/src/gui_sdl.c b/src/gui_sdl.c index 93184ef..48492cf 100644 --- a/src/gui_sdl.c +++ b/src/gui_sdl.c @@ -101,8 +101,11 @@ static const char *screen_messages[] = { /*03*/ "TV mode", /*04*/ "^|Color|B&W", /*05*/ " ", - /*06*/ "Resolution", - /*07*/ "^|640X480|320X240", + /*06*/ "Buffer resolution", + /*07*/ "^|640X480|320X240", + /*08*/ " ", + /*09*/ "576p video mode", + /*10*/ "^|on|off", NULL }; @@ -409,7 +412,6 @@ static void manage_tape(int which) case 5: //Create // Create tape create_tapfile_sdl(); - //msgInfo("Not yet implemented",3000,NULL); break; case 6: //Delete delete_tape(); @@ -541,7 +543,7 @@ static void save_load_general_configurations(int); static void screen_settings(void) { - unsigned int submenus[3],submenus_old[3]; + unsigned int submenus[4],submenus_old[4]; int opt, i; memset(submenus, 0, sizeof(submenus)); @@ -549,8 +551,9 @@ static void screen_settings(void) submenus[0] = !ordenador.dblscan; submenus[1] = ordenador.bw; submenus[2] = ordenador.zaurus_mini?1:0; + submenus[3] = !ordenador.progressive; - for (i=0; i<3; i++) submenus_old[i] = submenus[i]; + for (i=0; i<4; i++) submenus_old[i] = submenus[i]; opt = menu_select_title("Screen settings menu", @@ -560,6 +563,7 @@ static void screen_settings(void) ordenador.dblscan = !submenus[0]; ordenador.bw = submenus[1]; + ordenador.progressive = !submenus[3]; if (submenus[0] != submenus_old[0]) update_npixels(); @@ -571,7 +575,15 @@ static void screen_settings(void) else {ordenador.zaurus_mini = 3; ordenador.text_mini=1;} update_npixels(); restart_video(); - } + } + if (submenus[3] != submenus_old[3]) + { + if (set_video_mode()) + { + msgInfo("Only avalaible from 576i PAL",3000,NULL); + ordenador.progressive = 0; + } + } } static void setup_joystick(int joy, unsigned int sdl_key, int joy_key)