src/mess/uimess.c
| r2955 | r2956 | |
| 12 | 12 | #include "uimess.h" |
| 13 | 13 | #include "input.h" |
| 14 | 14 | |
| 15 | | //int mess_pause_for_ui = 0; |
| 15 | |
| 16 | /*************************************************************************** |
| 17 | LOCAL VARIABLES |
| 18 | ***************************************************************************/ |
| 19 | |
| 16 | 20 | static int ui_active = 0; |
| 17 | 21 | |
| 22 | |
| 23 | |
| 24 | /*************************************************************************** |
| 25 | IMPLEMENTATION |
| 26 | ***************************************************************************/ |
| 27 | |
| 18 | 28 | int mess_ui_active(void) |
| 19 | 29 | { |
| 20 | 30 | return ui_active; |
| r2955 | r2956 | |
| 160 | 170 | |
| 161 | 171 | |
| 162 | 172 | |
| 173 | /*------------------------------------------------- |
| 174 | ui_menu_image_info - menu that shows info on |
| 175 | all loaded images |
| 176 | -------------------------------------------------*/ |
| 177 | |
| 163 | 178 | UINT32 ui_menu_image_info(running_machine *machine, UINT32 state) |
| 164 | 179 | { |
| 165 | 180 | char buf[2048]; |
| r2955 | r2956 | |
| 182 | 197 | |
| 183 | 198 | |
| 184 | 199 | |
| 200 | /*------------------------------------------------- |
| 201 | mess_use_new_ui - determines if the "new ui" |
| 202 | is in use |
| 203 | -------------------------------------------------*/ |
| 204 | |
| 185 | 205 | int mess_use_new_ui(void) |
| 186 | 206 | { |
| 187 | 207 | #if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32) |
| r2955 | r2956 | |
| 193 | 213 | |
| 194 | 214 | |
| 195 | 215 | |
| 216 | /*------------------------------------------------- |
| 217 | mess_disable_builtin_ui - function to determine |
| 218 | if the builtin UI should be disabled |
| 219 | -------------------------------------------------*/ |
| 220 | |
| 196 | 221 | int mess_disable_builtin_ui(running_machine *machine) |
| 197 | 222 | { |
| 198 | 223 | return mess_use_new_ui() || ((machine->gamedrv->flags & GAME_COMPUTER) && !mess_ui_active()); |
src/mess/uimess.h
| r2955 | r2956 | |
| 10 | 10 | #define UIMESS_H |
| 11 | 11 | |
| 12 | 12 | #include "ui.h" |
| 13 | #include "uimenu.h" |
| 13 | 14 | |
| 14 | 15 | int mess_ui_active(void); |
| 15 | 16 | void mess_ui_update(running_machine *machine); |
| r2955 | r2956 | |
| 25 | 26 | |
| 26 | 27 | /* tape control */ |
| 27 | 28 | UINT32 menu_tape_control(running_machine *machine, UINT32 state); |
| 28 | | void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos); |
| 29 | astring *tapecontrol_gettime(astring *dest, const device_config *device, int *curpos, int *endpos); |
| 29 | 30 | |
| 30 | 31 | /* paste */ |
| 31 | 32 | void ui_paste(running_machine *machine); |
src/mess/tapectrl.c
| r2955 | r2956 | |
| 19 | 19 | IMPLEMENTATION |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | |
| 22 | | void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos) |
| 22 | /*------------------------------------------------- |
| 23 | tapecontrol_gettime - returns a textual |
| 24 | representation of the time |
| 25 | -------------------------------------------------*/ |
| 26 | |
| 27 | astring *tapecontrol_gettime(astring *dest, const device_config *device, int *curpos, int *endpos) |
| 23 | 28 | { |
| 24 | 29 | double t0, t1; |
| 25 | 30 | |
| 26 | | t0 = cassette_get_position(img); |
| 27 | | t1 = cassette_get_length(img); |
| 31 | t0 = cassette_get_position(device); |
| 32 | t1 = cassette_get_length(device); |
| 28 | 33 | |
| 29 | 34 | if (t1) |
| 30 | | snprintf(timepos, timepos_size, "%04d/%04d", (int) t0, (int) t1); |
| 35 | astring_printf(dest, "%04d/%04d", (int) t0, (int) t1); |
| 31 | 36 | else |
| 32 | | snprintf(timepos, timepos_size, "%04d/%04d", 0, (int) t1); |
| 37 | astring_printf(dest, "%04d/%04d", 0, (int) t1); |
| 33 | 38 | |
| 34 | | if (curpos) |
| 39 | if (curpos != NULL) |
| 35 | 40 | *curpos = t0; |
| 36 | | if (endpos) |
| 41 | if (endpos != NULL) |
| 37 | 42 | *endpos = t1; |
| 43 | |
| 44 | return dest; |
| 38 | 45 | } |
| 39 | 46 | |
| 47 | |
| 48 | |
| 40 | 49 | static int tapecontrol(running_machine *machine, int selected) |
| 41 | 50 | { |
| 42 | 51 | static int id = 0; |
| 43 | | char timepos[32]; |
| 52 | astring *timepos = astring_alloc(); |
| 44 | 53 | ui_menu_item menu_item[40]; |
| 45 | 54 | char name[64]; |
| 46 | 55 | const device_config *img; |
| r2955 | r2956 | |
| 78 | 87 | menu_item[total].flags = 0; |
| 79 | 88 | total++; |
| 80 | 89 | |
| 81 | | tapecontrol_gettime(timepos, sizeof(timepos) / sizeof(timepos[0]), img, NULL, NULL); |
| 90 | tapecontrol_gettime(timepos, img, NULL, NULL); |
| 82 | 91 | |
| 83 | 92 | state = cassette_get_state(img); |
| 84 | 93 | menu_item[total].text = |
| r2955 | r2956 | |
| 90 | 99 | : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_recording : UI_recording_inhibited) |
| 91 | 100 | )); |
| 92 | 101 | |
| 93 | | menu_item[total].subtext = timepos; |
| 102 | menu_item[total].subtext = astring_c(timepos); |
| 94 | 103 | menu_item[total].flags = 0; |
| 95 | 104 | total++; |
| 96 | 105 | |
| r2955 | r2956 | |
| 214 | 223 | if (input_ui_pressed(machine, IPT_UI_CONFIGURE)) |
| 215 | 224 | sel = -2; |
| 216 | 225 | |
| 226 | astring_free(timepos); |
| 217 | 227 | return sel + 1; |
| 218 | 228 | } |
| 219 | 229 | |
| 220 | 230 | |
| 221 | 231 | /*------------------------------------------------- |
| 222 | | menu_tape_control - MESS-specific menu |
| 232 | menu_tape_control - main tape control menu |
| 223 | 233 | -------------------------------------------------*/ |
| 224 | 234 | |
| 225 | 235 | UINT32 menu_tape_control(running_machine *machine, UINT32 state) |
src/mess/osd/windows/tapedlg.c
| r2955 | r2956 | |
| 60 | 60 | struct tape_dialog *dlg; |
| 61 | 61 | int id; |
| 62 | 62 | int curpos, endpos; |
| 63 | | char tapestatus[32]; |
| 63 | astring *tapestatus = astring_alloc(); |
| 64 | 64 | const device_config *img; |
| 65 | 65 | |
| 66 | 66 | dlg = get_tapedialog(dialog); |
| r2955 | r2956 | |
| 68 | 68 | |
| 69 | 69 | img = image_from_devtype_and_index(IO_CASSETTE, id); |
| 70 | 70 | |
| 71 | | tapecontrol_gettime(tapestatus, sizeof(tapestatus) / sizeof(tapestatus[0]), |
| 72 | | img, &curpos, &endpos); |
| 71 | tapecontrol_gettime(tapestatus, img, &curpos, &endpos); |
| 73 | 72 | |
| 74 | 73 | SendMessage(dlg->slider, TBM_SETRANGEMIN, FALSE, 0); |
| 75 | 74 | SendMessage(dlg->slider, TBM_SETRANGEMAX, FALSE, endpos); |
| 76 | 75 | SendMessage(dlg->slider, TBM_SETPOS, TRUE, curpos); |
| 77 | 76 | |
| 78 | | win_set_window_text_utf8(dlg->status, tapestatus); |
| 77 | win_set_window_text_utf8(dlg->status, astring_c(tapestatus)); |
| 78 | |
| 79 | astring_free(tapestatus); |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | //============================================================ |