mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 21:44:22 +01:00
Integrate new menu system from Holger
This commit is contained in:
parent
fb7de09d4c
commit
b424598a6b
@ -210,15 +210,16 @@ public:
|
|||||||
|
|
||||||
void network_vblank();
|
void network_vblank();
|
||||||
|
|
||||||
void select_disc(Prefs *np);
|
void select_disc(Prefs *np, bool start);
|
||||||
void select_fake_key_sequence(Prefs *np);
|
|
||||||
void start_fake_key_sequence(const char *str);
|
void start_fake_key_sequence(const char *str);
|
||||||
void run_fake_key_sequence();
|
void run_fake_key_sequence();
|
||||||
char * bind_one_key(Prefs *np, int which);
|
char * bind_one_key(Prefs *np, int which);
|
||||||
void bind_keys(Prefs *np);
|
void bind_keys(Prefs *np);
|
||||||
|
void select_fake_key_sequence(Prefs *np);
|
||||||
|
void advanced_options(Prefs *np);
|
||||||
void other_options(Prefs *np);
|
void other_options(Prefs *np);
|
||||||
void networking_menu(Prefs *np);
|
void networking_menu(Prefs *np);
|
||||||
void save_load_state(Prefs *np);
|
void save_load_state(Prefs *np, int do_what);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
119
Src/C64_SDL.h
119
Src/C64_SDL.h
@ -101,9 +101,15 @@ void C64::c64_dtor(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void C64::select_disc(Prefs *np)
|
void C64::select_disc(Prefs *np, bool start)
|
||||||
{
|
{
|
||||||
const char *name = menu_select_file(IMAGE_PATH);
|
const char *name;
|
||||||
|
const char *d64_name = NULL;
|
||||||
|
|
||||||
|
if (!start)
|
||||||
|
name = menu_select_file(IMAGE_PATH);
|
||||||
|
else
|
||||||
|
name = menu_select_file_start(IMAGE_PATH, &d64_name);
|
||||||
|
|
||||||
if (name== NULL)
|
if (name== NULL)
|
||||||
return;
|
return;
|
||||||
@ -155,6 +161,18 @@ void C64::select_disc(Prefs *np)
|
|||||||
|
|
||||||
/* Cleanup*/
|
/* Cleanup*/
|
||||||
free((void*)name);
|
free((void*)name);
|
||||||
|
|
||||||
|
/* And maybe start the game */
|
||||||
|
if (d64_name)
|
||||||
|
{
|
||||||
|
static char buf[255];
|
||||||
|
|
||||||
|
snprintf(buf, 255, "\nLOAD \"%s\",8,1\nRUN\n", d64_name);
|
||||||
|
this->start_fake_key_sequence((const char*)buf);
|
||||||
|
free((void*)d64_name);
|
||||||
|
}
|
||||||
|
else if (start)
|
||||||
|
this->start_fake_key_sequence("\nLOAD \"*\",8,1\nRUN\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,10 +293,10 @@ void C64::networking_menu(Prefs *np)
|
|||||||
this->prefs_changed = true;
|
this->prefs_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C64::other_options(Prefs *np)
|
void C64::advanced_options(Prefs *np)
|
||||||
{
|
{
|
||||||
int submenus[3] = { np->DisplayOption, 0, !np->Emul1541Proc };
|
int submenus[4] = { np->DisplayOption, 0,
|
||||||
|
np->SpriteCollisions, 0 };
|
||||||
|
|
||||||
#define SPEED_95 30
|
#define SPEED_95 30
|
||||||
#define SPEED_100 20
|
#define SPEED_100 20
|
||||||
@ -294,11 +312,13 @@ void C64::other_options(Prefs *np)
|
|||||||
/* If it has some other value... */
|
/* If it has some other value... */
|
||||||
submenus[1] = 1; break;
|
submenus[1] = 1; break;
|
||||||
}
|
}
|
||||||
int opt = menu_select(other_options_messages, submenus);
|
|
||||||
|
int opt = menu_select(new_advanced_options_menu_messages,
|
||||||
|
submenus);
|
||||||
if (opt >= 0)
|
if (opt >= 0)
|
||||||
{
|
{
|
||||||
np->DisplayOption = submenus[0];
|
np->DisplayOption = submenus[0];
|
||||||
np->Emul1541Proc = submenus[2] == 0 ? true : false;
|
np->SpriteCollisions = submenus[2];
|
||||||
|
|
||||||
switch(submenus[1])
|
switch(submenus[1])
|
||||||
{
|
{
|
||||||
@ -311,8 +331,20 @@ void C64::other_options(Prefs *np)
|
|||||||
np->MsPerFrame = SPEED_110; break;
|
np->MsPerFrame = SPEED_110; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt == 6)
|
this->prefs_changed = true;
|
||||||
Reset();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C64::other_options(Prefs *np)
|
||||||
|
{
|
||||||
|
int old_swap = ThePrefs.JoystickSwap == true ? 1 : 0;
|
||||||
|
int submenus[3] = { old_swap, !np->Emul1541Proc, 0 };
|
||||||
|
|
||||||
|
int opt = menu_select(new_options_menu_messages,
|
||||||
|
submenus);
|
||||||
|
if (opt >= 0)
|
||||||
|
{
|
||||||
|
np->Emul1541Proc = submenus[1] == 0 ? true : false;
|
||||||
|
|
||||||
this->prefs_changed = true;
|
this->prefs_changed = true;
|
||||||
}
|
}
|
||||||
@ -358,7 +390,6 @@ void C64::select_fake_key_sequence(Prefs *np)
|
|||||||
"LOAD \"*\",8,1 and RUN",
|
"LOAD \"*\",8,1 and RUN",
|
||||||
"LOAD \"$\",8",
|
"LOAD \"$\",8",
|
||||||
"LIST",
|
"LIST",
|
||||||
"Type with virtual keyboard",
|
|
||||||
NULL};
|
NULL};
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
@ -366,20 +397,11 @@ void C64::select_fake_key_sequence(Prefs *np)
|
|||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (opt == 3)
|
this->start_fake_key_sequence(fake_key_sequences[opt]);
|
||||||
{
|
|
||||||
const char *seq = this->virtual_keyboard->get_string();
|
|
||||||
|
|
||||||
if (seq != NULL)
|
|
||||||
this->start_fake_key_sequence(seq);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this->start_fake_key_sequence(fake_key_sequences[opt]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C64::save_load_state(Prefs *np)
|
void C64::save_load_state(Prefs *np, int opt)
|
||||||
{
|
{
|
||||||
int opt = menu_select(save_load_state_messages, NULL);
|
|
||||||
switch(opt)
|
switch(opt)
|
||||||
{
|
{
|
||||||
case 1: /* save */
|
case 1: /* save */
|
||||||
@ -626,40 +648,57 @@ void C64::VBlank(bool draw_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->have_a_break) {
|
if (this->have_a_break) {
|
||||||
int submenus[1];
|
int submenus[3] = {1, 0, 0};
|
||||||
int opt;
|
int opt;
|
||||||
int old_swap = ThePrefs.JoystickSwap == true ? 1 : 0;
|
|
||||||
|
|
||||||
Prefs np = ThePrefs;
|
Prefs np = ThePrefs;
|
||||||
this->prefs_changed = false;
|
this->prefs_changed = false;
|
||||||
|
|
||||||
TheSID->PauseSound();
|
TheSID->PauseSound();
|
||||||
submenus[0] = old_swap;
|
opt = menu_select(new_main_menu_messages, submenus);
|
||||||
opt = menu_select(main_menu_messages, submenus);
|
|
||||||
|
|
||||||
switch(opt)
|
switch(opt)
|
||||||
{
|
{
|
||||||
case 0: /* Load disc/tape */
|
case 2: /* Insert disc/tape */
|
||||||
this->select_fake_key_sequence(&np);
|
this->select_disc(&np, submenus[0] == 1);
|
||||||
break;
|
break;
|
||||||
case 1: /* Insert disc/tape */
|
case 4: /* Save / load game */
|
||||||
this->select_disc(&np);
|
this->save_load_state(&np, submenus[1]);
|
||||||
break;
|
break;
|
||||||
case 2: /* Bind keys to joystick */
|
case 6: /* Bind keys to joystick */
|
||||||
this->bind_keys(&np);
|
switch (submenus[2])
|
||||||
|
{
|
||||||
|
case 0: /* type */
|
||||||
|
{
|
||||||
|
const char *seq = this->virtual_keyboard->get_string();
|
||||||
|
|
||||||
|
if (seq != NULL)
|
||||||
|
this->start_fake_key_sequence(seq);
|
||||||
|
} break;
|
||||||
|
case 1: /* Macro */
|
||||||
|
this->select_fake_key_sequence(&np); break;
|
||||||
|
default:
|
||||||
|
case 2: /* Bind to controller */
|
||||||
|
this->bind_keys(&np); break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3: /* Other options */
|
case 9: /* Reset the C64 */
|
||||||
this->other_options(&np);
|
Reset();
|
||||||
break;
|
break;
|
||||||
case 4: /* Networking */
|
case 10: /* Networking */
|
||||||
this->networking_menu(&np);
|
this->networking_menu(&np);
|
||||||
break;
|
break;
|
||||||
case 5: /* Swap joysticks */
|
case 11: /* Other options */
|
||||||
|
this->other_options(&np);
|
||||||
break;
|
break;
|
||||||
case 7: /* Save / load game */
|
case 12: /* Advanced options */
|
||||||
this->save_load_state(&np);
|
this->advanced_options(&np);
|
||||||
break;
|
break;
|
||||||
case 9: /* Quit */
|
case 13:
|
||||||
|
{
|
||||||
|
menu_select(welcome, NULL);
|
||||||
|
} break;
|
||||||
|
case 15: /* Quit */
|
||||||
quit_thyself = true;
|
quit_thyself = true;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
@ -670,8 +709,6 @@ void C64::VBlank(bool draw_frame)
|
|||||||
np.JoystickSwap = false;
|
np.JoystickSwap = false;
|
||||||
else
|
else
|
||||||
np.JoystickSwap = true;
|
np.JoystickSwap = true;
|
||||||
if (submenus[0] != old_swap)
|
|
||||||
this->prefs_changed = true;
|
|
||||||
|
|
||||||
if (this->prefs_changed)
|
if (this->prefs_changed)
|
||||||
{
|
{
|
||||||
@ -683,7 +720,7 @@ void C64::VBlank(bool draw_frame)
|
|||||||
|
|
||||||
this->have_a_break = false;
|
this->have_a_break = false;
|
||||||
if (this->quit_thyself)
|
if (this->quit_thyself)
|
||||||
ThePrefs.Save(PREFS_PATH);
|
ThePrefs.Save((const char*)PREFS_PATH);
|
||||||
}
|
}
|
||||||
this->network_vblank();
|
this->network_vblank();
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ static submenu_t *find_submenu(menu_t *p_menu, int index)
|
|||||||
void menu_print_font(SDL_Surface *screen, int r, int g, int b,
|
void menu_print_font(SDL_Surface *screen, int r, int g, int b,
|
||||||
int x, int y, const char *msg)
|
int x, int y, const char *msg)
|
||||||
{
|
{
|
||||||
#define _MAX_STRING 24
|
#define _MAX_STRING 64
|
||||||
SDL_Surface *font_surf;
|
SDL_Surface *font_surf;
|
||||||
SDL_Rect dst = {x, y, 0, 0};
|
SDL_Rect dst = {x, y, 0, 0};
|
||||||
SDL_Color color = {r, g, b};
|
SDL_Color color = {r, g, b};
|
||||||
@ -353,7 +353,7 @@ void menu_print_font(SDL_Surface *screen, int r, int g, int b,
|
|||||||
void menu_print_font64(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg)
|
void menu_print_font64(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg)
|
||||||
{
|
{
|
||||||
#undef _MAX_STRING
|
#undef _MAX_STRING
|
||||||
#define _MAX_STRING 26
|
#define _MAX_STRING 64
|
||||||
SDL_Surface *font_surf;
|
SDL_Surface *font_surf;
|
||||||
SDL_Rect dst = {x, y, 0, 0};
|
SDL_Rect dst = {x, y, 0, 0};
|
||||||
SDL_Color color = {r, g, b};
|
SDL_Color color = {r, g, b};
|
||||||
@ -1010,10 +1010,12 @@ const char *menu_select_file_start(const char *dir_path, const char **d64_name)
|
|||||||
{
|
{
|
||||||
const char *file = menu_select_file_internal(dir_path,
|
const char *file = menu_select_file_internal(dir_path,
|
||||||
0, 0, FULL_DISPLAY_X/2, FULL_DISPLAY_Y);
|
0, 0, FULL_DISPLAY_X/2, FULL_DISPLAY_Y);
|
||||||
|
const char *exts[] = {".d64", ".D64", NULL};
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
return NULL;
|
return NULL;
|
||||||
*d64_name = get_d64_file(file);
|
if (ext_matches_list(file, exts))
|
||||||
|
*d64_name = get_d64_file(file);
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
@ -10,37 +10,36 @@ const char *welcome[] = {
|
|||||||
/*05*/ " PRG image. Use the virtual keyboard or assign the ",
|
/*05*/ " PRG image. Use the virtual keyboard or assign the ",
|
||||||
/*06*/ " key strokes to buttons on the Wiimote. ",
|
/*06*/ " key strokes to buttons on the Wiimote. ",
|
||||||
/*07*/ " Save the game state in the main menu of the game. ",
|
/*07*/ " Save the game state in the main menu of the game. ",
|
||||||
/*08*/ " Next time you can load that state instead of the ",
|
/*08*/ " Next time you can load that state instead and have",
|
||||||
/*09*/ " game to have all configured stuff along with that ",
|
/*09*/ " the game and everything configured directly. ",
|
||||||
/*10*/ " game. ",
|
/*10*/ " ",
|
||||||
/*11*/ " ",
|
/*11*/ " In the networking menu, you can host a game over ",
|
||||||
/*12*/ " This version features USB-keyboard support and ",
|
/*12*/ " the network or browse for active games. During ",
|
||||||
/*13*/ " D64 content listing. Use first Wiimote as port 1 ",
|
/*13*/ " network play, you can send messages to your peer ",
|
||||||
/*14*/ " joystick and the second as port 2 joystick. ",
|
/*14*/ " by pressing ScrLk on the USB keyboard. ",
|
||||||
/*15*/ " ",
|
/*15*/ " ",
|
||||||
/*16*/ ".-------------------------------------------------.",
|
/*16*/ ".-------------------------------------------------.",
|
||||||
/*17*/ "^| Enter Frodo | Don't show again ",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *new_main_menu_messages[] = {
|
const char *new_main_menu_messages[] = {
|
||||||
/*00*/ "#1.MAIN MENU ",
|
/*00*/ "#1.MAIN MENU ",
|
||||||
/*01*/ "#1-------------------------------------",
|
/*01*/ "#1-------------------------------------",
|
||||||
/*02*/ ".Image",
|
/*02*/ ".File",
|
||||||
/*03*/ "^|Load|Start|Remove",
|
/*03*/ "^|Insert|Start",
|
||||||
/*04*/ ".States",
|
/*04*/ ".States",
|
||||||
/*05*/ "^|Load|Save|Delete|Rename ",
|
/*05*/ "^|Load|Save|Delete",
|
||||||
/*06*/ ".Keyboard",
|
/*06*/ ".Keyboard",
|
||||||
/*07*/ "^|Type|Macro|Bind",
|
/*07*/ "^|Type|Macro|Bind",
|
||||||
/*08*/ "#1-------------------------------------",
|
/*08*/ "#1-------------------------------------",
|
||||||
/*09*/ ".Reset the C=64",
|
/*09*/ ".Reset the C=64",
|
||||||
/*10*/ ".Options",
|
/*10*/ ".Networking",
|
||||||
/*11*/ ".Advanced Options",
|
/*11*/ ".Options",
|
||||||
/*12*/ ".Controls",
|
/*12*/ ".Advanced Options",
|
||||||
/*13*/ "#1-------------------------------------",
|
/*13*/ ".Help",
|
||||||
/*14*/ ".Quit",
|
/*14*/ "#1-------------------------------------",
|
||||||
/*15*/ "#1-------------------------------------",
|
/*15*/ ".Quit",
|
||||||
/*16*/ "#1'2'=SELECT, '1'=CANCEL",
|
/*17*/ "#1'2'=SELECT, '1'=CANCEL",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const char *new_options_menu_messages[] = {
|
const char *new_options_menu_messages[] = {
|
||||||
@ -52,8 +51,8 @@ const char *new_options_menu_messages[] = {
|
|||||||
/*05*/ ".True 1541 emulation",
|
/*05*/ ".True 1541 emulation",
|
||||||
/*06*/ "^|NO|YES",
|
/*06*/ "^|NO|YES",
|
||||||
/*07*/ " ",
|
/*07*/ " ",
|
||||||
/*08*/ ".1541 Floppy Drive LED", /* 0 */
|
/*08*/ ".1541 Floppy Drive LED", /* 0 */
|
||||||
/*09*/ "^|OFF|ON",
|
/*09*/ "^|OFF|ON",
|
||||||
/*10*/ "#1-------------------------------------",
|
/*10*/ "#1-------------------------------------",
|
||||||
/*11*/ "#1'2'=SELECT, '1'=CANCEL",
|
/*11*/ "#1'2'=SELECT, '1'=CANCEL",
|
||||||
NULL
|
NULL
|
||||||
@ -61,23 +60,20 @@ const char *new_options_menu_messages[] = {
|
|||||||
const char *new_advanced_options_menu_messages[] = {
|
const char *new_advanced_options_menu_messages[] = {
|
||||||
/*00*/ "#1.ADVANCED OPTIONS MENU ",
|
/*00*/ "#1.ADVANCED OPTIONS MENU ",
|
||||||
/*01*/ "#1-------------------------------------",
|
/*01*/ "#1-------------------------------------",
|
||||||
/*02*/ ".Display resolution", /* 0 */
|
/*02*/ ".Display resolution",
|
||||||
/*03*/ "^|double-center|stretched",
|
/*03*/ "^|double-center|stretched",
|
||||||
/*04*/ " ",
|
/*04*/ " ",
|
||||||
/*05*/ ".Speed (approx.)", /* 2 */
|
/*05*/ ".Speed (approx.)",
|
||||||
/*06*/ "^|95|100|110",
|
/*06*/ "^|95|100|110",
|
||||||
/*07*/ " ",
|
/*07*/ " ",
|
||||||
/*08*/ ".Sprite collisions", /* 0 */
|
/*08*/ ".Sprite collisions",
|
||||||
/*09*/ "^|OFF|ON",
|
/*09*/ "^|OFF|ON",
|
||||||
/*10*/ " ",
|
|
||||||
/*11*/ ".Autostart", /* 0 */
|
|
||||||
/*12*/ "^|Save|Clear", /* 0 */
|
|
||||||
/*13*/ "#1-------------------------------------",
|
/*13*/ "#1-------------------------------------",
|
||||||
/*14*/ "#1'2'=SELECT, '1'=CANCEL",
|
/*14*/ "#1'2'=SELECT, '1'=CANCEL",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const char *new_help_menu_messages[] = {
|
const char *new_help_menu_messages[] = {
|
||||||
/*00*/ "#1.CONTROLS MENU ",
|
/*00*/ "#1.HELP MENU ",
|
||||||
/*01*/ "#1-------------------------------------",
|
/*01*/ "#1-------------------------------------",
|
||||||
/*02*/ ".Wiimote key mappings", /* 0 */
|
/*02*/ ".Wiimote key mappings", /* 0 */
|
||||||
/*03*/ "^|Wiimote Info|Set Default", /* 0 */
|
/*03*/ "^|Wiimote Info|Set Default", /* 0 */
|
||||||
|
Loading…
Reference in New Issue
Block a user