Previous 199869 Revisions Next

r34256 Thursday 8th January, 2015 at 03:01:26 UTC by RealComboman
added outputs so artwork can display current gear settings
[src/emu/ui]devctrl.h mainmenu.c mainmenu.h tapectrl.c tapectrl.h
[src/mame/drivers]dragrace.c
[src/osd/sdl]sdl.mak

trunk/src/emu/ui/devctrl.h
r242767r242768
22
33    ui/devctrl.h
44
5    Device specific control menu
6    This source provides a base class for any device which need a specific
7    submenu and which can occur multiple times in the same driver (at the
8    moment, cassette tapes and barcode readers, in future possibly other like
9    printers)
10    The base class contains calls to get the total number of devices of
11    the same kind connected to the driver, and shortcuts to switch current
12    device to next one or previous one attached. This allows, for instance,
13    users to pass from a device to another one by simply pressing left/right
14    and the menu is rebuilt accordingly, without the need of a preliminary
15    submenu listing available devices of the same kind.
5    Device specific control (base class for tapectrl)
166
177    Copyright Nicola Salmoria and the MAME Team.
188    Visit http://mamedev.org for licensing and usage restrictions.
r242767r242768
3727   int current_index();
3828   void previous();
3929   void next();
40   astring current_display_name();
4130
4231private:
4332   // device iterator
r242767r242768
115104   }
116105}
117106
118
119//-------------------------------------------------
120//  current_display_name
121//-------------------------------------------------
122
123template<class _DeviceType>
124astring ui_menu_device_control<_DeviceType>::current_display_name()
125{
126   astring display_name;
127   display_name.cpy(current_device()->device().name());
128   if (count() > 1)
129   {
130      astring temp;
131      temp.printf(" %d", current_index() + 1);
132      display_name.cat(temp);
133   }
134   return display_name;
135}
136
137107#endif /* __UI_DEVCTRL_H__ */
trunk/src/emu/ui/mainmenu.c
r242767r242768
8484      /* add tape control menu */
8585      cassette_device_iterator cassiter(machine().root_device());
8686      if (cassiter.first() != NULL)
87         item_append("Tape Control", NULL, 0, (void *)TAPE_CONTROL);
87         item_append("Tape Control", NULL, 0, (void *)MESS_MENU_TAPE_CONTROL);
8888   }
8989
9090   if (machine().ioport().has_bioses())
r242767r242768
184184         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
185185         break;
186186
187      case TAPE_CONTROL:
188         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_tape_control(machine(), container, NULL)));
187      case MESS_MENU_TAPE_CONTROL:
188         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container, NULL)));
189189         break;
190190
191191      case SLOT_DEVICES:
trunk/src/emu/ui/mainmenu.h
r242767r242768
3535      GAME_INFO,
3636      IMAGE_MENU_IMAGE_INFO,
3737      IMAGE_MENU_FILE_MANAGER,
38      TAPE_CONTROL,
38      MESS_MENU_TAPE_CONTROL,
3939      SLOT_DEVICES,
4040      NETWORK_DEVICES,
4141      KEYBOARD_MODE,
trunk/src/emu/ui/tapectrl.c
r242767r242768
22
33    ui/tapectrl.c
44
5    Tape control
5    MESS's tape control
66
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
r242767r242768
1212#include "emu.h"
1313#include "ui/tapectrl.h"
1414
15
16
1517/***************************************************************************
1618    CONSTANTS
1719***************************************************************************/
r242767r242768
2123#define TAPECMD_PLAY            ((void *) 0x0002)
2224#define TAPECMD_RECORD          ((void *) 0x0003)
2325#define TAPECMD_REWIND          ((void *) 0x0004)
24#define TAPECMD_FAST_FORWARD    ((void *) 0x0005)
26#define TAPECMD_FAST_FORWARD        ((void *) 0x0005)
2527#define TAPECMD_SLIDER          ((void *) 0x0006)
2628#define TAPECMD_SELECT          ((void *) 0x0007)
2729
r242767r242768
3436//  ctor
3537//-------------------------------------------------
3638
37ui_menu_tape_control::ui_menu_tape_control(running_machine &machine, render_container *container, cassette_image_device *device)
39ui_menu_mess_tape_control::ui_menu_mess_tape_control(running_machine &machine, render_container *container, cassette_image_device *device)
3840   : ui_menu_device_control<cassette_image_device>(machine, container, device)
3941{
4042}
r242767r242768
4446//  dtor
4547//-------------------------------------------------
4648
47ui_menu_tape_control::~ui_menu_tape_control()
49ui_menu_mess_tape_control::~ui_menu_mess_tape_control()
4850{
4951}
5052
r242767r242768
5355//  populate - populates the main tape control menu
5456//-------------------------------------------------
5557
56void ui_menu_tape_control::populate()
58void ui_menu_mess_tape_control::populate()
5759{
60   astring timepos;
61   cassette_state state;
5862   UINT32 flags = 0;
5963
6064   if (count() > 1)
6165   {
62      if (current_index() == (count() - 1))
66      int index = current_index();
67
68      if( index == (count()-1) )
6369         flags |= MENU_FLAG_LEFT_ARROW;
6470      else
6571         flags |= MENU_FLAG_RIGHT_ARROW;
6672   }
6773
68   if (current_device())
69   {     
70      // name of tape
71      item_append(current_display_name().cstr(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", flags, TAPECMD_SELECT);
74   if ((current_device() != NULL) && (current_device()->exists()))
75   {
76      double t0, t1;
77      UINT32 tapeflags = 0;
7278
73      if (current_device()->exists())
79      t0 = current_device()->get_position();
80      t1 = current_device()->get_length();
81
82      if (t1 > 0)
7483      {
75         astring timepos;
76         cassette_state state;
77         double t0 = current_device()->get_position();
78         double t1 = current_device()->get_length();
79         UINT32 tapeflags = 0;
80         
81         // state
82         if (t1 > 0)
83         {
84            if (t0 > 0)
85               tapeflags |= MENU_FLAG_LEFT_ARROW;
86            if (t0 < t1)
87               tapeflags |= MENU_FLAG_RIGHT_ARROW;
88         }
89         
90         get_time_string(timepos, current_device(), NULL, NULL);
91         state = current_device()->get_state();
92         item_append(
93                  (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
94                  ?   "stopped"
95                  :   ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
96                      ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
97                      : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
98                      ),
99                  timepos,
100                  tapeflags,
101                  TAPECMD_SLIDER);
102         
103         // pause or stop
104         item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
105         
106         // play
107         item_append("Play", NULL, 0, TAPECMD_PLAY);
108         
109         // record
110         item_append("Record", NULL, 0, TAPECMD_RECORD);
111         
112         // rewind
113         item_append("Rewind", NULL, 0, TAPECMD_REWIND);
114         
115         // fast forward
116         item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
84         if (t0 > 0)
85            tapeflags |= MENU_FLAG_LEFT_ARROW;
86         if (t0 < t1)
87            tapeflags |= MENU_FLAG_RIGHT_ARROW;
11788      }
89
90      // name of tape
91      item_append(current_device()->device().name(), current_device()->filename(), flags, TAPECMD_SELECT);
92
93      // state
94      get_time_string(timepos, current_device(), NULL, NULL);
95      state = current_device()->get_state();
96      item_append(
97         (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
98            ?   "stopped"
99            :   ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
100               ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
101               : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
102               ),
103         timepos,
104         tapeflags,
105         TAPECMD_SLIDER);
106
107      // pause or stop
108      item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
109
110      // play
111      item_append("Play", NULL, 0, TAPECMD_PLAY);
112
113      // record
114      item_append("Record", NULL, 0, TAPECMD_RECORD);
115
116      // rewind
117      item_append("Rewind", NULL, 0, TAPECMD_REWIND);
118
119      // fast forward
120      item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
118121   }
122   else
123   {
124      // no tape loaded in this cassette device (but there could be more than one!)
125      if (count() > 1)
126         item_append("No Tape Image loaded", "", flags, TAPECMD_SELECT);
127      else
128         item_append("No Tape Image loaded", NULL, 0, NULL);
129   }
119130}
120131
121132
r242767r242768
123134//  handle - main tape control menu
124135//-------------------------------------------------
125136
126void ui_menu_tape_control::handle()
137void ui_menu_mess_tape_control::handle()
127138{
128139   // rebuild the menu - we have to do this so that the counter updates
129140   reset(UI_MENU_RESET_REMEMBER_POSITION);
r242767r242768
136147      switch(event->iptkey)
137148      {
138149         case IPT_UI_LEFT:
139            if (event->itemref == TAPECMD_SLIDER)
150            if (event->itemref==TAPECMD_SLIDER)
140151               current_device()->seek(-1, SEEK_CUR);
141            else if (event->itemref == TAPECMD_SELECT)
152            else if (event->itemref==TAPECMD_SELECT)
142153               previous();
143154            break;
144155
145156         case IPT_UI_RIGHT:
146            if (event->itemref == TAPECMD_SLIDER)
157            if (event->itemref==TAPECMD_SLIDER)
147158               current_device()->seek(+1, SEEK_CUR);
148            else if (event->itemref == TAPECMD_SELECT)
159            else if (event->itemref==TAPECMD_SELECT)
149160               next();
150161            break;
151162
152163         case IPT_UI_SELECT:
153            if (event->itemref == TAPECMD_STOP)
154               current_device()->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
155            else if (event->itemref == TAPECMD_PLAY)
156               current_device()->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
157            else if (event->itemref == TAPECMD_RECORD)
158               current_device()->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
159            else if (event->itemref == TAPECMD_REWIND)
160               current_device()->seek(-30, SEEK_CUR);
161            else if (event->itemref == TAPECMD_FAST_FORWARD)
162               current_device()->seek(30, SEEK_CUR);
163            else if (event->itemref == TAPECMD_SLIDER)
164               current_device()->seek(0, SEEK_SET);
164            {
165               if (event->itemref==TAPECMD_STOP)
166                  current_device()->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
167               else if (event->itemref==TAPECMD_PLAY)
168                  current_device()->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
169               else if (event->itemref==TAPECMD_RECORD)
170                  current_device()->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
171               else if (event->itemref==TAPECMD_REWIND)
172                  current_device()->seek(-30, SEEK_CUR);
173               else if (event->itemref==TAPECMD_FAST_FORWARD)
174                  current_device()->seek(30, SEEK_CUR);
175               else if (event->itemref==TAPECMD_SLIDER)
176                  current_device()->seek(0, SEEK_SET);
177            }
165178            break;
166179      }
167180   }
r242767r242768
173186//  representation of the time
174187//-------------------------------------------------
175188
176void ui_menu_tape_control::get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos)
189void ui_menu_mess_tape_control::get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos)
177190{
178191   double t0, t1;
179192
trunk/src/emu/ui/tapectrl.h
r242767r242768
22
33    ui/tapectrl.h
44
5    Tape control
5    MESS's tape control
66
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
r242767r242768
1717#include "imagedev/cassette.h"
1818#include "ui/devctrl.h"
1919
20class ui_menu_tape_control : public ui_menu_device_control<cassette_image_device> {
20class ui_menu_mess_tape_control : public ui_menu_device_control<cassette_image_device> {
2121public:
22   ui_menu_tape_control(running_machine &machine, render_container *container, cassette_image_device *device);
23   virtual ~ui_menu_tape_control();
22   ui_menu_mess_tape_control(running_machine &machine, render_container *container, cassette_image_device *device);
23   virtual ~ui_menu_mess_tape_control();
2424   virtual void populate();
2525   virtual void handle();
2626
trunk/src/mame/drivers/dragrace.c
r242767r242768
2727         case 0x10: m_gear[i] = 0; break;
2828      }
2929   }
30   output_set_value("P1gear", m_gear[0]);
31   output_set_value("P2gear", m_gear[1]);
3032
3133   /* watchdog is disabled during service mode */
3234   machine().watchdog_enable(ioport("IN0")->read() & 0x20);
trunk/src/osd/sdl/sdl.mak
r242767r242768
657657endif
658658
659659ifeq ($(SDL_LIBVER),sdl2)
660LIBS += -lSDL2 -limm32 -lversion -lole32 -loleaut32 -lws2_32 -static
661BASELIBS += -limm32 -lversion -lole32 -loleaut32 -lws2_32 -static
660LIBS += -lSDL2 -lImm32 -lversion -lole32 -loleaut32 -static
661BASELIBS += -lImm32 -lversion -lole32 -loleaut32 -static
662662else
663663LIBS += -lSDL -static
664664endif


Previous 199869 Revisions Next


© 1997-2024 The MAME Team