Previous 15994 Revisions Next

r2536 Sunday 4th May, 2008 at 14:05:56 UTC by Nathan Woods
1. Shift+ScrollLock now triggers a paste command.

2. New MESS specific OSD call: osd_get_clipboard_text()
[docs]messnew.txt
[src/emu]inptport.c inptport.h ui.c
[src/mess]osdmess.h uimess.c uimess.h
[src/mess/osd/windows]menu.c winmess.c
[src/mess/tools/messtest]tststubs.c

src/emu/inptport.c
r2535r2536
980980   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_ROTATE,           "UI Rotate",         SEQ_DEF_1(KEYCODE_R) )
981981   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_SHOW_PROFILER,    "Show Profiler",      SEQ_DEF_2(KEYCODE_F11, KEYCODE_LSHIFT) )
982982#ifdef MESS
983   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_TOGGLE_UI,        "UI Toggle",         SEQ_DEF_1(KEYCODE_SCRLOCK) )
984#endif
983   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_TOGGLE_UI,        "UI Toggle",         SEQ_DEF_3(KEYCODE_SCRLOCK, SEQCODE_NOT, KEYCODE_LSHIFT) )
984   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_PASTE,          "UI Paste Text",      SEQ_DEF_2(KEYCODE_SCRLOCK, KEYCODE_LSHIFT) )
985#endif /* MESS */
985986   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_TOGGLE_DEBUG,     "Toggle Debugger",      SEQ_DEF_1(KEYCODE_F5) )
986987   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_SAVE_STATE,       "Save State",         SEQ_DEF_2(KEYCODE_F7, KEYCODE_LSHIFT) )
987988   INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_LOAD_STATE,       "Load State",         SEQ_DEF_3(KEYCODE_F7, SEQCODE_NOT, KEYCODE_LSHIFT) )
src/emu/inptport.h
r2535r2536
317317   /* special meaning handled by custom code */
318318   IPT_SPECIAL,
319319
320#ifdef MESS
321   IPT_UI_PASTE,
322#endif /* MESS */
323
320324   __ipt_max
321325};
322326
src/emu/ui.c
r2535r2536
13841384   else
13851385      video_set_fastforward(FALSE);
13861386
1387#ifdef MESS
1388   /* paste? */
1389   if (input_ui_pressed(IPT_UI_PASTE))
1390      ui_paste(machine);
1391#endif /* MESS */
1392
13871393   return 0;
13881394}
13891395
src/mess/uimess.c
r2535r2536
198198{
199199   return mess_use_new_ui() || ((machine->gamedrv->flags & GAME_COMPUTER) && !mess_ui_active());
200200}
201
202
203
204/*-------------------------------------------------
205    ui_paste - does a paste from the keyboard
206-------------------------------------------------*/
207
208void ui_paste(running_machine *machine)
209{
210   /* retrieve the clipboard text */
211   char *text = osd_get_clipboard_text();
212
213   /* was a result returned? */
214   if (text != NULL)
215   {
216      /* post the text */
217      inputx_post_utf8(text);
218
219      /* free the string */
220      free(text);
221   }
222}
src/mess/uimess.h
r2535r2536
2626/* tape control */
2727int tapecontrol(int selected);
2828
29/* paste */
30void ui_paste(running_machine *machine);
31
2932#endif /* UIMESS_H */
src/mess/tools/messtest/tststubs.c
r2535r2536
1010#include "debug/debugcpu.h"
1111#endif /* ENABLE_DEBUGGER */
1212
13#ifdef UNUSED_FUNCTION
14int osd_create_display(const osd_create_params *params, UINT32 *rgb_components)
15{
16   rgb_components[0] = 0xff0000;
17   rgb_components[1] = 0x00ff00;
18   rgb_components[2] = 0x0000ff;
19   return 0;
20}
21
22void osd_close_display(void)
23{
24}
25
26int osd_skip_this_frame(void)
27{
28   return 0;
29}
30
31bitmap_t *osd_override_snapshot(bitmap_t *bitmap, rectangle *bounds)
32{
33   return NULL;
34}
35#endif
36
3713void osd_set_mastervolume(int attenuation)
3814{
3915}
4016
41#ifdef UNUSED_FUNCTION
42int osd_get_mastervolume(void)
43{
44   return 0;
45}
46
47void osd_sound_enable(int enable)
48{
49}
50
51int osd_is_code_pressed(int code)
52{
53   return 0;
54}
55
56int osd_is_key_pressed(int keycode)
57{
58   return 0;
59}
60
61int osd_readkey_unicode(int flush)
62{
63   return 0;
64}
65
66int osd_is_joystick_axis_code(int joycode)
67{
68   return 0;
69}
70
71int osd_joystick_needs_calibration(void)
72{
73   return 0;
74}
75
76void osd_joystick_start_calibration(void)
77{
78}
79
80const char *osd_joystick_calibrate_next(void)
81{
82   return NULL;
83}
84
85void osd_joystick_calibrate(void)
86{
87}
88
89void osd_joystick_end_calibration(void)
90{
91}
92
93void osd_lightgun_read(int player, int *deltax, int *deltay)
94{
95}
96
97void osd_trak_read(int player, int *deltax, int *deltay)
98{
99}
100#endif
101
10217void osd_customize_inputport_list(input_port_default_entry *defaults)
10318{
10419}
10520
106#ifdef UNUSED_FUNCTION
107void osd_logerror(const char *text)
108{
109}
110#endif
111
11221int osd_keyboard_disabled(void)
11322{
11423   return 0;
11524}
11625
117#ifdef UNUSED_FUNCTION
118void osd_begin_final_unloading(void)
119{
120}
121
122void osd_image_load_status_changed(const device_config *img, int is_final_unload)
123{
124}
125#endif
126
12726#ifdef ENABLE_DEBUGGER
12827void osd_wait_for_debugger(void)
12928{
r2535r2536
13130}
13231#endif // ENABLE_DEBUGGER
13332
134#ifdef UNUSED_FUNCTION
135int win_mess_config_init(void)
136{
137   return 0;
138}
139#endif
140
14133void osd_break_into_debugger(const char *message)
14234{
14335}
14436
145#ifdef UNUSED_FUNCTION
146void win_mess_options_init(void)
147{
148}
149#endif
15037
15138//============================================================
15239//   osd_alloc_executable
r2535r2536
20289{
20390}
20491
205
206#ifdef UNUSED_FUNCTION
207void osd_mess_config_init(running_machine *machine)
92void osd_paste(running_machine *machine)
20893{
20994}
210#endif
src/mess/osd/windows/menu.c
r2535r2536
921921
922922
923923//============================================================
924//   paste
925//============================================================
926
927static void paste(void)
928{
929   HANDLE h;
930   LPSTR text;
931   size_t mb_size;
932   size_t w_size;
933   LPWSTR wtext;
934
935   if (!OpenClipboard(NULL))
936      return;
937
938   h = GetClipboardData(CF_TEXT);
939   if (h)
940   {
941      text = GlobalLock(h);
942      if (text)
943      {
944         mb_size = strlen(text);
945         w_size = MultiByteToWideChar(CP_ACP, 0, text, mb_size, NULL, 0);
946         wtext = (LPWSTR) alloca(w_size * sizeof(WCHAR));
947         MultiByteToWideChar(CP_ACP, 0, text, mb_size, wtext, w_size);
948         inputx_postn_utf16(wtext, w_size);
949         GlobalUnlock(h);
950      }
951   }
952
953   CloseClipboard();
954}
955
956
957
958//============================================================
959924//   pause
960925//============================================================
961926
r2535r2536
17061671         break;
17071672
17081673      case ID_EDIT_PASTE:
1709         paste();
1674         PostMessage(wnd, WM_PASTE, 0, 0);
17101675         break;
17111676
17121677      case ID_KEYBOARD_NATURAL:
r2535r2536
21532118            inputx_postc(wparam);
21542119         break;
21552120
2121      case WM_PASTE:
2122         ui_paste(Machine);
2123         break;
2124
21562125      case WM_COMMAND:
21572126         if (invoke_command(Machine, wnd, wparam))
21582127            break;
src/mess/osd/windows/winmess.c
r2535r2536
88#include "winutil.h"
99#include "strconv.h"
1010#include "winutf8.h"
11#include "inputx.h"
1112
1213
1314//============================================================
r2535r2536
315316
316317
317318
318/* ************************************************************************ */
319/* Directories                                                              */
320/* ************************************************************************ */
319//============================================================
320//  CLIPBOARD
321//============================================================
321322
323//============================================================
324//   get_clipboard_text_by_format
325//============================================================
326
327static char *get_clipboard_text_by_format(UINT format, char *(*convert)(LPCVOID data))
328{
329   char *result = NULL;
330   HANDLE data_handle;
331   LPVOID data;
332
333   // check to see if this format is available
334   if (IsClipboardFormatAvailable(format))
335   {
336      // open the clipboard
337      if (OpenClipboard(NULL))
338      {
339         // try to access clipboard data
340         data_handle = GetClipboardData(format);
341         if (data_handle != NULL)
342         {
343            // lock the data
344            data = GlobalLock(data_handle);
345            if (data != NULL)
346            {
347               // invoke the convert
348               result = (*convert)(data);
349
350               // unlock the data
351               GlobalUnlock(data_handle);
352            }
353         }
354
355         // close out the clipboard
356         CloseClipboard();
357      }
358   }
359   return result;
360}
361
362
363
364//============================================================
365//   convert_wide
366//============================================================
367
368static char *convert_wide(LPCVOID data)
369{
370   return utf8_from_wstring((LPCWSTR) data);
371}
372
373
374
375//============================================================
376//   convert_ansi
377//============================================================
378
379static char *convert_ansi(LPCVOID data)
380{
381   return utf8_from_astring((LPCSTR) data);
382}
383
384
385
386//============================================================
387//   osd_get_clipboard_text
388//============================================================
389
390char *osd_get_clipboard_text(void)
391{
392   char *result = NULL;
393
394   // try to access unicode text
395   if (result == NULL)
396      result = get_clipboard_text_by_format(CF_UNICODETEXT, convert_wide);
397
398   // try to access ANSI text
399   if (result == NULL)
400      result = get_clipboard_text_by_format(CF_TEXT, convert_ansi);
401
402   return result;
403}
404
405
406
407//============================================================
408//  DIRECTORIES
409//============================================================
410
322411#ifdef UNDER_CE
323412int osd_num_devices(void)
324413{
src/mess/osdmess.h
r2535r2536
211211/* returns 1 if input of type IPT_KEYBOARD should be supressed */
212212int osd_keyboard_disabled(void);
213213
214/* reads text from the clipboard - the returned string needs to be free()-ed! */
215char *osd_get_clipboard_text(void);
214216
217
218
215219/******************************************************************************
216220
217221  Device and file browsing
docs/messnew.txt
r2535r2536
7878- Fixed bug in file selector that could cause paths to contain extraneous
7979  separators.  (bug #1595) [Nate Woods]
8080
81- Shift+ScrollLock now triggers a paste command.  [Nate Woods]
82
8183- [Windows] Fixed "Configure..." dialog problem when customizing certain
8284  system's controllers.  (bugs #1570, #1573) [Nate Woods]
8385
r2535r2536
126128
127129- Converted HD63450 DMA controller to the new device system.  [Barry Rodewald]
128130
131- New MESS specific OSD call:  osd_get_clipboard_text().  [Nate Woods]
129132
130133
134
1311350.124a
132136
133137New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team