Added 320X240 resolution, fixed menu_init and added menu_denit

This commit is contained in:
fabio.olimpieri 2014-02-09 10:54:47 +00:00
parent a00f4ef0b4
commit 5650524f40
6 changed files with 1289 additions and 1197 deletions

View File

@ -47,6 +47,10 @@
#include "hotkeys.h"
#include "sdlgfx.h"
#ifdef USE_SDL
#include "guidep/menu.h"
#endif
/* Uncomment for debugging output */
//#define DEBUG
#ifdef DEBUG
@ -57,8 +61,6 @@
static SDL_Surface *display;
static SDL_Surface *screen;
extern void menu_init(SDL_Surface *screen);
/* Standard P96 screen modes */
#define MAX_SCREEN_MODES 12
@ -943,7 +945,9 @@ static int graphics_subinit (void)
gui_message ("Unable to set video mode: %s\n", SDL_GetError ());
return 0;
} else {
menu_init(screen);
#ifdef USE_SDL
menu_init(screen); //GEKKO
#endif
/* Just in case we didn't get exactly what we asked for . . . */
fullscreen = ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
is_hwsurface = ((screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE);
@ -1140,6 +1144,9 @@ void graphics_leave (void)
graphics_subshutdown ();
SDL_QuitSubSystem(SDL_INIT_VIDEO);
dumpcustom ();
#ifdef USE_SDL
menu_deinit(); //GEKKO
#endif
}
void graphics_notify_state (int state)
@ -1404,6 +1411,10 @@ int check_prefs_changed_gfx (void)
currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen;
#ifdef GEKKO
currprefs.gfx_correct_ratio = changed_prefs.gfx_correct_ratio;
current_width = currprefs.gfx_width_win;
current_height = currprefs.gfx_height_win;
gfxvidinfo.width = current_width;
gfxvidinfo.height = current_height;
#endif
#ifdef PICASSO96

View File

@ -104,6 +104,12 @@ void VirtualKeyboard_init(SDL_Surface *screen)
kbd_is_active=0;
}
void VirtualKeyboard_fini(void)
{
SDL_FreeSurface (image_kbd);
vkb_is_init = -1;
kbd_is_active = 0;
}
void draw_vk()
{
@ -199,6 +205,8 @@ struct virtkey* virtkbd_get_key()
{
virtkey_t *key;
if (FULL_DISPLAY_X != 640) {msgInfo("Virtual Keyboard only with 640X480 res",4000,NULL);return NULL;}
if (vkb_is_init != 1) return NULL;
pause_sound();

View File

@ -30,7 +30,8 @@ typedef struct Virtual_Keyboard
} VirtualKeyboard_struct;
extern void VirtualKeyboard_init(SDL_Surface *surf);
void VirtualKeyboard_init(SDL_Surface *surf);
void VirtualKeyboard_fini(void);
extern struct virtkey *virtkbd_get_key(void);
extern void flip_VKB();
void flip_VKB();
extern int kbd_is_active;

View File

@ -179,14 +179,16 @@ static const char *other_messages[] = {
/*03*/ "^| 0 | 1 | 2 | 3 | 4 ",
/*04*/ "Correct aspect ratio",
/*05*/ "^|off|100%|95%|93%|90%|custom",
/*06*/ "Scanlines",
/*07*/ "^|on|off",
/*08*/ "Leds",
/*06*/ "Resolution",
/*07*/ "^|320X240|640X480",
/*08*/ "Scanlines",
/*09*/ "^|on|off",
/*10*/ "Port",
/*11*/ "^|DEFAULT|SD|USB|SMB",
/*12*/ "Rumble",
/*13*/ "^|on|off",
/*10*/ "Leds",
/*11*/ "^|on|off",
/*12*/ "Port",
/*13*/ "^|DEFAULT|SD|USB|SMB",
/*14*/ "Rumble",
/*15*/ "^|on|off",
NULL
};
@ -802,7 +804,7 @@ void make_hardfile(void)
if (file_exists(hdf_path))
{
if (msgYesNo("Overwrite the existing file?", 0, FULL_DISPLAY_X /2-180, FULL_DISPLAY_Y /2-48))
if (msgYesNo("Overwrite the existing file?", 0, FULL_DISPLAY_X /2-180/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
unlink (hdf_path); else return;
}
@ -821,7 +823,7 @@ void delete_hardfile(void)
char dir[255];
strncpy(dir,prefs_get_attr("hardfile_path"),255);
name = (char *) menu_select_file(dir, NULL, 0);
if (name && msgYesNo("Are you sure to delete the hardfile?", 0, FULL_DISPLAY_X /2-200, FULL_DISPLAY_Y /2-48))
if (name && msgYesNo("Are you sure to delete the hardfile?", 0, FULL_DISPLAY_X /2-200/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
{unlink (name); msgInfo("Hardfile deleted",3000,NULL);}
}
@ -1216,10 +1218,28 @@ static void audio_options(void)
fix_options_menu_sdl(1);
}
static void set_gfx_resolution (int res)
{
if (res) //640X480
{
changed_prefs.gfx_width_win = 640;
changed_prefs.gfx_height_win = 480;
changed_prefs.gfx_lores = 0;
changed_prefs.gfx_linedbl = 1;
}
else //320X240
{
changed_prefs.gfx_width_win = 320;
changed_prefs.gfx_height_win = 240;
changed_prefs.gfx_lores = 1;
changed_prefs.gfx_linedbl = 0;
}
}
static void other_options(void)
{
int submenus[7];
int opt, floppy_n;
int submenus[8];
int opt, floppy_n, old_sub_3;
memset(submenus, 0, sizeof(submenus));
@ -1228,10 +1248,11 @@ static void other_options(void)
submenus[0] = get_floppy_speed();
submenus[1] = floppy_n;
submenus[2] = get_gfx_aspect_ratio();
submenus[3] = !(changed_prefs.gfx_linedbl == 2) ;
submenus[4] = !changed_prefs.leds_on_screen;
submenus[5] = changed_prefs.Port;
submenus[6] = !changed_prefs.rumble;
submenus[3] = old_sub_3 = (changed_prefs.gfx_width_win == 640) ;
submenus[4] = !(changed_prefs.gfx_linedbl == 2) ;
submenus[5] = !changed_prefs.leds_on_screen;
submenus[6] = changed_prefs.Port;
submenus[7] = !changed_prefs.rumble;
opt = menu_select_title("Other options menu",
other_messages, submenus);
@ -1241,10 +1262,11 @@ static void other_options(void)
set_floppy_speed(submenus[0]);
set_floppy_number(submenus[1]);
set_gfx_aspect_ratio(submenus[2]);
changed_prefs.gfx_linedbl = submenus[3] ? 1 : 2;
changed_prefs.leds_on_screen = !submenus[4];
set_Port(submenus[5]);
changed_prefs.rumble = !submenus[6];
if (old_sub_3 != submenus[3]) set_gfx_resolution(submenus[3]);
if (changed_prefs.gfx_width_win == 640) changed_prefs.gfx_linedbl = submenus[4] ? 1 : 2;
changed_prefs.leds_on_screen = !submenus[5];
set_Port(submenus[6]);
changed_prefs.rumble = !submenus[7];
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
currprefs.rumble = changed_prefs.rumble;
@ -1737,7 +1759,7 @@ void gui_display(int shortcut)
uae_reset(1);
break;
case 15:
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138, FULL_DISPLAY_Y /2-48))
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
{currprefs.rumble=0; uae_quit();}
break;
default:

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,12 @@ extern "C" {
#define KEY_PAGEDOWN 64
#define KEY_PAGEUP 128
#define KEY_HELP 256
#define FULL_DISPLAY_X 640
#define FULL_DISPLAY_Y 480
#define MAX_DEVICE_ITEM 32
extern int FULL_DISPLAY_X; //640
extern int FULL_DISPLAY_Y; //480
extern int RATIO;
void menu_print_font(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg, int font_size);
void menu_print_font_alt(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg);
@ -46,13 +48,15 @@ const char *menu_select_file_start(const char *dir_path, const char **d64_name);
uint32_t menu_wait_key_press(void);
extern void msgKill(SDL_Rect *rc);
extern int msgInfo(char *text, int duration, SDL_Rect *rc);
void msgKill(SDL_Rect *rc);
int msgInfo(char *text, int duration, SDL_Rect *rc);
extern int msgYesNo(char *text, int def,int x, int y);
int msgYesNo(char *text, int def,int x, int y);
void menu_init(SDL_Surface *screen);
void menu_deinit(void);
int menu_is_inited(void);
int ext_matches(const char *name, const char *ext);