Merge branch 'master' of ssh://mess.org/mame

This commit is contained in:
Nathan Woods 2014-01-19 16:26:06 +00:00
commit 23618e712c
11 changed files with 282 additions and 241 deletions

6
.gitattributes vendored
View File

@ -2505,6 +2505,8 @@ src/emu/timer.c svneol=native#text/plain
src/emu/timer.h svneol=native#text/plain
src/emu/ui.c svneol=native#text/plain
src/emu/ui.h svneol=native#text/plain
src/emu/ui/filemngr.c svneol=native#text/plain
src/emu/ui/filemngr.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
@ -2513,10 +2515,10 @@ 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/ui/tapectrl.c svneol=native#text/plain
src/emu/ui/tapectrl.h svneol=native#text/plain
src/emu/uigfx.c svneol=native#text/plain
src/emu/uigfx.h svneol=native#text/plain
src/emu/uiimage.c svneol=native#text/plain
src/emu/uiimage.h svneol=native#text/plain
src/emu/uiinput.c svneol=native#text/plain
src/emu/uiinput.h svneol=native#text/plain
src/emu/uismall.png -text svneol=unset#image/png

View File

@ -13,7 +13,7 @@
#include "drivenum.h"
#include "ui.h"
#include "zippath.h"
#include "uiimage.h"
#include "ui/filemngr.h"
#include "uiswlist.h"
//**************************************************************************

View File

@ -143,13 +143,14 @@ EMUOBJS = \
$(EMUOBJ)/timer.o \
$(EMUOBJ)/ui.o \
$(EMUOBJ)/uigfx.o \
$(EMUOBJ)/uiimage.o \
$(EMUOBJ)/uiinput.o \
$(EMUOBJ)/uiswlist.o \
$(EMUOBJ)/ui/menu.o \
$(EMUOBJ)/ui/mainmenu.o \
$(EMUOBJ)/ui/miscmenu.o \
$(EMUOBJ)/ui/selgame.o \
$(EMUOBJ)/ui/filemngr.o \
$(EMUOBJ)/ui/tapectrl.o \
$(EMUOBJ)/validity.o \
$(EMUOBJ)/video.o \
$(EMUOBJ)/debug/debugcmd.o \

View File

@ -9,7 +9,7 @@
#include "zippath.h"
#include "floppy.h"
#include "formats/imageutl.h"
#include "uiimage.h"
#include "ui/filemngr.h"
// device type definition

View File

@ -1,6 +1,6 @@
/*********************************************************************
filemngr.c
ui/filemngr.c
MESS's clunky built-in file manager
@ -20,7 +20,7 @@
#include "emu.h"
#include "ui.h"
#include "uiswlist.h"
#include "uiimage.h"
#include "ui/filemngr.h"
#include "zippath.h"
#include "imagedev/floppy.h"
#include "imagedev/cassette.h"
@ -961,14 +961,6 @@ void ui_menu_select_rw::handle()
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
#define TAPECMD_NULL ((void *) 0x0000)
#define TAPECMD_STOP ((void *) 0x0001)
#define TAPECMD_PLAY ((void *) 0x0002)
#define TAPECMD_RECORD ((void *) 0x0003)
#define TAPECMD_REWIND ((void *) 0x0004)
#define TAPECMD_FAST_FORWARD ((void *) 0x0005)
#define TAPECMD_SLIDER ((void *) 0x0006)
#define TAPECMD_SELECT ((void *) 0x0007)
#define BITBANGERCMD_SELECT ((void *) 0x0000)
#define BITBANGERCMD_MODE ((void *) 0x0001)
@ -980,14 +972,6 @@ void ui_menu_select_rw::handle()
IMPLEMENTATION
***************************************************************************/
ui_menu_mess_tape_control::ui_menu_mess_tape_control(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
ui_menu_mess_tape_control::~ui_menu_mess_tape_control()
{
}
ui_menu_mess_bitbanger_control::ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
@ -996,17 +980,6 @@ ui_menu_mess_bitbanger_control::~ui_menu_mess_bitbanger_control()
{
}
/*-------------------------------------------------
cassette_count - returns the number of cassette
devices in the machine
-------------------------------------------------*/
int ui_menu_mess_tape_control::cassette_count()
{
cassette_device_iterator iter(machine().root_device());
return iter.count();
}
/*-------------------------------------------------
bitbanger_count - returns the number of bitbanger
devices in the machine
@ -1018,110 +991,6 @@ int ui_menu_mess_bitbanger_control::bitbanger_count()
return iter.count();
}
/*-------------------------------------------------
tapecontrol_gettime - returns a textual
representation of the time
-------------------------------------------------*/
astring &tapecontrol_gettime(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos)
{
double t0, t1;
t0 = cassette->get_position();
t1 = cassette->get_length();
if (t1)
dest.printf("%04d/%04d", (int) t0, (int) t1);
else
dest.printf("%04d/%04d", 0, (int) t1);
if (curpos != NULL)
*curpos = t0;
if (endpos != NULL)
*endpos = t1;
return dest;
}
/*-------------------------------------------------
menu_tape_control_populate - populates the
main tape control menu
-------------------------------------------------*/
void ui_menu_mess_tape_control::populate()
{
astring timepos;
cassette_state state;
int count = cassette_count();
UINT32 flags = 0;
if( count > 0 )
{
if( index == (count-1) )
flags |= MENU_FLAG_LEFT_ARROW;
else
flags |= MENU_FLAG_RIGHT_ARROW;
}
if ((device != NULL) && (device->exists()))
{
double t0, t1;
UINT32 tapeflags = 0;
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
t0 = cassette->get_position();
t1 = cassette->get_length();
if (t1 > 0)
{
if (t0 > 0)
tapeflags |= MENU_FLAG_LEFT_ARROW;
if (t0 < t1)
tapeflags |= MENU_FLAG_RIGHT_ARROW;
}
/* name of tape */
item_append(device->device().name(), device->filename(), flags, TAPECMD_SELECT);
/* state */
tapecontrol_gettime(timepos, cassette, NULL, NULL);
state = cassette->get_state();
item_append(
(state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
? "stopped"
: ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
: ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
),
timepos,
tapeflags,
TAPECMD_SLIDER);
/* pause or stop */
item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
/* play */
item_append("Play", NULL, 0, TAPECMD_PLAY);
/* record */
item_append("Record", NULL, 0, TAPECMD_RECORD);
/* rewind */
item_append("Rewind", NULL, 0, TAPECMD_REWIND);
/* fast forward */
item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
}
else
{
/* no tape loaded */
item_append("No Tape Image loaded", NULL, flags, NULL);
}
}
/*-------------------------------------------------
menu_bitbanger_control_populate - populates the
main bitbanger control menu
@ -1177,88 +1046,6 @@ void ui_menu_mess_bitbanger_control::populate()
}
/*-------------------------------------------------
menu_tape_control - main tape control menu
-------------------------------------------------*/
void ui_menu_mess_tape_control::handle()
{
/* do we have to load the device? */
if (device == NULL)
{
cassette_device_iterator iter(machine().root_device());
device = iter.byindex(index);
reset((ui_menu_reset_options)0);
}
/* rebuild the menu - we have to do this so that the counter updates */
reset(UI_MENU_RESET_REMEMBER_POSITION);
populate();
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
/* process the menu */
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
if (event != NULL)
{
switch(event->iptkey)
{
case IPT_UI_LEFT:
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(-1, SEEK_CUR);
else
if (event->itemref==TAPECMD_SELECT)
{
/* left arrow - rotate left through cassette devices */
if (index > 0)
index--;
else
index = cassette_count() - 1;
device = NULL;
}
break;
case IPT_UI_RIGHT:
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(+1, SEEK_CUR);
else
if (event->itemref==TAPECMD_SELECT)
{
/* right arrow - rotate right through cassette devices */
if (index < cassette_count() - 1)
index++;
else
index = 0;
device = NULL;
}
break;
case IPT_UI_SELECT:
{
if (event->itemref==TAPECMD_STOP)
cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_PLAY)
cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_RECORD)
cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_REWIND)
cassette->seek(-30, SEEK_CUR);
else
if (event->itemref==TAPECMD_FAST_FORWARD)
cassette->seek(30, SEEK_CUR);
else
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(0, SEEK_SET);
}
break;
}
}
}
/*-------------------------------------------------
menu_bitbanger_control - main bitbanger
control menu

View File

@ -1,8 +1,8 @@
/***************************************************************************
uiimage.h
ui/filemngr.h
Internal MAME user interface image.
MESS's clunky built-in file manager
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
@ -11,8 +11,8 @@
#pragma once
#ifndef __UIIMAGE_H__
#define __UIIMAGE_H__
#ifndef __UI_FILEMNGR_H__
#define __UI_FILEMNGR_H__
class ui_menu_image_info : public ui_menu {
public:
@ -35,19 +35,6 @@ public:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
};
class ui_menu_mess_tape_control : public ui_menu {
public:
ui_menu_mess_tape_control(running_machine &machine, render_container *container);
virtual ~ui_menu_mess_tape_control();
virtual void populate();
virtual void handle();
private:
int index;
device_image_interface *device;
int cassette_count();
};
class ui_menu_mess_bitbanger_control : public ui_menu {
public:
ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container);
@ -157,4 +144,4 @@ private:
int *result;
};
#endif /* __UIIMAGE_H__ */
#endif /* __UI_FILEMNGR_H__ */

View File

@ -15,8 +15,9 @@
#include "ui.h"
#include "rendutil.h"
#include "cheat.h"
#include "uiimage.h"
#include "uiinput.h"
#include "ui/filemngr.h"
#include "ui/tapectrl.h"
#include "ui/mainmenu.h"
#include "ui/miscmenu.h"
#include "ui/selgame.h"

View File

@ -15,8 +15,8 @@
#include "ui.h"
#include "rendutil.h"
#include "cheat.h"
#include "uiimage.h"
#include "uiinput.h"
#include "ui/filemngr.h"
#include "ui/miscmenu.h"
#include "audit.h"
#include "crsshair.h"

View File

@ -15,8 +15,8 @@
#include "ui.h"
#include "rendutil.h"
#include "cheat.h"
#include "uiimage.h"
#include "uiinput.h"
#include "ui/filemngr.h"
#include "ui/selgame.h"
#include "ui/miscmenu.h"
#include "audit.h"

229
src/emu/ui/tapectrl.c Normal file
View File

@ -0,0 +1,229 @@
/***************************************************************************
ui/tapectrl.c
MESS's tape control
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#include "emu.h"
#include "ui/tapectrl.h"
#define TAPECMD_NULL ((void *) 0x0000)
#define TAPECMD_STOP ((void *) 0x0001)
#define TAPECMD_PLAY ((void *) 0x0002)
#define TAPECMD_RECORD ((void *) 0x0003)
#define TAPECMD_REWIND ((void *) 0x0004)
#define TAPECMD_FAST_FORWARD ((void *) 0x0005)
#define TAPECMD_SLIDER ((void *) 0x0006)
#define TAPECMD_SELECT ((void *) 0x0007)
ui_menu_mess_tape_control::ui_menu_mess_tape_control(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
ui_menu_mess_tape_control::~ui_menu_mess_tape_control()
{
}
/*-------------------------------------------------
cassette_count - returns the number of cassette
devices in the machine
-------------------------------------------------*/
int ui_menu_mess_tape_control::cassette_count()
{
cassette_device_iterator iter(machine().root_device());
return iter.count();
}
/*-------------------------------------------------
menu_tape_control_populate - populates the
main tape control menu
-------------------------------------------------*/
void ui_menu_mess_tape_control::populate()
{
astring timepos;
cassette_state state;
int count = cassette_count();
UINT32 flags = 0;
if( count > 0 )
{
if( index == (count-1) )
flags |= MENU_FLAG_LEFT_ARROW;
else
flags |= MENU_FLAG_RIGHT_ARROW;
}
if ((device != NULL) && (device->exists()))
{
double t0, t1;
UINT32 tapeflags = 0;
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
t0 = cassette->get_position();
t1 = cassette->get_length();
if (t1 > 0)
{
if (t0 > 0)
tapeflags |= MENU_FLAG_LEFT_ARROW;
if (t0 < t1)
tapeflags |= MENU_FLAG_RIGHT_ARROW;
}
/* name of tape */
item_append(device->device().name(), device->filename(), flags, TAPECMD_SELECT);
/* state */
tapecontrol_gettime(timepos, cassette, NULL, NULL);
state = cassette->get_state();
item_append(
(state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
? "stopped"
: ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
: ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
),
timepos,
tapeflags,
TAPECMD_SLIDER);
/* pause or stop */
item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
/* play */
item_append("Play", NULL, 0, TAPECMD_PLAY);
/* record */
item_append("Record", NULL, 0, TAPECMD_RECORD);
/* rewind */
item_append("Rewind", NULL, 0, TAPECMD_REWIND);
/* fast forward */
item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
}
else
{
/* no tape loaded */
item_append("No Tape Image loaded", NULL, flags, NULL);
}
}
/*-------------------------------------------------
menu_tape_control - main tape control menu
-------------------------------------------------*/
void ui_menu_mess_tape_control::handle()
{
/* do we have to load the device? */
if (device == NULL)
{
cassette_device_iterator iter(machine().root_device());
device = iter.byindex(index);
reset((ui_menu_reset_options)0);
}
/* rebuild the menu - we have to do this so that the counter updates */
reset(UI_MENU_RESET_REMEMBER_POSITION);
populate();
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
/* process the menu */
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
if (event != NULL)
{
switch(event->iptkey)
{
case IPT_UI_LEFT:
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(-1, SEEK_CUR);
else
if (event->itemref==TAPECMD_SELECT)
{
/* left arrow - rotate left through cassette devices */
if (index > 0)
index--;
else
index = cassette_count() - 1;
device = NULL;
}
break;
case IPT_UI_RIGHT:
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(+1, SEEK_CUR);
else
if (event->itemref==TAPECMD_SELECT)
{
/* right arrow - rotate right through cassette devices */
if (index < cassette_count() - 1)
index++;
else
index = 0;
device = NULL;
}
break;
case IPT_UI_SELECT:
{
if (event->itemref==TAPECMD_STOP)
cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_PLAY)
cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_RECORD)
cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
else
if (event->itemref==TAPECMD_REWIND)
cassette->seek(-30, SEEK_CUR);
else
if (event->itemref==TAPECMD_FAST_FORWARD)
cassette->seek(30, SEEK_CUR);
else
if (event->itemref==TAPECMD_SLIDER)
cassette->seek(0, SEEK_SET);
}
break;
}
}
}
/*-------------------------------------------------
tapecontrol_gettime - returns a textual
representation of the time
-------------------------------------------------*/
astring &ui_menu_mess_tape_control::tapecontrol_gettime(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos)
{
double t0, t1;
t0 = cassette->get_position();
t1 = cassette->get_length();
if (t1)
dest.printf("%04d/%04d", (int) t0, (int) t1);
else
dest.printf("%04d/%04d", 0, (int) t1);
if (curpos != NULL)
*curpos = t0;
if (endpos != NULL)
*endpos = t1;
return dest;
}

34
src/emu/ui/tapectrl.h Normal file
View File

@ -0,0 +1,34 @@
/***************************************************************************
ui/tapectrl.h
MESS's tape control
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __UI_TAPECTRL_H__
#define __UI_TAPECTRL_H__
#include "imagedev/cassette.h"
class ui_menu_mess_tape_control : public ui_menu {
public:
ui_menu_mess_tape_control(running_machine &machine, render_container *container);
virtual ~ui_menu_mess_tape_control();
virtual void populate();
virtual void handle();
private:
int index;
device_image_interface *device;
int cassette_count();
static astring &tapecontrol_gettime(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos);
};
#endif /* __UI_TAPECTRL_H__ */