From c2787689a4f7aeb05962983f2a36b1a0aa07c4bb Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Wed, 7 Jan 2009 17:35:40 +0000 Subject: [PATCH] Handle long filenames --- CHANGES.WII | 7 +++++++ Src/C64_SDL.i | 16 ++++++++-------- Src/menu.cpp | 3 +++ 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 CHANGES.WII diff --git a/CHANGES.WII b/CHANGES.WII new file mode 100644 index 0000000..0bfe05d --- /dev/null +++ b/CHANGES.WII @@ -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 diff --git a/Src/C64_SDL.i b/Src/C64_SDL.i index 02eb988..77e78de 100644 --- a/Src/C64_SDL.i +++ b/Src/C64_SDL.i @@ -78,7 +78,7 @@ void C64::c64_ctor1(void) this->fake_key_keytime = 5; 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; SDL_RWops *rw; @@ -103,7 +103,7 @@ void C64::c64_ctor1(void) exit(1); } 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) @@ -178,7 +178,7 @@ void C64::select_disc(Prefs *np) return; 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); if (opt >= 0) { @@ -246,12 +246,12 @@ void C64::bind_key(Prefs *np) }; 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); if (opt >= 0) { 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); np->JoystickKeyBinding[opt] = kcs[key]; @@ -265,7 +265,7 @@ void C64::display_options(Prefs *np) menu_t display_menu; 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); if (opt >= 0) np->DisplayOption = opt; @@ -278,7 +278,7 @@ void C64::save_load_state(Prefs *np) menu_t select_saves_menu; 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); switch(opt) { @@ -306,7 +306,7 @@ void C64::save_load_state(Prefs *np) if (file_list == NULL) break; 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); if (save >= 0) { diff --git a/Src/menu.cpp b/Src/menu.cpp index 46498a5..b186ea9 100644 --- a/Src/menu.cpp +++ b/Src/menu.cpp @@ -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) 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)) ) { perror("malloc failed!\n");