mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
Renamed uimenu.? ==> ui/menu.?, uimain.? ==>
mainmenu.?/miscmenu.?/selgame.?
This commit is contained in:
parent
f7d6b5d721
commit
432a2d29f3
12
.gitattributes
vendored
12
.gitattributes
vendored
@ -2505,16 +2505,20 @@ src/emu/timer.c svneol=native#text/plain
|
|||||||
src/emu/timer.h svneol=native#text/plain
|
src/emu/timer.h svneol=native#text/plain
|
||||||
src/emu/ui.c svneol=native#text/plain
|
src/emu/ui.c svneol=native#text/plain
|
||||||
src/emu/ui.h svneol=native#text/plain
|
src/emu/ui.h svneol=native#text/plain
|
||||||
|
src/emu/ui/mainmenu.c svneol=native#text/plain
|
||||||
|
src/emu/ui/mainmenu.h svneol=native#text/plain
|
||||||
|
src/emu/ui/menu.c svneol=native#text/plain
|
||||||
|
src/emu/ui/menu.h svneol=native#text/plain
|
||||||
|
src/emu/ui/miscmenu.c svneol=native#text/plain
|
||||||
|
src/emu/ui/miscmenu.h svneol=native#text/plain
|
||||||
|
src/emu/ui/selgame.c svneol=native#text/plain
|
||||||
|
src/emu/ui/selgame.h svneol=native#text/plain
|
||||||
src/emu/uigfx.c svneol=native#text/plain
|
src/emu/uigfx.c svneol=native#text/plain
|
||||||
src/emu/uigfx.h svneol=native#text/plain
|
src/emu/uigfx.h svneol=native#text/plain
|
||||||
src/emu/uiimage.c svneol=native#text/plain
|
src/emu/uiimage.c svneol=native#text/plain
|
||||||
src/emu/uiimage.h svneol=native#text/plain
|
src/emu/uiimage.h svneol=native#text/plain
|
||||||
src/emu/uiinput.c svneol=native#text/plain
|
src/emu/uiinput.c svneol=native#text/plain
|
||||||
src/emu/uiinput.h svneol=native#text/plain
|
src/emu/uiinput.h svneol=native#text/plain
|
||||||
src/emu/uimain.c svneol=native#text/plain
|
|
||||||
src/emu/uimain.h svneol=native#text/plain
|
|
||||||
src/emu/uimenu.c svneol=native#text/plain
|
|
||||||
src/emu/uimenu.h svneol=native#text/plain
|
|
||||||
src/emu/uismall.png -text svneol=unset#image/png
|
src/emu/uismall.png -text svneol=unset#image/png
|
||||||
src/emu/uiswlist.c svneol=native#text/plain
|
src/emu/uiswlist.c svneol=native#text/plain
|
||||||
src/emu/uiswlist.h svneol=native#text/plain
|
src/emu/uiswlist.h svneol=native#text/plain
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "uimain.h"
|
#include "ui/selgame.h"
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
@ -57,7 +57,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_
|
|||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
|
||||||
// diimage requires uimenu
|
// diimage requires uimenu
|
||||||
#include "uimenu.h"
|
#include "ui/menu.h"
|
||||||
|
|
||||||
// devices and callbacks
|
// devices and callbacks
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
@ -63,6 +63,7 @@ OBJDIRS += \
|
|||||||
$(EMUOBJ)/machine \
|
$(EMUOBJ)/machine \
|
||||||
$(EMUOBJ)/layout \
|
$(EMUOBJ)/layout \
|
||||||
$(EMUOBJ)/imagedev \
|
$(EMUOBJ)/imagedev \
|
||||||
|
$(EMUOBJ)/ui \
|
||||||
$(EMUOBJ)/video \
|
$(EMUOBJ)/video \
|
||||||
|
|
||||||
OSDSRC = $(SRC)/osd
|
OSDSRC = $(SRC)/osd
|
||||||
@ -145,8 +146,10 @@ EMUOBJS = \
|
|||||||
$(EMUOBJ)/uiimage.o \
|
$(EMUOBJ)/uiimage.o \
|
||||||
$(EMUOBJ)/uiinput.o \
|
$(EMUOBJ)/uiinput.o \
|
||||||
$(EMUOBJ)/uiswlist.o \
|
$(EMUOBJ)/uiswlist.o \
|
||||||
$(EMUOBJ)/uimain.o \
|
$(EMUOBJ)/ui/menu.o \
|
||||||
$(EMUOBJ)/uimenu.o \
|
$(EMUOBJ)/ui/mainmenu.o \
|
||||||
|
$(EMUOBJ)/ui/miscmenu.o \
|
||||||
|
$(EMUOBJ)/ui/selgame.o \
|
||||||
$(EMUOBJ)/validity.o \
|
$(EMUOBJ)/validity.o \
|
||||||
$(EMUOBJ)/video.o \
|
$(EMUOBJ)/video.o \
|
||||||
$(EMUOBJ)/debug/debugcmd.o \
|
$(EMUOBJ)/debug/debugcmd.o \
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "uimain.h"
|
#include "ui/selgame.h"
|
||||||
#include "uiinput.h"
|
#include "uiinput.h"
|
||||||
#include "crsshair.h"
|
#include "crsshair.h"
|
||||||
#include "validity.h"
|
#include "validity.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#ifndef __SOFTLIST_H_
|
#ifndef __SOFTLIST_H_
|
||||||
#define __SOFTLIST_H_
|
#define __SOFTLIST_H_
|
||||||
|
|
||||||
#include "uimenu.h"
|
#include "ui/menu.h"
|
||||||
#include "expat.h"
|
#include "expat.h"
|
||||||
#include "pool.h"
|
#include "pool.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
#include "rendfont.h"
|
#include "rendfont.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "uiinput.h"
|
#include "uiinput.h"
|
||||||
#include "uimain.h"
|
#include "ui/mainmenu.h"
|
||||||
|
#include "ui/miscmenu.h"
|
||||||
#include "uigfx.h"
|
#include "uigfx.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
241
src/emu/ui/mainmenu.c
Normal file
241
src/emu/ui/mainmenu.c
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
|
||||||
|
ui/mainmenu.c
|
||||||
|
|
||||||
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
|
Copyright Nicola Salmoria and the MAME Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "osdnet.h"
|
||||||
|
#include "emuopts.h"
|
||||||
|
#include "ui.h"
|
||||||
|
#include "rendutil.h"
|
||||||
|
#include "cheat.h"
|
||||||
|
#include "uiimage.h"
|
||||||
|
#include "uiinput.h"
|
||||||
|
#include "ui/mainmenu.h"
|
||||||
|
#include "ui/miscmenu.h"
|
||||||
|
#include "ui/selgame.h"
|
||||||
|
#include "audit.h"
|
||||||
|
#include "crsshair.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "imagedev/cassette.h"
|
||||||
|
#include "imagedev/bitbngr.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
MENU HANDLERS
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
ui_menu_main constructor - populate the main menu
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
ui_menu_main::ui_menu_main(running_machine &machine, render_container *container) : ui_menu(machine, container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_menu_main::populate()
|
||||||
|
{
|
||||||
|
astring menu_text;
|
||||||
|
|
||||||
|
/* add input menu items */
|
||||||
|
item_append("Input (general)", NULL, 0, (void *)INPUT_GROUPS);
|
||||||
|
|
||||||
|
menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun());
|
||||||
|
item_append(menu_text.cstr(), NULL, 0, (void *)INPUT_SPECIFIC);
|
||||||
|
|
||||||
|
/* add optional input-related menus */
|
||||||
|
if (machine().ioport().has_analog())
|
||||||
|
item_append("Analog Controls", NULL, 0, (void *)ANALOG);
|
||||||
|
if (machine().ioport().has_dips())
|
||||||
|
item_append("Dip Switches", NULL, 0, (void *)SETTINGS_DIP_SWITCHES);
|
||||||
|
if (machine().ioport().has_configs())
|
||||||
|
{
|
||||||
|
menu_text.printf("%s Configuration",emulator_info::get_capstartgamenoun());
|
||||||
|
item_append(menu_text.cstr(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add bookkeeping menu */
|
||||||
|
item_append("Bookkeeping Info", NULL, 0, (void *)BOOKKEEPING);
|
||||||
|
|
||||||
|
/* add game info menu */
|
||||||
|
menu_text.printf("%s Information",emulator_info::get_capstartgamenoun());
|
||||||
|
item_append(menu_text.cstr(), NULL, 0, (void *)GAME_INFO);
|
||||||
|
|
||||||
|
image_interface_iterator imgiter(machine().root_device());
|
||||||
|
if (imgiter.first() != NULL)
|
||||||
|
{
|
||||||
|
/* add image info menu */
|
||||||
|
item_append("Image Information", NULL, 0, (void *)IMAGE_MENU_IMAGE_INFO);
|
||||||
|
|
||||||
|
/* add file manager menu */
|
||||||
|
item_append("File Manager", NULL, 0, (void *)IMAGE_MENU_FILE_MANAGER);
|
||||||
|
|
||||||
|
/* add tape control menu */
|
||||||
|
cassette_device_iterator cassiter(machine().root_device());
|
||||||
|
if (cassiter.first() != NULL)
|
||||||
|
item_append("Tape Control", NULL, 0, (void *)MESS_MENU_TAPE_CONTROL);
|
||||||
|
|
||||||
|
/* add bitbanger control menu */
|
||||||
|
bitbanger_device_iterator bititer(machine().root_device());
|
||||||
|
if (bititer.first() != NULL)
|
||||||
|
item_append("Bitbanger Control", NULL, 0, (void *)MESS_MENU_BITBANGER_CONTROL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (machine().ioport().has_bioses())
|
||||||
|
item_append("Bios Selection", NULL, 0, (void *)BIOS_SELECTION);
|
||||||
|
|
||||||
|
slot_interface_iterator slotiter(machine().root_device());
|
||||||
|
if (slotiter.first() != NULL)
|
||||||
|
{
|
||||||
|
/* add slot info menu */
|
||||||
|
item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES);
|
||||||
|
}
|
||||||
|
|
||||||
|
network_interface_iterator netiter(machine().root_device());
|
||||||
|
if (netiter.first() != NULL)
|
||||||
|
{
|
||||||
|
/* add image info menu */
|
||||||
|
item_append("Network Devices", NULL, 0, (void*)NETWORK_DEVICES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add keyboard mode menu */
|
||||||
|
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
|
||||||
|
item_append("Keyboard Mode", NULL, 0, (void *)KEYBOARD_MODE);
|
||||||
|
|
||||||
|
/* add sliders menu */
|
||||||
|
item_append("Slider Controls", NULL, 0, (void *)SLIDERS);
|
||||||
|
|
||||||
|
/* add video options menu */
|
||||||
|
item_append("Video Options", NULL, 0, (machine().render().target_by_index(1) != NULL) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
|
||||||
|
|
||||||
|
/* add crosshair options menu */
|
||||||
|
if (crosshair_get_usage(machine()))
|
||||||
|
item_append("Crosshair Options", NULL, 0, (void *)CROSSHAIR);
|
||||||
|
|
||||||
|
/* add cheat menu */
|
||||||
|
if (machine().options().cheat() && machine().cheat().first() != NULL)
|
||||||
|
item_append("Cheat", NULL, 0, (void *)CHEAT);
|
||||||
|
|
||||||
|
/* add memory card menu */
|
||||||
|
if (machine().config().m_memcard_handler != NULL)
|
||||||
|
item_append("Memory Card", NULL, 0, (void *)MEMORY_CARD);
|
||||||
|
|
||||||
|
/* add reset and exit menus */
|
||||||
|
menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun());
|
||||||
|
item_append(menu_text.cstr(), NULL, 0, (void *)SELECT_GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_menu_main::~ui_menu_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
menu_main - handle the main menu
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_menu_main::handle()
|
||||||
|
{
|
||||||
|
/* process the menu */
|
||||||
|
const ui_menu_event *menu_event = process(0);
|
||||||
|
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
|
||||||
|
switch((long long)(menu_event->itemref)) {
|
||||||
|
case INPUT_GROUPS:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_SPECIFIC:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_specific(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SETTINGS_DIP_SWITCHES:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_dip_switches(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SETTINGS_DRIVER_CONFIG:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_driver_config(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ANALOG:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_analog(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BOOKKEEPING:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bookkeeping(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GAME_INFO:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_game_info(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IMAGE_MENU_IMAGE_INFO:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_image_info(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IMAGE_MENU_FILE_MANAGER:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MESS_MENU_TAPE_CONTROL:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MESS_MENU_BITBANGER_CONTROL:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_bitbanger_control(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SLOT_DEVICES:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_slot_devices(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NETWORK_DEVICES:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_network_devices(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEYBOARD_MODE:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_keyboard_mode(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SLIDERS:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_sliders(machine(), container, false)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDEO_TARGETS:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_targets(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDEO_OPTIONS:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, machine().render().first_target())));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CROSSHAIR:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_crosshair(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CHEAT:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_cheat(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MEMORY_CARD:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_memory_card(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SELECT_GAME:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, 0)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BIOS_SELECTION:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bios_selection(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fatalerror("ui_menu_main::handle - unknown reference\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
src/emu/ui/mainmenu.h
Normal file
54
src/emu/ui/mainmenu.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ui/mainmenu.h
|
||||||
|
|
||||||
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
|
Copyright Nicola Salmoria and the MAME Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __UI_MAINMENU_H__
|
||||||
|
#define __UI_MAINMENU_H__
|
||||||
|
|
||||||
|
#include "crsshair.h"
|
||||||
|
#include "drivenum.h"
|
||||||
|
|
||||||
|
class ui_menu_main : public ui_menu {
|
||||||
|
public:
|
||||||
|
ui_menu_main(running_machine &machine, render_container *container);
|
||||||
|
virtual ~ui_menu_main();
|
||||||
|
virtual void populate();
|
||||||
|
virtual void handle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum {
|
||||||
|
INPUT_GROUPS,
|
||||||
|
INPUT_SPECIFIC,
|
||||||
|
SETTINGS_DIP_SWITCHES,
|
||||||
|
SETTINGS_DRIVER_CONFIG,
|
||||||
|
ANALOG,
|
||||||
|
BOOKKEEPING,
|
||||||
|
GAME_INFO,
|
||||||
|
IMAGE_MENU_IMAGE_INFO,
|
||||||
|
IMAGE_MENU_FILE_MANAGER,
|
||||||
|
MESS_MENU_TAPE_CONTROL,
|
||||||
|
MESS_MENU_BITBANGER_CONTROL,
|
||||||
|
SLOT_DEVICES,
|
||||||
|
NETWORK_DEVICES,
|
||||||
|
KEYBOARD_MODE,
|
||||||
|
SLIDERS,
|
||||||
|
VIDEO_TARGETS,
|
||||||
|
VIDEO_OPTIONS,
|
||||||
|
CROSSHAIR,
|
||||||
|
CHEAT,
|
||||||
|
MEMORY_CARD,
|
||||||
|
SELECT_GAME,
|
||||||
|
BIOS_SELECTION,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __UI_MAINMENU_H__ */
|
@ -1,6 +1,6 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
||||||
uimenu.c
|
ui/menu.c
|
||||||
|
|
||||||
Internal MAME menus for the user interface.
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
@ -15,7 +15,8 @@
|
|||||||
#include "rendutil.h"
|
#include "rendutil.h"
|
||||||
#include "uiinput.h"
|
#include "uiinput.h"
|
||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "uimain.h"
|
#include "ui/mainmenu.h"
|
||||||
|
#include "ui/miscmenu.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
uimenu.h
|
ui/menu.h
|
||||||
|
|
||||||
Internal MAME menus for the user interface.
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __UIMENU_H__
|
#ifndef __UI_MENU_H__
|
||||||
#define __UIMENU_H__
|
#define __UI_MENU_H__
|
||||||
|
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
@ -183,4 +183,4 @@ private:
|
|||||||
static void render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
|
static void render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __UIMENU_H__ */
|
#endif /* __UI_MENU_H__ */
|
@ -1,6 +1,6 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
||||||
uimenu.c
|
miscmenu.c
|
||||||
|
|
||||||
Internal MAME menus for the user interface.
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "uiimage.h"
|
#include "uiimage.h"
|
||||||
#include "uiinput.h"
|
#include "uiinput.h"
|
||||||
#include "uimain.h"
|
#include "ui/miscmenu.h"
|
||||||
#include "audit.h"
|
#include "audit.h"
|
||||||
#include "crsshair.h"
|
#include "crsshair.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -69,245 +69,10 @@ UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *c
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
force_game_select - force the game
|
|
||||||
select menu to be visible and inescapable
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void ui_menu_select_game::force_game_select(running_machine &machine, render_container *container)
|
|
||||||
{
|
|
||||||
char *gamename = (char *)machine.options().system_name();
|
|
||||||
|
|
||||||
/* reset the menu stack */
|
|
||||||
ui_menu::stack_reset(machine);
|
|
||||||
|
|
||||||
/* add the quit entry followed by the game select entry */
|
|
||||||
ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container));
|
|
||||||
quit->set_special_main_menu(true);
|
|
||||||
ui_menu::stack_push(quit);
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_select_game(machine, container, gamename)));
|
|
||||||
|
|
||||||
/* force the menus on */
|
|
||||||
ui_show_menu();
|
|
||||||
|
|
||||||
/* make sure MAME is paused */
|
|
||||||
machine.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
MENU HANDLERS
|
MENU HANDLERS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
ui_menu_main constructor - populate the main menu
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
ui_menu_main::ui_menu_main(running_machine &machine, render_container *container) : ui_menu(machine, container)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ui_menu_main::populate()
|
|
||||||
{
|
|
||||||
astring menu_text;
|
|
||||||
|
|
||||||
/* add input menu items */
|
|
||||||
item_append("Input (general)", NULL, 0, (void *)INPUT_GROUPS);
|
|
||||||
|
|
||||||
menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun());
|
|
||||||
item_append(menu_text.cstr(), NULL, 0, (void *)INPUT_SPECIFIC);
|
|
||||||
|
|
||||||
/* add optional input-related menus */
|
|
||||||
if (machine().ioport().has_analog())
|
|
||||||
item_append("Analog Controls", NULL, 0, (void *)ANALOG);
|
|
||||||
if (machine().ioport().has_dips())
|
|
||||||
item_append("Dip Switches", NULL, 0, (void *)SETTINGS_DIP_SWITCHES);
|
|
||||||
if (machine().ioport().has_configs())
|
|
||||||
{
|
|
||||||
menu_text.printf("%s Configuration",emulator_info::get_capstartgamenoun());
|
|
||||||
item_append(menu_text.cstr(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add bookkeeping menu */
|
|
||||||
item_append("Bookkeeping Info", NULL, 0, (void *)BOOKKEEPING);
|
|
||||||
|
|
||||||
/* add game info menu */
|
|
||||||
menu_text.printf("%s Information",emulator_info::get_capstartgamenoun());
|
|
||||||
item_append(menu_text.cstr(), NULL, 0, (void *)GAME_INFO);
|
|
||||||
|
|
||||||
image_interface_iterator imgiter(machine().root_device());
|
|
||||||
if (imgiter.first() != NULL)
|
|
||||||
{
|
|
||||||
/* add image info menu */
|
|
||||||
item_append("Image Information", NULL, 0, (void *)IMAGE_MENU_IMAGE_INFO);
|
|
||||||
|
|
||||||
/* add file manager menu */
|
|
||||||
item_append("File Manager", NULL, 0, (void *)IMAGE_MENU_FILE_MANAGER);
|
|
||||||
|
|
||||||
/* add tape control menu */
|
|
||||||
cassette_device_iterator cassiter(machine().root_device());
|
|
||||||
if (cassiter.first() != NULL)
|
|
||||||
item_append("Tape Control", NULL, 0, (void *)MESS_MENU_TAPE_CONTROL);
|
|
||||||
|
|
||||||
/* add bitbanger control menu */
|
|
||||||
bitbanger_device_iterator bititer(machine().root_device());
|
|
||||||
if (bititer.first() != NULL)
|
|
||||||
item_append("Bitbanger Control", NULL, 0, (void *)MESS_MENU_BITBANGER_CONTROL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (machine().ioport().has_bioses())
|
|
||||||
item_append("Bios Selection", NULL, 0, (void *)BIOS_SELECTION);
|
|
||||||
|
|
||||||
slot_interface_iterator slotiter(machine().root_device());
|
|
||||||
if (slotiter.first() != NULL)
|
|
||||||
{
|
|
||||||
/* add slot info menu */
|
|
||||||
item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES);
|
|
||||||
}
|
|
||||||
|
|
||||||
network_interface_iterator netiter(machine().root_device());
|
|
||||||
if (netiter.first() != NULL)
|
|
||||||
{
|
|
||||||
/* add image info menu */
|
|
||||||
item_append("Network Devices", NULL, 0, (void*)NETWORK_DEVICES);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add keyboard mode menu */
|
|
||||||
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
|
|
||||||
item_append("Keyboard Mode", NULL, 0, (void *)KEYBOARD_MODE);
|
|
||||||
|
|
||||||
/* add sliders menu */
|
|
||||||
item_append("Slider Controls", NULL, 0, (void *)SLIDERS);
|
|
||||||
|
|
||||||
/* add video options menu */
|
|
||||||
item_append("Video Options", NULL, 0, (machine().render().target_by_index(1) != NULL) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
|
|
||||||
|
|
||||||
/* add crosshair options menu */
|
|
||||||
if (crosshair_get_usage(machine()))
|
|
||||||
item_append("Crosshair Options", NULL, 0, (void *)CROSSHAIR);
|
|
||||||
|
|
||||||
/* add cheat menu */
|
|
||||||
if (machine().options().cheat() && machine().cheat().first() != NULL)
|
|
||||||
item_append("Cheat", NULL, 0, (void *)CHEAT);
|
|
||||||
|
|
||||||
/* add memory card menu */
|
|
||||||
if (machine().config().m_memcard_handler != NULL)
|
|
||||||
item_append("Memory Card", NULL, 0, (void *)MEMORY_CARD);
|
|
||||||
|
|
||||||
/* add reset and exit menus */
|
|
||||||
menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun());
|
|
||||||
item_append(menu_text.cstr(), NULL, 0, (void *)SELECT_GAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_menu_main::~ui_menu_main()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
menu_main - handle the main menu
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void ui_menu_main::handle()
|
|
||||||
{
|
|
||||||
/* process the menu */
|
|
||||||
const ui_menu_event *menu_event = process(0);
|
|
||||||
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
|
|
||||||
switch((long long)(menu_event->itemref)) {
|
|
||||||
case INPUT_GROUPS:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INPUT_SPECIFIC:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_specific(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_DIP_SWITCHES:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_dip_switches(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_DRIVER_CONFIG:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_driver_config(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ANALOG:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_analog(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BOOKKEEPING:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bookkeeping(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GAME_INFO:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_game_info(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_MENU_IMAGE_INFO:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_image_info(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_MENU_FILE_MANAGER:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MESS_MENU_TAPE_CONTROL:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MESS_MENU_BITBANGER_CONTROL:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_bitbanger_control(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SLOT_DEVICES:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_slot_devices(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NETWORK_DEVICES:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_network_devices(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEYBOARD_MODE:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_keyboard_mode(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SLIDERS:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_sliders(machine(), container, false)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIDEO_TARGETS:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_targets(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIDEO_OPTIONS:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, machine().render().first_target())));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CROSSHAIR:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_crosshair(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CHEAT:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_cheat(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MEMORY_CARD:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_memory_card(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SELECT_GAME:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, 0)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BIOS_SELECTION:
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bios_selection(machine(), container)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
fatalerror("ui_menu_main::handle - unknown reference\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
ui_menu_keyboard_mode - menu that
|
ui_menu_keyboard_mode - menu that
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
@ -2538,358 +2303,3 @@ void ui_menu_quit_game::handle()
|
|||||||
/* reset the menu stack */
|
/* reset the menu stack */
|
||||||
ui_menu::stack_reset(machine());
|
ui_menu::stack_reset(machine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
menu_select_game - handle the game select
|
|
||||||
menu
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void ui_menu_select_game::handle()
|
|
||||||
{
|
|
||||||
/* ignore pause keys by swallowing them before we process the menu */
|
|
||||||
ui_input_pressed(machine(), IPT_UI_PAUSE);
|
|
||||||
|
|
||||||
/* process the menu */
|
|
||||||
const ui_menu_event *menu_event = process(0);
|
|
||||||
if (menu_event != NULL && menu_event->itemref != NULL)
|
|
||||||
{
|
|
||||||
/* reset the error on any future menu_event */
|
|
||||||
if (error)
|
|
||||||
error = false;
|
|
||||||
|
|
||||||
/* handle selections */
|
|
||||||
else if (menu_event->iptkey == IPT_UI_SELECT)
|
|
||||||
{
|
|
||||||
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
|
||||||
|
|
||||||
/* special case for configure inputs */
|
|
||||||
if ((FPTR)driver == 1)
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
|
|
||||||
|
|
||||||
/* anything else is a driver */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// audit the game first to see if we're going to work
|
|
||||||
driver_enumerator enumerator(machine().options(), *driver);
|
|
||||||
enumerator.next();
|
|
||||||
media_auditor auditor(enumerator);
|
|
||||||
media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
|
|
||||||
|
|
||||||
// if everything looks good, schedule the new driver
|
|
||||||
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE)
|
|
||||||
{
|
|
||||||
machine().schedule_new_driver(*driver);
|
|
||||||
ui_menu::stack_reset(machine());
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise, display an error
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reset(UI_MENU_RESET_REMEMBER_REF);
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* escape pressed with non-empty text clears the text */
|
|
||||||
else if (menu_event->iptkey == IPT_UI_CANCEL && search[0] != 0)
|
|
||||||
{
|
|
||||||
/* since we have already been popped, we must recreate ourself from scratch */
|
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, NULL)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* typed characters append to the buffer */
|
|
||||||
else if (menu_event->iptkey == IPT_SPECIAL)
|
|
||||||
{
|
|
||||||
int buflen = strlen(search);
|
|
||||||
|
|
||||||
/* if it's a backspace and we can handle it, do so */
|
|
||||||
if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0)
|
|
||||||
{
|
|
||||||
*(char *)utf8_previous_char(&search[buflen]) = 0;
|
|
||||||
rerandomize = true;
|
|
||||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if it's any other key and we're not maxed out, update */
|
|
||||||
else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f)
|
|
||||||
{
|
|
||||||
buflen += utf8_from_uchar(&search[buflen], ARRAY_LENGTH(search) - buflen, menu_event->unichar);
|
|
||||||
search[buflen] = 0;
|
|
||||||
reset(UI_MENU_RESET_SELECT_FIRST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we're in an error state, overlay an error message */
|
|
||||||
if (error)
|
|
||||||
ui_draw_text_box(container,
|
|
||||||
"The selected game is missing one or more required ROM or CHD images. "
|
|
||||||
"Please select a different game.\n\nPress any key to continue.",
|
|
||||||
JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
menu_select_game_populate - populate the game
|
|
||||||
select menu
|
|
||||||
-------------------------------------------------*/
|
|
||||||
ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container)
|
|
||||||
{
|
|
||||||
driverlist = global_alloc_array(const game_driver *, driver_list::total()+1);
|
|
||||||
build_driver_list();
|
|
||||||
if(gamename)
|
|
||||||
strcpy(search, gamename);
|
|
||||||
matchlist[0] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ui_menu_select_game::populate()
|
|
||||||
{
|
|
||||||
int matchcount;
|
|
||||||
int curitem;
|
|
||||||
|
|
||||||
for (curitem = matchcount = 0; driverlist[curitem] != NULL && matchcount < VISIBLE_GAMES_IN_LIST; curitem++)
|
|
||||||
if (!(driverlist[curitem]->flags & GAME_NO_STANDALONE))
|
|
||||||
matchcount++;
|
|
||||||
|
|
||||||
/* if nothing there, add a single multiline item and return */
|
|
||||||
if (matchcount == 0)
|
|
||||||
{
|
|
||||||
astring txt;
|
|
||||||
txt.printf("No %s found. Please check the rompath specified in the %s.ini file.\n\n"
|
|
||||||
"If this is your first time using %s, please see the config.txt file in "
|
|
||||||
"the docs directory for information on configuring %s.",
|
|
||||||
emulator_info::get_gamesnoun(),
|
|
||||||
emulator_info::get_configname(),
|
|
||||||
emulator_info::get_appname(),emulator_info::get_appname() );
|
|
||||||
item_append(txt.cstr(), NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* otherwise, rebuild the match list */
|
|
||||||
assert(drivlist != NULL);
|
|
||||||
if (search[0] != 0 || matchlist[0] == -1 || rerandomize)
|
|
||||||
drivlist->find_approximate_matches(search, matchcount, matchlist);
|
|
||||||
rerandomize = false;
|
|
||||||
|
|
||||||
/* iterate over entries */
|
|
||||||
for (curitem = 0; curitem < matchcount; curitem++)
|
|
||||||
{
|
|
||||||
int curmatch = matchlist[curitem];
|
|
||||||
if (curmatch != -1)
|
|
||||||
{
|
|
||||||
int cloneof = drivlist->non_bios_clone(curmatch);
|
|
||||||
item_append(drivlist->driver(curmatch).name, drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&drivlist->driver(curmatch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we're forced into this, allow general input configuration as well */
|
|
||||||
if (ui_menu::stack_has_special_main_menu())
|
|
||||||
{
|
|
||||||
item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
|
|
||||||
item_append("Configure General Inputs", NULL, 0, (void *)1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* configure the custom rendering */
|
|
||||||
customtop = ui_get_line_height(machine()) + 3.0f * UI_BOX_TB_BORDER;
|
|
||||||
custombottom = 4.0f * ui_get_line_height(machine()) + 3.0f * UI_BOX_TB_BORDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_menu_select_game::~ui_menu_select_game()
|
|
||||||
{
|
|
||||||
global_free(drivlist);
|
|
||||||
global_free(driverlist);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
menu_select_game_build_driver_list - build a
|
|
||||||
list of available drivers
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void ui_menu_select_game::build_driver_list()
|
|
||||||
{
|
|
||||||
// start with an empty list
|
|
||||||
drivlist = global_alloc(driver_enumerator(machine().options()));
|
|
||||||
drivlist->exclude_all();
|
|
||||||
|
|
||||||
/* open a path to the ROMs and find them in the array */
|
|
||||||
file_enumerator path(machine().options().media_path());
|
|
||||||
const osd_directory_entry *dir;
|
|
||||||
|
|
||||||
/* iterate while we get new objects */
|
|
||||||
while ((dir = path.next()) != NULL)
|
|
||||||
{
|
|
||||||
char drivername[50];
|
|
||||||
char *dst = drivername;
|
|
||||||
const char *src;
|
|
||||||
|
|
||||||
/* build a name for it */
|
|
||||||
for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++)
|
|
||||||
*dst++ = tolower((UINT8)*src);
|
|
||||||
*dst = 0;
|
|
||||||
|
|
||||||
int drivnum = drivlist->find(drivername);
|
|
||||||
if (drivnum != -1)
|
|
||||||
drivlist->include(drivnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now build the final list */
|
|
||||||
drivlist->reset();
|
|
||||||
int listnum = 0;
|
|
||||||
while (drivlist->next())
|
|
||||||
driverlist[listnum++] = &drivlist->driver();
|
|
||||||
|
|
||||||
/* NULL-terminate */
|
|
||||||
driverlist[listnum] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
menu_select_game_custom_render - perform our
|
|
||||||
special rendering
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
void ui_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
|
||||||
{
|
|
||||||
const game_driver *driver;
|
|
||||||
float width, maxwidth;
|
|
||||||
float x1, y1, x2, y2;
|
|
||||||
astring tempbuf[5];
|
|
||||||
rgb_t color;
|
|
||||||
int line;
|
|
||||||
|
|
||||||
/* display the current typeahead */
|
|
||||||
if (search[0] != 0)
|
|
||||||
tempbuf[0].printf("Type name or select: %s_", search);
|
|
||||||
else
|
|
||||||
tempbuf[0].printf("Type name or select: (random)");
|
|
||||||
|
|
||||||
/* get the size of the text */
|
|
||||||
ui_draw_text_full(container, tempbuf[0], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
|
||||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
|
|
||||||
width += 2 * UI_BOX_LR_BORDER;
|
|
||||||
maxwidth = MAX(width, origx2 - origx1);
|
|
||||||
|
|
||||||
/* compute our bounds */
|
|
||||||
x1 = 0.5f - 0.5f * maxwidth;
|
|
||||||
x2 = x1 + maxwidth;
|
|
||||||
y1 = origy1 - top;
|
|
||||||
y2 = origy1 - UI_BOX_TB_BORDER;
|
|
||||||
|
|
||||||
/* draw a box */
|
|
||||||
ui_draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
|
||||||
|
|
||||||
/* take off the borders */
|
|
||||||
x1 += UI_BOX_LR_BORDER;
|
|
||||||
x2 -= UI_BOX_LR_BORDER;
|
|
||||||
y1 += UI_BOX_TB_BORDER;
|
|
||||||
y2 -= UI_BOX_TB_BORDER;
|
|
||||||
|
|
||||||
/* draw the text within it */
|
|
||||||
ui_draw_text_full(container, tempbuf[0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
|
||||||
|
|
||||||
/* determine the text to render below */
|
|
||||||
driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL;
|
|
||||||
if ((FPTR)driver > 1)
|
|
||||||
{
|
|
||||||
const char *gfxstat, *soundstat;
|
|
||||||
|
|
||||||
/* first line is game name */
|
|
||||||
tempbuf[0].printf("%-.100s", driver->description);
|
|
||||||
|
|
||||||
/* next line is year, manufacturer */
|
|
||||||
tempbuf[1].printf("%s, %-.100s", driver->year, driver->manufacturer);
|
|
||||||
|
|
||||||
/* next line source path */
|
|
||||||
tempbuf[2].printf("Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).cstr());
|
|
||||||
|
|
||||||
/* next line is overall driver status */
|
|
||||||
if (driver->flags & GAME_NOT_WORKING)
|
|
||||||
tempbuf[3].cpy("Overall: NOT WORKING");
|
|
||||||
else if (driver->flags & GAME_UNEMULATED_PROTECTION)
|
|
||||||
tempbuf[3].cpy("Overall: Unemulated Protection");
|
|
||||||
else
|
|
||||||
tempbuf[3].cpy("Overall: Working");
|
|
||||||
|
|
||||||
/* next line is graphics, sound status */
|
|
||||||
if (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS))
|
|
||||||
gfxstat = "Imperfect";
|
|
||||||
else
|
|
||||||
gfxstat = "OK";
|
|
||||||
|
|
||||||
if (driver->flags & GAME_NO_SOUND)
|
|
||||||
soundstat = "Unimplemented";
|
|
||||||
else if (driver->flags & GAME_IMPERFECT_SOUND)
|
|
||||||
soundstat = "Imperfect";
|
|
||||||
else
|
|
||||||
soundstat = "OK";
|
|
||||||
|
|
||||||
tempbuf[4].printf("Gfx: %s, Sound: %s", gfxstat, soundstat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *s = emulator_info::get_copyright();
|
|
||||||
line = 0;
|
|
||||||
|
|
||||||
/* first line is version string */
|
|
||||||
tempbuf[line++].printf("%s %s", emulator_info::get_applongname(), build_version);
|
|
||||||
|
|
||||||
/* output message */
|
|
||||||
while (line < ARRAY_LENGTH(tempbuf))
|
|
||||||
{
|
|
||||||
if (!(*s == 0 || *s == '\n'))
|
|
||||||
tempbuf[line].cat(*s);
|
|
||||||
|
|
||||||
if (*s == '\n')
|
|
||||||
{
|
|
||||||
line++;
|
|
||||||
s++;
|
|
||||||
} else if (*s != 0)
|
|
||||||
s++;
|
|
||||||
else
|
|
||||||
line++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the size of the text */
|
|
||||||
maxwidth = origx2 - origx1;
|
|
||||||
for (line = 0; line < 4; line++)
|
|
||||||
{
|
|
||||||
ui_draw_text_full(container, tempbuf[line], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
|
||||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
|
|
||||||
width += 2 * UI_BOX_LR_BORDER;
|
|
||||||
maxwidth = MAX(maxwidth, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compute our bounds */
|
|
||||||
x1 = 0.5f - 0.5f * maxwidth;
|
|
||||||
x2 = x1 + maxwidth;
|
|
||||||
y1 = origy2 + UI_BOX_TB_BORDER;
|
|
||||||
y2 = origy2 + bottom;
|
|
||||||
|
|
||||||
/* draw a box */
|
|
||||||
color = UI_BACKGROUND_COLOR;
|
|
||||||
if (driver != NULL)
|
|
||||||
color = UI_GREEN_COLOR;
|
|
||||||
if (driver != NULL && (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_NO_SOUND | GAME_IMPERFECT_SOUND)) != 0)
|
|
||||||
color = UI_YELLOW_COLOR;
|
|
||||||
if (driver != NULL && (driver->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) != 0)
|
|
||||||
color = UI_RED_COLOR;
|
|
||||||
ui_draw_outlined_box(container, x1, y1, x2, y2, color);
|
|
||||||
|
|
||||||
/* take off the borders */
|
|
||||||
x1 += UI_BOX_LR_BORDER;
|
|
||||||
x2 -= UI_BOX_LR_BORDER;
|
|
||||||
y1 += UI_BOX_TB_BORDER;
|
|
||||||
y2 -= UI_BOX_TB_BORDER;
|
|
||||||
|
|
||||||
/* draw all lines */
|
|
||||||
for (line = 0; line < 4; line++)
|
|
||||||
{
|
|
||||||
ui_draw_text_full(container, tempbuf[line], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
|
||||||
y1 += ui_get_line_height(machine());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
uimain.h
|
ui/miscmenu.h
|
||||||
|
|
||||||
Internal MAME menus for the user interface.
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
@ -11,46 +11,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __UIMAIN_H__
|
#ifndef __UI_MISCMENU_H__
|
||||||
#define __UIMAIN_H__
|
#define __UI_MISCMENU_H__
|
||||||
|
|
||||||
#include "crsshair.h"
|
#include "crsshair.h"
|
||||||
#include "drivenum.h"
|
#include "drivenum.h"
|
||||||
|
|
||||||
class ui_menu_main : public ui_menu {
|
|
||||||
public:
|
|
||||||
ui_menu_main(running_machine &machine, render_container *container);
|
|
||||||
virtual ~ui_menu_main();
|
|
||||||
virtual void populate();
|
|
||||||
virtual void handle();
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum {
|
|
||||||
INPUT_GROUPS,
|
|
||||||
INPUT_SPECIFIC,
|
|
||||||
SETTINGS_DIP_SWITCHES,
|
|
||||||
SETTINGS_DRIVER_CONFIG,
|
|
||||||
ANALOG,
|
|
||||||
BOOKKEEPING,
|
|
||||||
GAME_INFO,
|
|
||||||
IMAGE_MENU_IMAGE_INFO,
|
|
||||||
IMAGE_MENU_FILE_MANAGER,
|
|
||||||
MESS_MENU_TAPE_CONTROL,
|
|
||||||
MESS_MENU_BITBANGER_CONTROL,
|
|
||||||
SLOT_DEVICES,
|
|
||||||
NETWORK_DEVICES,
|
|
||||||
KEYBOARD_MODE,
|
|
||||||
SLIDERS,
|
|
||||||
VIDEO_TARGETS,
|
|
||||||
VIDEO_OPTIONS,
|
|
||||||
CROSSHAIR,
|
|
||||||
CHEAT,
|
|
||||||
MEMORY_CARD,
|
|
||||||
SELECT_GAME,
|
|
||||||
BIOS_SELECTION,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class ui_menu_keyboard_mode : public ui_menu {
|
class ui_menu_keyboard_mode : public ui_menu {
|
||||||
public:
|
public:
|
||||||
ui_menu_keyboard_mode(running_machine &machine, render_container *container);
|
ui_menu_keyboard_mode(running_machine &machine, render_container *container);
|
||||||
@ -344,30 +310,6 @@ public:
|
|||||||
virtual void handle();
|
virtual void handle();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ui_menu_select_game : public ui_menu {
|
|
||||||
public:
|
|
||||||
ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename);
|
|
||||||
virtual ~ui_menu_select_game();
|
|
||||||
virtual void populate();
|
|
||||||
virtual void handle();
|
|
||||||
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
|
||||||
|
|
||||||
// force game select menu
|
|
||||||
static void force_game_select(running_machine &machine, render_container *container);
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum { VISIBLE_GAMES_IN_LIST = 15 };
|
|
||||||
UINT8 error;
|
|
||||||
UINT8 rerandomize;
|
|
||||||
char search[40];
|
|
||||||
int matchlist[VISIBLE_GAMES_IN_LIST];
|
|
||||||
const game_driver **driverlist;
|
|
||||||
|
|
||||||
driver_enumerator *drivlist;
|
|
||||||
|
|
||||||
void build_driver_list();
|
|
||||||
};
|
|
||||||
|
|
||||||
class ui_menu_bios_selection : public ui_menu {
|
class ui_menu_bios_selection : public ui_menu {
|
||||||
public:
|
public:
|
||||||
ui_menu_bios_selection(running_machine &machine, render_container *container);
|
ui_menu_bios_selection(running_machine &machine, render_container *container);
|
||||||
@ -378,4 +320,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __UIMAIN_H__ */
|
#endif /* __UI_MISCMENU_H__ */
|
407
src/emu/ui/selgame.c
Normal file
407
src/emu/ui/selgame.c
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
|
||||||
|
selgame.c
|
||||||
|
|
||||||
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
|
Copyright Nicola Salmoria and the MAME Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "osdnet.h"
|
||||||
|
#include "emuopts.h"
|
||||||
|
#include "ui.h"
|
||||||
|
#include "rendutil.h"
|
||||||
|
#include "cheat.h"
|
||||||
|
#include "uiimage.h"
|
||||||
|
#include "uiinput.h"
|
||||||
|
#include "ui/selgame.h"
|
||||||
|
#include "ui/miscmenu.h"
|
||||||
|
#include "audit.h"
|
||||||
|
#include "crsshair.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
menu_select_game - handle the game select
|
||||||
|
menu
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_menu_select_game::handle()
|
||||||
|
{
|
||||||
|
/* ignore pause keys by swallowing them before we process the menu */
|
||||||
|
ui_input_pressed(machine(), IPT_UI_PAUSE);
|
||||||
|
|
||||||
|
/* process the menu */
|
||||||
|
const ui_menu_event *menu_event = process(0);
|
||||||
|
if (menu_event != NULL && menu_event->itemref != NULL)
|
||||||
|
{
|
||||||
|
/* reset the error on any future menu_event */
|
||||||
|
if (error)
|
||||||
|
error = false;
|
||||||
|
|
||||||
|
/* handle selections */
|
||||||
|
else if (menu_event->iptkey == IPT_UI_SELECT)
|
||||||
|
{
|
||||||
|
const game_driver *driver = (const game_driver *)menu_event->itemref;
|
||||||
|
|
||||||
|
/* special case for configure inputs */
|
||||||
|
if ((FPTR)driver == 1)
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
|
||||||
|
|
||||||
|
/* anything else is a driver */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// audit the game first to see if we're going to work
|
||||||
|
driver_enumerator enumerator(machine().options(), *driver);
|
||||||
|
enumerator.next();
|
||||||
|
media_auditor auditor(enumerator);
|
||||||
|
media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
|
||||||
|
|
||||||
|
// if everything looks good, schedule the new driver
|
||||||
|
if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE)
|
||||||
|
{
|
||||||
|
machine().schedule_new_driver(*driver);
|
||||||
|
ui_menu::stack_reset(machine());
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, display an error
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reset(UI_MENU_RESET_REMEMBER_REF);
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* escape pressed with non-empty text clears the text */
|
||||||
|
else if (menu_event->iptkey == IPT_UI_CANCEL && search[0] != 0)
|
||||||
|
{
|
||||||
|
/* since we have already been popped, we must recreate ourself from scratch */
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, NULL)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* typed characters append to the buffer */
|
||||||
|
else if (menu_event->iptkey == IPT_SPECIAL)
|
||||||
|
{
|
||||||
|
int buflen = strlen(search);
|
||||||
|
|
||||||
|
/* if it's a backspace and we can handle it, do so */
|
||||||
|
if ((menu_event->unichar == 8 || menu_event->unichar == 0x7f) && buflen > 0)
|
||||||
|
{
|
||||||
|
*(char *)utf8_previous_char(&search[buflen]) = 0;
|
||||||
|
rerandomize = true;
|
||||||
|
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if it's any other key and we're not maxed out, update */
|
||||||
|
else if (menu_event->unichar >= ' ' && menu_event->unichar < 0x7f)
|
||||||
|
{
|
||||||
|
buflen += utf8_from_uchar(&search[buflen], ARRAY_LENGTH(search) - buflen, menu_event->unichar);
|
||||||
|
search[buflen] = 0;
|
||||||
|
reset(UI_MENU_RESET_SELECT_FIRST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we're in an error state, overlay an error message */
|
||||||
|
if (error)
|
||||||
|
ui_draw_text_box(container,
|
||||||
|
"The selected game is missing one or more required ROM or CHD images. "
|
||||||
|
"Please select a different game.\n\nPress any key to continue.",
|
||||||
|
JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
menu_select_game_populate - populate the game
|
||||||
|
select menu
|
||||||
|
-------------------------------------------------*/
|
||||||
|
ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename) : ui_menu(machine, container)
|
||||||
|
{
|
||||||
|
driverlist = global_alloc_array(const game_driver *, driver_list::total()+1);
|
||||||
|
build_driver_list();
|
||||||
|
if(gamename)
|
||||||
|
strcpy(search, gamename);
|
||||||
|
matchlist[0] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_menu_select_game::populate()
|
||||||
|
{
|
||||||
|
int matchcount;
|
||||||
|
int curitem;
|
||||||
|
|
||||||
|
for (curitem = matchcount = 0; driverlist[curitem] != NULL && matchcount < VISIBLE_GAMES_IN_LIST; curitem++)
|
||||||
|
if (!(driverlist[curitem]->flags & GAME_NO_STANDALONE))
|
||||||
|
matchcount++;
|
||||||
|
|
||||||
|
/* if nothing there, add a single multiline item and return */
|
||||||
|
if (matchcount == 0)
|
||||||
|
{
|
||||||
|
astring txt;
|
||||||
|
txt.printf("No %s found. Please check the rompath specified in the %s.ini file.\n\n"
|
||||||
|
"If this is your first time using %s, please see the config.txt file in "
|
||||||
|
"the docs directory for information on configuring %s.",
|
||||||
|
emulator_info::get_gamesnoun(),
|
||||||
|
emulator_info::get_configname(),
|
||||||
|
emulator_info::get_appname(),emulator_info::get_appname() );
|
||||||
|
item_append(txt.cstr(), NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* otherwise, rebuild the match list */
|
||||||
|
assert(drivlist != NULL);
|
||||||
|
if (search[0] != 0 || matchlist[0] == -1 || rerandomize)
|
||||||
|
drivlist->find_approximate_matches(search, matchcount, matchlist);
|
||||||
|
rerandomize = false;
|
||||||
|
|
||||||
|
/* iterate over entries */
|
||||||
|
for (curitem = 0; curitem < matchcount; curitem++)
|
||||||
|
{
|
||||||
|
int curmatch = matchlist[curitem];
|
||||||
|
if (curmatch != -1)
|
||||||
|
{
|
||||||
|
int cloneof = drivlist->non_bios_clone(curmatch);
|
||||||
|
item_append(drivlist->driver(curmatch).name, drivlist->driver(curmatch).description, (cloneof == -1) ? 0 : MENU_FLAG_INVERT, (void *)&drivlist->driver(curmatch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we're forced into this, allow general input configuration as well */
|
||||||
|
if (ui_menu::stack_has_special_main_menu())
|
||||||
|
{
|
||||||
|
item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
|
||||||
|
item_append("Configure General Inputs", NULL, 0, (void *)1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* configure the custom rendering */
|
||||||
|
customtop = ui_get_line_height(machine()) + 3.0f * UI_BOX_TB_BORDER;
|
||||||
|
custombottom = 4.0f * ui_get_line_height(machine()) + 3.0f * UI_BOX_TB_BORDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_menu_select_game::~ui_menu_select_game()
|
||||||
|
{
|
||||||
|
global_free(drivlist);
|
||||||
|
global_free(driverlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
menu_select_game_build_driver_list - build a
|
||||||
|
list of available drivers
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_menu_select_game::build_driver_list()
|
||||||
|
{
|
||||||
|
// start with an empty list
|
||||||
|
drivlist = global_alloc(driver_enumerator(machine().options()));
|
||||||
|
drivlist->exclude_all();
|
||||||
|
|
||||||
|
/* open a path to the ROMs and find them in the array */
|
||||||
|
file_enumerator path(machine().options().media_path());
|
||||||
|
const osd_directory_entry *dir;
|
||||||
|
|
||||||
|
/* iterate while we get new objects */
|
||||||
|
while ((dir = path.next()) != NULL)
|
||||||
|
{
|
||||||
|
char drivername[50];
|
||||||
|
char *dst = drivername;
|
||||||
|
const char *src;
|
||||||
|
|
||||||
|
/* build a name for it */
|
||||||
|
for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++)
|
||||||
|
*dst++ = tolower((UINT8)*src);
|
||||||
|
*dst = 0;
|
||||||
|
|
||||||
|
int drivnum = drivlist->find(drivername);
|
||||||
|
if (drivnum != -1)
|
||||||
|
drivlist->include(drivnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now build the final list */
|
||||||
|
drivlist->reset();
|
||||||
|
int listnum = 0;
|
||||||
|
while (drivlist->next())
|
||||||
|
driverlist[listnum++] = &drivlist->driver();
|
||||||
|
|
||||||
|
/* NULL-terminate */
|
||||||
|
driverlist[listnum] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
menu_select_game_custom_render - perform our
|
||||||
|
special rendering
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_menu_select_game::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
|
||||||
|
{
|
||||||
|
const game_driver *driver;
|
||||||
|
float width, maxwidth;
|
||||||
|
float x1, y1, x2, y2;
|
||||||
|
astring tempbuf[5];
|
||||||
|
rgb_t color;
|
||||||
|
int line;
|
||||||
|
|
||||||
|
/* display the current typeahead */
|
||||||
|
if (search[0] != 0)
|
||||||
|
tempbuf[0].printf("Type name or select: %s_", search);
|
||||||
|
else
|
||||||
|
tempbuf[0].printf("Type name or select: (random)");
|
||||||
|
|
||||||
|
/* get the size of the text */
|
||||||
|
ui_draw_text_full(container, tempbuf[0], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||||
|
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
|
||||||
|
width += 2 * UI_BOX_LR_BORDER;
|
||||||
|
maxwidth = MAX(width, origx2 - origx1);
|
||||||
|
|
||||||
|
/* compute our bounds */
|
||||||
|
x1 = 0.5f - 0.5f * maxwidth;
|
||||||
|
x2 = x1 + maxwidth;
|
||||||
|
y1 = origy1 - top;
|
||||||
|
y2 = origy1 - UI_BOX_TB_BORDER;
|
||||||
|
|
||||||
|
/* draw a box */
|
||||||
|
ui_draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
/* take off the borders */
|
||||||
|
x1 += UI_BOX_LR_BORDER;
|
||||||
|
x2 -= UI_BOX_LR_BORDER;
|
||||||
|
y1 += UI_BOX_TB_BORDER;
|
||||||
|
y2 -= UI_BOX_TB_BORDER;
|
||||||
|
|
||||||
|
/* draw the text within it */
|
||||||
|
ui_draw_text_full(container, tempbuf[0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||||
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
||||||
|
|
||||||
|
/* determine the text to render below */
|
||||||
|
driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL;
|
||||||
|
if ((FPTR)driver > 1)
|
||||||
|
{
|
||||||
|
const char *gfxstat, *soundstat;
|
||||||
|
|
||||||
|
/* first line is game name */
|
||||||
|
tempbuf[0].printf("%-.100s", driver->description);
|
||||||
|
|
||||||
|
/* next line is year, manufacturer */
|
||||||
|
tempbuf[1].printf("%s, %-.100s", driver->year, driver->manufacturer);
|
||||||
|
|
||||||
|
/* next line source path */
|
||||||
|
tempbuf[2].printf("Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).cstr());
|
||||||
|
|
||||||
|
/* next line is overall driver status */
|
||||||
|
if (driver->flags & GAME_NOT_WORKING)
|
||||||
|
tempbuf[3].cpy("Overall: NOT WORKING");
|
||||||
|
else if (driver->flags & GAME_UNEMULATED_PROTECTION)
|
||||||
|
tempbuf[3].cpy("Overall: Unemulated Protection");
|
||||||
|
else
|
||||||
|
tempbuf[3].cpy("Overall: Working");
|
||||||
|
|
||||||
|
/* next line is graphics, sound status */
|
||||||
|
if (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS))
|
||||||
|
gfxstat = "Imperfect";
|
||||||
|
else
|
||||||
|
gfxstat = "OK";
|
||||||
|
|
||||||
|
if (driver->flags & GAME_NO_SOUND)
|
||||||
|
soundstat = "Unimplemented";
|
||||||
|
else if (driver->flags & GAME_IMPERFECT_SOUND)
|
||||||
|
soundstat = "Imperfect";
|
||||||
|
else
|
||||||
|
soundstat = "OK";
|
||||||
|
|
||||||
|
tempbuf[4].printf("Gfx: %s, Sound: %s", gfxstat, soundstat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *s = emulator_info::get_copyright();
|
||||||
|
line = 0;
|
||||||
|
|
||||||
|
/* first line is version string */
|
||||||
|
tempbuf[line++].printf("%s %s", emulator_info::get_applongname(), build_version);
|
||||||
|
|
||||||
|
/* output message */
|
||||||
|
while (line < ARRAY_LENGTH(tempbuf))
|
||||||
|
{
|
||||||
|
if (!(*s == 0 || *s == '\n'))
|
||||||
|
tempbuf[line].cat(*s);
|
||||||
|
|
||||||
|
if (*s == '\n')
|
||||||
|
{
|
||||||
|
line++;
|
||||||
|
s++;
|
||||||
|
} else if (*s != 0)
|
||||||
|
s++;
|
||||||
|
else
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the size of the text */
|
||||||
|
maxwidth = origx2 - origx1;
|
||||||
|
for (line = 0; line < 4; line++)
|
||||||
|
{
|
||||||
|
ui_draw_text_full(container, tempbuf[line], 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||||
|
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
|
||||||
|
width += 2 * UI_BOX_LR_BORDER;
|
||||||
|
maxwidth = MAX(maxwidth, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compute our bounds */
|
||||||
|
x1 = 0.5f - 0.5f * maxwidth;
|
||||||
|
x2 = x1 + maxwidth;
|
||||||
|
y1 = origy2 + UI_BOX_TB_BORDER;
|
||||||
|
y2 = origy2 + bottom;
|
||||||
|
|
||||||
|
/* draw a box */
|
||||||
|
color = UI_BACKGROUND_COLOR;
|
||||||
|
if (driver != NULL)
|
||||||
|
color = UI_GREEN_COLOR;
|
||||||
|
if (driver != NULL && (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_NO_SOUND | GAME_IMPERFECT_SOUND)) != 0)
|
||||||
|
color = UI_YELLOW_COLOR;
|
||||||
|
if (driver != NULL && (driver->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) != 0)
|
||||||
|
color = UI_RED_COLOR;
|
||||||
|
ui_draw_outlined_box(container, x1, y1, x2, y2, color);
|
||||||
|
|
||||||
|
/* take off the borders */
|
||||||
|
x1 += UI_BOX_LR_BORDER;
|
||||||
|
x2 -= UI_BOX_LR_BORDER;
|
||||||
|
y1 += UI_BOX_TB_BORDER;
|
||||||
|
y2 -= UI_BOX_TB_BORDER;
|
||||||
|
|
||||||
|
/* draw all lines */
|
||||||
|
for (line = 0; line < 4; line++)
|
||||||
|
{
|
||||||
|
ui_draw_text_full(container, tempbuf[line], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||||
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
|
||||||
|
y1 += ui_get_line_height(machine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
force_game_select - force the game
|
||||||
|
select menu to be visible and inescapable
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void ui_menu_select_game::force_game_select(running_machine &machine, render_container *container)
|
||||||
|
{
|
||||||
|
char *gamename = (char *)machine.options().system_name();
|
||||||
|
|
||||||
|
/* reset the menu stack */
|
||||||
|
ui_menu::stack_reset(machine);
|
||||||
|
|
||||||
|
/* add the quit entry followed by the game select entry */
|
||||||
|
ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container));
|
||||||
|
quit->set_special_main_menu(true);
|
||||||
|
ui_menu::stack_push(quit);
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_select_game(machine, container, gamename)));
|
||||||
|
|
||||||
|
/* force the menus on */
|
||||||
|
ui_show_menu();
|
||||||
|
|
||||||
|
/* make sure MAME is paused */
|
||||||
|
machine.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
44
src/emu/ui/selgame.h
Normal file
44
src/emu/ui/selgame.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ui/selgame.h
|
||||||
|
|
||||||
|
Internal MAME menus for the user interface.
|
||||||
|
|
||||||
|
Copyright Nicola Salmoria and the MAME Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __UI_SELGAME_H__
|
||||||
|
#define __UI_SELGAME_H__
|
||||||
|
|
||||||
|
#include "drivenum.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ui_menu_select_game : public ui_menu {
|
||||||
|
public:
|
||||||
|
ui_menu_select_game(running_machine &machine, render_container *container, const char *gamename);
|
||||||
|
virtual ~ui_menu_select_game();
|
||||||
|
virtual void populate();
|
||||||
|
virtual void handle();
|
||||||
|
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
|
||||||
|
|
||||||
|
// force game select menu
|
||||||
|
static void force_game_select(running_machine &machine, render_container *container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum { VISIBLE_GAMES_IN_LIST = 15 };
|
||||||
|
UINT8 error;
|
||||||
|
UINT8 rerandomize;
|
||||||
|
char search[40];
|
||||||
|
int matchlist[VISIBLE_GAMES_IN_LIST];
|
||||||
|
const game_driver **driverlist;
|
||||||
|
|
||||||
|
driver_enumerator *drivlist;
|
||||||
|
|
||||||
|
void build_driver_list();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __UI_SELGAME_H__ */
|
Loading…
Reference in New Issue
Block a user