Handle long filenames

This commit is contained in:
simon.kagstrom 2009-01-07 17:35:40 +00:00
parent ee755f540e
commit c2787689a4
3 changed files with 18 additions and 8 deletions

7
CHANGES.WII Normal file
View File

@ -0,0 +1,7 @@
version 2:
* Handle very long filenames better (thanks Corey89 for pointing this out)
* Better Makefile
* More keycodes added (C=)
version 1:
* Initial release

View File

@ -78,7 +78,7 @@ void C64::c64_ctor1(void)
this->fake_key_keytime = 5; this->fake_key_keytime = 5;
this->fake_key_type = 0; this->fake_key_type = 0;
MENU_SIZE_X = FULL_DISPLAY_X; MENU_SIZE_X = FULL_DISPLAY_X - FULL_DISPLAY_X / 4;
MENU_SIZE_Y = FULL_DISPLAY_Y - FULL_DISPLAY_Y / 4; MENU_SIZE_Y = FULL_DISPLAY_Y - FULL_DISPLAY_Y / 4;
SDL_RWops *rw; SDL_RWops *rw;
@ -103,7 +103,7 @@ void C64::c64_ctor1(void)
exit(1); exit(1);
} }
menu_init(&this->main_menu, this->menu_font, main_menu_messages, menu_init(&this->main_menu, this->menu_font, main_menu_messages,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
} }
void C64::c64_ctor2(void) void C64::c64_ctor2(void)
@ -178,7 +178,7 @@ void C64::select_disc(Prefs *np)
return; return;
menu_init(&select_disc_menu, this->menu_font, file_list, menu_init(&select_disc_menu, this->menu_font, file_list,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int opt = menu_select(real_screen, &select_disc_menu, NULL); int opt = menu_select(real_screen, &select_disc_menu, NULL);
if (opt >= 0) if (opt >= 0)
{ {
@ -246,12 +246,12 @@ void C64::bind_key(Prefs *np)
}; };
menu_init(&bind_key_menu, this->menu_font, bind_key_messages, menu_init(&bind_key_menu, this->menu_font, bind_key_messages,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int opt = menu_select(real_screen, &bind_key_menu, NULL); int opt = menu_select(real_screen, &bind_key_menu, NULL);
if (opt >= 0) if (opt >= 0)
{ {
menu_init(&key_menu, this->menu_font, keys, menu_init(&key_menu, this->menu_font, keys,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int key = menu_select(real_screen, &key_menu, NULL); int key = menu_select(real_screen, &key_menu, NULL);
np->JoystickKeyBinding[opt] = kcs[key]; np->JoystickKeyBinding[opt] = kcs[key];
@ -265,7 +265,7 @@ void C64::display_options(Prefs *np)
menu_t display_menu; menu_t display_menu;
menu_init(&display_menu, this->menu_font, display_option_messages, menu_init(&display_menu, this->menu_font, display_option_messages,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int opt = menu_select(real_screen, &display_menu, NULL); int opt = menu_select(real_screen, &display_menu, NULL);
if (opt >= 0) if (opt >= 0)
np->DisplayOption = opt; np->DisplayOption = opt;
@ -278,7 +278,7 @@ void C64::save_load_state(Prefs *np)
menu_t select_saves_menu; menu_t select_saves_menu;
menu_init(&save_load_menu, this->menu_font, save_load_state_messages, menu_init(&save_load_menu, this->menu_font, save_load_state_messages,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int opt = menu_select(real_screen, &save_load_menu, NULL); int opt = menu_select(real_screen, &save_load_menu, NULL);
switch(opt) switch(opt)
{ {
@ -306,7 +306,7 @@ void C64::save_load_state(Prefs *np)
if (file_list == NULL) if (file_list == NULL)
break; break;
menu_init(&select_saves_menu, this->menu_font, file_list, menu_init(&select_saves_menu, this->menu_font, file_list,
0, 32, MENU_SIZE_X, MENU_SIZE_Y); 32, 32, MENU_SIZE_X, MENU_SIZE_Y);
int save = menu_select(real_screen, &select_saves_menu, NULL); int save = menu_select(real_screen, &select_saves_menu, NULL);
if (save >= 0) if (save >= 0)
{ {

View File

@ -219,6 +219,9 @@ void menu_init(menu_t *p_menu, TTF_Font *p_font, const char **pp_msgs,
if (text_w_font > p_menu->text_w) if (text_w_font > p_menu->text_w)
p_menu->text_w = text_w_font; p_menu->text_w = text_w_font;
} }
if (p_menu->text_w > p_menu->x2 - p_menu->x1)
p_menu->text_w = p_menu->x2 - p_menu->x1;
if ( !(p_menu->p_submenus = (submenu_t *)malloc(sizeof(submenu_t) * p_menu->n_submenus)) ) if ( !(p_menu->p_submenus = (submenu_t *)malloc(sizeof(submenu_t) * p_menu->n_submenus)) )
{ {
perror("malloc failed!\n"); perror("malloc failed!\n");